From aef913739c0f07b6c5228b3f5b55ea8c29d151c6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 17 Feb 2017 09:28:46 +0100 Subject: [PATCH] #1230 Added StimPlan legend configuration object --- .../ProjectDataModel/CMakeLists_files.cmake | 3 +- .../ProjectDataModel/RimLegendConfig.h | 3 + .../RimStimPlanLegendConfig.cpp | 93 +++++++++++++++++++ .../RimStimPlanLegendConfig.h | 55 +++++++++++ 4 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.cpp create mode 100644 ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.h diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 283e2dd2a6..0a06dbf445 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -94,7 +94,7 @@ ${CEE_CURRENT_LIST_DIR}RimSimWellFractureCollection.h ${CEE_CURRENT_LIST_DIR}RimFractureExportSettings.h ${CEE_CURRENT_LIST_DIR}RimFractureTemplate.h ${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.h - +${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -187,6 +187,7 @@ ${CEE_CURRENT_LIST_DIR}RimSimWellFractureCollection.cpp ${CEE_CURRENT_LIST_DIR}RimFractureExportSettings.cpp ${CEE_CURRENT_LIST_DIR}RimFractureTemplate.cpp ${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.cpp +${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.cpp ) diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.h b/ApplicationCode/ProjectDataModel/RimLegendConfig.h index c5a2eef632..79e58668f3 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.h @@ -121,7 +121,10 @@ public: protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void initAfterRead(); + + friend class RimStimPlanLegendConfig; virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly); private: diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.cpp new file mode 100644 index 0000000000..29198e740b --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.cpp @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 - 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimStimPlanLegendConfig.h" + +#include "RimLegendConfig.h" + +#include "cafPdmUiOrdering.h" +#include "cafPdmUiTreeOrdering.h" + + +CAF_PDM_SOURCE_INIT(RimStimPlanLegendConfig, "RimStimPlanLegendConfig"); + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimStimPlanLegendConfig::RimStimPlanLegendConfig() +{ + CAF_PDM_InitObject("StimPlan Legend Definition", ":/Legend.png", "", ""); + + CAF_PDM_InitField(&m_name, "Name", QString("StimPlan Legend"), "Name", "", "", ""); + m_name.uiCapability()->setUiReadOnly(true); + + CAF_PDM_InitFieldNoDefault(&m_legend, "Legend", "Legend", "", "", ""); + m_legend = new RimLegendConfig; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimStimPlanLegendConfig::~RimStimPlanLegendConfig() +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimStimPlanLegendConfig::name() const +{ + return m_name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStimPlanLegendConfig::setName(const QString& name) +{ + m_name = name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimStimPlanLegendConfig::userDescriptionField() +{ + return &m_name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStimPlanLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + uiOrdering.add(&m_name); + + m_legend->defineUiOrdering(uiConfigName, uiOrdering); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStimPlanLegendConfig::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) +{ + uiTreeOrdering.setForgetRemainingFields(true); +} + diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.h b/ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.h new file mode 100644 index 0000000000..7f8afa26a8 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimStimPlanLegendConfig.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 - 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafAppEnum.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmChildField.h" + + +class RimLegendConfig; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimStimPlanLegendConfig : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimStimPlanLegendConfig(); + virtual ~RimStimPlanLegendConfig(); + + QString name() const; + void setName(const QString& name); + + + virtual caf::PdmFieldHandle* userDescriptionField() override; + +protected: + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; + +private: + caf::PdmField m_name; + caf::PdmChildField m_legend; + +};