Merge branch 'dev' of https://github.com/OPM/ResInsight into dev

This commit is contained in:
Ruben Manuel Thoms
2020-09-25 17:09:27 +02:00
211 changed files with 5256 additions and 2112 deletions

View File

@@ -114,10 +114,6 @@ RimAnalysisPlot::RimAnalysisPlot()
CAF_PDM_InitFieldNoDefault( &m_referenceCase, "ReferenceCase", "Reference Case", "", "", "" );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Title", "", "", "" );
m_showPlotTitle.xmlCapability()->setIOWritable( false );
m_showPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto", "", "", "" );
m_useAutoPlotTitle.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
@@ -202,7 +198,6 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
{
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( auto curveDef : curveDefinitions )
{
@@ -460,7 +455,6 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
{
@@ -1138,8 +1132,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
{
std::pair<double, double> minMax = filter->filterRangeMinMax();
if ( filter->useAbsoluteValues() ) value = fabs( value );
if ( minMax.first <= value && value <= minMax.second )
{
casesToKeep.insert( sumCase );
@@ -1148,7 +1140,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
else if ( filter->filterOperation() == RimPlotDataFilterItem::TOP_N ||
filter->filterOperation() == RimPlotDataFilterItem::BOTTOM_N )
{
if ( filter->useAbsoluteValues() ) value = fabs( value );
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
auto itIsInsertedPair = casesToKeepWithValue.insert( {sumCase, value} );
@@ -1288,8 +1279,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
// clang-format off
storeResultCoreLambda = [&]( double value ) // clang-format on
{
if ( filter->useAbsoluteValues() ) value = fabs( value );
if ( minMax.first <= value && value <= minMax.second )
{
casesToKeep.insert( sumCaseInEvaluation );
@@ -1302,7 +1291,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
// clang-format off
storeResultCoreLambda = [&]( double value ) // clang-format on
{
if ( filter->useAbsoluteValues() ) value = fabs( value );
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
auto itIsInsertedPair = casesToKeepWithValue.insert( {sumCaseInEvaluation, value} );
@@ -1342,8 +1330,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
// clang-format off
storeResultCoreLambda = [&]( double value ) // clang-format on
{
if ( filter->useAbsoluteValues() ) value = fabs( value );
if ( minMax.first <= value && value <= minMax.second )
{
sumItemsToKeep.insert( sumItem );
@@ -1356,7 +1342,6 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
// clang-format off
storeResultCoreLambda = [&]( double value ) // clang-format on
{
if ( filter->useAbsoluteValues() ) value = fabs( value );
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
auto itIsInsertedPair = sumItemsToKeepWithValue.insert( {sumItem, value} );
@@ -1652,7 +1637,7 @@ void RimAnalysisPlot::updatePlotTitle()
{
QString plotTitle = description();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
m_plotWidget->scheduleReplot();
}
}
@@ -1816,17 +1801,3 @@ void RimAnalysisPlot::connectAllCaseSignals()
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlot::disconnectAllCaseSignals()
{
for ( auto dataEntry : m_analysisPlotDataSelection )
{
if ( dataEntry->ensemble() )
{
dataEntry->ensemble()->caseRemoved.disconnect( this );
}
}
}

View File

@@ -135,7 +135,6 @@ private:
void detachAllCurves() override;
void reattachAllCurves() override {}
void doRemoveFromCollection() override {}
void updateAxes() override;
void onAxisSelected( int axis, bool toggle ) override;
void updateZoomInQwt() override {}
@@ -176,12 +175,11 @@ private:
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
int barTextFontSize() const;
void initAfterRead();
void initAfterRead() override;
private:
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
void connectAllCaseSignals();
void disconnectAllCaseSignals();
private:
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
@@ -200,7 +198,6 @@ private:
caf::PdmPtrField<RimSummaryCase*> m_referenceCase;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;

View File

@@ -53,7 +53,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot()
applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" );
// plot->enableAutoPlotTitle( true );
m_analysisPlots.push_back( plot );
addPlot( plot );
plot->loadDataAndUpdate();
@@ -79,7 +79,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot( RimSummaryCaseCo
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
// plot->enableAutoPlotTitle( true );
m_analysisPlots.push_back( plot );
addPlot( plot );
plot->loadDataAndUpdate();
@@ -106,15 +106,7 @@ void RimAnalysisPlotCollection::updateSummaryNameHasChanged()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlotCollection::removeSummaryPlot( RimAnalysisPlot* analysisPlot )
{
m_analysisPlots.removeChildObject( analysisPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots()
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots() const
{
return m_analysisPlots.childObjects();
}
@@ -122,9 +114,9 @@ std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlotCollection::deleteAllChildObjects()
size_t RimAnalysisPlotCollection::plotCount() const
{
m_analysisPlots.deleteAllChildObjects();
return m_analysisPlots.size();
}
//--------------------------------------------------------------------------------------------------
@@ -156,6 +148,9 @@ void RimAnalysisPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAnaly
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysisPlot* plot,
RimSummaryCaseCollection* ensemble,
const std::string& quantityName,
@@ -182,3 +177,20 @@ void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysis
plot->setTimeSteps( {timeStep} );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlotCollection::insertPlot( RimAnalysisPlot* analysisPlot, size_t index )
{
m_analysisPlots.insert( index, analysisPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAnalysisPlotCollection::removePlot( RimAnalysisPlot* analysisPlot )
{
m_analysisPlots.removeChildObject( analysisPlot );
updateAllRequiredEditors();
}

View File

@@ -18,19 +18,21 @@
#pragma once
#include "RimAbstractPlotCollection.h"
#include "RimAnalysisPlot.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
#include <ctime>
class RimAnalysisPlot;
class RimSummaryCaseCollection;
//==================================================================================================
///
///
//==================================================================================================
class RimAnalysisPlotCollection : public caf::PdmObject
class RimAnalysisPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimAnalysisPlot>
{
CAF_PDM_HEADER_INIT;
@@ -43,11 +45,11 @@ public:
createAnalysisPlot( RimSummaryCaseCollection* ensemble, const QString& quantityName, std::time_t timeStep );
void updateSummaryNameHasChanged();
void removeSummaryPlot( RimAnalysisPlot* analysisPlot );
std::vector<RimAnalysisPlot*> plots();
void deleteAllChildObjects();
std::vector<RimAnalysisPlot*> plots() const final;
size_t plotCount() const final;
void insertPlot( RimAnalysisPlot* analysisPlot, size_t index ) final;
void removePlot( RimAnalysisPlot* analysisPlot ) final;
private:
void applyFirstEnsembleFieldAddressesToPlot( RimAnalysisPlot* plot, const std::string& quantityName = "" );

View File

@@ -56,8 +56,6 @@ RimPlotDataFilterItem* RimPlotDataFilterCollection::addFilter()
//--------------------------------------------------------------------------------------------------
void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter )
{
filter->filterChanged.disconnect( this );
m_filters.removeChildObject( filter );
delete filter;

View File

@@ -103,7 +103,6 @@ RimPlotDataFilterItem::RimPlotDataFilterItem()
caf::PdmUiActionPushButtonEditor::configureEditorForField( &m_filterQuantitySelectButton );
CAF_PDM_InitFieldNoDefault( &m_filterOperation, "FilterOperation", "is", "", "", "" );
CAF_PDM_InitField( &m_useAbsoluteValue, "UseAbsoluteValue", true, "using absolute values", "", "", "" );
CAF_PDM_InitField( &m_topBottomN, "MinTopN", 20, "N", "", "", "" );
m_topBottomN.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
@@ -237,10 +236,6 @@ void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changed
{
this->updateMaxMinAndDefaultValues( true );
}
else if ( changedField == &m_useAbsoluteValue )
{
this->updateMaxMinAndDefaultValues( false );
}
else if ( changedField == &m_filterOperation )
{
this->updateMaxMinAndDefaultValues( false );
@@ -361,15 +356,12 @@ void RimPlotDataFilterItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
if ( m_filterOperation() == RANGE )
{
uiOrdering.add( &m_useAbsoluteValue, {false} );
uiOrdering.add( &m_max, {true, -1, 1} );
uiOrdering.add( &m_min, {true, -1, 1} );
}
else if ( m_filterOperation == TOP_N || m_filterOperation == BOTTOM_N )
{
uiOrdering.add( &m_topBottomN, {false} );
uiOrdering.add( &m_useAbsoluteValue, {true} );
}
}
@@ -432,16 +424,16 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
if ( RiaCurveDataTools::isValidValue( eParam.minValue, false ) )
{
m_lowerLimit = eParam.minValue;
if ( m_useAbsoluteValue ) m_lowerLimit = fabs( eParam.minValue );
}
if ( RiaCurveDataTools::isValidValue( eParam.maxValue, false ) )
{
m_upperLimit = eParam.maxValue;
if ( m_useAbsoluteValue ) m_upperLimit = fabs( eParam.maxValue );
}
// Make sure max is > min after doing abs
if ( m_upperLimit < m_lowerLimit ) std::swap( m_upperLimit, m_lowerLimit );
if ( m_upperLimit < m_lowerLimit )
{
std::swap( m_upperLimit, m_lowerLimit );
}
}
}
else
@@ -449,7 +441,7 @@ void RimPlotDataFilterItem::updateMaxMinAndDefaultValues( bool forceDefault )
parentPlot->maxMinValueFromAddress( m_filterQuantityUiField,
m_consideredTimestepsType(),
m_explicitlySelectedTimeSteps(),
m_useAbsoluteValue(),
false,
&m_lowerLimit,
&m_upperLimit );
}

View File

@@ -96,7 +96,6 @@ public:
QString ensembleParameterName() const;
FilterOperation filterOperation() const { return m_filterOperation(); }
bool useAbsoluteValues() const { return m_useAbsoluteValue(); }
std::pair<double, double> filterRangeMinMax() const;
int topBottomN() const;
@@ -135,7 +134,6 @@ private:
// Operation and parameters
caf::PdmField<caf::AppEnum<FilterOperation>> m_filterOperation;
caf::PdmField<bool> m_useAbsoluteValue;
caf::PdmField<int> m_topBottomN;
caf::PdmField<double> m_max;
caf::PdmField<double> m_min;

View File

@@ -164,6 +164,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimAbstractPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelPropertyCurve.h
)

View File

@@ -18,36 +18,34 @@
#include "RimFractureModel.h"
#include "RiaColorTables.h"
#include "RiaCompletionTypeCalculationScheduler.h"
#include "RiaEclipseUnitTools.h"
#include "RiaFractureDefines.h"
#include "RiaFractureModelDefines.h"
#include "RiaLogging.h"
#include "Riu3DMainWindowTools.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigSimulationWellCoordsAndMD.h"
#include "RigWellPath.h"
#include "RigWellPathIntersectionTools.h"
#include "Rim3dView.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimColorLegend.h"
#include "RimColorLegendCollection.h"
#include "RimColorLegendItem.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimElasticProperties.h"
#include "RimEllipseFractureTemplate.h"
#include "RimFractureModelPlot.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimPolylineTarget.h"
#include "RimProject.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimTools.h"
#include "RimUserDefinedPolylinesAnnotation.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathGeometryDef.h"
@@ -235,15 +233,23 @@ RimFractureModel::RimFractureModel()
m_formationDip.uiCapability()->setUiReadOnly( true );
m_formationDip.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
CAF_PDM_InitScriptableField( &m_autoComputeBarrier, "AutoComputeBarrier", true, "Auto Compute Barrier", "", "", "" );
CAF_PDM_InitScriptableField( &m_hasBarrier, "Barrier", true, "Barrier", "", "", "" );
CAF_PDM_InitScriptableField( &m_distanceToBarrier, "DistanceToBarrier", 0.0, "Distance To Barrier [m]", "", "", "" );
m_distanceToBarrier.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
m_distanceToBarrier.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitScriptableField( &m_barrierDip, "BarrierDip", 0.0, "Barrier Dip", "", "", "" );
m_barrierDip.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
m_barrierDip.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitScriptableField( &m_wellPenetrationLayer, "WellPenetrationLayer", 0, "Well Penetration Layer", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties", "", "", "" );
m_elasticProperties.uiCapability()->setUiHidden( true );
m_elasticProperties.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitScriptableFieldNoDefault( &m_barrierAnnotation, "BarrierAnnotation", "Barrier Annotation", "", "", "" );
setDeletable( true );
}
@@ -252,6 +258,8 @@ RimFractureModel::RimFractureModel()
//--------------------------------------------------------------------------------------------------
RimFractureModel::~RimFractureModel()
{
clearBarrierAnnotation();
RimWellPath* wellPath = m_thicknessDirectionWellPath.value();
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
@@ -294,9 +302,25 @@ void RimFractureModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField
}
if ( changedField == &m_MD || changedField == &m_extractionType || changedField == &m_boundingBoxVertical ||
changedField == &m_boundingBoxHorizontal )
changedField == &m_boundingBoxHorizontal || changedField == &m_fractureOrientation ||
changedField == &m_autoComputeBarrier )
{
updateThicknessDirection();
if ( m_autoComputeBarrier )
{
updateDistanceToBarrierAndDip();
}
else
{
clearBarrierAnnotation();
}
}
if ( changedField == &m_autoComputeBarrier || changedField == &m_hasBarrier )
{
m_barrierDip.uiCapability()->setUiReadOnly( m_autoComputeBarrier || !m_hasBarrier );
m_distanceToBarrier.uiCapability()->setUiReadOnly( m_autoComputeBarrier || !m_hasBarrier );
}
if ( changedField == &m_extractionType || changedField == &m_thicknessDirectionWellPath )
@@ -552,6 +576,189 @@ cvf::Vec3d RimFractureModel::calculateTSTDirection() const
return ( direction / static_cast<double>( numContributingCells ) ).getNormalized();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureModel::updateDistanceToBarrierAndDip()
{
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( this );
if ( !objHandle ) return;
RimWellPath* wellPath = nullptr;
objHandle->firstAncestorOrThisOfType( wellPath );
if ( !wellPath ) return;
RigEclipseCaseData* eclipseCaseData = getEclipseCaseData();
if ( !eclipseCaseData ) return;
const cvf::Vec3d& position = anchorPosition();
RiaLogging::info( "Computing distance to barrier." );
RiaLogging::info( QString( "Anchor position: %1" ).arg( RimFractureModel::vecToString( position ) ) );
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
// Find the well path points closest to the anchor position
cvf::Vec3d p1;
cvf::Vec3d p2;
wellPathGeometry->twoClosestPoints( position, &p1, &p2 );
RiaLogging::info( QString( "Closest points on well path: %1 %2" )
.arg( RimFractureModel::vecToString( p1 ) )
.arg( RimFractureModel::vecToString( p2 ) ) );
// Create a well direction based on the two points
cvf::Vec3d wellDirection = ( p2 - p1 ).getNormalized();
RiaLogging::info( QString( "Well direction: %1" ).arg( RimFractureModel::vecToString( wellDirection ) ) );
cvf::Vec3d fractureDirection = wellDirection;
if ( m_fractureOrientation == FractureOrientation::ALONG_WELL_PATH )
{
cvf::Mat3d azimuthRotation = cvf::Mat3d::fromRotation( cvf::Vec3d::Z_AXIS, cvf::Math::toRadians( 90.0 ) );
fractureDirection.transformVector( azimuthRotation );
}
// The direction to the barrier is normal to the TST
cvf::Vec3d directionToBarrier = ( thicknessDirection() ^ fractureDirection ).getNormalized();
RiaLogging::info( QString( "Direction to barrier: %1" ).arg( RimFractureModel::vecToString( directionToBarrier ) ) );
std::vector<WellPathCellIntersectionInfo> intersections =
generateBarrierIntersections( eclipseCaseData, position, directionToBarrier );
RiaLogging::info( QString( "Intersections: %1" ).arg( intersections.size() ) );
double shortestDistance = std::numeric_limits<double>::max();
RigMainGrid* mainGrid = eclipseCaseData->mainGrid();
bool foundFault = false;
cvf::Vec3d barrierPosition;
double barrierDip = 0.0;
for ( const WellPathCellIntersectionInfo& intersection : intersections )
{
// Find the closest cell face which is a fault
double distance = position.pointDistance( intersection.startPoint );
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace( intersection.globCellIndex,
intersection.intersectedCellFaceIn );
if ( fault && distance < shortestDistance )
{
foundFault = true;
shortestDistance = distance;
barrierPosition = intersection.startPoint;
const RigCell& cell = mainGrid->globalCellArray()[intersection.globCellIndex];
cvf::Vec3d faceNormal = cell.faceNormalWithAreaLength( intersection.intersectedCellFaceIn );
barrierDip = calculateFormationDip( faceNormal );
}
}
if ( foundFault )
{
RiaLogging::info( QString( "Found barrier distance: %1 Dip: %2" ).arg( shortestDistance ).arg( barrierDip ) );
clearBarrierAnnotation();
addBarrierAnnotation( position, barrierPosition );
m_hasBarrier = true;
m_barrierDip = barrierDip;
m_distanceToBarrier = shortestDistance;
}
else
{
RiaLogging::info( "No barrier found." );
clearBarrierAnnotation();
m_hasBarrier = false;
m_barrierDip = 0.0;
m_distanceToBarrier = 0.0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo>
RimFractureModel::generateBarrierIntersections( RigEclipseCaseData* eclipseCaseData,
const cvf::Vec3d& position,
const cvf::Vec3d& directionToBarrier )
{
double randoDistance = 10000.0;
cvf::Vec3d forwardPosition = position + ( directionToBarrier * randoDistance );
cvf::Vec3d backwardPosition = position + ( directionToBarrier * -randoDistance );
std::vector<WellPathCellIntersectionInfo> intersections =
generateBarrierIntersectionsBetweenPoints( eclipseCaseData, position, forwardPosition );
std::vector<WellPathCellIntersectionInfo> backwardIntersections =
generateBarrierIntersectionsBetweenPoints( eclipseCaseData, position, backwardPosition );
// Merge the intersections for the search for closest
intersections.insert( intersections.end(), backwardIntersections.begin(), backwardIntersections.end() );
return intersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo>
RimFractureModel::generateBarrierIntersectionsBetweenPoints( RigEclipseCaseData* eclipseCaseData,
const cvf::Vec3d& startPosition,
const cvf::Vec3d& endPosition )
{
// Create a fake well path from the anchor point to
// a point far away in the direction barrier direction
std::vector<cvf::Vec3d> pathCoords;
pathCoords.push_back( startPosition );
pathCoords.push_back( endPosition );
RigSimulationWellCoordsAndMD helper( pathCoords );
return RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( eclipseCaseData,
helper.wellPathPoints(),
helper.measuredDepths() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureModel::clearBarrierAnnotation()
{
auto existingAnnotation = m_barrierAnnotation.value();
if ( existingAnnotation )
{
delete existingAnnotation;
m_barrierAnnotation = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureModel::addBarrierAnnotation( const cvf::Vec3d& startPosition, const cvf::Vec3d& endPosition )
{
RimAnnotationCollection* coll = annotationCollection();
if ( !coll ) return;
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
RimPolylineTarget* startTarget = new RimPolylineTarget();
startTarget->setAsPointXYZ( startPosition );
newAnnotation->insertTarget( nullptr, startTarget );
RimPolylineTarget* endTarget = new RimPolylineTarget();
endTarget->setAsPointXYZ( endPosition );
newAnnotation->insertTarget( nullptr, endTarget );
m_barrierAnnotation = newAnnotation;
coll->addAnnotation( newAnnotation );
coll->scheduleRedrawOfRelevantViews();
coll->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimAnnotationCollection* RimFractureModel::annotationCollection()
{
const auto project = RimProject::current();
auto oilField = project->activeOilField();
return oilField ? oilField->annotationCollection() : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -559,6 +766,7 @@ void RimFractureModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
{
m_thicknessDirectionWellPath.uiCapability()->setUiHidden( true );
m_elasticProperties.uiCapability()->setUiHidden( false );
m_barrierAnnotation.uiCapability()->setUiHidden( true );
uiOrdering.add( nameField() );
uiOrdering.add( &m_MD );
@@ -613,6 +821,7 @@ void RimFractureModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
caf::PdmUiOrdering* asymmetricGroup = uiOrdering.addNewGroup( "Asymmetric" );
asymmetricGroup->add( &m_formationDip );
asymmetricGroup->add( &m_hasBarrier );
asymmetricGroup->add( &m_autoComputeBarrier );
asymmetricGroup->add( &m_distanceToBarrier );
asymmetricGroup->add( &m_barrierDip );
asymmetricGroup->add( &m_wellPenetrationLayer );
@@ -625,7 +834,8 @@ void RimFractureModel::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_stressDepth || field == &m_verticalStress || field == &m_formationDip )
if ( field == &m_stressDepth || field == &m_verticalStress || field == &m_formationDip || field == &m_barrierDip ||
field == &m_distanceToBarrier )
{
auto doubleAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
if ( doubleAttr )

View File

@@ -24,6 +24,8 @@
#include "RimCheckableNamedObject.h"
#include "RimWellPathComponentInterface.h"
#include "RigWellLogExtractor.h"
#include "cafPdmChildField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmProxyValueField.h"
@@ -34,6 +36,8 @@ class RimWellPath;
class RimModeledWellPath;
class RimElasticProperties;
class RigEclipseCaseData;
class RimAnnotationCollection;
class RimUserDefinedPolylinesAnnotation;
//==================================================================================================
///
@@ -143,11 +147,13 @@ protected:
caf::PdmUiEditorAttribute* attribute ) override;
private:
void updatePositionFromMeasuredDepth();
void updateThicknessDirection();
cvf::Vec3d calculateTSTDirection() const;
void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
static double calculateFormationDip( const cvf::Vec3d& direction );
void updatePositionFromMeasuredDepth();
void updateThicknessDirection();
void updateDistanceToBarrierAndDip();
cvf::Vec3d calculateTSTDirection() const;
void findThicknessTargetPoints( cvf::Vec3d& topPosition, cvf::Vec3d& bottomPosition );
static double calculateFormationDip( const cvf::Vec3d& direction );
static QString vecToString( const cvf::Vec3d& vec );
void updateThicknessDirectionWellPathName();
static double computeDefaultStressDepth();
@@ -155,6 +161,19 @@ private:
static RigEclipseCaseData* getEclipseCaseData();
static RimEclipseCase* getEclipseCase();
void addBarrierAnnotation( const cvf::Vec3d& startPosition, const cvf::Vec3d& endPosition );
void clearBarrierAnnotation();
RimAnnotationCollection* annotationCollection();
static std::vector<WellPathCellIntersectionInfo> generateBarrierIntersections( RigEclipseCaseData* eclipseCaseData,
const cvf::Vec3d& position,
const cvf::Vec3d& directionToBarrier );
static std::vector<WellPathCellIntersectionInfo>
generateBarrierIntersectionsBetweenPoints( RigEclipseCaseData* eclipseCaseData,
const cvf::Vec3d& startPosition,
const cvf::Vec3d& endPosition );
protected:
caf::PdmField<double> m_MD;
caf::PdmField<caf::AppEnum<ExtractionType>> m_extractionType;
@@ -192,9 +211,11 @@ protected:
caf::PdmField<caf::AppEnum<FractureOrientation>> m_fractureOrientation;
caf::PdmField<double> m_perforationLength;
caf::PdmField<double> m_formationDip;
caf::PdmField<bool> m_hasBarrier;
caf::PdmField<double> m_distanceToBarrier;
caf::PdmField<double> m_barrierDip;
caf::PdmField<int> m_wellPenetrationLayer;
caf::PdmField<double> m_formationDip;
caf::PdmField<bool> m_autoComputeBarrier;
caf::PdmField<bool> m_hasBarrier;
caf::PdmField<double> m_distanceToBarrier;
caf::PdmField<double> m_barrierDip;
caf::PdmField<int> m_wellPenetrationLayer;
caf::PdmPtrField<RimUserDefinedPolylinesAnnotation*> m_barrierAnnotation;
};

View File

@@ -50,7 +50,6 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step", "", "", "" );
m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitField( &m_useAutoPlotTitle, "AutoTitle", true, "Automatic Plot Title", "", "", "" );
CAF_PDM_InitField( &m_description, "PlotTitle", QString( "Correlation Plot" ), "Custom Plot Title", "", "", "" );
@@ -76,7 +75,6 @@ RimAbstractCorrelationPlot::~RimAbstractCorrelationPlot()
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
{
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( auto curveDef : curveDefinitions )
{
@@ -127,7 +125,6 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
if ( !curveSelection.empty() )
{
std::vector<RiaSummaryCurveDefinition> summaryVectorDefinitions = dlg.curveSelection();
disconnectAllCaseSignals();
m_analysisPlotDataSelection.deleteAllChildObjects();
for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions )
{
@@ -613,17 +610,3 @@ void RimAbstractCorrelationPlot::connectAllCaseSignals()
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimAbstractCorrelationPlot::disconnectAllCaseSignals()
{
for ( auto dataEntry : m_analysisPlotDataSelection )
{
if ( dataEntry->ensemble() )
{
dataEntry->ensemble()->caseRemoved.disconnect( this );
}
}
}

View File

@@ -60,9 +60,10 @@ public:
int axisTitleFontSize() const;
int axisValueFontSize() const;
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
std::set<time_t> allAvailableTimeSteps();
protected:
// Overridden PDM methods
@@ -76,7 +77,6 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
std::set<time_t> allAvailableTimeSteps();
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
std::set<RifEclipseSummaryAddress> addresses();
@@ -98,7 +98,6 @@ protected:
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
void reattachAllCurves() override {}
void doRemoveFromCollection() override {}
void updateZoomInQwt() override {}
void updateZoomFromQwt() override {}
void setAutoScaleXEnabled( bool enabled ) override {}
@@ -120,7 +119,6 @@ protected:
private:
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
void connectAllCaseSignals();
void disconnectAllCaseSignals();
protected:
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
@@ -136,7 +134,6 @@ protected:
caf::PdmField<TimeStepFilterEnum> m_timeStepFilter;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;

View File

@@ -152,8 +152,6 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
{
CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_sortByValues, "CorrelationSorting", "Sort Matrix by Values", "", "", "" );
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
@@ -164,8 +162,8 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
"",
"",
"" );
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", false, "Show Only Top Correlations", "", "", "" );
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 15, "Number rows/columns", "", "", "" );
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations", "", "", "" );
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters", "", "", "" );
m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
@@ -174,7 +172,9 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
m_legendConfig = new RimRegularLegendConfig();
m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 );
m_legendConfig->setColorLegend(
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::CORRELATION ) );
RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::RED_WHITE_BLUE ) );
setLegendsVisible( false );
this->uiCapability()->setUiTreeChildrenHidden( true );
m_selectMultipleVectors = true;
@@ -190,14 +190,6 @@ RimCorrelationMatrixPlot::~RimCorrelationMatrixPlot()
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationMatrixPlot::CorrelationFactor RimCorrelationMatrixPlot::correlationFactor() const
{
return m_correlationFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -262,10 +254,10 @@ void RimCorrelationMatrixPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
const QVariant& newValue )
{
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
changedField == &m_sortByValues || changedField == &m_sortByAbsoluteValues ||
changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount ||
changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList )
if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByValues ||
changedField == &m_sortByAbsoluteValues || changedField == &m_showOnlyTopNCorrelations ||
changedField == &m_topNFilterCount || changedField == &m_excludeParametersWithoutVariation ||
changedField == &m_selectedParametersList )
{
if ( changedField == &m_excludeParametersWithoutVariation )
{
@@ -282,8 +274,7 @@ void RimCorrelationMatrixPlot::fieldChangedByUi( const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Factor Settings" );
correlationGroup->add( &m_correlationFactor );
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Settings" );
correlationGroup->add( &m_excludeParametersWithoutVariation );
correlationGroup->add( &m_selectedParametersList );
correlationGroup->add( &m_showAbsoluteValues );
@@ -551,14 +542,7 @@ void RimCorrelationMatrixPlot::createMatrix()
if ( parameterValues.empty() ) continue;
if ( m_correlationFactor == CorrelationFactor::PEARSON )
{
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValues, caseValuesAtTimestep );
}
else
{
correlation = RiaStatisticsTools::spearmanCorrelation( parameterValues, caseValuesAtTimestep );
}
correlation = RiaStatisticsTools::pearsonCorrelation( parameterValues, caseValuesAtTimestep );
bool validResult = RiaCurveDataTools::isValidValue( correlation, false );
if ( validResult )
@@ -653,15 +637,13 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
{
if ( m_useAutoPlotTitle )
{
m_description = QString( "%1 Matrix for Parameters vs Result Vectors at %2" )
.arg( m_correlationFactor().uiText() )
.arg( timeStepString() );
m_description = QString( "Correlation Matrix for Parameters vs Result Vectors at %2" ).arg( timeStepString() );
}
if ( m_plotWidget )
{
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
if ( isMdiWindow() )
{
m_plotWidget->setPlotTitleFontSize( titleFontSize() );

View File

@@ -39,9 +39,6 @@ public:
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> matrixCellSelected;
public:
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
enum class Sorting
{
NO_SORTING,
@@ -55,7 +52,6 @@ public:
RimCorrelationMatrixPlot();
~RimCorrelationMatrixPlot() override;
CorrelationFactor correlationFactor() const;
bool showAbsoluteValues() const;
bool sortByAbsoluteValues() const;
RimRegularLegendConfig* legendConfig();
@@ -85,14 +81,13 @@ private:
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
private:
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<SortingEnum> m_sortByValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<SortingEnum> m_sortByValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;

View File

@@ -47,19 +47,6 @@
#include <map>
#include <set>
namespace caf
{
template <>
void caf::AppEnum<RimCorrelationPlot::CorrelationFactor>::setUp()
{
addItem( RimCorrelationPlot::CorrelationFactor::PEARSON, "PEARSON", "Pearson Correlation Coefficient" );
#ifdef USE_GSL
addItem( RimCorrelationPlot::CorrelationFactor::SPEARMAN, "SPEARMAN", "Spearman's Rank Correlation Coefficient" );
#endif
setDefault( RimCorrelationPlot::CorrelationFactor::PEARSON );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimCorrelationPlot, "CorrelationPlot" );
//--------------------------------------------------------------------------------------------------
@@ -71,8 +58,6 @@ RimCorrelationPlot::RimCorrelationPlot()
{
CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
CAF_PDM_InitField( &m_excludeParametersWithoutVariation,
@@ -82,13 +67,14 @@ RimCorrelationPlot::RimCorrelationPlot()
"",
"",
"" );
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", false, "Show Only Top Correlations", "", "", "" );
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 15, "Number rows/columns", "", "", "" );
CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations", "", "", "" );
CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters", "", "", "" );
m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_selectedParametersList.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
setLegendsVisible( false );
setDeletable( true );
}
@@ -110,10 +96,9 @@ void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
const QVariant& newValue )
{
RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_correlationFactor || changedField == &m_showAbsoluteValues ||
changedField == &m_sortByAbsoluteValues || changedField == &m_excludeParametersWithoutVariation ||
changedField == &m_selectedParametersList || changedField == &m_showOnlyTopNCorrelations ||
changedField == &m_topNFilterCount )
if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByAbsoluteValues ||
changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList ||
changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount )
{
if ( changedField == &m_excludeParametersWithoutVariation )
{
@@ -129,8 +114,7 @@ void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Factor Settings" );
correlationGroup->add( &m_correlationFactor );
caf::PdmUiGroup* correlationGroup = uiOrdering.addNewGroup( "Correlation Settings" );
correlationGroup->add( &m_excludeParametersWithoutVariation );
correlationGroup->add( &m_selectedParametersList );
@@ -263,10 +247,7 @@ void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chart
auto address = *addresses().begin();
std::vector<std::pair<EnsembleParameter, double>> correlations =
ensemble->parameterCorrelations( address,
selectedTimestep,
m_correlationFactor == CorrelationFactor::SPEARMAN,
m_selectedParametersList() );
ensemble->parameterCorrelations( address, selectedTimestep, m_selectedParametersList() );
QString timestepString = m_timeStep().toString( RiaPreferences::current()->dateTimeFormat() );
@@ -289,19 +270,12 @@ void RimCorrelationPlot::updatePlotTitle()
if ( m_useAutoPlotTitle && !ensembles().empty() )
{
auto ensemble = *ensembles().begin();
m_description = QString( "%1 for %2, %3 at %4" )
.arg( m_correlationFactor().uiText() )
.arg( ensemble->name() )
.arg( m_selectedVarsUiField )
.arg( timeStepString() );
m_description =
QString( "Correlations for %2, %3 at %4" ).arg( ensemble->name() ).arg( m_selectedVarsUiField ).arg( timeStepString() );
}
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
if ( isMdiWindow() )
{
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}
//--------------------------------------------------------------------------------------------------
@@ -324,22 +298,6 @@ void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle,
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCorrelationPlot::CorrelationFactor RimCorrelationPlot::correlationFactor() const
{
return m_correlationFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::setCorrelationFactor( CorrelationFactor factor )
{
m_correlationFactor = factor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -40,21 +40,10 @@ class RimCorrelationPlot : public RimAbstractCorrelationPlot
public:
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> tornadoItemSelected;
public:
enum class CorrelationFactor
{
PEARSON,
SPEARMAN
};
using CorrelationFactorEnum = caf::AppEnum<CorrelationFactor>;
public:
RimCorrelationPlot();
~RimCorrelationPlot() override;
CorrelationFactor correlationFactor() const;
void setCorrelationFactor( CorrelationFactor factor );
bool showAbsoluteValues() const;
void setShowAbsoluteValues( bool showAbsoluteValues );
@@ -84,11 +73,10 @@ private:
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
private:
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmField<bool> m_showAbsoluteValues;
caf::PdmField<bool> m_sortByAbsoluteValues;
caf::PdmField<bool> m_excludeParametersWithoutVariation;
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
};

View File

@@ -59,7 +59,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool de
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} );
plot->selectAllParameters();
m_correlationPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -77,7 +77,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSumm
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep );
plot->selectAllParameters();
m_correlationPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -92,7 +92,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
if ( defaultToFirstEnsembleField ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT", "FWPT", "FGPT"} );
plot->selectAllParameters();
m_correlationPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -109,7 +109,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityNames, timeStep );
plot->selectAllParameters();
m_correlationPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -123,7 +123,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
plot->setAsPlotMdiWindow();
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} );
m_correlationPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -140,7 +140,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep );
plot->setEnsembleParameter( paramName );
m_correlationPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -181,15 +181,24 @@ RimCorrelationReportPlot*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* correlationPlot )
void RimCorrelationPlotCollection::insertPlot( RimAbstractCorrelationPlot* plot, size_t index )
{
m_correlationPlots.removeChildObject( correlationPlot );
m_correlationPlots.insert( index, plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots()
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot )
{
m_correlationPlots.removeChildObject( plot );
updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots() const
{
return m_correlationPlots.childObjects();
}
@@ -197,7 +206,15 @@ std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports()
size_t RimCorrelationPlotCollection::plotCount() const
{
return m_correlationPlots.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports() const
{
return m_correlationReports.childObjects();
}
@@ -205,9 +222,9 @@ std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlotCollection::deleteAllChildObjects()
void RimCorrelationPlotCollection::deleteAllPlots()
{
m_correlationPlots.deleteAllChildObjects();
RimTypedPlotCollection<RimAbstractCorrelationPlot>::deleteAllPlots();
m_correlationReports.deleteAllChildObjects();
}
@@ -253,16 +270,26 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstr
{
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
std::vector<RiaSummaryCurveDefinition> curveDefs;
std::vector<QString> highestCorrelationParameters;
for ( auto address : allAddresses )
{
auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) );
if ( it != quantityNames.end() || quantityNames.empty() )
{
curveDefs.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
auto correlationSortedEnsembleParameters =
ensemble->correlationSortedEnsembleParameters( address, timeStep );
highestCorrelationParameters.push_back( correlationSortedEnsembleParameters.front().first.name );
}
}
plot->setCurveDefinitions( curveDefs );
plot->setTimeStep( timeStep );
auto crossPlot = dynamic_cast<RimParameterResultCrossPlot*>( plot );
if ( crossPlot && !highestCorrelationParameters.empty() )
{
crossPlot->setEnsembleParameter( highestCorrelationParameters.front() );
}
}
}
@@ -300,7 +327,17 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
plot->crossPlot()->setEnsembleParameter( ensembles.front()->variationSortedEnsembleParameters().front().name );
time_t timeStep = *( plot->matrixPlot()->allAvailableTimeSteps().rbegin() );
auto correlationSortedEnsembleParameters =
ensembles.front()->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(),
timeStep );
if ( !correlationSortedEnsembleParameters.empty() )
{
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
}
plot->matrixPlot()->setTimeStep( timeStep );
}
}
@@ -334,12 +371,17 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCor
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( ensemble, address ) );
}
}
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
plot->matrixPlot()->setTimeStep( timeStep );
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
plot->correlationPlot()->setTimeStep( timeStep );
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
plot->crossPlot()->setTimeStep( timeStep );
plot->crossPlot()->setEnsembleParameter( ensemble->variationSortedEnsembleParameters().front().name );
auto correlationSortedEnsembleParameters =
ensemble->correlationSortedEnsembleParameters( curveDefsTornadoAndCrossPlot.front().summaryAddress(), timeStep );
QString crossPlotEnsembleParameterName = correlationSortedEnsembleParameters.front().first.name;
plot->crossPlot()->setEnsembleParameter( crossPlotEnsembleParameterName );
}
}

View File

@@ -18,13 +18,15 @@
#pragma once
#include "RimAbstractCorrelationPlot.h"
#include "RimAbstractPlotCollection.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
#include <ctime>
#include <vector>
class RimAbstractCorrelationPlot;
class RimCorrelationPlot;
class RimCorrelationMatrixPlot;
class RimCorrelationReportPlot;
@@ -35,7 +37,7 @@ class RimSummaryCaseCollection;
///
///
//==================================================================================================
class RimCorrelationPlotCollection : public caf::PdmObject
class RimCorrelationPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimAbstractCorrelationPlot>
{
CAF_PDM_HEADER_INIT;
@@ -64,13 +66,15 @@ public:
const QString& tornadoAndCrossPlotQuantityName,
std::time_t timeStep );
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
void removeReport( RimCorrelationReportPlot* correlationReport );
std::vector<RimAbstractCorrelationPlot*> plots();
std::vector<RimCorrelationReportPlot*> reports();
std::vector<RimAbstractCorrelationPlot*> plots() const final;
size_t plotCount() const final;
void insertPlot( RimAbstractCorrelationPlot* plot, size_t index ) final;
void removePlot( RimAbstractCorrelationPlot* correlationPlot ) final;
void deleteAllPlots() final;
void deleteAllChildObjects();
std::vector<RimCorrelationReportPlot*> reports() const;
private:
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot,

View File

@@ -84,7 +84,7 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
m_correlationPlot->setLegendsVisible( false );
m_parameterResultCrossPlot = new RimParameterResultCrossPlot;
m_parameterResultCrossPlot->setLegendsVisible( false );
m_parameterResultCrossPlot->setLegendsVisible( true );
this->uiCapability()->setUiTreeChildrenHidden( true );
@@ -320,7 +320,6 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
m_parameterResultCrossPlot->setAxisTitleFontSize( m_axisTitleFontSize() );
m_parameterResultCrossPlot->setAxisValueFontSize( m_axisValueFontSize() );
m_correlationPlot->setCorrelationFactor( m_correlationMatrixPlot->correlationFactor() );
m_correlationPlot->setShowAbsoluteValues( m_correlationMatrixPlot->showAbsoluteValues() );
m_correlationPlot->setSortByAbsoluteValues( m_correlationMatrixPlot->sortByAbsoluteValues() );

View File

@@ -38,8 +38,6 @@ class RiuMultiPlotPage;
class RimCorrelationReportPlot : public QObject, public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
public:
RimCorrelationReportPlot();

View File

@@ -22,6 +22,8 @@
#include "RiaPreferences.h"
#include "RiaQDateTimeTools.h"
#include "RiaStatisticsTools.h"
#include "RiaTextStringTools.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuSummaryVectorSelectionDialog.h"
@@ -30,6 +32,7 @@
#include "RimDerivedSummaryCase.h"
#include "RimEnsembleCurveSet.h"
#include "RimMultiPlot.h"
#include "RimPlotAxisProperties.h"
#include "RimPlotAxisPropertiesInterface.h"
#include "RimPlotDataFilterCollection.h"
@@ -166,10 +169,13 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate()
if ( m_plotWidget && m_analyserOfSelectedCurveDefs )
{
createPoints();
QwtLegend* legend = new QwtLegend( m_plotWidget );
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
m_plotWidget->setLegendFontSize( legendFontSize() );
m_plotWidget->updateLegend();
if ( m_showPlotLegends && !isSubPlot<RimMultiPlot>() )
{
QwtLegend* legend = new QwtLegend( m_plotWidget );
m_plotWidget->insertLegend( legend, QwtPlot::RightLegend );
m_plotWidget->setLegendFontSize( legendFontSize() );
m_plotWidget->updateLegend();
}
this->updateAxes();
this->updatePlotTitle();
@@ -199,6 +205,21 @@ void RimParameterResultCrossPlot::updateAxes()
m_plotWidget->setAxisRange( QwtPlot::xBottom, m_xRange.first - xRangeWidth * 0.1, m_xRange.second + xRangeWidth * 0.1 );
}
QStringList caseNamesOfValidEnsembleCases( const RimSummaryCaseCollection* ensemble )
{
QStringList caseNames;
for ( auto summaryCase : ensemble->allSummaryCases() )
{
RifSummaryReaderInterface* reader = summaryCase->summaryReader();
if ( !reader ) continue;
if ( !summaryCase->caseRealizationParameters() ) continue;
caseNames.push_back( summaryCase->displayCaseName() );
}
return caseNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -228,6 +249,9 @@ void RimParameterResultCrossPlot::createPoints()
EnsembleParameter parameter = ensembleParameter( m_ensembleParameter );
if ( !( parameter.isNumeric() && parameter.isValid() ) ) return;
QStringList caseNames = caseNamesOfValidEnsembleCases( ensemble );
QString commonCaseRoot = RiaTextStringTools::findCommonRoot( caseNames );
for ( size_t caseIdx = 0u; caseIdx < ensemble->allSummaryCases().size(); ++caseIdx )
{
auto summaryCase = ensemble->allSummaryCases()[caseIdx];
@@ -278,7 +302,7 @@ void RimParameterResultCrossPlot::createPoints()
plotCurve->setSymbol( symbol );
QStringList curveName;
if ( showEnsembleName ) curveName += ensemble->name();
curveName += summaryCase->displayCaseName();
curveName += summaryCase->displayCaseName().replace( commonCaseRoot, "" );
if ( showAddressName ) curveName += QString::fromStdString( address.uiText() );
plotCurve->setTitle( curveName.join( " - " ) );
@@ -307,10 +331,6 @@ void RimParameterResultCrossPlot::updatePlotTitle()
.arg( timeStepString() );
}
m_plotWidget->setPlotTitle( m_description );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
if ( isMdiWindow() )
{
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
}

View File

@@ -282,14 +282,6 @@ void RimWellDistributionPlot::zoomAll()
// cvf::Trace::show("RimWellDistributionPlot::zoomAll()");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellDistributionPlot::doRemoveFromCollection()
{
// cvf::Trace::show("RimWellDistributionPlot::doRemoveFromCollection()");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -71,9 +71,6 @@ public:
void zoomAll() override;
private:
// RimPlot implementations
void doRemoveFromCollection() override;
// RimViewWindow implementations
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;

View File

@@ -100,9 +100,6 @@ RimWellPltPlot::RimWellPltPlot()
{
CAF_PDM_InitObject( "Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "" );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "" );
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true );
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
@@ -117,6 +114,7 @@ RimWellPltPlot::RimWellPltPlot()
CAF_PDM_InitFieldNoDefault( &m_selectedSourcesForIo, "Sources", "Sources", "", "", "" );
m_selectedSourcesForIo.uiCapability()->setUiHidden( true );
m_selectedSourcesForIo.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", "" );
m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
@@ -128,7 +126,7 @@ RimWellPltPlot::RimWellPltPlot()
CAF_PDM_InitFieldNoDefault( &m_phases, "Phases", "Phases", "", "", "" );
m_phases.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
m_phases = std::vector<caf::AppEnum<FlowPhase>>( {FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER} );
m_phases = std::vector<caf::AppEnum<FlowPhase>>( { FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER } );
m_phases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_nameConfig->setCustomName( "PLT Plot" );
@@ -138,7 +136,8 @@ RimWellPltPlot::RimWellPltPlot()
m_isOnLoad = true;
m_plotLegendsHorizontal = false;
setAvailableDepthTypes( {RiaDefines::DepthTypeEnum::MEASURED_DEPTH} );
setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::MEASURED_DEPTH } );
setPlotTitleVisible( true );
}
//--------------------------------------------------------------------------------------------------
@@ -961,7 +960,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
// uiTreeOrdering.skipRemainingChildren( true );
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
@@ -1034,11 +1033,6 @@ void RimWellPltPlot::initAfterRead()
m_wellLogPlot_OBSOLETE = nullptr;
}
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
{
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();
// Postpone init until data has been loaded

View File

@@ -114,8 +114,6 @@ private:
void updateFormationsOnPlot() const;
private:
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<QString> m_wellPathName;
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;

View File

@@ -83,9 +83,6 @@ RimWellRftPlot::RimWellRftPlot()
{
CAF_PDM_InitObject( "RFT Plot", ":/RFTPlot16x16.png", "", "" );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", "" );
CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", "" );
CAF_PDM_InitField( &m_showErrorInObservedData, "ShowErrorObserved", true, "Show Observed Data Error", "", "", "" );
@@ -127,11 +124,13 @@ RimWellRftPlot::RimWellRftPlot()
// TODO: may want to support TRUE_VERTICAL_DEPTH_RKB in the future
// It was developed for regular well log plots and requires some more work for RFT plots.
setAvailableDepthTypes( {RiaDefines::DepthTypeEnum::MEASURED_DEPTH, RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH} );
setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::MEASURED_DEPTH, RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH } );
m_nameConfig->setCustomName( "RFT Plot" );
m_plotLegendsHorizontal = false;
setPlotTitleVisible( true );
this->setAsPlotMdiWindow();
m_isOnLoad = true;
}
@@ -382,7 +381,7 @@ void RimWellRftPlot::updateEditorsFromCurves()
selectedSources.insert( curveDef.address() );
auto newTimeStepMap = std::map<QDateTime, std::set<RifDataSourceForRftPlt>>{
{curveDef.timeStep(), std::set<RifDataSourceForRftPlt>{curveDef.address()}}};
{ curveDef.timeStep(), std::set<RifDataSourceForRftPlt>{ curveDef.address() } } };
RimWellPlotTools::addTimeStepsToMap( selectedTimeStepsMap, newTimeStepMap );
selectedTimeSteps.insert( curveDef.timeStep() );
}
@@ -911,11 +910,6 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
updateFormationsOnPlot();
syncCurvesFromUiSelection();
}
else if ( changedField == &m_showPlotWindowTitle )
{
// m_wellLogPlot->setShowDescription(m_showPlotTitle);
}
}
//--------------------------------------------------------------------------------------------------
@@ -1108,10 +1102,6 @@ void RimWellRftPlot::initAfterRead()
delete m_wellLogPlot_OBSOLETE;
m_wellLogPlot_OBSOLETE = nullptr;
}
if ( m_showPlotTitle_OBSOLETE() && !m_showPlotWindowTitle() )
{
m_showPlotWindowTitle = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();
}
@@ -1286,12 +1276,12 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
std::vector<cvf::Color3f> colorTable;
RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable );
std::vector<RiuQwtSymbol::PointSymbolEnum> symbolTable = {RiuQwtSymbol::SYMBOL_ELLIPSE,
RiuQwtSymbol::SYMBOL_RECT,
RiuQwtSymbol::SYMBOL_DIAMOND,
RiuQwtSymbol::SYMBOL_CROSS,
RiuQwtSymbol::SYMBOL_XCROSS,
RiuQwtSymbol::SYMBOL_STAR1};
std::vector<RiuQwtSymbol::PointSymbolEnum> symbolTable = { RiuQwtSymbol::SYMBOL_ELLIPSE,
RiuQwtSymbol::SYMBOL_RECT,
RiuQwtSymbol::SYMBOL_DIAMOND,
RiuQwtSymbol::SYMBOL_CROSS,
RiuQwtSymbol::SYMBOL_XCROSS,
RiuQwtSymbol::SYMBOL_STAR1 };
// Add new curves
for ( const RiaRftPltCurveDefinition& curveDefToAdd : allCurveDefs )

