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
This commit is contained in:
Vidar Lundberg
2013-05-16 14:10:22 +02:00
parent 704facc1c1
commit 163ce74052
14 changed files with 171 additions and 12 deletions

View File

@@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaStdInclude.h"
#include "RiaApplication.h"
#include "cafEffectCache.h"
@@ -34,6 +35,8 @@
#include "RimResultCase.h"
#include "RimInputCase.h"
#include "RimReservoirView.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafCeetronNavigation.h"
#include "cafCadNavigation.h"
@@ -327,6 +330,41 @@ bool RiaApplication::loadProject(const QString& projectFileName)
// Add well paths
if (m_project->wellPathCollection == NULL)
{
printf("Create well path collection in loadProject.\n");
m_project->wellPathCollection = new RimWellPathCollection();
m_project->wellPathCollection->setProject(m_project);
}
#if 1
if (m_project && m_project->wellPathCollection) m_project->wellPathCollection->readWellPathFiles();
#else
// TESTCODE begin: Add hardcoded well paths from file
if (m_project && m_project->wellPathCollection->wellPaths.size() == 0)
{
QFile wellPathFile;
wellPathFile.setFileName("c:\\temp\\wellPaths.txt");
wellPathFile.open(QIODevice::ReadOnly | QIODevice::Text);
QByteArray filePath;
QList<QString> wellPathFilePaths;
for (filePath = wellPathFile.readLine().trimmed(); !wellPathFile.atEnd(); filePath = wellPathFile.readLine().trimmed())
{
if (filePath[0] == '#' || filePath.isEmpty())
continue;
wellPathFilePaths.push_back(filePath);
}
addWellPathsToModel(wellPathFilePaths);
}
else
{
// Read the well path files specified in the model (RimWellPathCollection / RimWellPath) into geometries (RigWellPath)
if (m_project && m_project->wellPathCollection) m_project->wellPathCollection->readWellPathFiles();
}
// TESTCODE end
#endif
caf::ProgressInfo caseProgress(casesToLoad.size() , "Reading Cases");
for (size_t cIdx = 0; cIdx < casesToLoad.size(); ++cIdx)
@@ -360,6 +398,28 @@ bool RiaApplication::loadProject(const QString& projectFileName)
}
//--------------------------------------------------------------------------------------------------
/// Add a list of well path file paths (JSON files) to the well path collection
//--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
{
if (m_project == NULL) return;
if (m_project->wellPathCollection == NULL)
{
printf("Create well path collection.\n");
m_project->wellPathCollection = new RimWellPathCollection();
m_project->wellPathCollection->setProject(m_project);
RiuMainWindow::instance()->uiPdmModel()->updateUiSubTree(m_project);
}
if (m_project->wellPathCollection->wellPaths.empty())
printf("Well path collection is empty.\n");
if (m_project && m_project->wellPathCollection) m_project->wellPathCollection->addWellPaths(wellPathFilePaths);
RiuMainWindow::instance()->uiPdmModel()->updateUiSubTree(m_project->wellPathCollection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -90,7 +90,8 @@ public:
bool saveProjectAs(const QString& fileName);
bool saveProjectPromptForFileName();
bool closeProject(bool askToSaveIfDirty);
void addWellPathsToModel(QList<QString> wellPathFilePaths);
void copySnapshotToClipboard();
void saveSnapshotPromtpForFilename();
void saveSnapshotAs(const QString& fileName);

View File

@@ -233,7 +233,7 @@ target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
if (MSVC)
# Qt DLLs
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd)
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd QtScript QtScriptd QtScriptTools QtScriptToolsd)
foreach (qtlib ${QTLIBLIST})
add_custom_command(TARGET ResInsight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
@@ -265,6 +265,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
${QT_LIBRARY_DIR}/libQtGui.so*
${QT_LIBRARY_DIR}/libQtOpenGL.so*
${QT_LIBRARY_DIR}/libQtNetwork.so*
${QT_LIBRARY_DIR}/libQtScript.so*
${QT_LIBRARY_DIR}/libQtScriptTools.so*
)
endif()
@@ -278,6 +280,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
${QT_BINARY_DIR}/QtGui4.dll
${QT_BINARY_DIR}/QtOpenGL4.dll
${QT_BINARY_DIR}/QtNetwork4.dll
${QT_BINARY_DIR}/QtScript4.dll
${QT_BINARY_DIR}/QtScriptTools4.dll
)
endif()

