mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#436) Added feature that creates a plot with a given LAS file log
This commit is contained in:
parent
9cd4c1efb8
commit
e4212a1135
@ -46,6 +46,7 @@ ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||
@ -104,6 +105,7 @@ ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||
|
155
ApplicationCode/Commands/RicAddWellLogToPlotFeature.cpp
Normal file
155
ApplicationCode/Commands/RicAddWellLogToPlotFeature.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicAddWellLogToPlotFeature.h"
|
||||
|
||||
#include "RimWellLasFileInfo.h"
|
||||
#include "RimWellLog.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotTrace.h"
|
||||
#include "RimWellLogFileCurve.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuWellLogTracePlot.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
CAF_CMD_SOURCE_INIT(RicAddWellLogToPlotFeature, "RicAddWellLogToPlotFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddWellLogToPlotFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellLog*> selection = selectedWellLogs();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellLog*> selection = selectedWellLogs();
|
||||
if (selection.size() < 1) return;
|
||||
|
||||
RimWellLogPlot* plot = createWellLogPlot();
|
||||
|
||||
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace();
|
||||
plot->addTrace(plotTrace);
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
for (size_t wlIdx = 0; wlIdx < selection.size(); wlIdx++)
|
||||
{
|
||||
RimWellLog* wellLog = selection[wlIdx];
|
||||
|
||||
RimWellLasFileInfo* lasFileInfo;
|
||||
wellLog->firstAnchestorOrThisOfType(lasFileInfo);
|
||||
if (lasFileInfo)
|
||||
{
|
||||
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
|
||||
plotTrace->addCurve(curve);
|
||||
|
||||
curve->setCurveData(lasFileInfo->logValues(wellLog->name()), lasFileInfo->depthValues());
|
||||
curve->setDescription(wellLog->name());
|
||||
curve->updatePlotData();
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddWellLogToPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Add To Plot");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLog*> RicAddWellLogToPlotFeature::selectedWellLogs()
|
||||
{
|
||||
std::vector<RimWellLog*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
return selection;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMainPlotCollection* RicAddWellLogToPlotFeature::mainPlotCollection()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
if (!mainPlotColl)
|
||||
{
|
||||
project->recreateMainPlotCollection();
|
||||
}
|
||||
|
||||
return project->mainPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlotCollection* RicAddWellLogToPlotFeature::wellLogPlotCollection()
|
||||
{
|
||||
RimMainPlotCollection* mainPlotColl = mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection();
|
||||
if (!wellLogPlotColl)
|
||||
{
|
||||
mainPlotColl->recreateWellLogPlotCollection();
|
||||
}
|
||||
|
||||
return mainPlotColl->wellLogPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RicAddWellLogToPlotFeature::createWellLogPlot()
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
|
||||
CVF_ASSERT(wellLogPlotColl);
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
wellLogPlotColl->wellLogPlots().push_back(plot);
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
} // end namespace caf
|
56
ApplicationCode/Commands/RicAddWellLogToPlotFeature.h
Normal file
56
ApplicationCode/Commands/RicAddWellLogToPlotFeature.h
Normal file
@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimMainPlotCollection;
|
||||
class RimWellLogPlotCollection;
|
||||
class RimWellLogPlot;
|
||||
class RimWellLog;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAddWellLogToPlotFeature : public CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimWellLog*> selectedWellLogs();
|
||||
RimMainPlotCollection* mainPlotCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimWellLogPlot* createWellLogPlot();
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // end namespace caf
|
@ -70,6 +70,7 @@ ${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLasFileInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLog.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFileCurve.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -138,6 +139,7 @@ ${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLasFileInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLog.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFileCurve.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -627,6 +627,7 @@ void RimProject::computeUtmAreaOfInterest()
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotTrace.h"
|
||||
#include "RimWellLogPlotCurve.h"
|
||||
#include "RimWellLog.h"
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
@ -824,6 +825,10 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
{
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLog*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddWellLogToPlotFeature";
|
||||
}
|
||||
}
|
||||
|
||||
if (RicToggleItemsFeatureImpl::isToggleCommandsAvailable())
|
||||
|
@ -35,7 +35,8 @@ class RimWellLog : public caf::PdmObject
|
||||
public:
|
||||
RimWellLog();
|
||||
|
||||
void setName(const QString& name);
|
||||
void setName(const QString& name);
|
||||
QString name() const { return m_name; }
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_name; }
|
||||
|
||||
|
56
ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp
Normal file
56
ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellLogFileCurve.h"
|
||||
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellLogFileCurve, "WellLogFileCurve");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogFileCurve::RimWellLogFileCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Well Log File Curve", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogFileCurve::~RimWellLogFileCurve()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::updatePlotData()
|
||||
{
|
||||
RimWellLogPlotCurve::updatePlotData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::setCurveData(const std::vector<double>& values, const std::vector<double>& depthValues)
|
||||
{
|
||||
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
|
||||
}
|
43
ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h
Normal file
43
ApplicationCode/ProjectDataModel/RimWellLogFileCurve.h
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimWellLogPlotCurve.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogFileCurve : public RimWellLogPlotCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellLogFileCurve();
|
||||
virtual ~RimWellLogFileCurve();
|
||||
|
||||
virtual void updatePlotData();
|
||||
|
||||
void setCurveData(const std::vector<double>& values, const std::vector<double>& depthValues);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user