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" ) )
|
||||
{
|
||||
m_mainWindow->hide();
|
||||
if ( m_mainWindow ) m_mainWindow->hide();
|
||||
getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
@ -1223,7 +1223,7 @@ void RiaGuiApplication::onProjectBeingOpened()
|
||||
void RiaGuiApplication::onProjectOpeningError( const QString& 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() )
|
||||
{
|
||||
m_mainWindow->show();
|
||||
getOrCreateAndShowMainWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainWindow->hide();
|
||||
if ( m_mainWindow ) m_mainWindow->hide();
|
||||
}
|
||||
|
||||
if ( m_project->showPlotWindow() )
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuFileDialogTools.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
@ -81,15 +82,14 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() );
|
||||
|
||||
startPath = startPath + "/" + templateCandidateName + ".rpt";
|
||||
|
||||
RicSaveMultiPlotTemplateFeatureSettings settings;
|
||||
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;
|
||||
|
||||
QString fileName = settings.filePath();
|
||||
QString fileName = settings.filePath() + "/" + settings.name() + ".rpt";
|
||||
if ( !fileName.isEmpty() )
|
||||
{
|
||||
QFile exportFile( fileName );
|
||||
|
@ -28,6 +28,7 @@ RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings
|
||||
CAF_PDM_InitObject( "Save Summary Plot", ":/CrossSection16x16.png" );
|
||||
|
||||
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_persistObjectNameGroups, "PersistObjectNameGroups", false, "Groups" );
|
||||
@ -50,6 +51,22 @@ QString RicSaveMultiPlotTemplateFeatureSettings::filePath() const
|
||||
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 )
|
||||
{
|
||||
uiOrdering.add( &m_filePath );
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( "Persist Object Names" );
|
||||
@ -102,8 +120,7 @@ void RicSaveMultiPlotTemplateFeatureSettings::defineEditorAttribute( const caf::
|
||||
auto attr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
if ( attr )
|
||||
{
|
||||
attr->m_selectSaveFileName = true;
|
||||
attr->m_fileSelectionFilter = "Plot Template Files(*.rpt);; All files(*.*)";
|
||||
attr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
void setFilePath( const QString& filePath );
|
||||
QString filePath() const;
|
||||
|
||||
void setName( const QString& name );
|
||||
QString name() const;
|
||||
|
||||
bool usePlacholderForWells() const;
|
||||
bool usePlacholderForGroups() const;
|
||||
bool usePlacholderForRegions() const;
|
||||
@ -47,6 +50,7 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
caf::PdmField<QString> m_name;
|
||||
|
||||
caf::PdmField<bool> m_persistObjectNameForWells;
|
||||
caf::PdmField<bool> m_persistObjectNameGroups;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RimSummaryCrossPlot.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmDefaultObjectFactory.h"
|
||||
@ -63,6 +64,17 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC
|
||||
newCurve->loadDataAndUpdate( true );
|
||||
newCurve->updateConnectedEditors();
|
||||
|
||||
RimSummaryMultiPlot* summaryMultiPlot = nullptr;
|
||||
summaryPlot->firstAncestorOrThisOfType( summaryMultiPlot );
|
||||
if ( summaryMultiPlot )
|
||||
{
|
||||
summaryMultiPlot->updatePlotWindowTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
summaryPlot->updatePlotTitle();
|
||||
}
|
||||
|
||||
summaryPlot->updateAllRequiredEditors();
|
||||
|
||||
return newCurve;
|
||||
|
@ -164,7 +164,7 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" );
|
||||
m_valueAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||
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 );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" );
|
||||
@ -891,7 +891,7 @@ void RimAnalysisPlot::updateAxes()
|
||||
if ( valAxisProperties->isActive() )
|
||||
{
|
||||
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(), {}, {} );
|
||||
calc.applyAxisPropertiesToPlot( m_plotWidget );
|
||||
@ -933,14 +933,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
}
|
||||
}
|
||||
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( itemToSelect );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect );
|
||||
}
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -65,13 +65,13 @@ RimGridCrossPlot::RimGridCrossPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis" );
|
||||
m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||
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 );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" );
|
||||
m_yAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||
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 );
|
||||
|
||||
connectAxisSignals( m_xAxisProperties() );
|
||||
@ -385,14 +385,7 @@ void RimGridCrossPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
properties = m_xAxisProperties;
|
||||
}
|
||||
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( properties );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( properties );
|
||||
}
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( properties, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -641,10 +634,13 @@ void RimGridCrossPlot::swapAxes()
|
||||
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
|
||||
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
|
||||
|
||||
QString tmpName = xAxisProperties->name();
|
||||
RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType();
|
||||
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType().axis() );
|
||||
yAxisProperties->setNameAndAxis( tmpName, tmpAxis.axis() );
|
||||
QString tmpName = xAxisProperties->objectName();
|
||||
QString tmpTitle = xAxisProperties->axisTitleText();
|
||||
RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType();
|
||||
xAxisProperties->setNameAndAxis( yAxisProperties->objectName(),
|
||||
yAxisProperties->axisTitleText(),
|
||||
yAxisProperties->plotAxisType().axis() );
|
||||
yAxisProperties->setNameAndAxis( tmpName, tmpTitle, tmpAxis.axis() );
|
||||
|
||||
m_xAxisProperties.removeChildObject( xAxisProperties );
|
||||
m_yAxisProperties.removeChildObject( yAxisProperties );
|
||||
|
@ -206,14 +206,7 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlot::onPlotSelected( bool toggle )
|
||||
{
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( this );
|
||||
}
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( this, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,8 +61,11 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
CAF_PDM_InitField( &m_isActive, "Active", true, "Active" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" );
|
||||
m_name.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_objectName, "Name", "Name" );
|
||||
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" );
|
||||
|
||||
@ -145,7 +148,7 @@ void RimPlotAxisProperties::setNameForUnusedAxis()
|
||||
else if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
||||
name += "Right";
|
||||
|
||||
m_name = name;
|
||||
m_objectName = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -153,7 +156,7 @@ void RimPlotAxisProperties::setNameForUnusedAxis()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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_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 enableRangeSettings( bool enable );
|
||||
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;
|
||||
|
||||
int titleFontSize() const override;
|
||||
int valuesFontSize() const override;
|
||||
|
||||
const QString& name() const override;
|
||||
RiuPlotAxis plotAxisType() const override;
|
||||
bool useAutoTitle() const;
|
||||
const QString objectName() const override;
|
||||
const QString axisTitleText() const override;
|
||||
|
||||
RiuPlotAxis plotAxisType() const override;
|
||||
bool useAutoTitle() const;
|
||||
|
||||
void setShowDescription( bool enable );
|
||||
bool showDescription() const;
|
||||
@ -145,7 +147,9 @@ private:
|
||||
caf::PdmField<double> m_visibleRangeMin;
|
||||
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<int> m_plotAxisIndex;
|
||||
caf::PdmField<LegendTickmarkCountEnum> m_majorTickmarkCount;
|
||||
|
@ -68,7 +68,8 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
|
||||
|
||||
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 ) )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( axis->objectName(), axis ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotControls.h"
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
@ -481,7 +482,22 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
||||
populateNameHelper( m_nameHelper.get() );
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@ -491,7 +507,8 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
||||
{
|
||||
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 );
|
||||
|
||||
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper );
|
||||
@ -609,9 +626,8 @@ bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,8 @@
|
||||
|
||||
#include "RiuPlotAxis.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuQwtPlotItem.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuTreeViewEventFilter.h"
|
||||
|
||||
@ -159,10 +161,10 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
|
||||
m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_sourceStepping.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_alternatePlotName, "AlternateName", "AlternateName" );
|
||||
m_alternatePlotName.uiCapability()->setUiReadOnly( true );
|
||||
m_alternatePlotName.uiCapability()->setUiHidden( true );
|
||||
m_alternatePlotName.xmlCapability()->disableIO();
|
||||
CAF_PDM_InitFieldNoDefault( &m_fallbackPlotName, "AlternateName", "AlternateName" );
|
||||
m_fallbackPlotName.uiCapability()->setUiReadOnly( true );
|
||||
m_fallbackPlotName.uiCapability()->setUiHidden( true );
|
||||
m_fallbackPlotName.xmlCapability()->disableIO();
|
||||
|
||||
setPlotInfoLabel( "Filters Active" );
|
||||
|
||||
@ -389,14 +391,7 @@ void RimSummaryPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
|
||||
caf::PdmObject* itemToSelect = axisPropertiesForPlotAxis( axis );
|
||||
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( itemToSelect );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect );
|
||||
}
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -599,16 +594,6 @@ const RimSummaryNameHelper* RimSummaryPlot::plotTitleHelper() const
|
||||
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() )
|
||||
{
|
||||
if ( ap->name().compare( apToCopy->name() ) == 0 )
|
||||
if ( ap->objectName().compare( apToCopy->objectName() ) == 0 )
|
||||
{
|
||||
QString data = apToCopy->writeObjectToXmlString();
|
||||
ap->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
|
||||
@ -1383,7 +1368,7 @@ caf::PdmFieldHandle* RimSummaryPlot::userDescriptionField()
|
||||
{
|
||||
if ( m_description().isEmpty() )
|
||||
{
|
||||
return &m_alternatePlotName;
|
||||
return &m_fallbackPlotName;
|
||||
}
|
||||
return &m_description;
|
||||
}
|
||||
@ -1804,7 +1789,7 @@ RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxi
|
||||
RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name )
|
||||
{
|
||||
auto* axisProperties = new RimPlotAxisProperties;
|
||||
axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() );
|
||||
axisProperties->setNameAndAxis( name, name, plotAxis.axis(), plotAxis.index() );
|
||||
m_axisProperties.push_back( axisProperties );
|
||||
connectAxisSignals( axisProperties );
|
||||
|
||||
@ -1854,7 +1839,10 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter,
|
||||
// Make sure the new axis on the correct side exists.
|
||||
RiuPlotAxis fixedUpPlotAxis = plotWidget()->createNextPlotAxis( newPlotAxis.axis() );
|
||||
// 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
|
||||
for ( auto curve : summaryCurves() )
|
||||
@ -2335,7 +2323,10 @@ void RimSummaryPlot::initAfterRead()
|
||||
if ( plotAxisProperties )
|
||||
{
|
||||
// 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()
|
||||
{
|
||||
m_alternatePlotName = "";
|
||||
|
||||
QStringList shortCurveNames;
|
||||
|
||||
if ( m_summaryCurveCollection->isCurvesVisible() )
|
||||
{
|
||||
for ( auto c : summaryCurves() )
|
||||
@ -2488,7 +2475,6 @@ void RimSummaryPlot::updateCurveNames()
|
||||
if ( c->isCurveVisible() )
|
||||
{
|
||||
c->updateCurveNameNoLegendUpdate();
|
||||
shortCurveNames.append( QString::fromStdString( c->summaryAddressY().vectorName() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2496,14 +2482,11 @@ void RimSummaryPlot::updateCurveNames()
|
||||
for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() )
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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* plotTitleHelper() const;
|
||||
void updateCurveNames();
|
||||
QString generatedPlotTitleFromAllCurves() const;
|
||||
|
||||
void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||
void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot );
|
||||
@ -228,6 +227,7 @@ private:
|
||||
void deleteAllPlotCurves();
|
||||
|
||||
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 );
|
||||
|
||||
@ -305,7 +305,7 @@ private:
|
||||
|
||||
caf::PdmField<bool> m_useAutoPlotTitle;
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<QString> m_alternatePlotName;
|
||||
caf::PdmField<QString> m_fallbackPlotName;
|
||||
|
||||
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
||||
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
||||
|
@ -130,7 +130,8 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
|
||||
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 );
|
||||
|
||||
bool titleBold = false;
|
||||
@ -276,8 +277,8 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
|
||||
for ( const RiaSummaryCurveDefinition& curveDef : m_curveDefinitions )
|
||||
{
|
||||
RifEclipseSummaryAddress sumAddress = curveDef.summaryAddress();
|
||||
std::string unitText;
|
||||
const RifEclipseSummaryAddress& sumAddress = curveDef.summaryAddress();
|
||||
std::string unitText;
|
||||
if ( curveDef.summaryCase() && curveDef.summaryCase()->summaryReader() )
|
||||
{
|
||||
unitText = curveDef.summaryCase()->summaryReader()->unitName( sumAddress );
|
||||
@ -285,7 +286,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
else if ( curveDef.ensemble() )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
@ -303,7 +304,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
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 )
|
||||
{
|
||||
@ -337,6 +338,86 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
|
||||
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:
|
||||
QString autoAxisTitle() const;
|
||||
QString createAxisObjectName() const;
|
||||
|
||||
static std::string shortCalculationName( const std::string& calculationName );
|
||||
|
||||
|
@ -348,6 +348,22 @@ void RimSummaryTimeAxisProperties::setMajorTickmarkCount( LegendTickmarkCount co
|
||||
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;
|
||||
void setMajorTickmarkCount( LegendTickmarkCount count ) override;
|
||||
|
||||
const QString& name() const override;
|
||||
const QString objectName() const override;
|
||||
const QString axisTitleText() const override;
|
||||
|
||||
protected:
|
||||
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 )
|
||||
{
|
||||
if ( toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( this );
|
||||
}
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( this, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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 selectAsCurrentItem( 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();
|
||||
};
|
||||
|
@ -557,6 +557,12 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
{
|
||||
if ( isZoomerActive() ) return false;
|
||||
|
||||
if ( mouseEvent->type() == QMouseEvent::MouseButtonDblClick )
|
||||
{
|
||||
if ( m_plotDefinition ) m_plotDefinition->zoomAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0;
|
||||
|
||||
if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton )
|
||||
@ -930,13 +936,14 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem
|
||||
highlightPlotItems( plotItems );
|
||||
auto plotItem = std::make_shared<RiuQwtPlotItem>( closestItem );
|
||||
emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 );
|
||||
|
||||
scheduleReplot();
|
||||
}
|
||||
else
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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->setCurrentIndex( currentIndex );
|
||||
m_treeView->setCurrentIndex( indexForItem );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user