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.
This commit is contained in:
Jacob Støren 2015-05-16 08:45:50 +02:00
parent 5e44826206
commit 9596f6c0a4
6 changed files with 29 additions and 13 deletions

View File

@ -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<QString>* searchedPaths);

View File

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

View File

@ -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<RimView*> 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);
}
}

View File

@ -53,12 +53,10 @@ public:
virtual std::vector<RimView*> views();
// Fields:
caf::PdmField<QString> caseUserDescription;
caf::PdmPointersField<RimGeoMechView*> geoMechViews;
private:
virtual caf::PdmFieldHandle* userDescriptionField();
virtual void initAfterRead();
private:
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
caf::PdmField<QString> m_caseFileName;

View File

@ -450,6 +450,16 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechView::initAfterRead()
{
this->cellResult()->setReservoirView(this);
this->updateUiIconFromToggleField();
}
//--------------------------------------------------------------------------------------------------
///

View File

@ -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<RimGeoMechCase> m_geomechCase;
cvf::ref<RivGeoMechPartMgr> m_geoMechFullModel;