mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/dev' into summary-text-edit-in-toolbar
This commit is contained in:
@@ -225,7 +225,10 @@ void RimAnnotationCollection::updateViewAnnotationCollections()
|
||||
|
||||
for ( const auto* view : views )
|
||||
{
|
||||
view->annotationCollection()->onGlobalCollectionChanged( this );
|
||||
if (view->annotationCollection())
|
||||
{
|
||||
view->annotationCollection()->onGlobalCollectionChanged( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindow.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
|
||||
@@ -130,7 +132,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRiuQwtPlotOwnerInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
|
||||
@@ -212,7 +213,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimMainPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotInterface.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindow.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp
|
||||
|
||||
@@ -774,13 +774,13 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
|
||||
QTextStream stream( &tableText );
|
||||
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
|
||||
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn( "Date" ),
|
||||
RifEclipseOutputTableColumn( "StorageCapacity" ),
|
||||
RifEclipseOutputTableColumn( "FlowCapacity" ),
|
||||
RifEclipseOutputTableColumn( "SweepEfficiency" ),
|
||||
RifEclipseOutputTableColumn( "DimensionlessTime" ),
|
||||
RifEclipseOutputTableColumn( "LorentzCoefficient" ),
|
||||
std::vector<RifTextDataTableColumn> header = {
|
||||
RifTextDataTableColumn( "Date" ),
|
||||
RifTextDataTableColumn( "StorageCapacity" ),
|
||||
RifTextDataTableColumn( "FlowCapacity" ),
|
||||
RifTextDataTableColumn( "SweepEfficiency" ),
|
||||
RifTextDataTableColumn( "DimensionlessTime" ),
|
||||
RifTextDataTableColumn( "LorentzCoefficient" ),
|
||||
};
|
||||
|
||||
formatter.header( header );
|
||||
|
||||
@@ -148,7 +148,6 @@ RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
|
||||
{
|
||||
m_defaultWellAllocPlot = new RimWellAllocationPlot;
|
||||
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
|
||||
RiaApplication::instance()->project()->assignViewIdToView( m_flowCharacteristicsPlot );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
@@ -164,7 +163,6 @@ RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlo
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
RiaApplication::instance()->project()->assignViewIdToView( m_flowCharacteristicsPlot );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "RigSimWellData.h"
|
||||
#include "RigTofAccumulatedPhaseFractionsCalculator.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "RigSimWellData.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellAllocationPlot, "WellAllocationPlot" );
|
||||
|
||||
@@ -100,7 +100,7 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
m_accumulatedWellFlowPlot = new RimWellLogPlot;
|
||||
m_accumulatedWellFlowPlot->setDepthUnit( RiaDefines::UNIT_NONE );
|
||||
m_accumulatedWellFlowPlot->setDepthType( RimWellLogPlot::CONNECTION_NUMBER );
|
||||
m_accumulatedWellFlowPlot->setTrackLegendsVisible( false );
|
||||
m_accumulatedWellFlowPlot->setLegendsVisible( false );
|
||||
m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" );
|
||||
@@ -125,6 +125,8 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} );
|
||||
m_accumulatedWellFlowPlot->setAvailableDepthTypes(
|
||||
{RimWellLogPlot::CONNECTION_NUMBER, RimWellLogPlot::TRUE_VERTICAL_DEPTH, RimWellLogPlot::PSEUDO_LENGTH} );
|
||||
|
||||
m_accumulatedWellFlowPlot->setCommonDataSourceEnabled( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -189,12 +191,12 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
for ( RimWellLogTrack* t : tracks )
|
||||
{
|
||||
accumulatedWellFlowPlot()->removeTrack( t );
|
||||
accumulatedWellFlowPlot()->removePlot( t );
|
||||
delete t;
|
||||
}
|
||||
}
|
||||
|
||||
CVF_ASSERT( accumulatedWellFlowPlot()->trackCount() == 0 );
|
||||
CVF_ASSERT( accumulatedWellFlowPlot()->plotCount() == 0 );
|
||||
|
||||
QString description;
|
||||
if ( m_flowType() == ACCUMULATED ) description = "Accumulated Flow";
|
||||
@@ -270,7 +272,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
plotTrack->setFormationsForCaseWithSimWellOnly( true );
|
||||
plotTrack->setFormationBranchIndex( (int)brIdx );
|
||||
|
||||
accumulatedWellFlowPlot()->addTrack( plotTrack );
|
||||
accumulatedWellFlowPlot()->addPlot( plotTrack );
|
||||
|
||||
const std::vector<double>& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER
|
||||
? wfCalculator->connectionNumbersFromTop( brIdx )
|
||||
@@ -794,6 +796,8 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
uiOrdering.add( &m_userName );
|
||||
uiOrdering.add( &m_showPlotTitle );
|
||||
|
||||
@@ -809,6 +813,8 @@ void RimWellAllocationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
optionGroup.add( &m_groupSmallContributions );
|
||||
optionGroup.add( &m_smallContributionsThreshold );
|
||||
m_smallContributionsThreshold.uiCapability()->setUiReadOnly( !m_groupSmallContributions() );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -865,9 +871,13 @@ cvf::Color3f RimWellAllocationPlot::getTracerColor( const QString& tracerName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateFormationNamesData() const
|
||||
{
|
||||
for ( size_t i = 0; i < m_accumulatedWellFlowPlot->trackCount(); ++i )
|
||||
for ( size_t i = 0; i < m_accumulatedWellFlowPlot->plotCount(); ++i )
|
||||
{
|
||||
RimWellLogTrack* track = m_accumulatedWellFlowPlot->trackByIndex( i );
|
||||
track->setAndUpdateSimWellFormationNamesData( m_case, m_wellName );
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( m_accumulatedWellFlowPlot->plotByIndex( i ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->setAndUpdateSimWellFormationNamesData( m_case, m_wellName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void RimWellFlowRateCurve::updateStackedPlotData()
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
|
||||
|
||||
bool isFirstTrack = ( wellLogTrack == wellLogPlot->trackByIndex( 0 ) );
|
||||
bool isFirstTrack = ( wellLogTrack == wellLogPlot->plotByIndex( 0 ) );
|
||||
|
||||
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE;
|
||||
|
||||
@@ -271,7 +271,7 @@ void RimWellFlowRateCurve::updateStackedPlotData()
|
||||
stackedValues.insert( stackedValues.begin(), 0.0 );
|
||||
polyLineStartStopIndices.front().second += 1;
|
||||
|
||||
if ( wellLogPlot->trackCount() > 1 && isFirstTrack )
|
||||
if ( wellLogPlot->plotCount() > 1 && isFirstTrack )
|
||||
{
|
||||
// Add a dummy negative depth value to make the contribution
|
||||
// from other branches connected to well head visible
|
||||
|
||||
@@ -170,10 +170,13 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
|
||||
{
|
||||
case RiaDefines::UNIT_METER:
|
||||
presentUnitSystems.insert( RiaEclipseUnitTools::UNITS_METRIC );
|
||||
break;
|
||||
case RiaDefines::UNIT_FEET:
|
||||
presentUnitSystems.insert( RiaEclipseUnitTools::UNITS_FIELD );
|
||||
break;
|
||||
case RiaDefines::UNIT_NONE:
|
||||
presentUnitSystems.insert( RiaEclipseUnitTools::UNITS_UNKNOWN );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,26 +229,31 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::updateFormationsOnPlot() const
|
||||
{
|
||||
if ( trackCount() > 0 )
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimWellPath* wellPath = proj->wellPathByName( m_wellPathName );
|
||||
|
||||
RimCase* formationNamesCase = trackByIndex( 0 )->formationNamesCase();
|
||||
|
||||
if ( !formationNamesCase )
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
/// Set default case. Todo : Use the first of the selected cases in the plot
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
RimCase* formationNamesCase = track->formationNamesCase();
|
||||
|
||||
if ( !cases.empty() )
|
||||
if ( !formationNamesCase )
|
||||
{
|
||||
formationNamesCase = cases[0];
|
||||
}
|
||||
}
|
||||
/// Set default case. Todo : Use the first of the selected cases in the plot
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
|
||||
trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
formationNamesCase = cases[0];
|
||||
}
|
||||
}
|
||||
|
||||
track->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,7 +491,11 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
RimWellLogTrack* plotTrack = trackByIndex( 0 );
|
||||
RimWellLogTrack* plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefs = selectedCurveDefs();
|
||||
|
||||
setPlotXAxisTitles( plotTrack );
|
||||
@@ -697,8 +709,8 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|
||||
curveGroupId++;
|
||||
}
|
||||
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
RimWellLogPlot::onLoadDataAndUpdate();
|
||||
plotTrack->calculateXZoomRange();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -883,11 +895,15 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
if ( changedField == &m_wellPathName )
|
||||
{
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
plotTrack->deleteAllCurves();
|
||||
m_selectedSources.v().clear();
|
||||
m_selectedTimeSteps.v().clear();
|
||||
updateFormationsOnPlot();
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->deleteAllCurves();
|
||||
m_selectedSources.v().clear();
|
||||
m_selectedTimeSteps.v().clear();
|
||||
updateFormationsOnPlot();
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_selectedSources )
|
||||
{
|
||||
@@ -921,20 +937,28 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
updateFormationsOnPlot();
|
||||
syncSourcesIoFieldFromGuiField();
|
||||
syncCurvesFromUiSelection();
|
||||
updateDepthZoom();
|
||||
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
plotTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
}
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
if ( changedField == &m_useStandardConditionCurves || changedField == &m_useReservoirConditionCurves ||
|
||||
changedField == &m_phases )
|
||||
{
|
||||
syncCurvesFromUiSelection();
|
||||
updateDepthZoom();
|
||||
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
plotTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAutoScaleXEnabled( true );
|
||||
}
|
||||
updateZoom();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -951,6 +975,7 @@ void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName );
|
||||
|
||||
uiOrdering.add( &m_wellPathName );
|
||||
@@ -967,20 +992,23 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
|
||||
flowGroup->add( &m_phases );
|
||||
|
||||
if ( trackCount() > 0 )
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimWellLogTrack* track = trackByIndex( 0 );
|
||||
RimWellLogTrack* const track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->uiOrderingForRftPltFormations( uiOrdering );
|
||||
|
||||
track->uiOrderingForRftPltFormations( uiOrdering );
|
||||
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
|
||||
legendAndAxisGroup->setCollapsedByDefault( true );
|
||||
|
||||
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
|
||||
legendAndAxisGroup->setCollapsedByDefault( true );
|
||||
createPlotSettingsUiGroup( *legendAndAxisGroup );
|
||||
|
||||
uiOrderingForPlotSettings( *legendAndAxisGroup );
|
||||
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
|
||||
|
||||
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
|
||||
|
||||
uiOrderingForDepthAxis( *legendAndAxisGroup );
|
||||
uiOrderingForDepthAxis( *legendAndAxisGroup );
|
||||
}
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
@@ -1095,9 +1123,14 @@ void RimWellPltPlot::onLoadDataAndUpdate()
|
||||
|
||||
if ( m_isOnLoad )
|
||||
{
|
||||
if ( trackCount() > 0 )
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
trackByIndex( 0 )->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
|
||||
}
|
||||
}
|
||||
m_isOnLoad = false;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RimWellPltPlot.h"
|
||||
|
||||
#include "RiuWellLogTrack.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
@@ -118,7 +118,7 @@ RimWellRftPlot::RimWellRftPlot()
|
||||
m_wellPathCollection = RiaApplication::instance()->project()->activeOilField()->wellPathCollection();
|
||||
|
||||
m_nameConfig->setCustomName( "RFT Plot" );
|
||||
m_trackLegendsHorizontal = true;
|
||||
m_plotLegendsHorizontal = true;
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
m_isOnLoad = true;
|
||||
@@ -175,35 +175,41 @@ void RimWellRftPlot::applyCurveColor( RimWellLogCurve* curve )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::updateFormationsOnPlot() const
|
||||
{
|
||||
if ( trackCount() > 0 )
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimWellPath* wellPath = proj->wellPathByName( m_wellPathNameOrSimWellName );
|
||||
|
||||
RimCase* formationNamesCase = trackByIndex( 0 )->formationNamesCase();
|
||||
|
||||
if ( !formationNamesCase )
|
||||
RimCase* formationNamesCase = nullptr;
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
/// Set default case. Todo : Use the first of the selected cases in the plot
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
formationNamesCase = track->formationNamesCase();
|
||||
|
||||
if ( !cases.empty() )
|
||||
if ( !formationNamesCase )
|
||||
{
|
||||
formationNamesCase = cases[0];
|
||||
}
|
||||
}
|
||||
/// Set default case. Todo : Use the first of the selected cases in the plot
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
|
||||
if ( wellPath )
|
||||
{
|
||||
trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
trackByIndex( 0 )->setAndUpdateSimWellFormationNamesAndBranchData( formationNamesCase,
|
||||
associatedSimWellName(),
|
||||
m_branchIndex,
|
||||
m_branchDetection );
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
formationNamesCase = cases[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ( wellPath )
|
||||
{
|
||||
track->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
track->setAndUpdateSimWellFormationNamesAndBranchData( formationNamesCase,
|
||||
associatedSimWellName(),
|
||||
m_branchIndex,
|
||||
m_branchDetection );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,7 +342,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() );
|
||||
}
|
||||
@@ -350,7 +356,10 @@ void RimWellRftPlot::updateEditorsFromCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
{
|
||||
RimWellLogTrack* plotTrack = trackByIndex( 0 );
|
||||
RimWellLogTrack* plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
const std::set<RiaRftPltCurveDefinition>& allCurveDefs = selectedCurveDefs();
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefsInPlot = curveDefsFromCurves();
|
||||
@@ -369,7 +378,7 @@ void RimWellRftPlot::syncCurvesFromUiSelection()
|
||||
allCurveDefs.end(),
|
||||
std::inserter( deleteCurveDefs, deleteCurveDefs.end() ) );
|
||||
|
||||
for ( RimWellLogCurve* const curve : plotTrack->curvesVector() )
|
||||
for ( RimWellLogCurve* const curve : plotTrack->curves() )
|
||||
{
|
||||
RiaRftPltCurveDefinition curveDef = RimWellPlotTools::curveDefFromCurve( curve );
|
||||
if ( deleteCurveDefs.count( curveDef ) > 0 )
|
||||
@@ -412,10 +421,14 @@ std::set<RiaRftPltCurveDefinition> RimWellRftPlot::curveDefsFromCurves() const
|
||||
{
|
||||
std::set<RiaRftPltCurveDefinition> curveDefs;
|
||||
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
for ( RimWellLogCurve* const curve : plotTrack->curvesVector() )
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
curveDefs.insert( RimWellPlotTools::curveDefFromCurve( curve ) );
|
||||
for ( RimWellLogCurve* const curve : plotTrack->curves() )
|
||||
{
|
||||
curveDefs.insert( RimWellPlotTools::curveDefFromCurve( curve ) );
|
||||
}
|
||||
}
|
||||
return curveDefs;
|
||||
}
|
||||
@@ -427,8 +440,11 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd,
|
||||
const std::set<RimWellLogCurve*>& curvesToDelete )
|
||||
{
|
||||
const QString simWellName = associatedSimWellName();
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
const QString simWellName = associatedSimWellName();
|
||||
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( !plotTrack ) return;
|
||||
|
||||
// Delete curves
|
||||
plotTrack->deleteAllCurves();
|
||||
@@ -656,16 +672,20 @@ const char* RimWellRftPlot::plotNameFormatString()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData )
|
||||
{
|
||||
for ( auto track : tracks() )
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
auto curves = track->curvesVector();
|
||||
for ( auto curve : curves )
|
||||
RimWellLogTrack* const track = dynamic_cast<RimWellLogTrack*>( plot );
|
||||
if ( track )
|
||||
{
|
||||
RimWellLogRftCurve* rftCurve = dynamic_cast<RimWellLogRftCurve*>( curve );
|
||||
if ( rftCurve && rftCurve->observedFmuRftData() == observedFmuRftData )
|
||||
auto curves = track->curves();
|
||||
for ( auto curve : curves )
|
||||
{
|
||||
track->takeOutCurve( rftCurve );
|
||||
delete rftCurve;
|
||||
RimWellLogRftCurve* rftCurve = dynamic_cast<RimWellLogRftCurve*>( curve );
|
||||
if ( rftCurve && rftCurve->observedFmuRftData() == observedFmuRftData )
|
||||
{
|
||||
track->takeOutCurve( rftCurve );
|
||||
delete rftCurve;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -811,7 +831,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
m_branchIndex = 0;
|
||||
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->deleteAllCurves();
|
||||
@@ -861,6 +881,7 @@ void RimWellRftPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
uiOrdering.add( &m_wellPathNameOrSimWellName );
|
||||
uiOrdering.add( &m_showStatisticsCurves );
|
||||
uiOrdering.add( &m_showEnsembleCurves );
|
||||
@@ -889,18 +910,21 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword( "Time Steps", "TimeSteps" );
|
||||
timeStepsGroup->add( &m_selectedTimeSteps );
|
||||
|
||||
if ( trackCount() > 0 )
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
RimWellLogTrack* track = trackByIndex( 0 );
|
||||
RimWellLogTrack* const track = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->uiOrderingForRftPltFormations( uiOrdering );
|
||||
|
||||
track->uiOrderingForRftPltFormations( uiOrdering );
|
||||
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
|
||||
legendAndAxisGroup->setCollapsedByDefault( true );
|
||||
|
||||
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
|
||||
legendAndAxisGroup->setCollapsedByDefault( true );
|
||||
|
||||
uiOrderingForPlotSettings( *legendAndAxisGroup );
|
||||
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
|
||||
uiOrderingForDepthAxis( *legendAndAxisGroup );
|
||||
createPlotSettingsUiGroup( *legendAndAxisGroup );
|
||||
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
|
||||
uiOrderingForDepthAxis( *legendAndAxisGroup );
|
||||
}
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
@@ -975,9 +999,14 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
if ( m_isOnLoad )
|
||||
{
|
||||
if ( trackCount() > 0 )
|
||||
if ( plotCount() > 0 )
|
||||
{
|
||||
trackByIndex( 0 )->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
|
||||
}
|
||||
}
|
||||
|
||||
m_isOnLoad = false;
|
||||
@@ -986,18 +1015,6 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
updateMdiWindowVisibility();
|
||||
updateFormationsOnPlot();
|
||||
|
||||
// Update of curve color must happen here when loading data from project file, as the curve color is blended by the
|
||||
// background color. The background color is taken from the viewer.
|
||||
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
|
||||
|
||||
if ( plotTrack && plotTrack->viewer() )
|
||||
{
|
||||
for ( auto c : plotTrack->curvesVector() )
|
||||
{
|
||||
applyCurveColor( c );
|
||||
}
|
||||
}
|
||||
|
||||
if ( depthType() == RimWellLogPlot::MEASURED_DEPTH )
|
||||
{
|
||||
assignWellPathToExtractionCurves();
|
||||
@@ -1006,6 +1023,19 @@ void RimWellRftPlot::onLoadDataAndUpdate()
|
||||
RimWellLogPlot::onLoadDataAndUpdate();
|
||||
|
||||
updateEditorsFromCurves();
|
||||
|
||||
// Update of curve color must happen here when loading data from project file, as the curve color is blended by the
|
||||
// background color. The background color is taken from the viewer.
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
|
||||
if ( plotTrack && plotTrack->viewer() )
|
||||
{
|
||||
syncCurvesFromUiSelection();
|
||||
for ( auto c : plotTrack->curves() )
|
||||
{
|
||||
applyCurveColor( c );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1044,13 +1074,18 @@ void RimWellRftPlot::assignWellPathToExtractionCurves()
|
||||
|
||||
if ( wellPath )
|
||||
{
|
||||
for ( RimWellLogCurve* curve : trackByIndex( 0 )->curvesVector() )
|
||||
RimWellLogTrack* const plotTrack = dynamic_cast<RimWellLogTrack*>( plotByIndex( 0 ) );
|
||||
CAF_ASSERT( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
auto extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
|
||||
if ( extractionCurve )
|
||||
for ( RimWellLogCurve* curve : plotTrack->curves() )
|
||||
{
|
||||
extractionCurve->setTrajectoryType( RimWellLogExtractionCurve::WELL_PATH );
|
||||
extractionCurve->setWellPath( wellPath );
|
||||
auto extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
|
||||
if ( extractionCurve )
|
||||
{
|
||||
extractionCurve->setTrajectoryType( RimWellLogExtractionCurve::WELL_PATH );
|
||||
extractionCurve->setWellPath( wellPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1108,10 +1143,10 @@ cvf::Color3f RimWellRftPlot::findCurveColor( RimWellLogCurve* curve )
|
||||
curveColor = m_dataSourceColors[sourceAddress];
|
||||
if ( m_showStatisticsCurves )
|
||||
{
|
||||
if ( trackByIndex( 0 ) && trackByIndex( 0 )->viewer() )
|
||||
if ( plotByIndex( 0 ) && plotByIndex( 0 )->viewer() )
|
||||
{
|
||||
cvf::Color3f backgroundColor = RiaColorTools::fromQColorTo3f(
|
||||
trackByIndex( 0 )->viewer()->canvasBackground().color() );
|
||||
plotByIndex( 0 )->viewer()->canvasBackground().color() );
|
||||
curveColor = RiaColorTools::blendCvfColors( backgroundColor, curveColor, 2, 1 );
|
||||
}
|
||||
}
|
||||
@@ -1135,12 +1170,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 )
|
||||
@@ -1170,14 +1205,6 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::onDepthTypeChanged()
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -132,8 +132,6 @@ private:
|
||||
cvf::Color3f findCurveColor( RimWellLogCurve* curve );
|
||||
void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
|
||||
|
||||
void onDepthTypeChanged() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellPathNameOrSimWellName;
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifEclipseDataTableFormatter.h"
|
||||
#include "RifTextDataTableFormatter.h"
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
@@ -88,6 +88,14 @@ RimGridCrossPlot::~RimGridCrossPlot()
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCrossPlot::isChecked() const
|
||||
{
|
||||
return isWindowVisible();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -139,7 +147,15 @@ std::vector<RimGridCrossPlotDataSet*> RimGridCrossPlot::dataSets() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimGridCrossPlot::viewWidget()
|
||||
{
|
||||
return m_qwtPlot;
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimGridCrossPlot::viewer()
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -149,9 +165,9 @@ QImage RimGridCrossPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_qwtPlot )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
QPixmap pix = m_qwtPlot->grab();
|
||||
QPixmap pix = m_plotWidget->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
@@ -163,16 +179,10 @@ QImage RimGridCrossPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::zoomAll()
|
||||
{
|
||||
if ( !m_qwtPlot ) return;
|
||||
setAutoScaleXEnabled( true );
|
||||
setAutoScaleYEnabled( true );
|
||||
|
||||
setAutoZoomForAllAxes( true );
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
|
||||
m_qwtPlot->replot();
|
||||
|
||||
updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -180,9 +190,9 @@ void RimGridCrossPlot::zoomAll()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
|
||||
{
|
||||
if ( m_qwtPlot )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_qwtPlot->replot();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,17 +201,17 @@ void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::reattachCurvesToQwtAndReplot()
|
||||
{
|
||||
if ( m_qwtPlot )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
dataSet->detachAllCurves();
|
||||
if ( dataSet->isChecked() )
|
||||
{
|
||||
dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
|
||||
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
|
||||
}
|
||||
}
|
||||
updateAxisDisplay();
|
||||
updateZoomInQwt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,68 +299,39 @@ void RimGridCrossPlot::detachAllCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisScaling()
|
||||
void RimGridCrossPlot::loadDataAndUpdate()
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisDisplay()
|
||||
void RimGridCrossPlot::setAutoScaleXEnabled( bool enabled )
|
||||
{
|
||||
if ( !m_qwtPlot ) return;
|
||||
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
|
||||
m_qwtPlot->updateAnnotationObjects( m_xAxisProperties );
|
||||
m_qwtPlot->updateAnnotationObjects( m_yAxisProperties );
|
||||
|
||||
m_qwtPlot->replot();
|
||||
m_xAxisProperties->setAutoZoom( enabled );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateZoomWindowFromQwt()
|
||||
void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled )
|
||||
{
|
||||
if ( !m_qwtPlot ) return;
|
||||
|
||||
updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
setAutoZoomForAllAxes( false );
|
||||
m_yAxisProperties->setAutoZoom( enabled );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::selectAxisInPropertyEditor( int axis )
|
||||
void RimGridCrossPlot::createPlotWidget()
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
if ( axis == QwtPlot::yLeft )
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( m_yAxisProperties );
|
||||
}
|
||||
else if ( axis == QwtPlot::xBottom )
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( m_xAxisProperties );
|
||||
}
|
||||
createViewWidget( nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::setAutoZoomForAllAxes( bool enableAutoZoom )
|
||||
{
|
||||
m_xAxisProperties->setAutoZoom( enableAutoZoom );
|
||||
m_yAxisProperties->setAutoZoom( enableAutoZoom );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const
|
||||
caf::PdmObject* RimGridCrossPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const
|
||||
{
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
@@ -365,23 +346,49 @@ caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve( const QwtPlotCu
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
RimPlotAxisProperties* properties = nullptr;
|
||||
if ( axis == QwtPlot::yLeft )
|
||||
{
|
||||
properties = m_yAxisProperties;
|
||||
}
|
||||
else if ( axis == QwtPlot::xBottom )
|
||||
{
|
||||
properties = m_xAxisProperties;
|
||||
}
|
||||
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( properties );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( properties );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( !m_qwtPlot )
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
m_qwtPlot = new RiuGridCrossQwtPlot( this, mainWindowParent );
|
||||
m_plotWidget = new RiuGridCrossQwtPlot( this, mainWindowParent );
|
||||
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
|
||||
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
|
||||
}
|
||||
m_qwtPlot->replot();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
|
||||
return m_qwtPlot;
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -390,10 +397,10 @@ QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
void RimGridCrossPlot::deleteViewWidget()
|
||||
{
|
||||
detachAllCurves();
|
||||
if ( m_qwtPlot )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_qwtPlot->deleteLater();
|
||||
m_qwtPlot = nullptr;
|
||||
m_plotWidget->deleteLater();
|
||||
m_plotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,8 +464,13 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_showLegend )
|
||||
{
|
||||
m_plotWidget->setLegendVisible( m_showLegend() );
|
||||
}
|
||||
if ( changedField == &m_legendFontSize )
|
||||
{
|
||||
m_plotWidget->setLegendFontSize( m_legendFontSize() );
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
dataSet->updateLegendIcons();
|
||||
@@ -501,39 +513,43 @@ void RimGridCrossPlot::performAutoNameUpdate()
|
||||
updateCurveNamesAndPlotTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxes()
|
||||
{
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
|
||||
m_plotWidget->updateAnnotationObjects( m_xAxisProperties );
|
||||
m_plotWidget->updateAnnotationObjects( m_yAxisProperties );
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updatePlot()
|
||||
{
|
||||
if ( m_qwtPlot )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( m_qwtPlot );
|
||||
RiuQwtPlotTools::setDefaultAxes( m_qwtPlot );
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget );
|
||||
RiuQwtPlotTools::setDefaultAxes( m_plotWidget );
|
||||
|
||||
updateAxisDisplay();
|
||||
updateAxes();
|
||||
|
||||
for ( auto dataSet : m_crossPlotDataSets )
|
||||
{
|
||||
dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
|
||||
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
|
||||
}
|
||||
|
||||
if ( m_showLegend() )
|
||||
{
|
||||
// Will be released in plot destructor or when a new legend is set
|
||||
QwtLegend* legend = new QwtLegend( m_qwtPlot );
|
||||
|
||||
auto font = legend->font();
|
||||
font.setPointSize( m_legendFontSize() );
|
||||
legend->setFont( font );
|
||||
m_qwtPlot->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlot->insertLegend( nullptr );
|
||||
}
|
||||
m_qwtPlot->updateLegendSizesToMatchPlot();
|
||||
m_qwtPlot->replot();
|
||||
m_plotWidget->setLegendVisible( m_showLegend() );
|
||||
m_plotWidget->setLegendFontSize( m_legendFontSize() );
|
||||
m_plotWidget->updateLegendSizesToMatchPlot();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,9 +563,9 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
|
||||
m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
|
||||
}
|
||||
|
||||
if ( m_qwtPlot )
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_qwtPlot->setTitle( this->createAutoName() );
|
||||
m_plotWidget->setTitle( this->createAutoName() );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
@@ -579,7 +595,7 @@ void RimGridCrossPlot::swapAxes()
|
||||
|
||||
loadDataAndUpdate();
|
||||
|
||||
updateAxisDisplay();
|
||||
updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -597,15 +613,16 @@ QString RimGridCrossPlot::asciiTitleForPlotExport( int dataSetIndex ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridCrossPlot::asciiDataForPlotExport( int dataSetIndex ) const
|
||||
QString RimGridCrossPlot::asciiDataForGridCrossPlotExport( int dataSetIndex ) const
|
||||
{
|
||||
if ( (size_t)dataSetIndex < m_crossPlotDataSets.size() )
|
||||
{
|
||||
QString asciiData;
|
||||
QTextStream stringStream( &asciiData );
|
||||
|
||||
RifEclipseDataTableFormatter formatter( stringStream );
|
||||
RifTextDataTableFormatter formatter( stringStream );
|
||||
formatter.setCommentPrefix( "" );
|
||||
formatter.setHeaderPrefix( "" );
|
||||
formatter.setTableRowPrependText( "" );
|
||||
formatter.setTableRowLineAppendText( "" );
|
||||
formatter.setColumnSpacing( 3 );
|
||||
@@ -620,14 +637,6 @@ QString RimGridCrossPlot::asciiDataForPlotExport( int dataSetIndex ) const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuGridCrossQwtPlot* RimGridCrossPlot::qwtPlot() const
|
||||
{
|
||||
return m_qwtPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -690,34 +699,66 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
|
||||
int fontSize,
|
||||
bool forceChange /*= false*/ )
|
||||
{
|
||||
if ( fontSettingType != RiaDefines::PLOT_FONT ) return false;
|
||||
|
||||
bool anyChange = false;
|
||||
for ( auto plotAxis : allPlotAxes() )
|
||||
if ( fontSettingType == RiaDefines::PLOT_FONT && m_plotWidget )
|
||||
{
|
||||
if ( forceChange || plotAxis->titleFontSize() == oldFontSize )
|
||||
for ( auto plotAxis : allPlotAxes() )
|
||||
{
|
||||
plotAxis->setTitleFontSize( fontSize );
|
||||
anyChange = true;
|
||||
if ( forceChange || plotAxis->titleFontSize() == oldFontSize )
|
||||
{
|
||||
plotAxis->setTitleFontSize( fontSize );
|
||||
anyChange = true;
|
||||
}
|
||||
if ( forceChange || plotAxis->valuesFontSize() == oldFontSize )
|
||||
{
|
||||
plotAxis->setValuesFontSize( fontSize );
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
if ( forceChange || plotAxis->valuesFontSize() == oldFontSize )
|
||||
|
||||
if ( forceChange || legendFontSize() == oldFontSize )
|
||||
{
|
||||
plotAxis->setValuesFontSize( fontSize );
|
||||
anyChange = true;
|
||||
m_legendFontSize = fontSize;
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
if ( anyChange ) loadDataAndUpdate();
|
||||
}
|
||||
|
||||
if ( forceChange || legendFontSize() == oldFontSize )
|
||||
{
|
||||
m_legendFontSize = fontSize;
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
if ( anyChange ) loadDataAndUpdate();
|
||||
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateLayout()
|
||||
{
|
||||
updatePlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateZoomInQwt()
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
m_plotWidget->updateAxes();
|
||||
updateZoomFromQwt();
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateZoomFromQwt()
|
||||
{
|
||||
updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
|
||||
updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -771,7 +812,7 @@ QString RimGridCrossPlot::yAxisParameterString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
||||
{
|
||||
if ( !m_qwtPlot ) return;
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
||||
QString axisParameterString = xAxisParameterString();
|
||||
@@ -786,17 +827,17 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
||||
|
||||
if ( axisProperties->isActive() )
|
||||
{
|
||||
m_qwtPlot->enableAxis( qwtAxisId, true );
|
||||
m_plotWidget->enableAxis( qwtAxisId, true );
|
||||
|
||||
QwtText axisTitle( axisParameterString );
|
||||
QFont titleFont = m_qwtPlot->axisTitle( qwtAxisId ).font();
|
||||
QFont titleFont = m_plotWidget->axisTitle( qwtAxisId ).font();
|
||||
titleFont.setBold( true );
|
||||
titleFont.setPointSize( axisProperties->titleFontSize() );
|
||||
axisTitle.setFont( titleFont );
|
||||
|
||||
QFont valuesFont = m_qwtPlot->axisFont( qwtAxisId );
|
||||
QFont valuesFont = m_plotWidget->axisFont( qwtAxisId );
|
||||
valuesFont.setPointSize( axisProperties->valuesFontSize() );
|
||||
m_qwtPlot->setAxisFont( qwtAxisId, valuesFont );
|
||||
m_plotWidget->setAxisFont( qwtAxisId, valuesFont );
|
||||
|
||||
switch ( axisProperties->titlePosition() )
|
||||
{
|
||||
@@ -808,16 +849,16 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
||||
break;
|
||||
}
|
||||
|
||||
m_qwtPlot->setAxisTitle( qwtAxisId, axisTitle );
|
||||
m_plotWidget->setAxisTitle( qwtAxisId, axisTitle );
|
||||
|
||||
if ( axisProperties->isLogarithmicScaleEnabled )
|
||||
{
|
||||
QwtLogScaleEngine* currentScaleEngine = dynamic_cast<QwtLogScaleEngine*>(
|
||||
m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
|
||||
m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
|
||||
if ( !currentScaleEngine )
|
||||
{
|
||||
m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine );
|
||||
m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 );
|
||||
m_plotWidget->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine );
|
||||
m_plotWidget->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 );
|
||||
}
|
||||
|
||||
if ( axisProperties->isAutoZoom() )
|
||||
@@ -832,38 +873,38 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
||||
std::swap( min, max );
|
||||
}
|
||||
|
||||
m_qwtPlot->setAxisScale( qwtAxisId, min, max );
|
||||
m_plotWidget->setAxisScale( qwtAxisId, min, max );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
|
||||
m_plotWidget->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QwtLinearScaleEngine* currentScaleEngine = dynamic_cast<QwtLinearScaleEngine*>(
|
||||
m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
|
||||
m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
|
||||
if ( !currentScaleEngine )
|
||||
{
|
||||
m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine );
|
||||
m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 );
|
||||
m_plotWidget->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine );
|
||||
m_plotWidget->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 );
|
||||
}
|
||||
|
||||
if ( axisProperties->isAutoZoom() )
|
||||
{
|
||||
m_qwtPlot->setAxisAutoScale( qwtAxisId );
|
||||
m_plotWidget->setAxisAutoScale( qwtAxisId );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
|
||||
m_plotWidget->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
|
||||
}
|
||||
}
|
||||
m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() )
|
||||
m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() )
|
||||
->setAttribute( QwtScaleEngine::Inverted, axisProperties->isAxisInverted() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlot->enableAxis( qwtAxisId, false );
|
||||
m_plotWidget->enableAxis( qwtAxisId, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,10 +913,10 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
|
||||
{
|
||||
CVF_ASSERT( m_qwtPlot );
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
QwtInterval xAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::xBottom );
|
||||
QwtInterval yAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::yLeft );
|
||||
QwtInterval xAxisRange = m_plotWidget->axisRange( QwtPlot::xBottom );
|
||||
QwtInterval yAxisRange = m_plotWidget->axisRange( QwtPlot::yLeft );
|
||||
|
||||
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
||||
QwtInterval axisRange = xAxisRange;
|
||||
@@ -951,7 +992,37 @@ void RimGridCrossPlot::setShowInfoBox( bool enable )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
|
||||
{
|
||||
return {m_xAxisProperties, m_yAxisProperties};
|
||||
return { m_xAxisProperties, m_yAxisProperties };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updatePlotTitle()
|
||||
{
|
||||
updateCurveNamesAndPlotTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->addOrUpdateDataSetLegend( dataSet );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSet )
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->removeDataSetLegend( dataSet );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimNameConfig.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
@@ -49,7 +49,7 @@ protected:
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
};
|
||||
|
||||
class RimGridCrossPlot : public RimPlot, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
|
||||
class RimGridCrossPlot : public RimPlotWindow, public RimPlotInterface, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -57,32 +57,36 @@ public:
|
||||
RimGridCrossPlot();
|
||||
~RimGridCrossPlot();
|
||||
|
||||
bool isChecked() const override;
|
||||
|
||||
RimGridCrossPlotDataSet* createDataSet();
|
||||
int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const;
|
||||
void addDataSet( RimGridCrossPlotDataSet* dataSet );
|
||||
|
||||
std::vector<RimGridCrossPlotDataSet*> dataSets() const;
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
void calculateZoomRangeAndUpdateQwt();
|
||||
void reattachCurvesToQwtAndReplot();
|
||||
QString createAutoName() const override;
|
||||
QWidget* viewWidget() override;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
void calculateZoomRangeAndUpdateQwt();
|
||||
void reattachCurvesToQwtAndReplot();
|
||||
QString createAutoName() const override;
|
||||
|
||||
bool showInfoBox() const;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void detachAllCurves();
|
||||
void detachAllCurves() override;
|
||||
void performAutoNameUpdate() override;
|
||||
void updateCurveNamesAndPlotTitle();
|
||||
void swapAxes();
|
||||
QString asciiTitleForPlotExport( int dataSetIndex ) const;
|
||||
QString asciiDataForPlotExport( int dataSetIndex ) const;
|
||||
RiuGridCrossQwtPlot* qwtPlot() const;
|
||||
bool isXAxisLogarithmic() const;
|
||||
bool isYAxisLogarithmic() const;
|
||||
void setYAxisInverted( bool inverted );
|
||||
int legendFontSize() const;
|
||||
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
|
||||
|
||||
bool isXAxisLogarithmic() const;
|
||||
bool isYAxisLogarithmic() const;
|
||||
void setYAxisInverted( bool inverted );
|
||||
int legendFontSize() const;
|
||||
|
||||
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
||||
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
@@ -90,14 +94,21 @@ public:
|
||||
int fontSize,
|
||||
bool forceChange = false ) override;
|
||||
|
||||
public:
|
||||
// Rim2dPlotInterface overrides
|
||||
void updateAxisScaling() override;
|
||||
void updateAxisDisplay() override;
|
||||
void updateZoomWindowFromQwt() override;
|
||||
void selectAxisInPropertyEditor( int axis ) override;
|
||||
void setAutoZoomForAllAxes( bool enableAutoZoom ) override;
|
||||
caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void updateLayout() override;
|
||||
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
void createPlotWidget() override;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
void addOrUpdateDataSetLegend( RimGridCrossPlotDataSet* dataSet );
|
||||
void removeDataSetLegend( RimGridCrossPlotDataSet* dataSet );
|
||||
|
||||
protected:
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
@@ -111,8 +122,8 @@ protected:
|
||||
const QVariant& newValue ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void updatePlot();
|
||||
void updateAxes() override;
|
||||
void updatePlot();
|
||||
|
||||
virtual QString xAxisParameterString() const;
|
||||
QString yAxisParameterString() const;
|
||||
@@ -129,6 +140,8 @@ protected:
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
void updatePlotTitle() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showInfoBox;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
@@ -140,5 +153,5 @@ private:
|
||||
|
||||
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
|
||||
|
||||
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
|
||||
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
|
||||
};
|
||||
|
||||
@@ -62,7 +62,6 @@ RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot()
|
||||
{
|
||||
RimGridCrossPlot* plot = new RimGridCrossPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
// plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size()));
|
||||
addGridCrossPlot( plot );
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RifEclipseDataTableFormatter.h"
|
||||
#include "RifTextDataTableFormatter.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigActiveCellsResultAccessor.h"
|
||||
@@ -943,10 +943,10 @@ QList<caf::PdmOptionItemInfo>
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_grouping )
|
||||
{
|
||||
std::set<RigGridCrossPlotCurveGrouping> validOptions = {NO_GROUPING,
|
||||
GROUP_BY_TIME,
|
||||
GROUP_BY_FORMATION,
|
||||
GROUP_BY_RESULT};
|
||||
std::set<RigGridCrossPlotCurveGrouping> validOptions = { NO_GROUPING,
|
||||
GROUP_BY_TIME,
|
||||
GROUP_BY_FORMATION,
|
||||
GROUP_BY_RESULT };
|
||||
if ( !hasMultipleTimeSteps() )
|
||||
{
|
||||
validOptions.erase( GROUP_BY_TIME );
|
||||
@@ -977,7 +977,7 @@ void RimGridCrossPlotDataSet::updateLegendRange()
|
||||
|
||||
RimGridCrossPlot* parent;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parent );
|
||||
if ( parent->qwtPlot() )
|
||||
if ( parent->viewer() )
|
||||
{
|
||||
if ( groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend() )
|
||||
{
|
||||
@@ -1020,11 +1020,11 @@ void RimGridCrossPlotDataSet::updateLegendRange()
|
||||
m_groupingProperty->updateLegendData( eclipseCase, m_timeStep() );
|
||||
}
|
||||
}
|
||||
parent->qwtPlot()->addOrUpdateDataSetLegend( this );
|
||||
parent->addOrUpdateDataSetLegend( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
parent->qwtPlot()->removeDataSetLegend( this );
|
||||
parent->removeDataSetLegend( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ void RimGridCrossPlotDataSet::swapAxisProperties( bool updatePlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotDataSet::exportFormattedData( RifEclipseDataTableFormatter& formatter ) const
|
||||
void RimGridCrossPlotDataSet::exportFormattedData( RifTextDataTableFormatter& formatter ) const
|
||||
{
|
||||
if ( m_groupedResults.empty() ) return;
|
||||
|
||||
@@ -1102,17 +1102,16 @@ void RimGridCrossPlotDataSet::exportFormattedData( RifEclipseDataTableFormatter&
|
||||
|
||||
if ( m_grouping != NO_GROUPING )
|
||||
{
|
||||
std::vector<RifEclipseOutputTableColumn> header = {RifEclipseOutputTableColumn( xTitle ),
|
||||
RifEclipseOutputTableColumn( yTitle ),
|
||||
RifEclipseOutputTableColumn( "Group Index" ),
|
||||
RifEclipseOutputTableColumn( "Group Description" )};
|
||||
std::vector<RifTextDataTableColumn> header = {RifTextDataTableColumn( xTitle ),
|
||||
RifTextDataTableColumn( yTitle ),
|
||||
RifTextDataTableColumn( "Group Index" ),
|
||||
RifTextDataTableColumn( "Group Description" )};
|
||||
|
||||
formatter.header( header );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RifEclipseOutputTableColumn> header = {RifEclipseOutputTableColumn( xTitle ),
|
||||
RifEclipseOutputTableColumn( yTitle )};
|
||||
std::vector<RifTextDataTableColumn> header = {RifTextDataTableColumn( xTitle ), RifTextDataTableColumn( yTitle )};
|
||||
formatter.header( header );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <QList>
|
||||
#include <map>
|
||||
|
||||
class RifEclipseDataTableFormatter;
|
||||
class RifTextDataTableFormatter;
|
||||
class RimCase;
|
||||
class RimGridCrossPlotCurve;
|
||||
class RimGridView;
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
bool groupingByCategoryResult() const;
|
||||
bool groupingEnabled() const;
|
||||
void swapAxisProperties( bool updatePlot );
|
||||
void exportFormattedData( RifEclipseDataTableFormatter& formatter ) const;
|
||||
void exportFormattedData( RifTextDataTableFormatter& formatter ) const;
|
||||
|
||||
bool isXAxisLogarithmic() const;
|
||||
bool isYAxisLogarithmic() const;
|
||||
|
||||
@@ -92,7 +92,6 @@ std::vector<RimSaturationPressurePlot*>
|
||||
{
|
||||
RimSaturationPressurePlot* plot = new RimSaturationPressurePlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
// As discussed with Liv Merete, it is not any use for creation of different plots for matrix/fracture. For
|
||||
// now, use hardcoded value for MATRIX
|
||||
|
||||
@@ -460,7 +460,7 @@ void Rim2dIntersectionView::setName( const QString& name )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim2dIntersectionView::isWindowVisible()
|
||||
bool Rim2dIntersectionView::isWindowVisible() const
|
||||
{
|
||||
return m_showWindow();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ protected:
|
||||
cvf::Transform* scaleTransform() override;
|
||||
void resetLegendsInViewer() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
bool isWindowVisible() override;
|
||||
bool isWindowVisible() const override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
|
||||
@@ -131,13 +131,6 @@ Rim3dView::Rim3dView( void )
|
||||
|
||||
CAF_PDM_InitField( &m_isComparisonViewEnabled, "EnableComparisonView", false, "Enable", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" );
|
||||
CAF_PDM_InitField( &m_isComparisonViewLinkingTimestep,
|
||||
"EnableComparisonViewTimestepLinking",
|
||||
true,
|
||||
"Link Timestep",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_crossSectionVizModel = new cvf::ModelBasicList;
|
||||
m_crossSectionVizModel->setName( "CrossSectionModel" );
|
||||
@@ -332,13 +325,13 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
|
||||
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" );
|
||||
gridGroup->add( &scaleZ );
|
||||
scaleZ.uiCapability()->setUiReadOnly( !this->isScaleZEditable() );
|
||||
gridGroup->add( &meshMode );
|
||||
gridGroup->add( &surfaceMode );
|
||||
|
||||
caf::PdmUiGroup* compViewGroup = uiOrdering.addNewGroup( "Comparison View" );
|
||||
compViewGroup->add( &m_isComparisonViewEnabled );
|
||||
compViewGroup->add( &m_comparisonView );
|
||||
compViewGroup->add( &m_isComparisonViewLinkingTimestep );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@@ -410,6 +403,15 @@ std::set<Rim3dView*> Rim3dView::viewsUsingThisAsComparisonView()
|
||||
return containingViews;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim3dView::isScaleZEditable()
|
||||
{
|
||||
return ( this->viewsUsingThisAsComparisonView().empty() ||
|
||||
( this->viewController() && this->viewController()->isCameraLinked() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -497,7 +499,7 @@ void Rim3dView::updateCurrentTimeStepAndRedraw()
|
||||
}
|
||||
|
||||
std::set<Rim3dView*> containerViews = this->viewsUsingThisAsComparisonView();
|
||||
if ( !containerViews.empty() && !isUsingOverrideViewer())
|
||||
if ( !containerViews.empty() && !isUsingOverrideViewer() )
|
||||
{
|
||||
for ( auto view : containerViews )
|
||||
{
|
||||
@@ -815,13 +817,7 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_isComparisonViewLinkingTimestep )
|
||||
{
|
||||
if ( m_isComparisonViewEnabled() && m_comparisonView() )
|
||||
{
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -912,19 +908,6 @@ void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* wellPathModelBasicLi
|
||||
wellPathModelBasicList->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
|
||||
{
|
||||
this->scaleZ = scalingFactor;
|
||||
updateScaleTransform();
|
||||
|
||||
this->updateGridBoxData();
|
||||
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -986,6 +969,16 @@ void Rim3dView::updateAnnotationItems()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dView::setScaleZAndUpdate( double scalingFactor )
|
||||
{
|
||||
this->scaleZ = scalingFactor;
|
||||
|
||||
updateScaling();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1006,14 +999,18 @@ void Rim3dView::updateScaling()
|
||||
|
||||
viewer()->mainCamera()->setFromLookAt( eye, eye + dir, up );
|
||||
viewer()->setPointOfInterest( poi );
|
||||
|
||||
updateScaleTransform();
|
||||
createDisplayModelAndRedraw();
|
||||
|
||||
viewer()->update();
|
||||
|
||||
updateZScaleLabel();
|
||||
}
|
||||
|
||||
if (activeComparisonView())
|
||||
{
|
||||
activeComparisonView()->setScaleZAndUpdate(scaleZ);
|
||||
}
|
||||
|
||||
updateScaleTransform();
|
||||
updateGridBoxData();
|
||||
updateZScaleLabel();
|
||||
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1023,7 +1020,8 @@ void Rim3dView::updateZScaleLabel()
|
||||
{
|
||||
// Update Z scale label
|
||||
int scale = static_cast<int>( scaleZ() );
|
||||
nativeOrOverrideViewer()->setZScale( scale );
|
||||
|
||||
if ( viewer() ) viewer()->setZScale( scale );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1045,6 +1043,12 @@ void Rim3dView::createHighlightAndGridBoxDisplayModelWithRedraw()
|
||||
{
|
||||
createHighlightAndGridBoxDisplayModel();
|
||||
|
||||
if ( Rim3dView* depView = prepareComparisonView() )
|
||||
{
|
||||
depView->createHighlightAndGridBoxDisplayModel();
|
||||
restoreComparisonView();
|
||||
}
|
||||
|
||||
if ( nativeOrOverrideViewer() )
|
||||
{
|
||||
nativeOrOverrideViewer()->update();
|
||||
@@ -1419,12 +1423,11 @@ Rim3dView* Rim3dView::prepareComparisonView()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_comparisonViewOrgTimestep = depView->currentTimeStep();
|
||||
depView->m_currentTimeStep = currentTimeStep();
|
||||
depView->clampCurrentTimestep();
|
||||
|
||||
m_comparisonViewOrgZScale = depView->scaleZ();
|
||||
depView->scaleZ = scaleZ();
|
||||
if ( depView->scaleZ() != scaleZ() )
|
||||
{
|
||||
depView->setScaleZAndUpdate( scaleZ() );
|
||||
}
|
||||
|
||||
viewer()->setComparisonViewEyePointOffset( RimViewManipulator::calculateEquivalentCamPosOffset( this, depView ) );
|
||||
|
||||
@@ -1442,6 +1445,6 @@ void Rim3dView::restoreComparisonView()
|
||||
CVF_ASSERT( depView );
|
||||
|
||||
depView->setOverrideViewer( nullptr );
|
||||
depView->m_currentTimeStep = m_comparisonViewOrgTimestep;
|
||||
depView->scaleZ = m_comparisonViewOrgZScale;
|
||||
viewer()->setCurrentComparisonFrame(depView->currentTimeStep());
|
||||
|
||||
}
|
||||
|
||||
@@ -163,7 +163,11 @@ public:
|
||||
void updateZScaleLabel();
|
||||
void updateMeasurement();
|
||||
|
||||
bool isMasterView() const;
|
||||
bool isMasterView() const;
|
||||
Rim3dView* activeComparisonView() const;
|
||||
bool isScaleZEditable();
|
||||
|
||||
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
|
||||
|
||||
@@ -296,9 +300,7 @@ private:
|
||||
|
||||
// Pure private methods : Override viewer and comparison view
|
||||
|
||||
void setOverrideViewer( RiuViewer* overrideViewer );
|
||||
Rim3dView* activeComparisonView() const;
|
||||
std::set<Rim3dView*> viewsUsingThisAsComparisonView();
|
||||
void setOverrideViewer( RiuViewer* overrideViewer );
|
||||
|
||||
Rim3dView* prepareComparisonView();
|
||||
void restoreComparisonView();
|
||||
@@ -319,5 +321,4 @@ private:
|
||||
caf::PdmField<bool> m_showZScaleLabel;
|
||||
caf::PdmField<bool> m_isComparisonViewEnabled;
|
||||
caf::PdmPtrField<Rim3dView*> m_comparisonView;
|
||||
caf::PdmField<bool> m_isComparisonViewLinkingTimestep;
|
||||
};
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimEclipseContourMapViewCollection.h"
|
||||
#include "RimEclipseInputProperty.h"
|
||||
#include "RimEclipseInputPropertyCollection.h"
|
||||
@@ -61,6 +62,7 @@
|
||||
#include "RimFractureTemplate.h"
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include "RimGeoMechContourMapViewCollection.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
@@ -174,6 +176,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "RicExportContourMapToTextFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseView*>( uiItem ) )
|
||||
{
|
||||
@@ -186,6 +189,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "RicExportEclipseInputGridFeature";
|
||||
menuBuilder << "RicExportContourMapToTextFeature";
|
||||
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseContourMapViewCollection*>( uiItem ) )
|
||||
|
||||
@@ -243,6 +243,34 @@ QString RimContourMapProjection::resultAggregationText() const
|
||||
return m_resultAggregation().uiText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimContourMapProjection::caseName() const
|
||||
{
|
||||
RimCase* rimCase = baseView()->ownerCase();
|
||||
if ( !rimCase )
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
return rimCase->caseUserDescription.value();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimContourMapProjection::currentTimeStepName() const
|
||||
{
|
||||
RimCase* rimCase = baseView()->ownerCase();
|
||||
if ( !rimCase || m_currentResultTimestep == -1 )
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
return rimCase->timeStepName( m_currentResultTimestep );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1606,7 +1634,7 @@ cvf::Vec2d RimContourMapProjection::origin2d() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// Vertex positions in local coordinates (add origin2d.x() for UTM x)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimContourMapProjection::xVertexPositions() const
|
||||
{
|
||||
@@ -1624,7 +1652,7 @@ std::vector<double> RimContourMapProjection::xVertexPositions() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// Vertex positions in local coordinates (add origin2d.y() for UTM y)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimContourMapProjection::yVertexPositions() const
|
||||
{
|
||||
|
||||
@@ -89,6 +89,9 @@ public:
|
||||
|
||||
QString resultAggregationText() const;
|
||||
|
||||
QString caseName() const;
|
||||
QString currentTimeStepName() const;
|
||||
|
||||
double maxValue() const;
|
||||
double minValue() const;
|
||||
|
||||
@@ -110,6 +113,9 @@ public:
|
||||
void setPickPoint( cvf::Vec2d globalPickPoint );
|
||||
cvf::Vec3d origin3d() const;
|
||||
|
||||
std::vector<double> xVertexPositions() const;
|
||||
std::vector<double> yVertexPositions() const;
|
||||
|
||||
// Pure-virtual public methods which should be overridden by Eclipse and Geo-mechanical contour map implementations
|
||||
virtual QString resultDescriptionText() const = 0;
|
||||
virtual RimRegularLegendConfig* legendConfig() const = 0;
|
||||
@@ -190,9 +196,6 @@ protected:
|
||||
cvf::Vec2d cellCenterPosition( uint i, uint j ) const;
|
||||
cvf::Vec2d origin2d() const;
|
||||
|
||||
std::vector<double> xVertexPositions() const;
|
||||
std::vector<double> yVertexPositions() const;
|
||||
|
||||
cvf::Vec2ui calculateMapSize() const;
|
||||
double gridEdgeOffset() const;
|
||||
|
||||
|
||||
@@ -275,7 +275,6 @@ void RimEclipseCase::initAfterRead()
|
||||
RimEclipseView* RimEclipseCase::createAndAddReservoirView()
|
||||
{
|
||||
RimEclipseView* rimEclipseView = new RimEclipseView();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( rimEclipseView );
|
||||
|
||||
rimEclipseView->setEclipseCase( this );
|
||||
|
||||
@@ -312,7 +311,6 @@ RimEclipseView* RimEclipseCase::createCopyAndAddView( const RimEclipseView* sour
|
||||
RimEclipseView* rimEclipseView = dynamic_cast<RimEclipseView*>(
|
||||
sourceView->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( rimEclipseView );
|
||||
RiaApplication::instance()->project()->assignViewIdToView( rimEclipseView );
|
||||
rimEclipseView->setEclipseCase( this );
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( rimEclipseView );
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include "RimTimeStepFilter.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmSettings.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
@@ -294,7 +294,7 @@ void RimEclipseView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
Rim3dView::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
RimGridView::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showInvalidCells )
|
||||
{
|
||||
@@ -1169,16 +1169,12 @@ void RimEclipseView::updateLegends()
|
||||
}
|
||||
else
|
||||
{
|
||||
nativeOrOverrideViewer()->removeColorLegend( this->cellEdgeResult()->legendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend( fractureColors()->activeLegend()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend(
|
||||
m_virtualPerforationResult->legendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend( this->cellResult()->legendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend( this->cellResult()->ternaryLegendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend(
|
||||
this->currentFaultResultColors()->legendConfig()->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend(
|
||||
this->currentFaultResultColors()->ternaryLegendConfig()->titledOverlayFrame() );
|
||||
std::vector<RimLegendConfig*> legendConfs = this->legendConfigs();
|
||||
|
||||
for (auto legendConf : legendConfs)
|
||||
{
|
||||
nativeOrOverrideViewer()->removeColorLegend(legendConf->titledOverlayFrame());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RimCase.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafAssert.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
@@ -113,6 +114,7 @@ void RimFormationNames::updateConnectedViews()
|
||||
std::vector<RimCase*> objects;
|
||||
this->objectsWithReferringPtrFieldsOfType( objects );
|
||||
|
||||
bool updatedTracks = false;
|
||||
for ( RimCase* caseObj : objects )
|
||||
{
|
||||
if ( caseObj )
|
||||
@@ -126,11 +128,13 @@ void RimFormationNames::updateConnectedViews()
|
||||
// The track may be referring to the case for other reasons than formations.
|
||||
if ( track->formationNamesCase() == caseObj )
|
||||
{
|
||||
track->loadDataAndUpdate( true );
|
||||
track->loadDataAndUpdate();
|
||||
updatedTracks = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -198,7 +198,6 @@ void RimGeoMechCase::reloadDataAndUpdate()
|
||||
RimGeoMechView* RimGeoMechCase::createAndAddReservoirView()
|
||||
{
|
||||
RimGeoMechView* gmv = new RimGeoMechView();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( gmv );
|
||||
|
||||
gmv->setGeoMechCase( this );
|
||||
|
||||
@@ -215,7 +214,6 @@ RimGeoMechView* RimGeoMechCase::createCopyAndAddView( const RimGeoMechView* sour
|
||||
sourceView->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( rimGeoMechView );
|
||||
|
||||
RiaApplication::instance()->project()->assignViewIdToView( rimGeoMechView );
|
||||
rimGeoMechView->setGeoMechCase( this );
|
||||
|
||||
caf::PdmDocument::updateUiIconStateRecursively( rimGeoMechView );
|
||||
|
||||
@@ -440,8 +440,12 @@ void RimGeoMechView::updateLegends()
|
||||
}
|
||||
else
|
||||
{
|
||||
nativeOrOverrideViewer()->removeColorLegend( cellResult()->legendConfig->titledOverlayFrame() );
|
||||
nativeOrOverrideViewer()->removeColorLegend( m_tensorResults->arrowColorLegendConfig->titledOverlayFrame() );
|
||||
std::vector<RimLegendConfig*> legendConfs = this->legendConfigs();
|
||||
|
||||
for (auto legendConf : legendConfs)
|
||||
{
|
||||
nativeOrOverrideViewer()->removeColorLegend(legendConf->titledOverlayFrame());
|
||||
}
|
||||
}
|
||||
|
||||
this->updateLegendTextAndRanges( cellResult()->legendConfig(), m_currentTimeStep() );
|
||||
@@ -752,7 +756,7 @@ void RimGeoMechView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
Rim3dView::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
RimGridView::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
608
ApplicationCode/ProjectDataModel/RimGridPlotWindow.cpp
Normal file
608
ApplicationCode/ProjectDataModel/RimGridPlotWindow.cpp
Normal file
@@ -0,0 +1,608 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimGridPlotWindow.h"
|
||||
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <cvfAssert.h>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void RimGridPlotWindow::ColumnCountEnum::setUp()
|
||||
{
|
||||
addItem( RimGridPlotWindow::COLUMNS_1, "1", "1 Column" );
|
||||
addItem( RimGridPlotWindow::COLUMNS_2, "2", "2 Columns" );
|
||||
addItem( RimGridPlotWindow::COLUMNS_3, "3", "3 Columns" );
|
||||
addItem( RimGridPlotWindow::COLUMNS_4, "4", "4 Columns" );
|
||||
addItem( RimGridPlotWindow::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
|
||||
setDefault( RimGridPlotWindow::COLUMNS_UNLIMITED );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridPlotWindow, "GridPlotWindow" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridPlotWindow::RimGridPlotWindow()
|
||||
{
|
||||
CAF_PDM_InitObject( "Grid Plot Window", ":/WellLogPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCountEnum, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridPlotWindow::~RimGridPlotWindow()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
m_plots.deleteAllChildObjects();
|
||||
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Move-assignment operator. Argument has to be passed with std::move()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridPlotWindow& RimGridPlotWindow::operator=( RimGridPlotWindow&& rhs )
|
||||
{
|
||||
RimPlotWindow::operator=( std::move( rhs ) );
|
||||
|
||||
// Move all tracks
|
||||
std::vector<caf::PdmObject*> plots = rhs.m_plots.childObjects();
|
||||
rhs.m_plots.clear();
|
||||
for ( caf::PdmObject* plot : plots )
|
||||
{
|
||||
CAF_ASSERT( dynamic_cast<RimPlotInterface*>( plot ) );
|
||||
m_plots.push_back( plot );
|
||||
}
|
||||
|
||||
m_columnCountEnum = rhs.m_columnCountEnum;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimGridPlotWindow::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::addPlot( RimPlotInterface* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::insertPlot( RimPlotInterface* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
m_plots.insert( index, toPdmObjectAsserted( plot ) );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::removePlot( RimPlotInterface* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removePlot( plot->viewer() );
|
||||
}
|
||||
m_plots.removeChildObject( toPdmObjectAsserted( plot ) );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimGridPlotWindow::plotCount() const
|
||||
{
|
||||
return m_plots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimGridPlotWindow::plotIndex( const RimPlotInterface* plot ) const
|
||||
{
|
||||
return m_plots.index( toPdmObjectAsserted( plot ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotInterface* RimGridPlotWindow::plotByIndex( size_t index ) const
|
||||
{
|
||||
return toPlotInterfaceAsserted( m_plots[index] );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotInterface*> RimGridPlotWindow::plots() const
|
||||
{
|
||||
std::vector<RimPlotInterface*> allPlots;
|
||||
allPlots.reserve( m_plots.size() );
|
||||
|
||||
for ( caf::PdmObject* pdmObject : m_plots )
|
||||
{
|
||||
allPlots.push_back( toPlotInterfaceAsserted( pdmObject ) );
|
||||
}
|
||||
return allPlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotInterface*> RimGridPlotWindow::visiblePlots() const
|
||||
{
|
||||
std::vector<RimPlotInterface*> allPlots;
|
||||
for ( caf::PdmObject* pdmObject : m_plots() )
|
||||
{
|
||||
RimPlotInterface* plot = toPlotInterfaceAsserted( pdmObject );
|
||||
if ( plot->isChecked() )
|
||||
{
|
||||
allPlots.push_back( plot );
|
||||
}
|
||||
}
|
||||
return allPlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::updateLayout()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
{
|
||||
m_viewer->scheduleUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Empty default implementation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::updatePlotNames() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::updatePlotOrderFromGridWidget()
|
||||
{
|
||||
std::sort( m_plots.begin(), m_plots.end(), [this]( caf::PdmObject* lhs, caf::PdmObject* rhs ) {
|
||||
auto indexLhs = m_viewer->indexOfPlotWidget( toPlotInterfaceAsserted( lhs )->viewer() );
|
||||
auto indexRhs = m_viewer->indexOfPlotWidget( toPlotInterfaceAsserted( rhs )->viewer() );
|
||||
return indexLhs < indexRhs;
|
||||
} );
|
||||
updatePlotNames();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::setAutoScaleXEnabled( bool enabled )
|
||||
{
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
plot->setAutoScaleXEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::setAutoScaleYEnabled( bool enabled )
|
||||
{
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
plot->setAutoScaleYEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimGridPlotWindow::columnCount() const
|
||||
{
|
||||
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
|
||||
{
|
||||
return static_cast<int>( visiblePlots().size() );
|
||||
}
|
||||
return static_cast<int>( m_columnCountEnum() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimGridPlotWindow::columnCountField()
|
||||
{
|
||||
return &m_columnCountEnum;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::zoomAll()
|
||||
{
|
||||
setAutoScaleXEnabled( true );
|
||||
setAutoScaleYEnabled( true );
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmUiGroup* RimGridPlotWindow::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* titleAndLegendsGroup = RimPlotWindow::createPlotSettingsUiGroup( uiOrdering );
|
||||
titleAndLegendsGroup->add( &m_columnCountEnum );
|
||||
return titleAndLegendsGroup;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridPlotWindow::asciiDataForPlotExport() const
|
||||
{
|
||||
QString out = description() + "\n";
|
||||
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
if ( plot->isChecked() )
|
||||
{
|
||||
out += plot->asciiDataForPlotExport();
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::onPlotAdditionOrRemoval()
|
||||
{
|
||||
updatePlotNames();
|
||||
updateConnectedEditors();
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimGridPlotWindow::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setScrollbarVisible( false );
|
||||
m_viewer->setSelectionsVisible( false );
|
||||
QPixmap pix = m_viewer->grab();
|
||||
image = pix.toImage();
|
||||
m_viewer->setScrollbarVisible( true );
|
||||
m_viewer->setSelectionsVisible( true );
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimGridPlotWindow::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_viewer = new RiuGridPlotWindow( this, mainWindowParent );
|
||||
recreatePlotWidgets();
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::deleteViewWidget()
|
||||
{
|
||||
detachAllCurves();
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->deleteLater();
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_columnCountEnum )
|
||||
{
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
createPlotSettingsUiGroup( uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimGridPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_columnCountEnum )
|
||||
{
|
||||
for ( size_t i = 0; i < ColumnCountEnum::size(); ++i )
|
||||
{
|
||||
ColumnCount enumVal = ColumnCountEnum::fromIndex( i );
|
||||
if ( enumVal == COLUMNS_UNLIMITED )
|
||||
{
|
||||
QString iconPath( ":/ColumnsUnlimited.png" );
|
||||
options.push_back( caf::PdmOptionItemInfo( ColumnCountEnum::uiText( enumVal ),
|
||||
enumVal,
|
||||
false,
|
||||
caf::QIconProvider( iconPath ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
QString iconPath = QString( ":/Columns%1.png" ).arg( static_cast<int>( enumVal ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( ColumnCountEnum::uiText( enumVal ),
|
||||
enumVal,
|
||||
false,
|
||||
caf::QIconProvider( iconPath ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
setPlotTitleInWidget( this->fullPlotTitle() );
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::initAfterRead()
|
||||
{
|
||||
RimPlotWindow::initAfterRead();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::updatePlotTitle()
|
||||
{
|
||||
m_viewer->setTitleVisible( m_showTitleInPlot() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::setPlotTitleInWidget( const QString& title )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setPlotTitle( title );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::updatePlots()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
{
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
this->updateZoom();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::updateZoom()
|
||||
{
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
auto plotVector = plots();
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
plotVector[tIdx]->createPlotWidget();
|
||||
m_viewer->addPlot( plotVector[tIdx]->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridPlotWindow::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
|
||||
{
|
||||
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
|
||||
{
|
||||
if ( m_viewer->fontSize() != defaultFontSize )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for ( const RimPlotInterface* plot : plots() )
|
||||
{
|
||||
if ( plot->hasCustomFontSizes( fontSettingType, defaultFontSize ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridPlotWindow::applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false */ )
|
||||
{
|
||||
bool somethingChanged = false;
|
||||
if ( fontSettingType == RiaDefines::PLOT_FONT && m_viewer )
|
||||
{
|
||||
if ( oldFontSize == m_viewer->fontSize() || forceChange )
|
||||
{
|
||||
m_viewer->setFontSize( fontSize );
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
if ( plot->applyFontSize( fontSettingType, oldFontSize, fontSize, forceChange ) )
|
||||
{
|
||||
somethingChanged = true;
|
||||
}
|
||||
}
|
||||
if ( somethingChanged )
|
||||
{
|
||||
m_viewer->scheduleUpdate();
|
||||
}
|
||||
}
|
||||
return somethingChanged;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridPlotWindow::detachAllCurves()
|
||||
{
|
||||
auto plotVector = plots();
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
plotVector[tIdx]->detachAllCurves();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotInterface* RimGridPlotWindow::toPlotInterfaceAsserted( caf::PdmObject* pdmObject )
|
||||
{
|
||||
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( pdmObject );
|
||||
CAF_ASSERT( plotInterface );
|
||||
return plotInterface;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimPlotInterface* RimGridPlotWindow::toPlotInterfaceAsserted( const caf::PdmObject* pdmObject )
|
||||
{
|
||||
const RimPlotInterface* plotInterface = dynamic_cast<const RimPlotInterface*>( pdmObject );
|
||||
CAF_ASSERT( plotInterface );
|
||||
return plotInterface;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimGridPlotWindow::toPdmObjectAsserted( RimPlotInterface* plotInterface )
|
||||
{
|
||||
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plotInterface );
|
||||
CAF_ASSERT( pdmObject );
|
||||
return pdmObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::PdmObject* RimGridPlotWindow::toPdmObjectAsserted( const RimPlotInterface* plotInterface )
|
||||
{
|
||||
const caf::PdmObject* pdmObject = dynamic_cast<const caf::PdmObject*>( plotInterface );
|
||||
CAF_ASSERT( pdmObject );
|
||||
return pdmObject;
|
||||
}
|
||||
130
ApplicationCode/ProjectDataModel/RimGridPlotWindow.h
Normal file
130
ApplicationCode/ProjectDataModel/RimGridPlotWindow.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimPlotWindow.h"
|
||||
#include "RiuGridPlotWindow.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
|
||||
class RimPlotInterface;
|
||||
|
||||
class RimGridPlotWindow : public RimPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum ColumnCount
|
||||
{
|
||||
COLUMNS_1 = 1,
|
||||
COLUMNS_2 = 2,
|
||||
COLUMNS_3 = 3,
|
||||
COLUMNS_4 = 4,
|
||||
COLUMNS_UNLIMITED = 1000,
|
||||
};
|
||||
typedef caf::AppEnum<ColumnCount> ColumnCountEnum;
|
||||
|
||||
public:
|
||||
RimGridPlotWindow();
|
||||
~RimGridPlotWindow();
|
||||
|
||||
RimGridPlotWindow& operator=( RimGridPlotWindow&& rhs );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
|
||||
void addPlot( RimPlotInterface* plot );
|
||||
void insertPlot( RimPlotInterface* plot, size_t index );
|
||||
void removePlot( RimPlotInterface* plot );
|
||||
|
||||
size_t plotCount() const;
|
||||
size_t plotIndex( const RimPlotInterface* plot ) const;
|
||||
RimPlotInterface* plotByIndex( size_t index ) const;
|
||||
|
||||
std::vector<RimPlotInterface*> plots() const;
|
||||
std::vector<RimPlotInterface*> visiblePlots() const;
|
||||
|
||||
void updateLayout() override;
|
||||
virtual void updatePlotNames();
|
||||
void updatePlotOrderFromGridWidget();
|
||||
|
||||
virtual void setAutoScaleXEnabled( bool enabled );
|
||||
virtual void setAutoScaleYEnabled( bool enabled );
|
||||
|
||||
int columnCount() const;
|
||||
caf::PdmFieldHandle* columnCountField();
|
||||
|
||||
void zoomAll() override;
|
||||
|
||||
caf::PdmUiGroup* createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
QString asciiDataForPlotExport() const;
|
||||
|
||||
virtual void onPlotAdditionOrRemoval();
|
||||
|
||||
protected:
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
|
||||
void updatePlotTitle() override;
|
||||
void setPlotTitleInWidget( const QString& plotTitle );
|
||||
void updatePlots();
|
||||
virtual void updateZoom();
|
||||
void recreatePlotWidgets();
|
||||
|
||||
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
||||
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange = false ) override;
|
||||
|
||||
private:
|
||||
void detachAllCurves() override;
|
||||
|
||||
static RimPlotInterface* toPlotInterfaceAsserted( caf::PdmObject* pdmObject );
|
||||
static const RimPlotInterface* toPlotInterfaceAsserted( const caf::PdmObject* pdmObject );
|
||||
static caf::PdmObject* toPdmObjectAsserted( RimPlotInterface* plotInterface );
|
||||
static const caf::PdmObject* toPdmObjectAsserted( const RimPlotInterface* plotInterface );
|
||||
|
||||
protected:
|
||||
caf::PdmField<ColumnCountEnum> m_columnCountEnum;
|
||||
|
||||
friend class RiuGridPlotWindow;
|
||||
QPointer<RiuGridPlotWindow> m_viewer;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<caf::PdmObject*> m_plots;
|
||||
};
|
||||
@@ -44,8 +44,8 @@
|
||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"
|
||||
#include "qwt_plot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGridTimeHistoryCurve, "GridTimeHistoryCurve" );
|
||||
|
||||
@@ -336,7 +336,7 @@ QString RimGridTimeHistoryCurve::caseName() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RimGridTimeHistoryCurve::gridCase() const
|
||||
{
|
||||
|
||||
@@ -418,14 +418,6 @@ void RimGridView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
viewLinker->updateCamera( this );
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_currentTimeStep )
|
||||
{
|
||||
RimViewLinker* viewLinker = this->assosiatedViewLinker();
|
||||
if ( viewLinker )
|
||||
{
|
||||
viewLinker->updateTimeStep( this, m_currentTimeStep );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -255,7 +255,7 @@ void RimIntersectionCollection::appendIntersectionBoxAndUpdate( RimIntersectionB
|
||||
m_intersectionBoxes.push_back( intersectionBox );
|
||||
|
||||
updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox );
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox, false );
|
||||
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfType( rimView );
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RiaCompletionTypeCalculationScheduler.h"
|
||||
#include "RifEclipseDataTableFormatter.h"
|
||||
#include "RifTextDataTableFormatter.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimWellPath.h"
|
||||
@@ -120,12 +120,12 @@ QString RimModeledWellPath::wellPlanText()
|
||||
QString planText;
|
||||
QTextStream qtxtStream( &planText );
|
||||
|
||||
RifEclipseDataTableFormatter formatter( qtxtStream );
|
||||
RifTextDataTableFormatter formatter( qtxtStream );
|
||||
formatter.setUnlimitedDataRowWidth();
|
||||
formatter.setTableRowPrependText( "" );
|
||||
formatter.setTableRowLineAppendText( "" );
|
||||
|
||||
std::vector<RifEclipseOutputTableColumn> tableHeader;
|
||||
std::vector<RifTextDataTableColumn> tableHeader;
|
||||
tableHeader.push_back( {"MDRKB"} );
|
||||
tableHeader.push_back( {"CL"} );
|
||||
tableHeader.push_back( {"Inc"} );
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimPlot.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlot, "RimPlot" ); // Do not use. Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlot::RimPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimPlot::createPlotWidget()
|
||||
{
|
||||
return createViewWidget( nullptr );
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimNameConfig.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
class RimPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlot();
|
||||
|
||||
QWidget* createPlotWidget();
|
||||
};
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
@@ -158,11 +158,11 @@ void RimPlotAxisAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimRiuQwtPlotOwnerInterface* parentPlot = nullptr;
|
||||
RimPlotInterface* parentPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( parentPlot );
|
||||
if ( parentPlot )
|
||||
{
|
||||
parentPlot->updateAxisDisplay();
|
||||
parentPlot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "RigStatisticsCalculator.h"
|
||||
|
||||
#include "RimPlotAxisAnnotation.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimPlotInterface.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
|
||||
@@ -416,17 +416,17 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
|
||||
RimRiuQwtPlotOwnerInterface* parentPlot = nullptr;
|
||||
RimPlotInterface* parentPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( parentPlot );
|
||||
if ( parentPlot )
|
||||
{
|
||||
if ( changedField == &isLogarithmicScaleEnabled )
|
||||
{
|
||||
parentPlot->updateAxisScaling();
|
||||
parentPlot->loadDataAndUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
parentPlot->updateAxisDisplay();
|
||||
parentPlot->updateAxes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
ApplicationCode/ProjectDataModel/RimPlotInterface.cpp
Normal file
30
ApplicationCode/ProjectDataModel/RimPlotInterface.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "RimPlotInterface.h"
|
||||
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#define RI_PLOT_MIN_DEFAULT -10.0
|
||||
#define RI_PLOT_MAX_DEFAULT 100.0
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void RimPlotInterface::WidthScaleFactorEnum::setUp()
|
||||
{
|
||||
addItem( RimPlotInterface::EXTRA_NARROW, "EXTRA_NARROW_TRACK", "Extra Narrow" );
|
||||
addItem( RimPlotInterface::NARROW, "NARROW_TRACK", "Narrow" );
|
||||
addItem( RimPlotInterface::NORMAL, "NORMAL_TRACK", "Normal" );
|
||||
addItem( RimPlotInterface::WIDE, "WIDE_TRACK", "Wide" );
|
||||
addItem( RimPlotInterface::EXTRA_WIDE, "EXTRA_WIDE_TRACK", "Extra wide" );
|
||||
setDefault( RimPlotInterface::NORMAL );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotInterface::asciiDataForPlotExport() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
87
ApplicationCode/ProjectDataModel/RimPlotInterface.h
Normal file
87
ApplicationCode/ProjectDataModel/RimPlotInterface.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RiaDefines.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RiuQwtPlotWidget;
|
||||
class RimPlotCurve;
|
||||
class QwtPlotCurve;
|
||||
|
||||
class RimPlotInterface
|
||||
{
|
||||
public:
|
||||
enum WidthScaleFactor
|
||||
{
|
||||
EXTRA_NARROW = 3,
|
||||
NARROW = 4,
|
||||
NORMAL = 5,
|
||||
WIDE = 7,
|
||||
EXTRA_WIDE = 10
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
|
||||
|
||||
public:
|
||||
virtual RiuQwtPlotWidget* viewer() = 0;
|
||||
virtual bool isChecked() const = 0;
|
||||
|
||||
RimPlotInterface() = default;
|
||||
virtual ~RimPlotInterface() = default;
|
||||
|
||||
virtual int widthScaleFactor() const
|
||||
{
|
||||
return NORMAL;
|
||||
}
|
||||
virtual void setWidthScaleFactor( WidthScaleFactor scaleFactor ) {}
|
||||
|
||||
virtual bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const = 0;
|
||||
virtual bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange = false ) = 0;
|
||||
|
||||
virtual void setAutoScaleXEnabled( bool enabled ) = 0;
|
||||
virtual void setAutoScaleYEnabled( bool enabled ) = 0;
|
||||
virtual void updateAxes() = 0;
|
||||
|
||||
virtual void updateZoomInQwt() = 0;
|
||||
virtual void updateZoomFromQwt() = 0;
|
||||
|
||||
virtual QString asciiDataForPlotExport() const;
|
||||
|
||||
virtual void createPlotWidget() = 0;
|
||||
virtual void detachAllCurves() = 0;
|
||||
|
||||
virtual caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const = 0;
|
||||
|
||||
virtual void loadDataAndUpdate() = 0;
|
||||
|
||||
virtual void onAxisSelected( int axis, bool toggle ) {}
|
||||
|
||||
protected:
|
||||
virtual void updatePlotWindowLayout() {}
|
||||
virtual void onWidthScaleFactorChange() {}
|
||||
};
|
||||
173
ApplicationCode/ProjectDataModel/RimPlotWindow.cpp
Normal file
173
ApplicationCode/ProjectDataModel/RimPlotWindow.cpp
Normal file
@@ -0,0 +1,173 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotWindow::RimPlotWindow()
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_description, "PlotDescription", QString( "" ), "Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
|
||||
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", false, "Legend Orientation", "", "", "" );
|
||||
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotWindow::~RimPlotWindow() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
|
||||
{
|
||||
m_showTitleInPlot = rhs.m_showTitleInPlot();
|
||||
m_showPlotLegends = rhs.m_showPlotLegends();
|
||||
m_plotLegendsHorizontal = rhs.m_plotLegendsHorizontal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::setDescription( const QString& description )
|
||||
{
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotWindow::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotWindow::fullPlotTitle() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotWindow::isPlotTitleVisible() const
|
||||
{
|
||||
return m_showTitleInPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::setPlotTitleVisible( bool visible )
|
||||
{
|
||||
m_showTitleInPlot = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotWindow::legendsVisible() const
|
||||
{
|
||||
return m_showPlotLegends();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::setLegendsVisible( bool doShow )
|
||||
{
|
||||
m_showPlotLegends = doShow;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotWindow::legendsHorizontal() const
|
||||
{
|
||||
return m_plotLegendsHorizontal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::setLegendsHorizontal( bool horizontal )
|
||||
{
|
||||
m_plotLegendsHorizontal = horizontal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showPlotLegends || changedField == &m_plotLegendsHorizontal )
|
||||
{
|
||||
updateLayout();
|
||||
}
|
||||
else if ( changedField == &m_showTitleInPlot )
|
||||
{
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if ( fieldNeedingOptions == &m_plotLegendsHorizontal )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Vertical", QVariant::fromValue( false ) ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( "Horizontal", QVariant::fromValue( true ) ) );
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmUiGroup* RimPlotWindow::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Title and Legends" );
|
||||
titleAndLegendsGroup->add( &m_showPlotLegends );
|
||||
titleAndLegendsGroup->add( &m_plotLegendsHorizontal );
|
||||
titleAndLegendsGroup->add( &m_showTitleInPlot );
|
||||
return titleAndLegendsGroup;
|
||||
}
|
||||
69
ApplicationCode/ProjectDataModel/RimPlotWindow.h
Normal file
69
ApplicationCode/ProjectDataModel/RimPlotWindow.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimNameConfig.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class QKeyEvent;
|
||||
|
||||
class RimPlotWindow : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPlotWindow();
|
||||
~RimPlotWindow();
|
||||
|
||||
RimPlotWindow& operator=( RimPlotWindow&& rhs );
|
||||
|
||||
virtual void setDescription( const QString& description );
|
||||
virtual QString description() const;
|
||||
virtual QString fullPlotTitle() const;
|
||||
|
||||
bool isPlotTitleVisible() const;
|
||||
void setPlotTitleVisible( bool visible );
|
||||
bool legendsVisible() const;
|
||||
void setLegendsVisible( bool doShow );
|
||||
bool legendsHorizontal() const;
|
||||
void setLegendsHorizontal( bool horizontal );
|
||||
|
||||
virtual void detachAllCurves() = 0;
|
||||
virtual void handleKeyPressEvent( QKeyEvent* keyEvent ) {}
|
||||
virtual void updateLayout() = 0;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
virtual caf::PdmUiGroup* createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering );
|
||||
virtual void updatePlotTitle() = 0;
|
||||
|
||||
protected:
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<bool> m_showTitleInPlot;
|
||||
caf::PdmField<bool> m_showPlotLegends;
|
||||
caf::PdmField<bool> m_plotLegendsHorizontal;
|
||||
};
|
||||
@@ -100,6 +100,9 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimProject::RimProject( void )
|
||||
: m_nextValidCaseId( 0 )
|
||||
, m_nextValidCaseGroupId( 0 )
|
||||
, m_nextValidViewId( 0 )
|
||||
{
|
||||
CAF_PDM_InitObject( "Project", "", "", "" );
|
||||
|
||||
@@ -242,6 +245,10 @@ void RimProject::close()
|
||||
mainWindowTreeViewState = "";
|
||||
plotWindowCurrentModelIndexPath = "";
|
||||
plotWindowTreeViewState = "";
|
||||
|
||||
m_nextValidCaseId = 0;
|
||||
m_nextValidCaseGroupId = 0;
|
||||
m_nextValidViewId = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -468,17 +475,15 @@ void RimProject::assignCaseIdToCase( RimCase* reservoirCase )
|
||||
{
|
||||
if ( reservoirCase )
|
||||
{
|
||||
int nextValidCaseId = 0;
|
||||
|
||||
std::vector<RimCase*> cases;
|
||||
this->descendantsIncludingThisOfType( cases );
|
||||
|
||||
for ( RimCase* rimCase : cases )
|
||||
{
|
||||
nextValidCaseId = std::max( nextValidCaseId, rimCase->caseId() + 1 );
|
||||
m_nextValidCaseId = std::max( m_nextValidCaseId, rimCase->caseId() + 1 );
|
||||
}
|
||||
|
||||
reservoirCase->caseId = nextValidCaseId;
|
||||
reservoirCase->caseId = m_nextValidCaseId++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,17 +494,15 @@ void RimProject::assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup )
|
||||
{
|
||||
if ( caseGroup )
|
||||
{
|
||||
int nextValidCaseGroupId = 0;
|
||||
|
||||
std::vector<RimIdenticalGridCaseGroup*> identicalCaseGroups;
|
||||
this->descendantsIncludingThisOfType( identicalCaseGroups );
|
||||
|
||||
for ( RimIdenticalGridCaseGroup* existingCaseGroup : identicalCaseGroups )
|
||||
{
|
||||
nextValidCaseGroupId = std::max( nextValidCaseGroupId, existingCaseGroup->groupId() + 1 );
|
||||
m_nextValidCaseGroupId = std::max( m_nextValidCaseGroupId, existingCaseGroup->groupId() + 1 );
|
||||
}
|
||||
|
||||
caseGroup->groupId = nextValidCaseGroupId;
|
||||
caseGroup->groupId = m_nextValidCaseGroupId++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,17 +513,15 @@ void RimProject::assignViewIdToView( RimViewWindow* view )
|
||||
{
|
||||
if ( view )
|
||||
{
|
||||
int nextValidViewId = 0;
|
||||
|
||||
std::vector<RimViewWindow*> viewWindows;
|
||||
this->descendantsIncludingThisOfType( viewWindows );
|
||||
|
||||
for ( RimViewWindow* existingView : viewWindows )
|
||||
{
|
||||
nextValidViewId = std::max( nextValidViewId, existingView->id() + 1 );
|
||||
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
|
||||
}
|
||||
|
||||
view->setId( nextValidViewId );
|
||||
view->setId( m_nextValidViewId++ );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,10 @@ private:
|
||||
caf::PdmField<bool> m_subWindowsTiled3DWindow;
|
||||
caf::PdmField<bool> m_subWindowsTiledPlotWindow;
|
||||
|
||||
int m_nextValidCaseId;
|
||||
int m_nextValidCaseGroupId;
|
||||
int m_nextValidViewId;
|
||||
|
||||
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
|
||||
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
|
||||
};
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RiaFontCache.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
class RimRiuQwtPlotOwnerInterface
|
||||
{
|
||||
public:
|
||||
virtual void detachAllCurves() = 0;
|
||||
virtual void updateAxisScaling() = 0;
|
||||
virtual void updateAxisDisplay() = 0;
|
||||
virtual void updateZoomWindowFromQwt() = 0;
|
||||
virtual void selectAxisInPropertyEditor( int axis ) = 0;
|
||||
virtual void setAutoZoomForAllAxes( bool enableAutoZoom ) = 0;
|
||||
|
||||
virtual caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const = 0;
|
||||
};
|
||||
@@ -286,12 +286,7 @@ QString RimViewLinker::displayNameForView( RimGridView* view )
|
||||
|
||||
if ( view )
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
view->firstAncestorOrThisOfType( rimCase );
|
||||
if ( rimCase )
|
||||
{
|
||||
displayName = rimCase->caseUserDescription() + ": " + view->name();
|
||||
}
|
||||
displayName = view->autoName();
|
||||
}
|
||||
|
||||
return displayName;
|
||||
@@ -436,25 +431,10 @@ void RimViewLinker::findNameAndIconFromView( QString* name, caf::QIconProvider*
|
||||
{
|
||||
CVF_ASSERT( name && icon );
|
||||
|
||||
*name = displayNameForView( view );
|
||||
|
||||
if ( view )
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
view->firstAncestorOrThisOfType( rimCase );
|
||||
|
||||
if ( dynamic_cast<RimGeoMechCase*>( rimCase ) )
|
||||
{
|
||||
*icon = caf::QIconProvider( ":/GeoMechCase48x48.png" );
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseResultCase*>( rimCase ) )
|
||||
{
|
||||
*icon = caf::QIconProvider( ":/Case48x48.png" );
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseInputCase*>( rimCase ) )
|
||||
{
|
||||
*icon = caf::QIconProvider( ":/EclipseInput48x48.png" );
|
||||
}
|
||||
*name = displayNameForView( view );
|
||||
*icon = view->uiIconProvider();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@ RimViewWindow::RimViewWindow( void )
|
||||
// Obsolete field
|
||||
CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "" );
|
||||
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry );
|
||||
RiaApplication::instance()->project()->assignViewIdToView( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -196,6 +197,14 @@ void RimViewWindow::viewNavigationChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::onViewNavigationChanged() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewWindow::isWindowVisible() const
|
||||
{
|
||||
return m_showWindow();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -277,10 +286,6 @@ void RimViewWindow::initAfterRead()
|
||||
setAsMdiWindow( mainWindowID );
|
||||
setMdiWindowGeometry( wg );
|
||||
}
|
||||
if ( m_viewId() == -1 )
|
||||
{
|
||||
RiaApplication::instance()->project()->assignViewIdToView( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -113,10 +113,7 @@ protected:
|
||||
virtual void deleteViewWidget() = 0;
|
||||
virtual void onLoadDataAndUpdate() = 0;
|
||||
virtual void onViewNavigationChanged();
|
||||
virtual bool isWindowVisible()
|
||||
{
|
||||
return m_showWindow();
|
||||
} // Virtual To allow special visibility control
|
||||
virtual bool isWindowVisible() const; // Virtual To allow special visibility control
|
||||
//////////
|
||||
|
||||
// Derived classes are not supposed to override this function. The intention is to always use m_showWindow
|
||||
|
||||
@@ -127,7 +127,7 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
{
|
||||
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
|
||||
m_commonDataSource->uiOrdering( RimWellLogCurveCommonDataSource::smoothingUiOrderinglabel(), uiOrdering );
|
||||
|
||||
caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup( "Parameter Sources" );
|
||||
parameterSources->add( &m_porePressureSource );
|
||||
@@ -137,7 +137,7 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
parameterSources->add( &m_userDefinedUcs );
|
||||
|
||||
uiOrderingForDepthAxis( uiOrdering );
|
||||
uiOrderingForPlotSettings( uiOrdering );
|
||||
createPlotSettingsUiGroup( uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
@@ -84,6 +84,47 @@ bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumVa
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumValue ) const
|
||||
{
|
||||
CAF_ASSERT( minimumValue && maximumValue );
|
||||
|
||||
if ( !( minimumValue && maximumValue ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( wellLogPlot );
|
||||
|
||||
if ( wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH )
|
||||
{
|
||||
if ( m_curveDataMDRange.first == -std::numeric_limits<double>::infinity() ||
|
||||
m_curveDataMDRange.second == std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*minimumValue = m_curveDataMDRange.first;
|
||||
*maximumValue = m_curveDataMDRange.second;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_curveDataTVDRange.first == -std::numeric_limits<double>::infinity() ||
|
||||
m_curveDataTVDRange.second == std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*minimumValue = m_curveDataTVDRange.first;
|
||||
*maximumValue = m_curveDataTVDRange.second;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -93,7 +134,7 @@ void RimWellLogCurve::setValuesAndMD( const std::vector<double>& xValues,
|
||||
bool isExtractionCurve )
|
||||
{
|
||||
m_curveData->setValuesAndMD( xValues, measuredDepths, depthUnit, isExtractionCurve );
|
||||
calculateCurveDataXRange();
|
||||
calculateCurveDataRanges();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -106,7 +147,7 @@ void RimWellLogCurve::setValuesWithTVD( const std::vector<double>& xValues,
|
||||
bool isExtractionCurve )
|
||||
{
|
||||
m_curveData->setValuesWithTVD( xValues, measuredDepths, tvDepths, depthUnit, isExtractionCurve );
|
||||
calculateCurveDataXRange();
|
||||
calculateCurveDataRanges();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -126,15 +167,8 @@ void RimWellLogCurve::updateZoomInParentPlot()
|
||||
firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
wellLogPlot->calculateAvailableDepthRange();
|
||||
wellLogPlot->updateDepthZoom();
|
||||
}
|
||||
|
||||
RimWellLogTrack* plotTrack;
|
||||
firstAncestorOrThisOfType( plotTrack );
|
||||
if ( plotTrack )
|
||||
{
|
||||
plotTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
wellLogPlot->setAutoScaleYEnabled( true );
|
||||
wellLogPlot->updateZoom();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,11 +196,18 @@ void RimWellLogCurve::setOverrideCurveDataXRange( double minimumValue, double ma
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogCurve::calculateCurveDataXRange()
|
||||
void RimWellLogCurve::calculateCurveDataRanges()
|
||||
{
|
||||
// Invalidate range first
|
||||
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(),
|
||||
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(),
|
||||
-std::numeric_limits<double>::infinity() );
|
||||
m_curveDataMDRange = std::make_pair( std::numeric_limits<double>::infinity(),
|
||||
-std::numeric_limits<double>::infinity() );
|
||||
m_curveDataTVDRange = std::make_pair( std::numeric_limits<double>::infinity(),
|
||||
-std::numeric_limits<double>::infinity() );
|
||||
|
||||
m_curveData->calculateMDRange( &m_curveDataMDRange.first, &m_curveDataMDRange.second );
|
||||
m_curveData->calculateTVDRange( &m_curveDataTVDRange.first, &m_curveDataTVDRange.second );
|
||||
|
||||
for ( double xValue : m_curveData->xValues() )
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
~RimWellLogCurve() override;
|
||||
|
||||
bool xValueRangeInData( double* minimumValue, double* maximumValue ) const;
|
||||
bool yValueRangeInData( double* minimumValue, double* maximumValue ) const;
|
||||
|
||||
void setValuesAndMD( const std::vector<double>& xValues,
|
||||
const std::vector<double>& measuredDepths,
|
||||
@@ -67,9 +68,11 @@ protected:
|
||||
void setOverrideCurveDataXRange( double minimumValue, double maximumValue );
|
||||
|
||||
private:
|
||||
void calculateCurveDataXRange();
|
||||
void calculateCurveDataRanges();
|
||||
|
||||
private:
|
||||
cvf::ref<RigWellLogCurveData> m_curveData;
|
||||
std::pair<double, double> m_curveDataXRange;
|
||||
std::pair<double, double> m_curveDataMDRange;
|
||||
std::pair<double, double> m_curveDataTVDRange;
|
||||
};
|
||||
|
||||
@@ -676,10 +676,17 @@ std::vector<caf::PdmFieldHandle*> RimWellLogCurveCommonDataSource::fieldsToShowI
|
||||
fieldsToDisplay.push_back( &m_simWellName );
|
||||
}
|
||||
fieldsToDisplay.push_back( &m_timeStep );
|
||||
|
||||
return fieldsToDisplay;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogCurveCommonDataSource::smoothingUiOrderinglabel()
|
||||
{
|
||||
return "ApplySmoothing";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -895,7 +902,7 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca
|
||||
}
|
||||
group->add( &m_timeStep );
|
||||
|
||||
if ( dynamic_cast<RimGeoMechCase*>( m_case() ) )
|
||||
if ( uiConfigName == smoothingUiOrderinglabel() )
|
||||
{
|
||||
group->add( &m_wbsSmoothing );
|
||||
group->add( &m_wbsSmoothingThreshold );
|
||||
@@ -923,7 +930,8 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField
|
||||
|
||||
if ( field == &m_case )
|
||||
{
|
||||
modifierText = ( "(Shift+" );
|
||||
modifierText = ( "(Shift+" );
|
||||
myAttr->minimumContentsLength = 14;
|
||||
}
|
||||
else if ( field == &m_wellPath || field == &m_simWellName )
|
||||
{
|
||||
@@ -931,7 +939,8 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField
|
||||
}
|
||||
else if ( field == &m_timeStep )
|
||||
{
|
||||
modifierText = ( "(" );
|
||||
modifierText = ( "(" );
|
||||
myAttr->minimumContentsLength = 12;
|
||||
}
|
||||
|
||||
if ( !modifierText.isEmpty() )
|
||||
|
||||
@@ -87,6 +87,8 @@ public:
|
||||
void applyNextTimeStep();
|
||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
static QString smoothingUiOrderinglabel();
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafUtils.h"
|
||||
@@ -371,10 +371,10 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
firstAncestorOrThisOfType( wellLogTrack );
|
||||
CVF_ASSERT( wellLogTrack );
|
||||
|
||||
RiuWellLogTrack* viewer = wellLogTrack->viewer();
|
||||
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
||||
if ( viewer )
|
||||
{
|
||||
viewer->setDepthTitle( "PL/" + wellLogPlot->depthPlotTitle() );
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "PL/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
@@ -30,9 +30,11 @@
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuGridPlotWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cvfAssert.h"
|
||||
@@ -76,11 +78,6 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Log Plot", ":/WellLogPlot16x16.png", "", "" );
|
||||
|
||||
m_viewer = nullptr;
|
||||
|
||||
CAF_PDM_InitField( &m_userName_OBSOLETE, "PlotDescription", QString( "" ), "Name", "", "", "" );
|
||||
m_userName_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_commonDataSource,
|
||||
"CommonDataSource",
|
||||
"Data Source",
|
||||
@@ -103,24 +100,19 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", "" );
|
||||
CAF_PDM_InitField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "" );
|
||||
m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitField( &m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showTrackLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
|
||||
CAF_PDM_InitField( &m_trackLegendsHorizontal, "TrackLegendsHorizontal", false, "Legend Orientation", "", "", "" );
|
||||
m_trackLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_tracks, "Tracks", "", "", "", "" );
|
||||
m_tracks.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
|
||||
m_nameConfig.uiCapability()->setUiTreeHidden( true );
|
||||
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_nameConfig = new RimWellLogPlotNameConfig();
|
||||
|
||||
m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET};
|
||||
m_availableDepthTypes = {MEASURED_DEPTH, TRUE_VERTICAL_DEPTH};
|
||||
m_availableDepthUnits = { RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET };
|
||||
m_availableDepthTypes = { MEASURED_DEPTH, TRUE_VERTICAL_DEPTH };
|
||||
|
||||
m_minAvailableDepth = HUGE_VAL;
|
||||
m_maxAvailableDepth = -HUGE_VAL;
|
||||
|
||||
m_commonDataSourceEnabled = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -128,8 +120,7 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
|
||||
{
|
||||
// Don't copy the obsoleted m_userName_OBSOLETE
|
||||
// It had its own implementation in the RFT/PLT/WAP plots
|
||||
RimGridPlotWindow::operator=( std::move( rhs ) );
|
||||
|
||||
auto dataSource = rhs.m_commonDataSource();
|
||||
rhs.m_commonDataSource.removeChildObject( dataSource );
|
||||
@@ -141,17 +132,6 @@ RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
|
||||
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
|
||||
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
|
||||
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
|
||||
m_showTitleInPlot = rhs.m_showTitleInPlot();
|
||||
m_showTrackLegends = rhs.m_showTrackLegends();
|
||||
m_trackLegendsHorizontal = rhs.m_trackLegendsHorizontal();
|
||||
|
||||
// Move all tracks
|
||||
std::vector<RimWellLogTrack*> tracks = rhs.m_tracks.childObjects();
|
||||
rhs.m_tracks.clear();
|
||||
for ( RimWellLogTrack* track : tracks )
|
||||
{
|
||||
m_tracks.push_back( track );
|
||||
}
|
||||
|
||||
auto nameConfig = rhs.m_nameConfig();
|
||||
rhs.m_nameConfig.removeChildObject( nameConfig );
|
||||
@@ -167,11 +147,6 @@ RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot::~RimWellLogPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
m_tracks.deleteAllChildObjects();
|
||||
|
||||
deleteViewWidget();
|
||||
delete m_commonDataSource;
|
||||
delete m_nameConfig;
|
||||
}
|
||||
@@ -179,225 +154,74 @@ RimWellLogPlot::~RimWellLogPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::viewWidget()
|
||||
QWidget* RimWellLogPlot::createPlotWidget( QWidget* mainWindowParent /*= nullptr */ )
|
||||
{
|
||||
return m_viewer;
|
||||
return createViewWidget( mainWindowParent );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
QString RimWellLogPlot::fullPlotTitle() const
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth )
|
||||
{
|
||||
applyDepthZoomFromVisibleDepth();
|
||||
|
||||
m_isAutoScaleDepthEnabled = false;
|
||||
}
|
||||
else if ( changedField == &m_showTrackLegends || changedField == &m_trackLegendsHorizontal ||
|
||||
changedField == &m_depthAxisGridVisibility )
|
||||
{
|
||||
updateTracks();
|
||||
}
|
||||
else if ( changedField == &m_showTitleInPlot )
|
||||
{
|
||||
m_viewer->setTitleVisible( m_showTitleInPlot() );
|
||||
}
|
||||
else if ( changedField == &m_isAutoScaleDepthEnabled )
|
||||
{
|
||||
updateDepthZoom();
|
||||
}
|
||||
else if ( changedField == &m_depthType )
|
||||
{
|
||||
onDepthTypeChanged();
|
||||
updateTracks();
|
||||
updateDepthZoom();
|
||||
}
|
||||
else if ( changedField == &m_depthUnit )
|
||||
{
|
||||
updateTracks();
|
||||
updateDepthZoom();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
return createAutoName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
void RimWellLogPlot::updateZoom()
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_depthType )
|
||||
if ( m_isAutoScaleDepthEnabled )
|
||||
{
|
||||
using DepthAppEnum = caf::AppEnum<DepthTypeEnum>;
|
||||
for ( size_t i = 0; i < DepthAppEnum::size(); ++i )
|
||||
calculateAvailableDepthRange();
|
||||
if ( m_minAvailableDepth < HUGE_VAL && m_maxAvailableDepth > -HUGE_VAL )
|
||||
{
|
||||
DepthTypeEnum enumVal = DepthAppEnum::fromIndex( i );
|
||||
|
||||
if ( m_availableDepthTypes.count( enumVal ) )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( DepthAppEnum::uiText( enumVal ), enumVal ) );
|
||||
}
|
||||
m_minVisibleDepth = m_minAvailableDepth;
|
||||
m_maxVisibleDepth = m_maxAvailableDepth + 0.01 * ( m_maxAvailableDepth - m_minAvailableDepth );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_depthUnit )
|
||||
{
|
||||
using UnitAppEnum = caf::AppEnum<RiaDefines::DepthUnitType>;
|
||||
for ( auto depthUnit : m_availableDepthUnits )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( UnitAppEnum::uiText( depthUnit ), depthUnit ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_trackLegendsHorizontal )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Vertical", QVariant::fromValue( false ) ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( "Horizontal", QVariant::fromValue( true ) ) );
|
||||
}
|
||||
|
||||
( *useOptionsOnly ) = true;
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellLogPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
for ( RimPlotInterface* plot : plots() )
|
||||
{
|
||||
static_cast<RimWellLogTrack*>( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() );
|
||||
}
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setScrollbarVisible( false );
|
||||
QPixmap pix = m_viewer->grab();
|
||||
image = pix.toImage();
|
||||
m_viewer->setScrollbarVisible( true );
|
||||
m_viewer->updateVerticalScrollBar( m_minVisibleDepth(),
|
||||
m_maxVisibleDepth(),
|
||||
m_minAvailableDepth,
|
||||
m_maxAvailableDepth );
|
||||
}
|
||||
|
||||
return image;
|
||||
RimGridPlotWindow::updateZoom();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::addTrack( RimWellLogTrack* track )
|
||||
{
|
||||
m_tracks.push_back( track );
|
||||
if ( m_viewer )
|
||||
{
|
||||
track->recreateViewer();
|
||||
m_viewer->addTrackPlot( track->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::insertTrack( RimWellLogTrack* track, size_t index )
|
||||
{
|
||||
m_tracks.insert( index, track );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
track->recreateViewer();
|
||||
m_viewer->insertTrackPlot( track->viewer(), index );
|
||||
}
|
||||
|
||||
updateTrackNames();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::removeTrack( RimWellLogTrack* track )
|
||||
{
|
||||
if ( track )
|
||||
{
|
||||
if ( m_viewer ) m_viewer->removeTrackPlot( track->viewer() );
|
||||
m_tracks.removeChildObject( track );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogTrack* RimWellLogPlot::trackByIndex( size_t index ) const
|
||||
{
|
||||
return m_tracks[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimWellLogPlot::firstVisibleTrackIndex() const
|
||||
{
|
||||
for ( size_t i = 0; i < m_tracks.size(); ++i )
|
||||
{
|
||||
if ( m_tracks[i]->isVisible() )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return std::numeric_limits<size_t>::max();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogTrack*> RimWellLogPlot::tracks() const
|
||||
{
|
||||
return m_tracks.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogTrack*> RimWellLogPlot::visibleTracks() const
|
||||
{
|
||||
std::vector<RimWellLogTrack*> tracks;
|
||||
for ( RimWellLogTrack* track : m_tracks() )
|
||||
{
|
||||
if ( track->isVisible() )
|
||||
{
|
||||
tracks.push_back( track );
|
||||
}
|
||||
}
|
||||
return tracks;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setDepthZoomByFactorAndCenter( double zoomFactor, double zoomCenter )
|
||||
void RimWellLogPlot::setDepthAxisRangeByFactorAndCenter( double zoomFactor, double zoomCenter )
|
||||
{
|
||||
double newMinimum = zoomCenter - ( zoomCenter - m_minVisibleDepth ) * zoomFactor;
|
||||
double newMaximum = zoomCenter + ( m_maxVisibleDepth - zoomCenter ) * zoomFactor;
|
||||
|
||||
setDepthZoomMinMax( newMinimum, newMaximum );
|
||||
setDepthAutoZoom( false );
|
||||
setDepthAxisRange( newMinimum, newMaximum );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::panDepth( double panFactor )
|
||||
void RimWellLogPlot::setDepthAxisRangeByPanDepth( double panFactor )
|
||||
{
|
||||
double delta = panFactor * ( m_maxVisibleDepth - m_minVisibleDepth );
|
||||
setDepthZoomMinMax( m_minVisibleDepth + delta, m_maxVisibleDepth + delta );
|
||||
setDepthAutoZoom( false );
|
||||
setDepthAxisRange( m_minVisibleDepth + delta, m_maxVisibleDepth + delta );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setDepthZoomMinMax( double minimumDepth, double maximumDepth )
|
||||
void RimWellLogPlot::setDepthAxisRange( double minimumDepth, double maximumDepth )
|
||||
{
|
||||
m_minVisibleDepth = minimumDepth;
|
||||
m_maxVisibleDepth = maximumDepth;
|
||||
@@ -405,7 +229,8 @@ void RimWellLogPlot::setDepthZoomMinMax( double minimumDepth, double maximumDept
|
||||
m_minVisibleDepth.uiCapability()->updateConnectedEditors();
|
||||
m_maxVisibleDepth.uiCapability()->updateConnectedEditors();
|
||||
|
||||
applyDepthZoomFromVisibleDepth();
|
||||
setAutoScaleYEnabled( false );
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -416,14 +241,16 @@ void RimWellLogPlot::calculateAvailableDepthRange()
|
||||
double minDepth = HUGE_VAL;
|
||||
double maxDepth = -HUGE_VAL;
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++ )
|
||||
auto plots = this->plots();
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plots.size(); tIdx++ )
|
||||
{
|
||||
double minTrackDepth = HUGE_VAL;
|
||||
double maxTrackDepth = -HUGE_VAL;
|
||||
|
||||
if ( m_tracks[tIdx]->isVisible() )
|
||||
if ( plots[tIdx]->isChecked() )
|
||||
{
|
||||
m_tracks[tIdx]->availableDepthRange( &minTrackDepth, &maxTrackDepth );
|
||||
static_cast<RimWellLogTrack*>( plots[tIdx] )->availableDepthRange( &minTrackDepth, &maxTrackDepth );
|
||||
|
||||
if ( minTrackDepth < minDepth )
|
||||
{
|
||||
@@ -437,8 +264,11 @@ void RimWellLogPlot::calculateAvailableDepthRange()
|
||||
}
|
||||
}
|
||||
|
||||
m_minAvailableDepth = minDepth;
|
||||
m_maxAvailableDepth = maxDepth;
|
||||
if ( minDepth < HUGE_VAL && maxDepth > -HUGE_VAL )
|
||||
{
|
||||
m_minAvailableDepth = minDepth;
|
||||
m_maxAvailableDepth = maxDepth;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -446,40 +276,14 @@ void RimWellLogPlot::calculateAvailableDepthRange()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::availableDepthRange( double* minimumDepth, double* maximumDepth ) const
|
||||
{
|
||||
if ( hasAvailableDepthRange() )
|
||||
{
|
||||
*minimumDepth = m_minAvailableDepth;
|
||||
*maximumDepth = m_maxAvailableDepth;
|
||||
}
|
||||
else
|
||||
{
|
||||
*minimumDepth = RI_LOGPLOT_MINDEPTH_DEFAULT;
|
||||
*maximumDepth = RI_LOGPLOT_MAXDEPTH_DEFAULT;
|
||||
}
|
||||
*minimumDepth = m_minAvailableDepth;
|
||||
*maximumDepth = m_maxAvailableDepth;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlot::hasAvailableDepthRange() const
|
||||
{
|
||||
return m_minAvailableDepth < HUGE_VAL && m_maxAvailableDepth > -HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::zoomAll()
|
||||
{
|
||||
setDepthAutoZoom( true );
|
||||
updateDepthZoom();
|
||||
updateTracks( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setDepthAutoZoom( bool on )
|
||||
void RimWellLogPlot::setAutoScaleYEnabled( bool on )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = on;
|
||||
m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors();
|
||||
@@ -493,92 +297,6 @@ void RimWellLogPlot::enableAllAutoNameTags( bool enable )
|
||||
m_nameConfig->enableAllAutoNameTags( enable );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString out = description() + "\n";
|
||||
|
||||
for ( RimWellLogTrack* track : m_tracks )
|
||||
{
|
||||
if ( !track->isVisible() ) continue;
|
||||
|
||||
out += "\n" + track->description() + "\n";
|
||||
|
||||
std::vector<RimWellLogCurve*> curves = track->curvesVector();
|
||||
|
||||
std::vector<QString> curveNames;
|
||||
std::vector<double> curveDepths;
|
||||
std::vector<std::vector<double>> curvesPlotXValues;
|
||||
|
||||
for ( RimWellLogCurve* curve : curves )
|
||||
{
|
||||
if ( !curve->isCurveVisible() ) continue;
|
||||
|
||||
const RigWellLogCurveData* curveData = curve->curveData();
|
||||
if ( !curveData ) continue;
|
||||
curveNames.push_back( curve->curveName() );
|
||||
|
||||
if ( curveNames.size() == 1 )
|
||||
{
|
||||
if ( depthType() == TRUE_VERTICAL_DEPTH )
|
||||
{
|
||||
curveDepths = curveData->trueDepthPlotValues( depthUnit() );
|
||||
}
|
||||
else
|
||||
{
|
||||
curveDepths = curveData->measuredDepthPlotValues( depthUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<double> xPlotValues = curveData->xPlotValues();
|
||||
if ( curveDepths.size() != xPlotValues.size() || xPlotValues.empty() )
|
||||
{
|
||||
curveNames.pop_back();
|
||||
|
||||
if ( curveNames.empty() )
|
||||
{
|
||||
curveDepths.clear();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
curvesPlotXValues.push_back( xPlotValues );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < curveDepths.size(); ++i )
|
||||
{
|
||||
if ( i == 0 )
|
||||
{
|
||||
if ( depthType() == CONNECTION_NUMBER )
|
||||
out += "Connection";
|
||||
else if ( depthType() == MEASURED_DEPTH )
|
||||
out += "MD ";
|
||||
else if ( depthType() == PSEUDO_LENGTH )
|
||||
out += "PL ";
|
||||
else if ( depthType() == TRUE_VERTICAL_DEPTH )
|
||||
out += "TVD ";
|
||||
for ( QString name : curveNames )
|
||||
out += " \t" + name;
|
||||
out += "\n";
|
||||
}
|
||||
else if ( curveDepths[i] == curveDepths[i - 1] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
out += QString::number( curveDepths[i], 'f', 3 );
|
||||
for ( std::vector<double> plotVector : curvesPlotXValues )
|
||||
{
|
||||
out += " \t" + QString::number( plotVector[i], 'g' );
|
||||
}
|
||||
out += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -604,13 +322,11 @@ void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering )
|
||||
caf::PdmUiGroup* RimWellLogPlot::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Title and Legends" );
|
||||
titleAndLegendsGroup->add( &m_showTrackLegends );
|
||||
titleAndLegendsGroup->add( &m_trackLegendsHorizontal );
|
||||
titleAndLegendsGroup->add( &m_showTitleInPlot );
|
||||
caf::PdmUiGroup* titleAndLegendsGroup = RimGridPlotWindow::createPlotSettingsUiGroup( uiOrdering );
|
||||
m_nameConfig->uiOrdering( "", *titleAndLegendsGroup );
|
||||
return titleAndLegendsGroup;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -691,13 +407,23 @@ QString RimWellLogPlot::createAutoName() const
|
||||
return generatedCurveName.join( ": " );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_viewer = new RiuWellLogPlot( this, mainWindowParent );
|
||||
recreatePlotWidgets();
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::performAutoNameUpdate()
|
||||
{
|
||||
updateCommonDataSource();
|
||||
this->updatePlotTitle();
|
||||
this->setPlotTitleInWidget( this->createAutoName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -759,6 +485,14 @@ void RimWellLogPlot::updateCommonDataSource()
|
||||
m_commonDataSource->updateDefaultOptions();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setCommonDataSourceEnabled( bool enable )
|
||||
{
|
||||
m_commonDataSourceEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -778,24 +512,31 @@ void RimWellLogPlot::setAvailableDepthTypes( const std::set<DepthTypeEnum>& dept
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::depthZoomMinMax( double* minimumDepth, double* maximumDepth ) const
|
||||
void RimWellLogPlot::onPlotAdditionOrRemoval()
|
||||
{
|
||||
*minimumDepth = m_minVisibleDepth;
|
||||
*maximumDepth = m_maxVisibleDepth;
|
||||
calculateAvailableDepthRange();
|
||||
updateZoom();
|
||||
RimGridPlotWindow::onPlotAdditionOrRemoval();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
void RimWellLogPlot::updatePlotNames()
|
||||
{
|
||||
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
|
||||
uiOrderingForDepthAxis( uiOrdering );
|
||||
uiOrderingForPlotSettings( uiOrdering );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
auto plotVector = plots();
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plotVector[tIdx] );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
QString description = track->description();
|
||||
QRegularExpression regexp( "Track \\d+" );
|
||||
description.replace( regexp, QString( "Track %1" ).arg( tIdx + 1 ) );
|
||||
track->setDescription( description );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -809,161 +550,91 @@ caf::PdmFieldHandle* RimWellLogPlot::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::onLoadDataAndUpdate()
|
||||
void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
updatePlotTitle();
|
||||
updateTracks();
|
||||
RimGridPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = false;
|
||||
updateZoom();
|
||||
}
|
||||
else if ( changedField == &m_depthAxisGridVisibility )
|
||||
{
|
||||
updateLayout();
|
||||
}
|
||||
else if ( changedField == &m_isAutoScaleDepthEnabled )
|
||||
{
|
||||
if ( m_isAutoScaleDepthEnabled )
|
||||
{
|
||||
updateZoom();
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_depthType )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = true;
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_depthUnit )
|
||||
{
|
||||
m_isAutoScaleDepthEnabled = true;
|
||||
updateZoom();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updateTracks( bool autoScaleXAxis )
|
||||
void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
if ( m_showWindow )
|
||||
RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
if ( m_commonDataSourceEnabled )
|
||||
{
|
||||
for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx )
|
||||
m_commonDataSource->uiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
uiOrderingForDepthAxis( uiOrdering );
|
||||
createPlotSettingsUiGroup( uiOrdering );
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimGridPlotWindow::calculateValueOptions( fieldNeedingOptions,
|
||||
useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_depthType )
|
||||
{
|
||||
using DepthAppEnum = caf::AppEnum<DepthTypeEnum>;
|
||||
for ( size_t i = 0; i < DepthAppEnum::size(); ++i )
|
||||
{
|
||||
m_tracks[tIdx]->loadDataAndUpdate();
|
||||
if ( autoScaleXAxis )
|
||||
DepthTypeEnum enumVal = DepthAppEnum::fromIndex( i );
|
||||
|
||||
if ( m_availableDepthTypes.count( enumVal ) )
|
||||
{
|
||||
m_tracks[tIdx]->setAutoScaleXEnabled( true );
|
||||
m_tracks[tIdx]->calculateXZoomRangeAndUpdateQwt();
|
||||
m_tracks[tIdx]->updateAxisAndGridTickIntervals();
|
||||
options.push_back( caf::PdmOptionItemInfo( DepthAppEnum::uiText( enumVal ), enumVal ) );
|
||||
}
|
||||
}
|
||||
|
||||
calculateAvailableDepthRange();
|
||||
applyDepthZoomFromVisibleDepth();
|
||||
if ( m_viewer ) m_viewer->updateChildrenLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updateTrackNames()
|
||||
{
|
||||
for ( size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++ )
|
||||
else if ( fieldNeedingOptions == &m_depthUnit )
|
||||
{
|
||||
QString description = m_tracks[tIdx]->description();
|
||||
QRegularExpression regexp( "Track \\d+" );
|
||||
description.replace( regexp, QString( "Track %1" ).arg( tIdx + 1 ) );
|
||||
m_tracks[tIdx]->setDescription( description );
|
||||
using UnitAppEnum = caf::AppEnum<RiaDefines::DepthUnitType>;
|
||||
for ( auto depthUnit : m_availableDepthUnits )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( UnitAppEnum::uiText( depthUnit ), depthUnit ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updateDepthZoom()
|
||||
{
|
||||
if ( m_isAutoScaleDepthEnabled )
|
||||
{
|
||||
applyZoomAllDepths();
|
||||
}
|
||||
else
|
||||
{
|
||||
applyDepthZoomFromVisibleDepth();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::applyDepthZoomFromVisibleDepth()
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
double minDepth = m_minVisibleDepth < HUGE_VAL ? m_minVisibleDepth : RI_LOGPLOT_MINDEPTH_DEFAULT;
|
||||
double maxDepth = m_maxVisibleDepth > -HUGE_VAL ? m_maxVisibleDepth : RI_LOGPLOT_MAXDEPTH_DEFAULT;
|
||||
|
||||
m_viewer->setDepthZoomAndReplot( minDepth, maxDepth );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::applyZoomAllDepths()
|
||||
{
|
||||
calculateAvailableDepthRange();
|
||||
|
||||
if ( hasAvailableDepthRange() )
|
||||
{
|
||||
setDepthZoomMinMax( m_minAvailableDepth,
|
||||
m_maxAvailableDepth + 0.01 * ( m_maxAvailableDepth - m_minAvailableDepth ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setDepthZoomMinMax( RI_LOGPLOT_MINDEPTH_DEFAULT, RI_LOGPLOT_MAXDEPTH_DEFAULT );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::recreateTrackPlots()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx )
|
||||
{
|
||||
m_tracks[tIdx]->recreateViewer();
|
||||
m_viewer->addTrackPlot( m_tracks[tIdx]->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::detachAllCurves()
|
||||
{
|
||||
for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx )
|
||||
{
|
||||
m_tracks[tIdx]->detachAllCurves();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setDescription( const QString& description )
|
||||
{
|
||||
m_nameConfig->setCustomName( description );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogPlot::description() const
|
||||
{
|
||||
return m_nameConfig->customName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_viewer = new RiuWellLogPlot( this, mainWindowParent );
|
||||
recreateTrackPlots();
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::deleteViewWidget()
|
||||
{
|
||||
detachAllCurves();
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->deleteLater();
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
( *useOptionsOnly ) = true;
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -971,12 +642,34 @@ void RimWellLogPlot::deleteViewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::initAfterRead()
|
||||
{
|
||||
RimViewWindow::initAfterRead();
|
||||
RimGridPlotWindow::initAfterRead();
|
||||
|
||||
updateCommonDataSource();
|
||||
if ( !m_userName_OBSOLETE().isEmpty() )
|
||||
if ( !m_description().isEmpty() )
|
||||
{
|
||||
m_nameConfig->setCustomName( m_userName_OBSOLETE() );
|
||||
m_nameConfig->setCustomName( m_description() );
|
||||
}
|
||||
|
||||
if ( m_depthAxisGridVisibility() == AXIS_GRID_MINOR )
|
||||
{
|
||||
m_depthAxisGridVisibility = AXIS_GRID_MAJOR_AND_MINOR;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_columnCountEnum )
|
||||
{
|
||||
auto comboAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
|
||||
if ( comboAttr )
|
||||
{
|
||||
comboAttr->iconSize = QSize( 24, 14 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,7 +700,7 @@ RiaDefines::DepthUnitType RimWellLogPlot::depthUnit() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogPlot::depthPlotTitle() const
|
||||
QString RimWellLogPlot::depthAxisTitle() const
|
||||
{
|
||||
QString depthTitle = "Depth";
|
||||
|
||||
@@ -1051,7 +744,7 @@ QString RimWellLogPlot::depthPlotTitle() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::enableDepthGridLines( AxisGridVisibility gridVisibility )
|
||||
void RimWellLogPlot::enableDepthAxisGridLines( AxisGridVisibility gridVisibility )
|
||||
{
|
||||
m_depthAxisGridVisibility = gridVisibility;
|
||||
}
|
||||
@@ -1059,67 +752,11 @@ void RimWellLogPlot::enableDepthGridLines( AxisGridVisibility gridVisibility )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot::AxisGridVisibility RimWellLogPlot::depthGridLinesVisibility() const
|
||||
RimWellLogPlot::AxisGridVisibility RimWellLogPlot::depthAxisGridLinesEnabled() const
|
||||
{
|
||||
return m_depthAxisGridVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlot::isPlotTitleVisible() const
|
||||
{
|
||||
return m_showTitleInPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setPlotTitleVisible( bool visible )
|
||||
{
|
||||
m_showTitleInPlot = visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlot::areTrackLegendsVisible() const
|
||||
{
|
||||
return m_showTrackLegends();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setTrackLegendsVisible( bool doShow )
|
||||
{
|
||||
m_showTrackLegends = doShow;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlot::areTrackLegendsHorizontal() const
|
||||
{
|
||||
return m_trackLegendsHorizontal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::setTrackLegendsHorizontal( bool horizontal )
|
||||
{
|
||||
m_trackLegendsHorizontal = horizontal;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimWellLogPlot::trackIndex( const RimWellLogTrack* track ) const
|
||||
{
|
||||
return m_tracks.index( track );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1127,22 +764,5 @@ void RimWellLogPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
|
||||
{
|
||||
m_depthUnit = depthUnit;
|
||||
|
||||
updateTracks();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updatePlotTitle()
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setPlotTitle( this->createAutoName() );
|
||||
}
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Default empty implementation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::onDepthTypeChanged() {}
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimGridPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include <QPointer>
|
||||
@@ -35,15 +35,15 @@
|
||||
#include <set>
|
||||
|
||||
class RimWellLogCurveCommonDataSource;
|
||||
class RiuWellLogPlot;
|
||||
class RimWellLogTrack;
|
||||
class RiuGridPlotWindow;
|
||||
class RimPlotInterface;
|
||||
class QKeyEvent;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogPlot : public RimPlot, public RimNameConfigHolderInterface
|
||||
class RimWellLogPlot : public RimGridPlotWindow, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -58,9 +58,10 @@ public:
|
||||
|
||||
enum AxisGridVisibility
|
||||
{
|
||||
AXIS_GRID_NONE,
|
||||
AXIS_GRID_MAJOR,
|
||||
AXIS_GRID_MAJOR_AND_MINOR
|
||||
AXIS_GRID_NONE = 0x00,
|
||||
AXIS_GRID_MAJOR = 0x01,
|
||||
AXIS_GRID_MINOR = 0x02,
|
||||
AXIS_GRID_MAJOR_AND_MINOR = 0x03
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum;
|
||||
@@ -69,107 +70,70 @@ public:
|
||||
RimWellLogPlot();
|
||||
~RimWellLogPlot() override;
|
||||
|
||||
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
|
||||
QString fullPlotTitle() const override;
|
||||
|
||||
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
|
||||
void setDescription( const QString& description );
|
||||
QString description() const;
|
||||
|
||||
DepthTypeEnum depthType() const;
|
||||
void setDepthType( DepthTypeEnum depthType );
|
||||
|
||||
RiaDefines::DepthUnitType depthUnit() const;
|
||||
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
|
||||
|
||||
QString depthPlotTitle() const;
|
||||
void enableDepthGridLines( AxisGridVisibility gridVisibility );
|
||||
AxisGridVisibility depthGridLinesVisibility() const;
|
||||
QString depthAxisTitle() const;
|
||||
void enableDepthAxisGridLines( AxisGridVisibility gridVisibility );
|
||||
AxisGridVisibility depthAxisGridLinesEnabled() const;
|
||||
|
||||
bool isPlotTitleVisible() const;
|
||||
void setPlotTitleVisible( bool visible );
|
||||
bool areTrackLegendsVisible() const;
|
||||
void setTrackLegendsVisible( bool doShow );
|
||||
bool areTrackLegendsHorizontal() const;
|
||||
void setTrackLegendsHorizontal( bool horizontal );
|
||||
|
||||
void addTrack( RimWellLogTrack* track );
|
||||
void insertTrack( RimWellLogTrack* track, size_t index );
|
||||
size_t trackCount() const
|
||||
{
|
||||
return m_tracks.size();
|
||||
}
|
||||
|
||||
void removeTrack( RimWellLogTrack* track );
|
||||
size_t trackIndex( const RimWellLogTrack* track ) const;
|
||||
RimWellLogTrack* trackByIndex( size_t index ) const;
|
||||
size_t firstVisibleTrackIndex() const;
|
||||
std::vector<RimWellLogTrack*> tracks() const;
|
||||
std::vector<RimWellLogTrack*> visibleTracks() const;
|
||||
void updateTracks( bool autoScaleXAxis = false );
|
||||
void updateTrackNames();
|
||||
|
||||
void updateDepthZoom();
|
||||
void setDepthZoomByFactorAndCenter( double zoomFactor, double zoomCenter );
|
||||
void panDepth( double panFactor );
|
||||
void setDepthZoomMinMax( double minimumDepth, double maximumDepth );
|
||||
void depthZoomMinMax( double* minimumDepth, double* maximumDepth ) const;
|
||||
void updateZoom() override;
|
||||
void setDepthAxisRangeByFactorAndCenter( double zoomFactor, double zoomCenter );
|
||||
void setDepthAxisRangeByPanDepth( double panFactor );
|
||||
void setDepthAxisRange( double minimumDepth, double maximumDepth );
|
||||
|
||||
void calculateAvailableDepthRange();
|
||||
void availableDepthRange( double* minimumDepth, double* maximumDepth ) const;
|
||||
bool hasAvailableDepthRange() const;
|
||||
|
||||
void zoomAll() override;
|
||||
void setDepthAutoZoom( bool on );
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
void enableAllAutoNameTags( bool enable );
|
||||
|
||||
QString asciiDataForPlotExport() const;
|
||||
|
||||
void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
|
||||
void uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering );
|
||||
void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
|
||||
caf::PdmUiGroup* createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
QString createAutoName() const override;
|
||||
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent );
|
||||
RimWellLogCurveCommonDataSource* commonDataSource() const;
|
||||
void updateCommonDataSource();
|
||||
void setCommonDataSourceEnabled( bool enable );
|
||||
|
||||
void setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits );
|
||||
void setAvailableDepthTypes( const std::set<RimWellLogPlot::DepthTypeEnum>& depthTypes );
|
||||
|
||||
void onPlotAdditionOrRemoval() override;
|
||||
|
||||
void updatePlotNames() override;
|
||||
|
||||
protected:
|
||||
void performAutoNameUpdate() override;
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void performAutoNameUpdate() override;
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void applyZoomAllDepths();
|
||||
void applyDepthZoomFromVisibleDepth();
|
||||
void recreateTrackPlots();
|
||||
void detachAllCurves();
|
||||
|
||||
void updatePlotTitle();
|
||||
virtual void onDepthTypeChanged();
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<QString> m_userName_OBSOLETE;
|
||||
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
|
||||
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
|
||||
bool m_commonDataSourceEnabled;
|
||||
|
||||
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
|
||||
@@ -178,10 +142,6 @@ protected:
|
||||
caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility;
|
||||
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
|
||||
|
||||
caf::PdmField<bool> m_showTitleInPlot;
|
||||
caf::PdmField<bool> m_showTrackLegends;
|
||||
caf::PdmField<bool> m_trackLegendsHorizontal;
|
||||
|
||||
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
|
||||
|
||||
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;
|
||||
@@ -189,7 +149,4 @@ protected:
|
||||
|
||||
double m_minAvailableDepth;
|
||||
double m_maxAvailableDepth;
|
||||
|
||||
friend class RiuWellLogPlot;
|
||||
QPointer<RiuWellLogPlot> m_viewer;
|
||||
};
|
||||
|
||||
@@ -33,7 +33,6 @@ class RigGeoMechCaseData;
|
||||
class RigWellPath;
|
||||
class RimWellPath;
|
||||
class RimEclipseCase;
|
||||
class RiuWellLogPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafVecIjk.h"
|
||||
@@ -459,24 +459,24 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
firstAncestorOrThisOfType( wellLogTrack );
|
||||
CVF_ASSERT( wellLogTrack );
|
||||
|
||||
RiuWellLogTrack* viewer = wellLogTrack->viewer();
|
||||
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
||||
if ( viewer )
|
||||
{
|
||||
if ( m_derivedMDSource == NO_SOURCE )
|
||||
{
|
||||
viewer->setDepthTitle( "TVDMSL" );
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "TVDMSL" );
|
||||
}
|
||||
else if ( m_derivedMDSource == PSEUDO_LENGTH )
|
||||
{
|
||||
viewer->setDepthTitle( "PL/" + wellLogPlot->depthPlotTitle() );
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "PL/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
else if ( m_derivedMDSource == WELL_PATH )
|
||||
{
|
||||
viewer->setDepthTitle( "WELL/" + wellLogPlot->depthPlotTitle() );
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "WELL/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
viewer->setDepthTitle( "OBS/" + wellLogPlot->depthPlotTitle() );
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "OBS/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@
|
||||
#include "RigWellPathFormations.h"
|
||||
#include "RiuPlotAnnotationTool.h"
|
||||
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@@ -31,6 +32,8 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <map>
|
||||
@@ -64,7 +67,7 @@ struct CurveSamplingPointData
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLogTrack : public caf::PdmObject
|
||||
class RimWellLogTrack : public caf::PdmObject, public RimPlotInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -82,21 +85,17 @@ public:
|
||||
CASE,
|
||||
WELL_PICK_FILTER
|
||||
};
|
||||
enum WidthScaleFactor
|
||||
{
|
||||
EXTRA_NARROW_TRACK = 3,
|
||||
NARROW_TRACK = 4,
|
||||
NORMAL_TRACK = 5,
|
||||
WIDE_TRACK = 7,
|
||||
EXTRA_WIDE_TRACK = 10
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionAnnotationType> RegionAnnotationTypeEnum;
|
||||
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay> RegionAnnotationDisplayEnum;
|
||||
|
||||
void setDescription( const QString& description );
|
||||
bool isVisible();
|
||||
void setVisible( bool visible );
|
||||
bool isChecked() const override;
|
||||
void setChecked( bool checked );
|
||||
const QString description() const;
|
||||
void setDescription( const QString& description );
|
||||
int widthScaleFactor() const override;
|
||||
void setWidthScaleFactor( WidthScaleFactor scaleFactor ) override;
|
||||
|
||||
void addCurve( RimWellLogCurve* curve );
|
||||
void insertCurve( RimWellLogCurve* curve, size_t index );
|
||||
void takeOutCurve( RimWellLogCurve* curve );
|
||||
@@ -105,13 +104,11 @@ public:
|
||||
size_t curveIndex( RimWellLogCurve* curve );
|
||||
size_t curveCount()
|
||||
{
|
||||
return curves.size();
|
||||
return m_curves.size();
|
||||
}
|
||||
|
||||
void setXAxisTitle( const QString& text );
|
||||
QString depthPlotTitle() const;
|
||||
int widthScaleFactor() const;
|
||||
void setWidthScaleFactor( WidthScaleFactor scaleFactor );
|
||||
QString yAxisTitle() const;
|
||||
|
||||
void setFormationWellPath( RimWellPath* wellPath );
|
||||
RimWellPath* formationWellPath() const;
|
||||
@@ -126,11 +123,11 @@ public:
|
||||
void setFormationTrajectoryType( TrajectoryType trajectoryType );
|
||||
TrajectoryType formationTrajectoryType() const;
|
||||
|
||||
void recreateViewer();
|
||||
void createPlotWidget();
|
||||
void detachAllCurves();
|
||||
void reattachAllCurves();
|
||||
|
||||
void loadDataAndUpdate( bool updateParentPlotAndToolbars = false );
|
||||
void loadDataAndUpdate() override;
|
||||
|
||||
void setAndUpdateWellPathFormationNamesData( RimCase* rimCase, RimWellPath* wellPath );
|
||||
|
||||
@@ -140,14 +137,22 @@ public:
|
||||
bool useBranchDetection );
|
||||
void setAndUpdateSimWellFormationNamesData( RimCase* rimCase, const QString& simWellName );
|
||||
|
||||
void setAutoScaleXEnabled( bool enabled );
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
|
||||
void availableXAxisRange( double* minX, double* maxX );
|
||||
void availableDepthRange( double* minimumDepth, double* maximumDepth );
|
||||
void updateParentPlotZoom();
|
||||
void calculateXZoomRangeAndUpdateQwt();
|
||||
void applyXZoomFromVisibleRange();
|
||||
void calculateXZoomRange();
|
||||
void updateEditors();
|
||||
|
||||
void setVisibleXRange( double minValue, double maxValue );
|
||||
void setVisibleYRange( double minValue, double maxValue );
|
||||
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
|
||||
void updateParentPlotZoom();
|
||||
|
||||
void updateEditors();
|
||||
|
||||
void setTickIntervals( double majorTickInterval, double minorTickInterval );
|
||||
void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines );
|
||||
|
||||
@@ -165,42 +170,62 @@ public:
|
||||
void setShowWellPathAttributes( bool on );
|
||||
void setWellPathAttributesSource( RimWellPath* wellPath );
|
||||
|
||||
RimWellPath* wellPathAttributeSource() const;
|
||||
RiuWellLogTrack* viewer();
|
||||
RimWellPath* wellPathAttributeSource() const;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
|
||||
RimWellLogCurve* curveDefinitionFromCurve( const QwtPlotCurve* curve ) const;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
|
||||
void setLogarithmicScale( bool enable );
|
||||
|
||||
std::map<int, std::vector<RimWellFlowRateCurve*>> visibleStackedCurves();
|
||||
|
||||
QString description();
|
||||
std::vector<RimWellLogCurve*> curvesVector();
|
||||
std::vector<RimWellLogCurve*> visibleCurvesVector();
|
||||
std::vector<RimWellLogCurve*> curves() const;
|
||||
std::vector<RimWellLogCurve*> visibleCurves() const;
|
||||
|
||||
void uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrdering );
|
||||
void uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
void setFormationsForCaseWithSimWellOnly( bool caseWithSimWellOnly );
|
||||
void updateAxisAndGridTickIntervals();
|
||||
void updateXAxisAndGridTickIntervals();
|
||||
|
||||
void updateAllLegendItems();
|
||||
|
||||
QString asciiDataForPlotExport() const;
|
||||
|
||||
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
||||
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange = false ) override;
|
||||
|
||||
void updatePlotWindowLayout() override;
|
||||
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
void updateAxes() override;
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void updateParentPlotLayout();
|
||||
void calculateXZoomRange();
|
||||
void calculateYZoomRange();
|
||||
|
||||
void updateXZoom();
|
||||
void updateYZoom();
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void initAfterRead() override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void computeAndSetXRangeMinForLogarithmicScale();
|
||||
|
||||
@@ -239,14 +264,23 @@ private:
|
||||
|
||||
void updateWellPathAttributesCollection();
|
||||
|
||||
void onWidthScaleFactorChange() override;
|
||||
|
||||
RimWellLogPlot* parentWellLogPlot() const;
|
||||
|
||||
private:
|
||||
QString m_xAxisTitle;
|
||||
|
||||
caf::PdmField<bool> m_show;
|
||||
caf::PdmField<QString> m_userName;
|
||||
caf::PdmChildArrayField<RimWellLogCurve*> curves;
|
||||
caf::PdmField<double> m_visibleXRangeMin;
|
||||
caf::PdmField<double> m_visibleXRangeMax;
|
||||
caf::PdmField<bool> m_show;
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<RimPlotInterface::WidthScaleFactorEnum> m_widthScaleFactor;
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogCurve*> m_curves;
|
||||
caf::PdmField<double> m_visibleXRangeMin;
|
||||
caf::PdmField<double> m_visibleXRangeMax;
|
||||
caf::PdmField<double> m_visibleYRangeMin;
|
||||
caf::PdmField<double> m_visibleYRangeMax;
|
||||
|
||||
caf::PdmField<bool> m_isAutoScaleXEnabled;
|
||||
caf::PdmField<bool> m_isLogarithmicScaleEnabled;
|
||||
caf::PdmField<RimWellLogPlot::AxisGridEnum> m_xAxisGridVisibility;
|
||||
@@ -268,7 +302,6 @@ private:
|
||||
caf::PdmField<int> m_formationBranchIndex;
|
||||
caf::PdmField<caf::AppEnum<RigWellPathFormations::FormationLevel>> m_formationLevel;
|
||||
caf::PdmField<bool> m_showformationFluids;
|
||||
caf::PdmField<caf::AppEnum<WidthScaleFactor>> m_widthScaleFactor;
|
||||
caf::PdmField<bool> m_formationBranchDetection;
|
||||
caf::PdmField<bool> m_showWellPathAttributes;
|
||||
caf::PdmField<bool> m_showWellPathCompletions;
|
||||
@@ -285,7 +318,6 @@ private:
|
||||
|
||||
bool m_formationsForCaseWithSimWellOnly;
|
||||
|
||||
QPointer<RiuWellLogTrack> m_wellLogTrackPlotWidget;
|
||||
|
||||
QPointer<RiuWellLogTrack> m_plotWidget;
|
||||
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
|
||||
};
|
||||
|
||||
@@ -186,10 +186,10 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet()
|
||||
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfType( parentPlot );
|
||||
if ( parentPlot && parentPlot->qwtPlot() )
|
||||
if ( parentPlot && parentPlot->viewer() )
|
||||
{
|
||||
m_qwtPlotCurveForLegendText->detach();
|
||||
parentPlot->qwtPlot()->removeEnsembleCurveSetLegend( this );
|
||||
parentPlot->removeEnsembleCurveSetLegend( this );
|
||||
}
|
||||
|
||||
delete m_qwtPlotCurveForLegendText;
|
||||
@@ -272,7 +272,7 @@ void RimEnsembleCurveSet::reattachQwtCurves()
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot )
|
||||
{
|
||||
m_qwtPlotCurveForLegendText->attach( plot->qwtPlot() );
|
||||
m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ void RimEnsembleCurveSet::addCurve( RimSummaryCurve* curve )
|
||||
{
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot ) curve->setParentQwtPlotNoReplot( plot->qwtPlot() );
|
||||
if ( plot ) curve->setParentQwtPlotNoReplot( plot->viewer() );
|
||||
|
||||
curve->setColor( m_color );
|
||||
m_curves.push_back( curve );
|
||||
@@ -635,7 +635,7 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector Y" );
|
||||
curveDataGroup->add( &m_yValuesSummaryCaseCollection );
|
||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||
curveDataGroup->add( &m_plotAxis );
|
||||
}
|
||||
|
||||
@@ -946,18 +946,18 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot && plot->qwtPlot() )
|
||||
if ( plot && plot->viewer() )
|
||||
{
|
||||
if ( m_yValuesSummaryCaseCollection() && isCurvesVisible() && m_colorMode == BY_ENSEMBLE_PARAM &&
|
||||
m_legendConfig->showLegend() )
|
||||
{
|
||||
plot->qwtPlot()->addOrUpdateEnsembleCurveSetLegend( this );
|
||||
plot->addOrUpdateEnsembleCurveSetLegend( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
plot->qwtPlot()->removeEnsembleCurveSetLegend( this );
|
||||
plot->removeEnsembleCurveSetLegend( this );
|
||||
}
|
||||
plot->qwtPlot()->replot();
|
||||
plot->viewer()->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,13 +1011,13 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
|
||||
}
|
||||
}
|
||||
|
||||
if ( plot->qwtPlot() ) m_qwtPlotCurveForLegendText->attach( plot->qwtPlot() );
|
||||
if ( plot->viewer() ) m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
||||
}
|
||||
|
||||
if ( plot->qwtPlot() )
|
||||
if ( plot->viewer() )
|
||||
{
|
||||
plot->qwtPlot()->updateLegend();
|
||||
plot->qwtPlot()->replot();
|
||||
plot->viewer()->updateLegend();
|
||||
plot->viewer()->scheduleReplot();
|
||||
plot->updateAxes();
|
||||
plot->updatePlotInfoLabel();
|
||||
}
|
||||
@@ -1079,7 +1079,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
for ( auto address : addresses )
|
||||
{
|
||||
auto curve = new RimSummaryCurve();
|
||||
curve->setParentQwtPlotNoReplot( plot->qwtPlot() );
|
||||
curve->setParentQwtPlotNoReplot( plot->viewer() );
|
||||
m_curves.push_back( curve );
|
||||
curve->setColor( m_statistics->color() );
|
||||
curve->setColor( m_statistics->color() );
|
||||
@@ -1103,9 +1103,9 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
curve->updateQwtPlotAxis();
|
||||
}
|
||||
|
||||
if ( plot->qwtPlot() )
|
||||
if ( plot->viewer() )
|
||||
{
|
||||
plot->qwtPlot()->updateLegend();
|
||||
plot->viewer()->updateLegend();
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
@@ -1163,7 +1163,7 @@ void RimEnsembleCurveSet::updateAllTextInPlot()
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( summaryPlot );
|
||||
if ( summaryPlot->qwtPlot() )
|
||||
if ( summaryPlot->viewer() )
|
||||
{
|
||||
summaryPlot->updatePlotTitle();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ RimSummaryPlot* RimSummaryCrossPlotCollection::createSummaryPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryCrossPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
plot->setDescription( QString( "Summary Cross Plot %1" ).arg( m_summaryCrossPlots.size() ) );
|
||||
|
||||
|
||||
@@ -637,10 +637,10 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
QString curveDataGroupName = "Summary Vector";
|
||||
if ( isCrossPlotCurve() ) curveDataGroupName += " Y";
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroupWithKeyword( curveDataGroupName, "Summary Vector Y" );
|
||||
curveDataGroup->add( &m_yValuesSummaryCase, {true, 3, 1} );
|
||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField, {true, 2, 1} );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, {false, 1, 0} );
|
||||
curveDataGroup->add( &m_plotAxis, {true, 3, 1} );
|
||||
curveDataGroup->add( &m_yValuesSummaryCase, { true, 3, 1 } );
|
||||
curveDataGroup->add( &m_yValuesSummaryAddressUiField, { true, 2, 1 } );
|
||||
curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||
curveDataGroup->add( &m_plotAxis, { true, 3, 1 } );
|
||||
|
||||
if ( isCrossPlotCurve() )
|
||||
m_showErrorBars = false;
|
||||
@@ -651,9 +651,9 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
if ( isCrossPlotCurve() )
|
||||
{
|
||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector X" );
|
||||
curveDataGroup->add( &m_xValuesSummaryCase, {true, 3, 1} );
|
||||
curveDataGroup->add( &m_xValuesSummaryAddressUiField, {true, 2, 1} );
|
||||
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, {false, 1, 0} );
|
||||
curveDataGroup->add( &m_xValuesSummaryCase, { true, 3, 1 } );
|
||||
curveDataGroup->add( &m_xValuesSummaryAddressUiField, { true, 2, 1 } );
|
||||
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, { false, 1, 0 } );
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
|
||||
|
||||
@@ -63,60 +63,33 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName()
|
||||
QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& summaryAddress,
|
||||
const RimSummaryPlotNameHelper* nameHelper ) const
|
||||
{
|
||||
std::string text;
|
||||
|
||||
RimSummaryCurve* summaryCurve = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryCurve );
|
||||
|
||||
if ( m_vectorName )
|
||||
std::string unitNameY;
|
||||
if ( summaryCurve )
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity();
|
||||
if ( !skipSubString )
|
||||
{
|
||||
text += summaryAddress.quantityName();
|
||||
|
||||
if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
{
|
||||
text = RiaStatisticsTools::replacePercentileByPValueText( QString::fromStdString( text ) ).toStdString();
|
||||
}
|
||||
|
||||
if ( m_unit && summaryCurve && !summaryCurve->unitNameY().empty() )
|
||||
{
|
||||
text += "[" + summaryCurve->unitNameY() + "]";
|
||||
}
|
||||
}
|
||||
unitNameY = summaryCurve->unitNameY();
|
||||
}
|
||||
|
||||
appendAddressDetails( text, summaryAddress, nameHelper );
|
||||
|
||||
QString caseName;
|
||||
std::string caseNameY;
|
||||
if ( caseNameY.empty() && summaryCurve && summaryCurve->summaryCaseY() )
|
||||
{
|
||||
caseNameY = summaryCurve->summaryCaseY()->caseName().toStdString();
|
||||
}
|
||||
|
||||
{
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
||||
{
|
||||
caseName = ensembleCurveSet->summaryCaseCollection()->name();
|
||||
caseNameY = ensembleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
if ( caseName.isEmpty() && summaryCurve && summaryCurve->summaryCaseY() )
|
||||
{
|
||||
caseName = summaryCurve->summaryCaseY()->caseName();
|
||||
}
|
||||
QString curveName = buildCurveName( summaryAddress, nameHelper, unitNameY, caseNameY );
|
||||
|
||||
if ( !caseName.isEmpty() )
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if ( m_caseName && !skipSubString )
|
||||
{
|
||||
if ( !text.empty() ) text += ", ";
|
||||
text += caseName.toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
return QString::fromStdString( text );
|
||||
return curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -125,41 +98,33 @@ QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& sum
|
||||
QString RimSummaryCurveAutoName::curveNameX( const RifEclipseSummaryAddress& summaryAddress,
|
||||
const RimSummaryPlotNameHelper* nameHelper ) const
|
||||
{
|
||||
std::string text;
|
||||
|
||||
RimSummaryCurve* summaryCurve = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryCurve );
|
||||
|
||||
if ( m_vectorName )
|
||||
std::string unitNameX;
|
||||
if ( summaryCurve )
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity();
|
||||
if ( !skipSubString )
|
||||
{
|
||||
text += summaryAddress.quantityName();
|
||||
unitNameX = summaryCurve->unitNameX();
|
||||
}
|
||||
|
||||
if ( m_unit && summaryCurve && !summaryCurve->unitNameX().empty() )
|
||||
{
|
||||
text += "[" + summaryCurve->unitNameX() + "]";
|
||||
}
|
||||
std::string caseNameX;
|
||||
if ( caseNameX.empty() && summaryCurve && summaryCurve->summaryCaseX() )
|
||||
{
|
||||
caseNameX = summaryCurve->summaryCaseX()->caseName().toStdString();
|
||||
}
|
||||
|
||||
{
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
||||
{
|
||||
caseNameX = ensembleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
appendAddressDetails( text, summaryAddress, nameHelper );
|
||||
QString curveName = buildCurveName( summaryAddress, nameHelper, unitNameX, caseNameX );
|
||||
|
||||
if ( summaryCurve && summaryCurve->summaryCaseX() )
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if ( m_caseName && !skipSubString )
|
||||
{
|
||||
QString caseName = summaryCurve->summaryCaseX()->caseName();
|
||||
|
||||
if ( !text.empty() ) text += ", ";
|
||||
text += caseName.toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
return QString::fromStdString( text );
|
||||
return curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -208,6 +173,53 @@ void RimSummaryCurveAutoName::appendLgrName( std::string& text, const RifEclipse
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& summaryAddress,
|
||||
const RimSummaryPlotNameHelper* nameHelper,
|
||||
const std::string& unitText,
|
||||
const std::string& caseName ) const
|
||||
{
|
||||
std::string text; // Using std::string locally to avoid a lot of conversion when building the curve name
|
||||
|
||||
if ( m_vectorName )
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity();
|
||||
if ( !skipSubString )
|
||||
{
|
||||
text = summaryAddress.quantityName();
|
||||
}
|
||||
|
||||
if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
{
|
||||
text = RiaStatisticsTools::replacePercentileByPValueText(
|
||||
QString::fromStdString( summaryAddress.quantityName() ) )
|
||||
.toStdString();
|
||||
}
|
||||
|
||||
if ( m_unit && !unitText.empty() )
|
||||
{
|
||||
text += "[" + unitText + "]";
|
||||
}
|
||||
}
|
||||
|
||||
appendAddressDetails( text, summaryAddress, nameHelper );
|
||||
|
||||
if ( !caseName.empty() )
|
||||
{
|
||||
bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
|
||||
|
||||
if ( m_caseName && !skipSubString )
|
||||
{
|
||||
if ( !text.empty() ) text += ", ";
|
||||
text += caseName;
|
||||
}
|
||||
}
|
||||
|
||||
return QString::fromStdString( text );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -52,6 +52,11 @@ private:
|
||||
const RimSummaryPlotNameHelper* nameHelper ) const;
|
||||
void appendLgrName( std::string& text, const RifEclipseSummaryAddress& summaryAddress ) const;
|
||||
|
||||
QString buildCurveName( const RifEclipseSummaryAddress& summaryAddress,
|
||||
const RimSummaryPlotNameHelper* nameHelper,
|
||||
const std::string& unitText,
|
||||
const std::string& caseName ) const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_vectorName;
|
||||
caf::PdmField<bool> m_unit;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicEditSummaryPlotFeature.h"
|
||||
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
@@ -33,6 +35,7 @@
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeViewEditor.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
@@ -55,6 +58,10 @@ RimSummaryCurveCollection::RimSummaryCurveCollection()
|
||||
CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" );
|
||||
m_showCurves.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_editPlot, "EditPlot", false, "", "", "", "" );
|
||||
m_editPlot.xmlCapability()->disableIO();
|
||||
m_editPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "", "", "", "" );
|
||||
m_ySourceStepping = new RimSummaryPlotSourceStepping;
|
||||
m_ySourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::Y_AXIS );
|
||||
@@ -309,7 +316,7 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
|
||||
parentPlot->updatePlotTitle();
|
||||
if ( parentPlot->qwtPlot() ) parentPlot->qwtPlot()->updateLegend();
|
||||
if ( parentPlot->viewer() ) parentPlot->viewer()->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -407,6 +414,33 @@ void RimSummaryCurveCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
|
||||
{
|
||||
loadDataAndUpdate( true );
|
||||
}
|
||||
else if ( changedField == &m_editPlot )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
this->firstAncestorOrThisOfType( plot );
|
||||
if ( plot )
|
||||
{
|
||||
RicEditSummaryPlotFeature::editSummaryPlot( plot );
|
||||
}
|
||||
m_editPlot = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( &m_editPlot == field )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Edit Plot";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -85,9 +85,14 @@ private:
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showCurves;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
caf::PdmField<bool> m_editPlot;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_ySourceStepping;
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_xSourceStepping;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,8 +24,8 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimPlotWindow.h"
|
||||
|
||||
#include "qwt_plot_textlabel.h"
|
||||
|
||||
@@ -64,7 +64,7 @@ class QKeyEvent;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlot : public RimPlot, public RimRiuQwtPlotOwnerInterface
|
||||
class RimSummaryPlot : public RimPlotWindow, public RimPlotInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
|
||||
void setDescription( const QString& description );
|
||||
QString description() const;
|
||||
bool isChecked() const override;
|
||||
|
||||
void enableShowPlotTitle( bool enable );
|
||||
void enableAutoPlotTitle( bool enable );
|
||||
@@ -103,30 +104,27 @@ public:
|
||||
void reattachAllCurves();
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
void updateAxes();
|
||||
void zoomAll() override;
|
||||
|
||||
void updateZoomInQwt();
|
||||
void updateAxes() override;
|
||||
|
||||
bool isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) const;
|
||||
|
||||
RimSummaryTimeAxisProperties* timeAxisProperties();
|
||||
time_t firstTimeStepOfFirstCurve();
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QWidget* viewWidget() override;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
|
||||
QString asciiDataForPlotExport( DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const;
|
||||
QString asciiDataForSummaryPlotExport( DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const;
|
||||
|
||||
std::vector<RimSummaryCurve*> summaryAndEnsembleCurves() const;
|
||||
std::set<RiaSummaryCurveDefinition> summaryAndEnsembleCurveDefinitions() const;
|
||||
std::vector<RimSummaryCurve*> summaryCurves() const;
|
||||
void deleteAllSummaryCurves();
|
||||
RimSummaryCurveCollection* summaryCurveCollection() const;
|
||||
RiuSummaryQwtPlot* qwtPlot() const;
|
||||
|
||||
std::vector<RimEnsembleCurveSet*> curveSets() const;
|
||||
|
||||
void updatePlotTitle();
|
||||
void updatePlotTitle() override;
|
||||
|
||||
const RimSummaryPlotNameHelper* activePlotTitleHelperAllCurves() const;
|
||||
void updateCurveNames();
|
||||
@@ -134,6 +132,8 @@ public:
|
||||
|
||||
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||
|
||||
void updateLayout() override;
|
||||
|
||||
void updateAll();
|
||||
void updateAllLegendItems();
|
||||
|
||||
@@ -163,14 +163,21 @@ public:
|
||||
virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const;
|
||||
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
public:
|
||||
// Rim2dPlotInterface overrides
|
||||
void updateAxisScaling() override;
|
||||
void updateAxisDisplay() override;
|
||||
void updateZoomWindowFromQwt() override;
|
||||
void selectAxisInPropertyEditor( int axis ) override;
|
||||
void setAutoZoomForAllAxes( bool enableAutoZoom ) override;
|
||||
caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
|
||||
void zoomAll() override;
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
|
||||
void createPlotWidget() override;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void addOrUpdateEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
|
||||
void removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
|
||||
|
||||
public:
|
||||
// RimViewWindow overrides
|
||||
@@ -208,15 +215,13 @@ private:
|
||||
bool hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const;
|
||||
|
||||
RimPlotAxisProperties* yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis leftOrRightPlotAxis ) const;
|
||||
void updateAxis( RiaDefines::PlotAxis plotAxis );
|
||||
void updateYAxis( RiaDefines::PlotAxis plotAxis );
|
||||
|
||||
void updateZoomForAxis( RiaDefines::PlotAxis plotAxis );
|
||||
|
||||
void updateTimeAxis();
|
||||
void updateBottomXAxis();
|
||||
|
||||
void updateAxisRangesFromQwt();
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
private:
|
||||
@@ -226,8 +231,7 @@ private:
|
||||
|
||||
caf::PdmField<int> m_legendFontSize;
|
||||
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
caf::PdmField<QString> m_userDefinedPlotTitle;
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
|
||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
||||
@@ -245,7 +249,7 @@ private:
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotFilterTextCurveSetEditor*> m_textCurveSetEditor;
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
QPointer<RiuSummaryQwtPlot> m_plotWidget;
|
||||
std::unique_ptr<QwtPlotTextLabel> m_plotInfoLabel;
|
||||
|
||||
bool m_isCrossPlot;
|
||||
|
||||
@@ -50,7 +50,6 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle()
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
plot->enableAutoPlotTitle( true );
|
||||
summaryPlots.push_back( plot );
|
||||
@@ -65,7 +64,6 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
RiaApplication::instance()->project()->assignViewIdToView( plot );
|
||||
|
||||
summaryPlots.push_back( plot );
|
||||
plot->setDescription( name );
|
||||
|
||||
@@ -71,7 +71,7 @@ RimSummaryPlotFilterTextCurveSetEditor::RimSummaryPlotFilterTextCurveSetEditor()
|
||||
CAF_PDM_InitObject( "Curve Set Filter Text", "", "", "" );
|
||||
|
||||
// clang-format off
|
||||
QString filterTextHeading = "Text to Create Summary Vectors";
|
||||
QString filterTextHeading = "Create Summary Curves from Text";
|
||||
QString filterTextShortcut = " (Ctrl + F)";
|
||||
|
||||
QString filterTextToolTip =
|
||||
|
||||
Reference in New Issue
Block a user