#5285 Surface import command Items and parsing infrastructure

This commit is contained in:
Jacob Støren 2020-01-03 13:49:12 +01:00
parent 993b98f977
commit 26db8d7351
21 changed files with 936 additions and 8 deletions

View File

@ -68,6 +68,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/GridCrossPlots
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Measurement
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Surfaces
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
@ -134,6 +135,7 @@ list( APPEND REFERENCED_CMAKE_FILES
ProjectDataModel/Completions/CMakeLists_files.cmake
ProjectDataModel/Measurement/CMakeLists_files.cmake
ProjectDataModel/PlotTemplates/CMakeLists_files.cmake
ProjectDataModel/Surfaces/CMakeLists_files.cmake
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
@ -163,6 +165,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
Commands/SummaryPlotCommands/CMakeLists_files.cmake
Commands/SsiHubImportCommands/CMakeLists_files.cmake
Commands/SurfaceCommands/CMakeLists_files.cmake
Commands/ToggleCommands/CMakeLists_files.cmake
Commands/ViewLink/CMakeLists_files.cmake
Commands/WellLogCommands/CMakeLists_files.cmake

View File

@ -0,0 +1,30 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportSurfacesFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicImportSurfacesFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
#set (QT_MOC_HEADERS
#${QT_MOC_HEADERS}
#${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.h
#)
source_group( "CommandFeature\\SurfaceCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
# cotire
caf_cotire_start_unity_at_first_item(SOURCE_GROUP_SOURCE_FILES)
list(APPEND CAF_COTIRE_START_NEW_UNITY_SOURCES
${CMAKE_CURRENT_LIST_DIR}/RicImportSurfacesFeature.cpp
)

View File

@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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 "RicImportSurfacesFeature.h"
#include "RiaApplication.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimSurface.h"
#include "RimSurfaceCollection.h"
#include "Riu3DMainWindowTools.h"
#include <QAction>
#include <QFileDialog>
CAF_CMD_SOURCE_INIT( RicImportSurfacesFeature, "RicImportSurfacesFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportSurfacesFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportSurfacesFeature::onActionTriggered( bool isChecked )
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "BINARY_GRID" );
QStringList fileNames = QFileDialog::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Surfaces",
defaultDir,
"Petrel surface file (*.ptl);All Files (*.*)" );
if ( fileNames.isEmpty() ) return;
// Remember the path to next time
app->setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( fileNames.last() ).absolutePath() );
// Find or create the AnnotationsCollection
RimProject* proj = RiaApplication::instance()->project();
RimSurfaceCollection* surfColl = proj->activeOilField()->surfaceCollection();
if ( !surfColl )
{
surfColl = new RimSurfaceCollection();
proj->activeOilField()->surfaceCollection = surfColl;
}
// For each file,
RimSurface* lastCreatedOrUpdated = surfColl->importSurfacesFromFiles( fileNames );
proj->updateConnectedEditors();
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
}
// surfColl->scheduleRedrawOfRelevantViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportSurfacesFeature::setupActionLook( QAction* actionToSetup )
{
// actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
actionToSetup->setText( "Import Surfaces" );
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicImportSurfacesFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,28 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
class RivSurfacePartMgr : public cvf::Object
{
public:
RivSurfacePartMgr( const RimSurfaceInView* surface );
void appendGeometryPartsToModel( cvf::ModelBasicList* model );
private:
};

View File

@ -31,6 +31,7 @@
#include "RimObservedSummaryData.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseMainCollection.h"
#include "RimSurfaceCollection.h"
#include "RimValveTemplateCollection.h"
#include "RimWellPathCollection.h"
@ -71,18 +72,20 @@ RimOilField::RimOilField( void )
"",
"" );
completionTemplateCollection = new RimCompletionTemplateCollection;
CAF_PDM_InitFieldNoDefault( &measurement, "Measurement", "Measurement", "", "", "" );
measurement = new RimMeasurement();
measurement.xmlCapability()->disableIO();
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseMainCollection = new RimSummaryCaseMainCollection();
observedDataCollection = new RimObservedDataCollection();
formationNamesCollection = new RimFormationNamesCollection();
annotationCollection = new RimAnnotationCollection();
CAF_PDM_InitFieldNoDefault( &surfaceCollection, "SurfaceCollection", "Surfaces", "", "", "" );
surfaceCollection = new RimSurfaceCollection();
completionTemplateCollection = new RimCompletionTemplateCollection;
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseMainCollection = new RimSummaryCaseMainCollection();
observedDataCollection = new RimObservedDataCollection();
formationNamesCollection = new RimFormationNamesCollection();
annotationCollection = new RimAnnotationCollection();
m_fractureTemplateCollection_OBSOLETE = new RimFractureTemplateCollection;
m_fractureTemplateCollection_OBSOLETE.xmlCapability()->setIOWritable( false );

