Introduce RimGridPlotWindow and RiuQwtPlotWidget

This commit is contained in:
Gaute Lindkvist
2019-10-11 15:54:19 +02:00
parent 2857a13e7c
commit c578a43b53
89 changed files with 5249 additions and 3809 deletions

View File

@@ -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
@@ -212,7 +214,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

View File

@@ -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", "", "", "" );
@@ -189,12 +189,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 +270,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 )
@@ -865,9 +865,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 );
}
}
}

View File

@@ -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

View File

@@ -229,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 );
}
}
}
@@ -486,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 );
@@ -700,8 +709,8 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
curveGroupId++;
}
plotTrack->setAutoScaleXEnabled( true );
RimWellLogPlot::onLoadDataAndUpdate();
plotTrack->calculateXZoomRange();
}
//--------------------------------------------------------------------------------------------------
@@ -886,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 )
{
@@ -924,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();
}
}
@@ -970,20 +991,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 );
@@ -1098,9 +1122,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;
}

View File

@@ -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;
@@ -150,10 +150,10 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* newCurve )
currentColor = 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() );
currentColor = RiaColorTools::blendCvfColors( backgroundColor, currentColor, 2, 1 );
}
}
@@ -185,35 +185,41 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* newCurve )
//--------------------------------------------------------------------------------------------------
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 );
}
}
}
}
@@ -360,7 +366,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();
@@ -379,7 +388,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 )
@@ -422,10 +431,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;
}
@@ -437,8 +450,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();
@@ -666,16 +682,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;
}
}
}
}
@@ -821,7 +841,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();
@@ -899,18 +919,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 );
@@ -985,9 +1008,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;
@@ -1042,13 +1070,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 );
}
}
}
}
@@ -1138,14 +1171,6 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::onDepthTypeChanged()
{
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -130,8 +130,6 @@ private:
void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
void onDepthTypeChanged() override;
private:
caf::PdmField<QString> m_wellPathNameOrSimWellName;
caf::PdmField<int> m_branchIndex;

View File

@@ -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;
}
}
@@ -501,39 +508,55 @@ void RimGridCrossPlot::performAutoNameUpdate()
updateCurveNamesAndPlotTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisDisplay()
{
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();
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 );
QwtLegend* legend = new QwtLegend( m_plotWidget );
auto font = legend->font();
font.setPointSize( m_legendFontSize() );
legend->setFont( font );
m_qwtPlot->insertLegend( legend, QwtPlot::BottomLegend );
m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend );
}
else
{
m_qwtPlot->insertLegend( nullptr );
m_plotWidget->insertLegend( nullptr );
}
m_qwtPlot->updateLegendSizesToMatchPlot();
m_qwtPlot->replot();
m_plotWidget->updateLegendSizesToMatchPlot();
m_plotWidget->scheduleReplot();
}
}
@@ -547,9 +570,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();
}
@@ -621,14 +644,6 @@ QString RimGridCrossPlot::asciiDataForPlotExport( int dataSetIndex ) const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGridCrossQwtPlot* RimGridCrossPlot::qwtPlot() const
{
return m_qwtPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -691,34 +706,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 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -772,7 +819,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();
@@ -787,17 +834,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() )
{
@@ -809,16 +856,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() )
@@ -833,38 +880,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 );
}
}
@@ -873,10 +920,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;
@@ -952,7 +999,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 );
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -23,7 +23,8 @@
#include "RiaDefines.h"
#include "RimNameConfig.h"
#include "RimPlot.h"
#include "RimPlotInterface.h"
#include "RimPlotWindow.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include <QPointer>
@@ -49,7 +50,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 +58,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;
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 +95,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 +123,8 @@ protected:
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void updatePlot();
void updateAxisDisplay();
void updatePlot();
virtual QString xAxisParameterString() const;
QString yAxisParameterString() const;
@@ -129,6 +141,8 @@ protected:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
void updatePlotTitle() override;
private:
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend;
@@ -140,5 +154,5 @@ private:
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
};

View File

@@ -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 );
}
}
}

View File

@@ -460,7 +460,7 @@ void Rim2dIntersectionView::setName( const QString& name )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim2dIntersectionView::isWindowVisible()
bool Rim2dIntersectionView::isWindowVisible() const
{
return m_showWindow();
}

View File

@@ -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,

View File

@@ -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();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,628 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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();
}
}
#if 0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updatePlotNames()
{
auto plotVector = plots();
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{
QString description = plotVector[tIdx]->description();
QRegularExpression regexp( "Track \\d+" );
description.replace( regexp, QString( "Track %1" ).arg( tIdx + 1 ) );
plotVector[tIdx]->setDescription( description );
}
}
#endif
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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();
updateColumnCount();
updateConnectedEditors();
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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();
updateColumnCount();
}
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();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridPlotWindow::updateColumnCount()
{
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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;
}

View File

@@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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;
// 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;
void updateColumnCount();
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;
};

View File

@@ -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
{

View File

@@ -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 );
}

View File

@@ -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();
};

View 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 "";
}

View File

@@ -0,0 +1,83 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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;
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 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() {}
};

View 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;
}

View 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;
};

View File

@@ -196,6 +196,14 @@ void RimViewWindow::viewNavigationChanged()
//--------------------------------------------------------------------------------------------------
void RimViewWindow::onViewNavigationChanged() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewWindow::isWindowVisible() const
{
return m_showWindow();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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

View File

@@ -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 );
}

View File

@@ -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() )
{

View File

@@ -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;
};

View File

