From 9596f6c0a472253196486c6e474a2ec14b50a144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Sat, 16 May 2015 08:45:50 +0200 Subject: [PATCH] Added init after read for GeoMechView/Case And finalized moving the caseUserDescription field All in order to get project load to work. Nearly there. Animation frame is not restored though. --- ApplicationCode/ProjectDataModel/RimCase.h | 1 + .../ProjectDataModel/RimEclipseCase.h | 2 +- .../ProjectDataModel/RimGeoMechCase.cpp | 24 ++++++++++++------- .../ProjectDataModel/RimGeoMechCase.h | 4 +--- .../ProjectDataModel/RimGeoMechView.cpp | 10 ++++++++ .../ProjectDataModel/RimGeoMechView.h | 1 + 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimCase.h b/ApplicationCode/ProjectDataModel/RimCase.h index 7a4466849d..10fd3efc13 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.h +++ b/ApplicationCode/ProjectDataModel/RimCase.h @@ -39,6 +39,7 @@ public: virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0; + virtual caf::PdmFieldHandle* userDescriptionField() { return &caseUserDescription; } protected: static QString relocateFile(const QString& fileName, const QString& newProjectPath, const QString& oldProjectPath, bool* foundFile, std::vector* searchedPaths); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index 716ade400e..0b0e7e029e 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -83,7 +83,7 @@ public: // Overridden methods from PdmObject public: - virtual caf::PdmFieldHandle* userDescriptionField() { return &caseUserDescription; } + protected: virtual void initAfterRead(); virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 95aeeabd3e..c6f8613457 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -33,7 +33,6 @@ RimGeoMechCase::RimGeoMechCase(void) { CAF_PDM_InitObject("Geomechanical Case", ":/GeoMechCase48x48.png", "", ""); - CAF_PDM_InitField(&caseUserDescription, "CaseUserDescription", QString(), "Case name", "", "" ,""); CAF_PDM_InitField(&m_caseFileName, "CaseFileName", QString(), "Case file name", "", "", ""); m_caseFileName.setUiReadOnly(true); CAF_PDM_InitFieldNoDefault(&geoMechViews, "GeoMechViews", "", "", "", ""); @@ -63,14 +62,6 @@ RimGeoMechView* RimGeoMechCase::createAndAddReservoirView() return gmv; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimGeoMechCase::userDescriptionField() -{ - return &caseUserDescription; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -123,3 +114,18 @@ std::vector RimGeoMechCase::views() return views; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechCase::initAfterRead() +{ + size_t j; + for (j = 0; j < geoMechViews().size(); j++) + { + RimGeoMechView* riv = geoMechViews()[j]; + CVF_ASSERT(riv); + + riv->setGeoMechCase(this); + } + +} diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h index 50f23f4ba3..7602a67803 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -53,12 +53,10 @@ public: virtual std::vector views(); // Fields: - caf::PdmField caseUserDescription; caf::PdmPointersField geoMechViews; private: - virtual caf::PdmFieldHandle* userDescriptionField(); - + virtual void initAfterRead(); private: cvf::ref m_geoMechCaseData; caf::PdmField m_caseFileName; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index f7bf98fd50..3946680822 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -450,6 +450,16 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechView::initAfterRead() +{ + this->cellResult()->setReservoirView(this); + + this->updateUiIconFromToggleField(); +} + //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.h b/ApplicationCode/ProjectDataModel/RimGeoMechView.h index 3bfe612f0f..aeb91e2637 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.h @@ -81,6 +81,7 @@ private: void updateLegends(); virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); + virtual void initAfterRead(); caf::PdmPointer m_geomechCase; cvf::ref m_geoMechFullModel;