View File

@@ -12,6 +12,7 @@ ${CEE_CURRENT_LIST_DIR}RifEclipseRestartFilesetAccess.h
${CEE_CURRENT_LIST_DIR}RifEclipseUnifiedRestartFileAccess.h
${CEE_CURRENT_LIST_DIR}RifReaderEclipseInput.h
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.h
${CEE_CURRENT_LIST_DIR}RifJsonEncodeDecode.h
${CEE_CURRENT_LIST_DIR}RifReaderInterface.h
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.h
)
@@ -24,6 +25,7 @@ ${CEE_CURRENT_LIST_DIR}RifEclipseRestartFilesetAccess.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseUnifiedRestartFileAccess.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseInput.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.cpp
${CEE_CURRENT_LIST_DIR}RifJsonEncodeDecode.cpp
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.cpp
)

View File

@@ -11,6 +11,8 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
)
@@ -22,6 +24,8 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp
)

View File

@@ -26,6 +26,8 @@ ${CEE_CURRENT_LIST_DIR}RimResultSlot.h
${CEE_CURRENT_LIST_DIR}RimCellEdgeResultSlot.h
${CEE_CURRENT_LIST_DIR}RimWell.h
${CEE_CURRENT_LIST_DIR}RimWellCollection.h
${CEE_CURRENT_LIST_DIR}RimWellPath.h
${CEE_CURRENT_LIST_DIR}RimWellPathCollection.h
${CEE_CURRENT_LIST_DIR}RimScriptCollection.h
${CEE_CURRENT_LIST_DIR}RimStatisticsCase.h
${CEE_CURRENT_LIST_DIR}RimStatisticsCaseCollection.h
@@ -62,6 +64,8 @@ ${CEE_CURRENT_LIST_DIR}RimResultSlot.cpp
${CEE_CURRENT_LIST_DIR}RimCellEdgeResultSlot.cpp
${CEE_CURRENT_LIST_DIR}RimWell.cpp
${CEE_CURRENT_LIST_DIR}RimWellCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellPath.cpp
${CEE_CURRENT_LIST_DIR}RimWellPathCollection.cpp
${CEE_CURRENT_LIST_DIR}RimScriptCollection.cpp
${CEE_CURRENT_LIST_DIR}RimStatisticsCase.cpp
${CEE_CURRENT_LIST_DIR}RimStatisticsCaseCollection.cpp

View File