@@ -679,6 +679,14 @@ std::vector<caf::PdmFieldHandle*> RimWellLogCurveCommonDataSource::fieldsToShowI
return fieldsToDisplay;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogCurveCommonDataSource::smoothingUiOrderinglabel()
{
return "ApplySmoothing";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -894,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 );

View File

@@ -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,

View File

@@ -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->setYTitle( "PL/" + wellLogPlot->depthAxisTitle() );
}
}

View File

@@ -34,7 +34,7 @@
#include "RimWellRftPlot.h"
#include "RiuQwtPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "RiuQwtPlotWidget.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"

File diff suppressed because it is too large Load Diff

View File

@@ -27,8 +27,7 @@
#include "cafPdmObject.h"
#include "RiaDefines.h"
#include "RimPlot.h"
#include "RimViewWindow.h"
#include "RimGridPlotWindow.h"
#include "RimWellLogPlotNameConfig.h"
#include <QPointer>
@@ -36,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;
@@ -57,16 +56,6 @@ public:
CONNECTION_NUMBER
};
enum ColumnCount
{
COLUMNS_1 = 1,
COLUMNS_2 = 2,
COLUMNS_3 = 3,
COLUMNS_4 = 4,
COLUMNS_UNLIMITED = 1000,
};
typedef caf::AppEnum<ColumnCount> ColumnCountEnum;
enum AxisGridVisibility
{
AXIS_GRID_NONE,
@@ -80,114 +69,66 @@ 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 );
int columnCount() const;
caf::PdmFieldHandle* columnCountField();
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 setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits );
void setAvailableDepthTypes( const std::set<RimWellLogPlot::DepthTypeEnum>& depthTypes );
void updateTrackOrderFromWidget();
void onPlotAdditionOrRemoval() 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;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
private:
void applyZoomAllDepths();
void applyDepthZoomFromVisibleDepth();
void recreateTrackPlots();
void detachAllCurves();
void updatePlotTitle();
virtual void onDepthTypeChanged();
void updateColumnCount();
protected:
caf::PdmField<QString> m_userName_OBSOLETE;
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
@@ -196,11 +137,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::PdmField<ColumnCountEnum> m_columnCountEnum;
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;
@@ -208,7 +144,4 @@ protected:
double m_minAvailableDepth;
double m_maxAvailableDepth;
friend class RiuWellLogPlot;
QPointer<RiuWellLogPlot> m_viewer;
};

View File

@@ -33,7 +33,6 @@ class RigGeoMechCaseData;
class RigWellPath;
class RimWellPath;
class RimEclipseCase;
class RiuWellLogPlot;
//==================================================================================================
///

View File

@@ -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->setYTitle( "TVDMSL" );
}
else if ( m_derivedMDSource == PSEUDO_LENGTH )
{
viewer->setDepthTitle( "PL/" + wellLogPlot->depthPlotTitle() );
viewer->setYTitle( "PL/" + wellLogPlot->depthAxisTitle() );
}
else if ( m_derivedMDSource == WELL_PATH )
{
viewer->setDepthTitle( "WELL/" + wellLogPlot->depthPlotTitle() );
viewer->setYTitle( "WELL/" + wellLogPlot->depthAxisTitle() );
}
else
{
viewer->setDepthTitle( "OBS/" + wellLogPlot->depthPlotTitle() );
viewer->setYTitle( "OBS/" + wellLogPlot->depthAxisTitle() );
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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,60 @@ 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;
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 +262,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 +300,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 +316,6 @@ private:
bool m_formationsForCaseWithSimWellOnly;
QPointer<RiuWellLogTrack> m_wellLogTrackPlotWidget;
QPointer<RiuWellLogTrack> m_plotWidget;
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
};

View File

@@ -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();
}

View File

@@ -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" );

View File

@@ -309,7 +309,7 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
firstAncestorOrThisOfTypeAsserted( parentPlot );
parentPlot->updatePlotTitle();
if ( parentPlot->qwtPlot() ) parentPlot->qwtPlot()->updateLegend();
if ( parentPlot->viewer() ) parentPlot->viewer()->updateLegend();
}
//--------------------------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,8 @@
#include "RifEclipseSummaryAddress.h"
#include "RimPlot.h"
#include "RimPlotInterface.h"
#include "RimPlotWindow.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "qwt_plot_textlabel.h"
@@ -64,7 +65,7 @@ class QKeyEvent;
///
///
//==================================================================================================
class RimSummaryPlot : public RimPlot, public RimRiuQwtPlotOwnerInterface
class RimSummaryPlot : public RimPlotWindow, public RimPlotInterface
{
CAF_PDM_HEADER_INIT;
@@ -74,6 +75,7 @@ public:
void setDescription( const QString& description );
QString description() const;
bool isChecked() const override;
void enableShowPlotTitle( bool enable );
void enableAutoPlotTitle( bool enable );
@@ -104,16 +106,14 @@ public:
void updateCaseNameHasChanged();
void updateAxes();
void zoomAll() override;
void updateZoomInQwt();
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;
@@ -122,11 +122,10 @@ public:
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 +133,8 @@ public:
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
void updateLayout() override;
void updateAll();
void updateAllLegendItems();
@@ -163,14 +164,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 +216,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 +232,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 +250,7 @@ private:
caf::PdmChildField<RimSummaryPlotFilterTextCurveSetEditor*> m_textCurveSetEditor;
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
QPointer<RiuSummaryQwtPlot> m_plotWidget;
std::unique_ptr<QwtPlotTextLabel> m_plotInfoLabel;
bool m_isCrossPlot;