mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Several minor issues (#8948)
* #8947 Plot Template : Split export dialog into file path and name * #8946 Update multi plot title when curve is appended by copy/paste * #8946 Separate axis object name and axis title text * If multi plot auto name is empty, use plot title "Plot N" * QwtPlotWidget: Double click activates Zoom All * More testing on valid main window before use * Return false if event is not handeled * Improve fallback plot name * Tree View Editor: Early exit if selected object is unchanged Resetting selection causes flickering * Summary Plot : Select curve object in project tree when clicking on curve
This commit is contained in:
parent
1aa41968a5
commit
f91fe41f1d
@ -571,7 +571,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
|
|||||||
|
|
||||||
if ( cvf::Option o = progOpt->option( "openplotwindow" ) )
|
if ( cvf::Option o = progOpt->option( "openplotwindow" ) )
|
||||||
{
|
{
|
||||||
m_mainWindow->hide();
|
if ( m_mainWindow ) m_mainWindow->hide();
|
||||||
getOrCreateAndShowMainPlotWindow();
|
getOrCreateAndShowMainPlotWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,7 +1223,7 @@ void RiaGuiApplication::onProjectBeingOpened()
|
|||||||
void RiaGuiApplication::onProjectOpeningError( const QString& errMsg )
|
void RiaGuiApplication::onProjectOpeningError( const QString& errMsg )
|
||||||
{
|
{
|
||||||
RiaLogging::errorInMessageBox( nullptr, "Error when opening project file", errMsg );
|
RiaLogging::errorInMessageBox( nullptr, "Error when opening project file", errMsg );
|
||||||
m_mainWindow->setPdmRoot( nullptr );
|
if ( m_mainWindow ) m_mainWindow->setPdmRoot( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1233,11 +1233,11 @@ void RiaGuiApplication::onProjectOpened()
|
|||||||
{
|
{
|
||||||
if ( m_project->show3DWindow() )
|
if ( m_project->show3DWindow() )
|
||||||
{
|
{
|
||||||
m_mainWindow->show();
|
getOrCreateAndShowMainWindow();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_mainWindow->hide();
|
if ( m_mainWindow ) m_mainWindow->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_project->showPlotWindow() )
|
if ( m_project->showPlotWindow() )
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "RiuFileDialogTools.h"
|
#include "RiuFileDialogTools.h"
|
||||||
|
#include "RiuPlotMainWindow.h"
|
||||||
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmUiPropertyViewDialog.h"
|
#include "cafPdmUiPropertyViewDialog.h"
|
||||||
@ -81,15 +82,14 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked )
|
|||||||
|
|
||||||
QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() );
|
QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() );
|
||||||
|
|
||||||
startPath = startPath + "/" + templateCandidateName + ".rpt";
|
|
||||||
|
|
||||||
RicSaveMultiPlotTemplateFeatureSettings settings;
|
RicSaveMultiPlotTemplateFeatureSettings settings;
|
||||||
settings.setFilePath( startPath );
|
settings.setFilePath( startPath );
|
||||||
|
settings.setName( templateCandidateName );
|
||||||
|
|
||||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &settings, "Export Plot Template", "" );
|
caf::PdmUiPropertyViewDialog propertyDialog( RiuPlotMainWindow::instance(), &settings, "Export Plot Template", "" );
|
||||||
if ( propertyDialog.exec() != QDialog::Accepted ) return;
|
if ( propertyDialog.exec() != QDialog::Accepted ) return;
|
||||||
|
|
||||||
QString fileName = settings.filePath();
|
QString fileName = settings.filePath() + "/" + settings.name() + ".rpt";
|
||||||
if ( !fileName.isEmpty() )
|
if ( !fileName.isEmpty() )
|
||||||
{
|
{
|
||||||
QFile exportFile( fileName );
|
QFile exportFile( fileName );
|
||||||
|
@ -28,6 +28,7 @@ RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings
|
|||||||
CAF_PDM_InitObject( "Save Summary Plot", ":/CrossSection16x16.png" );
|
CAF_PDM_InitObject( "Save Summary Plot", ":/CrossSection16x16.png" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" );
|
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" );
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_persistObjectNameForWells, "PersistObjectNameWells", false, "Wells" );
|
CAF_PDM_InitField( &m_persistObjectNameForWells, "PersistObjectNameWells", false, "Wells" );
|
||||||
CAF_PDM_InitField( &m_persistObjectNameGroups, "PersistObjectNameGroups", false, "Groups" );
|
CAF_PDM_InitField( &m_persistObjectNameGroups, "PersistObjectNameGroups", false, "Groups" );
|
||||||
@ -50,6 +51,22 @@ QString RicSaveMultiPlotTemplateFeatureSettings::filePath() const
|
|||||||
return m_filePath().path();
|
return m_filePath().path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicSaveMultiPlotTemplateFeatureSettings::setName( const QString& name )
|
||||||
|
{
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicSaveMultiPlotTemplateFeatureSettings::name() const
|
||||||
|
{
|
||||||
|
return m_name();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -80,6 +97,7 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForRegions() const
|
|||||||
void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_filePath );
|
uiOrdering.add( &m_filePath );
|
||||||
|
uiOrdering.add( &m_name );
|
||||||
|
|
||||||
{
|
{
|
||||||
auto group = uiOrdering.addNewGroup( "Persist Object Names" );
|
auto group = uiOrdering.addNewGroup( "Persist Object Names" );
|
||||||
@ -102,8 +120,7 @@ void RicSaveMultiPlotTemplateFeatureSettings::defineEditorAttribute( const caf::
|
|||||||
auto attr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
auto attr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||||
if ( attr )
|
if ( attr )
|
||||||
{
|
{
|
||||||
attr->m_selectSaveFileName = true;
|
attr->m_selectDirectory = true;
|
||||||
attr->m_fileSelectionFilter = "Plot Template Files(*.rpt);; All files(*.*)";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,9 @@ public:
|
|||||||
void setFilePath( const QString& filePath );
|
void setFilePath( const QString& filePath );
|
||||||
QString filePath() const;
|
QString filePath() const;
|
||||||
|
|
||||||
|
void setName( const QString& name );
|
||||||
|
QString name() const;
|
||||||
|
|
||||||
bool usePlacholderForWells() const;
|
bool usePlacholderForWells() const;
|
||||||
bool usePlacholderForGroups() const;
|
bool usePlacholderForGroups() const;
|
||||||
bool usePlacholderForRegions() const;
|
bool usePlacholderForRegions() const;
|
||||||
@ -47,6 +50,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<caf::FilePath> m_filePath;
|
caf::PdmField<caf::FilePath> m_filePath;
|
||||||
|
caf::PdmField<QString> m_name;
|
||||||
|
|
||||||
caf::PdmField<bool> m_persistObjectNameForWells;
|
caf::PdmField<bool> m_persistObjectNameForWells;
|
||||||
caf::PdmField<bool> m_persistObjectNameGroups;
|
caf::PdmField<bool> m_persistObjectNameGroups;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "RimSummaryCrossPlot.h"
|
#include "RimSummaryCrossPlot.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimSummaryCurveCollection.h"
|
#include "RimSummaryCurveCollection.h"
|
||||||
|
#include "RimSummaryMultiPlot.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "cafPdmDefaultObjectFactory.h"
|
#include "cafPdmDefaultObjectFactory.h"
|
||||||
@ -63,6 +64,17 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC
|
|||||||
newCurve->loadDataAndUpdate( true );
|
newCurve->loadDataAndUpdate( true );
|
||||||
newCurve->updateConnectedEditors();
|
newCurve->updateConnectedEditors();
|
||||||
|
|
||||||
|
RimSummaryMultiPlot* summaryMultiPlot = nullptr;
|
||||||
|
summaryPlot->firstAncestorOrThisOfType( summaryMultiPlot );
|
||||||
|
if ( summaryMultiPlot )
|
||||||
|
{
|
||||||
|
summaryMultiPlot->updatePlotWindowTitle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
summaryPlot->updatePlotTitle();
|
||||||
|
}
|
||||||
|
|
||||||
summaryPlot->updateAllRequiredEditors();
|
summaryPlot->updateAllRequiredEditors();
|
||||||
|
|
||||||
return newCurve;
|
return newCurve;
|
||||||
|
@ -164,7 +164,7 @@ RimAnalysisPlot::RimAnalysisPlot()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" );
|
CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" );
|
||||||
m_valueAxisProperties.uiCapability()->setUiTreeHidden( true );
|
m_valueAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||||
m_valueAxisProperties = new RimPlotAxisProperties;
|
m_valueAxisProperties = new RimPlotAxisProperties;
|
||||||
m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::YLeft ) );
|
m_valueAxisProperties->setNameAndAxis( "Value-Axis", "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::YLeft ) );
|
||||||
m_valueAxisProperties->enableRangeSettings( false );
|
m_valueAxisProperties->enableRangeSettings( false );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" );
|
CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" );
|
||||||
@ -891,7 +891,7 @@ void RimAnalysisPlot::updateAxes()
|
|||||||
if ( valAxisProperties->isActive() )
|
if ( valAxisProperties->isActive() )
|
||||||
{
|
{
|
||||||
m_plotWidget->enableAxis( axis, true );
|
m_plotWidget->enableAxis( axis, true );
|
||||||
m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis.axis() );
|
m_valueAxisProperties->setNameAndAxis( "Value-Axis", "Value-Axis", axis.axis() );
|
||||||
|
|
||||||
RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} );
|
RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} );
|
||||||
calc.applyAxisPropertiesToPlot( m_plotWidget );
|
calc.applyAxisPropertiesToPlot( m_plotWidget );
|
||||||
@ -933,14 +933,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( toggle )
|
RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle );
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::toggleItemInSelection( itemToSelect );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -65,13 +65,13 @@ RimGridCrossPlot::RimGridCrossPlot()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis" );
|
CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis" );
|
||||||
m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
|
m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||||
m_xAxisProperties = new RimPlotAxisProperties;
|
m_xAxisProperties = new RimPlotAxisProperties;
|
||||||
m_xAxisProperties->setNameAndAxis( "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
m_xAxisProperties->setNameAndAxis( "X-Axis", "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
|
||||||
m_xAxisProperties->setEnableTitleTextSettings( false );
|
m_xAxisProperties->setEnableTitleTextSettings( false );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" );
|
CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" );
|
||||||
m_yAxisProperties.uiCapability()->setUiTreeHidden( true );
|
m_yAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||||
m_yAxisProperties = new RimPlotAxisProperties;
|
m_yAxisProperties = new RimPlotAxisProperties;
|
||||||
m_yAxisProperties->setNameAndAxis( "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
m_yAxisProperties->setNameAndAxis( "Y-Axis", "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||||
m_yAxisProperties->setEnableTitleTextSettings( false );
|
m_yAxisProperties->setEnableTitleTextSettings( false );
|
||||||
|
|
||||||
connectAxisSignals( m_xAxisProperties() );
|
connectAxisSignals( m_xAxisProperties() );
|
||||||
@ -385,14 +385,7 @@ void RimGridCrossPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
|||||||
properties = m_xAxisProperties;
|
properties = m_xAxisProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( toggle )
|
RiuPlotMainWindowTools::selectOrToggleObject( properties, toggle );
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::toggleItemInSelection( properties );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( properties );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -641,10 +634,13 @@ void RimGridCrossPlot::swapAxes()
|
|||||||
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
|
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
|
||||||
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
|
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
|
||||||
|
|
||||||
QString tmpName = xAxisProperties->name();
|
QString tmpName = xAxisProperties->objectName();
|
||||||
RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType();
|
QString tmpTitle = xAxisProperties->axisTitleText();
|
||||||
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType().axis() );
|
RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType();
|
||||||
yAxisProperties->setNameAndAxis( tmpName, tmpAxis.axis() );
|
xAxisProperties->setNameAndAxis( yAxisProperties->objectName(),
|
||||||
|
yAxisProperties->axisTitleText(),
|
||||||
|
yAxisProperties->plotAxisType().axis() );
|
||||||
|
yAxisProperties->setNameAndAxis( tmpName, tmpTitle, tmpAxis.axis() );
|
||||||
|
|
||||||
m_xAxisProperties.removeChildObject( xAxisProperties );
|
m_xAxisProperties.removeChildObject( xAxisProperties );
|
||||||
m_yAxisProperties.removeChildObject( yAxisProperties );
|
m_yAxisProperties.removeChildObject( yAxisProperties );
|
||||||
|
@ -206,14 +206,7 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlot::onPlotSelected( bool toggle )
|
void RimPlot::onPlotSelected( bool toggle )
|
||||||
{
|
{
|
||||||
if ( toggle )
|
RiuPlotMainWindowTools::selectOrToggleObject( this, toggle );
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::toggleItemInSelection( this );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -61,8 +61,11 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
|||||||
CAF_PDM_InitField( &m_isActive, "Active", true, "Active" );
|
CAF_PDM_InitField( &m_isActive, "Active", true, "Active" );
|
||||||
m_isActive.uiCapability()->setUiHidden( true );
|
m_isActive.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" );
|
CAF_PDM_InitFieldNoDefault( &m_objectName, "Name", "Name" );
|
||||||
m_name.uiCapability()->setUiHidden( true );
|
m_objectName.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_axisTitle, "AxisTitle", "Axis Title" );
|
||||||
|
m_objectName.uiCapability()->setUiReadOnly( true );
|
||||||
|
|
||||||
CAF_PDM_InitField( &isAutoTitle, "AutoTitle", true, "Auto Title" );
|
CAF_PDM_InitField( &isAutoTitle, "AutoTitle", true, "Auto Title" );
|
||||||
|
|
||||||
@ -145,7 +148,7 @@ void RimPlotAxisProperties::setNameForUnusedAxis()
|
|||||||
else if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
else if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
||||||
name += "Right";
|
name += "Right";
|
||||||
|
|
||||||
m_name = name;
|
m_objectName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -153,7 +156,7 @@ void RimPlotAxisProperties::setNameForUnusedAxis()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
caf::PdmFieldHandle* RimPlotAxisProperties::userDescriptionField()
|
caf::PdmFieldHandle* RimPlotAxisProperties::userDescriptionField()
|
||||||
{
|
{
|
||||||
return &m_name;
|
return &m_objectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -259,9 +262,13 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex )
|
void RimPlotAxisProperties::setNameAndAxis( const QString& objectName,
|
||||||
|
const QString& axistTitle,
|
||||||
|
RiaDefines::PlotAxis axis,
|
||||||
|
int axisIndex )
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_objectName = objectName;
|
||||||
|
m_axisTitle = axistTitle;
|
||||||
m_plotAxis = axis;
|
m_plotAxis = axis;
|
||||||
m_plotAxisIndex = axisIndex;
|
m_plotAxisIndex = axisIndex;
|
||||||
|
|
||||||
@ -298,9 +305,17 @@ int RimPlotAxisProperties::valuesFontSize() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const QString& RimPlotAxisProperties::name() const
|
const QString RimPlotAxisProperties::objectName() const
|
||||||
{
|
{
|
||||||
return m_name();
|
return m_objectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const QString RimPlotAxisProperties::axisTitleText() const
|
||||||
|
{
|
||||||
|
return m_axisTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -62,15 +62,17 @@ public:
|
|||||||
void setEnableTitleTextSettings( bool enable );
|
void setEnableTitleTextSettings( bool enable );
|
||||||
void enableRangeSettings( bool enable );
|
void enableRangeSettings( bool enable );
|
||||||
void setNameForUnusedAxis();
|
void setNameForUnusedAxis();
|
||||||
void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 );
|
void setNameAndAxis( const QString& objectName, const QString& axistTitle, RiaDefines::PlotAxis axis, int axisIndex = 0 );
|
||||||
AxisTitlePositionType titlePosition() const override;
|
AxisTitlePositionType titlePosition() const override;
|
||||||
|
|
||||||
int titleFontSize() const override;
|
int titleFontSize() const override;
|
||||||
int valuesFontSize() const override;
|
int valuesFontSize() const override;
|
||||||
|
|
||||||
const QString& name() const override;
|
const QString objectName() const override;
|
||||||
RiuPlotAxis plotAxisType() const override;
|
const QString axisTitleText() const override;
|
||||||
bool useAutoTitle() const;
|
|
||||||
|
RiuPlotAxis plotAxisType() const override;
|
||||||
|
bool useAutoTitle() const;
|
||||||
|
|
||||||
void setShowDescription( bool enable );
|
void setShowDescription( bool enable );
|
||||||
bool showDescription() const;
|
bool showDescription() const;
|
||||||
@ -145,7 +147,9 @@ private:
|
|||||||
caf::PdmField<double> m_visibleRangeMin;
|
caf::PdmField<double> m_visibleRangeMin;
|
||||||
caf::PdmField<double> m_visibleRangeMax;
|
caf::PdmField<double> m_visibleRangeMax;
|
||||||
|
|
||||||
caf::PdmField<QString> m_name;
|
caf::PdmField<QString> m_objectName;
|
||||||
|
caf::PdmField<QString> m_axisTitle;
|
||||||
|
|
||||||
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis;
|
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis;
|
||||||
caf::PdmField<int> m_plotAxisIndex;
|
caf::PdmField<int> m_plotAxisIndex;
|
||||||
caf::PdmField<LegendTickmarkCountEnum> m_majorTickmarkCount;
|
caf::PdmField<LegendTickmarkCountEnum> m_majorTickmarkCount;
|
||||||
|
@ -68,7 +68,8 @@ public:
|
|||||||
|
|
||||||
virtual bool isActive() const = 0;
|
virtual bool isActive() const = 0;
|
||||||
|
|
||||||
virtual const QString& name() const = 0;
|
virtual const QString objectName() const = 0;
|
||||||
|
virtual const QString axisTitleText() const = 0;
|
||||||
|
|
||||||
virtual bool isAxisInverted() const;
|
virtual bool isAxisInverted() const;
|
||||||
|
|
||||||
|
@ -1222,7 +1222,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
|
|||||||
|
|
||||||
for ( auto axis : plot->plotAxes() )
|
for ( auto axis : plot->plotAxes() )
|
||||||
{
|
{
|
||||||
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
options.push_back( caf::PdmOptionItemInfo( axis->objectName(), axis ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf:
|
|||||||
{
|
{
|
||||||
if ( dynamic_cast<RimPlotAxisProperties*>( axis ) )
|
if ( dynamic_cast<RimPlotAxisProperties*>( axis ) )
|
||||||
{
|
{
|
||||||
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
options.push_back( caf::PdmOptionItemInfo( axis->objectName(), axis ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseCollection.h"
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
|
#include "RimSummaryMultiPlotCollection.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
#include "RimSummaryPlotControls.h"
|
#include "RimSummaryPlotControls.h"
|
||||||
#include "RimSummaryPlotNameHelper.h"
|
#include "RimSummaryPlotNameHelper.h"
|
||||||
@ -481,7 +482,22 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
|||||||
populateNameHelper( m_nameHelper.get() );
|
populateNameHelper( m_nameHelper.get() );
|
||||||
|
|
||||||
auto title = m_nameHelper->plotTitle();
|
auto title = m_nameHelper->plotTitle();
|
||||||
if ( title.isEmpty() ) title = "Empty Plot";
|
|
||||||
|
if ( title.isEmpty() )
|
||||||
|
{
|
||||||
|
auto proj = RimProject::current();
|
||||||
|
auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection();
|
||||||
|
|
||||||
|
size_t index = 0;
|
||||||
|
for ( auto p : collections->multiPlots() )
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
if ( p == this ) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
title = QString( "Plot %1" ).arg( index );
|
||||||
|
}
|
||||||
|
|
||||||
setMultiPlotTitle( title );
|
setMultiPlotTitle( title );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +507,8 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
|||||||
{
|
{
|
||||||
auto subPlotNameHelper = plot->plotTitleHelper();
|
auto subPlotNameHelper = plot->plotTitleHelper();
|
||||||
|
|
||||||
// Disable auto plot title, as this is required to be able to include the information in the multi plot title
|
// Disable auto plot title, as this is required to be able to include the information in the multi plot
|
||||||
|
// title
|
||||||
plot->enableAutoPlotTitle( false );
|
plot->enableAutoPlotTitle( false );
|
||||||
|
|
||||||
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper );
|
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper );
|
||||||
@ -609,9 +626,8 @@ bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -58,6 +58,8 @@
|
|||||||
|
|
||||||
#include "RiuPlotAxis.h"
|
#include "RiuPlotAxis.h"
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
#include "RiuQwtPlotCurve.h"
|
||||||
|
#include "RiuQwtPlotItem.h"
|
||||||
#include "RiuSummaryQwtPlot.h"
|
#include "RiuSummaryQwtPlot.h"
|
||||||
#include "RiuTreeViewEventFilter.h"
|
#include "RiuTreeViewEventFilter.h"
|
||||||
|
|
||||||
@ -159,10 +161,10 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
|
|||||||
m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true );
|
m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
m_sourceStepping.xmlCapability()->disableIO();
|
m_sourceStepping.xmlCapability()->disableIO();
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_alternatePlotName, "AlternateName", "AlternateName" );
|
CAF_PDM_InitFieldNoDefault( &m_fallbackPlotName, "AlternateName", "AlternateName" );
|
||||||
m_alternatePlotName.uiCapability()->setUiReadOnly( true );
|
m_fallbackPlotName.uiCapability()->setUiReadOnly( true );
|
||||||
m_alternatePlotName.uiCapability()->setUiHidden( true );
|
m_fallbackPlotName.uiCapability()->setUiHidden( true );
|
||||||
m_alternatePlotName.xmlCapability()->disableIO();
|
m_fallbackPlotName.xmlCapability()->disableIO();
|
||||||
|
|
||||||
setPlotInfoLabel( "Filters Active" );
|
setPlotInfoLabel( "Filters Active" );
|
||||||
|
|
||||||
@ -389,14 +391,7 @@ void RimSummaryPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
|||||||
|
|
||||||
caf::PdmObject* itemToSelect = axisPropertiesForPlotAxis( axis );
|
caf::PdmObject* itemToSelect = axisPropertiesForPlotAxis( axis );
|
||||||
|
|
||||||
if ( toggle )
|
RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle );
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::toggleItemInSelection( itemToSelect );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -599,16 +594,6 @@ const RimSummaryNameHelper* RimSummaryPlot::plotTitleHelper() const
|
|||||||
return m_nameHelperAllCurves.get();
|
return m_nameHelperAllCurves.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimSummaryPlot::generatedPlotTitleFromAllCurves() const
|
|
||||||
{
|
|
||||||
RimSummaryPlotNameHelper nameHelper;
|
|
||||||
updateNameHelperWithCurveData( &nameHelper );
|
|
||||||
return nameHelper.plotTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -632,7 +617,7 @@ void RimSummaryPlot::copyMatchingAxisPropertiesFromOther( const RimSummaryPlot&
|
|||||||
{
|
{
|
||||||
for ( auto ap : plotAxes() )
|
for ( auto ap : plotAxes() )
|
||||||
{
|
{
|
||||||
if ( ap->name().compare( apToCopy->name() ) == 0 )
|
if ( ap->objectName().compare( apToCopy->objectName() ) == 0 )
|
||||||
{
|
{
|
||||||
QString data = apToCopy->writeObjectToXmlString();
|
QString data = apToCopy->writeObjectToXmlString();
|
||||||
ap->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
ap->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||||
@ -1383,7 +1368,7 @@ caf::PdmFieldHandle* RimSummaryPlot::userDescriptionField()
|
|||||||
{
|
{
|
||||||
if ( m_description().isEmpty() )
|
if ( m_description().isEmpty() )
|
||||||
{
|
{
|
||||||
return &m_alternatePlotName;
|
return &m_fallbackPlotName;
|
||||||
}
|
}
|
||||||
return &m_description;
|
return &m_description;
|
||||||
}
|
}
|
||||||
@ -1804,7 +1789,7 @@ RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxi
|
|||||||
RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name )
|
RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name )
|
||||||
{
|
{
|
||||||
auto* axisProperties = new RimPlotAxisProperties;
|
auto* axisProperties = new RimPlotAxisProperties;
|
||||||
axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() );
|
axisProperties->setNameAndAxis( name, name, plotAxis.axis(), plotAxis.index() );
|
||||||
m_axisProperties.push_back( axisProperties );
|
m_axisProperties.push_back( axisProperties );
|
||||||
connectAxisSignals( axisProperties );
|
connectAxisSignals( axisProperties );
|
||||||
|
|
||||||
@ -1854,7 +1839,10 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter,
|
|||||||
// Make sure the new axis on the correct side exists.
|
// Make sure the new axis on the correct side exists.
|
||||||
RiuPlotAxis fixedUpPlotAxis = plotWidget()->createNextPlotAxis( newPlotAxis.axis() );
|
RiuPlotAxis fixedUpPlotAxis = plotWidget()->createNextPlotAxis( newPlotAxis.axis() );
|
||||||
// The index can change so need to update.
|
// The index can change so need to update.
|
||||||
axisProperties->setNameAndAxis( axisProperties->name(), fixedUpPlotAxis.axis(), fixedUpPlotAxis.index() );
|
axisProperties->setNameAndAxis( axisProperties->objectName(),
|
||||||
|
axisProperties->axisTitleText(),
|
||||||
|
fixedUpPlotAxis.axis(),
|
||||||
|
fixedUpPlotAxis.index() );
|
||||||
|
|
||||||
// Move all attached curves
|
// Move all attached curves
|
||||||
for ( auto curve : summaryCurves() )
|
for ( auto curve : summaryCurves() )
|
||||||
@ -2335,7 +2323,10 @@ void RimSummaryPlot::initAfterRead()
|
|||||||
if ( plotAxisProperties )
|
if ( plotAxisProperties )
|
||||||
{
|
{
|
||||||
// Reset the plot axis for the axis property
|
// Reset the plot axis for the axis property
|
||||||
plotAxisProperties->setNameAndAxis( axisProperties->name(), axis.axis(), 0 );
|
plotAxisProperties->setNameAndAxis( axisProperties->objectName(),
|
||||||
|
axisProperties->axisTitleText(),
|
||||||
|
axis.axis(),
|
||||||
|
0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2477,10 +2468,6 @@ void RimSummaryPlot::deleteAllPlotCurves()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateCurveNames()
|
void RimSummaryPlot::updateCurveNames()
|
||||||
{
|
{
|
||||||
m_alternatePlotName = "";
|
|
||||||
|
|
||||||
QStringList shortCurveNames;
|
|
||||||
|
|
||||||
if ( m_summaryCurveCollection->isCurvesVisible() )
|
if ( m_summaryCurveCollection->isCurvesVisible() )
|
||||||
{
|
{
|
||||||
for ( auto c : summaryCurves() )
|
for ( auto c : summaryCurves() )
|
||||||
@ -2488,7 +2475,6 @@ void RimSummaryPlot::updateCurveNames()
|
|||||||
if ( c->isCurveVisible() )
|
if ( c->isCurveVisible() )
|
||||||
{
|
{
|
||||||
c->updateCurveNameNoLegendUpdate();
|
c->updateCurveNameNoLegendUpdate();
|
||||||
shortCurveNames.append( QString::fromStdString( c->summaryAddressY().vectorName() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2496,14 +2482,11 @@ void RimSummaryPlot::updateCurveNames()
|
|||||||
for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() )
|
for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() )
|
||||||
{
|
{
|
||||||
curveSet->updateEnsembleLegendItem();
|
curveSet->updateEnsembleLegendItem();
|
||||||
|
|
||||||
if ( curveSet->isCurvesVisible() )
|
|
||||||
{
|
|
||||||
shortCurveNames.append( QString::fromStdString( curveSet->summaryAddress().vectorName() ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_alternatePlotName = shortCurveNames.join( "," );
|
RimSummaryPlotNameHelper nameHelper;
|
||||||
|
updateNameHelperWithCurveData( &nameHelper );
|
||||||
|
m_fallbackPlotName = nameHelper.plotTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -2556,6 +2539,25 @@ void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter )
|
|||||||
updateAllRequiredEditors();
|
updateAllRequiredEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem, bool toggle, int sampleIndex )
|
||||||
|
{
|
||||||
|
auto wrapper = dynamic_cast<RiuQwtPlotItem*>( plotItem.get() );
|
||||||
|
if ( !wrapper ) return;
|
||||||
|
|
||||||
|
auto qwtPlotItem = wrapper->qwtPlotItem();
|
||||||
|
if ( !qwtPlotItem ) return;
|
||||||
|
|
||||||
|
auto riuPlotCurve = dynamic_cast<RiuQwtPlotCurve*>( qwtPlotItem );
|
||||||
|
if ( !riuPlotCurve ) return;
|
||||||
|
|
||||||
|
auto rimPlotCurve = riuPlotCurve->ownerRimCurve();
|
||||||
|
|
||||||
|
RiuPlotMainWindowTools::selectOrToggleObject( rimPlotCurve, toggle );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -148,7 +148,6 @@ public:
|
|||||||
const RimSummaryNameHelper* activePlotTitleHelperAllCurves() const;
|
const RimSummaryNameHelper* activePlotTitleHelperAllCurves() const;
|
||||||
const RimSummaryNameHelper* plotTitleHelper() const;
|
const RimSummaryNameHelper* plotTitleHelper() const;
|
||||||
void updateCurveNames();
|
void updateCurveNames();
|
||||||
QString generatedPlotTitleFromAllCurves() const;
|
|
||||||
|
|
||||||
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||||
void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||||
@ -228,6 +227,7 @@ private:
|
|||||||
void deleteAllPlotCurves();
|
void deleteAllPlotCurves();
|
||||||
|
|
||||||
void onCurveCollectionChanged( const SignalEmitter* emitter );
|
void onCurveCollectionChanged( const SignalEmitter* emitter );
|
||||||
|
void onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem, bool toggle, int sampleIndex ) override;
|
||||||
|
|
||||||
void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis );
|
void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis );
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ private:
|
|||||||
|
|
||||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||||
caf::PdmField<QString> m_description;
|
caf::PdmField<QString> m_description;
|
||||||
caf::PdmField<QString> m_alternatePlotName;
|
caf::PdmField<QString> m_fallbackPlotName;
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||||
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
||||||
|
@ -130,7 +130,8 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
|
|||||||
titleAlignment = Qt::AlignRight;
|
titleAlignment = Qt::AlignRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_axisProperties->setNameAndAxis( axisTitle, axis.axis(), axis.index() );
|
QString objectName = createAxisObjectName();
|
||||||
|
m_axisProperties->setNameAndAxis( objectName, axisTitle, axis.axis(), axis.index() );
|
||||||
plotWidget->setAxisTitleText( axis, axisTitle );
|
plotWidget->setAxisTitleText( axis, axisTitle );
|
||||||
|
|
||||||
bool titleBold = false;
|
bool titleBold = false;
|
||||||
@ -276,8 +277,8 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
|||||||
|
|
||||||
for ( const RiaSummaryCurveDefinition& curveDef : m_curveDefinitions )
|
for ( const RiaSummaryCurveDefinition& curveDef : m_curveDefinitions )
|
||||||
{
|
{
|
||||||
RifEclipseSummaryAddress sumAddress = curveDef.summaryAddress();
|
const RifEclipseSummaryAddress& sumAddress = curveDef.summaryAddress();
|
||||||
std::string unitText;
|
std::string unitText;
|
||||||
if ( curveDef.summaryCase() && curveDef.summaryCase()->summaryReader() )
|
if ( curveDef.summaryCase() && curveDef.summaryCase()->summaryReader() )
|
||||||
{
|
{
|
||||||
unitText = curveDef.summaryCase()->summaryReader()->unitName( sumAddress );
|
unitText = curveDef.summaryCase()->summaryReader()->unitName( sumAddress );
|
||||||
@ -285,7 +286,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
|||||||
else if ( curveDef.ensemble() )
|
else if ( curveDef.ensemble() )
|
||||||
{
|
{
|
||||||
std::vector<RimSummaryCase*> sumCases = curveDef.ensemble()->allSummaryCases();
|
std::vector<RimSummaryCase*> sumCases = curveDef.ensemble()->allSummaryCases();
|
||||||
if ( sumCases.size() && sumCases[0] && sumCases[0]->summaryReader() )
|
if ( !sumCases.empty() && sumCases[0] && sumCases[0]->summaryReader() )
|
||||||
{
|
{
|
||||||
unitText = sumCases[0]->summaryReader()->unitName( sumAddress );
|
unitText = sumCases[0]->summaryReader()->unitName( sumAddress );
|
||||||
}
|
}
|
||||||
@ -303,7 +304,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
|||||||
scaleFactorText = QString( " x 10<sup>%1</sup> " ).arg( QString::number( exponent ) );
|
scaleFactorText = QString( " x 10<sup>%1</sup> " ).arg( QString::number( exponent ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto unitIt : unitToQuantityNameMap )
|
for ( const auto& unitIt : unitToQuantityNameMap )
|
||||||
{
|
{
|
||||||
for ( const auto& quantIt : unitIt.second )
|
for ( const auto& quantIt : unitIt.second )
|
||||||
{
|
{
|
||||||
@ -337,6 +338,86 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
|||||||
return assembledYAxisText;
|
return assembledYAxisText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSummaryPlotAxisFormatter::createAxisObjectName() const
|
||||||
|
{
|
||||||
|
std::set<std::string> vectorNames;
|
||||||
|
|
||||||
|
auto addVectorNames = [&]( const RifEclipseSummaryAddress& sumAddress ) {
|
||||||
|
size_t cutPos = sumAddress.vectorName().find( ':' );
|
||||||
|
if ( cutPos == std::string::npos ) cutPos = -1;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
const std::string& quantityName = sumAddress.vectorName().substr( cutPos + 1 );
|
||||||
|
|
||||||
|
if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
|
||||||
|
{
|
||||||
|
name = shortCalculationName( quantityName );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name = quantityName;
|
||||||
|
}
|
||||||
|
vectorNames.insert( name );
|
||||||
|
};
|
||||||
|
|
||||||
|
for ( RimSummaryCurve* rimCurve : m_summaryCurves )
|
||||||
|
{
|
||||||
|
RifEclipseSummaryAddress sumAddress;
|
||||||
|
|
||||||
|
if ( m_axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||||
|
{
|
||||||
|
sumAddress = rimCurve->summaryAddressX();
|
||||||
|
}
|
||||||
|
else if ( rimCurve->axisY() == this->m_axisProperties->plotAxisType() )
|
||||||
|
{
|
||||||
|
sumAddress = rimCurve->summaryAddressY();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
addVectorNames( sumAddress );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const RiaSummaryCurveDefinition& curveDef : m_curveDefinitions )
|
||||||
|
{
|
||||||
|
const RifEclipseSummaryAddress& sumAddress = curveDef.summaryAddress();
|
||||||
|
|
||||||
|
addVectorNames( sumAddress );
|
||||||
|
}
|
||||||
|
|
||||||
|
QString assembledAxisObjectName;
|
||||||
|
|
||||||
|
for ( const auto& vectorName : vectorNames )
|
||||||
|
{
|
||||||
|
assembledAxisObjectName += QString::fromStdString( vectorName ) + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !m_timeHistoryCurveQuantities.empty() )
|
||||||
|
{
|
||||||
|
if ( !assembledAxisObjectName.isEmpty() )
|
||||||
|
{
|
||||||
|
assembledAxisObjectName += " : ";
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const auto& timeQuantity : m_timeHistoryCurveQuantities )
|
||||||
|
{
|
||||||
|
assembledAxisObjectName += timeQuantity + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const int maxChars = 100;
|
||||||
|
QFont font;
|
||||||
|
QFontMetrics fm( font );
|
||||||
|
assembledAxisObjectName = fm.elidedText( assembledAxisObjectName, Qt::ElideRight, maxChars );
|
||||||
|
|
||||||
|
return assembledAxisObjectName;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString autoAxisTitle() const;
|
QString autoAxisTitle() const;
|
||||||
|
QString createAxisObjectName() const;
|
||||||
|
|
||||||
static std::string shortCalculationName( const std::string& calculationName );
|
static std::string shortCalculationName( const std::string& calculationName );
|
||||||
|
|
||||||
|
@ -348,6 +348,22 @@ void RimSummaryTimeAxisProperties::setMajorTickmarkCount( LegendTickmarkCount co
|
|||||||
m_majorTickmarkCount = count;
|
m_majorTickmarkCount = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const QString RimSummaryTimeAxisProperties::objectName() const
|
||||||
|
{
|
||||||
|
return title();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const QString RimSummaryTimeAxisProperties::axisTitleText() const
|
||||||
|
{
|
||||||
|
return title();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -704,11 +720,3 @@ void RimSummaryTimeAxisProperties::defineEditorAttribute( const caf::PdmFieldHan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
const QString& RimSummaryTimeAxisProperties::name() const
|
|
||||||
{
|
|
||||||
return title();
|
|
||||||
}
|
|
||||||
|
@ -107,7 +107,8 @@ public:
|
|||||||
LegendTickmarkCount majorTickmarkCount() const override;
|
LegendTickmarkCount majorTickmarkCount() const override;
|
||||||
void setMajorTickmarkCount( LegendTickmarkCount count ) override;
|
void setMajorTickmarkCount( LegendTickmarkCount count ) override;
|
||||||
|
|
||||||
const QString& name() const override;
|
const QString objectName() const override;
|
||||||
|
const QString axisTitleText() const override;
|
||||||
|
|
||||||
protected:
|
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;
|
||||||
|
@ -1045,14 +1045,7 @@ void RimWellLogTrack::updateZoomFromParentPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogTrack::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
void RimWellLogTrack::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||||
{
|
{
|
||||||
if ( toggle )
|
RiuPlotMainWindowTools::selectOrToggleObject( this, toggle );
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::toggleItemInSelection( this );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -83,6 +83,21 @@ void RiuPlotMainWindowTools::toggleItemInSelection( const caf::PdmObject* object
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuPlotMainWindowTools::selectOrToggleObject( const caf::PdmObject* object, bool toggle )
|
||||||
|
{
|
||||||
|
if ( toggle )
|
||||||
|
{
|
||||||
|
RiuPlotMainWindowTools::toggleItemInSelection( object );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RiuPlotMainWindowTools::selectAsCurrentItem( object );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -34,5 +34,6 @@ public:
|
|||||||
static void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true );
|
static void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true );
|
||||||
static void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
static void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
||||||
static void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
static void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true );
|
||||||
|
static void selectOrToggleObject( const caf::PdmObject* object, bool toggle );
|
||||||
static void refreshToolbars();
|
static void refreshToolbars();
|
||||||
};
|
};
|
||||||
|
@ -557,6 +557,12 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
|||||||
{
|
{
|
||||||
if ( isZoomerActive() ) return false;
|
if ( isZoomerActive() ) return false;
|
||||||
|
|
||||||
|
if ( mouseEvent->type() == QMouseEvent::MouseButtonDblClick )
|
||||||
|
{
|
||||||
|
if ( m_plotDefinition ) m_plotDefinition->zoomAll();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0;
|
bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0;
|
||||||
|
|
||||||
if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton )
|
if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton )
|
||||||
@ -930,13 +936,14 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem
|
|||||||
highlightPlotItems( plotItems );
|
highlightPlotItems( plotItems );
|
||||||
auto plotItem = std::make_shared<RiuQwtPlotItem>( closestItem );
|
auto plotItem = std::make_shared<RiuQwtPlotItem>( closestItem );
|
||||||
emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 );
|
emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 );
|
||||||
|
|
||||||
scheduleReplot();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit plotSelected( toggleItemInSelection );
|
emit plotSelected( toggleItemInSelection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always do a replot, as the reset operation also requires replot
|
||||||
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1136,7 +1143,7 @@ void RiuQwtPlotWidget::highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY )
|
|||||||
if ( axisId != axisIdX && axisId != axisIdY )
|
if ( axisId != axisIdX && axisId != axisIdY )
|
||||||
{
|
{
|
||||||
auto axisWidget = m_plot->axisWidget( axisId );
|
auto axisWidget = m_plot->axisWidget( axisId );
|
||||||
axisWidget->setStyleSheet( "color: gray" );
|
axisWidget->setStyleSheet( "color: #D9D9D9" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,11 +429,16 @@ PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle()
|
|||||||
void PdmUiTreeViewEditor::selectAsCurrentItem( const PdmUiItem* uiItem )
|
void PdmUiTreeViewEditor::selectAsCurrentItem( const PdmUiItem* uiItem )
|
||||||
{
|
{
|
||||||
QModelIndex index = m_treeViewModel->findModelIndex( uiItem );
|
QModelIndex index = m_treeViewModel->findModelIndex( uiItem );
|
||||||
QModelIndex currentIndex = m_filterModel->mapFromSource( index );
|
QModelIndex indexForItem = m_filterModel->mapFromSource( index );
|
||||||
|
|
||||||
|
auto currentSelected = treeView()->currentIndex();
|
||||||
|
|
||||||
|
// Return if index is the same, as resetting the selection causes flickering
|
||||||
|
if ( indexForItem == currentSelected ) return;
|
||||||
|
|
||||||
m_treeView->clearSelection();
|
m_treeView->clearSelection();
|
||||||
|
|
||||||
m_treeView->setCurrentIndex( currentIndex );
|
m_treeView->setCurrentIndex( indexForItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user