@@ -32,6 +32,7 @@
#include "RigGridManager.h"
#include "RigCaseData.h"
#include "RimResultCase.h"
#include "RimWellPathCollection.h"
#include "cafPdmFieldCvfColor.h"
@@ -65,7 +66,6 @@ RimProject::RimProject(void)
CAF_PDM_InitFieldNoDefault(&caseGroups, "CaseGroups", "", "", "", "");
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
treeViewState.setUiHidden(true);
@@ -75,9 +75,11 @@ RimProject::RimProject(void)
scriptCollection = new RimScriptCollection();
scriptCollection->directory.setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
m_gridCollection = new RigGridManager;
initAfterRead();
initScriptDirectories();
}
//--------------------------------------------------------------------------------------------------
@@ -88,6 +90,7 @@ RimProject::~RimProject(void)
close();
if (scriptCollection()) delete scriptCollection();
if (wellPathCollection()) delete wellPathCollection();
reservoirs.deleteAllChildObjects();
}
@@ -101,6 +104,7 @@ void RimProject::close()
reservoirs.deleteAllChildObjects();
caseGroups.deleteAllChildObjects();
if (wellPathCollection != NULL) delete wellPathCollection;
fileName = "";
@@ -108,10 +112,11 @@ void RimProject::close()
nextValidCaseGroupId = 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::initAfterRead()
void RimProject::initScriptDirectories()
{
//
// TODO : Must store content of scripts in project file and notify user if stored content is different from disk on execute and edit
@@ -185,6 +190,17 @@ void RimProject::initAfterRead()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::initAfterRead()
{
initScriptDirectories();
if (wellPathCollection) wellPathCollection->setProject(this);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -434,3 +450,20 @@ void RimProject::allCases(std::vector<RimCase*>& cases)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::createDisplayModelAndRedrawAllViews()
{
for (size_t caseIdx = 0; caseIdx < reservoirs.size(); caseIdx++)
{
RimCase* rimCase = reservoirs[caseIdx];
for (size_t viewIdx = 0; viewIdx < rimCase->reservoirViews.size(); viewIdx++)
{
RimReservoirView* reservoirView = rimCase->reservoirViews[viewIdx];
reservoirView->createDisplayModelAndRedraw();
}
}
}

View File

@@ -19,8 +19,6 @@
#pragma once
#include "cafPdmDocument.h"
//#include "RimScriptCollection.h"
//#include "RimIdenticalGridCaseGroup.h"
class RimCase;
class RigGridManager;
@@ -28,6 +26,7 @@ class RimScriptCollection;
class RimIdenticalGridCaseGroup;
class RigMainGrid;
class RigCaseData;
class RimWellPathCollection;
//==================================================================================================
///
@@ -48,6 +47,7 @@ public:
caf::PdmField<QString> currentModelIndexPath;
caf::PdmField<int> nextValidCaseId; // Unique case ID within a project, used to identify a case from Octave scripts
caf::PdmField<int> nextValidCaseGroupId; // Unique case group ID within a project, used to identify a case group from Octave scripts
caf::PdmField<RimWellPathCollection*> wellPathCollection;
void setScriptDirectories(const QString& scriptDirectories);
QString projectFileVersionString() const;
@@ -65,12 +65,14 @@ public:
void assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup);
void allCases(std::vector<RimCase*>& cases);
void createDisplayModelAndRedrawAllViews();
private:
RigMainGrid* registerCaseInGridCollection(RigCaseData* rigEclipseCase);
protected:
// Overridden methods
void initScriptDirectories();
virtual void initAfterRead();
virtual void setupBeforeSave();

View File

@@ -30,6 +30,7 @@
#include <QMessageBox>
#include "RimProject.h"
#include "RimCase.h"
#include "RimResultSlot.h"
#include "RimCellEdgeResultSlot.h"
@@ -38,6 +39,10 @@
#include "RimCellPropertyFilter.h"
#include "RimCellPropertyFilterCollection.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimWellPathCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimScriptCollection.h"
#include "RimCaseCollection.h"
#include "RiuMainWindow.h"
#include "RigGridBase.h"
@@ -61,6 +66,7 @@
#include "Rim3dOverlayInfoConfig.h"
#include "RigGridScalarDataAccess.h"
#include "RimReservoirCellResultsCacher.h"
#include "RivWellPathCollectionPartMgr.h"
#include "cvfOverlayScalarMapperLegend.h"
#include <limits.h>
@@ -189,6 +195,7 @@ RimReservoirView::~RimReservoirView()
delete rangeFilterCollection();
delete propertyFilterCollection();
delete wellCollection();
// delete wellPathCollection();
if (m_viewer)
{
@@ -346,6 +353,10 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
if (scaleZ < 1) scaleZ = 1;
// Regenerate well paths
RimWellPathCollection* wellPathCollection = (RiaApplication::instance() && RiaApplication::instance()->project()) ? RiaApplication::instance()->project()->wellPathCollection() : NULL;
if (wellPathCollection) wellPathCollection->wellPathCollectionPartMgr()->scheduleGeometryRegen();
if (m_viewer)
{
cvf::Vec3d poi = m_viewer->pointOfInterest();
@@ -564,7 +575,6 @@ void RimReservoirView::createDisplayModel()
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::INACTIVE);
}
}
size_t frameIdx;
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
@@ -573,6 +583,19 @@ void RimReservoirView::createDisplayModel()
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
}
// Append static Well Paths to model
cvf::Vec3d displayModelOffset = eclipseCase()->reservoirData()->mainGrid()->displayModelOffset();
double characteristicCellSize = eclipseCase()->reservoirData()->mainGrid()->characteristicIJCellSize();
cvf::BoundingBox boundingBox = currentActiveCellInfo()->geometryBoundingBox();
RimProject* rimProject = RiaApplication::instance() ? RiaApplication::instance()->project() : NULL;
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = (rimProject && rimProject->wellPathCollection()) ? rimProject->wellPathCollection()->wellPathCollectionPartMgr() : NULL;
if (wellPathCollectionPartMgr)
{
printf("Append well paths for frame %i: ", frameIdx);
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), displayModelOffset, m_reservoirGridPartManager->scaleTransform(), characteristicCellSize, boundingBox);
printf("\n");
}
}
// Set static colors
@@ -581,7 +604,6 @@ void RimReservoirView::createDisplayModel()
m_visibleGridParts = geometryTypesToAdd;
}
// Compute triangle count, Debug only
if (false)

