mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Project/OilField: Made sure one and always one oilfield exists in a project.
p4#: 21884
This commit is contained in:
parent
3cfbc9f25e
commit
a9d2baf117
@ -63,16 +63,8 @@ RimOilField::RimOilField(void)
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimOilField::~RimOilField(void)
|
RimOilField::~RimOilField(void)
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimOilField::close()
|
|
||||||
{
|
{
|
||||||
if (wellPathCollection()) delete wellPathCollection();
|
if (wellPathCollection()) delete wellPathCollection();
|
||||||
if (analysisModels()) delete analysisModels();
|
if (analysisModels()) delete analysisModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,5 +43,4 @@ public:
|
|||||||
caf::PdmField<RimAnalysisModels*> analysisModels;
|
caf::PdmField<RimAnalysisModels*> analysisModels;
|
||||||
caf::PdmField<RimWellPathCollection*> wellPathCollection;
|
caf::PdmField<RimWellPathCollection*> wellPathCollection;
|
||||||
|
|
||||||
void close();
|
|
||||||
};
|
};
|
||||||
|
@ -55,9 +55,6 @@ CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimProject::RimProject(void)
|
RimProject::RimProject(void)
|
||||||
{
|
{
|
||||||
CAF_PDM_InitFieldNoDefault(&oilFields, "OilFields", "Oil Fields", "", "", "");
|
|
||||||
oilFields.setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_projectFileVersionString, "ProjectFileVersionString", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_projectFileVersionString, "ProjectFileVersionString", "", "", "", "");
|
||||||
m_projectFileVersionString.setUiHidden(true);
|
m_projectFileVersionString.setUiHidden(true);
|
||||||
|
|
||||||
@ -67,12 +64,8 @@ RimProject::RimProject(void)
|
|||||||
CAF_PDM_InitField(&nextValidCaseGroupId, "NextValidCaseGroupId", 0, "Next Valid Case Group ID", "", "" ,"");
|
CAF_PDM_InitField(&nextValidCaseGroupId, "NextValidCaseGroupId", 0, "Next Valid Case Group ID", "", "" ,"");
|
||||||
nextValidCaseGroupId.setUiHidden(true);
|
nextValidCaseGroupId.setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&casesObsolete, "Reservoirs", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&oilFields, "OilFields", "Oil Fields", "", "", "");
|
||||||
casesObsolete.setUiHidden(true);
|
oilFields.setUiHidden(true);
|
||||||
casesObsolete.setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
|
||||||
CAF_PDM_InitFieldNoDefault(&caseGroupsObsolete, "CaseGroups", "", "", "", "");
|
|
||||||
caseGroupsObsolete.setUiHidden(true);
|
|
||||||
caseGroupsObsolete.setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
|
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
|
||||||
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
||||||
@ -81,6 +74,16 @@ RimProject::RimProject(void)
|
|||||||
CAF_PDM_InitFieldNoDefault(¤tModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(¤tModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");
|
||||||
currentModelIndexPath.setUiHidden(true);
|
currentModelIndexPath.setUiHidden(true);
|
||||||
|
|
||||||
|
// Obsolete fields. The content is moved to OilFields and friends
|
||||||
|
CAF_PDM_InitFieldNoDefault(&casesObsolete, "Reservoirs", "", "", "", "");
|
||||||
|
casesObsolete.setUiHidden(true);
|
||||||
|
casesObsolete.setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
||||||
|
CAF_PDM_InitFieldNoDefault(&caseGroupsObsolete, "CaseGroups", "", "", "", "");
|
||||||
|
caseGroupsObsolete.setUiHidden(true);
|
||||||
|
caseGroupsObsolete.setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
||||||
|
|
||||||
|
// Initialization
|
||||||
|
|
||||||
scriptCollection = new RimScriptCollection();
|
scriptCollection = new RimScriptCollection();
|
||||||
scriptCollection->directory.setUiHidden(true);
|
scriptCollection->directory.setUiHidden(true);
|
||||||
|
|
||||||
@ -97,8 +100,8 @@ RimProject::~RimProject(void)
|
|||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
oilFields.deleteAllChildObjects();
|
||||||
if (scriptCollection()) delete scriptCollection();
|
if (scriptCollection()) delete scriptCollection();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -106,15 +109,9 @@ RimProject::~RimProject(void)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimProject::close()
|
void RimProject::close()
|
||||||
{
|
{
|
||||||
size_t numOilFields = oilFields().size();
|
|
||||||
for (size_t oilFieldsIdx = 0; oilFieldsIdx < numOilFields; oilFieldsIdx++)
|
|
||||||
{
|
|
||||||
RimOilField* oilField = oilFields[oilFieldsIdx];
|
|
||||||
if (oilField == NULL) continue;
|
|
||||||
|
|
||||||
oilField->close();
|
|
||||||
}
|
|
||||||
oilFields.deleteAllChildObjects();
|
oilFields.deleteAllChildObjects();
|
||||||
|
oilFields.push_back(new RimOilField);
|
||||||
|
|
||||||
casesObsolete.deleteAllChildObjects();
|
casesObsolete.deleteAllChildObjects();
|
||||||
caseGroupsObsolete.deleteAllChildObjects();
|
caseGroupsObsolete.deleteAllChildObjects();
|
||||||
|
|
||||||
@ -424,19 +421,9 @@ void RimProject::createDisplayModelAndRedrawAllViews()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimOilField* RimProject::activeOilField()
|
RimOilField* RimProject::activeOilField()
|
||||||
{
|
{
|
||||||
if (oilFields.size() > 1)
|
CVF_ASSERT(oilFields.size() == 1);
|
||||||
{
|
|
||||||
printf("ERROR: RimProject::activeOilField returns hardcoded first oil field, while oilFields actually contain more than one oil field! Must handle several oil fields in this method!\n");
|
return oilFields[0];
|
||||||
}
|
|
||||||
|
|
||||||
if (oilFields.size() > 0)
|
|
||||||
{
|
|
||||||
return oilFields[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user