View File

@ -37,6 +37,7 @@ class RimSummaryCaseMainCollection;
class RimWellPathCollection;
class RimAnnotationCollection;
class RimMeasurement;
class RimSurfaceCollection;
//==================================================================================================
///
@ -67,6 +68,7 @@ public:
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
caf::PdmChildField<RimAnnotationCollection*> annotationCollection;
caf::PdmChildField<RimMeasurement*> measurement;
caf::PdmChildField<RimSurfaceCollection*> surfaceCollection;
protected:
void initAfterRead() override;

View File

@ -70,6 +70,7 @@
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryCrossPlotCollection.h"
#include "RimSummaryPlotCollection.h"
#include "RimSurfaceCollection.h"
#include "RimTools.h"
#include "RimUserDefinedPolylinesAnnotation.h"
#include "RimValveTemplate.h"
@ -81,6 +82,7 @@
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "SsiHubImportCommands/RimWellPathImport.h"
#include "RiuMainWindow.h"
@ -1375,6 +1377,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
if ( oilField->analysisModels() ) uiTreeOrdering.add( oilField->analysisModels() );
if ( oilField->geoMechModels() ) uiTreeOrdering.add( oilField->geoMechModels() );
if ( oilField->wellPathCollection() ) uiTreeOrdering.add( oilField->wellPathCollection() );
if ( oilField->surfaceCollection() ) uiTreeOrdering.add( oilField->surfaceCollection() );
if ( oilField->formationNamesCollection() ) uiTreeOrdering.add( oilField->formationNamesCollection() );
if ( oilField->completionTemplateCollection() )
uiTreeOrdering.add( oilField->completionTemplateCollection() );

View File

