#1032 Well Log Plot - added Change Data Source feature for extraction curves

This commit is contained in:
Magne Sjaastad 2016-12-17 16:45:02 +01:00
parent c698206194
commit ac4f21318c
6 changed files with 277 additions and 0 deletions

View File

@ -18,6 +18,8 @@ ${CEE_CURRENT_LIST_DIR}RicWellLogPlotTrackFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicPasteWellLogCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.h
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -34,6 +36,8 @@ ${CEE_CURRENT_LIST_DIR}RicWellLogPlotTrackFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicPasteWellLogCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.cpp
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,98 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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 "RicChangeDataSourceFeature.h"
#include "RicChangeDataSourceFeatureUi.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RimCase.h"
#include "RimWellLogCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPath.h"
#include "cafPdmUiPropertyViewDialog.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicChangeDataSourceFeature, "RicChangeDataSourceFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicChangeDataSourceFeature::isCommandEnabled()
{
std::vector<RimWellLogExtractionCurve*> extrCurves = extractionCurves();
return extrCurves.size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicChangeDataSourceFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellLogExtractionCurve*> extrCurves = extractionCurves();
if (extrCurves.size() == 0) return;
RicChangeDataSourceFeatureUi featureUi;
featureUi.wellPathToApply = extrCurves[0]->wellPath();
featureUi.caseToApply = extrCurves[0]->rimCase();
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Change Data Source for Selected Curves", "");
propertyDialog.resize(QSize(500, 200));
if (propertyDialog.exec() == QDialog::Accepted)
{
for (RimWellLogExtractionCurve* extractionCurve : extrCurves)
{
extractionCurve->setWellPath(featureUi.wellPathToApply);
extractionCurve->setCase(featureUi.caseToApply);
extractionCurve->loadDataAndUpdate();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicChangeDataSourceFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Change Data Source");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogExtractionCurve*> RicChangeDataSourceFeature::extractionCurves()
{
std::vector<RimWellLogExtractionCurve*> extrCurves;
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
for (RimWellLogCurve* c : curves)
{
if (dynamic_cast<RimWellLogExtractionCurve*>(c))
{
extrCurves.push_back(dynamic_cast<RimWellLogExtractionCurve*>(c));
}
}
return extrCurves;
}

View File

@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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 RimWellLogExtractionCurve;
//==================================================================================================
///
//==================================================================================================
class RicChangeDataSourceFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
static std::vector<RimWellLogExtractionCurve*> extractionCurves();
};

View File

@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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 "RicChangeDataSourceFeatureUi.h"
#include "RimCase.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiaApplication.h"
CAF_PDM_SOURCE_INIT(RicChangeDataSourceFeatureUi, "ChangeDataSourceFeatureUi");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicChangeDataSourceFeatureUi::RicChangeDataSourceFeatureUi()
{
CAF_PDM_InitObject("Change Data Source", "", "", "");
CAF_PDM_InitFieldNoDefault(&wellPathToApply, "CurveWellPath", "Well Path", "", "", "");
CAF_PDM_InitFieldNoDefault(&caseToApply, "CurveCase", "Case", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RicChangeDataSourceFeatureUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> optionList;
if (fieldNeedingOptions == &caseToApply)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimCase*> cases;
proj->allCases(cases);
for (RimCase* c : cases)
{
optionList.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c));
}
}
else if (fieldNeedingOptions == &wellPathToApply)
{
RimProject* proj = RiaApplication::instance()->project();
if (proj->activeOilField()->wellPathCollection())
{
for (RimWellPath* wellPath : proj->activeOilField()->wellPathCollection()->wellPaths)
{
optionList.push_back(caf::PdmOptionItemInfo(wellPath->name(), wellPath));
}
}
}
return optionList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicChangeDataSourceFeatureUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Apply the following for all selected curves");
group->add(&caseToApply);
group->add(&wellPathToApply);
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// 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 "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafPdmUiOrdering.h"
class RimCase;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicChangeDataSourceFeatureUi : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicChangeDataSourceFeatureUi();
caf::PdmPtrField<RimCase*> caseToApply;
caf::PdmPtrField<RimWellPath*> wellPathToApply;
protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
};

View File

@ -393,6 +393,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
commandIds << "RicCopyReferencesToClipboardFeature";
commandIds << "RicExportToLasFileFeature";
commandIds << "RicChangeDataSourceFeature";
}
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
{