Refactor RimPlotWindow and RimPlotInterface

This commit is contained in:
Gaute Lindkvist
2019-11-15 10:12:19 +01:00
parent 4dd0651dae
commit d9043db5e0
40 changed files with 697 additions and 765 deletions

View File

@@ -50,10 +50,10 @@ std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString&
bool capitalizeFileNames,
double resampleInterval )
{
std::vector<RimWellLogCurve*> allCurves;
std::vector<RimPlotInterface*> plots = plotWindow->visiblePlots();
std::vector<RimWellLogCurve*> allCurves;
std::vector<RimPlot*> plots = plotWindow->visiblePlots();
for ( RimPlotInterface* plot : plots )
for ( RimPlot* plot : plots )
{
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( plot );
if ( track )

View File

@@ -24,7 +24,7 @@
#include "RimMainPlotCollection.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotCollection.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimProject.h"
#include "RiuPlotMainWindowTools.h"
@@ -60,12 +60,12 @@ RicfCommandResponse RicNewMultiPlotFeature::execute()
if ( !m_plots().empty() )
{
std::vector<RimPlotInterface*> plotInterfaces;
std::vector<RimPlot*> plots;
for ( auto ptr : m_plots() )
{
plotInterfaces.push_back( reinterpret_cast<RimPlotInterface*>( ptr ) );
plots.push_back( reinterpret_cast<RimPlot*>( ptr ) );
}
plotWindow->movePlotsToThis( plotInterfaces, nullptr );
plotWindow->movePlotsToThis( plots, nullptr );
}
plotCollection->updateAllRequiredEditors();
@@ -89,12 +89,12 @@ bool RicNewMultiPlotFeature::isCommandEnabled()
return true;
}
auto selectedPlots = selectedPlotInterfaces();
auto plots = selectedPlots();
std::vector<caf::PdmUiItem*> selectedUiItems;
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
return !selectedPlots.empty() && selectedPlots.size() == selectedUiItems.size();
return !plots.empty() && plots.size() == selectedUiItems.size();
}
//--------------------------------------------------------------------------------------------------
@@ -103,10 +103,10 @@ bool RicNewMultiPlotFeature::isCommandEnabled()
void RicNewMultiPlotFeature::onActionTriggered( bool isChecked )
{
m_plots.v().clear();
auto selectedPlots = selectedPlotInterfaces();
for ( RimPlotInterface* plotInterface : selectedPlots )
auto plots = selectedPlots();
for ( RimPlot* plot : plots )
{
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plotInterface ) );
m_plots.v().push_back( reinterpret_cast<uintptr_t>( plot ) );
}
execute();
}
@@ -116,7 +116,7 @@ void RicNewMultiPlotFeature::onActionTriggered( bool isChecked )
//--------------------------------------------------------------------------------------------------
void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
{
if ( selectedPlotInterfaces().empty() )
if ( selectedPlots().empty() )
{
actionToSetup->setText( "New Empty Multi Plot" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
@@ -131,19 +131,19 @@ void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RicNewMultiPlotFeature::selectedPlotInterfaces()
std::vector<RimPlot*> RicNewMultiPlotFeature::selectedPlots()
{
std::vector<caf::PdmUiItem*> uiItems;
caf::SelectionManager::instance()->selectedItems( uiItems );
std::vector<RimPlotInterface*> plotInterfaces;
std::vector<RimPlot*> plots;
for ( caf::PdmUiItem* uiItem : uiItems )
{
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( uiItem );
RimPlot* plotInterface = dynamic_cast<RimPlot*>( uiItem );
if ( plotInterface )
{
plotInterfaces.push_back( plotInterface );
plots.push_back( plotInterface );
}
}
return plotInterfaces;
return plots;
}

View File

@@ -25,7 +25,7 @@
#include <vector>
class RimPlotInterface;
class RimPlot;
//==================================================================================================
///
@@ -45,7 +45,7 @@ protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static std::vector<RimPlotInterface*> selectedPlotInterfaces();
static std::vector<RimPlot*> selectedPlots();
private:
caf::PdmField<std::vector<uint64_t>> m_plots;

View File

@@ -26,7 +26,7 @@
#include "RiuQwtPlotWidget.h"
#include "RimMultiPlot.h"
#include "RimPlotInterface.h"
#include "RimPlotWindow.h"
#include "RimWellLogTrack.h"
#include "cafSelectionManager.h"
@@ -52,7 +52,7 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
{
RimMultiPlot* multiPlot = nullptr;
object->firstAncestorOrThisOfType( multiPlot );
if ( dynamic_cast<RimPlotInterface*>( object ) && multiPlot )
if ( dynamic_cast<RimPlotWindow*>( object ) && multiPlot )
{
plotsSelected++;
}
@@ -70,21 +70,19 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
std::vector<caf::PdmObject*> selection;
std::vector<RimPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
std::set<RimMultiPlot*> alteredPlotWindows;
for ( size_t i = 0; i < selection.size(); i++ )
for ( RimPlot* plot : selection )
{
RimPlotInterface* plot = dynamic_cast<RimPlotInterface*>( selection[i] );
RimMultiPlot* plotWindow = nullptr;
selection[i]->firstAncestorOrThisOfType( plotWindow );
plot->firstAncestorOrThisOfType( plotWindow );
if ( plot && plotWindow )
{
alteredPlotWindows.insert( plotWindow );
plotWindow->removePlot( plot );
caf::SelectionManager::instance()->removeObjectFromAllSelections( selection[i] );
caf::SelectionManager::instance()->removeObjectFromAllSelections( plot );
plotWindow->updateConnectedEditors();
delete plot;

View File

@@ -191,7 +191,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
formationTrack->setFormationCase( geoMechCase );
formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setColSpan( RimPlotInterface::ONE );
formationTrack->setColSpan( RimPlot::ONE );
}
//--------------------------------------------------------------------------------------------------
@@ -202,7 +202,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
RimGeoMechCase* geoMechCase )
{
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot );
casingShoeTrack->setColSpan( RimPlotInterface::ONE );
casingShoeTrack->setColSpan( RimPlot::ONE );
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
@@ -226,7 +226,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"WBS Parameters",
plot );
paramCurvesTrack->setColSpan( RimPlotInterface::TWO );
paramCurvesTrack->setColSpan( RimPlot::TWO );
paramCurvesTrack->setAutoScaleXEnabled( true );
paramCurvesTrack->setTickIntervals( 0.5, 0.05 );
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
@@ -234,7 +234,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
paramCurvesTrack->setFormationCase( geoMechCase );
paramCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::CURVE_ANNOTATIONS );
paramCurvesTrack->setShowRegionLabels( true );
paramCurvesTrack->setChecked( false );
paramCurvesTrack->setShowWindow( false );
std::vector<QString> resultNames = RiaDefines::wellPathStabilityParameterNames();
std::vector<cvf::Color3f> colors = {cvf::Color3f::CRIMSON, cvf::Color3f::DARK_YELLOW};
@@ -272,7 +272,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Stability Curves",
plot );
stabilityCurvesTrack->setColSpan( RimPlotInterface::FIVE );
stabilityCurvesTrack->setColSpan( RimPlot::FIVE );
stabilityCurvesTrack->setAutoScaleXEnabled( true );
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
@@ -361,7 +361,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 );
minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 );
}
wellPathAnglesTrack->setColSpan( RimPlotInterface::THREE );
wellPathAnglesTrack->setColSpan( RimPlot::THREE );
wellPathAnglesTrack->setVisibleXRange( minValue, maxValue );
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );

View File

@@ -72,7 +72,7 @@ ${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}/RimPlotInterface.h
${CMAKE_CURRENT_LIST_DIR}/RimPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.h
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
@@ -214,7 +214,7 @@ ${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}/RimPlotInterface.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp

View File

@@ -136,8 +136,9 @@ RimWellPltPlot::RimWellPltPlot()
m_nameConfig->setCustomName( "PLT Plot" );
this->setAsPlotMdiWindow();
m_doInitAfterLoad = false;
m_isOnLoad = true;
m_doInitAfterLoad = false;
m_isOnLoad = true;
m_plotLegendsHorizontal = false;
setAvailableDepthTypes( {RiaDefines::MEASURED_DEPTH} );
}
@@ -199,6 +200,7 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet );
plotTrack->setXAxisTitle( axisTitle );
#if 0
QString unitText;
for ( auto unitSet: presentUnitSystems )
@@ -997,13 +999,14 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
if ( track )
{
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" );
track->uiOrderingForXAxisSettings( *axesGroup );
uiOrderingForDepthAxis( *axesGroup );
track->uiOrderingForXAxisSettings( uiOrdering );
caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis Settings" );
uiOrderingForDepthAxis( uiConfigName, *depthGroup );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForPlotLayout( *plotLayoutGroup );
RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *plotLayoutGroup );
RimWellLogPlot::uiOrderingForLegendSettings( uiConfigName, *plotLayoutGroup );
}
}

View File

