mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1032 WLP : Moved function to CurveFeatureImpl
This commit is contained in:
parent
0e13d653cb
commit
7fe9357b0f
@ -24,6 +24,8 @@
|
||||
#include "RigLasFileExporter.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -39,7 +41,7 @@ CAF_CMD_SOURCE_INIT(RicExportToLasFileFeature, "RicExportToLasFileFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportToLasFileFeature::isCommandEnabled()
|
||||
{
|
||||
return selectedWellLogCurves().size() > 0;
|
||||
return RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -47,7 +49,7 @@ bool RicExportToLasFileFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellLogCurve*> curves = selectedWellLogCurves();
|
||||
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
||||
if (curves.size() == 0) return;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
@ -103,39 +105,3 @@ void RicExportToLasFileFeature::setupActionLook(QAction* actionToSetup)
|
||||
actionToSetup->setText("Export To LAS Files...");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogCurve*> RicExportToLasFileFeature::selectedWellLogCurves() const
|
||||
{
|
||||
std::set<RimWellLogCurve*> curveSet;
|
||||
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems(selectedItems);
|
||||
|
||||
for (auto selectedItem : selectedItems)
|
||||
{
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selectedItem);
|
||||
if (objHandle)
|
||||
{
|
||||
std::vector<RimWellLogCurve*> childCurves;
|
||||
objHandle->descendantsIncludingThisOfType(childCurves);
|
||||
|
||||
for (auto curve : childCurves)
|
||||
{
|
||||
curveSet.insert(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
for (auto curve : curveSet)
|
||||
{
|
||||
allCurves.push_back(curve);
|
||||
}
|
||||
|
||||
return allCurves;
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,5 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimWellLogCurve*> selectedWellLogCurves() const;
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
|
||||
@ -52,3 +56,39 @@ cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromTable()
|
||||
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
|
||||
return cvfColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves()
|
||||
{
|
||||
std::set<RimWellLogCurve*> curveSet;
|
||||
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems(selectedItems);
|
||||
|
||||
for (caf::PdmUiItem* selectedItem : selectedItems)
|
||||
{
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selectedItem);
|
||||
if (objHandle)
|
||||
{
|
||||
std::vector<RimWellLogCurve*> childCurves;
|
||||
objHandle->descendantsIncludingThisOfType(childCurves);
|
||||
|
||||
for (RimWellLogCurve* curve : childCurves)
|
||||
{
|
||||
curveSet.insert(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
for (RimWellLogCurve* curve : curveSet)
|
||||
{
|
||||
allCurves.push_back(curve);
|
||||
}
|
||||
|
||||
return allCurves;
|
||||
}
|
||||
|
@ -21,12 +21,14 @@
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
class RimWellLogCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellLogPlotCurveFeatureImpl
|
||||
{
|
||||
|
||||
public:
|
||||
static cvf::Color3f curveColorFromTable();
|
||||
static std::vector<RimWellLogCurve*> selectedWellLogCurves();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user