View File

@@ -161,6 +161,5 @@ private:
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
bool m_isOnLoad;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
};

View File

@@ -391,20 +391,6 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::doRemoveFromCollection()
{
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
this->firstAncestorOrThisOfType( crossPlotCollection );
if ( crossPlotCollection )
{
crossPlotCollection->removeGridCrossPlot( this );
crossPlotCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -648,7 +634,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
{
QString plotTitle = this->createAutoName();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
}
updateMdiWindowTitle();
}
@@ -774,7 +760,7 @@ void RimGridCrossPlot::updateLegend()
{
if ( m_plotWidget )
{
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() );
m_plotWidget->setLegendFontSize( legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{

View File

@@ -141,7 +141,6 @@ private:
void doUpdateLayout() override;
void cleanupBeforeClose();
void doRemoveFromCollection() override;
QString generateInfoBoxText() const;
void connectAxisSignals( RimPlotAxisProperties* axis );

View File

@@ -43,17 +43,17 @@ RimGridCrossPlotCollection::~RimGridCrossPlotCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCollection::deleteAllChildObjects()
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::plots() const
{
m_gridCrossPlots.deleteAllChildObjects();
return m_gridCrossPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::gridCrossPlots() const
size_t RimGridCrossPlotCollection::plotCount() const
{
return m_gridCrossPlots.childObjects();
return m_gridCrossPlots.size();
}
//--------------------------------------------------------------------------------------------------
@@ -65,22 +65,23 @@ RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot()
plot->setAsPlotMdiWindow();
// plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size()));
addGridCrossPlot( plot );
addPlot( plot );
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCollection::addGridCrossPlot( RimGridCrossPlot* plot )
void RimGridCrossPlotCollection::insertPlot( RimGridCrossPlot* plot, size_t index )
{
m_gridCrossPlots().push_back( plot );
m_gridCrossPlots.insert( index, plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCollection::removeGridCrossPlot( RimGridCrossPlot* plot )
void RimGridCrossPlotCollection::removePlot( RimGridCrossPlot* plot )
{
m_gridCrossPlots.removeChildObject( plot );
updateAllRequiredEditors();
}

View File

@@ -17,16 +17,17 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimAbstractPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimGridCrossPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimGridCrossPlotCollection : public caf::PdmObject
class RimGridCrossPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimGridCrossPlot>
{
CAF_PDM_HEADER_INIT;
@@ -34,12 +35,12 @@ public:
RimGridCrossPlotCollection();
~RimGridCrossPlotCollection() override;
void deleteAllChildObjects();
std::vector<RimGridCrossPlot*> plots() const final;
size_t plotCount() const final;
void insertPlot( RimGridCrossPlot* plot, size_t index ) final;
void removePlot( RimGridCrossPlot* plot ) final;
std::vector<RimGridCrossPlot*> gridCrossPlots() const;
RimGridCrossPlot* createGridCrossPlot();
void addGridCrossPlot( RimGridCrossPlot* plot );
void removeGridCrossPlot( RimGridCrossPlot* plot );
RimGridCrossPlot* createGridCrossPlot();
private:
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;

View File

@@ -108,11 +108,19 @@ std::vector<RimSaturationPressurePlot*>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots()
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots() const
{
return m_saturationPressurePlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimSaturationPressurePlotCollection::plotCount() const
{
return m_saturationPressurePlots.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -38,7 +38,8 @@ public:
std::vector<RimSaturationPressurePlot*> createSaturationPressurePlots( RimEclipseResultCase* eclipseResultCase,
int timeStep );
std::vector<RimSaturationPressurePlot*> plots();
std::vector<RimSaturationPressurePlot*> plots() const;
size_t plotCount() const;
void deleteAllChildObjects();
private:

View File

@@ -20,6 +20,7 @@
#include "Rim3dOverlayInfoConfig.h"
#include "RiaPreferences.h"
#include "RiaQDateTimeTools.h"
#include "RicGridStatisticsDialog.h"
@@ -105,6 +106,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
CAF_PDM_InitField( &m_active, "Active", true, "Active", "", "", "" );
m_active.uiCapability()->setUiHidden( true );
m_active = RiaPreferences::current()->showInfoBox();
CAF_PDM_InitField( &m_showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "" );
CAF_PDM_InitField( &m_showCaseInfo, "ShowInfoText", true, "Case Info", "", "", "" );

View File

@@ -136,7 +136,13 @@ Rim3dView::Rim3dView( void )
CAF_PDM_InitField( &meshMode, "MeshMode", defaultMeshType, "Grid Lines", "", "", "" );
CAF_PDM_InitFieldNoDefault( &surfaceMode, "SurfaceMode", "Grid Surface", "", "", "" );
CAF_PDM_InitScriptableField( &m_showGridBox, "ShowGridBox", true, "Show Grid Box", "", "", "" );
CAF_PDM_InitScriptableField( &m_showGridBox,
"ShowGridBox",
RiaPreferences::current()->showGridBox(),
"Show Grid Box",
"",
"",
"" );
CAF_PDM_InitScriptableField( &m_disableLighting,
"DisableLighting",

View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPlot.h"
#include "cafPdmObject.h"
class RimAbstractPlotCollection
{
public:
virtual ~RimAbstractPlotCollection() = default;
virtual size_t plotCount() const = 0;
virtual void deleteAllPlots() = 0;
virtual void removeRimPlot( RimPlot* plot ) = 0;
};
//==================================================================================================
/// Templated Base class of all plot collections.
/// Specialize on plot type (has to derive from RimPlot) and the base class of the collection.
//==================================================================================================
template <typename RimPlotType>
class RimTypedPlotCollection : public RimAbstractPlotCollection
{
static_assert( std::is_base_of<RimPlot, RimPlotType>::value, "RimPlotType must inherit from RimPlot" );
public:
~RimTypedPlotCollection() override = default;
virtual std::vector<RimPlotType*> plots() const = 0;
void deleteAllPlots() override
{
for ( auto plot : plots() )
{
removePlot( plot );
delete plot;
}
}
void addPlot( RimPlotType* plot ) { insertPlot( plot, plotCount() ); }
virtual void insertPlot( RimPlotType* plot, size_t index ) = 0;
virtual void removePlot( RimPlotType* plot ) = 0;
void removeRimPlot( RimPlot* rimPlot )
{
auto typedPlot = dynamic_cast<RimPlotType*>( rimPlot );
if ( typedPlot )
{
removePlot( typedPlot );
}
}
};

View File

@@ -79,14 +79,13 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimContourMapProjection, "RimContourMapProjection"
RimContourMapProjection::RimContourMapProjection()
: m_pickPoint( cvf::Vec2d::UNDEFINED )
, m_mapSize( cvf::Vec2ui( 0u, 0u ) )
, m_sampleSpacing( -1.0 )
, m_currentResultTimestep( -1 )
, m_minResultAllTimeSteps( std::numeric_limits<double>::infinity() )
, m_maxResultAllTimeSteps( -std::numeric_limits<double>::infinity() )
{
CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" );
CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.8, "Sample Spacing Factor", "", "", "" );
CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor", "", "", "" );
m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation", "", "", "" );
@@ -169,23 +168,23 @@ std::vector<cvf::Vec3d> RimContourMapProjection::generatePickPointPolygon()
{
{
#ifndef NDEBUG
cvf::Vec2d cellDiagonal( m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 );
cvf::Vec2d cellDiagonal( sampleSpacing() * 0.5, sampleSpacing() * 0.5 );
cvf::Vec2ui pickedCell = ijFromLocalPos( m_pickPoint );
cvf::Vec2d cellCenter = cellCenterPosition( pickedCell.x(), pickedCell.y() );
cvf::Vec2d cellCorner = cellCenter - cellDiagonal;
points.push_back( cvf::Vec3d( cellCorner, 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, m_sampleSpacing ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( m_sampleSpacing, m_sampleSpacing ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, m_sampleSpacing ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, m_sampleSpacing ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( sampleSpacing(), sampleSpacing() ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner + cvf::Vec2d( 0.0, sampleSpacing() ), 0.0 ) );
points.push_back( cvf::Vec3d( cellCorner, 0.0 ) );
#endif
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * m_sampleSpacing, 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * m_sampleSpacing, 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * m_sampleSpacing ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * m_sampleSpacing ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.5 * sampleSpacing(), 0.0 ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint - cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) );
points.push_back( cvf::Vec3d( m_pickPoint + cvf::Vec2d( 0.0, 0.5 * sampleSpacing() ), 0.0 ) );
}
}
return points;
@@ -219,17 +218,17 @@ const std::vector<cvf::Vec4d>& RimContourMapProjection::trianglesWithVertexValue
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimContourMapProjection::sampleSpacing() const
double RimContourMapProjection::sampleSpacingFactor() const
{
return m_sampleSpacing;
return m_relativeSampleSpacing();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimContourMapProjection::sampleSpacingFactor() const
void RimContourMapProjection::setSampleSpacingFactor( double spacingFactor )
{
return m_relativeSampleSpacing();
m_relativeSampleSpacing = spacingFactor;
}
//--------------------------------------------------------------------------------------------------
@@ -845,7 +844,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
}
}
const double cellArea = m_sampleSpacing * m_sampleSpacing;
const double cellArea = sampleSpacing() * sampleSpacing();
const double areaThreshold = 1.0e-5 * 0.5 * cellArea;
std::vector<std::vector<std::vector<cvf::Vec3d>>> subtractPolygons;
@@ -977,11 +976,11 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
std::vector<cvf::Vec3d> clippedTriangle;
if ( v == clippedPolygon.size() - 1 )
{
clippedTriangle = {clippedPolygon[v], clippedPolygon[0], baryCenter};
clippedTriangle = { clippedPolygon[v], clippedPolygon[0], baryCenter };
}
else
{
clippedTriangle = {clippedPolygon[v], clippedPolygon[v + 1], baryCenter};
clippedTriangle = { clippedPolygon[v], clippedPolygon[v + 1], baryCenter };
}
polygonTriangles.push_back( clippedTriangle );
}
@@ -1005,7 +1004,7 @@ void RimContourMapProjection::generateTrianglesWithVertexValues()
{
for ( size_t n = 0; n < 3; ++n )
{
if ( ( triangle[n] - localVertex ).length() < m_sampleSpacing * 0.01 &&
if ( ( triangle[n] - localVertex ).length() < sampleSpacing() * 0.01 &&
triangleWithValues[n].w() != std::numeric_limits<double>::infinity() )
{
value = triangleWithValues[n].w();
@@ -1077,8 +1076,8 @@ std::vector<cvf::Vec3d> RimContourMapProjection::generateVertices() const
cvf::Vec2ui ij = ijFromVertexIndex( index );
cvf::Vec2d mapPos = cellCenterPosition( ij.x(), ij.y() );
// Shift away from sample point to vertex
mapPos.x() -= m_sampleSpacing * 0.5;
mapPos.y() -= m_sampleSpacing * 0.5;
mapPos.x() -= sampleSpacing() * 0.5;
mapPos.y() -= sampleSpacing() * 0.5;
cvf::Vec3d vertexPos( mapPos, 0.0 );
vertices[index] = vertexPos;
@@ -1114,7 +1113,7 @@ void RimContourMapProjection::generateContourPolygons()
contourLevels.front() *= 0.5;
}
double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * m_sampleSpacing : 1.0e-3 * m_sampleSpacing;
double simplifyEpsilon = m_smoothContourLines() ? 5.0e-2 * sampleSpacing() : 1.0e-3 * sampleSpacing();
if ( nContourLevels >= 10 )
{
@@ -1175,7 +1174,7 @@ RimContourMapProjection::ContourPolygons
double contourValue )
{
const double areaThreshold =
1.5 * ( m_sampleSpacing * m_sampleSpacing ) / ( sampleSpacingFactor() * sampleSpacingFactor() );
1.5 * ( sampleSpacing() * sampleSpacing() ) / ( sampleSpacingFactor() * sampleSpacingFactor() );
ContourPolygons contourPolygons;
@@ -1253,7 +1252,7 @@ void RimContourMapProjection::smoothContourPolygons( ContourPolygons* contourPol
maxChange = std::max( maxChange, ( modifiedVertex - v ).length() );
}
polygon.vertices.swap( newVertices );
if ( maxChange < m_sampleSpacing * 1.0e-2 ) break;
if ( maxChange < sampleSpacing() * 1.0e-2 ) break;
}
}
}
@@ -1317,7 +1316,7 @@ std::vector<RimContourMapProjection::CellIndexAndResult>
{
cvf::Vec3d top2dElementCentroid( globalPos2d, m_expandedBoundingBox.max().z() );
cvf::Vec3d bottom2dElementCentroid( globalPos2d, m_expandedBoundingBox.min().z() );
cvf::Vec3d planarDiagonalVector( 0.5 * m_sampleSpacing, 0.5 * m_sampleSpacing, 0.0 );
cvf::Vec3d planarDiagonalVector( 0.5 * sampleSpacing(), 0.5 * sampleSpacing(), 0.0 );
cvf::Vec3d topNECorner = top2dElementCentroid + planarDiagonalVector;
cvf::Vec3d bottomSWCorner = bottom2dElementCentroid - planarDiagonalVector;
@@ -1455,10 +1454,10 @@ double RimContourMapProjection::interpolateValue( const cvf::Vec2d& gridPos2d )
cvf::Vec2d cellCenter = cellCenterPosition( cellContainingPoint.x(), cellContainingPoint.y() );
std::array<cvf::Vec3d, 4> x;
x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -m_sampleSpacing * 0.5, -m_sampleSpacing * 0.5 ), 0.0 );
x[1] = cvf::Vec3d( cellCenter + cvf::Vec2d( m_sampleSpacing * 0.5, -m_sampleSpacing * 0.5 ), 0.0 );
x[2] = cvf::Vec3d( cellCenter + cvf::Vec2d( m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 ), 0.0 );
x[3] = cvf::Vec3d( cellCenter + cvf::Vec2d( -m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 ), 0.0 );
x[0] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 );
x[1] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing() * 0.5, -sampleSpacing() * 0.5 ), 0.0 );
x[2] = cvf::Vec3d( cellCenter + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 ), 0.0 );
x[3] = cvf::Vec3d( cellCenter + cvf::Vec2d( -sampleSpacing() * 0.5, sampleSpacing() * 0.5 ), 0.0 );
cvf::Vec4d baryCentricCoords =
cvf::GeometryTools::barycentricCoords( x[0], x[1], x[2], x[3], cvf::Vec3d( gridPos2d, 0.0 ) );
@@ -1615,8 +1614,8 @@ cvf::Vec2ui RimContourMapProjection::ijFromCellIndex( size_t cellIndex ) const
//--------------------------------------------------------------------------------------------------
cvf::Vec2ui RimContourMapProjection::ijFromLocalPos( const cvf::Vec2d& localPos2d ) const
{
uint i = localPos2d.x() / m_sampleSpacing;
uint j = localPos2d.y() / m_sampleSpacing;
uint i = localPos2d.x() / sampleSpacing();
uint j = localPos2d.y() / sampleSpacing();
return cvf::Vec2ui( i, j );
}
@@ -1629,7 +1628,7 @@ cvf::Vec2d RimContourMapProjection::cellCenterPosition( uint i, uint j ) const
cvf::Vec2d cellCorner =
cvf::Vec2d( ( i * gridExtent.x() ) / ( m_mapSize.x() ), ( j * gridExtent.y() ) / ( m_mapSize.y() ) );
return cellCorner + cvf::Vec2d( m_sampleSpacing * 0.5, m_sampleSpacing * 0.5 );
return cellCorner + cvf::Vec2d( sampleSpacing() * 0.5, sampleSpacing() * 0.5 );
}
//--------------------------------------------------------------------------------------------------
@@ -1683,8 +1682,8 @@ cvf::Vec2ui RimContourMapProjection::calculateMapSize() const
{
cvf::Vec3d gridExtent = m_expandedBoundingBox.extent();
uint projectionSizeX = static_cast<uint>( std::ceil( gridExtent.x() / m_sampleSpacing ) );
uint projectionSizeY = static_cast<uint>( std::ceil( gridExtent.y() / m_sampleSpacing ) );
uint projectionSizeX = static_cast<uint>( std::ceil( gridExtent.x() / sampleSpacing() ) );
uint projectionSizeY = static_cast<uint>( std::ceil( gridExtent.y() / sampleSpacing() ) );
return cvf::Vec2ui( projectionSizeX, projectionSizeY );
}
@@ -1694,7 +1693,7 @@ cvf::Vec2ui RimContourMapProjection::calculateMapSize() const
//--------------------------------------------------------------------------------------------------
double RimContourMapProjection::gridEdgeOffset() const
{
return m_sampleSpacing * 2.0;
return sampleSpacing() * 2.0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -26,6 +26,7 @@
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cvfArray.h"
#include "cvfBoundingBox.h"
@@ -83,8 +84,10 @@ public:
const std::vector<ContourPolygons>& contourPolygons() const;
const std::vector<cvf::Vec4d>& trianglesWithVertexValues();
double sampleSpacing() const;
virtual double sampleSpacing() const = 0;
double sampleSpacingFactor() const;
void setSampleSpacingFactor( double spacingFactor );
bool showContourLines() const;
QString resultAggregationText() const;
@@ -209,7 +212,8 @@ protected:
void initAfterRead() override;
protected:
caf::PdmField<double> m_relativeSampleSpacing;
caf::PdmField<double> m_relativeSampleSpacing;
caf::PdmField<ResultAggregation> m_resultAggregation;
caf::PdmField<bool> m_showContourLines;
caf::PdmField<bool> m_showContourLabels;
@@ -224,7 +228,6 @@ protected:
cvf::Vec2ui m_mapSize;
cvf::BoundingBox m_expandedBoundingBox;
cvf::BoundingBox m_gridBoundingBox;
double m_sampleSpacing;
std::vector<ContourPolygons> m_contourPolygons;
std::vector<double> m_contourLevelCumulativeAreas;
std::vector<cvf::Vec4d> m_trianglesWithVertexValues;

View File

@@ -26,8 +26,12 @@
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseResultCase.h"
#include "RimGeoMechCase.h"
#include "RimOilField.h"
#include "RimPlot.h"
#include "RimProject.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
@@ -86,7 +90,8 @@ RimDepthTrackPlot::RimDepthTrackPlot()
m_commonDataSource.xmlCapability()->disableIO();
m_commonDataSource = new RimWellLogCurveCommonDataSource;
CAF_PDM_InitScriptableField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" );
CAF_PDM_InitScriptableField( &m_showPlotWindowTitle_OBSOLETE, "ShowTitleInPlot", false, "Show Title", "", "", "" );
m_showPlotWindowTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" );
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
@@ -120,10 +125,10 @@ RimDepthTrackPlot::RimDepthTrackPlot()
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered );
m_availableDepthUnits = {RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET};
m_availableDepthTypes = {RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB};
m_availableDepthUnits = { RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET };
m_availableDepthTypes = { RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB };
m_minAvailableDepth = HUGE_VAL;
m_maxAvailableDepth = -HUGE_VAL;
@@ -148,6 +153,46 @@ RimDepthTrackPlot::~RimDepthTrackPlot()
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
/// Move-assignment operator. Argument has to be passed with std::move()
//--------------------------------------------------------------------------------------------------
RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
// Move all tracks
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( RimPlot* plot : plots )
{
m_plots.push_back( plot );
}
// Deliberately don't set m_plotWindowTitle and m_nameConfig. This operator is used for copying parameters from
// children. This only happens for some plots that used to own a plot but now inherits the plot.
// They had their own description at top level which we don't want to overwrite.
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject( dataSource );
m_commonDataSource = dataSource;
m_commonDataSourceEnabled = rhs.m_commonDataSourceEnabled;
m_depthType = rhs.m_depthType();
m_depthUnit = rhs.m_depthUnit();
m_minVisibleDepth = rhs.m_minVisibleDepth();
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
m_subTitleFontSize = rhs.m_subTitleFontSize();
m_axisTitleFontSize = rhs.m_axisTitleFontSize();
m_axisValueFontSize = rhs.m_axisValueFontSize();
m_minAvailableDepth = rhs.m_minAvailableDepth;
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -172,68 +217,6 @@ QString RimDepthTrackPlot::description() const
return m_plotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimDepthTrackPlot::isPlotTitleVisible() const
{
return m_showPlotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::setPlotTitleVisible( bool visible )
{
m_showPlotWindowTitle = visible;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::addPlot( RimPlot* plot )
{
insertPlot( plot, m_plots.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
{
m_plots.insert( index, plot );
if ( m_viewer )
{
plot->createPlotWidget();
m_viewer->insertPlot( plot->viewer(), index );
}
plot->setShowWindow( true );
plot->setLegendsVisible( false );
onPlotAdditionOrRemoval();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::removePlot( RimPlot* plot )
{
if ( plot )
{
if ( m_viewer )
{
m_viewer->removePlot( plot->viewer() );
}
m_plots.removeChildObject( plot );
onPlotAdditionOrRemoval();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -400,6 +383,38 @@ void RimDepthTrackPlot::visibleDepthRange( double* minimumDepth, double* maximum
*maximumDepth = m_maxVisibleDepth;
}
RiaDefines::DepthUnitType RimDepthTrackPlot::caseDepthUnit() const
{
RimEclipseResultCase* thecase = dynamic_cast<RimEclipseResultCase*>( commonDataSource()->caseToApply() );
if ( thecase == nullptr )
{
// no suitable case found, look in the project to see if there is a eclipse case with units defined loaded
RimProject* p = RiaApplication::instance()->project();
for ( RimEclipseCase* aCase : p->activeOilField()->analysisModels()->cases() )
{
thecase = dynamic_cast<RimEclipseResultCase*>( aCase );
if ( thecase ) break;
}
}
if ( thecase )
{
switch ( thecase->unitSystem() )
{
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
return RiaDefines::DepthUnitType::UNIT_FEET;
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
return RiaDefines::DepthUnitType::UNIT_METER;
default:
break;
}
}
return RiaDefines::DepthUnitType::UNIT_NONE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -425,7 +440,7 @@ void RimDepthTrackPlot::uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUi
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotWindowTitle );
uiOrdering.add( &m_showPlotTitle );
m_nameConfig->uiOrdering( uiConfigName, uiOrdering );
}
@@ -559,7 +574,7 @@ void RimDepthTrackPlot::performAutoNameUpdate()
m_plotWindowTitle = createAutoName();
if ( m_viewer )
{
m_viewer->setTitleVisible( m_showPlotWindowTitle() );
m_viewer->setTitleVisible( m_showPlotTitle() );
m_viewer->setPlotTitle( m_plotWindowTitle );
}
updateMdiWindowTitle();
@@ -692,7 +707,7 @@ void RimDepthTrackPlot::onPlotAdditionOrRemoval()
calculateAvailableDepthRange();
updateZoom();
updateSubPlotNames();
updateConnectedEditors();
updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------
@@ -729,7 +744,6 @@ void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter )
recreatePlotWidgets();
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -819,14 +833,14 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
else if ( changedField == &m_depthUnit )
{
m_isAutoScaleDepthEnabled = true;
updateZoom();
onLoadDataAndUpdate();
}
else if ( changedField == &m_subTitleFontSize || changedField == &m_axisTitleFontSize ||
changedField == &m_axisValueFontSize )
{
updateFonts();
}
else if ( changedField == &m_showPlotWindowTitle )
else if ( changedField == &m_showPlotTitle )
{
performAutoNameUpdate();
}
@@ -910,11 +924,15 @@ void RimDepthTrackPlot::initAfterRead()
m_depthAxisGridVisibility = AXIS_GRID_MAJOR_AND_MINOR;
}
if ( m_showPlotWindowTitle_OBSOLETE() )
{
m_showPlotTitle = true;
}
if ( !m_plotWindowTitle().isEmpty() )
{
m_nameConfig->setCustomName( m_plotWindowTitle );
}
performAutoNameUpdate();
}
@@ -970,6 +988,42 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField()
return &m_plotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
{
m_plots.insert( index, plot );
if ( m_viewer )
{
plot->createPlotWidget();
m_viewer->insertPlot( plot->viewer(), index );
}
plot->setShowWindow( true );
onPlotAdditionOrRemoval();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::removePlot( RimPlot* plot )
{
if ( plot )
{
if ( m_viewer )
{
m_viewer->removePlot( plot->viewer() );
}
m_plots.removeChildObject( plot );
onPlotAdditionOrRemoval();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1098,6 +1152,9 @@ void RimDepthTrackPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{

View File

@@ -19,6 +19,11 @@
#pragma once
#include "RiaDefines.h"
#include "RimAbstractPlotCollection.h"
#include "RimPlotWindow.h"
#include "RimWellLogPlotNameConfig.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
@@ -26,10 +31,6 @@
#include "cafPdmFieldHandle.h"
#include "cafPdmObject.h"
#include "RiaDefines.h"
#include "RimPlotWindow.h"
#include "RimWellLogPlotNameConfig.h"
#include <QPointer>
#include <set>
@@ -43,7 +44,7 @@ class QKeyEvent;
///
///
//==================================================================================================
class RimDepthTrackPlot : public RimPlotWindow, public RimNameConfigHolderInterface
class RimDepthTrackPlot : public RimTypedPlotCollection<RimPlot>, public RimPlotWindow, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;
@@ -63,23 +64,20 @@ public:
RimDepthTrackPlot();
~RimDepthTrackPlot() override;
RimDepthTrackPlot& operator=( RimDepthTrackPlot&& rhs );
QWidget* viewWidget() override;
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
QString description() const override;
bool isPlotTitleVisible() const;
void setPlotTitleVisible( bool visible );
void addPlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index );
void removePlot( RimPlot* plot );
size_t plotCount() const;
size_t plotCount() const override;
size_t plotIndex( const RimPlot* plot ) const;
RimPlot* plotByIndex( size_t index ) const;
std::vector<RimPlot*> plots() const;
std::vector<RimPlot*> plots() const override;
std::vector<RimPlot*> visiblePlots() const;
void insertPlot( RimPlot* plot, size_t index ) final;
void removePlot( RimPlot* plot ) final;
DepthTypeEnum depthType() const;
void setDepthType( DepthTypeEnum depthType );
@@ -127,6 +125,8 @@ public:
int axisTitleFontSize() const;
int axisValueFontSize() const;
RiaDefines::DepthUnitType caseDepthUnit() const;
protected:
QImage snapshotWindowContent() override;
@@ -155,13 +155,13 @@ private:
void onPlotAdditionOrRemoval();
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
void doUpdateLayout() override;
void onPlotsReordered( const SignalEmitter* emitter );
void onPlotsReordered( const caf::SignalEmitter* emitter );
protected:
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
bool m_commonDataSourceEnabled;
caf::PdmField<bool> m_showPlotWindowTitle;
caf::PdmField<bool> m_showPlotWindowTitle_OBSOLETE;
caf::PdmField<QString> m_plotWindowTitle;
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;

View File

@@ -147,6 +147,18 @@ void RimEclipseContourMapProjection::updateLegend()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimEclipseContourMapProjection::sampleSpacing() const
{
if ( m_mainGrid.notNull() )
{
return m_relativeSampleSpacing * m_mainGrid->characteristicIJCellSize();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -324,8 +336,8 @@ std::vector<double> RimEclipseContourMapProjection::calculateColumnResult( Resul
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapProjection::updateGridInformation()
{
m_mainGrid = eclipseCase()->eclipseCaseData()->mainGrid();
m_sampleSpacing = m_relativeSampleSpacing * m_mainGrid->characteristicIJCellSize();
m_mainGrid = eclipseCase()->eclipseCaseData()->mainGrid();
m_gridBoundingBox = eclipseCase()->activeCellsBoundingBox();
cvf::Vec3d minExpandedPoint = m_gridBoundingBox.min() - cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
cvf::Vec3d maxExpandedPoint = m_gridBoundingBox.max() + cvf::Vec3d( gridEdgeOffset(), gridEdgeOffset(), 0.0 );
@@ -336,8 +348,8 @@ void RimEclipseContourMapProjection::updateGridInformation()
// Re-jig max point to be an exact multiple of cell size
cvf::Vec3d minPoint = m_expandedBoundingBox.min();
cvf::Vec3d maxPoint = m_expandedBoundingBox.max();
maxPoint.x() = minPoint.x() + m_mapSize.x() * m_sampleSpacing;
maxPoint.y() = minPoint.y() + m_mapSize.y() * m_sampleSpacing;
maxPoint.x() = minPoint.x() + m_mapSize.x() * sampleSpacing();
maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing();
m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint );
}

View File

@@ -58,6 +58,8 @@ public:
RimRegularLegendConfig* legendConfig() const override;
void updateLegend() override;
double sampleSpacing() const override;
protected:
typedef RimContourMapProjection::CellIndexAndResult CellIndexAndResult;

View File

@@ -315,6 +315,14 @@ bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEc
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaEclipseUnitTools::UnitSystemType RimEclipseResultCase::unitSystem()
{
return m_unitSystem();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -61,6 +61,8 @@ public:
bool openAndReadActiveCellData( RigEclipseCaseData* mainEclipseCase );
void readGridDimensions( std::vector<std::vector<int>>& gridDimensions );
RiaEclipseUnitTools::UnitSystemType unitSystem();
// Overrides from RimCase
QString locationOnDisc() const override;
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;

View File

@@ -703,9 +703,11 @@ void RimExtrudedCurveIntersection::setPushButtonText( bool buttonEnable, caf::Pd
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute )
{
if ( attribute && enable )
// if ( attribute && enable )
if ( attribute )
{
attribute->m_baseColor.setRgb( 255, 220, 255 );
attribute->m_qssState = enable ? "ExternalInput" : QString();
// attribute->m_baseColor.setRgb( 255, 220, 255 );
}
}

View File

@@ -379,10 +379,23 @@ std::vector<double> RimFractureModelPlot::calculateStress() const
{
std::vector<double> stress;
std::vector<double> stressGradients;
calculateStressWithGradients( stress, stressGradients );
std::vector<double> initialStress;
calculateStressWithGradients( stress, stressGradients, initialStress );
return stress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimFractureModelPlot::calculateInitialStress() const
{
std::vector<double> stress;
std::vector<double> stressGradients;
std::vector<double> initialStress;
calculateStressWithGradients( stress, stressGradients, initialStress );
return initialStress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -402,7 +415,8 @@ std::vector<double> RimFractureModelPlot::findCurveXValuesByProperty( RiaDefines
///
//--------------------------------------------------------------------------------------------------
bool RimFractureModelPlot::calculateStressWithGradients( std::vector<double>& stress,
std::vector<double>& stressGradients ) const
std::vector<double>& stressGradients,
std::vector<double>& initialStress ) const
{
// Reference stress
const double verticalStressRef = m_fractureModel->verticalStress();
@@ -468,6 +482,8 @@ bool RimFractureModelPlot::calculateStressWithGradients( std::vector<double>& st
double depletionStress = Sh_init + deltaHorizontalStress;
stress.push_back( RiaEclipseUnitTools::barToPsi( depletionStress ) );
initialStress.push_back( RiaEclipseUnitTools::barToPsi( Sh_init ) );
// Cache some results for the gradients calculation
stressForGradients.push_back( Sv );
pressureForGradients.push_back( initialPressure );
@@ -493,12 +509,12 @@ bool RimFractureModelPlot::calculateStressWithGradients( std::vector<double>& st
// Second pass to calculate the stress gradients
for ( size_t i = 0; i < layerBoundaryDepths.size(); i++ )
{
double diffStress = stressForGradients[i + 1] - stressForGradients[i];
double diffPressure = pressureForGradients[i + 1] - pressureForGradients[i];
double diffDepth = depthForGradients[i + 1] - depthForGradients[i];
double k0 = findValueAtTopOfLayer( k0Data, layerBoundaryIndexes, i );
double gradient = ( diffStress * k0 + diffPressure * ( 1.0 - k0 ) ) / diffDepth;
stressGradients.push_back( RiaEclipseUnitTools::barPerMeterToPsiPerFeet( gradient ) );
double diffStress = stressForGradients[i + 1] - stressForGradients[i];
double diffPressure = pressureForGradients[i + 1] - pressureForGradients[i];
double diffDepth = depthForGradients[i + 1] - depthForGradients[i];
double k0 = findValueAtTopOfLayer( k0Data, layerBoundaryIndexes, i );
double stressGradient = ( diffStress * k0 + diffPressure * ( 1.0 - k0 ) ) / diffDepth;
stressGradients.push_back( RiaEclipseUnitTools::barPerMeterToPsiPerFeet( stressGradient ) );
}
return true;
@@ -511,7 +527,8 @@ std::vector<double> RimFractureModelPlot::calculateStressGradient() const
{
std::vector<double> stress;
std::vector<double> stressGradients;
calculateStressWithGradients( stress, stressGradients );
std::vector<double> initialStress;
calculateStressWithGradients( stress, stressGradients, initialStress );
return stressGradients;
}

View File

@@ -34,26 +34,6 @@ class RimFractureModelPlot : public RimDepthTrackPlot
CAF_PDM_HEADER_INIT;
public:
enum class PropertyType
{
FACIES,
LAYERS,
POROSITY,
PERMEABILITY_X,
PERMEABILITY_Z,
INITIAL_PRESSURE,
PRESSURE,
STRESS,
STRESS_GRADIENT,
YOUNGS_MODULUS,
POISSONS_RATIO,
K_IC,
PROPPANT_EMBEDMENT,
BIOT_COEFFICIENT,
K0,
FLUID_LOSS_COEFFICIENT,
};
RimFractureModelPlot();
void setFractureModel( RimFractureModel* fractureModel );
@@ -69,6 +49,7 @@ public:
std::vector<double> calculateHorizontalPermeability() const;
std::vector<double> calculateReservoirPressure() const;
std::vector<double> calculateStress() const;
std::vector<double> calculateInitialStress() const;
std::vector<double> calculateStressGradient() const;
std::vector<double> calculateYoungsModulus() const;
std::vector<double> calculatePoissonsRatio() const;
@@ -93,7 +74,9 @@ protected:
void calculateLayers( std::vector<std::pair<double, double>>& layerBoundaryDepths,
std::vector<std::pair<size_t, size_t>>& layerBoundaryIndexes ) const;
RimWellLogExtractionCurve* findCurveByProperty( RiaDefines::CurveProperty curveProperty ) const;
bool calculateStressWithGradients( std::vector<double>& stress, std::vector<double>& stressGradients ) const;
bool calculateStressWithGradients( std::vector<double>& stress,
std::vector<double>& stressGradients,
std::vector<double>& initialStress ) const;
static double findValueAtTopOfLayer( const std::vector<double>& values,
const std::vector<std::pair<size_t, size_t>>& layerBoundaryIndexes,

View File

@@ -128,6 +128,12 @@ void RimFractureModelStressCurve::performDataExtraction( bool* isUsingPseudoLeng
std::vector<double> stressGradients = fractureModelPlot->calculateStressGradient();
addDatapointsForBottomOfLayers( tvDepthValues, values, stressGradients );
}
else if ( m_curveProperty() == RiaDefines::CurveProperty::INITIAL_STRESS )
{
values = fractureModelPlot->calculateInitialStress();
std::vector<double> stressGradients = fractureModelPlot->calculateStressGradient();
addDatapointsForBottomOfLayers( tvDepthValues, values, stressGradients );
}
else if ( m_curveProperty() == RiaDefines::CurveProperty::STRESS_GRADIENT )
{
values = fractureModelPlot->calculateStressGradient();

View File

@@ -41,12 +41,6 @@ class RimFractureModelStressCurve : public RimWellLogExtractionCurve, public Rim
CAF_PDM_HEADER_INIT;
public:
enum class PropertyType
{
STRESS,
STRESS_GRADIENT
};
RimFractureModelStressCurve();
~RimFractureModelStressCurve() override;

View File

@@ -130,6 +130,19 @@ void RimGeoMechContourMapProjection::updateLegend()
legendConfig()->setTitle( projectionLegendText );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimGeoMechContourMapProjection::sampleSpacing() const
{
RimGeoMechCase* geoMechCase = this->geoMechCase();
if ( geoMechCase )
{
return m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -205,7 +218,6 @@ void RimGeoMechContourMapProjection::updateGridInformation()
RimGeoMechCase* geoMechCase = this->geoMechCase();
m_femPart = geoMechCase->geoMechData()->femParts()->part( 0 );
m_femPartGrid = m_femPart->getOrCreateStructGrid();
m_sampleSpacing = m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
m_femPart->ensureIntersectionSearchTreeIsBuilt();
m_gridBoundingBox = geoMechCase->activeCellsBoundingBox();
@@ -232,8 +244,8 @@ void RimGeoMechContourMapProjection::updateGridInformation()
// Re-jig max point to be an exact multiple of cell size
cvf::Vec3d minPoint = m_expandedBoundingBox.min();
cvf::Vec3d maxPoint = m_expandedBoundingBox.max();
maxPoint.x() = minPoint.x() + m_mapSize.x() * m_sampleSpacing;
maxPoint.y() = minPoint.y() + m_mapSize.y() * m_sampleSpacing;
maxPoint.x() = minPoint.x() + m_mapSize.x() * sampleSpacing();
maxPoint.y() = minPoint.y() + m_mapSize.y() * sampleSpacing();
m_expandedBoundingBox = cvf::BoundingBox( minPoint, maxPoint );
}
@@ -281,7 +293,7 @@ std::vector<bool> RimGeoMechContourMapProjection::getMapCellVisibility()
cvf::Vec3d porExtent = validResBoundingBox.extent();
double radius = std::max( porExtent.x(), porExtent.y() ) * 0.25;
double expansion = m_paddingAroundPorePressureRegion * radius;
size_t cellPadding = std::ceil( expansion / m_sampleSpacing );
size_t cellPadding = std::ceil( expansion / sampleSpacing() );
for ( size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex )
{
if ( !mapCellVisibility[cellIndex] )
@@ -583,13 +595,13 @@ QList<caf::PdmOptionItemInfo>
if ( fieldNeedingOptions == &m_resultAggregation )
{
std::vector<ResultAggregationEnum> validOptions = {RESULTS_TOP_VALUE,
RESULTS_MEAN_VALUE,
RESULTS_GEOM_VALUE,
RESULTS_HARM_VALUE,
RESULTS_MIN_VALUE,
RESULTS_MAX_VALUE,
RESULTS_SUM};
std::vector<ResultAggregationEnum> validOptions = { RESULTS_TOP_VALUE,
RESULTS_MEAN_VALUE,
RESULTS_GEOM_VALUE,
RESULTS_HARM_VALUE,
RESULTS_MIN_VALUE,
RESULTS_MAX_VALUE,
RESULTS_SUM };
for ( ResultAggregationEnum option : validOptions )
{

View File

@@ -56,6 +56,8 @@ public:
RimRegularLegendConfig* legendConfig() const override;
void updateLegend() override;
double sampleSpacing() const override;
protected:
typedef RimContourMapProjection::CellIndexAndResult CellIndexAndResult;

View File

@@ -551,7 +551,7 @@ void RimGridView::updateSurfacesInViewTreeItems()
RimProject* proj = RimProject::current();
RimSurfaceCollection* surfColl = proj->activeOilField()->surfaceCollection();
if ( surfColl && surfColl->surfaces().size() )
if ( surfColl && surfColl->containsSurface() )
{
if ( !m_surfaceCollection() )
{

View File

@@ -240,14 +240,14 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
m_rftPlotCollection()->deleteAllPlots();
m_pltPlotCollection()->deleteAllPlots();
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
m_summaryCrossPlotCollection()->deleteAllChildObjects();
m_gridCrossPlotCollection->deleteAllChildObjects();
m_summaryPlotCollection()->deleteAllPlots();
m_summaryCrossPlotCollection()->deleteAllPlots();
m_gridCrossPlotCollection->deleteAllPlots();
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
m_saturationPressurePlotCollection()->deleteAllChildObjects();
m_multiPlotCollection()->deleteAllChildObjects();
m_analysisPlotCollection()->deleteAllChildObjects();
m_correlationPlotCollection()->deleteAllChildObjects();
m_analysisPlotCollection()->deleteAllPlots();
m_correlationPlotCollection()->deleteAllPlots();
m_fractureModelPlotCollection()->deleteAllPlots();
}
@@ -295,7 +295,7 @@ void RimMainPlotCollection::updatePlotsWithFormations()
if ( m_gridCrossPlotCollection )
{
for ( RimGridCrossPlot* crossPlot : m_gridCrossPlotCollection->gridCrossPlots() )
for ( RimGridCrossPlot* crossPlot : m_gridCrossPlotCollection->plots() )
{
crossPlot->loadDataAndUpdate();
}

View File

@@ -28,6 +28,7 @@
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "cafPdmFieldReorderCapability.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiToolButtonEditor.h"
@@ -74,6 +75,8 @@ RimMultiPlot::RimMultiPlot()
CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" );
m_plots.uiCapability()->setUiHidden( true );
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
reorderability->orderChanged.connect( this, &RimMultiPlot::onPlotsReordered );
CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page", "", "", "" );
@@ -180,14 +183,6 @@ void RimMultiPlot::setMultiPlotTitle( const QString& title )
m_plotWindowTitle = title;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::addPlot( RimPlot* plot )
{
insertPlot( plot, m_plots.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -479,11 +474,32 @@ void RimMultiPlot::onPlotAdditionOrRemoval()
updateSubPlotNames();
updatePlotWindowTitle();
applyPlotWindowTitleToWidgets();
updateConnectedEditors();
updateAllRequiredEditors();
updateLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::onPlotsReordered( const caf::SignalEmitter* emitter )
{
updateSubPlotNames();
recreatePlotWidgets();
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
updateSubPlotNames();
recreatePlotWidgets();
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -704,6 +720,7 @@ void RimMultiPlot::onLoadDataAndUpdate()
applyPlotWindowTitleToWidgets();
updatePlots();
updateLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
@@ -760,6 +777,8 @@ void RimMultiPlot::recreatePlotWidgets()
{
CVF_ASSERT( m_viewer );
m_viewer->removeAllPlots();
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )

View File

@@ -18,6 +18,7 @@
#pragma once
#include "RimAbstractPlotCollection.h"
#include "RimPlotAxisPropertiesInterface.h"
#include "RimPlotWindow.h"
@@ -37,7 +38,7 @@
class RimPlot;
class RimMultiPlot : public RimPlotWindow
class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection<RimPlot>
{
CAF_PDM_HEADER_INIT;
@@ -69,16 +70,15 @@ public:
QString multiPlotTitle() const;
void setMultiPlotTitle( const QString& title );
void addPlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index );
void removePlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index ) override;
void removePlot( RimPlot* plot ) override;
void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition );
size_t plotCount() const;
size_t plotCount() const override;
size_t plotIndex( const RimPlot* plot ) const;
RimPlot* plotByIndex( size_t index ) const;
std::vector<RimPlot*> plots() const;
std::vector<RimPlot*> plots() const override;
std::vector<RimPlot*> visiblePlots() const;
void updatePlotOrderFromGridWidget();
@@ -135,6 +135,9 @@ private:
void updatePlotWindowTitle();
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
void onPlotAdditionOrRemoval();
void onPlotsReordered( const caf::SignalEmitter* emitter );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
protected:
caf::PdmField<bool> m_showPlotWindowTitle;

View File

@@ -1,6 +1,8 @@
#include "RimPlot.h"
#include "RicfCommandObject.h"
#include "RimAbstractPlotCollection.h"
#include "RimMultiPlot.h"
#include "RimPlotCurve.h"
#include "RimPlotWindow.h"
@@ -124,7 +126,13 @@ void RimPlot::removeFromMdiAreaAndCollection()
{
revokeMdiWindowStatus();
}
doRemoveFromCollection();
RimAbstractPlotCollection* plotCollection = nullptr;
this->firstAncestorOfType( plotCollection );
if ( plotCollection )
{
plotCollection->removeRimPlot( this );
}
}
//--------------------------------------------------------------------------------------------------
@@ -132,9 +140,10 @@ void RimPlot::removeFromMdiAreaAndCollection()
//--------------------------------------------------------------------------------------------------
void RimPlot::updateAfterInsertingIntoMultiPlot()
{
updateLegend();
updateAxes();
updateLayout();
loadDataAndUpdate();
/* updateLegend();
updateAxes();
updateLayout(); */
}
//--------------------------------------------------------------------------------------------------

View File

@@ -91,6 +91,14 @@ public:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
template <typename PlotWindowType = RimPlotWindow>
bool isSubPlot() const
{
PlotWindowType* parentPlotWindow = nullptr;
firstAncestorOfType( parentPlotWindow );
return parentPlotWindow != nullptr;
}
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
@@ -101,7 +109,6 @@ protected:
void updateFonts() override;
private:
virtual void doRemoveFromCollection() = 0;
virtual void doRenderWindowContent( QPaintDevice* paintDevice ) override;
virtual void handleKeyPressEvent( QKeyEvent* event ) {}
virtual void handleWheelEvent( QWheelEvent* event ) {}

View File

@@ -141,7 +141,7 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" );
CAF_PDM_InitField( &m_curveColor, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
CAF_PDM_InitField( &m_curveColor, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
CAF_PDM_InitField( &m_fillColor, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color", "", "", "" );
CAF_PDM_InitField( &m_curveThickness, "Thickness", 1, "Line Thickness", "", "", "" );
@@ -151,7 +151,7 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitFieldNoDefault( &m_lineStyle, "LineStyle", "Line Style", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_fillStyle, "FillStyle", "Area Fill Style", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_pointSymbol, "PointSymbol", "Symbol", "", "", "" );
CAF_PDM_InitField( &m_symbolEdgeColor, "SymbolEdgeColor", cvf::Color3f( cvf::Color3::BLACK ), "Symbol Edge Color", "", "", "" );
CAF_PDM_InitField( &m_symbolEdgeColor, "SymbolEdgeColor", RiaColorTools::textColor3f(), "Symbol Edge Color", "", "", "" );
CAF_PDM_InitField( &m_symbolSkipPixelDistance,
"SymbolSkipPxDist",
@@ -301,6 +301,14 @@ void RimPlotCurve::setLegendEntryText( const QString& legendEntryText )
m_legendEntryText = legendEntryText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setErrorBarsVisible( bool isVisible )
{
m_showErrorBars = isVisible;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -991,8 +999,8 @@ void RimPlotCurve::setLineThickness( int thickness )
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::resetAppearance()
{
setColor( cvf::Color3f( cvf::Color3::BLACK ) );
setSymbolEdgeColor( cvf::Color3f( cvf::Color3::BLACK ) );
setColor( RiaColorTools::textColor3f() );
setSymbolEdgeColor( RiaColorTools::textColor3f() );
setLineThickness( 2 );
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
setSymbol( RiuQwtSymbol::SYMBOL_NONE );

View File

@@ -115,6 +115,8 @@ public:
void setZOrder( double z );
void setErrorBarsVisible( bool isVisible );
virtual void updateCurveAppearance();
bool isCrossPlotCurve() const;
void updateUiIconFromPlotSymbol();

View File

@@ -52,6 +52,7 @@ RimPlotWindow::RimPlotWindow()
m_id.capability<caf::PdmAbstractFieldScriptingCapability>()->setIOWriteable( false );
m_id.xmlCapability()->setCopyable( false );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
@@ -83,6 +84,7 @@ int RimPlotWindow::id() const
//--------------------------------------------------------------------------------------------------
RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
{
m_showPlotTitle = rhs.m_showPlotTitle();
m_showPlotLegends = rhs.m_showPlotLegends();
m_plotLegendsHorizontal = rhs.m_plotLegendsHorizontal();
m_titleFontSize = rhs.m_titleFontSize();
@@ -90,6 +92,22 @@ RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotWindow::plotTitleVisible() const
{
return m_showPlotTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setPlotTitleVisible( bool showPlotTitle )
{
m_showPlotTitle = showPlotTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -50,6 +50,9 @@ public:
RimPlotWindow& operator=( RimPlotWindow&& rhs );
bool plotTitleVisible() const;
void setPlotTitleVisible( bool showPlotTitle );
virtual QString description() const = 0;
bool legendsVisible() const;
void setLegendsVisible( bool doShow );
@@ -94,6 +97,7 @@ private:
protected:
caf::PdmField<int> m_id;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_showPlotLegends;
caf::PdmField<bool> m_plotLegendsHorizontal;

View File

@@ -223,8 +223,8 @@ void RimPltPlotCollection::addPlot( RimWellPltPlot* newPlot )
//--------------------------------------------------------------------------------------------------
void RimPltPlotCollection::removePlot( RimWellPltPlot* plot )
{
size_t index = m_pltPlots.index( plot );
if ( index < m_pltPlots.size() ) m_pltPlots.erase( index );
m_pltPlots.removeChildObject( plot );
updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -159,7 +159,7 @@ void RimReloadCaseTools::updateAllPlots()
RimSummaryPlotCollection* summaryPlotCollection = project->mainPlotCollection()->summaryPlotCollection();
if ( summaryPlotCollection )
{
for ( RimSummaryPlot* summaryPlot : summaryPlotCollection->summaryPlots() )
for ( RimSummaryPlot* summaryPlot : summaryPlotCollection->plots() )
{
summaryPlot->loadDataAndUpdate();
}
@@ -168,7 +168,7 @@ void RimReloadCaseTools::updateAllPlots()
RimGridCrossPlotCollection* gridCrossPlotCollection = project->mainPlotCollection()->gridCrossPlotCollection();
if ( gridCrossPlotCollection )
{
for ( RimGridCrossPlot* crossPlot : gridCrossPlotCollection->gridCrossPlots() )
for ( RimGridCrossPlot* crossPlot : gridCrossPlotCollection->plots() )
{
crossPlot->loadDataAndUpdate();
}

View File

@@ -223,8 +223,8 @@ void RimRftPlotCollection::addPlot( RimWellRftPlot* newPlot )
//--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::removePlot( RimWellRftPlot* plot )
{
size_t index = m_rftPlots.index( plot );
if ( index < m_rftPlots.size() ) m_rftPlots.erase( index );
m_rftPlots.removeChildObject( plot );
updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -475,7 +475,7 @@ void RimSummaryCalculation::updateDependentCurvesAndPlots()
calcColl->rebuildCaseMetaData();
RimSummaryPlotCollection* summaryPlotCollection = RiaSummaryTools::summaryPlotCollection();
for ( RimSummaryPlot* sumPlot : summaryPlotCollection->summaryPlots() )
for ( RimSummaryPlot* sumPlot : summaryPlotCollection->plots() )
{
bool plotContainsCalculatedCurves = false;

View File

@@ -93,6 +93,7 @@ void RimViewWindow::loadDataAndUpdate()
{
assignIdIfNecessary();
onLoadDataAndUpdate();
updateUiIconFromToggleField();
}
//--------------------------------------------------------------------------------------------------
@@ -336,12 +337,12 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() && id() >= 0 )
{
treeItemAttribute->tags.clear();
caf::PdmUiTreeViewItemAttribute::Tag tag;
tag.text = QString( "%1" ).arg( id() );
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
tag->text = QString( "%1" ).arg( id() );
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
tag.bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
tag.fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );
treeItemAttribute->tags.push_back( tag );
tag->bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
tag->fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );
treeItemAttribute->tags.push_back( std::move( tag ) );
}
}

View File

@@ -178,8 +178,6 @@ void RimWellLogExtractionCurve::setFromSimulationWellName( const QString& simWel
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setCase( RimCase* rimCase )
{
disconnectCaseSignals( m_case.value() );
m_case = rimCase;
connectCaseSignals( rimCase );
@@ -201,7 +199,6 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
{
if ( view )
{
disconnectCaseSignals( m_case.value() );
m_case = view->ownerCase();
connectCaseSignals( m_case );
}
@@ -1121,17 +1118,6 @@ void RimWellLogExtractionCurve::connectCaseSignals( RimCase* rimCase )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::disconnectCaseSignals( RimCase* rimCase )
{
if ( rimCase != nullptr )
{
rimCase->settingsChanged.disconnect( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -98,7 +98,6 @@ protected:
void onLoadDataAndUpdate( bool updateParentPlot ) override;
void onCaseSettingsChanged( const caf::SignalEmitter* emitter );
void connectCaseSignals( RimCase* rimCase );
void disconnectCaseSignals( RimCase* rimCase );
virtual void performDataExtraction( bool* isUsingPseudoLength );
void extractData( bool* isUsingPseudoLength, bool performDataSmoothing = false, double smoothingThreshold = -1.0 );

View File

@@ -76,38 +76,6 @@ RimWellLogPlot::~RimWellLogPlot()
//--------------------------------------------------------------------------------------------------
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
// Move all tracks
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( RimPlot* plot : plots )
{
m_plots.push_back( plot );
}
// Deliberately don't set m_plotWindowTitle. This operator is used for copying parameters from children.
// This only happens for some plots that used to own a plot but now inherits the plot.
// These all had their own description at top level which we don't want to overwrite.
m_showPlotWindowTitle = rhs.m_showPlotWindowTitle;
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject( dataSource );
m_commonDataSource = dataSource;
m_depthType = rhs.m_depthType();
m_depthUnit = rhs.m_depthUnit();
m_minVisibleDepth = rhs.m_minVisibleDepth();
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
// Deliberately don't copy m_nameConfig. This operator is used for copying parameters from children.
// This only happens for some plots that used to own a plot but now inherits the plot.
// These all had their own description at top level which we don't want to overwrite.
m_minAvailableDepth = rhs.m_minAvailableDepth;
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
RimDepthTrackPlot::operator=( std::move( rhs ) );
return *this;
}

View File

@@ -518,19 +518,6 @@ int RimWellLogTrack::axisFontSize() const
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisFontSize() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::doRemoveFromCollection()
{
RimDepthTrackPlot* wellLogPlot = nullptr;
this->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot )
{
wellLogPlot->removePlot( this );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1112,7 +1099,6 @@ void RimWellLogTrack::removeCurve( RimWellLogCurve* curve )
{
m_curves[index]->detachQwtCurve();
m_curves.removeChildObject( curve );
disconnectCurveSignals( curve );
}
}
@@ -2045,17 +2031,6 @@ void RimWellLogTrack::connectCurveSignals( RimWellLogCurve* curve )
curve->stackingChanged.connect( this, &RimWellLogTrack::curveStackingChanged );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::disconnectCurveSignals( RimWellLogCurve* curve )
{
curve->dataChanged.disconnect( this );
curve->visibilityChanged.disconnect( this );
curve->appearanceChanged.disconnect( this );
curve->stackingChanged.disconnect( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2514,6 +2489,9 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
RimDepthTrackPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
RiaDefines::DepthUnitType fromDepthUnit = plot->caseDepthUnit();
RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit();
if ( m_formationSource() == WELL_PICK_FILTER )
{
if ( m_formationWellPathForSourceWellPath == nullptr ) return;
@@ -2545,7 +2523,10 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
}
}
m_annotationTool->attachWellPicks( m_plotWidget, formationNamesToPlot, yValues );
std::vector<double> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
m_annotationTool->attachWellPicks( m_plotWidget, formationNamesToPlot, convertedYValues );
}
else
{
@@ -2612,10 +2593,14 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
const caf::ColorTable waterAndRockColors = RiaColorTables::waterAndRockPaletteColors();
const std::vector<std::pair<double, double>> waterAndRockIntervals =
waterAndRockRegions( plot->depthType(), extractor );
const std::vector<std::pair<double, double>> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( waterAndRockIntervals, fromDepthUnit, toDepthUnit );
m_annotationTool->attachNamedRegions( m_plotWidget,
{"Sea Level", ""},
xRange,
waterAndRockIntervals,
convertedYValues,
m_regionAnnotationDisplay(),
waterAndRockColors,
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
@@ -2653,11 +2638,14 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
const std::pair<double, double> xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() );
std::vector<std::pair<double, double>> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
caf::ColorTable colorTable( m_colorShadingLegend->colorArray() );
m_annotationTool->attachNamedRegions( m_plotWidget,
formationNamesToPlot,
xRange,
yValues,
convertedYValues,
m_regionAnnotationDisplay(),
colorTable,
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
@@ -2674,6 +2662,9 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
RimDepthTrackPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
RiaDefines::DepthUnitType fromDepthUnit = plot->caseDepthUnit();
RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit();
RigEclipseWellLogExtractor* eclWellLogExtractor =
RiaExtractionTools::wellLogExtractorEclipseCase( m_formationWellPathForSourceCase,
dynamic_cast<RimEclipseCase*>( m_formationCase() ) );
@@ -2730,6 +2721,10 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
std::vector<std::pair<double, double>> yValues;
RimWellLogTrack::findRegionNamesToPlot( curveData, namesVector, plot->depthType(), &namesToPlot, &yValues );
// convert to plot depth unit
std::vector<std::pair<double, double>> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
// TODO: unecessarily messy!
// Need to map colors to names (since a category can be used several times)
for ( QString nameToPlot : namesToPlot )
@@ -2751,7 +2746,7 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
m_annotationTool->attachNamedRegions( m_plotWidget,
namesToPlot,
xRange,
yValues,
convertedYValues,
m_regionAnnotationDisplay(),
colorTable,
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
@@ -2768,6 +2763,9 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
this->firstAncestorOrThisOfType( wellBoreStabilityPlot );
if ( wellBoreStabilityPlot )
{
RiaDefines::DepthUnitType fromDepthUnit = wellBoreStabilityPlot->caseDepthUnit();
RiaDefines::DepthUnitType toDepthUnit = wellBoreStabilityPlot->depthUnit();
wellBoreStabilityPlot->updateCommonDataSource();
RimGeoMechCase* geoMechCase =
dynamic_cast<RimGeoMechCase*>( wellBoreStabilityPlot->commonDataSource()->caseToApply() );
@@ -2814,10 +2812,15 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
// convert to plot depth unit
std::vector<std::pair<double, double>> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
m_annotationTool->attachNamedRegions( m_plotWidget,
sourceNamesToPlot,
xRange,
yValues,
convertedYValues,
m_regionAnnotationDisplay(),
colorTable,
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
@@ -2840,10 +2843,15 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
// convert to plot depth unit
std::vector<std::pair<double, double>> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
m_annotationTool->attachNamedRegions( m_plotWidget,
sourceNamesToPlot,
xRange,
yValues,
convertedYValues,
m_regionAnnotationDisplay(),
colorTable,
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,
@@ -2865,10 +2873,15 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
// convert to plot depth unit
std::vector<std::pair<double, double>> convertedYValues =
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
m_annotationTool->attachNamedRegions( m_plotWidget,
sourceNamesToPlot,
xRange,
yValues,
convertedYValues,
m_regionAnnotationDisplay(),
colorTable,
( ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100 ) / 3,

View File

@@ -247,8 +247,6 @@ private:
int axisFontSize() const;
void doRemoveFromCollection() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void curveDataChanged( const caf::SignalEmitter* emitter );
void curveVisibilityChanged( const caf::SignalEmitter* emitter, bool visible );
@@ -299,7 +297,6 @@ private:
const RigWellLogExtractor* extractor ) const;
void connectCurveSignals( RimWellLogCurve* curve );
void disconnectCurveSignals( RimWellLogCurve* curve );
private:
QString m_xAxisTitle;

View File

@@ -34,13 +34,14 @@
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimFractureModel.h"
#include "RimFractureModelCollection.h"
#include "RimOilField.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
@@ -143,10 +144,14 @@ void RimWellPathCollection::loadDataAndUpdate()
{
caf::ProgressInfo progress( wellPaths.size(), "Reading well paths from file" );
for ( size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++ )
readWellPathFormationFiles();
for ( RimWellPath* wellPath : wellPaths() )
{
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPaths[wpIdx] );
RimModeledWellPath* mWPath = dynamic_cast<RimModeledWellPath*>( wellPaths[wpIdx] );
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPath );
RimModeledWellPath* mWPath = dynamic_cast<RimModeledWellPath*>( wellPath );
if ( fWPath )
{
if ( !fWPath->filePath().isEmpty() )
@@ -157,8 +162,15 @@ void RimWellPathCollection::loadDataAndUpdate()
RiaLogging::warning( errorMessage );
}
}
}
else if ( mWPath )
{
mWPath->createWellPathGeometry();
}
for ( RimWellLogFile* const wellLogFile : fWPath->wellLogFiles() )
if ( wellPath )
{
for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
{
if ( wellLogFile )
{
@@ -169,13 +181,16 @@ void RimWellPathCollection::loadDataAndUpdate()
}
}
}
}
else if ( mWPath )
{
mWPath->createWellPathGeometry();
}
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPaths[wpIdx]->name() ) );
RimFractureModelCollection* fractureModelCollection = wellPath->fractureModelCollection();
if ( fractureModelCollection )
{
for ( RimFractureModel* fractureModel : fractureModelCollection->allFractureModels() )
{
fractureModel->loadDataAndUpdate();
}
}
}
progress.incrementProgress();
}

View File

@@ -235,6 +235,11 @@ std::pair<std::vector<time_t>, std::vector<double>>
reader1->values( address, &values1 );
reader2->values( address, &values2 );
if ( values1.empty() && values2.empty() )
{
return ResultPair();
}
merger.addCurveData( reader1->timeSteps( address ), values1 );
merger.addCurveData( reader2->timeSteps( address ), values2 );
merger.computeInterpolatedValues();

View File

@@ -18,9 +18,9 @@
#include "RimEnsembleCurveSet.h"
#include "RiaColorTools.h"
#include "RiaGuiApplication.h"
#include "RiaStatisticsTools.h"
#include "RiuAbstractLegendFrame.h"
#include "SummaryPlotCommands/RicSummaryPlotEditorUi.h"
@@ -46,6 +46,7 @@
#include "RimSummaryFilter.h"
#include "RimSummaryPlot.h"
#include "RiuAbstractLegendFrame.h"
#include "RiuCvfOverlayItemWidget.h"
#include "RiuDraggableOverlayFrame.h"
#include "RiuPlotMainWindow.h"
@@ -115,7 +116,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum<ColorMode>( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" );
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
@@ -930,6 +931,8 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
{
if ( isCurvesVisible() )
{
std::vector<RimSummaryCurve*> newSummaryCurves;
for ( auto& sumCase : sumCases )
{
RimSummaryCurve* curve = new RimSummaryCurve();
@@ -940,12 +943,23 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
addCurve( curve );
curve->updateCurveVisibility();
curve->loadDataAndUpdate( false );
curve->updateQwtPlotAxis();
if ( curve->qwtPlotCurve() )
newSummaryCurves.push_back( curve );
}
#pragma omp parallel for
for ( int i = 0; i < (int)newSummaryCurves.size(); ++i )
{
newSummaryCurves[i]->valuesX();
}
for ( int i = 0; i < (int)newSummaryCurves.size(); ++i )
{
newSummaryCurves[i]->loadDataAndUpdate( false );
newSummaryCurves[i]->updateQwtPlotAxis();
if ( newSummaryCurves[i]->qwtPlotCurve() )
{
curve->qwtPlotCurve()->setItemAttribute( QwtPlotItem::Legend, false );
newSummaryCurves[i]->qwtPlotCurve()->setItemAttribute( QwtPlotItem::Legend, false );
}
}
@@ -954,7 +968,7 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
if ( plot->viewer() )
{
plot->viewer()->updateLegend();
if ( plot->legendsVisible() ) plot->viewer()->updateLegend();
plot->viewer()->scheduleReplot();
plot->updateAxes();
plot->updatePlotInfoLabel();
@@ -1020,7 +1034,6 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
curve->setParentQwtPlotNoReplot( plot->viewer() );
m_curves.push_back( curve );
curve->setColor( m_statistics->color() );
curve->setColor( m_statistics->color() );
auto symbol = statisticsCurveSymbolFromAddress( address );
curve->setSymbol( symbol );
@@ -1131,13 +1144,7 @@ std::vector<std::pair<EnsembleParameter, double>> RimEnsembleCurveSet::correlati
RimSummaryCaseCollection* ensemble = m_yValuesSummaryCaseCollection;
if ( ensemble )
{
auto parameters = ensemble->parameterCorrelationsAllTimeSteps( summaryAddress() );
std::sort( parameters.begin(),
parameters.end(),
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
return std::abs( lhs.second ) > std::abs( rhs.second );
} );
return parameters;
return ensemble->correlationSortedEnsembleParameters( summaryAddress() );
}
else
{

View File

@@ -18,8 +18,8 @@
#include "RimEnsembleStatistics.h"
#include "RiaColorTools.h"
#include "RifSummaryReaderInterface.h"
#include "RigStatisticsMath.h"
#include "RimEnsembleCurveSet.h"
@@ -46,7 +46,8 @@ RimEnsembleStatistics::RimEnsembleStatistics()
CAF_PDM_InitField( &m_includeIncompleteCurves, "IncludeIncompleteCurves", false, "Include Incomplete Curves", "", "", "" );
CAF_PDM_InitField( &m_warningLabel, "WarningLabel", QString( "Warning: Ensemble time range mismatch" ), "", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
m_warningLabel.xmlCapability()->disableIO();
m_warningLabel.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );

View File

@@ -36,7 +36,7 @@
#include <QFileInfo>
#include <QRegularExpression>
#define SUMMARY_CASE_SHORT_NAME_LENGTH 6 // TODO: Could make this a preference if required.
#define SUMMARY_CASE_SHORT_NAME_LENGTH 4 // TODO: Could make this a preference if required.
CAF_PDM_ABSTRACT_SOURCE_INIT( RimSummaryCase, "SummaryCase" );
namespace caf
@@ -329,14 +329,11 @@ QString RimSummaryCase::uniqueShortNameForEnsembleCase( RimSummaryCase* summaryC
for ( auto keyComponent : keyFileComponents )
{
QStringList subComponents;
QString numberGroup = numberRe.match( keyComponent ).captured();
int numberGroupAndDelimiterLength = numberGroup.length() + 1;
QString numberGroup = numberRe.match( keyComponent ).captured();
if ( !numberGroup.isEmpty() )
{
keyComponent = keyComponent.replace( numberGroup, "" );
QString stem =
keyComponent.left( std::max( 1, SUMMARY_CASE_SHORT_NAME_LENGTH - numberGroupAndDelimiterLength ) );
QString stem = keyComponent.left( SUMMARY_CASE_SHORT_NAME_LENGTH );
if ( !stem.isEmpty() ) subComponents.push_back( stem );
subComponents.push_back( numberGroup );
}

View File

@@ -230,7 +230,6 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase )
{
size_t caseCountBeforeRemove = m_cases.size();
summaryCase->nameChanged.disconnect( this );
m_cases.removeChildObject( summaryCase );
m_cachedSortedEnsembleParameters.clear();
@@ -474,6 +473,37 @@ const std::vector<EnsembleParameter>&
return m_cachedSortedEnsembleParameters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<EnsembleParameter, double>>
RimSummaryCaseCollection::correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address ) const
{
auto parameters = parameterCorrelationsAllTimeSteps( address );
std::sort( parameters.begin(),
parameters.end(),
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
return std::abs( lhs.second ) > std::abs( rhs.second );
} );
return parameters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<EnsembleParameter, double>>
RimSummaryCaseCollection::correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address,
time_t selectedTimeStep ) const
{
auto parameters = parameterCorrelations( address, selectedTimeStep );
std::sort( parameters.begin(),
parameters.end(),
[]( const std::pair<EnsembleParameter, double>& lhs, const std::pair<EnsembleParameter, double>& rhs ) {
return std::abs( lhs.second ) > std::abs( rhs.second );
} );
return parameters;
}
time_t timeDiff( time_t lhs, time_t rhs )
{
if ( lhs >= rhs )
@@ -489,7 +519,6 @@ time_t timeDiff( time_t lhs, time_t rhs )
std::vector<std::pair<EnsembleParameter, double>>
RimSummaryCaseCollection::parameterCorrelations( const RifEclipseSummaryAddress& address,
time_t timeStep,
bool spearman,
const std::vector<QString>& selectedParameters ) const
{
auto parameters = variationSortedEnsembleParameters( true );
@@ -552,16 +581,8 @@ std::vector<std::pair<EnsembleParameter, double>>
for ( auto parameterValuesPair : parameterValues )
{
double correlation = 0.0;
if ( spearman )
{
double spearman = RiaStatisticsTools::spearmanCorrelation( parameterValuesPair.second, caseValuesAtTimestep );
if ( spearman != std::numeric_limits<double>::infinity() ) correlation = spearman;
}
else
{
double pearson = RiaStatisticsTools::pearsonCorrelation( parameterValuesPair.second, caseValuesAtTimestep );
if ( pearson != std::numeric_limits<double>::infinity() ) correlation = pearson;
}
double pearson = RiaStatisticsTools::pearsonCorrelation( parameterValuesPair.second, caseValuesAtTimestep );
if ( pearson != std::numeric_limits<double>::infinity() ) correlation = pearson;
correlationResults.push_back( std::make_pair( parameterValuesPair.first, correlation ) );
}
return correlationResults;
@@ -572,7 +593,6 @@ std::vector<std::pair<EnsembleParameter, double>>
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<EnsembleParameter, double>>
RimSummaryCaseCollection::parameterCorrelationsAllTimeSteps( const RifEclipseSummaryAddress& address,
bool spearman,
const std::vector<QString>& selectedParameters ) const
{
const size_t maxTimeStepCount = 10;
@@ -587,7 +607,7 @@ std::vector<std::pair<EnsembleParameter, double>>
for ( size_t i = stride; i < timeStepsVector.size(); i += stride )
{
std::vector<std::pair<EnsembleParameter, double>> correlationsForTimeStep =
parameterCorrelations( address, timeStepsVector[i], spearman, selectedParameters );
parameterCorrelations( address, timeStepsVector[i], selectedParameters );
correlationsForChosenTimeSteps.push_back( correlationsForTimeStep );
}
@@ -658,9 +678,16 @@ EnsembleParameter RimSummaryCaseCollection::createEnsembleParameter( const QStri
size_t numericValuesCount = 0;
size_t textValuesCount = 0;
auto summaryCases = allSummaryCases();
// Make sure the values list exactly matches the case count
// And use an invalid value (infinity) for invalid cases.
eParam.values.resize( summaryCases.size(), std::numeric_limits<double>::infinity() );
// Prepare case realization params, and check types
for ( const auto& rimCase : allSummaryCases() )
for ( size_t caseIdx = 0; caseIdx < summaryCases.size(); ++caseIdx )
{
auto rimCase = summaryCases[caseIdx];
auto crp = rimCase->caseRealizationParameters();
if ( !crp ) continue;
@@ -669,15 +696,15 @@ EnsembleParameter RimSummaryCaseCollection::createEnsembleParameter( const QStri
if ( value.isNumeric() )
{
double numVal = value.numericValue();
eParam.values.push_back( QVariant( numVal ) );
double numVal = value.numericValue();
eParam.values[caseIdx] = QVariant( numVal );
if ( numVal < eParam.minValue ) eParam.minValue = numVal;
if ( numVal > eParam.maxValue ) eParam.maxValue = numVal;
numericValuesCount++;
}
else if ( value.isText() )
{
eParam.values.push_back( QVariant( value.textValue() ) );
eParam.values[caseIdx] = QVariant( value.textValue() );
textValuesCount++;
}
}

View File

@@ -115,14 +115,16 @@ public:
int ensembleId() const;
const std::vector<EnsembleParameter>& variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
std::vector<std::pair<EnsembleParameter, double>>
correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address ) const;
std::vector<std::pair<EnsembleParameter, double>>
correlationSortedEnsembleParameters( const RifEclipseSummaryAddress& address, time_t selectedTimeStep ) const;
std::vector<std::pair<EnsembleParameter, double>>
parameterCorrelations( const RifEclipseSummaryAddress& address,
time_t selectedTimeStep,
bool spearman = false,
const std::vector<QString>& selectedParameters = {} ) const;
std::vector<std::pair<EnsembleParameter, double>>
parameterCorrelationsAllTimeSteps( const RifEclipseSummaryAddress& address,
bool spearman = false,
const std::vector<QString>& selectedParameters = {} ) const;
std::vector<EnsembleParameter> alphabeticEnsembleParameters() const;

View File

@@ -240,7 +240,6 @@ void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase )
}
}
summaryCase->nameChanged.disconnect( this );
m_cases.removeChildObject( summaryCase );
for ( RimSummaryCaseCollection* summaryCaseCollection : m_caseCollections )
@@ -307,7 +306,6 @@ RimSummaryCaseCollection*
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseMainCollection::removeCaseCollection( RimSummaryCaseCollection* caseCollection )
{
caseCollection->caseNameChanged.disconnect( this );
m_caseCollections.removeChildObject( caseCollection );
}

View File

@@ -48,7 +48,7 @@ RimSummaryCrossPlotCollection::~RimSummaryCrossPlotCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCrossPlotCollection::deleteAllChildObjects()
void RimSummaryCrossPlotCollection::deleteAllPlots()
{
m_summaryCrossPlots.deleteAllChildObjects();
}
@@ -56,11 +56,19 @@ void RimSummaryCrossPlotCollection::deleteAllChildObjects()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryPlot*> RimSummaryCrossPlotCollection::summaryPlots() const
std::vector<RimSummaryPlot*> RimSummaryCrossPlotCollection::plots() const
{
return m_summaryCrossPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimSummaryCrossPlotCollection::plotCount() const
{
return m_summaryCrossPlots.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -86,6 +94,23 @@ void RimSummaryCrossPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionIt
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCrossPlotCollection::insertPlot( RimSummaryPlot* plot, size_t index )
{
m_summaryCrossPlots.insert( index, plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCrossPlotCollection::removePlot( RimSummaryPlot* plot )
{
m_summaryCrossPlots.removeChildObject( plot );
updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -98,11 +123,3 @@ RimSummaryPlot* RimSummaryCrossPlotCollection::createSummaryPlot()
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCrossPlotCollection::addSummaryPlot( RimSummaryPlot* plot )
{
m_summaryCrossPlots().push_back( plot );
}

View File

@@ -18,16 +18,17 @@
#pragma once
#include "RimAbstractPlotCollection.h"
#include "RimSummaryPlot.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimSummaryPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimSummaryCrossPlotCollection : public caf::PdmObject
class RimSummaryCrossPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimSummaryPlot>
{
CAF_PDM_HEADER_INIT;
@@ -35,11 +36,14 @@ public:
RimSummaryCrossPlotCollection();
~RimSummaryCrossPlotCollection() override;
void deleteAllChildObjects();
void deleteAllPlots() final;
std::vector<RimSummaryPlot*> summaryPlots() const;
RimSummaryPlot* createSummaryPlot();
void addSummaryPlot( RimSummaryPlot* plot );
std::vector<RimSummaryPlot*> plots() const final;
size_t plotCount() const final;
void insertPlot( RimSummaryPlot* plot, size_t index ) final;
void removePlot( RimSummaryPlot* plot ) final;
RimSummaryPlot* createSummaryPlot();
void updateSummaryNameHasChanged();
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;

View File

@@ -106,7 +106,7 @@ protected:
void updateLegendsInPlot() override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void initAfterRead();
void initAfterRead() override;
private:
RifSummaryReaderInterface* valuesSummaryReaderX() const;

View File

@@ -48,7 +48,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCurveCollection, "RimSummaryCurveCollection" );
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurveCollection::RimSummaryCurveCollection()
: curvesReordered( this )
: curvesChanged( this )
{
CAF_PDM_InitObject( "Summary Curves", ":/SummaryCurveFilter16x16.png", "", "" );
@@ -476,7 +476,16 @@ void RimSummaryCurveCollection::defineEditorAttribute( const caf::PdmFieldHandle
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveCollection::onCurvesReordered( const SignalEmitter* emitter )
{
curvesReordered.send();
curvesChanged.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
curvesChanged.send();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -42,7 +42,7 @@ class RimSummaryCurveCollection : public caf::PdmObject
CAF_PDM_HEADER_INIT;
private:
caf::Signal<> curvesReordered;
caf::Signal<> curvesChanged;
public:
RimSummaryCurveCollection();
@@ -97,6 +97,8 @@ private:
caf::PdmUiEditorAttribute* attribute ) override;
void onCurvesReordered( const SignalEmitter* emitter );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
private:
friend class RimSummaryCrossPlot;

View File

@@ -146,19 +146,14 @@ RimSummaryPlot::RimSummaryPlot()
{
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
CAF_PDM_InitScriptableField( &m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "" );
m_showPlotTitle.xmlCapability()->setIOWritable( false );
CAF_PDM_InitScriptableField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title", "", "", "" );
CAF_PDM_InitScriptableField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name", "", "", "" );
CAF_PDM_InitScriptableField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "", "", "", "" );
m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true );
m_summaryCurveCollection = new RimSummaryCurveCollection;
m_summaryCurveCollection->curvesReordered.connect( this, &RimSummaryPlot::onCurvesReordered );
m_summaryCurveCollection->curvesChanged.connect( this, &RimSummaryPlot::onCurveCollectionChanged );
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSetCollection, "EnsembleCurveSetCollection", "", "", "", "" );
m_ensembleCurveSetCollection.uiCapability()->setUiTreeHidden( true );
@@ -235,22 +230,6 @@ RimSummaryPlot::~RimSummaryPlot()
delete m_ensembleCurveSetCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlot::showPlotTitle() const
{
return m_showPlotTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setShowPlotTitle( bool showTitle )
{
m_showPlotTitle = showTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -360,7 +339,7 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTi
populateTimeHistoryCurvesData( m_gridTimeHistoryCurves.childObjects(), &timeHistoryCurvesData );
// Export observed data
appendToExportData( out, {summaryCurvesObsData}, showTimeAsLongString );
appendToExportData( out, { summaryCurvesObsData }, showTimeAsLongString );
std::vector<CurvesData> exportData( 2 );
@@ -379,7 +358,7 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTi
CurvesData asciiCurvesData;
populateAsciiDataCurvesData( m_asciiDataCurves.childObjects(), &asciiCurvesData );
appendToExportData( out, {asciiCurvesData}, showTimeAsLongString );
appendToExportData( out, { asciiCurvesData }, showTimeAsLongString );
}
return out;
@@ -609,7 +588,7 @@ void RimSummaryPlot::updatePlotTitle()
{
QString plotTitle = description();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() );
m_plotWidget->scheduleReplot();
}
}
@@ -677,7 +656,7 @@ void RimSummaryPlot::updateLegend()
{
if ( m_plotWidget )
{
m_plotWidget->setLegendVisible( m_showPlotLegends && isMdiWindow() );
m_plotWidget->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
}
reattachAllCurves();
@@ -1255,7 +1234,7 @@ void RimSummaryPlot::removeCurve( RimSummaryCurve* curve )
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::deleteCurve( RimSummaryCurve* curve )
{
deleteCurves( {curve} );
deleteCurves( { curve } );
}
//--------------------------------------------------------------------------------------------------
@@ -1432,6 +1411,12 @@ void RimSummaryPlot::updateStackedCurveData()
{
updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT );
if ( m_plotWidget )
{
reattachAllCurves();
m_plotWidget->scheduleReplot();
}
}
//--------------------------------------------------------------------------------------------------
@@ -1492,10 +1477,6 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxi
zPos -= 1.0;
}
}
if ( m_plotWidget )
{
m_plotWidget->scheduleReplot();
}
}
//--------------------------------------------------------------------------------------------------
///
@@ -1580,7 +1561,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
if ( m_plotWidget )
{
m_plotWidget->setLegendVisible( m_showPlotLegends && isMdiWindow() );
m_plotWidget->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
m_plotWidget->setLegendFontSize( legendFontSize() );
m_plotWidget->updateLegend();
}
@@ -1646,7 +1627,7 @@ void RimSummaryPlot::updateZoomFromQwt()
//--------------------------------------------------------------------------------------------------
std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
{
return {m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties};
return { m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties };
}
//--------------------------------------------------------------------------------------------------
@@ -1756,20 +1737,6 @@ void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter,
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::doRemoveFromCollection()
{
RimSummaryPlotCollection* summaryCollection = nullptr;
this->firstAncestorOrThisOfType( summaryCollection );
if ( summaryCollection )
{
summaryCollection->removeSummaryPlot( this );
summaryCollection->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2169,7 +2136,7 @@ void RimSummaryPlot::handleKeyPressEvent( QKeyEvent* keyEvent )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::onCurvesReordered( const SignalEmitter* emitter )
void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter )
{
updateStackedCurveData();
}
@@ -2292,13 +2259,13 @@ void populateTimeHistoryCurvesData( std::vector<RimGridTimeHistoryCurve*> curves
if ( curveCaseName == curvesData->caseNames[i] ) casePosInList = i;
}
CurveData curveData = {curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues()};
CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() };
if ( casePosInList == cvf::UNDEFINED_SIZE_T )
{
curvesData->caseNames.push_back( curveCaseName );
curvesData->timeSteps.push_back( curve->timeStepValues() );
curvesData->allCurveData.push_back( std::vector<CurveData>( {curveData} ) );
curvesData->allCurveData.push_back( std::vector<CurveData>( { curveData } ) );
}
else
{
@@ -2324,13 +2291,13 @@ void populateAsciiDataCurvesData( std::vector<RimAsciiDataCurve*> curves, Curves
size_t casePosInList = cvf::UNDEFINED_SIZE_T;
CurveData curveData = {curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues()};
CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() };
if ( casePosInList == cvf::UNDEFINED_SIZE_T )
{
curvesData->caseNames.push_back( "" );
curvesData->timeSteps.push_back( curve->timeSteps() );
curvesData->allCurveData.push_back( std::vector<CurveData>( {curveData} ) );
curvesData->allCurveData.push_back( std::vector<CurveData>( { curveData } ) );
}
else
{
@@ -2367,7 +2334,7 @@ void populateSummaryCurvesData( std::vector<RimSummaryCurve*> curves, SummaryCur
if ( curveCaseName == curvesData->caseNames[i] ) casePosInList = i;
}
CurveData curveData = {curve->curveExportDescription(), curve->summaryAddressY(), curve->valuesY()};
CurveData curveData = { curve->curveExportDescription(), curve->summaryAddressY(), curve->valuesY() };
CurveData errorCurveData;
// Error data
@@ -2388,7 +2355,7 @@ void populateSummaryCurvesData( std::vector<RimSummaryCurve*> curves, SummaryCur
// 1. Case is not referenced before, or
// 2. We have calculated data, and it we cannot assume identical time axis
auto curveDataList = std::vector<CurveData>( {curveData} );
auto curveDataList = std::vector<CurveData>( { curveData } );
if ( hasErrorData ) curveDataList.push_back( errorCurveData );
curvesData->caseNames.push_back( curveCaseName );

View File

@@ -73,8 +73,6 @@ public:
RimSummaryPlot();
~RimSummaryPlot() override;
bool showPlotTitle() const;
void setShowPlotTitle( bool showTitle );
void setDescription( const QString& description );
QString description() const override;
@@ -192,10 +190,9 @@ private:
void detachAllPlotItems();
void doRemoveFromCollection() override;
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
void onCurvesReordered( const SignalEmitter* emitter );
void onCurveCollectionChanged( const SignalEmitter* emitter );
protected:
// Overridden PDM methods
@@ -251,7 +248,6 @@ private:
private:
caf::PdmField<bool> m_normalizeCurveYValues;
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;

View File

@@ -39,9 +39,9 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
{
CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" );
summaryPlots.uiCapability()->setUiHidden( true );
caf::PdmFieldReorderCapability::addToField( &summaryPlots );
CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" );
m_summaryPlots.uiCapability()->setUiHidden( true );
caf::PdmFieldReorderCapability::addToField( &m_summaryPlots );
}
//--------------------------------------------------------------------------------------------------
@@ -49,7 +49,6 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
//--------------------------------------------------------------------------------------------------
RimSummaryPlotCollection::~RimSummaryPlotCollection()
{
summaryPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
@@ -61,7 +60,8 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle()
plot->setAsPlotMdiWindow();
plot->enableAutoPlotTitle( true );
summaryPlots.push_back( plot );
addPlot( plot );
return plot;
}
@@ -74,7 +74,8 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
RimSummaryPlot* plot = new RimSummaryPlot();
plot->setAsPlotMdiWindow();
summaryPlots.push_back( plot );
addPlot( plot );
plot->setDescription( name );
return plot;
@@ -85,7 +86,7 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::updateSummaryNameHasChanged()
{
for ( RimSummaryPlot* plot : summaryPlots )
for ( RimSummaryPlot* plot : plots() )
{
plot->updateCaseNameHasChanged();
}
@@ -96,21 +97,13 @@ void RimSummaryPlotCollection::updateSummaryNameHasChanged()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const
{
for ( RimSummaryPlot* plot : summaryPlots() )
for ( RimSummaryPlot* plot : plots() )
{
QString displayName = plot->description();
optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::removeSummaryPlot( RimSummaryPlot* summaryPlot )
{
summaryPlots.removeChildObject( summaryPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -121,3 +114,36 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle*
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
mainPlotWindow->updateSummaryPlotToolBar();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryPlot*> RimSummaryPlotCollection::plots() const
{
return m_summaryPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimSummaryPlotCollection::plotCount() const
{
return m_summaryPlots.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::insertPlot( RimSummaryPlot* summaryPlot, size_t index )
{
m_summaryPlots.insert( index, summaryPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotCollection::removePlot( RimSummaryPlot* summaryPlot )
{
m_summaryPlots.removeChildObject( summaryPlot );
updateAllRequiredEditors();
}

View File

@@ -18,6 +18,9 @@
#pragma once
#include "RimAbstractPlotCollection.h"
#include "RimSummaryPlot.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrArrayField.h"
@@ -28,7 +31,7 @@ class RimSummaryPlot;
///
///
//==================================================================================================
class RimSummaryPlotCollection : public caf::PdmObject
class RimSummaryPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimSummaryPlot>
{
CAF_PDM_HEADER_INIT;
@@ -36,16 +39,19 @@ public:
RimSummaryPlotCollection();
~RimSummaryPlotCollection() override;
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
RimSummaryPlot* createSummaryPlotWithAutoTitle();
RimSummaryPlot* createNamedSummaryPlot( const QString& name );
void updateSummaryNameHasChanged();
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
void removeSummaryPlot( RimSummaryPlot* summaryPlot );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
std::vector<RimSummaryPlot*> plots() const final;
size_t plotCount() const final;
void insertPlot( RimSummaryPlot* summaryPlot, size_t index ) final;
void removePlot( RimSummaryPlot* summaryPlot ) final;
private:
caf::PdmChildArrayField<RimSummaryPlot*> m_summaryPlots;
};

View File

@@ -41,6 +41,7 @@
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiItem.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiToolBarEditor.h"
CAF_PDM_SOURCE_INIT( RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionModifier" );
@@ -1118,4 +1119,9 @@ void RimSummaryPlotSourceStepping::defineEditorAttribute( const caf::PdmFieldHan
myAttr->prevButtonText = "Previous " + modifierText + "PgUp)";
}
}
if ( myAttr && ( uiConfigName == caf::PdmUiToolBarEditor::uiEditorConfigName() ) )
{
myAttr->minimumWidth = 120;
}
}

View File

@@ -432,3 +432,17 @@ RimSurfaceCollection* RimSurfaceCollection::getSubCollection( const QString name
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSurfaceCollection::containsSurface()
{
bool containsSurface = ( surfaces().size() > 0 );
for ( auto coll : m_subCollections )
{
containsSurface |= coll->containsSurface();
}
return containsSurface;
}

View File

@@ -44,6 +44,8 @@ public:
void addSubCollection( RimSurfaceCollection* collection );
RimSurfaceCollection* getSubCollection( const QString name );
bool containsSurface();
void reloadSurfaces( std::vector<RimSurface*> surfaces );
void removeSurface( RimSurface* surface );