View File

@@ -48,7 +48,7 @@ class RivReservoirPipesPartMgr;
class RiuViewer;
class RigGridBase;
class RigGridCellFaceVisibilityFilter;
class RimReservoirCellResultsStorage;
namespace cvf
{
class Transform;

View File

@@ -17,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.h
${CEE_CURRENT_LIST_DIR}RigCaseCellResultsData.h
${CEE_CURRENT_LIST_DIR}RigSingleWellResultsData.h
${CEE_CURRENT_LIST_DIR}RigStatisticsMath.h
${CEE_CURRENT_LIST_DIR}RigWellPath.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -32,6 +33,7 @@ ${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.cpp
${CEE_CURRENT_LIST_DIR}RigCaseCellResultsData.cpp
${CEE_CURRENT_LIST_DIR}RigSingleWellResultsData.cpp
${CEE_CURRENT_LIST_DIR}RigStatisticsMath.cpp
${CEE_CURRENT_LIST_DIR}RigWellPath.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -30,6 +30,7 @@
#include "RimWellCollection.h"
#include "RimReservoirCellResultsCacher.h"
#include "RimCaseCollection.h"
#include "RimWellPathCollection.h"
#include "RimUiTreeModelPdm.h"
@@ -181,6 +182,7 @@ void RiuMainWindow::createActions()
m_openProjectAction = new QAction(style()->standardIcon(QStyle::SP_DirOpenIcon), "&Open Project", this);
m_openLastUsedProjectAction = new QAction("Open &Last Used Project", this);
m_openWellPathsAction = new QAction(style()->standardIcon(QStyle::SP_DirOpenIcon), "&Open Well Paths", this);
m_mockModelAction = new QAction("&Mock Model", this);
m_mockResultsModelAction = new QAction("Mock Model With &Results", this);
@@ -202,6 +204,7 @@ void RiuMainWindow::createActions()
connect(m_openMultipleEclipseCasesAction,SIGNAL(triggered()), SLOT(slotOpenMultipleCases()));
connect(m_openProjectAction, SIGNAL(triggered()), SLOT(slotOpenProject()));
connect(m_openLastUsedProjectAction,SIGNAL(triggered()), SLOT(slotOpenLastUsedProject()));
connect(m_openWellPathsAction, SIGNAL(triggered()), SLOT(slotOpenWellPaths()));
connect(m_mockModelAction, SIGNAL(triggered()), SLOT(slotMockModel()));
connect(m_mockResultsModelAction, SIGNAL(triggered()), SLOT(slotMockResultsModel()));
@@ -291,6 +294,7 @@ void RiuMainWindow::createMenus()
fileMenu->addAction(m_openProjectAction);
fileMenu->addAction(m_openLastUsedProjectAction);
fileMenu->addAction(m_openWellPathsAction);
fileMenu->addSeparator();
QMenu* importMenu = fileMenu->addMenu("&Import");
@@ -762,6 +766,25 @@ void RiuMainWindow::slotOpenLastUsedProject()
restoreTreeViewState();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotOpenWellPaths()
{
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("WELLPATH_DIR");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(this, "Open JSON Well Paths", defaultDir, "JSON Well Path (*.json)");
if (wellPathFilePaths.size() < 1) return;
// Remember the path to next time
app->setDefaultFileDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
app->addWellPathsToModel(wellPathFilePaths);
if (app->project()) app->project()->createDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -119,6 +119,7 @@ private:
QAction* m_openMultipleEclipseCasesAction;
QAction* m_openProjectAction;
QAction* m_openLastUsedProjectAction;
QAction* m_openWellPathsAction;
QAction* m_saveProjectAction;
QAction* m_saveProjectAsAction;
QAction* m_closeProjectAction;
@@ -177,6 +178,7 @@ private slots:
void slotOpenMultipleCases();
void slotOpenProject();
void slotOpenLastUsedProject();
void slotOpenWellPaths();
void slotSaveProject();
void slotSaveProjectAs();
void slotCloseProject();

View File

@@ -63,7 +63,7 @@ include_directories(
################################################################################
# Qt
################################################################################
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork)
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript QtScriptTools)
find_package (Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
include (${QT_USE_FILE})