From 1792163d55e85b8c42be05a4b9ce5f4d880ff29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Tue, 6 Mar 2018 14:18:26 +0100 Subject: [PATCH] #2474 Fractures. Do not store object name to project file --- .../ProjectDataModel/CMakeLists_files.cmake | 2 + .../ProjectDataModel/RimCheckableObject.cpp | 61 +++++++++++++++++++ .../ProjectDataModel/RimCheckableObject.h | 44 +++++++++++++ .../ProjectDataModel/RimStimPlanColors.cpp | 5 +- .../ProjectDataModel/RimStimPlanColors.h | 4 +- 5 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 ApplicationCode/ProjectDataModel/RimCheckableObject.cpp create mode 100644 ApplicationCode/ProjectDataModel/RimCheckableObject.h diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index ee0a98820c..10c888ad6f 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -87,6 +87,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMdiWindowController.h ${CMAKE_CURRENT_LIST_DIR}/RimPropertyFilter.h ${CMAKE_CURRENT_LIST_DIR}/RimNamedObject.h ${CMAKE_CURRENT_LIST_DIR}/RimCheckableNamedObject.h +${CMAKE_CURRENT_LIST_DIR}/RimCheckableObject.h ${CMAKE_CURRENT_LIST_DIR}/RimGridTimeHistoryCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimGeometrySelectionItem.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseGeometrySelectionItem.h @@ -188,6 +189,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMdiWindowController.cpp ${CMAKE_CURRENT_LIST_DIR}/RimPropertyFilter.cpp ${CMAKE_CURRENT_LIST_DIR}/RimNamedObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCheckableNamedObject.cpp +${CMAKE_CURRENT_LIST_DIR}/RimCheckableObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimGridTimeHistoryCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimGeometrySelectionItem.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseGeometrySelectionItem.cpp diff --git a/ApplicationCode/ProjectDataModel/RimCheckableObject.cpp b/ApplicationCode/ProjectDataModel/RimCheckableObject.cpp new file mode 100644 index 0000000000..33946e0508 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimCheckableObject.cpp @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RimCheckableObject.h" + +CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimCheckableObject, "RimCheckableObject"); // Do not use. Abstract class + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCheckableObject::RimCheckableObject(void) +{ + CAF_PDM_InitField(&m_isChecked, "IsChecked", true, "Active", "", "", ""); + m_isChecked.uiCapability()->setUiHidden(true); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCheckableObject::~RimCheckableObject(void) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimCheckableObject::isChecked() const +{ + return m_isChecked(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimCheckableObject::setCheckState(bool checkState) +{ + m_isChecked = checkState; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimCheckableObject::objectToggleField() +{ + return &m_isChecked; +} diff --git a/ApplicationCode/ProjectDataModel/RimCheckableObject.h b/ApplicationCode/ProjectDataModel/RimCheckableObject.h new file mode 100644 index 0000000000..d2ed97adfa --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimCheckableObject.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +#include + +//================================================================================================== +/// +/// +//================================================================================================== +class RimCheckableObject : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; +public: + RimCheckableObject(void); + virtual ~RimCheckableObject(void); + + bool isChecked() const; + void setCheckState(bool checkState); + +protected: + virtual caf::PdmFieldHandle* objectToggleField() override; + +protected: + caf::PdmField m_isChecked; +}; + diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp index 5f064f4869..5d713b2b99 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimStimPlanColors.cpp @@ -64,7 +64,7 @@ static QString toString(const std::pair& resultNameAndUnit); //-------------------------------------------------------------------------------------------------- RimStimPlanColors::RimStimPlanColors() { - CAF_PDM_InitObject("StimPlan Colors", ":/FractureSymbol16x16.png", "", ""); + CAF_PDM_InitObject("Fractures", ":/FractureSymbol16x16.png", "", ""); CAF_PDM_InitField(&m_resultNameAndUnit, "ResultName", QString(""), "Result Variable", "", "", ""); @@ -76,9 +76,6 @@ RimStimPlanColors::RimStimPlanColors() CAF_PDM_InitField(&m_showStimPlanMesh, "ShowStimPlanMesh", true, "Show Mesh", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_stimPlanCellVizMode, "StimPlanCellVizMode", "Color Interpolation", "", "", ""); - - setName("Fractures"); - nameField()->uiCapability()->setUiReadOnly(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanColors.h b/ApplicationCode/ProjectDataModel/RimStimPlanColors.h index 8da9052202..fb40eb701f 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanColors.h +++ b/ApplicationCode/ProjectDataModel/RimStimPlanColors.h @@ -18,7 +18,7 @@ #pragma once -#include "RimCheckableNamedObject.h" +#include "RimCheckableObject.h" #include "cafAppEnum.h" #include "cafPdmChildField.h" @@ -40,7 +40,7 @@ class RimFractureTemplateCollection; /// /// //================================================================================================== -class RimStimPlanColors : public RimCheckableNamedObject +class RimStimPlanColors : public RimCheckableObject { CAF_PDM_HEADER_INIT;