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

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