#1032 WLP : Moved function to CurveFeatureImpl

This commit is contained in:
Magne Sjaastad
2016-12-17 16:29:36 +01:00
parent 0e13d653cb
commit 7fe9357b0f
4 changed files with 47 additions and 42 deletions

View File

@@ -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;
}