2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-05-18 02:45:23 -05:00
|
|
|
//
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimProject.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
|
2015-08-01 16:04:04 -05:00
|
|
|
|
2013-03-22 10:24:42 -05:00
|
|
|
#include "RiaApplication.h"
|
2013-03-22 10:12:00 -05:00
|
|
|
#include "RiaVersionInfo.h"
|
2015-08-01 16:04:04 -05:00
|
|
|
|
2013-03-22 10:58:44 -05:00
|
|
|
#include "RigCaseData.h"
|
2015-08-01 16:04:04 -05:00
|
|
|
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RimCalcScript.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RimCaseCollection.h"
|
2015-08-01 16:04:04 -05:00
|
|
|
#include "RimCommandObject.h"
|
|
|
|
#include "RimEclipseCase.h"
|
|
|
|
#include "RimEclipseCaseCollection.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "RimEclipseInputProperty.h"
|
|
|
|
#include "RimEclipseInputPropertyCollection.h"
|
|
|
|
#include "RimEclipseStatisticsCase.h"
|
|
|
|
#include "RimEclipseStatisticsCaseCollection.h"
|
2015-08-01 16:04:04 -05:00
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimGeoMechCase.h"
|
|
|
|
#include "RimGeoMechModels.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RimIdenticalGridCaseGroup.h"
|
2015-10-13 03:24:11 -05:00
|
|
|
#include "RimViewController.h"
|
2015-09-07 07:29:46 -05:00
|
|
|
#include "RimMainPlotCollection.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimScriptCollection.h"
|
2015-09-07 07:29:46 -05:00
|
|
|
#include "RimViewLinker.h"
|
2015-09-08 03:17:35 -05:00
|
|
|
#include "RimViewLinkerCollection.h"
|
2015-09-07 07:29:46 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
#include "RimWellLogPlotCollection.h"
|
2015-08-12 13:59:38 -05:00
|
|
|
#include "RimWellPath.h"
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
#include "RimWellPathCollection.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RimWellPathImport.h"
|
2013-02-14 06:16:56 -06:00
|
|
|
|
2015-08-18 09:36:37 -05:00
|
|
|
#include "RiuMainWindow.h"
|
|
|
|
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "ToggleCommands/RicToggleItemsFeatureImpl.h"
|
|
|
|
#include "OctaveScriptCommands/RicExecuteScriptForCasesFeature.h"
|
|
|
|
|
|
|
|
#include "cafCmdFeature.h"
|
2015-08-06 08:55:17 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
|
|
|
|
2014-07-24 03:11:43 -05:00
|
|
|
#include <QDir>
|
2015-08-17 03:51:13 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimProject::RimProject(void)
|
|
|
|
{
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_projectFileVersionString, "ProjectFileVersionString", "", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
m_projectFileVersionString.uiCapability()->setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-05-08 03:41:56 -05:00
|
|
|
CAF_PDM_InitField(&nextValidCaseId, "NextValidCaseId", 0, "Next Valid Case ID", "", "" ,"");
|
2015-08-05 06:27:36 -05:00
|
|
|
nextValidCaseId.uiCapability()->setUiHidden(true);
|
2013-05-08 03:41:56 -05:00
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
CAF_PDM_InitField(&nextValidCaseGroupId, "NextValidCaseGroupId", 0, "Next Valid Case Group ID", "", "" ,"");
|
2015-08-05 06:27:36 -05:00
|
|
|
nextValidCaseGroupId.uiCapability()->setUiHidden(true);
|
2013-05-10 08:35:33 -05:00
|
|
|
|
2013-06-12 02:36:50 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&oilFields, "OilFields", "Oil Fields", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
oilFields.uiCapability()->setUiHidden(true);
|
2013-02-14 07:30:01 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
|
2015-08-20 08:48:37 -05:00
|
|
|
scriptCollection.uiCapability()->setUiHidden(true);
|
2013-04-19 06:20:46 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
treeViewState.uiCapability()->setUiHidden(true);
|
2013-04-26 12:05:35 -05:00
|
|
|
|
2013-09-06 06:06:39 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&wellPathImport, "WellPathImport", "WellPathImport", "", "", "");
|
|
|
|
wellPathImport = new RimWellPathImport();
|
2015-08-05 06:27:36 -05:00
|
|
|
wellPathImport.uiCapability()->setUiHidden(true);
|
|
|
|
wellPathImport.uiCapability()->setUiChildrenHidden(true);
|
2013-09-06 06:06:39 -05:00
|
|
|
|
2015-10-15 03:18:59 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&mainPlotCollection, "MainPlotCollection", "Plots", "", "", "");
|
2015-08-27 09:13:49 -05:00
|
|
|
mainPlotCollection.uiCapability()->setUiHidden(true);
|
|
|
|
|
2015-09-08 03:17:35 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&viewLinkerCollection, "LinkedViews", "Linked Views (field in RimProject", ":/chain.png", "", "");
|
|
|
|
viewLinkerCollection.uiCapability()->setUiHidden(true);
|
|
|
|
viewLinkerCollection = new RimViewLinkerCollection;
|
2015-09-01 10:14:22 -05:00
|
|
|
|
2013-09-12 01:11:56 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&commandObjects, "CommandObjects", "CommandObjects", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
//wellPathImport.uiCapability()->setUiHidden(true);
|
2013-09-12 01:11:56 -05:00
|
|
|
|
2013-04-26 12:05:35 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(¤tModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
currentModelIndexPath.uiCapability()->setUiHidden(true);
|
2013-04-19 06:20:46 -05:00
|
|
|
|
2013-06-12 02:36:50 -05:00
|
|
|
// Obsolete fields. The content is moved to OilFields and friends
|
|
|
|
CAF_PDM_InitFieldNoDefault(&casesObsolete, "Reservoirs", "", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
casesObsolete.uiCapability()->setUiHidden(true);
|
|
|
|
casesObsolete.xmlCapability()->setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
2013-06-12 02:36:50 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&caseGroupsObsolete, "CaseGroups", "", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
caseGroupsObsolete.uiCapability()->setUiHidden(true);
|
|
|
|
caseGroupsObsolete.xmlCapability()->setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
2013-06-12 02:36:50 -05:00
|
|
|
|
|
|
|
// Initialization
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
scriptCollection = new RimScriptCollection();
|
2015-08-05 06:27:36 -05:00
|
|
|
scriptCollection->directory.uiCapability()->setUiHidden(true);
|
2015-08-20 08:48:37 -05:00
|
|
|
scriptCollection->uiCapability()->setUiName("Scripts");
|
|
|
|
scriptCollection->uiCapability()->setUiIcon(QIcon(":/Default.png"));
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2015-08-27 09:13:49 -05:00
|
|
|
mainPlotCollection = new RimMainPlotCollection();
|
|
|
|
|
2013-06-07 07:54:02 -05:00
|
|
|
// For now, create a default first oilfield that contains the rest of the project
|
|
|
|
oilFields.push_back(new RimOilField);
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
initScriptDirectories();
|
2015-08-09 04:16:52 -05:00
|
|
|
|
|
|
|
this->setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimProject::~RimProject(void)
|
|
|
|
{
|
2013-02-14 06:16:56 -06:00
|
|
|
close();
|
|
|
|
|
2013-06-12 02:36:50 -05:00
|
|
|
oilFields.deleteAllChildObjects();
|
2012-05-18 02:45:23 -05:00
|
|
|
if (scriptCollection()) delete scriptCollection();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::close()
|
|
|
|
{
|
2015-09-03 13:13:08 -05:00
|
|
|
if (mainPlotCollection()) delete mainPlotCollection();
|
2013-06-06 08:07:31 -05:00
|
|
|
oilFields.deleteAllChildObjects();
|
2013-06-12 02:36:50 -05:00
|
|
|
oilFields.push_back(new RimOilField);
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
casesObsolete.deleteAllChildObjects();
|
|
|
|
caseGroupsObsolete.deleteAllChildObjects();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-10-24 02:53:27 -05:00
|
|
|
wellPathImport->regions().deleteAllChildObjects();
|
2013-09-06 08:59:25 -05:00
|
|
|
|
2013-09-13 03:42:27 -05:00
|
|
|
commandObjects.deleteAllChildObjects();
|
|
|
|
|
2015-09-16 07:26:25 -05:00
|
|
|
delete viewLinkerCollection->viewLinker();
|
|
|
|
viewLinkerCollection->viewLinker = NULL;
|
2015-09-04 04:22:44 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
fileName = "";
|
2013-05-08 03:41:56 -05:00
|
|
|
|
|
|
|
nextValidCaseId = 0;
|
2013-05-10 08:35:33 -05:00
|
|
|
nextValidCaseGroupId = 0;
|
2015-08-12 03:29:58 -05:00
|
|
|
currentModelIndexPath = "";
|
|
|
|
treeViewState = "";
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
void RimProject::initScriptDirectories()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
//
|
|
|
|
// TODO : Must store content of scripts in project file and notify user if stored content is different from disk on execute and edit
|
|
|
|
//
|
2013-03-22 09:50:44 -05:00
|
|
|
RiaApplication* app = RiaApplication::instance();
|
2013-04-24 00:35:31 -05:00
|
|
|
QString scriptDirectories = app->scriptDirectories();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-24 00:35:31 -05:00
|
|
|
this->setScriptDirectories(scriptDirectories);
|
2013-05-08 03:41:56 -05:00
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
// Find largest used caseId read from file and make sure all cases have a valid caseId
|
|
|
|
{
|
|
|
|
int largestId = -1;
|
2013-05-08 03:41:56 -05:00
|
|
|
|
2015-05-15 11:51:49 -05:00
|
|
|
std::vector<RimCase*> cases;
|
2013-05-10 08:35:33 -05:00
|
|
|
allCases(cases);
|
2013-05-08 03:41:56 -05:00
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
for (size_t i = 0; i < cases.size(); i++)
|
2013-05-08 03:41:56 -05:00
|
|
|
{
|
2013-05-10 08:35:33 -05:00
|
|
|
if (cases[i]->caseId > largestId)
|
|
|
|
{
|
|
|
|
largestId = cases[i]->caseId;
|
|
|
|
}
|
2013-05-08 03:41:56 -05:00
|
|
|
}
|
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
if (largestId > this->nextValidCaseId)
|
|
|
|
{
|
|
|
|
this->nextValidCaseId = largestId + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assign case Id to cases with an invalid case Id
|
|
|
|
for (size_t i = 0; i < cases.size(); i++)
|
|
|
|
{
|
|
|
|
if (cases[i]->caseId < 0)
|
|
|
|
{
|
|
|
|
assignCaseIdToCase(cases[i]);
|
|
|
|
}
|
|
|
|
}
|
2013-05-08 03:41:56 -05:00
|
|
|
}
|
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
// Find largest used groupId read from file and make sure all groups have a valid groupId
|
2015-06-25 05:11:06 -05:00
|
|
|
RimEclipseCaseCollection* analysisModels = activeOilField() ? activeOilField()->analysisModels() : NULL;
|
2013-06-06 08:07:31 -05:00
|
|
|
if (analysisModels)
|
2013-05-08 03:41:56 -05:00
|
|
|
{
|
2013-05-10 08:35:33 -05:00
|
|
|
int largestGroupId = -1;
|
2013-06-06 08:07:31 -05:00
|
|
|
|
|
|
|
for (size_t i = 0; i < analysisModels->caseGroups().size(); i++)
|
2013-05-10 08:35:33 -05:00
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups()[i];
|
2013-05-10 08:35:33 -05:00
|
|
|
|
|
|
|
if (cg->groupId > largestGroupId)
|
|
|
|
{
|
|
|
|
largestGroupId = cg->groupId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (largestGroupId > this->nextValidCaseGroupId)
|
2013-05-08 03:41:56 -05:00
|
|
|
{
|
2013-05-10 08:35:33 -05:00
|
|
|
this->nextValidCaseGroupId = largestGroupId + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assign group Id to groups with an invalid Id
|
2013-06-06 08:07:31 -05:00
|
|
|
for (size_t i = 0; i < analysisModels->caseGroups().size(); i++)
|
2013-05-10 08:35:33 -05:00
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups()[i];
|
2013-05-10 08:35:33 -05:00
|
|
|
|
|
|
|
if (cg->groupId < 0)
|
|
|
|
{
|
|
|
|
assignIdToCaseGroup(cg);
|
|
|
|
}
|
2013-05-08 03:41:56 -05:00
|
|
|
}
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::initAfterRead()
|
|
|
|
{
|
|
|
|
initScriptDirectories();
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
// Create an empty oil field in case the project did not contain one
|
|
|
|
if (oilFields.size() < 1)
|
|
|
|
{
|
|
|
|
oilFields.push_back(new RimOilField);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handle old project files with obsolete structure.
|
|
|
|
// Move caseGroupsObsolete and casesObsolete to oilFields()[idx]->analysisModels()
|
2015-06-25 05:11:06 -05:00
|
|
|
RimEclipseCaseCollection* analysisModels = activeOilField() ? activeOilField()->analysisModels() : NULL;
|
2013-06-06 08:07:31 -05:00
|
|
|
bool movedOneRimIdenticalGridCaseGroup = false;
|
|
|
|
for (size_t cgIdx = 0; cgIdx < caseGroupsObsolete.size(); ++cgIdx)
|
|
|
|
{
|
|
|
|
RimIdenticalGridCaseGroup* sourceCaseGroup = caseGroupsObsolete[cgIdx];
|
|
|
|
if (analysisModels)
|
|
|
|
{
|
|
|
|
analysisModels->caseGroups.push_back(sourceCaseGroup);
|
2013-06-12 03:52:46 -05:00
|
|
|
//printf("Moved m_project->caseGroupsObsolete[%i] to first oil fields analysis models\n", cgIdx);
|
2013-06-06 08:07:31 -05:00
|
|
|
movedOneRimIdenticalGridCaseGroup = true; // moved at least one so assume the others will be moved too...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (movedOneRimIdenticalGridCaseGroup)
|
|
|
|
{
|
|
|
|
caseGroupsObsolete.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool movedOneRimCase = false;
|
|
|
|
for (size_t cIdx = 0; cIdx < casesObsolete().size(); ++cIdx)
|
|
|
|
{
|
|
|
|
if (analysisModels)
|
|
|
|
{
|
2015-09-01 10:04:08 -05:00
|
|
|
RimEclipseCase* sourceCase = casesObsolete[cIdx];
|
|
|
|
casesObsolete.set(cIdx, NULL);
|
2013-06-06 08:07:31 -05:00
|
|
|
analysisModels->cases.push_back(sourceCase);
|
2013-06-12 03:52:46 -05:00
|
|
|
//printf("Moved m_project->casesObsolete[%i] to first oil fields analysis models\n", cIdx);
|
2013-06-06 08:07:31 -05:00
|
|
|
movedOneRimCase = true; // moved at least one so assume the others will be moved too...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (movedOneRimCase)
|
|
|
|
{
|
|
|
|
casesObsolete.clear();
|
|
|
|
}
|
2015-10-23 08:46:25 -05:00
|
|
|
|
|
|
|
if (casesObsolete().size() > 0 || caseGroupsObsolete.size() > 0)
|
|
|
|
{
|
|
|
|
//printf("RimProject::initAfterRead: Was not able to move all cases (%i left) or caseGroups (%i left) from Project to analysisModels",
|
|
|
|
// casesObsolete().size(), caseGroupsObsolete.size());
|
|
|
|
}
|
2013-06-06 08:07:31 -05:00
|
|
|
|
|
|
|
// Set project pointer to each well path
|
|
|
|
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
|
|
|
{
|
|
|
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
|
|
|
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
|
|
|
oilField->wellPathCollection->setProject(this);
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::setupBeforeSave()
|
|
|
|
{
|
|
|
|
m_projectFileVersionString = STRPRODUCTVER;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-24 00:35:31 -05:00
|
|
|
/// Support list of multiple script paths divided by ';'
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-24 00:35:31 -05:00
|
|
|
void RimProject::setScriptDirectories(const QString& scriptDirectories)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2012-06-26 09:10:41 -05:00
|
|
|
scriptCollection->calcScripts().deleteAllChildObjects();
|
|
|
|
scriptCollection->subDirectories().deleteAllChildObjects();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-24 00:35:31 -05:00
|
|
|
QStringList pathList = scriptDirectories.split(';');
|
|
|
|
foreach(QString path, pathList)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-24 00:35:31 -05:00
|
|
|
QDir dir(path);
|
|
|
|
if (!path.isEmpty() && dir.exists() && dir.isReadable())
|
|
|
|
{
|
|
|
|
RimScriptCollection* sharedScriptLocation = new RimScriptCollection;
|
|
|
|
sharedScriptLocation->directory = path;
|
|
|
|
sharedScriptLocation->setUiName(dir.dirName());
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-24 00:35:31 -05:00
|
|
|
sharedScriptLocation->readContentFromDisc();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-24 00:35:31 -05:00
|
|
|
scriptCollection->subDirectories.push_back(sharedScriptLocation);
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimProject::projectFileVersionString() const
|
|
|
|
{
|
|
|
|
return m_projectFileVersionString;
|
|
|
|
}
|
2013-02-14 06:16:56 -06:00
|
|
|
|
2013-04-23 01:11:52 -05:00
|
|
|
|
2013-04-08 01:44:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-08 05:01:40 -05:00
|
|
|
void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName)
|
2013-04-08 01:44:33 -05:00
|
|
|
{
|
2013-04-12 01:31:59 -05:00
|
|
|
// Extract the filename of the project file when it was saved
|
|
|
|
QString oldProjectFileName = this->fileName;
|
|
|
|
// Replace with the new actual filename
|
2013-04-08 05:01:40 -05:00
|
|
|
this->fileName = fileName;
|
|
|
|
|
|
|
|
QFileInfo fileInfo(fileName);
|
2013-04-12 01:31:59 -05:00
|
|
|
QString newProjectPath = fileInfo.path();
|
|
|
|
|
|
|
|
QFileInfo fileInfoOld(oldProjectFileName);
|
|
|
|
QString oldProjectPath = fileInfoOld.path();
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
// Loop over all cases and update file path
|
2013-04-08 05:01:40 -05:00
|
|
|
|
2015-05-15 11:51:49 -05:00
|
|
|
std::vector<RimCase*> cases;
|
2013-05-08 03:41:56 -05:00
|
|
|
allCases(cases);
|
|
|
|
for (size_t i = 0; i < cases.size(); i++)
|
2013-04-08 05:01:40 -05:00
|
|
|
{
|
2013-05-08 03:41:56 -05:00
|
|
|
cases[i]->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
2013-04-08 05:01:40 -05:00
|
|
|
}
|
2013-10-24 02:50:16 -05:00
|
|
|
|
|
|
|
// Update path to well path file cache
|
|
|
|
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
|
|
|
{
|
|
|
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
|
|
|
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
|
|
|
oilField->wellPathCollection->updateFilePathsFromProjectPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
wellPathImport->updateFilePaths();
|
2013-05-08 03:41:56 -05:00
|
|
|
}
|
2013-04-08 05:01:40 -05:00
|
|
|
|
2013-05-08 03:41:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-05-15 11:51:49 -05:00
|
|
|
void RimProject::assignCaseIdToCase(RimCase* reservoirCase)
|
2013-05-08 03:41:56 -05:00
|
|
|
{
|
|
|
|
if (reservoirCase)
|
|
|
|
{
|
|
|
|
reservoirCase->caseId = nextValidCaseId;
|
|
|
|
|
|
|
|
nextValidCaseId = nextValidCaseId + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup)
|
|
|
|
{
|
|
|
|
if (caseGroup)
|
|
|
|
{
|
|
|
|
caseGroup->groupId = nextValidCaseGroupId;
|
|
|
|
|
|
|
|
nextValidCaseGroupId = nextValidCaseGroupId + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-08 03:41:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-05-15 11:51:49 -05:00
|
|
|
void RimProject::allCases(std::vector<RimCase*>& cases)
|
2013-05-08 03:41:56 -05:00
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
2013-04-08 05:01:40 -05:00
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
RimOilField* oilField = oilFields[oilFieldIdx];
|
2015-05-15 11:51:49 -05:00
|
|
|
if (!oilField) continue;
|
2013-04-08 05:01:40 -05:00
|
|
|
|
2015-06-25 05:11:06 -05:00
|
|
|
RimEclipseCaseCollection* analysisModels = oilField->analysisModels();
|
2015-05-15 11:51:49 -05:00
|
|
|
if (analysisModels )
|
2013-05-08 03:41:56 -05:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
for (size_t caseIdx = 0; caseIdx < analysisModels->cases.size(); caseIdx++)
|
|
|
|
{
|
|
|
|
cases.push_back(analysisModels->cases[caseIdx]);
|
|
|
|
}
|
|
|
|
for (size_t cgIdx = 0; cgIdx < analysisModels->caseGroups.size(); cgIdx++)
|
2013-06-06 08:07:31 -05:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
// Load the Main case of each IdenticalGridCaseGroup
|
|
|
|
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups[cgIdx];
|
|
|
|
if (cg == NULL) continue;
|
|
|
|
|
2015-05-18 08:23:51 -05:00
|
|
|
if (cg->statisticsCaseCollection())
|
2015-05-15 11:51:49 -05:00
|
|
|
{
|
2015-05-18 08:23:51 -05:00
|
|
|
for (size_t caseIdx = 0; caseIdx < cg->statisticsCaseCollection()->reservoirs.size(); caseIdx++)
|
|
|
|
{
|
|
|
|
cases.push_back(cg->statisticsCaseCollection()->reservoirs[caseIdx]);
|
|
|
|
}
|
2015-05-15 11:51:49 -05:00
|
|
|
}
|
2015-05-18 08:23:51 -05:00
|
|
|
if (cg->caseCollection())
|
2015-05-15 11:51:49 -05:00
|
|
|
{
|
2015-05-18 08:23:51 -05:00
|
|
|
for (size_t caseIdx = 0; caseIdx < cg->caseCollection()->reservoirs.size(); caseIdx++)
|
|
|
|
{
|
|
|
|
cases.push_back(cg->caseCollection()->reservoirs[caseIdx]);
|
|
|
|
}
|
2015-05-15 11:51:49 -05:00
|
|
|
}
|
2013-06-06 08:07:31 -05:00
|
|
|
}
|
2015-05-15 11:51:49 -05:00
|
|
|
}
|
2013-06-06 08:07:31 -05:00
|
|
|
|
2015-05-15 11:51:49 -05:00
|
|
|
RimGeoMechModels* geomModels = oilField->geoMechModels();
|
|
|
|
if (geomModels)
|
|
|
|
{
|
|
|
|
for (size_t caseIdx = 0; caseIdx < geomModels->cases.size(); caseIdx++)
|
2013-06-06 08:07:31 -05:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
cases.push_back(geomModels->cases[caseIdx]);
|
2013-06-06 08:07:31 -05:00
|
|
|
}
|
2013-04-08 05:01:40 -05:00
|
|
|
}
|
|
|
|
}
|
2013-04-08 01:44:33 -05:00
|
|
|
}
|
|
|
|
|
2015-09-07 06:33:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::allNotLinkedViews(std::vector<RimView*>& views)
|
|
|
|
{
|
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
allCases(cases);
|
|
|
|
|
|
|
|
std::vector<RimView*> alreadyLinkedViews;
|
2015-09-16 07:26:25 -05:00
|
|
|
if (viewLinkerCollection->viewLinker())
|
2015-09-07 06:33:27 -05:00
|
|
|
{
|
2015-09-16 07:26:25 -05:00
|
|
|
viewLinkerCollection->viewLinker()->allViews(alreadyLinkedViews);
|
2015-09-07 06:33:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++)
|
|
|
|
{
|
|
|
|
RimCase* rimCase = cases[caseIdx];
|
|
|
|
if (!rimCase) continue;
|
|
|
|
|
|
|
|
std::vector<RimView*> caseViews = rimCase->views();
|
|
|
|
for (size_t viewIdx = 0; viewIdx < caseViews.size(); viewIdx++)
|
|
|
|
{
|
|
|
|
bool isLinked = false;
|
|
|
|
for (size_t lnIdx = 0; lnIdx < alreadyLinkedViews.size(); lnIdx++)
|
|
|
|
{
|
|
|
|
if (caseViews[viewIdx] == alreadyLinkedViews[lnIdx])
|
|
|
|
{
|
|
|
|
isLinked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!isLinked)
|
|
|
|
{
|
|
|
|
views.push_back(caseViews[viewIdx]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-30 06:30:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::allVisibleViews(std::vector<RimView*>& views)
|
|
|
|
{
|
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
allCases(cases);
|
|
|
|
|
|
|
|
for (size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++)
|
|
|
|
{
|
|
|
|
RimCase* rimCase = cases[caseIdx];
|
|
|
|
if (!rimCase) continue;
|
|
|
|
|
|
|
|
std::vector<RimView*> caseViews = rimCase->views();
|
|
|
|
for (size_t viewIdx = 0; viewIdx < caseViews.size(); viewIdx++)
|
|
|
|
{
|
|
|
|
if (caseViews[viewIdx] && caseViews[viewIdx]->viewer())
|
|
|
|
{
|
|
|
|
views.push_back(caseViews[viewIdx]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::createDisplayModelAndRedrawAllViews()
|
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
std::vector<RimCase*> cases;
|
2013-06-06 08:07:31 -05:00
|
|
|
allCases(cases);
|
|
|
|
for (size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++)
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
RimCase* rimCase = cases[caseIdx];
|
2013-06-06 08:07:31 -05:00
|
|
|
if (rimCase == NULL) continue;
|
2015-05-15 11:51:49 -05:00
|
|
|
std::vector<RimView*> views = rimCase->views();
|
2013-06-06 08:07:31 -05:00
|
|
|
|
2015-05-15 11:51:49 -05:00
|
|
|
for (size_t viewIdx = 0; viewIdx < views.size(); viewIdx++)
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
views[viewIdx]->scheduleCreateDisplayModelAndRedraw();
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-31 06:57:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-06-06 08:07:31 -05:00
|
|
|
/// Currently there will be only one oil field in Resinsight, so return hardcoded first oil field
|
|
|
|
/// from the RimOilField collection.
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimOilField* RimProject::activeOilField()
|
|
|
|
{
|
2013-06-12 02:36:50 -05:00
|
|
|
CVF_ASSERT(oilFields.size() == 1);
|
|
|
|
|
|
|
|
return oilFields[0];
|
2013-06-06 08:07:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-05-31 06:57:16 -05:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-09-08 03:53:25 -05:00
|
|
|
void RimProject::computeUtmAreaOfInterest()
|
2013-05-31 06:57:16 -05:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
std::vector<RimCase*> cases;
|
2013-05-31 06:57:16 -05:00
|
|
|
allCases(cases);
|
|
|
|
|
|
|
|
cvf::BoundingBox projectBB;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < cases.size(); i++)
|
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
RimEclipseCase* rimCase = dynamic_cast<RimEclipseCase*>(cases[i]);
|
2013-05-31 06:57:16 -05:00
|
|
|
|
|
|
|
if (rimCase && rimCase->reservoirData())
|
|
|
|
{
|
|
|
|
for (size_t gridIdx = 0; gridIdx < rimCase->reservoirData()->gridCount(); gridIdx++ )
|
|
|
|
{
|
|
|
|
RigGridBase* rigGrid = rimCase->reservoirData()->grid(gridIdx);
|
|
|
|
|
|
|
|
projectBB.add(rigGrid->boundingBox());
|
|
|
|
}
|
|
|
|
}
|
2015-05-15 11:51:49 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Todo : calculate BBox of GeoMechCase
|
|
|
|
}
|
2013-05-31 06:57:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (projectBB.isValid())
|
|
|
|
{
|
2013-09-08 03:53:25 -05:00
|
|
|
double north, south, east, west;
|
2013-05-31 06:57:16 -05:00
|
|
|
|
2013-09-08 03:53:25 -05:00
|
|
|
north = projectBB.max().y();
|
|
|
|
south = projectBB.min().y();
|
|
|
|
|
|
|
|
west = projectBB.min().x();
|
|
|
|
east = projectBB.max().x();
|
|
|
|
|
|
|
|
wellPathImport->north = north;
|
|
|
|
wellPathImport->south = south;
|
|
|
|
wellPathImport->east = east;
|
|
|
|
wellPathImport->west = west;
|
2013-05-31 06:57:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-06 04:00:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "cafCmdFeatureManager.h"
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "RimCellRangeFilterCollection.h"
|
|
|
|
#include "RimCellRangeFilter.h"
|
2015-08-06 07:54:18 -05:00
|
|
|
#include "RimEclipsePropertyFilterCollection.h"
|
|
|
|
#include "RimEclipsePropertyFilter.h"
|
2015-08-11 08:33:06 -05:00
|
|
|
#include "RimGeoMechPropertyFilterCollection.h"
|
|
|
|
#include "RimGeoMechPropertyFilter.h"
|
2015-08-13 13:22:49 -05:00
|
|
|
#include "RimGeoMechView.h"
|
2015-08-07 08:08:17 -05:00
|
|
|
#include "RimEclipseCellColors.h"
|
|
|
|
#include "RimEclipseFaultColors.h"
|
2015-08-28 04:32:25 -05:00
|
|
|
#include "RimWellLogPlot.h"
|
2015-11-04 09:14:42 -06:00
|
|
|
#include "RimWellLogTrack.h"
|
2015-08-30 19:06:37 -05:00
|
|
|
#include "RimWellLogPlotCurve.h"
|
2015-09-18 02:16:59 -05:00
|
|
|
#include "RimWellLogFileChannel.h"
|
2015-08-17 03:51:13 -05:00
|
|
|
#include <QMenu>
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-13 13:22:49 -05:00
|
|
|
|
2015-08-06 04:00:21 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 03:51:13 -05:00
|
|
|
void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-12 14:19:06 -05:00
|
|
|
QStringList commandIds;
|
2015-08-06 04:00:21 -05:00
|
|
|
|
|
|
|
std::vector<caf::PdmUiItem*> uiItems;
|
|
|
|
caf::SelectionManager::instance()->selectedItems(uiItems);
|
|
|
|
|
2015-08-28 03:42:57 -05:00
|
|
|
if (uiItems.size() == 0)
|
|
|
|
{
|
|
|
|
commandIds << "RicNewWellLogPlotFeature";
|
|
|
|
}
|
|
|
|
else if (uiItems.size() > 1)
|
2015-08-14 05:08:56 -05:00
|
|
|
{
|
2015-09-16 09:16:02 -05:00
|
|
|
caf::PdmUiItem* uiItem = uiItems[0];
|
2015-09-18 02:16:59 -05:00
|
|
|
if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
2015-09-16 09:16:02 -05:00
|
|
|
{
|
|
|
|
commandIds << "RicAddWellLogToPlotFeature";
|
|
|
|
}
|
2015-08-14 05:08:56 -05:00
|
|
|
}
|
2015-08-18 08:07:00 -05:00
|
|
|
else if (uiItems.size() == 1)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-11 03:55:53 -05:00
|
|
|
caf::PdmUiItem* uiItem = uiItems[0];
|
|
|
|
CVF_ASSERT(uiItem);
|
|
|
|
|
2015-08-20 06:44:45 -05:00
|
|
|
if (dynamic_cast<RimEclipseCaseCollection*>(uiItem))
|
|
|
|
{
|
|
|
|
commandIds << "RicImportEclipseCaseFeature";
|
2015-08-20 06:54:20 -05:00
|
|
|
commandIds << "RicImportInputEclipseCaseFeature";
|
2015-08-20 07:11:21 -05:00
|
|
|
commandIds << "RicCreateGridCaseGroupFeature";
|
2015-08-20 07:20:13 -05:00
|
|
|
commandIds << "RicEclipseCaseNewGroupFeature";
|
2015-08-20 06:44:45 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimGeoMechView*>(uiItem))
|
2015-08-13 13:22:49 -05:00
|
|
|
{
|
2015-08-18 03:36:23 -05:00
|
|
|
commandIds << "RicNewViewFeature";
|
2015-08-13 13:22:49 -05:00
|
|
|
commandIds << "RicCopyReferencesToClipboardFeature";
|
2015-08-14 03:50:08 -05:00
|
|
|
commandIds << "RicPasteGeoMechViewsFeature";
|
2015-08-18 07:10:34 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-09-16 08:13:56 -05:00
|
|
|
commandIds << "Separator";
|
2015-08-14 03:50:08 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimEclipseView*>(uiItem))
|
|
|
|
{
|
2015-08-20 10:19:38 -05:00
|
|
|
commandIds << "RicNewViewFeature";
|
2015-08-14 03:50:08 -05:00
|
|
|
commandIds << "RicCopyReferencesToClipboardFeature";
|
|
|
|
commandIds << "RicPasteEclipseViewsFeature";
|
2015-08-18 07:10:34 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-09-16 08:13:56 -05:00
|
|
|
commandIds << "Separator";
|
2015-08-13 13:22:49 -05:00
|
|
|
}
|
2015-08-21 04:47:59 -05:00
|
|
|
else if (dynamic_cast<RimCaseCollection*>(uiItem))
|
2015-08-20 10:19:38 -05:00
|
|
|
{
|
2015-08-21 08:08:07 -05:00
|
|
|
commandIds << "RicPasteEclipseCasesFeature";
|
2015-08-21 04:47:59 -05:00
|
|
|
commandIds << "RicNewStatisticsCaseFeature";
|
2015-08-20 10:19:38 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimEclipseStatisticsCase*>(uiItem))
|
|
|
|
{
|
|
|
|
commandIds << "RicNewViewFeature";
|
2015-08-21 07:53:45 -05:00
|
|
|
commandIds << "RicComputeStatisticsFeature";
|
2015-08-20 10:19:38 -05:00
|
|
|
commandIds << "RicCloseCaseFeature";
|
|
|
|
commandIds << "RicExecuteScriptForCasesFeature";
|
|
|
|
}
|
2015-08-13 13:22:49 -05:00
|
|
|
else if (dynamic_cast<RimEclipseCase*>(uiItem))
|
2015-08-07 08:08:17 -05:00
|
|
|
{
|
2015-08-13 13:22:49 -05:00
|
|
|
commandIds << "RicCopyReferencesToClipboardFeature";
|
|
|
|
|
2015-08-14 03:17:18 -05:00
|
|
|
commandIds << "RicPasteEclipseCasesFeature";
|
|
|
|
commandIds << "RicPasteEclipseViewsFeature";
|
|
|
|
|
2015-08-18 06:40:57 -05:00
|
|
|
commandIds << "RicCloseCaseFeature";
|
2015-08-18 03:36:23 -05:00
|
|
|
commandIds << "RicNewViewFeature";
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicEclipseCaseNewGroupFeature";
|
2015-08-18 09:36:37 -05:00
|
|
|
commandIds << "RicExecuteScriptForCasesFeature";
|
2015-08-07 08:08:17 -05:00
|
|
|
}
|
2015-08-14 03:50:08 -05:00
|
|
|
else if (dynamic_cast<RimGeoMechCase*>(uiItem))
|
|
|
|
{
|
|
|
|
commandIds << "RicPasteGeoMechViewsFeature";
|
2015-08-18 03:36:23 -05:00
|
|
|
commandIds << "RicNewViewFeature";
|
2015-08-20 10:19:38 -05:00
|
|
|
commandIds << "Separator";
|
|
|
|
|
2015-08-18 06:40:57 -05:00
|
|
|
commandIds << "RicCloseCaseFeature";
|
2015-08-14 03:50:08 -05:00
|
|
|
}
|
2015-08-14 03:17:18 -05:00
|
|
|
else if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem))
|
|
|
|
{
|
2015-08-20 10:19:38 -05:00
|
|
|
commandIds << "RicEclipseCaseNewGroupFeature";
|
2015-08-14 03:17:18 -05:00
|
|
|
commandIds << "RicPasteEclipseCasesFeature";
|
2015-08-21 08:44:12 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-14 03:17:18 -05:00
|
|
|
}
|
2015-08-11 03:55:53 -05:00
|
|
|
else if (dynamic_cast<RimEclipseCellColors*>(uiItem))
|
2015-08-07 08:08:17 -05:00
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicSaveEclipseResultAsInputPropertyFeature";
|
2015-08-24 03:40:47 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimEclipseInputPropertyCollection*>(uiItem))
|
|
|
|
{
|
|
|
|
commandIds << "RicAddEclipseInputPropertyFeature";
|
2015-08-07 08:08:17 -05:00
|
|
|
}
|
2015-08-24 03:03:21 -05:00
|
|
|
else if (dynamic_cast<RimEclipseInputProperty*>(uiItem))
|
|
|
|
{
|
2015-08-24 03:45:43 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-24 03:03:21 -05:00
|
|
|
commandIds << "RicSaveEclipseInputPropertyFeature";
|
|
|
|
}
|
2015-08-11 03:55:53 -05:00
|
|
|
else if (dynamic_cast<RimCellRangeFilterCollection*>(uiItem))
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicRangeFilterNewFeature";
|
|
|
|
commandIds << "RicRangeFilterNewSliceIFeature";
|
|
|
|
commandIds << "RicRangeFilterNewSliceJFeature";
|
|
|
|
commandIds << "RicRangeFilterNewSliceKFeature";
|
2015-08-06 04:00:21 -05:00
|
|
|
}
|
2015-08-11 03:55:53 -05:00
|
|
|
else if (dynamic_cast<RimCellRangeFilter*>(uiItem))
|
2015-08-07 08:08:17 -05:00
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicRangeFilterInsertFeature";
|
|
|
|
commandIds << "RicRangeFilterNewSliceIFeature";
|
|
|
|
commandIds << "RicRangeFilterNewSliceJFeature";
|
|
|
|
commandIds << "RicRangeFilterNewSliceKFeature";
|
2015-08-17 03:51:13 -05:00
|
|
|
commandIds << "Separator";
|
2015-08-12 14:19:06 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-07 08:08:17 -05:00
|
|
|
}
|
2015-08-11 03:55:53 -05:00
|
|
|
else if (dynamic_cast<RimEclipsePropertyFilterCollection*>(uiItem))
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicEclipsePropertyFilterNewFeature";
|
2015-08-06 04:00:21 -05:00
|
|
|
}
|
2015-08-11 03:55:53 -05:00
|
|
|
else if (dynamic_cast<RimEclipsePropertyFilter*>(uiItem))
|
2015-08-10 06:35:57 -05:00
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicEclipsePropertyFilterInsertFeature";
|
2015-08-17 03:51:13 -05:00
|
|
|
commandIds << "Separator";
|
2015-08-12 14:19:06 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-11 08:33:06 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(uiItem))
|
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicGeoMechPropertyFilterNewFeature";
|
2015-08-11 08:33:06 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimGeoMechPropertyFilter*>(uiItem))
|
|
|
|
{
|
2015-08-17 08:09:01 -05:00
|
|
|
commandIds << "RicGeoMechPropertyFilterInsertFeature";
|
2015-08-17 03:51:13 -05:00
|
|
|
commandIds << "Separator";
|
2015-08-12 14:19:06 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-12 13:12:50 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimWellPathCollection*>(uiItem))
|
|
|
|
{
|
2015-08-12 14:19:06 -05:00
|
|
|
commandIds << "RicWellPathsDeleteAllFeature";
|
2015-08-24 09:33:54 -05:00
|
|
|
commandIds << "RicWellPathsImportFileFeature";
|
|
|
|
commandIds << "RicWellPathsImportSsihubFeature";
|
2015-09-14 09:33:28 -05:00
|
|
|
commandIds << "RicWellLogsImportFileFeature";
|
2015-08-12 13:59:38 -05:00
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimWellPath*>(uiItem))
|
|
|
|
{
|
2015-09-22 03:52:28 -05:00
|
|
|
commandIds << "RicNewWellLogFileCurveFeature";
|
2015-09-22 05:29:14 -05:00
|
|
|
commandIds << "RicNewWellLogCurveExtractionFeature";
|
2015-10-29 07:12:55 -05:00
|
|
|
commandIds << "RicWellPathDeleteFeature";
|
2015-08-10 06:35:57 -05:00
|
|
|
}
|
2015-08-18 08:07:00 -05:00
|
|
|
else if (dynamic_cast<RimCalcScript*>(uiItem))
|
|
|
|
{
|
2015-08-19 11:17:45 -05:00
|
|
|
commandIds << "RicEditScriptFeature";
|
2015-08-20 03:31:36 -05:00
|
|
|
commandIds << "RicNewScriptFeature";
|
|
|
|
commandIds << "Separator";
|
2015-08-18 08:07:00 -05:00
|
|
|
commandIds << "RicExecuteScriptFeature";
|
|
|
|
}
|
2015-08-20 04:59:07 -05:00
|
|
|
else if (dynamic_cast<RimScriptCollection*>(uiItem))
|
|
|
|
{
|
|
|
|
commandIds << "RicAddScriptPathFeature";
|
|
|
|
commandIds << "RicDeleteScriptPathFeature";
|
|
|
|
}
|
2015-09-24 04:29:01 -05:00
|
|
|
else if (dynamic_cast<RimViewController*>(uiItem))
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-09-02 10:18:02 -05:00
|
|
|
commandIds << "RicShowAllLinkedViewsFeature";
|
|
|
|
commandIds << "Separator";
|
2015-08-25 05:40:55 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
|
|
|
}
|
2015-09-07 07:29:46 -05:00
|
|
|
else if (dynamic_cast<RimViewLinker*>(uiItem))
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-02 10:18:02 -05:00
|
|
|
commandIds << "RicShowAllLinkedViewsFeature";
|
|
|
|
commandIds << "Separator";
|
2015-09-16 07:40:50 -05:00
|
|
|
commandIds << "RicDeleteAllLinkedViewsFeature";
|
2015-09-01 10:14:22 -05:00
|
|
|
}
|
2015-08-28 05:25:48 -05:00
|
|
|
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
|
|
|
|
{
|
|
|
|
commandIds << "RicNewWellLogPlotFeature";
|
|
|
|
}
|
2015-08-28 04:32:25 -05:00
|
|
|
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
|
|
|
{
|
2015-09-18 05:29:23 -05:00
|
|
|
commandIds << "RicNewWellLogPlotTrackFeature";
|
2015-08-31 04:05:55 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-28 04:32:25 -05:00
|
|
|
}
|
2015-11-04 08:57:06 -06:00
|
|
|
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
|
2015-08-28 04:45:18 -05:00
|
|
|
{
|
2015-09-18 02:07:06 -05:00
|
|
|
commandIds << "RicNewWellLogCurveExtractionFeature";
|
2015-09-18 10:29:17 -05:00
|
|
|
commandIds << "RicNewWellLogFileCurveFeature";
|
2015-09-21 08:55:55 -05:00
|
|
|
commandIds << "RicDeleteWellLogPlotTrackFeature";
|
2015-08-30 19:06:37 -05:00
|
|
|
}
|
2015-11-04 09:19:38 -06:00
|
|
|
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
|
2015-08-30 19:06:37 -05:00
|
|
|
{
|
2015-10-15 04:27:12 -05:00
|
|
|
commandIds << "RicExportToLasFileFeature";
|
2015-08-30 19:06:37 -05:00
|
|
|
commandIds << "RicDeleteItemFeature";
|
2015-08-28 04:45:18 -05:00
|
|
|
}
|
2015-09-18 02:16:59 -05:00
|
|
|
else if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
2015-09-15 08:23:25 -05:00
|
|
|
{
|
|
|
|
commandIds << "RicAddWellLogToPlotFeature";
|
|
|
|
}
|
2015-09-16 08:13:56 -05:00
|
|
|
|
|
|
|
if (dynamic_cast<RimView*>(uiItem))
|
|
|
|
{
|
2015-09-22 07:34:26 -05:00
|
|
|
commandIds << "RicLinkVisibleViewsFeature";
|
|
|
|
commandIds << "RicLinkViewFeature";
|
|
|
|
commandIds << "RicUnLinkViewFeature";
|
|
|
|
commandIds << "RicShowLinkOptionsFeature";
|
2015-09-16 08:13:56 -05:00
|
|
|
commandIds << "RicSetMasterViewFeature";
|
|
|
|
}
|
2015-08-06 04:00:21 -05:00
|
|
|
}
|
|
|
|
|
2015-08-18 03:51:13 -05:00
|
|
|
if (RicToggleItemsFeatureImpl::isToggleCommandsAvailable())
|
|
|
|
{
|
|
|
|
commandIds << "Separator";
|
|
|
|
commandIds << "RicToggleItemsOnFeature";
|
2015-08-18 05:08:46 -05:00
|
|
|
commandIds << "RicToggleItemsOffFeature";
|
|
|
|
commandIds << "RicToggleItemsFeature";
|
2015-08-18 03:51:13 -05:00
|
|
|
}
|
|
|
|
|
2015-08-12 14:19:06 -05:00
|
|
|
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
|
|
|
for (int i = 0; i < commandIds.size(); i++)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-17 03:51:13 -05:00
|
|
|
if (commandIds[i] == "Separator")
|
2015-08-14 03:17:18 -05:00
|
|
|
{
|
2015-08-17 03:51:13 -05:00
|
|
|
contextMenu.addSeparator();
|
|
|
|
}
|
2015-08-18 09:36:37 -05:00
|
|
|
else if (commandIds[i] == "RicExecuteScriptForCasesFeature")
|
|
|
|
{
|
|
|
|
// Execute script on selection of cases
|
2015-08-19 06:23:26 -05:00
|
|
|
RiuMainWindow* ruiMainWindow = RiuMainWindow::instance();
|
|
|
|
if (ruiMainWindow)
|
|
|
|
{
|
2015-08-18 09:36:37 -05:00
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
ruiMainWindow->selectedCases(cases);
|
|
|
|
|
|
|
|
if (cases.size() > 0)
|
|
|
|
{
|
|
|
|
QMenu* executeMenu = contextMenu.addMenu("Execute script");
|
|
|
|
|
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
RimProject* proj = app->project();
|
|
|
|
if (proj && proj->scriptCollection())
|
|
|
|
{
|
|
|
|
RimScriptCollection* rootScriptCollection = proj->scriptCollection();
|
|
|
|
|
|
|
|
// Root script collection holds a list of subdirectories of user defined script folders
|
|
|
|
for (size_t i = 0; i < rootScriptCollection->subDirectories.size(); i++)
|
|
|
|
{
|
|
|
|
RimScriptCollection* subDir = rootScriptCollection->subDirectories[i];
|
|
|
|
|
|
|
|
if (subDir)
|
|
|
|
{
|
|
|
|
appendScriptItems(executeMenu, subDir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contextMenu.addSeparator();
|
|
|
|
contextMenu.addMenu(executeMenu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-17 03:51:13 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
|
|
|
if (feature->canFeatureBeExecuted())
|
|
|
|
{
|
|
|
|
QAction* act = commandManager->action(commandIds[i]);
|
|
|
|
CVF_ASSERT(act);
|
2015-08-12 14:19:06 -05:00
|
|
|
|
2015-08-17 03:51:13 -05:00
|
|
|
contextMenu.addAction(act);
|
|
|
|
}
|
2015-08-14 03:17:18 -05:00
|
|
|
}
|
2015-08-06 04:00:21 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-18 09:36:37 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::appendScriptItems(QMenu* menu, RimScriptCollection* scriptCollection)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(menu);
|
|
|
|
|
|
|
|
QDir dir(scriptCollection->directory);
|
|
|
|
QMenu* subMenu = menu->addMenu(dir.dirName());
|
|
|
|
|
2015-08-19 06:23:26 -05:00
|
|
|
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
|
|
|
CVF_ASSERT(commandManager);
|
|
|
|
|
|
|
|
RicExecuteScriptForCasesFeature* executeScriptFeature = dynamic_cast<RicExecuteScriptForCasesFeature*>(commandManager->getCommandFeature("RicExecuteScriptForCasesFeature"));
|
|
|
|
CVF_ASSERT(executeScriptFeature);
|
|
|
|
|
2015-08-18 09:36:37 -05:00
|
|
|
for (size_t i = 0; i < scriptCollection->calcScripts.size(); i++)
|
|
|
|
{
|
|
|
|
RimCalcScript* calcScript = scriptCollection->calcScripts[i];
|
|
|
|
QFileInfo fi(calcScript->absolutePath());
|
|
|
|
|
|
|
|
QString menuText = fi.baseName();
|
2015-08-19 06:23:26 -05:00
|
|
|
QAction* scriptAction = subMenu->addAction(menuText, executeScriptFeature, SLOT(slotExecuteScriptForSelectedCases()));
|
2015-08-18 09:36:37 -05:00
|
|
|
|
|
|
|
scriptAction->setData(QVariant(calcScript->absolutePath()));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < scriptCollection->subDirectories.size(); i++)
|
|
|
|
{
|
|
|
|
RimScriptCollection* subDir = scriptCollection->subDirectories[i];
|
|
|
|
|
|
|
|
appendScriptItems(subMenu, subDir);
|
|
|
|
}
|
|
|
|
}
|
2015-08-06 08:55:17 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
|
|
|
{
|
2015-09-16 07:26:25 -05:00
|
|
|
if (viewLinkerCollection()->viewLinker())
|
2015-09-07 07:01:19 -05:00
|
|
|
{
|
2015-09-08 03:17:35 -05:00
|
|
|
// Use object instead of field to avoid duplicate entries in the tree view
|
|
|
|
uiTreeOrdering.add(viewLinkerCollection());
|
2015-09-07 07:01:19 -05:00
|
|
|
}
|
|
|
|
|
2015-08-11 08:22:49 -05:00
|
|
|
RimOilField* oilField = activeOilField();
|
|
|
|
if (oilField)
|
2015-08-06 08:55:17 -05:00
|
|
|
{
|
2015-08-11 08:22:49 -05:00
|
|
|
if (oilField->analysisModels()) uiTreeOrdering.add(oilField->analysisModels());
|
|
|
|
if (oilField->geoMechModels()) uiTreeOrdering.add(oilField->geoMechModels());
|
|
|
|
if (oilField->wellPathCollection()) uiTreeOrdering.add(oilField->wellPathCollection());
|
2015-08-06 08:55:17 -05:00
|
|
|
}
|
|
|
|
|
2015-08-28 05:10:36 -05:00
|
|
|
if (mainPlotCollection)
|
|
|
|
{
|
|
|
|
if (mainPlotCollection->wellLogPlotCollection())
|
|
|
|
{
|
|
|
|
if (mainPlotCollection->wellLogPlotCollection()->wellLogPlots().size() > 0)
|
|
|
|
{
|
|
|
|
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-06 08:55:17 -05:00
|
|
|
|
2015-09-07 06:07:10 -05:00
|
|
|
uiTreeOrdering.add(scriptCollection());
|
|
|
|
|
2015-08-06 08:55:17 -05:00
|
|
|
uiTreeOrdering.setForgetRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
2015-09-07 03:44:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimProject::recreateMainPlotCollection()
|
|
|
|
{
|
|
|
|
if (!mainPlotCollection())
|
|
|
|
{
|
|
|
|
mainPlotCollection = new RimMainPlotCollection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|