@ -0,0 +1,24 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSurface.h
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceInView.h
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceInViewCollection.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSurface.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceInViewCollection.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "ProjectDataModel\\Surface" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -0,0 +1,202 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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 "RimSurface.h"
#include "RigSurface.h"
#include "cafUtils.h"
#include <QFileInfo>
#include <fstream>
#include <iosfwd>
#include <sstream>
#include <string>
CAF_PDM_SOURCE_INIT( RimSurface, "Surface" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurface::RimSurface()
{
CAF_PDM_InitObject( "Surface", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_userDescription, "SurfaceUserDecription", "Name", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_surfaceDefinitionFilePath, "SurfaceFilePath", "File", "", "", "" );
CAF_PDM_InitField( &m_color, "SurfaceColor", cvf::Color3f( 0.5f, 0.3f, 0.2f ), "Color", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurface::~RimSurface() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurface::setSurfaceFilePath( const QString& filePath )
{
m_surfaceDefinitionFilePath = filePath;
if ( m_userDescription().isEmpty() )
{
m_userDescription = QFileInfo( filePath ).fileName();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSurface::userDescription()
{
return m_userDescription();
}
struct SurfacePointData
{
int i;
int j;
cvf::Vec3d point;
std::vector<double> values;
};
//--------------------------------------------------------------------------------------------------
/// Returns false for fatal failure
//--------------------------------------------------------------------------------------------------
bool RimSurface::updateDataFromFile()
{
std::ifstream stream( this->surfaceFilePath().toLatin1().data() );
std::vector<SurfacePointData> surfaceDataPoints;
int minI = std::numeric_limits<int>::max();
int minJ = std::numeric_limits<int>::max();
int maxI = std::numeric_limits<int>::min();
int maxJ = std::numeric_limits<int>::min();
while ( stream.good() )
{
std::string line;
std::getline( stream, line );
std::istringstream lineStream( line );
double x( HUGE_VAL ), y( HUGE_VAL ), z( HUGE_VAL );
int i( -1 ), j( -1 );
std::vector<double> values;
// First check if we can read a number
lineStream >> x;
if ( lineStream.good() ) // If we can, assume this line is a surface point
{
lineStream >> y >> z >> i >> j;
if ( x != HUGE_VAL && y != HUGE_VAL && z != HUGE_VAL && i != -1 && j != -1 )
{
// Check for extra data
while ( lineStream.good() )
{
double d;
lineStream >> d;
if ( lineStream.good() ) values.push_back( d );
}
// Add point
surfaceDataPoints.push_back( {i, j, {x, y, z}, values} );
minI = std::min( minI, i );
minJ = std::min( minJ, j );
maxI = std::max( maxI, i );
maxJ = std::max( maxJ, j );
}
}
else // Probably a comment line, skip
{
}
}
// clang-format off
if ( surfaceDataPoints.empty()
|| minI == std::numeric_limits<int>::max()
|| minJ == std::numeric_limits<int>::max()
|| maxI == std::numeric_limits<int>::min()
|| maxJ == std::numeric_limits<int>::min() )
{
return false;
}
// clang-format on
// Create full size grid matrix
size_t iCount = maxI - minI + 1;
size_t jCount = maxJ - minJ + 1;
if ( iCount < 2 || jCount < 2 )
{
return false;
}
std::vector<std::vector<unsigned>> indexToPointData;
indexToPointData.resize( iCount, std::vector<unsigned>( jCount, -1 ) );
std::vector<cvf::Vec3d> vertices;
for ( unsigned pIdx = 0; pIdx < surfaceDataPoints.size(); ++pIdx )
{
const auto& pointData = surfaceDataPoints[pIdx];
indexToPointData[pointData.i - minI][pointData.j - minJ] = pIdx;
vertices.push_back( pointData.point );
// Todo: Move result values for each point into the
}
std::vector<unsigned> triangleIndices;
if ( indexToPointData.size() < 2 )
{
return false;
}
for ( size_t iIdx = 0; iIdx < indexToPointData.size() - 1; ++iIdx )
{
for ( size_t jIdx = 0; jIdx < indexToPointData[iIdx].size() - 1; ++jIdx )
{
{
unsigned q1 = indexToPointData[iIdx + 0][jIdx + 0];
unsigned q2 = indexToPointData[iIdx + 0][jIdx + 1];
unsigned q3 = indexToPointData[iIdx + 1][jIdx + 0];
unsigned q4 = indexToPointData[iIdx + 1][jIdx + 1];
if ( q1 != -1 && q2 != -1 && q4 != -1 )
{
triangleIndices.push_back( q1 );
triangleIndices.push_back( q2 );
triangleIndices.push_back( q4 );
}
if ( q1 != -1 && q2 != -1 && q3 != -1 )
{
triangleIndices.push_back( q1 );
triangleIndices.push_back( q4 );
triangleIndices.push_back( q3 );
}
}
}
}
m_surfaceData = new RigSurface();
m_surfaceData->setTriangleData( triangleIndices, vertices );
return true;
}

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfObject.h"
#include "cafPdmFieldCvfColor.h"
class RigSurface;
class RimSurface : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSurface();
~RimSurface() override;
void setSurfaceFilePath( const QString& filePath );
QString surfaceFilePath()
{
return m_surfaceDefinitionFilePath().path();
}
void setColor( const cvf::Color3f& color )
{
m_color = color;
}
bool updateDataFromFile();
QString userDescription();
private:
caf::PdmField<caf::FilePath> m_surfaceDefinitionFilePath;
caf::PdmField<QString> m_userDescription;
caf::PdmField<cvf::Color3f> m_color;
cvf::ref<RigSurface> m_surfaceData;
};

View File

@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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 "RimSurfaceCollection.h"
#include "QMessageBox"
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RimProject.h"
#include "RimSurface.h"
CAF_PDM_SOURCE_INIT( RimSurfaceCollection, "SurfaceCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceCollection::RimSurfaceCollection()
{
CAF_PDM_InitObject( "Surfaces", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_surfaces, "SurfacesField", "Surfaces", "", "", "" );
m_surfaces.uiCapability()->setUiTreeHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceCollection::~RimSurfaceCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceCollection::addSurface( RimSurface* surface )
{
m_surfaces.push_back( surface );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurface* RimSurfaceCollection::importSurfacesFromFiles( const QStringList& fileNames )
{
QStringList newFileNames;
std::vector<RimSurface*> surfacesToReload;
for ( const QString& newFileName : fileNames )
{
bool isFound = false;
for ( RimSurface* surface : m_surfaces() )
{
if ( surface->surfaceFilePath() == newFileName )
{
surfacesToReload.push_back( surface );
isFound = true;
break;
}
}
if ( !isFound )
{
newFileNames.push_back( newFileName );
}
}
size_t newSurfCount = 0;
size_t existingSurfCount = m_surfaces().size();
QString errorMessages;
for ( const QString& newFileName : newFileNames )
{
RimSurface* newSurface = new RimSurface;
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f( existingSurfCount + newSurfCount );
newSurface->setSurfaceFilePath( newFileName );
newSurface->setColor( newColor );
if ( !newSurface->updateDataFromFile() )
{
delete newSurface;
errorMessages += newFileName + "\n";
}
else
{
this->addSurface( newSurface );
surfacesToReload.push_back( newSurface );
++newSurfCount;
}
}
if ( !errorMessages.isEmpty() )
{
QMessageBox::warning( nullptr, "Import Surfaces:", "Could not import the following files:\n" + errorMessages );
}
this->updateConnectedEditors();
updateViews( surfacesToReload );
if ( !newFileNames.empty() )
{
return m_surfaces[m_surfaces.size() - 1];
}
else
{
return nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToReload )
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimGridView*> views;
proj->allVisibleGridViews( views );
for ( auto view : views )
{
// Update SurfaceInViewCollection
// For each visible surfaceInView included in surfsToReload
// LoadDataAndUpdate
}
}

View File

@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimSurface;
class RimSurfaceCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSurfaceCollection();
~RimSurfaceCollection() override;
void addSurface( RimSurface* surface );
RimSurface* importSurfacesFromFiles( const QStringList& fileNames );
private:
void updateViews( const std::vector<RimSurface*>& surfsToReload );
caf::PdmChildArrayField<RimSurface*> m_surfaces;
};

View File

@ -0,0 +1,53 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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 "RimSurfaceInView.h"
#include "RimSurface.h"
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceInView::RimSurfaceInView()
{
CAF_PDM_InitObject( "Surface", "", "", "" );
CAF_PDM_InitField( &m_isActive, "IsActive", true, "Visible", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceInView::~RimSurfaceInView() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSurfaceInView::name()
{
if ( m_surface ) return m_surface->userDescription();
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceInView::loadDataAndUpdate() {}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
class RimSurface;
class RimSurfaceInView : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSurfaceInView();
~RimSurfaceInView() override;
QString name();
void loadDataAndUpdate();
private:
caf::PdmProxyValueField<QString> m_name;
caf::PdmField<bool> m_isActive;
caf::PdmPtrField<RimSurface*> m_surface;
};

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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 "RimSurfaceInViewCollection.h"
#include "RimSurfaceInView.h"
CAF_PDM_SOURCE_INIT( RimSurfaceInViewCollection, "SurfaceInViewCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceInViewCollection::RimSurfaceInViewCollection()
{
CAF_PDM_InitObject( "Surfaces", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "SurfacesInViewField", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceInViewCollection::~RimSurfaceInViewCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceInViewCollection::updateFromSurfaceCollection() {}

View File

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
class RimSurfaceInView;
class RimSurfaceInViewCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSurfaceInViewCollection();
~RimSurfaceInViewCollection() override;
void updateFromSurfaceCollection();
private:
caf::PdmChildArrayField<RimSurfaceInView*> m_surfacesInView;
};

View File

@ -65,6 +65,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.h
${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.h
${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.h
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.h
${CMAKE_CURRENT_LIST_DIR}/RigSurface.h
${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.h
${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RigPolyLinesData.h
@ -137,6 +138,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigFractureGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigFractureCell.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellResultPoint.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RigSurface.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.cpp
${CMAKE_CURRENT_LIST_DIR}/RigGeoMechBoreHoleStressCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RigPolyLinesData.cpp

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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 "RigSurface.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSurface::RigSurface() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSurface::~RigSurface() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigSurface::setTriangleData( const std::vector<unsigned>& tringleIndices, const std::vector<cvf::Vec3d>& vertices )
{
m_triangleIndices = tringleIndices;
m_vertices = vertices;
}

View File

@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfObject.h"
#include "cvfVector3.h"
#include <QString>
#include <map>
#include <vector>
class RigSurface : public cvf::Object
{
public:
RigSurface();
~RigSurface() override;
const std::vector<unsigned>& triangleVertices()
{
return m_triangleIndices;
}
const std::vector<cvf::Vec3d>& vertices()
{
return m_vertices;
}
void setTriangleData( const std::vector<unsigned>& tringleIndices, const std::vector<cvf::Vec3d>& vertices );
void addVerticeResult( const QString resultName, const std::vector<double>& resultValues );
private:
std::vector<unsigned> m_triangleIndices;
std::vector<cvf::Vec3d> m_vertices;
std::map<QString, std::vector<double>> m_verticeResults;
};

View File

@ -456,6 +456,7 @@ void RiuMainWindow::createMenus()
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedDataInMenuFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportObservedFmuDataInMenuFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportFormationNamesFeature" ) );
importMenu->addAction( cmdFeatureMgr->action( "RicImportSurfacesFeature" ) );
QMenu* exportMenu = fileMenu->addMenu( "&Export" );
exportMenu->addAction( cmdFeatureMgr->action( "RicSnapshotViewToFileFeature" ) );