@@ -118,7 +118,7 @@ RimWellRftPlot::RimWellRftPlot()
m_wellPathCollection = RiaApplication::instance()->project()->activeOilField()->wellPathCollection();
m_nameConfig->setCustomName( "RFT Plot" );
m_plotLegendsHorizontal = true;
m_plotLegendsHorizontal = false;
this->setAsPlotMdiWindow();
m_isOnLoad = true;
@@ -940,13 +940,14 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
if ( track )
{
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" );
track->uiOrderingForXAxisSettings( *axesGroup );
uiOrderingForDepthAxis( *axesGroup );
track->uiOrderingForXAxisSettings( uiOrdering );
caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis Settings" );
uiOrderingForDepthAxis( uiConfigName, *depthGroup );
caf::PdmUiGroup* plotLayoutGroup = uiOrdering.addNewGroup( "Plot Layout" );
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForPlotLayout( *plotLayoutGroup );
RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *plotLayoutGroup );
RimWellLogPlot::uiOrderingForLegendSettings( uiConfigName, *plotLayoutGroup );
}
}

View File

@@ -57,9 +57,6 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
CAF_PDM_InitField( &m_showLegend_OBSOLETE, "ShowLegend", false, "Show Legend", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
@@ -90,22 +87,6 @@ RimGridCrossPlot::~RimGridCrossPlot()
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::isChecked() const
{
return isWindowVisible();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setChecked( bool checked )
{
m_showWindow = checked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -314,14 +295,6 @@ void RimGridCrossPlot::detachAllCurves()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::loadDataAndUpdate()
{
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -338,14 +311,6 @@ void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled )
m_yAxisProperties->setAutoZoom( enabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::createPlotWidget()
{
createViewWidget( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -441,22 +406,6 @@ void RimGridCrossPlot::updateAfterInsertingIntoMultiPlot()
updateLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::rowSpan() const
{
return static_cast<int>( m_rowSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::colSpan() const
{
return static_cast<int>( m_colSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -508,7 +457,7 @@ void RimGridCrossPlot::initAfterRead()
{
if ( m_showLegend_OBSOLETE() )
{
m_showPlotLegends = true;
setLegendsVisible( true );
}
}
@@ -520,14 +469,9 @@ void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
caf::PdmUiGroup* generalGroup = uiOrdering.addNewGroup( "Plot Options" );
generalGroup->add( &m_showInfoBox );
if ( isStandalonePlot() )
if ( isMdiWindow() )
{
generalGroup->add( &m_showPlotLegends );
if ( m_showPlotLegends() )
{
generalGroup->add( &m_legendFontSize );
}
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, *generalGroup );
}
else
{
@@ -563,14 +507,10 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_legendFontSize )
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
updateLegend();
}
else if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
updatePlotWindowLayout();
updateParentLayout();
}
else
{
@@ -578,32 +518,6 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimGridCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_legendFontSize )
{
std::vector<int> fontSizes;
fontSizes.push_back( 8 );
fontSizes.push_back( 10 );
fontSizes.push_back( 12 );
fontSizes.push_back( 14 );
fontSizes.push_back( 16 );
for ( int value : fontSizes )
{
QString text = QString( "%1" ).arg( value );
options.push_back( caf::PdmOptionItemInfo( text, value ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -660,7 +574,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
}
if ( m_plotWidget && isStandalonePlot() )
if ( m_plotWidget && isMdiWindow() )
{
m_plotWidget->setTitle( this->createAutoName() );
}
@@ -695,6 +609,20 @@ void RimGridCrossPlot::swapAxes()
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::asciiDataForPlotExport() const
{
QString fullData;
for ( int i = 0; i < (int)m_crossPlotDataSets.size(); ++i )
{
fullData += asciiTitleForPlotExport( i ) + "\n";
fullData += asciiDataForGridCrossPlotExport( i ) + "\n";
}
return fullData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -758,20 +686,6 @@ void RimGridCrossPlot::setYAxisInverted( bool inverted )
m_yAxisProperties->setAxisInverted( inverted );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::legendFontSize() const
{
RimMultiPlot* plotWindow = nullptr;
this->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
return plotWindow->legendFontSize();
}
return m_legendFontSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -821,8 +735,8 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
if ( forceChange || legendFontSize() == oldFontSize )
{
m_legendFontSize = fontSize;
anyChange = true;
setLegendFontSize( fontSize );
anyChange = true;
}
if ( anyChange ) loadDataAndUpdate();
@@ -833,8 +747,9 @@ bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingTyp
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateLayout()
void RimGridCrossPlot::performLayoutUpdate()
{
updateLegend();
updatePlot();
}
@@ -843,8 +758,8 @@ void RimGridCrossPlot::updateLayout()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateLegend()
{
m_plotWidget->setInternalQwtLegendVisible( m_showPlotLegends() && isStandalonePlot() );
m_plotWidget->setLegendFontSize( m_legendFontSize() );
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
m_plotWidget->setLegendFontSize( legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->updateLegendIcons();

View File

@@ -23,8 +23,7 @@
#include "RiaDefines.h"
#include "RimNameConfig.h"
#include "RimPlotInterface.h"
#include "RimPlotWindow.h"
#include "RimPlot.h"
#include <QPointer>
@@ -49,7 +48,7 @@ protected:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
};
class RimGridCrossPlot : public RimPlotWindow, public RimPlotInterface, public RimNameConfigHolderInterface
class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;
@@ -57,9 +56,6 @@ public:
RimGridCrossPlot();
~RimGridCrossPlot();
bool isChecked() const override;
void setChecked( bool checked ) override;
QString description() const override;
RimGridCrossPlotDataSet* createDataSet();
@@ -83,13 +79,14 @@ public:
void performAutoNameUpdate() override;
void updateCurveNamesAndPlotTitle();
void swapAxes();
QString asciiTitleForPlotExport( int dataSetIndex ) const;
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
QString asciiDataForPlotExport() const override;
QString asciiTitleForPlotExport( int dataSetIndex ) const;
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const;
void setYAxisInverted( bool inverted );
int legendFontSize() const;
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
@@ -97,17 +94,13 @@ public:
int fontSize,
bool forceChange = false ) override;
void updateLayout() override;
void updateLegend();
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
void loadDataAndUpdate() override;
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;
@@ -117,24 +110,20 @@ public:
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoMultiPlot() override;
int rowSpan() const override;
int colSpan() const override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
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 updateAxes() override;
void updatePlot();
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void updateAxes() override;
void updatePlot();
virtual QString xAxisParameterString() const;
QString yAxisParameterString() const;
@@ -152,6 +141,8 @@ protected:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private:
void performLayoutUpdate() override;
void cleanupBeforeClose();
private:
@@ -159,9 +150,6 @@ private:
caf::PdmField<bool> m_showLegend_OBSOLETE;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;

View File

@@ -17,7 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimMultiPlot.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
@@ -79,15 +80,11 @@ RimMultiPlot& RimMultiPlot::operator=( RimMultiPlot&& rhs )
{
RimPlotWindow::operator=( std::move( rhs ) );
m_showPlotWindowTitle = rhs.m_showPlotWindowTitle;
m_plotWindowTitle = rhs.m_plotWindowTitle;
// Move all tracks
std::vector<caf::PdmObject*> plots = rhs.m_plots.childObjects();
std::vector<RimPlot*> plots = rhs.m_plots.childObjects();
rhs.m_plots.clear();
for ( caf::PdmObject* plot : plots )
for ( RimPlot* plot : plots )
{
CAF_ASSERT( dynamic_cast<RimPlotInterface*>( plot ) );
m_plots.push_back( plot );
}
@@ -104,6 +101,14 @@ QWidget* RimMultiPlot::viewWidget()
return m_viewer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimMultiPlot::description() const
{
return multiPlotTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -139,7 +144,7 @@ void RimMultiPlot::setMultiPlotTitle( const QString& title )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::addPlot( RimPlotInterface* plot )
void RimMultiPlot::addPlot( RimPlot* plot )
{
insertPlot( plot, m_plots.size() );
}
@@ -147,12 +152,12 @@ void RimMultiPlot::addPlot( RimPlotInterface* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::insertPlot( RimPlotInterface* plot, size_t index )
void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
{
m_plots.insert( index, toPdmObjectAsserted( plot ) );
plot->setChecked( true );
m_plots.insert( index, plot );
plot->setShowWindow( true );
if ( m_viewer )
{
@@ -168,7 +173,7 @@ void RimMultiPlot::insertPlot( RimPlotInterface* plot, size_t index )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::removePlot( RimPlotInterface* plot )
void RimMultiPlot::removePlot( RimPlot* plot )
{
if ( plot )
{
@@ -176,7 +181,7 @@ void RimMultiPlot::removePlot( RimPlotInterface* plot )
{
m_viewer->removePlot( plot->viewer() );
}
m_plots.removeChildObject( toPdmObjectAsserted( plot ) );
m_plots.removeChildObject( plot );
onPlotAdditionOrRemoval();
}
@@ -185,13 +190,12 @@ void RimMultiPlot::removePlot( RimPlotInterface* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::movePlotsToThis( const std::vector<RimPlotInterface*>& plotsToMove,
RimPlotInterface* plotToInsertAfter )
void RimMultiPlot::movePlotsToThis( const std::vector<RimPlot*>& plotsToMove, RimPlot* plotToInsertAfter )
{
for ( size_t tIdx = 0; tIdx < plotsToMove.size(); tIdx++ )
{
RimPlotInterface* plot = plotsToMove[tIdx];
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
RimPlot* plot = plotsToMove[tIdx];
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
RimMultiPlot* srcPlot = nullptr;
pdmObject->firstAncestorOrThisOfType( srcPlot );
@@ -228,55 +232,47 @@ size_t RimMultiPlot::plotCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimMultiPlot::plotIndex( const RimPlotInterface* plot ) const
size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const
{
return m_plots.index( toPdmObjectAsserted( plot ) );
return m_plots.index( plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotInterface* RimMultiPlot::plotByIndex( size_t index ) const
RimPlot* RimMultiPlot::plotByIndex( size_t index ) const
{
return toPlotInterfaceAsserted( m_plots[index] );
return m_plots[index];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RimMultiPlot::plots() const
std::vector<RimPlot*> RimMultiPlot::plots() const
{
std::vector<RimPlotInterface*> allPlots;
allPlots.reserve( m_plots.size() );
return m_plots.childObjects();
}
for ( caf::PdmObject* pdmObject : m_plots )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlot*> RimMultiPlot::visiblePlots() const
{
std::vector<RimPlot*> allVisiblePlots;
for ( RimPlot* plot : m_plots() )
{
allPlots.push_back( toPlotInterfaceAsserted( pdmObject ) );
}
return allPlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotInterface*> RimMultiPlot::visiblePlots() const
{
std::vector<RimPlotInterface*> allPlots;
for ( caf::PdmObject* pdmObject : m_plots() )
{
RimPlotInterface* plot = toPlotInterfaceAsserted( pdmObject );
if ( plot->isChecked() )
if ( plot->showWindow() )
{
allPlots.push_back( plot );
allVisiblePlots.push_back( plot );
}
}
return allPlots;
return allVisiblePlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updateLayout()
void RimMultiPlot::performLayoutUpdate()
{
if ( m_showWindow )
{
@@ -294,9 +290,9 @@ void RimMultiPlot::updatePlotNames() {}
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::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() );
std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) {
auto indexLhs = m_viewer->indexOfPlotWidget( lhs->viewer() );
auto indexRhs = m_viewer->indexOfPlotWidget( rhs->viewer() );
return indexLhs < indexRhs;
} );
updatePlotNames();
@@ -308,7 +304,7 @@ void RimMultiPlot::updatePlotOrderFromGridWidget()
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setAutoScaleXEnabled( bool enabled )
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->setAutoScaleXEnabled( enabled );
}
@@ -319,7 +315,7 @@ void RimMultiPlot::setAutoScaleXEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setAutoScaleYEnabled( bool enabled )
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->setAutoScaleYEnabled( enabled );
}
@@ -370,9 +366,9 @@ QString RimMultiPlot::asciiDataForPlotExport() const
{
QString out = multiPlotTitle() + "\n";
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
if ( plot->isChecked() )
if ( plot->showWindow() )
{
out += plot->asciiDataForPlotExport();
}
@@ -467,18 +463,18 @@ void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void RimMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForPlotLayout( *titleAndLegendsGroup );
uiOrderingForPlotLayout( uiConfigName, *titleAndLegendsGroup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
void RimMultiPlot::uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotWindowTitle );
uiOrdering.add( &m_plotWindowTitle );
uiOrdering.add( &m_showIndividualPlotTitles );
RimPlotWindow::uiOrderingForPlotLayout( uiOrdering );
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, uiOrdering );
uiOrdering.add( &m_columnCountEnum );
}
@@ -555,7 +551,7 @@ void RimMultiPlot::updatePlots()
{
if ( m_showWindow )
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->loadDataAndUpdate();
}
@@ -568,7 +564,7 @@ void RimMultiPlot::updatePlots()
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updateZoom()
{
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
plot->updateZoomInQwt();
}
@@ -605,7 +601,7 @@ bool RimMultiPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingTy
{
return true;
}
for ( const RimPlotInterface* plot : plots() )
for ( const RimPlot* plot : plots() )
{
if ( plot->hasCustomFontSizes( fontSettingType, defaultFontSize ) )
{
@@ -639,7 +635,7 @@ bool RimMultiPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
somethingChanged = true;
}
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
if ( plot->applyFontSize( fontSettingType, oldFontSize, fontSize, forceChange ) )
{
@@ -671,43 +667,3 @@ void RimMultiPlot::cleanupBeforeClose()
m_viewer = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotInterface* RimMultiPlot::toPlotInterfaceAsserted( caf::PdmObject* pdmObject )
{
RimPlotInterface* plotInterface = dynamic_cast<RimPlotInterface*>( pdmObject );
CAF_ASSERT( plotInterface );
return plotInterface;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimPlotInterface* RimMultiPlot::toPlotInterfaceAsserted( const caf::PdmObject* pdmObject )
{
const RimPlotInterface* plotInterface = dynamic_cast<const RimPlotInterface*>( pdmObject );
CAF_ASSERT( plotInterface );
return plotInterface;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RimMultiPlot::toPdmObjectAsserted( RimPlotInterface* plotInterface )
{
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plotInterface );
CAF_ASSERT( pdmObject );
return pdmObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::PdmObject* RimMultiPlot::toPdmObjectAsserted( const RimPlotInterface* plotInterface )
{
const caf::PdmObject* pdmObject = dynamic_cast<const caf::PdmObject*>( plotInterface );
CAF_ASSERT( pdmObject );
return pdmObject;
}

View File

@@ -32,7 +32,7 @@
#include <vector>
class RimPlotInterface;
class RimPlot;
class RimMultiPlot : public RimPlotWindow
{
@@ -47,7 +47,7 @@ public:
COLUMNS_4 = 4,
COLUMNS_UNLIMITED = 1000,
};
typedef caf::AppEnum<ColumnCount> ColumnCountEnum;
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
public:
RimMultiPlot();
@@ -57,29 +57,30 @@ public:
QWidget* viewWidget() override;
QString description() const override;
bool isMultiPlotTitleVisible() const;
void setMultiPlotTitleVisible( bool visible );
QString multiPlotTitle() const;
void setMultiPlotTitle( const QString& title );
void addPlot( RimPlotInterface* plot );
void insertPlot( RimPlotInterface* plot, size_t index );
void removePlot( RimPlotInterface* plot );
void movePlotsToThis( const std::vector<RimPlotInterface*>& plots, RimPlotInterface* plotToInsertAfter );
void addPlot( RimPlot* plot );
void insertPlot( RimPlot* plot, size_t index );
void removePlot( RimPlot* plot );
void movePlotsToThis( const std::vector<RimPlot*>& plots, RimPlot* plotToInsertAfter );
size_t plotCount() const;
size_t plotIndex( const RimPlotInterface* plot ) const;
RimPlotInterface* plotByIndex( size_t index ) const;
size_t plotCount() const;
size_t plotIndex( const RimPlot* plot ) const;
RimPlot* plotByIndex( size_t index ) const;
std::vector<RimPlotInterface*> plots() const;
std::vector<RimPlotInterface*> visiblePlots() const;
std::vector<RimPlot*> plots() const;
std::vector<RimPlot*> visiblePlots() const;
void updateLayout() override;
virtual void updatePlotNames();
void updatePlotOrderFromGridWidget();
virtual void setAutoScaleXEnabled( bool enabled );
virtual void setAutoScaleYEnabled( bool enabled );
void setAutoScaleXEnabled( bool enabled );
void setAutoScaleYEnabled( bool enabled );
int columnCount() const;
caf::PdmFieldHandle* columnCountField();
@@ -87,8 +88,7 @@ public:
void zoomAll() override;
QString asciiDataForPlotExport() const;
QString asciiDataForPlotExport() const;
virtual void onPlotAdditionOrRemoval();
protected:
@@ -104,7 +104,7 @@ protected:
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering ) override;
void uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
@@ -124,11 +124,7 @@ protected:
private:
void cleanupBeforeClose();
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 );
void performLayoutUpdate() override;
protected:
caf::PdmField<bool> m_showPlotWindowTitle;
@@ -140,5 +136,5 @@ protected:
QPointer<RiuMultiPlotWindow> m_viewer;
private:
caf::PdmChildArrayField<caf::PdmObject*> m_plots;
caf::PdmChildArrayField<RimPlot*> m_plots;
};

View File

@@ -0,0 +1,40 @@
#include "RimPlotWindow.h"
#include "RimMultiPlot.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmObject.h"
namespace caf
{
template <>
void RimPlotWindow::RowOrColSpanEnum::setUp()
{
addItem( RimPlotWindow::UNLIMITED, "UNLIMITED", "Unlimited" );
addItem( RimPlotWindow::ONE, "ONE", "1" );
addItem( RimPlotWindow::TWO, "TWO", "2" );
addItem( RimPlotWindow::THREE, "THREE", "3" );
addItem( RimPlotWindow::FOUR, "FOUR", "4" );
addItem( RimPlotWindow::FIVE, "FIVE", "5" );
setDefault( RimPlotWindow::ONE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updatePlotWindowLayout()
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
RimMultiPlot* plotWindow;
thisPdm->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}

View File

@@ -0,0 +1,88 @@
#include "RimPlot.h"
#include "RimMultiPlot.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmObject.h"
namespace caf
{
template <>
void RimPlot::RowOrColSpanEnum::setUp()
{
addItem( RimPlot::UNLIMITED, "UNLIMITED", "Unlimited" );
addItem( RimPlot::ONE, "ONE", "1" );
addItem( RimPlot::TWO, "TWO", "2" );
addItem( RimPlot::THREE, "THREE", "3" );
addItem( RimPlot::FOUR, "FOUR", "4" );
addItem( RimPlot::FIVE, "FIVE", "5" );
setDefault( RimPlot::ONE );
}
} // namespace caf
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlot, "RimPlot" ); // Do not use. Abstract class
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RimPlot()
{
CAF_PDM_InitObject( "Plot", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::createPlotWidget()
{
createViewWidget( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RowOrColSpan RimPlot::rowSpan() const
{
return m_rowSpan();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlot::RowOrColSpan RimPlot::colSpan() const
{
return m_colSpan();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::setRowSpan( RowOrColSpan rowSpan )
{
m_rowSpan = rowSpan;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::setColSpan( RowOrColSpan colSpan )
{
m_colSpan = colSpan;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
if ( changedField == &m_colSpan || changedField == &m_rowSpan )
{
onRowOrColSpanChange();
updateParentLayout();
}
}

View File

@@ -19,6 +19,8 @@
#include "RiaDefines.h"
#include "RimPlotWindow.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
@@ -30,8 +32,10 @@ class RiuQwtPlotWidget;
class RimPlotCurve;
class QwtPlotCurve;
class RimPlotInterface
class RimPlot : public RimPlotWindow
{
CAF_PDM_HEADER_INIT;
public:
enum RowOrColSpan
{
@@ -42,36 +46,21 @@ public:
FOUR = 4,
FIVE = 5
};
typedef caf::AppEnum<RowOrColSpan> RowOrColSpanEnum;
using RowOrColSpanEnum = caf::AppEnum<RowOrColSpan>;
public:
RimPlotInterface() = default;
virtual ~RimPlotInterface() = default;
RimPlot();
virtual ~RimPlot() = default;
bool isStandalonePlot() const;
// Real implementations
void createPlotWidget();
RowOrColSpan rowSpan() const;
RowOrColSpan colSpan() const;
void setRowSpan( RowOrColSpan rowSpan );
void setColSpan( RowOrColSpan colSpan );
virtual RiuQwtPlotWidget* viewer() = 0;
virtual bool isChecked() const = 0;
virtual void setChecked( bool checked ) = 0;
virtual QString description() const = 0;
virtual int rowSpan() const
{
return 1;
}
virtual int colSpan() const
{
return 1;
}
virtual void setRowSpan( RowOrColSpan rowSpan ) {}
virtual void setColSpan( RowOrColSpan colSpan ) {}
virtual bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const = 0;
virtual bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange = false ) = 0;
// Pure virtual interface methods
virtual RiuQwtPlotWidget* viewer() = 0;
virtual void setAutoScaleXEnabled( bool enabled ) = 0;
virtual void setAutoScaleYEnabled( bool enabled ) = 0;
@@ -80,21 +69,27 @@ public:
virtual void updateZoomInQwt() = 0;
virtual void updateZoomFromQwt() = 0;
virtual QString asciiDataForPlotExport() const;
virtual QString asciiDataForPlotExport() const = 0;
virtual void createPlotWidget() = 0;
virtual void detachAllCurves() = 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 ) {}
virtual void onAxisSelected( int axis, bool toggle ) = 0;
// TODO: Refactor
virtual void removeFromMdiAreaAndCollection() {}
virtual void updateAfterInsertingIntoMultiPlot() {}
protected:
void updatePlotWindowLayout();
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
virtual void onRowOrColSpanChange() {}
protected:
caf::PdmField<RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RowOrColSpanEnum> m_colSpan;
};

View File

@@ -22,7 +22,7 @@
#include "RigEquil.h"
#include "RimEclipseCase.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimTools.h"
#include "RimViewWindow.h"
@@ -158,7 +158,7 @@ void RimPlotAxisAnnotation::fieldChangedByUi( const caf::PdmFieldHandle* changed
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotInterface* parentPlot = nullptr;
RimPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
if ( parentPlot )
{

View File

@@ -25,8 +25,8 @@
#include "RiaPreferences.h"
#include "RigStatisticsCalculator.h"
#include "RimPlot.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotInterface.h"
#include "cafPdmUiSliderEditor.h"
@@ -416,7 +416,7 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed
m_isAutoZoom = false;
}
RimPlotInterface* parentPlot = nullptr;
RimPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
if ( parentPlot )
{

View File

@@ -1,65 +0,0 @@
#include "RimPlotInterface.h"
#include "RimMultiPlot.h"
#include "RimPlotWindow.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmObject.h"
namespace caf
{
template <>
void RimPlotInterface::RowOrColSpanEnum::setUp()
{
addItem( RimPlotInterface::UNLIMITED, "UNLIMITED", "Unlimited" );
addItem( RimPlotInterface::ONE, "ONE", "1" );
addItem( RimPlotInterface::TWO, "TWO", "2" );
addItem( RimPlotInterface::THREE, "THREE", "3" );
addItem( RimPlotInterface::FOUR, "FOUR", "4" );
addItem( RimPlotInterface::FIVE, "FIVE", "5" );
setDefault( RimPlotInterface::ONE );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotInterface::isStandalonePlot() const
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
if ( thisPdm )
{
RimMultiPlot* multiPlot = nullptr;
thisPdm->firstAncestorOrThisOfType( multiPlot );
return multiPlot == nullptr;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimPlotInterface::asciiDataForPlotExport() const
{
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotInterface::updatePlotWindowLayout()
{
const caf::PdmObject* thisPdm = dynamic_cast<const caf::PdmObject*>( this );
CAF_ASSERT( thisPdm );
RimMultiPlot* plotWindow;
thisPdm->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}

View File

@@ -29,14 +29,20 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not us
//--------------------------------------------------------------------------------------------------
RimPlotWindow::RimPlotWindow()
{
CAF_PDM_InitObject( "Plot", "", "", "" );
CAF_PDM_InitObject( "PlotWindow", "", "", "" );
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
int fontSize = RiaFontCache::pointSizeFromFontSizeEnum(
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum(
RiaApplication::instance()->preferences()->defaultPlotFontSize() );
CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", fontSize, "Legend Font Size", "", "", "" );
CAF_PDM_InitField( &m_legendFontSize,
"LegendFontSize",
std::max( 8, defaultFontSize - 2 ),
"Legend Font Size",
"",
"",
"" );
}
//--------------------------------------------------------------------------------------------------
@@ -51,6 +57,7 @@ RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs )
{
m_showPlotLegends = rhs.m_showPlotLegends();
m_plotLegendsHorizontal = rhs.m_plotLegendsHorizontal();
m_legendFontSize = rhs.m_legendFontSize();
return *this;
}
@@ -102,6 +109,32 @@ void RimPlotWindow::setLegendFontSize( int fontSize )
m_legendFontSize = fontSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updateLayout()
{
performLayoutUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::updateParentLayout()
{
caf::PdmFieldHandle* parentField = this->parentField();
if ( parentField )
{
caf::PdmObjectHandle* parentObject = parentField->ownerObject();
RimPlotWindow* plotWindow = nullptr;
parentObject->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -160,7 +193,7 @@ QList<caf::PdmOptionItemInfo> RimPlotWindow::calculateValueOptions( const caf::P
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
void RimPlotWindow::uiOrderingForLegendSettings( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotLegends );
uiOrdering.add( &m_plotLegendsHorizontal );

View File

@@ -24,6 +24,7 @@
#include "cafPdmFieldHandle.h"
#include "cafPdmObject.h"
class QwtPlotCurve;
class QKeyEvent;
class RimPlotWindow : public RimViewWindow
@@ -36,6 +37,8 @@ public:
RimPlotWindow& operator=( RimPlotWindow&& rhs );
virtual QString description() const = 0;
bool legendsVisible() const;
void setLegendsVisible( bool doShow );
bool legendsHorizontal() const;
@@ -43,17 +46,21 @@ public:
int legendFontSize() const;
void setLegendFontSize( int fontSize );
virtual void handleKeyPressEvent( QKeyEvent* keyEvent ) {}
virtual void updateLayout() = 0;
void updateLayout();
void updateParentLayout();
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
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 void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForLegendSettings( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
private:
virtual void performLayoutUpdate() {}
protected:
caf::PdmField<bool> m_showPlotLegends;

View File

@@ -90,6 +90,22 @@ void RimViewWindow::setId( int id )
m_viewId = id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewWindow::showWindow() const
{
return m_showWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setShowWindow( bool showWindow )
{
m_showWindow = showWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -158,6 +174,22 @@ void RimViewWindow::updateMdiWindowVisibility()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setAs3DViewMdiWindow()
{
setAsMdiWindow( 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewWindow::setAsPlotMdiWindow()
{
setAsMdiWindow( 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -64,18 +64,15 @@ public:
int id() const;
void setId( int id );
bool showWindow() const;
void setShowWindow( bool showWindow );
void loadDataAndUpdate();
void handleMdiWindowClosed();
void updateMdiWindowVisibility();
void setAs3DViewMdiWindow()
{
setAsMdiWindow( 0 );
}
void setAsPlotMdiWindow()
{
setAsMdiWindow( 1 );
}
void setAs3DViewMdiWindow();
void setAsPlotMdiWindow();
void revokeMdiWindowStatus();
bool isMdiWindow() const;
@@ -109,7 +106,7 @@ protected:
friend class RimMdiWindowController;
QString windowTitle();
virtual QWidget* createViewWidget( QWidget* mainWindowParent ) = 0;
virtual QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) = 0;
virtual void updateViewWidgetAfterCreation(){};
virtual void updateMdiWindowTitle(); // Has real default implementation
virtual void deleteViewWidget() = 0;

View File

@@ -135,8 +135,8 @@ void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
parameterSources->add( &m_userDefinedUcs );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Title, Legend and Axis" );
RimWellLogPlot::uiOrderingForPlotLayout( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
RimWellLogPlot::uiOrderingForLegendSettings( uiConfigName, *legendAndAxisGroup );
uiOrderingForDepthAxis( uiConfigName, *legendAndAxisGroup );
uiOrdering.skipRemainingFields( true );
}

View File

@@ -26,6 +26,7 @@
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
@@ -106,6 +107,7 @@ RimWellLogPlot::RimWellLogPlot()
m_commonDataSourceEnabled = true;
m_columnCountEnum = RimMultiPlot::COLUMNS_UNLIMITED;
m_plotLegendsHorizontal = false;
setMultiPlotTitleVisible( false );
}
@@ -168,7 +170,7 @@ void RimWellLogPlot::updateZoom()
}
}
for ( RimPlotInterface* plot : plots() )
for ( RimPlot* plot : plots() )
{
static_cast<RimWellLogTrack*>( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() );
}
@@ -234,7 +236,7 @@ void RimWellLogPlot::calculateAvailableDepthRange()
double minTrackDepth = HUGE_VAL;
double maxTrackDepth = -HUGE_VAL;
if ( plots[tIdx]->isChecked() )
if ( plots[tIdx]->showWindow() )
{
static_cast<RimWellLogTrack*>( plots[tIdx] )->availableDepthRange( &minTrackDepth, &maxTrackDepth );
@@ -286,7 +288,7 @@ void RimWellLogPlot::enableAllAutoNameTags( bool enable )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
void RimWellLogPlot::uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
if ( m_availableDepthTypes.size() > 1u )
{
@@ -306,13 +308,11 @@ void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering )
void RimWellLogPlot::uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_showPlotWindowTitle );
m_nameConfig->uiOrdering( "", uiOrdering );
m_nameConfig->uiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_showIndividualPlotTitles );
RimPlotWindow::uiOrderingForPlotLayout( uiOrdering );
uiOrdering.add( &m_columnCountEnum );
}
//--------------------------------------------------------------------------------------------------
@@ -409,7 +409,7 @@ QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent )
void RimWellLogPlot::performAutoNameUpdate()
{
updateCommonDataSource();
setMultiPlotTitle( m_nameConfig->name() );
setMultiPlotTitle( createAutoName() );
updatePlotTitleInWidgets();
}
@@ -585,10 +585,12 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
}
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Depth Axis" );
uiOrderingForDepthAxis( *gridGroup );
uiOrderingForDepthAxis( uiConfigName, *gridGroup );
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
uiOrderingForPlotLayout( *titleAndLegendsGroup );
uiOrderingForAutoName( uiConfigName, *titleAndLegendsGroup );
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, uiOrdering );
titleAndLegendsGroup->add( &m_columnCountEnum );
uiOrdering.skipRemainingFields( true );
}
@@ -634,16 +636,17 @@ void RimWellLogPlot::initAfterRead()
{
RimMultiPlot::initAfterRead();
updateCommonDataSource();
if ( !m_plotWindowTitle().isEmpty() )
{
m_nameConfig->setCustomName( m_plotWindowTitle() );
}
if ( m_depthAxisGridVisibility() == AXIS_GRID_MINOR )
{
m_depthAxisGridVisibility = AXIS_GRID_MAJOR_AND_MINOR;
}
if ( !m_plotWindowTitle().isEmpty() )
{
m_nameConfig->setCustomName( m_plotWindowTitle );
}
performAutoNameUpdate();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -36,7 +36,7 @@
class RimWellLogCurveCommonDataSource;
class RiuMultiPlotWindow;
class RimPlotInterface;
class RimPlotWindow;
class QKeyEvent;
//==================================================================================================
@@ -85,11 +85,11 @@ public:
void calculateAvailableDepthRange();
void availableDepthRange( double* minimumDepth, double* maximumDepth ) const;
void setAutoScaleYEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled );
void enableAllAutoNameTags( bool enable );
void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForPlotLayout( caf::PdmUiOrdering& uiOrdering ) override;
void uiOrderingForDepthAxis( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
void uiOrderingForAutoName( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
QString createAutoName() const override;
@@ -103,11 +103,11 @@ public:
void onPlotAdditionOrRemoval() override;
void updatePlotNames() override;
void handleKeyPressEvent( QKeyEvent* keyEvent );
protected:
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void performAutoNameUpdate() override;
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
// Overridden PDM methods
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,

View File

@@ -150,13 +150,9 @@ RimWellLogTrack::RimWellLogTrack()
{
CAF_PDM_InitObject( "Track", ":/WellLogTrack16x16.png", "", "" );
CAF_PDM_InitField( &m_show, "Show", true, "Show Plot", "", "", "" );
m_show.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" );
m_description.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Column Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "", "", "", "" );
m_curves.uiCapability()->setUiHidden( true );
@@ -249,6 +245,10 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitFieldNoDefault( &m_wellPathComponentSource, "AttributesWellPathSource", "Well Path", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes", "", "", "" );
CAF_PDM_InitField( &m_show_OBSOLETE, "Show", false, "Show Plot", "", "", "" );
m_show_OBSOLETE.uiCapability()->setUiHidden( true );
m_show_OBSOLETE.xmlCapability()->setIOWritable( false );
m_formationsForCaseWithSimWellOnly = false;
}
@@ -260,22 +260,6 @@ RimWellLogTrack::~RimWellLogTrack()
m_curves.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::isChecked() const
{
return m_show();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setChecked( bool checked )
{
m_show = checked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -292,22 +276,6 @@ void RimWellLogTrack::setDescription( const QString& description )
m_description = description;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogTrack::colSpan() const
{
return m_colSpan();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setColSpan( RowOrColSpan colSpan )
{
m_colSpan = colSpan;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -332,6 +300,34 @@ void RimWellLogTrack::simWellOptionItems( QList<caf::PdmOptionItemInfo>* options
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::cleanupBeforeClose()
{
detachAllPlotItems();
if ( m_plotWidget )
{
m_plotWidget->deleteLater();
m_plotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::detachAllPlotItems()
{
for ( RimPlotCurve* curve : m_curves )
{
curve->detachQwtCurve();
}
for ( auto& plotObjects : m_wellPathAttributePlotObjects )
{
plotObjects->detachFromQwt();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -471,7 +467,7 @@ void RimWellLogTrack::updateXZoom()
// Attribute range. Fixed range where well components are positioned [-1, 1].
// Set an extended range here to allow for some label space.
double componentRangeMax = 1.5 * ( 4 / ( static_cast<int>( m_colSpan() ) ) );
double componentRangeMax = 1.5 * ( 4 / ( static_cast<int>( colSpan() ) ) );
double componentRangeMin = -0.25;
if ( m_showWellPathComponentsBothSides )
{
@@ -498,23 +494,18 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_show )
if ( changedField == &m_showWindow )
{
if ( m_plotWidget )
{
m_plotWidget->setVisible( m_show() );
m_plotWidget->setVisible( m_showWindow );
}
updatePlotWindowLayout();
updateParentLayout();
}
else if ( changedField == &m_description )
{
updatePlotWindowLayout();
}
else if ( changedField == &m_colSpan )
{
onRowOrColSpanChange();
updatePlotWindowLayout();
updateParentLayout();
}
else if ( changedField == &m_explicitTickIntervals )
{
@@ -590,7 +581,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
updateConnectedEditors();
RiuPlotMainWindowTools::refreshToolbars();
}
@@ -609,19 +600,19 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_formationWellPathForSourceCase )
{
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_formationSimWellName )
{
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_formationTrajectoryType )
@@ -640,7 +631,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_formationBranchIndex || changedField == &m_formationBranchDetection )
@@ -650,13 +641,13 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_formationBranchDetection );
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_formationWellPathForSourceWellPath )
{
loadDataAndUpdate();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_formationLevel )
@@ -672,14 +663,14 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
changedField == &m_wellPathAttributesInLegend || changedField == &m_wellPathCompletionsInLegend )
{
updateWellPathAttributesOnPlot();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_wellPathComponentSource )
{
updateWellPathAttributesCollection();
updateWellPathAttributesOnPlot();
updatePlotWindowLayout();
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
}
@@ -701,31 +692,8 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
}
else
{
int majorTickIntervals = 3;
int minorTickIntervals = 0;
switch ( m_colSpan() )
{
case ONE:
majorTickIntervals = 3;
minorTickIntervals = 2;
break;
case TWO:
majorTickIntervals = 3;
minorTickIntervals = 5;
break;
case THREE:
majorTickIntervals = 5;
minorTickIntervals = 5;
break;
case FOUR:
majorTickIntervals = 5;
minorTickIntervals = 10;
break;
case FIVE:
majorTickIntervals = 10;
minorTickIntervals = 10;
break;
}
int majorTickIntervals = 5;
int minorTickIntervals = 10;
m_plotWidget->setAutoTickIntervalCounts( QwtPlot::xTop, majorTickIntervals, minorTickIntervals );
m_plotWidget->setAxisRange( QwtPlot::xTop, m_visibleXRangeMin, m_visibleXRangeMax );
}
@@ -1048,14 +1016,6 @@ void RimWellLogTrack::deleteAllCurves()
m_curves.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimWellLogTrack::viewer()
{
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1079,7 +1039,7 @@ void RimWellLogTrack::availableDepthRange( double* minimumDepth, double* maximum
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::loadDataAndUpdate()
void RimWellLogTrack::onLoadDataAndUpdate()
{
RimWellLogPlot* wellLogPlot = nullptr;
firstAncestorOrThisOfType( wellLogPlot );
@@ -1315,11 +1275,11 @@ RimWellLogTrack::TrajectoryType RimWellLogTrack::formationTrajectoryType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::createPlotWidget()
QWidget* RimWellLogTrack::createViewWidget( QWidget* mainWindowParent )
{
if ( m_plotWidget == nullptr )
{
m_plotWidget = new RiuWellLogTrack( this );
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
m_plotWidget->setAxisInverted( QwtPlot::yLeft );
updateAxisScaleEngine();
@@ -1331,6 +1291,15 @@ void RimWellLogTrack::createPlotWidget()
m_plotWidget->scheduleReplot();
}
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::deleteViewWidget()
{
cleanupBeforeClose();
}
//--------------------------------------------------------------------------------------------------
@@ -1338,14 +1307,7 @@ void RimWellLogTrack::createPlotWidget()
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::detachAllCurves()
{
for ( RimPlotCurve* curve : m_curves )
{
curve->detachQwtCurve();
}
for ( auto& plotObjects : m_wellPathAttributePlotObjects )
{
plotObjects->detachFromQwt();
}
detachAllPlotItems();
}
//--------------------------------------------------------------------------------------------------
@@ -1519,6 +1481,50 @@ RimWellPath* RimWellLogTrack::wellPathAttributeSource() const
return m_wellPathComponentSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellLogTrack::viewWidget()
{
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimWellLogTrack::viewer()
{
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimWellLogTrack::snapshotWindowContent()
{
QImage image;
if ( m_plotWidget )
{
QPixmap pix = m_plotWidget->grab();
image = pix.toImage();
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::zoomAll()
{
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
calculateXZoomRange();
calculateYZoomRange();
updateZoomInQwt();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1632,6 +1638,11 @@ void RimWellLogTrack::initAfterRead()
{
m_xAxisGridVisibility = RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR;
}
if ( m_show_OBSOLETE )
{
m_showWindow = true;
}
}
//--------------------------------------------------------------------------------------------------
@@ -1652,14 +1663,6 @@ void RimWellLogTrack::defineEditorAttribute( const caf::PdmFieldHandle* field,
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogTrack::objectToggleField()
{
return &m_show;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1726,14 +1729,6 @@ void RimWellLogTrack::updateWellPathAttributesCollection()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::onRowOrColSpanChange()
{
updateXZoom();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2151,7 +2146,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
m_annotationTool->attachNamedRegions( this->viewer(),
m_annotationTool->attachNamedRegions( m_plotWidget,
formationNamesToPlot,
xRange,
yValues,
@@ -2180,7 +2175,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
m_showformationFluids(),
plot->depthType() );
m_annotationTool->attachWellPicks( this->viewer(), formationNamesToPlot, yValues );
m_annotationTool->attachWellPicks( m_plotWidget, formationNamesToPlot, yValues );
}
}
@@ -2242,7 +2237,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
m_annotationTool->attachNamedRegions( this->viewer(),
m_annotationTool->attachNamedRegions( m_plotWidget,
sourceNamesToPlot,
xRange,
yValues,
@@ -2271,7 +2266,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
m_annotationTool->attachNamedRegions( this->viewer(),
m_annotationTool->attachNamedRegions( m_plotWidget,
sourceNamesToPlot,
xRange,
yValues,
@@ -2300,7 +2295,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
wellBoreStabilityPlot->depthType(),
&sourceNamesToPlot,
&yValues );
m_annotationTool->attachNamedRegions( this->viewer(),
m_annotationTool->attachNamedRegions( m_plotWidget,
sourceNamesToPlot,
xRange,
yValues,

View File

@@ -24,7 +24,7 @@
#include "RigWellPathFormations.h"
#include "RiuPlotAnnotationTool.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimRegularLegendConfig.h"
#include "cafPdmChildArrayField.h"
@@ -67,14 +67,11 @@ struct CurveSamplingPointData
///
///
//==================================================================================================
class RimWellLogTrack : public caf::PdmObject, public RimPlotInterface
class RimWellLogTrack : public RimPlot
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogTrack();
~RimWellLogTrack() override;
enum TrajectoryType
{
WELL_PATH,
@@ -86,17 +83,21 @@ public:
WELL_PICK_FILTER
};
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionAnnotationType> RegionAnnotationTypeEnum;
typedef caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay> RegionAnnotationDisplayEnum;
using RegionAnnotationTypeEnum = caf::AppEnum<RiuPlotAnnotationTool::RegionAnnotationType>;
using RegionAnnotationDisplayEnum = caf::AppEnum<RiuPlotAnnotationTool::RegionDisplay>;
public:
RimWellLogTrack();
~RimWellLogTrack() override;
QWidget* viewWidget() override;
RiuQwtPlotWidget* viewer() override;
QImage snapshotWindowContent() override;
void zoomAll() override;
bool isChecked() const override;
void setChecked( bool checked ) override;
QString description() const override;
void setDescription( const QString& description );
int colSpan() const override;
void setColSpan( RowOrColSpan colSpan ) override;
void addCurve( RimWellLogCurve* curve );
void insertCurve( RimWellLogCurve* curve, size_t index );
void takeOutCurve( RimWellLogCurve* curve );
@@ -124,12 +125,9 @@ public:
void setFormationTrajectoryType( TrajectoryType trajectoryType );
TrajectoryType formationTrajectoryType() const;
void createPlotWidget() override;
void detachAllCurves() override;
void reattachAllCurves();
void loadDataAndUpdate() override;
void setAndUpdateWellPathFormationNamesData( RimCase* rimCase, RimWellPath* wellPath );
void setAndUpdateSimWellFormationNamesAndBranchData( RimCase* rimCase,
@@ -171,8 +169,7 @@ public:
void setShowWellPathAttributes( bool on );
void setWellPathAttributesSource( RimWellPath* wellPath );
RimWellPath* wellPathAttributeSource() const;
RiuQwtPlotWidget* viewer() override;
RimWellPath* wellPathAttributeSource() const;
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
@@ -191,7 +188,7 @@ public:
void updateAllLegendItems();
QString asciiDataForPlotExport() const;
QString asciiDataForPlotExport() const override;
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
@@ -203,7 +200,15 @@ public:
void updateAxes() override;
protected:
// RimViewWindow overrides
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
private:
void cleanupBeforeClose();
void detachAllPlotItems();
void calculateXZoomRange();
void calculateYZoomRange();
@@ -223,7 +228,6 @@ private:
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
caf::PdmFieldHandle* objectToggleField() override;
caf::PdmFieldHandle* userDescriptionField() override;
void computeAndSetXRangeMinForLogarithmicScale();
@@ -262,16 +266,12 @@ private:
void updateWellPathAttributesCollection();
void onRowOrColSpanChange() override;
RimWellLogPlot* parentWellLogPlot() const;
private:
QString m_xAxisTitle;
caf::PdmField<bool> m_show;
caf::PdmField<QString> m_description;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmField<QString> m_description;
caf::PdmChildArrayField<RimWellLogCurve*> m_curves;
caf::PdmField<double> m_visibleXRangeMin;
@@ -311,6 +311,7 @@ private:
caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection;
caf::PdmField<bool> m_showFormations_OBSOLETE;
caf::PdmField<bool> m_show_OBSOLETE;
std::vector<std::unique_ptr<RiuWellPathComponentPlotItem>> m_wellPathAttributePlotObjects;

View File

@@ -141,7 +141,7 @@ CurvesData concatCurvesData( const std::vector<CurvesData>& curvesData );
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlot::RimSummaryPlot()
: RimPlotWindow()
: RimPlot()
{
CAF_PDM_InitObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "" );
@@ -154,9 +154,6 @@ RimSummaryPlot::RimSummaryPlot()
CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Column Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "", "", "", "" );
m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true );
m_summaryCurveCollection = new RimSummaryCurveCollection;
@@ -327,6 +324,14 @@ RiuQwtPlotWidget* RimSummaryPlot::viewer()
return m_plotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSummaryPlot::asciiDataForPlotExport() const
{
return asciiDataForSummaryPlotExport( DateTimePeriod::YEAR, false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -377,14 +382,6 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( DateTimePeriod resampling
return out;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::createPlotWidget()
{
createViewWidget( nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1315,14 +1312,6 @@ void RimSummaryPlot::addAsciiDataCruve( RimAsciiDataCurve* curve )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::loadDataAndUpdate()
{
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1338,7 +1327,7 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showWindow )
{
@@ -1361,11 +1350,6 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
}
if ( changedField == &m_rowSpan || changedField == &m_colSpan )
{
updatePlotWindowLayout();
}
if ( changedField == &m_normalizeCurveYValues )
{
this->loadDataAndUpdate();
@@ -1456,7 +1440,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
if ( m_plotWidget )
{
m_plotWidget->setLegendVisible( m_showPlotLegends && isStandalonePlot() );
m_plotWidget->setLegendVisible( m_showPlotLegends && isMdiWindow() );
m_plotWidget->setLegendFontSize( m_legendFontSize() );
m_plotWidget->updateLegend();
}
@@ -1528,7 +1512,7 @@ std::set<RimPlotAxisPropertiesInterface*> RimSummaryPlot::allPlotAxes() const
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::cleanupBeforeClose()
{
detachAllCurves();
detachAllPlotItems();
if ( m_plotWidget )
{
@@ -1564,13 +1548,16 @@ void RimSummaryPlot::removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::removeFromMdiAreaAndCollection()
{
RimSummaryPlotCollection* summaryCollection = nullptr;
this->firstAncestorOrThisOfType( summaryCollection );
if ( summaryCollection )
if ( isMdiWindow() )
{
summaryCollection->removeSummaryPlot( this );
this->revokeMdiWindowStatus();
summaryCollection->updateAllRequiredEditors();
RimSummaryPlotCollection* summaryCollection = nullptr;
this->firstAncestorOrThisOfType( summaryCollection );
if ( summaryCollection )
{
summaryCollection->removeSummaryPlot( this );
this->revokeMdiWindowStatus();
summaryCollection->updateAllRequiredEditors();
}
}
}
@@ -1592,22 +1579,6 @@ void RimSummaryPlot::updateAfterInsertingIntoMultiPlot()
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimSummaryPlot::rowSpan() const
{
return static_cast<int>( m_rowSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimSummaryPlot::colSpan() const
{
return static_cast<int>( m_colSpan() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1632,22 +1603,6 @@ QString RimSummaryPlot::description() const
return m_description();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlot::isChecked() const
{
return isWindowVisible();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setChecked( bool checked )
{
m_showWindow = checked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1694,7 +1649,7 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" );
mainOptions->setCollapsedByDefault( true );
if ( isStandalonePlot() )
if ( isMdiWindow() )
{
mainOptions->add( &m_showPlotTitle );
if ( m_showPlotTitle )
@@ -1712,7 +1667,7 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
}
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle );
if ( isStandalonePlot() )
if ( isMdiWindow() )
{
mainOptions->add( &m_showPlotLegends );
if ( m_showPlotLegends() )
@@ -1821,7 +1776,7 @@ void RimSummaryPlot::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateMdiWindowTitle()
{
if ( m_plotWidget && isStandalonePlot() )
if ( m_plotWidget && isMdiWindow() )
{
QString plotTitle = description();
@@ -1887,26 +1842,48 @@ void RimSummaryPlot::updateNameHelperWithCurveData( RimSummaryPlotNameHelper* na
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateWindowVisibility()
{
RimMultiPlot* plotWindow = nullptr;
this->firstAncestorOrThisOfType( plotWindow );
if ( plotWindow )
{
plotWindow->updateLayout();
}
else
if ( isMdiWindow() )
{
updateMdiWindowVisibility();
}
else
{
updateParentLayout();
}
updateAxes();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateLayout()
void RimSummaryPlot::performLayoutUpdate()
{
this->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::detachAllPlotItems()
{
if ( m_summaryCurveCollection )
{
m_summaryCurveCollection->detachQwtCurves();
}
m_ensembleCurveSetCollection->detachQwtCurves();
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
{
curve->detachQwtCurve();
}
for ( RimAsciiDataCurve* curve : m_asciiDataCurves )
{
curve->detachQwtCurve();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1931,22 +1908,7 @@ void RimSummaryPlot::updateCurveNames()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::detachAllCurves()
{
if ( m_summaryCurveCollection )
{
m_summaryCurveCollection->detachQwtCurves();
}
m_ensembleCurveSetCollection->detachQwtCurves();
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
{
curve->detachQwtCurve();
}
for ( RimAsciiDataCurve* curve : m_asciiDataCurves )
{
curve->detachQwtCurve();
}
detachAllPlotItems();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -24,8 +24,7 @@
#include "RifEclipseSummaryAddress.h"
#include "RimPlotInterface.h"
#include "RimPlotWindow.h"
#include "RimPlot.h"
#include "qwt_plot_textlabel.h"
@@ -64,7 +63,7 @@ class QKeyEvent;
///
///
//==================================================================================================
class RimSummaryPlot : public RimPlotWindow, public RimPlotInterface
class RimSummaryPlot : public RimPlot
{
CAF_PDM_HEADER_INIT;
@@ -77,8 +76,6 @@ public:
void setDescription( const QString& description );
QString description() const override;
bool isChecked() const override;
void setChecked( bool checked ) override;
void setDraggable( bool draggable );
void enableAutoPlotTitle( bool enable );
@@ -118,6 +115,7 @@ public:
QWidget* viewWidget() override;
RiuQwtPlotWidget* viewer() override;
QString asciiDataForPlotExport() const override;
QString asciiDataForSummaryPlotExport( DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const;
std::vector<RimSummaryCurve*> summaryAndEnsembleCurves() const;
@@ -136,8 +134,6 @@ public:
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
void updateLayout() override;
void updateAll();
void updateAllLegendItems();
@@ -159,7 +155,7 @@ public:
void setNormalizationEnabled( bool enable );
bool isNormalizationEnabled();
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
void handleKeyPressEvent( QKeyEvent* keyEvent );
virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const;
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
@@ -170,11 +166,9 @@ public:
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() override;
void addOrUpdateEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
void removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curveSet );
@@ -182,12 +176,9 @@ public:
void removeFromMdiAreaAndCollection() override;
void updateAfterInsertingIntoMultiPlot() override;
int rowSpan() const override;
int colSpan() const override;
public:
// RimViewWindow overrides
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
void deleteViewWidget() override;
void initAfterRead() override;
@@ -196,6 +187,9 @@ private:
void updateNameHelperWithCurveData( RimSummaryPlotNameHelper* nameHelper ) const;
void updateWindowVisibility();
void performLayoutUpdate() override;
void detachAllPlotItems();
protected:
// Overridden PDM methods
@@ -236,9 +230,6 @@ private:
caf::PdmField<bool> m_useAutoPlotTitle;
caf::PdmField<QString> m_description;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_rowSpan;
caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
caf::PdmChildField<RimEnsembleCurveSetCollection*> m_ensembleCurveSetCollection;

View File

@@ -30,7 +30,7 @@
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimMultiPlot.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCaseMainCollection.h"
@@ -163,7 +163,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
}
if ( dynamic_cast<RimEclipseCase*>( uiItem ) || dynamic_cast<RimWellLogCurve*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlotInterface*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlot*>( uiItem ) ||
dynamic_cast<RimSummaryCase*>( uiItem ) )
{
// TODO: Remember to handle reservoir holding the main grid
@@ -188,14 +188,14 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
}
else if ( dynamic_cast<RimMultiPlot*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlotInterface>::containsTypedObjects( m_dragItems ) )
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if ( dynamic_cast<RimPlotInterface*>( uiItem ) )
else if ( dynamic_cast<RimPlot*>( uiItem ) )
{
if ( RiuTypedPdmObjects<RimPlotInterface>::containsTypedObjects( m_dragItems ) )
if ( RiuTypedPdmObjects<RimPlot>::containsTypedObjects( m_dragItems ) )
{
itemflags |= Qt::ItemIsDropEnabled;
}
@@ -459,19 +459,19 @@ bool RiuDragDrop::handleMultiPlotDrop( Qt::DropAction action,
RimMultiPlot* multiPlot,
int insertAtPosition )
{
std::vector<RimPlotInterface*> plots = RiuTypedPdmObjects<RimPlotInterface>::typedObjectsFromGroup( draggedObjects );
std::vector<RimPlot*> plots = RiuTypedPdmObjects<RimPlot>::typedObjectsFromGroup( draggedObjects );
if ( plots.size() > 0 )
{
if ( action == Qt::MoveAction )
{
RimPlotInterface* insertAfter = nullptr;
RimPlot* insertAfter = nullptr;
if ( insertAtPosition > 0 )
{
auto visibleTracks = multiPlot->visiblePlots();
if ( !visibleTracks.empty() )
{
int insertAfterPosition = std::min( insertAtPosition - 1, (int)visibleTracks.size() - 1 );
insertAfter = dynamic_cast<RimPlotInterface*>( visibleTracks[insertAfterPosition] );
insertAfter = dynamic_cast<RimPlot*>( visibleTracks[insertAfterPosition] );
}
}
multiPlot->movePlotsToThis( plots, insertAfter );

View File

@@ -30,7 +30,7 @@
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimRegularLegendConfig.h"
#include "cafCmdFeatureMenuBuilder.h"
@@ -58,7 +58,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent /*= nullptr*/ )
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimPlot* plotDefinition, QWidget* parent /*= nullptr*/ )
: RiuQwtPlotWidget( plotDefinition, parent )
{
// LeftButton for the zooming

View File

@@ -29,7 +29,7 @@
class RimGridCrossPlotDataSet;
class RimPlotAxisProperties;
class RimPlotInterface;
class RimPlot;
class RiuCvfOverlayItemWidget;
class RiuDraggableOverlayFrame;
class RiuPlotAnnotationTool;
@@ -50,7 +50,7 @@ class RiuGridCrossQwtPlot : public RiuQwtPlotWidget, public RiuInterfaceToViewWi
Q_OBJECT;
public:
RiuGridCrossQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent = nullptr );
RiuGridCrossQwtPlot( RimPlot* plotDefinition, QWidget* parent = nullptr );
~RiuGridCrossQwtPlot();
RiuGridCrossQwtPlot( const RiuGridCrossQwtPlot& ) = delete;

View File

@@ -223,7 +223,7 @@ void RiuMultiPlotWindow::setSelectionsVisible( bool visible )
{
for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets )
{
if ( visible && caf::SelectionManager::instance()->isSelected( plotWidget->plotOwner(), 0 ) )
if ( visible && caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), 0 ) )
{
plotWidget->setWidgetState( RiuWidgetStyleSheet::SELECTED );
}
@@ -302,14 +302,6 @@ void RiuMultiPlotWindow::contextMenuEvent( QContextMenuEvent* event )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotWindow::keyPressEvent( QKeyEvent* keyEvent )
{
m_plotDefinition->handleKeyPressEvent( keyEvent );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -466,13 +458,13 @@ void RiuMultiPlotWindow::dropEvent( QDropEvent* event )
}
}
}
RimPlotInterface* insertAfter = nullptr;
RimPlot* insertAfter = nullptr;
if ( beforeIndex > 0 )
{
insertAfter = m_plotWidgets[beforeIndex - 1]->plotDefinition();
}
RimPlotInterface* plotToMove = source->plotDefinition();
RimPlot* plotToMove = source->plotDefinition();
if ( insertAfter != plotToMove )
{
@@ -518,7 +510,7 @@ void RiuMultiPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>
for ( int changedLevel : changedSelectionLevels )
{
isSelected = isSelected ||
caf::SelectionManager::instance()->isSelected( plotWidget->plotOwner(), changedLevel );
caf::SelectionManager::instance()->isSelected( plotWidget->plotDefinition(), changedLevel );
}
if ( isSelected )
{
@@ -590,8 +582,9 @@ void RiuMultiPlotWindow::reinsertPlotWidgets()
int column = 0;
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
{
int colSpan = std::min( plotWidgets[visibleIndex]->plotDefinition()->colSpan(), rowAndColumnCount.second );
int rowSpan = plotWidgets[visibleIndex]->plotDefinition()->rowSpan();
int expextedColSpan = static_cast<int>( plotWidgets[visibleIndex]->plotDefinition()->colSpan() );
int colSpan = std::min( expextedColSpan, rowAndColumnCount.second );
int rowSpan = plotWidgets[visibleIndex]->plotDefinition()->rowSpan();
std::tie( row, column ) = findAvailableRowAndColumn( row, column, colSpan, rowAndColumnCount.second );

View File

@@ -79,7 +79,6 @@ public:
protected:
void contextMenuEvent( QContextMenuEvent* ) override;
void keyPressEvent( QKeyEvent* keyEvent ) override;
QLabel* createTitleLabel() const;
void resizeEvent( QResizeEvent* event ) override;

View File

@@ -23,8 +23,8 @@
#include "RiaColorTools.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RimPlot.h"
#include "RimPlotCurve.h"
#include "RimPlotInterface.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtCurvePointTracker.h"
@@ -60,13 +60,11 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidget* parent )
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plot, QWidget* parent )
: QwtPlot( parent )
, m_plotDefinition( plot )
, m_draggable( true )
{
m_plotOwner = dynamic_cast<caf::PdmObject*>( plotTrackDefinition );
CAF_ASSERT( m_plotOwner );
setDefaults();
this->installEventFilter( this );
@@ -78,9 +76,9 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidg
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::~RiuQwtPlotWidget()
{
if ( plotDefinition() )
if ( m_plotDefinition )
{
plotDefinition()->detachAllCurves();
m_plotDefinition->detachAllCurves();
}
}
@@ -89,9 +87,9 @@ RiuQwtPlotWidget::~RiuQwtPlotWidget()
//--------------------------------------------------------------------------------------------------
bool RiuQwtPlotWidget::isChecked() const
{
if ( plotDefinition() )
if ( m_plotDefinition )
{
return plotDefinition()->isChecked();
return m_plotDefinition->showWindow();
}
return false;
@@ -158,17 +156,9 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotInterface* RiuQwtPlotWidget::plotDefinition() const
RimPlot* RiuQwtPlotWidget::plotDefinition() const
{
return dynamic_cast<RimPlotInterface*>( m_plotOwner.p() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RiuQwtPlotWidget::plotOwner() const
{
return m_plotOwner.p();
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
@@ -611,7 +601,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
axisId = i;
}
}
plotDefinition()->onAxisSelected( axisId, toggleItemInSelection );
m_plotDefinition->onAxisSelected( axisId, toggleItemInSelection );
}
//--------------------------------------------------------------------------------------------------
@@ -671,11 +661,11 @@ void RiuQwtPlotWidget::selectPlotOwner( bool toggleItemInSelection )
{
if ( toggleItemInSelection )
{
RiuPlotMainWindowTools::toggleItemInSelection( plotOwner() );
RiuPlotMainWindowTools::toggleItemInSelection( m_plotDefinition );
}
else
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotOwner() );
RiuPlotMainWindowTools::selectAsCurrentItem( m_plotDefinition );
}
scheduleReplot();
}
@@ -710,10 +700,10 @@ void RiuQwtPlotWidget::selectClosestCurve( const QPoint& pos, bool toggleItemInS
resetCurveHighlighting();
if ( closestCurve && distMin < 20 )
{
if ( plotDefinition() )
if ( m_plotDefinition )
{
RimPlotCurve* selectedCurve = dynamic_cast<RimPlotCurve*>(
plotDefinition()->findPdmObjectFromQwtCurve( closestCurve ) );
m_plotDefinition->findPdmObjectFromQwtCurve( closestCurve ) );
if ( selectedCurve )
{
if ( toggleItemInSelection )

View File

@@ -31,7 +31,7 @@
#include <set>
class RiaPlotWindowRedrawScheduler;
class RimPlotInterface;
class RimPlot;
class QwtLegend;
class QwtPicker;
@@ -53,11 +53,10 @@ class RiuQwtPlotWidget : public QwtPlot
Q_OBJECT
public:
RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidget* parent = nullptr );
RiuQwtPlotWidget( RimPlot* plotTrackDefinition, QWidget* parent = nullptr );
~RiuQwtPlotWidget() override;
RimPlotInterface* plotDefinition() const;
caf::PdmObject* plotOwner() const;
RimPlot* plotDefinition() const;
bool isChecked() const;
@@ -130,7 +129,7 @@ private:
RiuWidgetStyleSheet createCanvasStyleSheet() const;
private:
caf::PdmPointer<caf::PdmObject> m_plotOwner;
caf::PdmPointer<RimPlot> m_plotDefinition;
QPoint m_clickPosition;
std::map<QwtPlot::Axis, QString> m_axisTitles;
std::map<QwtPlot::Axis, bool> m_axisTitlesEnabled;

View File

@@ -23,7 +23,7 @@
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimMainPlotCollection.h"
#include "RimPlotInterface.h"
#include "RimPlot.h"
#include "RimRegularLegendConfig.h"
#include "RimSummaryCase.h"
#include "RimSummaryCurve.h"
@@ -92,7 +92,7 @@ static EnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent /*= nullptr*/ )
RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent /*= nullptr*/ )
: RiuQwtPlotWidget( plotDefinition, parent )
{
// LeftButton for the zooming
@@ -131,6 +131,11 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimPlotInterface* plotDefinition, QWidget*
setLegendVisible( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSummaryQwtPlot::~RiuSummaryQwtPlot() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -261,7 +266,7 @@ void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event )
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
caf::SelectionManager::instance()->setSelectedItem( plotOwner() );
caf::SelectionManager::instance()->setSelectedItem( plotDefinition() );
menuBuilder << "RicShowPlotDataFeature";
menuBuilder << "RicSavePlotTemplateFeature";

View File

@@ -40,7 +40,8 @@ class RiuSummaryQwtPlot : public RiuQwtPlotWidget, public RiuInterfaceToViewWind
Q_OBJECT;
public:
RiuSummaryQwtPlot( RimPlotInterface* plotDefinition, QWidget* parent = nullptr );
RiuSummaryQwtPlot( RimPlot* plotDefinition, QWidget* parent = nullptr );
~RiuSummaryQwtPlot() override;
void useDateBasedTimeAxis(
const QString& dateFormat,

View File

@@ -72,6 +72,14 @@ void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisib
m_trackScrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::keyPressEvent( QKeyEvent* event )
{
wellLogPlotDefinition()->handleKeyPressEvent( event );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -33,6 +33,7 @@ public:
void updateVerticalScrollBar( double minVisible, double maxVisible, double minAvailable, double maxAvailable ) override;
protected:
void keyPressEvent( QKeyEvent* event ) override;
bool willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const override;
bool showYAxis( int row, int column ) const override;