mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5285 Visualization and update of Surfaces
This commit is contained in:
parent
e9086005d4
commit
e6d96316d4
@ -71,6 +71,7 @@
|
|||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
#include "RimSummaryCrossPlotCollection.h"
|
#include "RimSummaryCrossPlotCollection.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSurfaceCollection.h"
|
||||||
#include "RimTextAnnotation.h"
|
#include "RimTextAnnotation.h"
|
||||||
#include "RimTextAnnotationInView.h"
|
#include "RimTextAnnotationInView.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
@ -541,6 +542,8 @@ bool RiaApplication::loadProject( const QString& projectFileName,
|
|||||||
fracture->loadDataAndUpdate();
|
fracture->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oilField->surfaceCollection()->loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If load action is specified to recalculate statistics, do it now.
|
// If load action is specified to recalculate statistics, do it now.
|
||||||
|
@ -57,6 +57,7 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization
|
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
|
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
|
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Surfaces
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface
|
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface/Core
|
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface/Core
|
||||||
@ -142,6 +143,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
|||||||
ModelVisualization/CMakeLists_files.cmake
|
ModelVisualization/CMakeLists_files.cmake
|
||||||
ModelVisualization/GridBox/CMakeLists_files.cmake
|
ModelVisualization/GridBox/CMakeLists_files.cmake
|
||||||
ModelVisualization/Intersections/CMakeLists_files.cmake
|
ModelVisualization/Intersections/CMakeLists_files.cmake
|
||||||
|
ModelVisualization/Surfaces/CMakeLists_files.cmake
|
||||||
ModelVisualization/WindowEdgeAxesOverlayItem/CMakeLists_files.cmake
|
ModelVisualization/WindowEdgeAxesOverlayItem/CMakeLists_files.cmake
|
||||||
|
|
||||||
UserInterface/CMakeLists_files.cmake
|
UserInterface/CMakeLists_files.cmake
|
||||||
|
@ -89,7 +89,7 @@ void RicNewViewFeature::setupActionLook( QAction* actionToSetup )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
Rim3dView* RicNewViewFeature::createReservoirView( RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase )
|
Rim3dView* RicNewViewFeature::createReservoirView( RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase )
|
||||||
{
|
{
|
||||||
Rim3dView* insertedView = nullptr;
|
RimGridView* insertedView = nullptr;
|
||||||
|
|
||||||
if ( eclipseCase )
|
if ( eclipseCase )
|
||||||
{
|
{
|
||||||
@ -100,6 +100,8 @@ Rim3dView* RicNewViewFeature::createReservoirView( RimEclipseCase* eclipseCase,
|
|||||||
insertedView = geomCase->createAndAddReservoirView();
|
insertedView = geomCase->createAndAddReservoirView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insertedView->updateSurfacesInViewTreeItems();
|
||||||
|
|
||||||
// Must be run before buildViewItems, as wells are created in this function
|
// Must be run before buildViewItems, as wells are created in this function
|
||||||
insertedView->loadDataAndUpdate();
|
insertedView->loadDataAndUpdate();
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RivSurfacePartMgr.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RivSurfacePartMgr.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_SOURCE_FILES
|
||||||
|
${SOURCE_GROUP_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
source_group( "ModelVisualization\\Surfaces" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,97 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RivSurfacePartMgr.h"
|
||||||
|
|
||||||
|
#include "RigSurface.h"
|
||||||
|
#include "RimSurface.h"
|
||||||
|
#include "RimSurfaceInView.h"
|
||||||
|
|
||||||
|
#include "RimCase.h"
|
||||||
|
#include "cafEffectGenerator.h"
|
||||||
|
#include "cvfDrawableGeo.h"
|
||||||
|
#include "cvfModelBasicList.h"
|
||||||
|
#include "cvfPart.h"
|
||||||
|
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RivSurfacePartMgr::RivSurfacePartMgr( RimSurfaceInView* surface )
|
||||||
|
: m_surfaceInView( surface )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RivSurfacePartMgr::appendNativeGeometryPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
|
||||||
|
{
|
||||||
|
if ( m_nativeTrianglesPart.isNull() || m_surfaceInView->surface()->surfaceData() != m_usedSurfaceData.p() )
|
||||||
|
{
|
||||||
|
generateNativePartGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_nativeTrianglesPart.notNull() )
|
||||||
|
{
|
||||||
|
m_nativeTrianglesPart->setTransform( scaleTransform );
|
||||||
|
|
||||||
|
caf::SurfaceEffectGenerator surfaceGen( cvf::Color4f( m_surfaceInView->surface()->color() ), caf::PO_1 );
|
||||||
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||||
|
m_nativeTrianglesPart->setEffect( eff.p() );
|
||||||
|
|
||||||
|
model->addPart( m_nativeTrianglesPart.p() );
|
||||||
|
|
||||||
|
if ( m_nativeMeshLinesPart.notNull() )
|
||||||
|
{
|
||||||
|
m_nativeMeshLinesPart->setTransform( scaleTransform );
|
||||||
|
model->addPart( m_nativeMeshLinesPart.p() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RivSurfacePartMgr::generateNativePartGeometry()
|
||||||
|
{
|
||||||
|
RimCase* ownerCase;
|
||||||
|
m_surfaceInView->firstAncestorOrThisOfTypeAsserted( ownerCase );
|
||||||
|
cvf::Vec3d displayModOffsett = ownerCase->displayModelOffset();
|
||||||
|
|
||||||
|
m_usedSurfaceData = m_surfaceInView->surface()->surfaceData();
|
||||||
|
|
||||||
|
const std::vector<cvf::Vec3d>& vertices = m_usedSurfaceData->vertices();
|
||||||
|
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray( vertices.size() );
|
||||||
|
for ( size_t i = 0; i < vertices.size(); ++i )
|
||||||
|
{
|
||||||
|
( *cvfVertices )[i] = cvf::Vec3f( vertices[i] - displayModOffsett );
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<unsigned>& triangleIndices = m_usedSurfaceData->triangleIndices();
|
||||||
|
cvf::ref<cvf::UIntArray> cvfIndices = new cvf::UIntArray( triangleIndices );
|
||||||
|
cvf::ref<cvf::PrimitiveSetIndexedUInt> indexSet = new cvf::PrimitiveSetIndexedUInt( cvf::PT_TRIANGLES );
|
||||||
|
indexSet->setIndices( cvfIndices.p() );
|
||||||
|
|
||||||
|
cvf::ref<cvf::DrawableGeo> drawGeo = new cvf::DrawableGeo;
|
||||||
|
drawGeo->addPrimitiveSet( indexSet.p() );
|
||||||
|
drawGeo->setVertexArray( cvfVertices.p() );
|
||||||
|
|
||||||
|
m_nativeTrianglesPart = new cvf::Part();
|
||||||
|
m_nativeTrianglesPart->setDrawable( drawGeo.p() );
|
||||||
|
}
|
@ -17,12 +17,34 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
#include "cvfObject.h"
|
||||||
|
|
||||||
|
namespace cvf
|
||||||
|
{
|
||||||
|
class ModelBasicList;
|
||||||
|
class Transform;
|
||||||
|
class Part;
|
||||||
|
class ScalarMapper;
|
||||||
|
class DrawableGeo;
|
||||||
|
} // namespace cvf
|
||||||
|
|
||||||
|
class RimSurfaceInView;
|
||||||
|
class RigSurface;
|
||||||
|
|
||||||
class RivSurfacePartMgr : public cvf::Object
|
class RivSurfacePartMgr : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RivSurfacePartMgr( const RimSurfaceInView* surface );
|
explicit RivSurfacePartMgr( RimSurfaceInView* surface );
|
||||||
|
|
||||||
void appendGeometryPartsToModel( cvf::ModelBasicList* model );
|
void appendNativeGeometryPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void generateNativePartGeometry();
|
||||||
|
|
||||||
|
caf::PdmPointer<RimSurfaceInView> m_surfaceInView;
|
||||||
|
cvf::ref<RigSurface> m_usedSurfaceData; // Store the reference to the old data, to know when new data has arrived.
|
||||||
|
|
||||||
|
cvf::ref<cvf::Part> m_nativeTrianglesPart;
|
||||||
|
cvf::ref<cvf::Part> m_nativeMeshLinesPart;
|
||||||
};
|
};
|
||||||
|
@ -539,6 +539,15 @@ void RimEclipseView::onCreateDisplayModel()
|
|||||||
m_reservoirGridPartManager->scaleTransform() );
|
m_reservoirGridPartManager->scaleTransform() );
|
||||||
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
|
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
|
||||||
|
|
||||||
|
// Surfaces
|
||||||
|
|
||||||
|
m_surfaceVizModel->removeAllParts();
|
||||||
|
if ( m_surfaceCollection )
|
||||||
|
{
|
||||||
|
m_surfaceCollection->appendPartsToModel( m_surfaceVizModel.p(), m_reservoirGridPartManager->scaleTransform() );
|
||||||
|
nativeOrOverrideViewer()->addStaticModelOnce( m_surfaceVizModel.p(), isUsingOverrideViewer() );
|
||||||
|
}
|
||||||
|
|
||||||
// Well path model
|
// Well path model
|
||||||
|
|
||||||
m_wellPathPipeVizModel->removeAllParts();
|
m_wellPathPipeVizModel->removeAllParts();
|
||||||
|
@ -298,6 +298,15 @@ void RimGeoMechView::onCreateDisplayModel()
|
|||||||
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
||||||
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
|
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
|
||||||
|
|
||||||
|
// Surfaces
|
||||||
|
|
||||||
|
m_surfaceVizModel->removeAllParts();
|
||||||
|
if ( m_surfaceCollection )
|
||||||
|
{
|
||||||
|
m_surfaceCollection->appendPartsToModel( m_surfaceVizModel.p(), scaleTransform() );
|
||||||
|
nativeOrOverrideViewer()->addStaticModelOnce( m_surfaceVizModel.p(), isUsingOverrideViewer() );
|
||||||
|
}
|
||||||
|
|
||||||
// If the animation was active before recreating everything, make viewer view current frame
|
// If the animation was active before recreating everything, make viewer view current frame
|
||||||
|
|
||||||
if ( isTimeStepDependentDataVisibleInThisOrComparisonView() )
|
if ( isTimeStepDependentDataVisibleInThisOrComparisonView() )
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "RivSingleCellPartGenerator.h"
|
#include "RivSingleCellPartGenerator.h"
|
||||||
|
|
||||||
#include "cvfModel.h"
|
#include "cvfModel.h"
|
||||||
|
#include "cvfModelBasicList.h"
|
||||||
#include "cvfPart.h"
|
#include "cvfPart.h"
|
||||||
#include "cvfScene.h"
|
#include "cvfScene.h"
|
||||||
|
|
||||||
@ -103,6 +104,9 @@ RimGridView::RimGridView()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceInViewCollection", "Surface Collection Field", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceInViewCollection", "Surface Collection Field", "", "", "" );
|
||||||
m_surfaceCollection.uiCapability()->setUiTreeHidden( true );
|
m_surfaceCollection.uiCapability()->setUiTreeHidden( true );
|
||||||
|
|
||||||
|
m_surfaceVizModel = new cvf::ModelBasicList;
|
||||||
|
m_surfaceVizModel->setName( "SurfaceModel" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -90,6 +90,8 @@ protected:
|
|||||||
void initAfterRead() override;
|
void initAfterRead() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
cvf::ref<cvf::ModelBasicList> m_surfaceVizModel;
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
caf::PdmChildField<RimIntersectionCollection*> m_intersectionCollection;
|
caf::PdmChildField<RimIntersectionCollection*> m_intersectionCollection;
|
||||||
|
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
#include "RimSurface.h"
|
#include "RimSurface.h"
|
||||||
|
|
||||||
|
#include "RimSurfaceCollection.h"
|
||||||
|
|
||||||
#include "RigSurface.h"
|
#include "RigSurface.h"
|
||||||
#include "cafUtils.h"
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iosfwd>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimSurface, "Surface" );
|
CAF_PDM_SOURCE_INIT( RimSurface, "Surface" );
|
||||||
|
|
||||||
@ -56,6 +57,30 @@ void RimSurface::setSurfaceFilePath( const QString& filePath )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSurface::surfaceFilePath()
|
||||||
|
{
|
||||||
|
return m_surfaceDefinitionFilePath().path();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSurface::setColor( const cvf::Color3f& color )
|
||||||
|
{
|
||||||
|
m_color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Color3f RimSurface::color() const
|
||||||
|
{
|
||||||
|
return m_color();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -64,6 +89,14 @@ QString RimSurface::userDescription()
|
|||||||
return m_userDescription();
|
return m_userDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigSurface* RimSurface::surfaceData()
|
||||||
|
{
|
||||||
|
return m_surfaceData.p();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -81,13 +114,17 @@ void RimSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|||||||
{
|
{
|
||||||
if ( changedField == &m_surfaceDefinitionFilePath )
|
if ( changedField == &m_surfaceDefinitionFilePath )
|
||||||
{
|
{
|
||||||
updateDataFromFile();
|
updateSurfaceDataFromFile();
|
||||||
|
|
||||||
// Todo: Update visualization
|
RimSurfaceCollection* surfColl;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
||||||
|
surfColl->updateViews( {this} );
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_color )
|
else if ( changedField == &m_color )
|
||||||
{
|
{
|
||||||
// Todo: Update visualization
|
RimSurfaceCollection* surfColl;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
||||||
|
surfColl->updateViews( {this} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +139,7 @@ struct SurfacePointData
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Returns false for fatal failure
|
/// Returns false for fatal failure
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimSurface::updateDataFromFile()
|
bool RimSurface::updateSurfaceDataFromFile()
|
||||||
{
|
{
|
||||||
std::ifstream stream( this->surfaceFilePath().toLatin1().data() );
|
std::ifstream stream( this->surfaceFilePath().toLatin1().data() );
|
||||||
|
|
||||||
|
@ -35,16 +35,13 @@ public:
|
|||||||
~RimSurface() override;
|
~RimSurface() override;
|
||||||
|
|
||||||
void setSurfaceFilePath( const QString& filePath );
|
void setSurfaceFilePath( const QString& filePath );
|
||||||
QString surfaceFilePath()
|
QString surfaceFilePath();
|
||||||
{
|
|
||||||
return m_surfaceDefinitionFilePath().path();
|
|
||||||
}
|
|
||||||
void setColor( const cvf::Color3f& color )
|
|
||||||
{
|
|
||||||
m_color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool updateDataFromFile();
|
void setColor( const cvf::Color3f& color );
|
||||||
|
cvf::Color3f color() const;
|
||||||
|
|
||||||
|
bool updateSurfaceDataFromFile();
|
||||||
|
RigSurface* surfaceData();
|
||||||
|
|
||||||
QString userDescription();
|
QString userDescription();
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ RimSurface* RimSurfaceCollection::importSurfacesFromFiles( const QStringList& fi
|
|||||||
newSurface->setSurfaceFilePath( newFileName );
|
newSurface->setSurfaceFilePath( newFileName );
|
||||||
newSurface->setColor( newColor );
|
newSurface->setColor( newColor );
|
||||||
|
|
||||||
if ( !newSurface->updateDataFromFile() )
|
if ( !newSurface->updateSurfaceDataFromFile() )
|
||||||
{
|
{
|
||||||
delete newSurface;
|
delete newSurface;
|
||||||
errorMessages += newFileName + "\n";
|
errorMessages += newFileName + "\n";
|
||||||
@ -132,20 +132,36 @@ std::vector<RimSurface*> RimSurfaceCollection::surfaces() const
|
|||||||
return m_surfaces.childObjects();
|
return m_surfaces.childObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSurfaceCollection::loadData()
|
||||||
|
{
|
||||||
|
for ( auto surf : m_surfaces )
|
||||||
|
{
|
||||||
|
if ( !surf->updateSurfaceDataFromFile() )
|
||||||
|
{
|
||||||
|
// Error: could not open the surface file surf->surfaceFilePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToReload )
|
void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToReload )
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
std::vector<RimGridView*> views;
|
|
||||||
proj->allVisibleGridViews( views );
|
std::vector<Rim3dView*> views;
|
||||||
|
proj->allViews( views );
|
||||||
|
|
||||||
// Make sure the tree items are syncronized
|
// Make sure the tree items are syncronized
|
||||||
|
|
||||||
for ( auto view : views )
|
for ( auto view : views )
|
||||||
{
|
{
|
||||||
view->updateSurfacesInViewTreeItems();
|
auto gridView = dynamic_cast<RimGridView*>( view );
|
||||||
|
if ( gridView ) gridView->updateSurfacesInViewTreeItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<RimGridView*> viewsNeedingUpdate;
|
std::set<RimGridView*> viewsNeedingUpdate;
|
||||||
|
@ -36,10 +36,10 @@ public:
|
|||||||
|
|
||||||
std::vector<RimSurface*> surfaces() const;
|
std::vector<RimSurface*> surfaces() const;
|
||||||
|
|
||||||
|
void loadData();
|
||||||
void updateViews();
|
void updateViews();
|
||||||
|
|
||||||
private:
|
|
||||||
void updateViews( const std::vector<RimSurface*>& surfsToReload );
|
void updateViews( const std::vector<RimSurface*>& surfsToReload );
|
||||||
|
|
||||||
|
private:
|
||||||
caf::PdmChildArrayField<RimSurface*> m_surfaces;
|
caf::PdmChildArrayField<RimSurface*> m_surfaces;
|
||||||
};
|
};
|
||||||
|
@ -18,8 +18,11 @@
|
|||||||
|
|
||||||
#include "RimSurfaceInView.h"
|
#include "RimSurfaceInView.h"
|
||||||
|
|
||||||
|
#include "RimGridView.h"
|
||||||
#include "RimSurface.h"
|
#include "RimSurface.h"
|
||||||
|
|
||||||
|
#include "RivSurfacePartMgr.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
|
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -75,6 +78,47 @@ void RimSurfaceInView::setSurface( RimSurface* surf )
|
|||||||
m_surface = surf;
|
m_surface = surf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimSurfaceInView::isActive()
|
||||||
|
{
|
||||||
|
return m_isActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSurfaceInView::clearGeometry()
|
||||||
|
{
|
||||||
|
m_surfacePartMgr = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RivSurfacePartMgr* RimSurfaceInView::surfacePartMgr()
|
||||||
|
{
|
||||||
|
if ( m_surfacePartMgr.isNull() ) m_surfacePartMgr = new RivSurfacePartMgr( this );
|
||||||
|
|
||||||
|
return m_surfacePartMgr.p();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue )
|
||||||
|
{
|
||||||
|
if ( changedField == &m_isActive )
|
||||||
|
{
|
||||||
|
RimGridView* ownerView;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||||
|
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -22,7 +22,10 @@
|
|||||||
#include "cafPdmProxyValueField.h"
|
#include "cafPdmProxyValueField.h"
|
||||||
#include "cafPdmPtrField.h"
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
#include "cvfObject.h"
|
||||||
|
|
||||||
class RimSurface;
|
class RimSurface;
|
||||||
|
class RivSurfacePartMgr;
|
||||||
|
|
||||||
class RimSurfaceInView : public caf::PdmObject
|
class RimSurfaceInView : public caf::PdmObject
|
||||||
{
|
{
|
||||||
@ -37,12 +40,21 @@ public:
|
|||||||
QString name() const;
|
QString name() const;
|
||||||
RimSurface* surface() const;
|
RimSurface* surface() const;
|
||||||
void setSurface( RimSurface* surf );
|
void setSurface( RimSurface* surf );
|
||||||
|
bool isActive();
|
||||||
|
|
||||||
|
void clearGeometry();
|
||||||
|
RivSurfacePartMgr* surfacePartMgr();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
caf::PdmFieldHandle* objectToggleField() override;
|
caf::PdmFieldHandle* objectToggleField() override;
|
||||||
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue ) override;
|
||||||
|
|
||||||
caf::PdmProxyValueField<QString> m_name;
|
caf::PdmProxyValueField<QString> m_name;
|
||||||
caf::PdmField<bool> m_isActive;
|
caf::PdmField<bool> m_isActive;
|
||||||
caf::PdmPtrField<RimSurface*> m_surface;
|
caf::PdmPtrField<RimSurface*> m_surface;
|
||||||
|
|
||||||
|
cvf::ref<RivSurfacePartMgr> m_surfacePartMgr;
|
||||||
};
|
};
|
||||||
|
@ -19,11 +19,16 @@
|
|||||||
#include "RimSurfaceInViewCollection.h"
|
#include "RimSurfaceInViewCollection.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
#include "RimGridView.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSurfaceCollection.h"
|
#include "RimSurfaceCollection.h"
|
||||||
#include "RimSurfaceInView.h"
|
#include "RimSurfaceInView.h"
|
||||||
|
|
||||||
|
#include "RivSurfacePartMgr.h"
|
||||||
|
|
||||||
|
#include "cvfModelBasicList.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimSurfaceInViewCollection, "SurfaceInViewCollection" );
|
CAF_PDM_SOURCE_INIT( RimSurfaceInViewCollection, "SurfaceInViewCollection" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -86,6 +91,39 @@ void RimSurfaceInViewCollection::updateFromSurfaceCollection()
|
|||||||
this->updateConnectedEditors();
|
this->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSurfaceInViewCollection::appendPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
|
||||||
|
{
|
||||||
|
if ( !m_isActive() ) return;
|
||||||
|
|
||||||
|
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||||
|
{
|
||||||
|
if ( surf->isActive() )
|
||||||
|
{
|
||||||
|
surf->surfacePartMgr()->appendNativeGeometryPartsToModel( model, scaleTransform );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model->updateBoundingBoxesRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSurfaceInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue )
|
||||||
|
{
|
||||||
|
if ( changedField == &m_isActive )
|
||||||
|
{
|
||||||
|
RimGridView* ownerView;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||||
|
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -21,6 +21,13 @@
|
|||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
namespace cvf
|
||||||
|
{
|
||||||
|
class ModelBasicList;
|
||||||
|
class Transform;
|
||||||
|
class ScalarMapper;
|
||||||
|
} // namespace cvf
|
||||||
|
|
||||||
class RimSurfaceInView;
|
class RimSurfaceInView;
|
||||||
class RimSurface;
|
class RimSurface;
|
||||||
|
|
||||||
@ -34,10 +41,15 @@ public:
|
|||||||
|
|
||||||
void updateFromSurfaceCollection();
|
void updateFromSurfaceCollection();
|
||||||
|
|
||||||
|
void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmFieldHandle* objectToggleField() override;
|
caf::PdmFieldHandle* objectToggleField() override;
|
||||||
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue ) override;
|
||||||
|
|
||||||
bool hasSurfaceInViewForSurface(const RimSurface * surf) const;
|
bool hasSurfaceInViewForSurface( const RimSurface* surf ) const;
|
||||||
|
|
||||||
caf::PdmField<bool> m_isActive;
|
caf::PdmField<bool> m_isActive;
|
||||||
caf::PdmChildArrayField<RimSurfaceInView*> m_surfacesInView;
|
caf::PdmChildArrayField<RimSurfaceInView*> m_surfacesInView;
|
||||||
|
@ -27,6 +27,22 @@ RigSurface::RigSurface() {}
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigSurface::~RigSurface() {}
|
RigSurface::~RigSurface() {}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::vector<unsigned>& RigSurface::triangleIndices()
|
||||||
|
{
|
||||||
|
return m_triangleIndices;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::vector<cvf::Vec3d>& RigSurface::vertices()
|
||||||
|
{
|
||||||
|
return m_vertices;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -31,14 +31,8 @@ public:
|
|||||||
RigSurface();
|
RigSurface();
|
||||||
~RigSurface() override;
|
~RigSurface() override;
|
||||||
|
|
||||||
const std::vector<unsigned>& triangleVertices()
|
const std::vector<unsigned>& triangleIndices();
|
||||||
{
|
const std::vector<cvf::Vec3d>& vertices();
|
||||||
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 setTriangleData( const std::vector<unsigned>& tringleIndices, const std::vector<cvf::Vec3d>& vertices );
|
||||||
void addVerticeResult( const QString resultName, const std::vector<double>& resultValues );
|
void addVerticeResult( const QString resultName, const std::vector<double>& resultValues );
|
||||||
|
Loading…
Reference in New Issue
Block a user