mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Surface Folders
* #7978 Ensemble Surface : Use collection instead of specialized class * Review updates
This commit is contained in:
parent
41f80e7d89
commit
7b1185cec4
@ -64,6 +64,8 @@ void RicImportEnsembleSurfaceFeature::onActionTriggered( bool isChecked )
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString pathCacheName = "ENSEMBLE_SURFACE_FILES";
|
||||
QStringList fileNames = runRecursiveFileSearchDialog( "Import Ensemble Surface", pathCacheName );
|
||||
|
||||
importEnsembleSurfaceFromFiles( fileNames );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -100,13 +102,12 @@ void RicImportEnsembleSurfaceFeature::importEnsembleSurfaceFromFiles( const QStr
|
||||
if ( surfaces.empty() ) return;
|
||||
|
||||
RimEnsembleSurface* ensemble = new RimEnsembleSurface;
|
||||
ensemble->setName( ensembleName );
|
||||
ensemble->setCollectionName( ensembleName );
|
||||
for ( auto surface : surfaces )
|
||||
ensemble->addFileSurface( surface );
|
||||
|
||||
RimProject::current()->activeOilField()->surfaceCollection->addEnsembleSurface( ensemble );
|
||||
|
||||
ensemble->loadDataAndUpdate();
|
||||
RimProject::current()->activeOilField()->surfaceCollection->addEnsembleSurface( ensemble );
|
||||
|
||||
RimProject::current()->activeOilField()->surfaceCollection->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( ensemble );
|
||||
|
@ -173,6 +173,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateSurfaceIntersection
|
||||
|
||||
rimSurface->loadDataIfRequired();
|
||||
auto surface = rimSurface->surfaceData();
|
||||
if ( !surface ) return;
|
||||
|
||||
std::vector<cvf::Vec3d> transformedSurfacePolyline;
|
||||
|
||||
|
@ -237,6 +237,8 @@ QString RivSurfacePartMgr::resultInfoText( Rim3dView* view, uint hitPart, cvf::V
|
||||
{
|
||||
const auto& values =
|
||||
m_usedSurfaceData->propertyValues( m_surfaceInView->surfaceResultDefinition()->propertyName() );
|
||||
if ( values.empty() ) return "";
|
||||
|
||||
const auto& ind = m_usedSurfaceData->triangleIndices();
|
||||
const auto& vert = m_usedSurfaceData->vertices();
|
||||
|
||||
@ -253,9 +255,11 @@ QString RivSurfacePartMgr::resultInfoText( Rim3dView* view, uint hitPart, cvf::V
|
||||
double dist2 = vert[vertIndex2].pointDistance( hitPoint );
|
||||
double dist3 = vert[vertIndex3].pointDistance( hitPoint );
|
||||
|
||||
double resultValue = values[vertIndex1];
|
||||
if ( dist2 < dist1 ) resultValue = values[vertIndex2];
|
||||
if ( ( dist3 < dist1 ) && ( dist3 < dist2 ) ) resultValue = values[vertIndex3];
|
||||
double resultValue = -1.0;
|
||||
if ( vertIndex1 < values.size() ) resultValue = values[vertIndex1];
|
||||
if ( dist2 < dist1 && vertIndex2 < values.size() ) resultValue = values[vertIndex2];
|
||||
if ( ( dist3 < dist1 ) && ( dist3 < dist2 ) && vertIndex3 < values.size() )
|
||||
resultValue = values[vertIndex3];
|
||||
|
||||
retval +=
|
||||
QString( "%1 : %2\n\n" ).arg( m_surfaceInView->surfaceResultDefinition()->propertyName() ).arg( resultValue );
|
||||
|
@ -489,18 +489,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
RimSurfaceCollection* surfColl = RimProject::current()->activeOilField()->surfaceCollection();
|
||||
|
||||
caf::IconProvider surfaceIcon( ":/ReservoirSurface16x16.png" );
|
||||
for ( auto surf : surfColl->surfaces() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( surf->userDescription(), surf, false, surfaceIcon ) );
|
||||
}
|
||||
for ( auto ensambleSurf : surfColl->ensembleSurfaces() )
|
||||
{
|
||||
for ( auto surf : ensambleSurf->surfaces() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( surf->userDescription(), surf, false, surfaceIcon ) );
|
||||
}
|
||||
}
|
||||
appendOptionItemsForSources( 0, surfColl, options );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1084,3 +1073,27 @@ double RimExtrudedCurveIntersection::azimuthInRadians( cvf::Vec3d vec )
|
||||
{
|
||||
return cvf::GeometryTools::getAngle( -cvf::Vec3d::Z_AXIS, cvf::Vec3d::Y_AXIS, vec );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimExtrudedCurveIntersection::appendOptionItemsForSources( int currentLevel,
|
||||
RimSurfaceCollection* currentCollection,
|
||||
QList<caf::PdmOptionItemInfo>& options ) const
|
||||
{
|
||||
caf::IconProvider surfaceIcon( ":/ReservoirSurface16x16.png" );
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo::createHeader( currentCollection->collectionName(), true ) );
|
||||
|
||||
for ( auto surf : currentCollection->surfaces() )
|
||||
{
|
||||
auto itemInfo = caf::PdmOptionItemInfo( surf->userDescription(), surf, false, surfaceIcon );
|
||||
itemInfo.setLevel( currentLevel + 1 );
|
||||
options.push_back( itemInfo );
|
||||
}
|
||||
|
||||
for ( auto subColl : currentCollection->subCollections() )
|
||||
{
|
||||
appendOptionItemsForSources( currentLevel, subColl, options );
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ class RimSimWellInView;
|
||||
class RimSimWellInViewCollection;
|
||||
class Rim2dIntersectionView;
|
||||
class RimSurface;
|
||||
class RimSurfaceCollection;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -131,6 +132,10 @@ private:
|
||||
void updateName();
|
||||
static double azimuthInRadians( cvf::Vec3d vec );
|
||||
|
||||
void appendOptionItemsForSources( int currentLevel,
|
||||
RimSurfaceCollection* currentCollection,
|
||||
QList<caf::PdmOptionItemInfo>& options ) const;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
|
||||
|
@ -7,7 +7,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceResultDefinition.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleSurface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleSurfaceInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsSurface.h
|
||||
)
|
||||
|
||||
@ -20,7 +19,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceResultDefinition.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleSurface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleSurfaceInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEnsembleStatisticsSurface.cpp
|
||||
)
|
||||
|
||||
|
@ -81,7 +81,7 @@ bool RimEnsembleStatisticsSurface::onLoadData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurface* RimEnsembleStatisticsSurface::createCopy()
|
||||
{
|
||||
RimEnsembleStatisticsSurface* newSurface = dynamic_cast<RimEnsembleStatisticsSurface*>(
|
||||
auto* newSurface = dynamic_cast<RimEnsembleStatisticsSurface*>(
|
||||
xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
if ( !newSurface->onLoadData() )
|
||||
@ -96,7 +96,7 @@ RimSurface* RimEnsembleStatisticsSurface::createCopy()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEnsembleStatisticsSurface ::updateSurfaceData()
|
||||
bool RimEnsembleStatisticsSurface::updateSurfaceData()
|
||||
{
|
||||
RimEnsembleSurface* ensembleSurface;
|
||||
firstAncestorOrThisOfType( ensembleSurface );
|
||||
@ -107,24 +107,11 @@ bool RimEnsembleStatisticsSurface ::updateSurfaceData()
|
||||
|
||||
if ( surface )
|
||||
{
|
||||
const std::vector<unsigned int>& indices = surface->triangleIndices();
|
||||
const std::vector<cvf::Vec3d>& vertices = surface->vertices();
|
||||
|
||||
const std::vector<float>& meanValues = surface->propertyValues(
|
||||
caf::AppEnum<RigSurfaceStatisticsCalculator::StatisticsType>::text( m_statisticsType.v() ) );
|
||||
|
||||
std::vector<cvf::Vec3d> verts;
|
||||
for ( size_t i = 0; i < vertices.size(); i++ )
|
||||
{
|
||||
verts.push_back( cvf::Vec3d( vertices[i].x(), vertices[i].y(), meanValues[i] ) );
|
||||
}
|
||||
|
||||
m_tringleIndices = indices;
|
||||
m_vertices = verts;
|
||||
const auto indices = surface->triangleIndices();
|
||||
const auto verts = extractStatisticalDepthForVertices( surface );
|
||||
|
||||
m_surfaceData = new RigSurface;
|
||||
|
||||
m_surfaceData->setTriangleData( m_tringleIndices, m_vertices );
|
||||
m_surfaceData->setTriangleData( indices, verts );
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -136,6 +123,26 @@ bool RimEnsembleStatisticsSurface ::updateSurfaceData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleStatisticsSurface ::clearCachedNativeData()
|
||||
std::vector<cvf::Vec3d> RimEnsembleStatisticsSurface::extractStatisticalDepthForVertices( const RigSurface* surface ) const
|
||||
|
||||
{
|
||||
CVF_ASSERT( surface );
|
||||
std::vector<cvf::Vec3d> verts = surface->vertices();
|
||||
|
||||
const auto& meanValues = surface->propertyValues(
|
||||
caf::AppEnum<RigSurfaceStatisticsCalculator::StatisticsType>::text( m_statisticsType.v() ) );
|
||||
|
||||
for ( size_t i = 0; i < verts.size(); i++ )
|
||||
{
|
||||
verts[i].z() = meanValues[i];
|
||||
}
|
||||
|
||||
return verts;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleStatisticsSurface::clearCachedNativeData()
|
||||
{
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ public:
|
||||
|
||||
protected:
|
||||
bool updateSurfaceData() override;
|
||||
|
||||
std::vector<cvf::Vec3d> extractStatisticalDepthForVertices( const RigSurface* surface ) const;
|
||||
|
||||
void clearCachedNativeData() override;
|
||||
|
||||
private:
|
||||
std::vector<unsigned> m_tringleIndices;
|
||||
std::vector<cvf::Vec3d> m_vertices;
|
||||
|
||||
caf::PdmField<caf::AppEnum<RigSurfaceStatisticsCalculator::StatisticsType>> m_statisticsType;
|
||||
};
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RimFileSurface.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
@ -42,21 +43,22 @@ RimEnsembleSurface::RimEnsembleSurface()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Ensemble Surface", ":/ReservoirSurfaces16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fileSurfaces, "FileSurfaces", "", "", "", "" );
|
||||
m_fileSurfaces.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_statisticsSurfaces, "StatisticsSurfaces", "", "", "", "" );
|
||||
m_statisticsSurfaces.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurface::removeFileSurface( RimFileSurface* fileSurface )
|
||||
{
|
||||
m_fileSurfaces.removeChildObject( fileSurface );
|
||||
std::vector<RigSurfaceStatisticsCalculator::StatisticsType> statisticsTypes =
|
||||
{ RigSurfaceStatisticsCalculator::StatisticsType::MIN,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::MAX,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::MEAN,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::P10,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::P50,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::P90 };
|
||||
|
||||
for ( auto s : statisticsTypes )
|
||||
{
|
||||
auto statSurface = new RimEnsembleStatisticsSurface;
|
||||
statSurface->setStatisticsType( s );
|
||||
addSurface( statSurface );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -64,30 +66,35 @@ void RimEnsembleSurface::removeFileSurface( RimFileSurface* fileSurface )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurface::addFileSurface( RimFileSurface* fileSurface )
|
||||
{
|
||||
m_fileSurfaces.push_back( fileSurface );
|
||||
if ( !sourceFileSurfaceCollection() )
|
||||
{
|
||||
auto coll = new RimSurfaceCollection;
|
||||
coll->setCollectionName( ensembleSourceFileCollectionName() );
|
||||
addSubCollection( coll );
|
||||
}
|
||||
|
||||
sourceFileSurfaceCollection()->addSurface( fileSurface );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFileSurface*> RimEnsembleSurface::fileSurfaces() const
|
||||
std::vector<RimFileSurface*> RimEnsembleSurface::sourceFileSurfaces() const
|
||||
{
|
||||
return m_fileSurfaces().childObjects();
|
||||
}
|
||||
std::vector<RimFileSurface*> fileSurfs;
|
||||
for ( auto& w : sourceFileSurfaceCollection()->surfaces() )
|
||||
{
|
||||
if ( auto fsurf = dynamic_cast<RimFileSurface*>( w ) )
|
||||
{
|
||||
fileSurfs.push_back( fsurf );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning( QString( "Detected unknown surface type in File Surface collection" ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSurface*> RimEnsembleSurface::surfaces() const
|
||||
{
|
||||
std::vector<RimSurface*> surfaces;
|
||||
for ( auto fs : m_fileSurfaces.childObjects() )
|
||||
surfaces.push_back( fs );
|
||||
|
||||
for ( auto s : m_statisticsSurfaces.childObjects() )
|
||||
surfaces.push_back( s );
|
||||
|
||||
return surfaces;
|
||||
return fileSurfs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -95,7 +102,7 @@ std::vector<RimSurface*> RimEnsembleSurface::surfaces() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurface::loadDataAndUpdate()
|
||||
{
|
||||
for ( auto& w : m_fileSurfaces )
|
||||
for ( auto& w : sourceFileSurfaces() )
|
||||
{
|
||||
if ( !w->onLoadData() )
|
||||
{
|
||||
@ -103,38 +110,25 @@ void RimEnsembleSurface::loadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimFileSurface*> fileSurfaces = m_fileSurfaces.childObjects();
|
||||
std::vector<RimFileSurface*> sourceSurfaceForStatistics = sourceFileSurfaces();
|
||||
if ( m_ensembleCurveSet != nullptr )
|
||||
{
|
||||
fileSurfaces = filterByEnsembleCurveSet( fileSurfaces );
|
||||
sourceSurfaceForStatistics = filterByEnsembleCurveSet( sourceSurfaceForStatistics );
|
||||
}
|
||||
|
||||
m_statisticsSurfaces.deleteAllChildObjects();
|
||||
m_statisticsSurfaces.clear();
|
||||
|
||||
if ( !fileSurfaces.empty() )
|
||||
if ( !sourceSurfaceForStatistics.empty() )
|
||||
{
|
||||
cvf::ref<RigSurface> firstSurface = fileSurfaces[0]->surfaceData();
|
||||
cvf::ref<RigSurface> firstSurface = sourceSurfaceForStatistics[0]->surfaceData();
|
||||
|
||||
std::vector<cvf::ref<RigSurface>> surfaces;
|
||||
for ( auto& w : fileSurfaces )
|
||||
surfaces.push_back( RigSurfaceResampler::resampleSurface( firstSurface, w->surfaceData() ) );
|
||||
std::vector<cvf::ref<RigSurface>> sourceSurfaces;
|
||||
for ( auto& w : sourceSurfaceForStatistics )
|
||||
sourceSurfaces.push_back( RigSurfaceResampler::resampleSurface( firstSurface, w->surfaceData() ) );
|
||||
|
||||
m_statisticsSurface = RigSurfaceStatisticsCalculator::computeStatistics( surfaces );
|
||||
m_statisticsSurface = RigSurfaceStatisticsCalculator::computeStatistics( sourceSurfaces );
|
||||
if ( !m_statisticsSurface.isNull() )
|
||||
{
|
||||
std::vector<RigSurfaceStatisticsCalculator::StatisticsType> statisticsTypes =
|
||||
{ RigSurfaceStatisticsCalculator::StatisticsType::MIN,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::MAX,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::MEAN,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::P10,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::P50,
|
||||
RigSurfaceStatisticsCalculator::StatisticsType::P90 };
|
||||
for ( auto s : statisticsTypes )
|
||||
for ( auto statSurface : surfaces() )
|
||||
{
|
||||
auto statSurface = new RimEnsembleStatisticsSurface;
|
||||
statSurface->setStatisticsType( s );
|
||||
m_statisticsSurfaces.push_back( statSurface );
|
||||
statSurface->onLoadData();
|
||||
}
|
||||
}
|
||||
@ -256,6 +250,35 @@ void RimEnsembleSurface::onFilterSourceChanged( const caf::SignalEmitter* emitte
|
||||
if ( m_ensembleCurveSet() ) loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurfaceCollection* RimEnsembleSurface::sourceFileSurfaceCollection() const
|
||||
|
||||
{
|
||||
auto name = ensembleSourceFileCollectionName();
|
||||
|
||||
return getSubCollection( name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEnsembleSurface::ensembleSourceFileCollectionName()
|
||||
{
|
||||
auto name = caf::AppEnum<RimSurface::SurfaceType>::uiText( RimSurface::SurfaceType::ENSEMBLE_SOURCE );
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurface::loadData()
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimNamedObject.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
@ -35,23 +35,21 @@ class RimSummaryCase;
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEnsembleSurface : public RimNamedObject
|
||||
class RimEnsembleSurface : public RimSurfaceCollection
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEnsembleSurface();
|
||||
void removeFileSurface( RimFileSurface* fileSurface );
|
||||
void addFileSurface( RimFileSurface* fileSurface );
|
||||
|
||||
std::vector<RimFileSurface*> fileSurfaces() const;
|
||||
|
||||
std::vector<RimSurface*> surfaces() const;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void addFileSurface( RimFileSurface* fileSurface );
|
||||
void loadDataAndUpdate();
|
||||
const RigSurface* statisticsSurface() const;
|
||||
|
||||
static QString ensembleSourceFileCollectionName();
|
||||
|
||||
void loadData() override;
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
@ -67,9 +65,11 @@ private:
|
||||
void connectEnsembleCurveSetFilterSignals();
|
||||
void onFilterSourceChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
caf::PdmChildArrayField<RimFileSurface*> m_fileSurfaces;
|
||||
caf::PdmChildArrayField<RimEnsembleStatisticsSurface*> m_statisticsSurfaces;
|
||||
caf::PdmPtrField<RimEnsembleCurveSet*> m_ensembleCurveSet;
|
||||
RimSurfaceCollection* sourceFileSurfaceCollection() const;
|
||||
std::vector<RimFileSurface*> sourceFileSurfaces() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEnsembleCurveSet*> m_ensembleCurveSet;
|
||||
|
||||
cvf::ref<RigSurface> m_statisticsSurface;
|
||||
};
|
||||
|
@ -1,342 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- 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 "RimEnsembleSurfaceInView.h"
|
||||
|
||||
#include "RimEnsembleSurface.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
#include "RimSurfaceInView.h"
|
||||
#include "RimSurfaceResultDefinition.h"
|
||||
|
||||
#include "RivSurfacePartMgr.h"
|
||||
|
||||
#include "cvfModelBasicList.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEnsembleSurfaceInView, "EnsembleSurfaceInView" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleSurfaceInView::RimEnsembleSurfaceInView()
|
||||
{
|
||||
CAF_PDM_InitObject( "Ensemble Surface", ":/ReservoirSurfaces16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleSurfaceName, "EnsembleSurfaceName", "EnsembleSurfaceName", "", "", "" );
|
||||
m_ensembleSurfaceName.registerGetMethod( this, &RimEnsembleSurfaceInView::name );
|
||||
m_ensembleSurfaceName.uiCapability()->setUiReadOnly( true );
|
||||
m_ensembleSurfaceName.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "SurfacesInViewField", "", "", "" );
|
||||
m_surfacesInView.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleSurface, "EnsembleSurface", "EnsembleSurface", "", "", "" );
|
||||
m_ensembleSurface.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
nameField()->uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleSurfaceInView::~RimEnsembleSurfaceInView()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimEnsembleSurfaceInView::userDescriptionField()
|
||||
{
|
||||
return &m_ensembleSurfaceName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEnsembleSurfaceInView::name() const
|
||||
{
|
||||
if ( m_ensembleSurface ) return m_ensembleSurface->name();
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleSurface* RimEnsembleSurfaceInView::ensembleSurface() const
|
||||
{
|
||||
return m_ensembleSurface;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::setEnsembleSurface( RimEnsembleSurface* surfcoll )
|
||||
{
|
||||
m_ensembleSurface = surfcoll;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::updateAllViewItems()
|
||||
{
|
||||
syncSurfacesWithView();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::syncSurfacesWithView()
|
||||
{
|
||||
// Delete surfaceInView without any real Surface connection
|
||||
|
||||
std::vector<RimSurfaceInView*> surfsInView = m_surfacesInView.childObjects();
|
||||
|
||||
for ( auto surf : surfsInView )
|
||||
{
|
||||
if ( !surf->surface() )
|
||||
{
|
||||
m_surfacesInView.removeChildObject( surf );
|
||||
delete surf;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new surfade entries and reorder
|
||||
std::vector<RimSurfaceInView*> orderedSurfs;
|
||||
|
||||
if ( m_ensembleSurface )
|
||||
{
|
||||
// pick up the surfaces and the order from the surface collection
|
||||
std::vector<RimSurface*> surfs = m_ensembleSurface->surfaces();
|
||||
for ( auto surf : surfs )
|
||||
{
|
||||
// check if this is a surface we need to create
|
||||
RimSurfaceInView* viewSurf = this->getSurfaceInViewForSurface( surf );
|
||||
if ( viewSurf == nullptr )
|
||||
{
|
||||
RimSurfaceInView* newSurfInView = new RimSurfaceInView();
|
||||
newSurfInView->setSurface( surf );
|
||||
orderedSurfs.push_back( newSurfInView );
|
||||
}
|
||||
else
|
||||
{
|
||||
orderedSurfs.push_back( viewSurf );
|
||||
}
|
||||
}
|
||||
|
||||
// make sure our view surfaces have the same order as the source surface collection
|
||||
m_surfacesInView.clear();
|
||||
for ( auto viewSurf : orderedSurfs )
|
||||
{
|
||||
m_surfacesInView.push_back( viewSurf );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::loadData()
|
||||
{
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() )
|
||||
{
|
||||
surf->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::clearGeometry()
|
||||
{
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
surf->clearGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::appendPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
|
||||
{
|
||||
if ( !isChecked() ) return;
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() )
|
||||
{
|
||||
surf->surfacePartMgr()->appendIntersectionGeometryPartsToModel( model, scaleTransform );
|
||||
}
|
||||
}
|
||||
|
||||
model->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
this->updateUiIconFromToggleField();
|
||||
|
||||
if ( changedField == &m_isChecked )
|
||||
{
|
||||
RimGridView* ownerView;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::initAfterRead()
|
||||
{
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurfaceInView* RimEnsembleSurfaceInView::getSurfaceInViewForSurface( const RimSurface* surf ) const
|
||||
{
|
||||
for ( auto surfInView : m_surfacesInView )
|
||||
{
|
||||
if ( surfInView->surface() == surf )
|
||||
{
|
||||
return surfInView;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex )
|
||||
{
|
||||
if ( !this->isChecked() ) return;
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() )
|
||||
{
|
||||
bool useNativeSurfaceColors = false;
|
||||
|
||||
if ( surf->isNativeSurfaceResultsActive() ) useNativeSurfaceColors = true;
|
||||
|
||||
if ( !useNativeSurfaceColors )
|
||||
{
|
||||
bool showResults = surf->activeSeparateResultDefinition()
|
||||
? surf->activeSeparateResultDefinition()->hasResult()
|
||||
: hasGeneralCellResult;
|
||||
|
||||
if ( showResults )
|
||||
{
|
||||
surf->surfacePartMgr()->updateCellResultColor( timeStepIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
useNativeSurfaceColors = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( useNativeSurfaceColors )
|
||||
{
|
||||
surf->surfacePartMgr()->updateNativeSurfaceColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::applySingleColorEffect()
|
||||
{
|
||||
if ( !this->isChecked() ) return;
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() )
|
||||
{
|
||||
surf->surfacePartMgr()->updateNativeSurfaceColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEnsembleSurfaceInView::hasAnyActiveSeparateResults()
|
||||
{
|
||||
if ( !this->isChecked() ) return false;
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() && surf->activeSeparateResultDefinition() &&
|
||||
surf->activeSeparateResultDefinition()->hasResult() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleSurfaceInView::updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer,
|
||||
bool isUsingOverrideViewer )
|
||||
{
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
surf->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer, isUsingOverrideViewer );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimRegularLegendConfig*> RimEnsembleSurfaceInView::legendConfigs()
|
||||
{
|
||||
std::vector<RimRegularLegendConfig*> configs;
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() && surf->surfaceResultDefinition() )
|
||||
{
|
||||
configs.push_back( surf->surfaceResultDefinition()->legendConfig() );
|
||||
}
|
||||
}
|
||||
|
||||
return configs;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- 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 "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class ScalarMapper;
|
||||
} // namespace cvf
|
||||
|
||||
class RimSurfaceInView;
|
||||
class RimSurface;
|
||||
class RimSurfaceCollection;
|
||||
class RimEnsembleSurfaceInView;
|
||||
class RimEnsembleSurface;
|
||||
class RimRegularLegendConfig;
|
||||
class RiuViewer;
|
||||
class RivIntersectionGeometryGeneratorIF;
|
||||
|
||||
class RimEnsembleSurfaceInView : public RimCheckableNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimEnsembleSurfaceInView();
|
||||
~RimEnsembleSurfaceInView() override;
|
||||
|
||||
QString name() const override;
|
||||
|
||||
RimEnsembleSurface* ensembleSurface() const;
|
||||
void setEnsembleSurface( RimEnsembleSurface* surfcoll );
|
||||
|
||||
void updateFromSurfaceCollection();
|
||||
void loadData();
|
||||
void clearGeometry();
|
||||
|
||||
void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform );
|
||||
void updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex );
|
||||
void applySingleColorEffect();
|
||||
|
||||
bool hasAnyActiveSeparateResults();
|
||||
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );
|
||||
|
||||
std::vector<RimRegularLegendConfig*> legendConfigs();
|
||||
|
||||
void updateAllViewItems();
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
RimSurfaceInView* getSurfaceInViewForSurface( const RimSurface* surf ) const;
|
||||
|
||||
void syncSurfacesWithView();
|
||||
|
||||
caf::PdmProxyValueField<QString> m_ensembleSurfaceName;
|
||||
caf::PdmChildArrayField<RimSurfaceInView*> m_surfacesInView;
|
||||
caf::PdmPtrField<RimEnsembleSurface*> m_ensembleSurface;
|
||||
};
|
@ -38,6 +38,16 @@
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimSurface, "SurfaceInterface" );
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimSurface::SurfaceType>::setUp()
|
||||
{
|
||||
addItem( RimSurface::SurfaceType::DEFAULT, "DEFAULT", "Default" );
|
||||
addItem( RimSurface::SurfaceType::ENSEMBLE_SOURCE, "ENSEMBLE_SOURCE", "Ensemble Source" );
|
||||
addItem( RimSurface::SurfaceType::ENSEMBLE_STATISTICS, "ENSEMBLE_STATISTICS", "Ensemble Statistics" );
|
||||
|
||||
setDefault( RimSurface::SurfaceType::DEFAULT );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -34,6 +34,16 @@ class RimSurface : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum class SurfaceType
|
||||
{
|
||||
DEFAULT,
|
||||
ENSEMBLE_SOURCE,
|
||||
ENSEMBLE_STATISTICS,
|
||||
// TODO: Add fault reactivation surfaces
|
||||
|
||||
};
|
||||
|
||||
public:
|
||||
RimSurface();
|
||||
~RimSurface() override;
|
||||
|
@ -58,9 +58,6 @@ RimSurfaceCollection::RimSurfaceCollection()
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_surfaces, "SurfacesField", "Surfaces", "", "", "" );
|
||||
m_surfaces.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_ensembleSurfaces, "EnsembleSurfaces", "Ensemble Surfaces", "", "", "" );
|
||||
m_ensembleSurfaces.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -117,7 +114,7 @@ void RimSurfaceCollection::addSurface( RimSurface* surface )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceCollection::addEnsembleSurface( RimEnsembleSurface* ensembleSurface )
|
||||
{
|
||||
m_ensembleSurfaces.push_back( ensembleSurface );
|
||||
addSubCollection( ensembleSurface );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -265,14 +262,6 @@ std::vector<RimSurfaceCollection*> RimSurfaceCollection::subCollections() const
|
||||
return m_subCollections.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEnsembleSurface*> RimSurfaceCollection::ensembleSurfaces() const
|
||||
{
|
||||
return m_ensembleSurfaces.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -283,9 +272,9 @@ void RimSurfaceCollection::loadData()
|
||||
surf->loadDataIfRequired();
|
||||
}
|
||||
|
||||
for ( auto ensSurf : m_ensembleSurfaces )
|
||||
for ( auto subColl : m_subCollections )
|
||||
{
|
||||
ensSurf->loadDataAndUpdate();
|
||||
subColl->loadData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,7 +468,7 @@ void RimSurfaceCollection::addSubCollection( RimSurfaceCollection* subcoll )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurfaceCollection* RimSurfaceCollection::getSubCollection( const QString name )
|
||||
RimSurfaceCollection* RimSurfaceCollection::getSubCollection( const QString& name ) const
|
||||
{
|
||||
for ( auto coll : m_subCollections )
|
||||
{
|
||||
@ -489,6 +478,19 @@ RimSurfaceCollection* RimSurfaceCollection::getSubCollection( const QString name
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceCollection::deleteSubCollection( const QString& name )
|
||||
{
|
||||
auto coll = getSubCollection( name );
|
||||
if ( coll )
|
||||
{
|
||||
auto index = m_subCollections.index( coll );
|
||||
m_subCollections.erase( index );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -501,11 +503,6 @@ bool RimSurfaceCollection::containsSurface()
|
||||
containsSurface |= coll->containsSurface();
|
||||
}
|
||||
|
||||
for ( auto ensSurf : m_ensembleSurfaces )
|
||||
{
|
||||
containsSurface |= ( ensSurf->surfaces().size() > 0 );
|
||||
}
|
||||
|
||||
return containsSurface;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,8 @@ public:
|
||||
RimSurface* addSurfacesAtIndex( int index, std::vector<RimSurface*> surfaces );
|
||||
|
||||
void addSubCollection( RimSurfaceCollection* collection );
|
||||
RimSurfaceCollection* getSubCollection( const QString name );
|
||||
RimSurfaceCollection* getSubCollection( const QString& name ) const;
|
||||
void deleteSubCollection( const QString& name );
|
||||
|
||||
bool containsFileSurface( QString filename );
|
||||
bool containsSurface();
|
||||
@ -54,7 +55,7 @@ public:
|
||||
void removeSurface( RimSurface* surface );
|
||||
void removeMissingFileSurfaces();
|
||||
|
||||
void loadData();
|
||||
virtual void loadData();
|
||||
|
||||
void updateViews();
|
||||
void updateViews( const std::vector<RimSurface*>& surfsToReload, bool showLegend = true );
|
||||
@ -67,7 +68,6 @@ public:
|
||||
|
||||
std::vector<RimSurface*> surfaces() const;
|
||||
std::vector<RimSurfaceCollection*> subCollections() const;
|
||||
std::vector<RimEnsembleSurface*> ensembleSurfaces() const;
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
@ -78,5 +78,4 @@ private:
|
||||
caf::PdmField<QString> m_collectionName;
|
||||
caf::PdmChildArrayField<RimSurface*> m_surfaces;
|
||||
caf::PdmChildArrayField<RimSurfaceCollection*> m_subCollections;
|
||||
caf::PdmChildArrayField<RimEnsembleSurface*> m_ensembleSurfaces;
|
||||
};
|
||||
|
@ -206,11 +206,18 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
|
||||
bool scheduleRedraw = false;
|
||||
|
||||
if ( changedField == &m_isActive || changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource )
|
||||
if ( changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource )
|
||||
{
|
||||
scheduleRedraw = true;
|
||||
}
|
||||
else if ( changedField == &m_showInactiveCells )
|
||||
else if ( changedField == &m_isActive )
|
||||
{
|
||||
// if ( m_isActive ) clearGeometry();
|
||||
|
||||
scheduleRedraw = true;
|
||||
}
|
||||
|
||||
if ( changedField == &m_showInactiveCells )
|
||||
{
|
||||
clearGeometry();
|
||||
scheduleRedraw = true;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "RimSurfaceInViewCollection.h"
|
||||
|
||||
#include "RimEnsembleSurfaceInView.h"
|
||||
#include "RimEnsembleSurface.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimOilField.h"
|
||||
@ -57,9 +57,6 @@ RimSurfaceInViewCollection::RimSurfaceInViewCollection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "SurfacesInViewField", "", "", "" );
|
||||
m_surfacesInView.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleSurfacesInView, "EnsemblesSurfacesInView", "EnsembleSurfacesInView", "", "", "" );
|
||||
m_ensembleSurfacesInView.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceCollectionRef", "SurfaceCollection", "", "", "" );
|
||||
m_surfaceCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
@ -113,7 +110,6 @@ void RimSurfaceInViewCollection::setSurfaceCollection( RimSurfaceCollection* sur
|
||||
void RimSurfaceInViewCollection::updateAllViewItems()
|
||||
{
|
||||
syncCollectionsWithView();
|
||||
syncEnsembleSurfacesWithView();
|
||||
syncSurfacesWithView();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
@ -168,56 +164,6 @@ void RimSurfaceInViewCollection::syncCollectionsWithView()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceInViewCollection::syncEnsembleSurfacesWithView()
|
||||
{
|
||||
// check that we have ensemble in view collectinons
|
||||
std::vector<RimEnsembleSurfaceInView*> ensembleSurfaces = m_ensembleSurfacesInView.childObjects();
|
||||
|
||||
for ( auto ensembleSurface : ensembleSurfaces )
|
||||
{
|
||||
if ( !ensembleSurface->ensembleSurface() )
|
||||
{
|
||||
m_ensembleSurfacesInView.removeChildObject( ensembleSurface );
|
||||
delete ensembleSurface;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new collection entries and reorder
|
||||
std::vector<RimEnsembleSurfaceInView*> orderedEnsembleSurfaces;
|
||||
if ( m_surfaceCollection )
|
||||
{
|
||||
// pick up the collections and the order from the surface collection
|
||||
std::vector<RimEnsembleSurface*> ensSurfs = m_surfaceCollection->ensembleSurfaces();
|
||||
for ( auto ensSurf : ensSurfs )
|
||||
{
|
||||
// check if this is a collection we need to create
|
||||
|
||||
RimEnsembleSurfaceInView* ensembleSurfaceInView = this->getEnsembleSurfaceInViewForEnsembleSurface( ensSurf );
|
||||
if ( ensembleSurfaceInView == nullptr )
|
||||
{
|
||||
RimEnsembleSurfaceInView* newColl = new RimEnsembleSurfaceInView();
|
||||
newColl->setEnsembleSurface( ensSurf );
|
||||
orderedEnsembleSurfaces.push_back( newColl );
|
||||
}
|
||||
else
|
||||
{
|
||||
orderedEnsembleSurfaces.push_back( ensembleSurfaceInView );
|
||||
}
|
||||
}
|
||||
|
||||
// make sure our view surfaces have the same order as the source surface collection
|
||||
m_ensembleSurfacesInView.clear();
|
||||
for ( auto ensSurf : orderedEnsembleSurfaces )
|
||||
{
|
||||
m_ensembleSurfacesInView.push_back( ensSurf );
|
||||
ensSurf->updateAllViewItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -236,7 +182,7 @@ void RimSurfaceInViewCollection::syncSurfacesWithView()
|
||||
}
|
||||
}
|
||||
|
||||
// Create new surfade entries and reorder
|
||||
// Create new surface entries and reorder
|
||||
std::vector<RimSurfaceInView*> orderedSurfs;
|
||||
|
||||
if ( m_surfaceCollection )
|
||||
@ -251,6 +197,12 @@ void RimSurfaceInViewCollection::syncSurfacesWithView()
|
||||
{
|
||||
RimSurfaceInView* newSurfInView = new RimSurfaceInView();
|
||||
newSurfInView->setSurface( surf );
|
||||
|
||||
if ( m_surfaceCollection->collectionName() == RimEnsembleSurface::ensembleSourceFileCollectionName() )
|
||||
{
|
||||
newSurfInView->setActive( false );
|
||||
}
|
||||
|
||||
orderedSurfs.push_back( newSurfInView );
|
||||
}
|
||||
else
|
||||
@ -286,11 +238,6 @@ void RimSurfaceInViewCollection::loadData()
|
||||
coll->loadData();
|
||||
}
|
||||
|
||||
for ( RimEnsembleSurfaceInView* ensSurf : m_ensembleSurfacesInView )
|
||||
{
|
||||
ensSurf->loadData();
|
||||
}
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() )
|
||||
@ -310,11 +257,6 @@ void RimSurfaceInViewCollection::clearGeometry()
|
||||
coll->clearGeometry();
|
||||
}
|
||||
|
||||
for ( RimEnsembleSurfaceInView* ensSurf : m_ensembleSurfacesInView )
|
||||
{
|
||||
ensSurf->clearGeometry();
|
||||
}
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
surf->clearGeometry();
|
||||
@ -336,14 +278,6 @@ void RimSurfaceInViewCollection::appendPartsToModel( cvf::ModelBasicList* model,
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimEnsembleSurfaceInView* ensSurf : m_ensembleSurfacesInView )
|
||||
{
|
||||
if ( ensSurf->isChecked() )
|
||||
{
|
||||
ensSurf->appendPartsToModel( model, scaleTransform );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimSurfaceInView* surf : m_surfacesInView )
|
||||
{
|
||||
if ( surf->isActive() )
|
||||
@ -413,23 +347,6 @@ RimSurfaceInViewCollection*
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleSurfaceInView*
|
||||
RimSurfaceInViewCollection::getEnsembleSurfaceInViewForEnsembleSurface( const RimEnsembleSurface* coll ) const
|
||||
{
|
||||
for ( auto collInView : m_ensembleSurfacesInView )
|
||||
{
|
||||
if ( collInView->ensembleSurface() == coll )
|
||||
{
|
||||
return collInView;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -35,7 +35,6 @@ class ScalarMapper;
|
||||
class RimSurfaceInView;
|
||||
class RimSurface;
|
||||
class RimSurfaceCollection;
|
||||
class RimEnsembleSurfaceInView;
|
||||
class RimEnsembleSurface;
|
||||
class RimRegularLegendConfig;
|
||||
class RiuViewer;
|
||||
@ -78,17 +77,15 @@ private:
|
||||
|
||||
RimSurfaceInView* getSurfaceInViewForSurface( const RimSurface* surf ) const;
|
||||
RimSurfaceInViewCollection* getCollectionInViewForCollection( const RimSurfaceCollection* coll ) const;
|
||||
RimEnsembleSurfaceInView* getEnsembleSurfaceInViewForEnsembleSurface( const RimEnsembleSurface* coll ) const;
|
||||
|
||||
void updateAllViewItems();
|
||||
void syncCollectionsWithView();
|
||||
void syncSurfacesWithView();
|
||||
void syncEnsembleSurfacesWithView();
|
||||
|
||||
private:
|
||||
caf::PdmProxyValueField<QString> m_collectionName;
|
||||
caf::PdmChildArrayField<RimSurfaceInViewCollection*> m_collectionsInView;
|
||||
caf::PdmChildArrayField<RimSurfaceInView*> m_surfacesInView;
|
||||
caf::PdmChildArrayField<RimEnsembleSurfaceInView*> m_ensembleSurfacesInView;
|
||||
caf::PdmChildArrayField<RimSurfaceInViewCollection*> m_collectionsInView;
|
||||
|
||||
caf::PdmPtrField<RimSurfaceCollection*> m_surfaceCollection;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user