mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary Multi Plot: Minor adjustments (#8856)
Remove obsolete single summary template code Always use maximized state of the QMdiSubWindow when a plot or view is deleted. Move time axis to top Set correct text for unused axis Avoid assert when layout is requested for non existing legend
This commit is contained in:
parent
f54399960d
commit
64bed1d611
@ -1,5 +1,4 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.h
|
||||
@ -10,7 +9,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.cpp
|
||||
|
@ -95,7 +95,9 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked )
|
||||
QFile exportFile( fileName );
|
||||
if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||
{
|
||||
RiaLogging::error( QString( "Save Plot Template : Could not open the file: %1" ).arg( fileName ) );
|
||||
RiaLogging::errorInMessageBox( NULL,
|
||||
"Save Plot Template",
|
||||
QString( "Could not save to the file: %1" ).arg( fileName ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,230 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicSavePlotTemplateFeature.h"
|
||||
|
||||
#include "RicReloadPlotTemplatesFeature.h"
|
||||
#include "RicSummaryPlotTemplateTools.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuFileDialogTools.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicSavePlotTemplateFeature, "RicSavePlotTemplateFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSavePlotTemplateFeature::isCommandEnabled()
|
||||
{
|
||||
if ( selectedSummaryPlot() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSavePlotTemplateFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( !selectedSummaryPlot() ) return;
|
||||
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
QString fallbackPath;
|
||||
auto folders = app->preferences()->plotTemplateFolders();
|
||||
if ( !folders.empty() )
|
||||
{
|
||||
// Use the last folder from preferences as the default fall back folder
|
||||
fallbackPath = folders.back();
|
||||
}
|
||||
|
||||
QString startPath = app->lastUsedDialogDirectoryWithFallback( "PLOT_TEMPLATE", fallbackPath );
|
||||
|
||||
QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() );
|
||||
|
||||
startPath = startPath + "/" + templateCandidateName + ".rpt";
|
||||
|
||||
QString fileName = RiuFileDialogTools::getSaveFileName( nullptr,
|
||||
tr( "Save Plot Template To File" ),
|
||||
startPath,
|
||||
tr( "Plot Template Files (*.rpt);;All files(*.*)" ) );
|
||||
if ( !fileName.isEmpty() )
|
||||
{
|
||||
QFile exportFile( fileName );
|
||||
if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||
{
|
||||
RiaLogging::error( QString( "Save Plot Template : Could not open the file: %1" ).arg( fileName ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QString objectAsText = createTextFromObject( selectedSummaryPlot() );
|
||||
|
||||
QTextStream stream( &exportFile );
|
||||
stream << objectAsText;
|
||||
|
||||
QString absPath = QFileInfo( fileName ).absolutePath();
|
||||
bool foundPathInPreferences = false;
|
||||
for ( const auto& f : folders )
|
||||
{
|
||||
if ( absPath.indexOf( f ) != -1 )
|
||||
{
|
||||
foundPathInPreferences = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !foundPathInPreferences )
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon( QMessageBox::Question );
|
||||
|
||||
QString questionText;
|
||||
questionText = QString( "The path is not part of the search path for templates.\n\nDo you want to append "
|
||||
"the destination path to the search path?" );
|
||||
|
||||
msgBox.setText( questionText );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel );
|
||||
|
||||
int ret = msgBox.exec();
|
||||
if ( ret == QMessageBox::Yes )
|
||||
{
|
||||
app->preferences()->appendPlotTemplateFolders( absPath );
|
||||
app->preferences()->writePreferencesToApplicationStore();
|
||||
}
|
||||
}
|
||||
|
||||
app->setLastUsedDialogDirectory( "PLOT_TEMPLATE", absPath );
|
||||
|
||||
RicReloadPlotTemplatesFeature::rebuildFromDisc();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicSavePlotTemplateFeature::createTextFromObject( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
if ( !summaryPlot ) return QString();
|
||||
|
||||
QString objectAsText = summaryPlot->writeObjectToXmlString();
|
||||
|
||||
caf::PdmObjectHandle* obj =
|
||||
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText,
|
||||
caf::PdmDefaultObjectFactory::instance(),
|
||||
true );
|
||||
|
||||
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
|
||||
if ( newSummaryPlot )
|
||||
{
|
||||
{
|
||||
std::set<QString> caseReferenceStrings;
|
||||
|
||||
const QString summaryFieldKeyword = RicSummaryPlotTemplateTools::summaryCaseFieldKeyword();
|
||||
for ( const auto& curve : newSummaryPlot->summaryCurves() )
|
||||
{
|
||||
auto fieldHandle = curve->findField( summaryFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
auto reference = fieldHandle->xmlCapability()->referenceString();
|
||||
caseReferenceStrings.insert( reference );
|
||||
}
|
||||
}
|
||||
|
||||
size_t index = 0;
|
||||
for ( const auto& s : caseReferenceStrings )
|
||||
{
|
||||
QString placeholderText = RicSummaryPlotTemplateTools::placeholderTextForSummaryCase();
|
||||
QString caseName = QString( "%1 %2" ).arg( placeholderText ).arg( index++ );
|
||||
|
||||
objectAsText.replace( s, caseName );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::set<QString> ensembleReferenceStrings;
|
||||
|
||||
const QString summaryGroupFieldKeyword = RicSummaryPlotTemplateTools::summaryGroupFieldKeyword();
|
||||
|
||||
for ( const auto& curveSet : newSummaryPlot->ensembleCurveSetCollection()->curveSets() )
|
||||
{
|
||||
auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
auto reference = fieldHandle->xmlCapability()->referenceString();
|
||||
ensembleReferenceStrings.insert( reference );
|
||||
}
|
||||
}
|
||||
|
||||
size_t index = 0;
|
||||
for ( const auto& s : ensembleReferenceStrings )
|
||||
{
|
||||
QString placeholderText = RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup();
|
||||
QString ensembleName = QString( "%1 %2" ).arg( placeholderText ).arg( index++ );
|
||||
|
||||
objectAsText.replace( s, ensembleName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete obj;
|
||||
|
||||
return objectAsText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSavePlotTemplateFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Save As Plot Template" );
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicSavePlotTemplateFeature::selectedSummaryPlot() const
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
sumPlot = RiaSummaryTools::parentSummaryPlot( selObj );
|
||||
}
|
||||
|
||||
return sumPlot;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSavePlotTemplateFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static QString createTextFromObject( RimSummaryPlot* summaryPlot );
|
||||
|
||||
private:
|
||||
RimSummaryPlot* selectedSummaryPlot() const;
|
||||
};
|
@ -278,190 +278,6 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot*
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicSummaryPlotTemplateTools::createPlotFromTemplateFile( const QString& fileName )
|
||||
{
|
||||
QFile importFile( fileName );
|
||||
if ( !importFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
RiaLogging::error( QString( "Create Plot from Template : Could not open the file: %1" ).arg( fileName ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QTextStream stream( &importFile );
|
||||
|
||||
QString objectAsText = stream.readAll();
|
||||
|
||||
caf::PdmObjectHandle* obj =
|
||||
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText,
|
||||
caf::PdmDefaultObjectFactory::instance(),
|
||||
true );
|
||||
|
||||
auto* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
|
||||
if ( newSummaryPlot )
|
||||
{
|
||||
bool isTemplateBefore_2021_06 = !objectAsText.contains( "<PlotCurveAppearance>" );
|
||||
if ( isTemplateBefore_2021_06 )
|
||||
{
|
||||
for ( auto c : newSummaryPlot->summaryAndEnsembleCurves() )
|
||||
{
|
||||
// Special handling of appearance settings because we do not have any support for file version of
|
||||
// plot templates
|
||||
// https://github.com/OPM/ResInsight/issues/8257
|
||||
c->updateCurveAppearanceForFilesOlderThan_2021_06();
|
||||
}
|
||||
}
|
||||
|
||||
return newSummaryPlot;
|
||||
}
|
||||
|
||||
delete obj;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection(
|
||||
RimSummaryPlot* summaryPlot,
|
||||
const std::vector<RimSummaryCase*>& selectedSummaryCases,
|
||||
const std::vector<RimSummaryCaseCollection*>& selectedEnsembles )
|
||||
{
|
||||
if ( !summaryPlot ) return;
|
||||
|
||||
if ( selectedSummaryCases.empty() && selectedEnsembles.empty() ) return;
|
||||
|
||||
RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( summaryPlot );
|
||||
summaryPlot->resolveReferencesRecursively();
|
||||
summaryPlot->initAfterReadRecursively();
|
||||
|
||||
{
|
||||
// Replace single summary curves data sources
|
||||
|
||||
auto summaryCurves = summaryPlot->summaryCurves();
|
||||
|
||||
const QString summaryFieldKeyword = RicSummaryPlotTemplateTools::summaryCaseFieldKeyword();
|
||||
|
||||
int maximumIndexValue = -1;
|
||||
for ( const auto& curve : summaryCurves )
|
||||
{
|
||||
auto fieldHandle = curve->findField( summaryFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
bool conversionOk = false;
|
||||
const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryCase();
|
||||
|
||||
auto referenceString = fieldHandle->xmlCapability()->referenceString();
|
||||
int indexValue =
|
||||
RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk );
|
||||
|
||||
maximumIndexValue = std::max( maximumIndexValue, indexValue );
|
||||
|
||||
if ( conversionOk && indexValue >= 0 && indexValue < static_cast<int>( selectedSummaryCases.size() ) )
|
||||
{
|
||||
auto summaryCaseY = selectedSummaryCases[static_cast<int>( indexValue )];
|
||||
curve->setSummaryCaseY( summaryCaseY );
|
||||
|
||||
auto currentAddressY = curve->summaryAddressY();
|
||||
if ( summaryCaseY->summaryReader() && !summaryCaseY->summaryReader()->hasAddress( currentAddressY ) )
|
||||
{
|
||||
auto allAddresses = summaryCaseY->summaryReader()->allResultAddresses();
|
||||
|
||||
auto candidate =
|
||||
RicSummaryPlotTemplateTools::firstAddressByQuantity( currentAddressY, allAddresses );
|
||||
if ( candidate.category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
|
||||
{
|
||||
curve->setSummaryAddressY( candidate );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( selectedSummaryCases.size() > static_cast<size_t>( maximumIndexValue + 1 ) )
|
||||
{
|
||||
// Use the curve style of the last curve in template, and duplicate this for remaining data sources
|
||||
|
||||
if ( !summaryCurves.empty() )
|
||||
{
|
||||
auto lastSummaryCurve = summaryCurves.back();
|
||||
|
||||
for ( size_t i = maximumIndexValue; i < selectedSummaryCases.size(); i++ )
|
||||
{
|
||||
auto newCurve =
|
||||
dynamic_cast<RimSummaryCurve*>( lastSummaryCurve->xmlCapability()->copyByXmlSerialization(
|
||||
caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
auto summaryCaseY = selectedSummaryCases[i];
|
||||
newCurve->setSummaryCaseY( summaryCaseY );
|
||||
summaryPlot->addCurveAndUpdate( newCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Replace ensemble data sources
|
||||
|
||||
auto summaryCurveSets = summaryPlot->ensembleCurveSetCollection()->curveSets();
|
||||
|
||||
const QString summaryGroupFieldKeyword = RicSummaryPlotTemplateTools::summaryGroupFieldKeyword();
|
||||
|
||||
int maximumIndexValue = -1;
|
||||
|
||||
for ( const auto& curveSet : summaryCurveSets )
|
||||
{
|
||||
auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
bool conversionOk = false;
|
||||
const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup();
|
||||
|
||||
auto referenceString = fieldHandle->xmlCapability()->referenceString();
|
||||
int indexValue =
|
||||
RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk );
|
||||
|
||||
maximumIndexValue = std::max( maximumIndexValue, indexValue );
|
||||
|
||||
if ( conversionOk && indexValue < static_cast<int>( selectedEnsembles.size() ) )
|
||||
{
|
||||
auto summaryCaseY = selectedEnsembles[indexValue];
|
||||
curveSet->setSummaryCaseCollection( summaryCaseY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( selectedEnsembles.size() > static_cast<size_t>( maximumIndexValue + 1 ) )
|
||||
{
|
||||
// Use the curve style of the last curve in template, and duplicate this for remaining data sources
|
||||
|
||||
if ( !summaryCurveSets.empty() )
|
||||
{
|
||||
auto lastSummaryCurveSet = summaryCurveSets.back();
|
||||
|
||||
for ( size_t i = maximumIndexValue; i < selectedEnsembles.size(); i++ )
|
||||
{
|
||||
auto newCurveSet =
|
||||
dynamic_cast<RimEnsembleCurveSet*>( lastSummaryCurveSet->xmlCapability()->copyByXmlSerialization(
|
||||
caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
auto ensembleDataSource = selectedEnsembles[i];
|
||||
newCurveSet->setSummaryCaseCollection( ensembleDataSource );
|
||||
|
||||
summaryPlot->ensembleCurveSetCollection()->addCurveSet( newCurveSet );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
multiPlot->updateConnectedEditors();
|
||||
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,9 +41,31 @@ class RimSummaryAddressCollection;
|
||||
class RicSummaryPlotTemplateTools
|
||||
{
|
||||
public:
|
||||
static RimSummaryMultiPlot* create( const QString& fileName );
|
||||
|
||||
static QString selectPlotTemplatePath();
|
||||
|
||||
static QString summaryCaseFieldKeyword();
|
||||
static QString summaryGroupFieldKeyword();
|
||||
|
||||
static QString placeholderTextForSummaryCase();
|
||||
static QString placeholderTextForSummaryGroup();
|
||||
static QString placeholderTextForWell();
|
||||
static QString placeholderTextForGroup();
|
||||
|
||||
private:
|
||||
static RimSummaryMultiPlot* createMultiPlotFromTemplateFile( const QString& fileName );
|
||||
|
||||
static RimSummaryMultiPlot* create( const QString& fileName );
|
||||
static std::vector<RimSummaryCase*> selectedSummaryCases();
|
||||
static std::vector<RimSummaryCaseCollection*> selectedSummaryCaseCollections();
|
||||
static std::vector<RimSummaryAddressCollection*> selectedSummaryAddressCollections();
|
||||
|
||||
static QString htmlTextFromPlotAndSelection( const RimSummaryPlot* templatePlot,
|
||||
|
||||
const std::set<RifEclipseSummaryAddress>& selectedSummaryAddresses,
|
||||
const std::vector<caf::PdmObject*>& selectedSources );
|
||||
|
||||
static QString htmlTextFromCount( const QString& itemText, size_t requiredItemCount, size_t selectionCount );
|
||||
|
||||
static void setValuesForPlaceholders( RimSummaryMultiPlot* summaryMultiPlot,
|
||||
const std::vector<RimSummaryCase*>& selectedSummaryCases,
|
||||
@ -59,33 +81,6 @@ public:
|
||||
const std::vector<QString>& groupNames,
|
||||
const std::vector<QString>& regions );
|
||||
|
||||
static RimSummaryPlot* createPlotFromTemplateFile( const QString& fileName );
|
||||
static void appendSummaryPlotToPlotCollection( RimSummaryPlot* summaryPlot,
|
||||
const std::vector<RimSummaryCase*>& selectedSummaryCases,
|
||||
const std::vector<RimSummaryCaseCollection*>& selectedEnsembles );
|
||||
|
||||
static QString htmlTextFromPlotAndSelection( const RimSummaryPlot* templatePlot,
|
||||
const std::set<RifEclipseSummaryAddress>& selectedSummaryAddresses,
|
||||
const std::vector<caf::PdmObject*>& selectedSources );
|
||||
|
||||
static QString htmlTextFromCount( const QString& itemText, size_t requiredItemCount, size_t selectionCount );
|
||||
|
||||
static QString selectPlotTemplatePath();
|
||||
|
||||
static std::vector<RimSummaryCase*> selectedSummaryCases();
|
||||
static std::vector<RimSummaryCaseCollection*> selectedSummaryCaseCollections();
|
||||
|
||||
static std::vector<RimSummaryAddressCollection*> selectedSummaryAddressCollections();
|
||||
|
||||
static QString summaryCaseFieldKeyword();
|
||||
static QString summaryGroupFieldKeyword();
|
||||
|
||||
static QString placeholderTextForSummaryCase();
|
||||
static QString placeholderTextForSummaryGroup();
|
||||
static QString placeholderTextForWell();
|
||||
static QString placeholderTextForGroup();
|
||||
|
||||
private:
|
||||
static RifEclipseSummaryAddress firstAddressByQuantity( const RifEclipseSummaryAddress& sourceAddress,
|
||||
const std::set<RifEclipseSummaryAddress>& allAddresses );
|
||||
|
||||
|
@ -36,8 +36,8 @@ CAF_CMD_SOURCE_INIT( RicNewPlotAxisPropertiesFeature, "RicNewPlotAxisPropertiesF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPlotAxisPropertiesFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimSummaryPlot*> summaryPlots = caf::selectedObjectsByTypeStrict<RimSummaryPlot*>();
|
||||
return summaryPlots.size() == 1;
|
||||
auto* summaryPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot*>();
|
||||
return ( summaryPlot != nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -45,13 +45,13 @@ bool RicNewPlotAxisPropertiesFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPlotAxisPropertiesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryPlot*> summaryPlots = caf::selectedObjectsByTypeStrict<RimSummaryPlot*>();
|
||||
if ( summaryPlots.size() != 1 ) return;
|
||||
|
||||
RimSummaryPlot* summaryPlot = summaryPlots[0];
|
||||
auto* summaryPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot*>();
|
||||
if ( !summaryPlot ) return;
|
||||
|
||||
RimPlotAxisProperties* newPlotAxisProperties =
|
||||
summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis" );
|
||||
summaryPlot->plotWidget()->ensureAxisIsCreated( newPlotAxisProperties->plotAxisType() );
|
||||
newPlotAxisProperties->setNameForUnusedAxis();
|
||||
|
||||
summaryPlot->updateConnectedEditors();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newPlotAxisProperties );
|
||||
|
@ -100,6 +100,7 @@
|
||||
#include "RimParameterResultCrossPlot.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
#include "RimPlotDataFilterCollection.h"
|
||||
#include "RimPlotDataFilterItem.h"
|
||||
#include "RimPltPlotCollection.h"
|
||||
@ -680,7 +681,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicNewSummaryCrossPlotCurveFeature";
|
||||
menuBuilder << "RicNewPlotAxisPropertiesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicSavePlotTemplateFeature";
|
||||
|
||||
// Export is not supported for cross plot
|
||||
if ( !summaryCrossPlot ) menuBuilder << "RicAsciiExportSummaryPlotFeature";
|
||||
@ -1043,6 +1043,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicCreateMultiPlotFromSelectionFeature";
|
||||
menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimPlotAxisPropertiesInterface*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewPlotAxisPropertiesFeature";
|
||||
}
|
||||
|
||||
if ( dynamic_cast<Rim3dView*>( firstUiItem ) )
|
||||
{
|
||||
|
@ -133,6 +133,21 @@ void RimPlotAxisProperties::enableRangeSettings( bool enable )
|
||||
m_isRangeSettingsEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotAxisProperties::setNameForUnusedAxis()
|
||||
{
|
||||
QString name = "Unused ";
|
||||
|
||||
if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||
name += "Left";
|
||||
else if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
|
||||
name += "Right";
|
||||
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
|
||||
void setEnableTitleTextSettings( bool enable );
|
||||
void enableRangeSettings( bool enable );
|
||||
void setNameForUnusedAxis();
|
||||
void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 );
|
||||
AxisTitlePositionType titlePosition() const override;
|
||||
|
||||
|
@ -511,7 +511,10 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf:
|
||||
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
||||
if ( dynamic_cast<RimPlotAxisProperties*>( axis ) )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,12 +127,6 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" );
|
||||
|
||||
auto leftAxis = addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" );
|
||||
leftAxis->setAlwaysRequired( true );
|
||||
|
||||
auto rightAxis = addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" );
|
||||
rightAxis->setAlwaysRequired( true );
|
||||
|
||||
if ( m_isCrossPlot )
|
||||
{
|
||||
addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom" );
|
||||
@ -145,6 +139,12 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
|
||||
m_axisProperties.push_back( timeAxisProperties );
|
||||
}
|
||||
|
||||
auto leftAxis = addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" );
|
||||
leftAxis->setAlwaysRequired( true );
|
||||
|
||||
auto rightAxis = addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" );
|
||||
rightAxis->setAlwaysRequired( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, "SummaryPlotFilterTextCurveSetEditor", "Text Filter Curve Creator" );
|
||||
m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true );
|
||||
m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor;
|
||||
@ -813,27 +813,37 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis )
|
||||
if ( riuPlotAxis.axis() == plotAxis )
|
||||
{
|
||||
auto* axisProperties = dynamic_cast<RimPlotAxisProperties*>( yAxisProperties );
|
||||
if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) && axisProperties )
|
||||
if ( axisProperties )
|
||||
{
|
||||
plotWidget()->enableAxis( riuPlotAxis, true );
|
||||
|
||||
std::set<QString> timeHistoryQuantities;
|
||||
|
||||
for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) )
|
||||
if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) )
|
||||
{
|
||||
timeHistoryQuantities.insert( c->quantityName() );
|
||||
plotWidget()->enableAxis( riuPlotAxis, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
plotWidget()->enableAxis( riuPlotAxis, false );
|
||||
}
|
||||
|
||||
RimSummaryPlotAxisFormatter calc( axisProperties,
|
||||
visibleSummaryCurvesForAxis( riuPlotAxis ),
|
||||
{},
|
||||
visibleAsciiDataCurvesForAxis( riuPlotAxis ),
|
||||
timeHistoryQuantities );
|
||||
calc.applyAxisPropertiesToPlot( plotWidget() );
|
||||
}
|
||||
else
|
||||
{
|
||||
plotWidget()->enableAxis( riuPlotAxis, false );
|
||||
if ( !hasVisibleCurvesForAxis( riuPlotAxis ) )
|
||||
{
|
||||
axisProperties->setNameForUnusedAxis();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::set<QString> timeHistoryQuantities;
|
||||
|
||||
for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) )
|
||||
{
|
||||
timeHistoryQuantities.insert( c->quantityName() );
|
||||
}
|
||||
|
||||
RimSummaryPlotAxisFormatter calc( axisProperties,
|
||||
visibleSummaryCurvesForAxis( riuPlotAxis ),
|
||||
{},
|
||||
visibleAsciiDataCurvesForAxis( riuPlotAxis ),
|
||||
timeHistoryQuantities );
|
||||
calc.applyAxisPropertiesToPlot( plotWidget() );
|
||||
}
|
||||
}
|
||||
|
||||
plotWidget()->enableAxisNumberLabels( riuPlotAxis, axisProperties->showNumbers() );
|
||||
|
@ -346,11 +346,10 @@ bool RiuMainWindowBase::isBlockingViewSelectionOnSubWindowActivated() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowBase::removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* viewer )
|
||||
{
|
||||
bool wasMaximized = viewer && viewer->isMaximized();
|
||||
|
||||
bool removedSubWindowWasActive = false;
|
||||
|
||||
QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer );
|
||||
bool wasMaximized = subWindowBeingClosed->isMaximized();
|
||||
if ( subWindowBeingClosed )
|
||||
{
|
||||
if ( subWindowBeingClosed->isActiveWindow() )
|
||||
|
@ -80,7 +80,7 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent )
|
||||
{
|
||||
CAF_ASSERT( m_plotDefinition );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
auto* layout = new QVBoxLayout;
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
setLayout( layout );
|
||||
|
||||
@ -275,7 +275,7 @@ void RiuQwtPlotWidget::setInternalLegendVisible( bool visible )
|
||||
{
|
||||
if ( visible )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( this );
|
||||
auto* legend = new QwtLegend( this );
|
||||
m_plot->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
else
|
||||
@ -291,7 +291,7 @@ void RiuQwtPlotWidget::insertLegend( RiuPlotWidget::Legend legendPosition )
|
||||
{
|
||||
CAF_ASSERT( legendPosition == RiuPlotWidget::Legend::BOTTOM );
|
||||
|
||||
QwtLegend* legend = new QwtLegend( this );
|
||||
auto* legend = new QwtLegend( this );
|
||||
m_plot->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, b
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
for ( QwtPlotItem* plotItem : plotItems )
|
||||
{
|
||||
QwtPlotGrid* grid = static_cast<QwtPlotGrid*>( plotItem );
|
||||
auto* grid = static_cast<QwtPlotGrid*>( plotItem );
|
||||
if ( qwtAxis == QwtAxis::XTop || qwtAxis == QwtAxis::XBottom )
|
||||
{
|
||||
grid->setXAxis( qwtAxis );
|
||||
@ -382,8 +382,8 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||
double minValue,
|
||||
double maxValue )
|
||||
{
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
auto* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
if ( scaleEngine )
|
||||
{
|
||||
QwtScaleDiv scaleDiv =
|
||||
@ -404,8 +404,8 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis,
|
||||
double rangeMin,
|
||||
double rangeMax )
|
||||
{
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
auto* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
if ( scaleEngine )
|
||||
{
|
||||
QwtScaleDiv scaleDiv = scaleEngine->divideScaleWithExplicitIntervalsAndRange( minTickValue,
|
||||
@ -542,7 +542,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
{
|
||||
if ( RiuPlotWidget::handleDragDropEvent( event ) ) return true;
|
||||
|
||||
QWheelEvent* wheelEvent = dynamic_cast<QWheelEvent*>( event );
|
||||
auto* wheelEvent = dynamic_cast<QWheelEvent*>( event );
|
||||
if ( wheelEvent && watched == m_plot->canvas() )
|
||||
{
|
||||
event->accept();
|
||||
@ -551,7 +551,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
return true;
|
||||
}
|
||||
|
||||
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>( event );
|
||||
auto* mouseEvent = dynamic_cast<QMouseEvent*>( event );
|
||||
if ( mouseEvent )
|
||||
{
|
||||
if ( isZoomerActive() ) return false;
|
||||
@ -571,7 +571,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
||||
QWidget* childClicked = m_plot->childAt( m_clickPosition );
|
||||
if ( childClicked )
|
||||
{
|
||||
QwtScaleWidget* scaleWidget = qobject_cast<QwtScaleWidget*>( childClicked );
|
||||
auto* scaleWidget = qobject_cast<QwtScaleWidget*>( childClicked );
|
||||
if ( scaleWidget )
|
||||
{
|
||||
onAxisSelected( scaleWidget, toggleItemInSelection );
|
||||
@ -678,7 +678,7 @@ void RiuQwtPlotWidget::applyAxisTitleToQwt( RiuPlotAxis axis )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuQwtPlotWidget::sizeHint() const
|
||||
{
|
||||
return QSize( 0, 0 );
|
||||
return { 0, 0 };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -686,7 +686,7 @@ QSize RiuQwtPlotWidget::sizeHint() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuQwtPlotWidget::minimumSizeHint() const
|
||||
{
|
||||
return QSize( 0, 0 );
|
||||
return { 0, 0 };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -787,8 +787,8 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
|
||||
{
|
||||
for ( int i = 0; i < QwtAxis::AxisPositions; ++i )
|
||||
{
|
||||
QwtAxis::Position pos = static_cast<QwtAxis::Position>( i );
|
||||
int count = m_plot->axesCount( pos );
|
||||
auto pos = static_cast<QwtAxis::Position>( i );
|
||||
int count = m_plot->axesCount( pos );
|
||||
for ( int id = 0; id < count; id++ )
|
||||
{
|
||||
QwtAxisId axisId( pos, id );
|
||||
@ -844,13 +844,13 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos,
|
||||
*distanceFromClick = std::numeric_limits<double>::infinity();
|
||||
|
||||
const QwtPlotItemList& itmList = m_plot->itemList();
|
||||
for ( QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); it++ )
|
||||
for ( auto it : itmList )
|
||||
{
|
||||
if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve )
|
||||
if ( it->rtti() == QwtPlotItem::Rtti_PlotCurve )
|
||||
{
|
||||
QwtPlotCurve* candidateCurve = static_cast<QwtPlotCurve*>( *it );
|
||||
double dist = std::numeric_limits<double>::infinity();
|
||||
int curvePoint = candidateCurve->closestPoint( pos, &dist );
|
||||
auto* candidateCurve = static_cast<QwtPlotCurve*>( it );
|
||||
double dist = std::numeric_limits<double>::infinity();
|
||||
int curvePoint = candidateCurve->closestPoint( pos, &dist );
|
||||
if ( dist < *distanceFromClick )
|
||||
{
|
||||
*closestItem = candidateCurve;
|
||||
@ -858,21 +858,21 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos,
|
||||
*closestCurvePoint = curvePoint;
|
||||
}
|
||||
}
|
||||
else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotShape )
|
||||
else if ( it->rtti() == QwtPlotItem::Rtti_PlotShape )
|
||||
{
|
||||
QwtPlotShapeItem* shapeItem = static_cast<QwtPlotShapeItem*>( *it );
|
||||
QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ),
|
||||
auto* shapeItem = static_cast<QwtPlotShapeItem*>( it );
|
||||
QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ),
|
||||
m_plot->invTransform( QwtAxis::YLeft, pos.y() ) );
|
||||
if ( shapeItem->shape().boundingRect().contains( scalePos ) )
|
||||
{
|
||||
*closestItem = *it;
|
||||
*closestItem = it;
|
||||
*distanceFromClick = 0.0;
|
||||
}
|
||||
}
|
||||
else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotBarChart )
|
||||
else if ( it->rtti() == QwtPlotItem::Rtti_PlotBarChart )
|
||||
{
|
||||
QwtPlotBarChart* barChart = static_cast<QwtPlotBarChart*>( *it );
|
||||
QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ),
|
||||
auto* barChart = static_cast<QwtPlotBarChart*>( it );
|
||||
QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ),
|
||||
m_plot->invTransform( QwtAxis::YLeft, pos.y() ) );
|
||||
|
||||
bool horizontal = barChart->orientation() == Qt::Horizontal;
|
||||
@ -883,7 +883,7 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos,
|
||||
: std::abs( samplePoint.x() - scalePos.x() );
|
||||
if ( dist < *distanceFromClick )
|
||||
{
|
||||
*closestItem = *it;
|
||||
*closestItem = it;
|
||||
*closestCurvePoint = (int)i;
|
||||
*distanceFromClick = dist;
|
||||
}
|
||||
@ -964,8 +964,8 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set<const QwtPlotItem*>& c
|
||||
auto plotItemList = m_plot->itemList();
|
||||
for ( QwtPlotItem* plotItem : plotItemList )
|
||||
{
|
||||
QwtPlotCurve* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
|
||||
QwtPlotShapeItem* plotShapeItem = dynamic_cast<QwtPlotShapeItem*>( plotItem );
|
||||
auto* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
|
||||
auto* plotShapeItem = dynamic_cast<QwtPlotShapeItem*>( plotItem );
|
||||
if ( plotCurve )
|
||||
{
|
||||
QPen existingPen = plotCurve->pen();
|
||||
@ -975,7 +975,7 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set<const QwtPlotItem*>& c
|
||||
QColor symbolColor;
|
||||
QColor symbolLineColor;
|
||||
|
||||
QwtSymbol* symbol = const_cast<QwtSymbol*>( plotCurve->symbol() );
|
||||
auto* symbol = const_cast<QwtSymbol*>( plotCurve->symbol() );
|
||||
if ( symbol )
|
||||
{
|
||||
symbolColor = symbol->brush().color();
|
||||
@ -1026,8 +1026,8 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting()
|
||||
auto plotItemList = m_plot->itemList();
|
||||
for ( QwtPlotItem* plotItem : plotItemList )
|
||||
{
|
||||
QwtPlotCurve* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
|
||||
QwtPlotShapeItem* plotShapeItem = dynamic_cast<QwtPlotShapeItem*>( plotItem );
|
||||
auto* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
|
||||
auto* plotShapeItem = dynamic_cast<QwtPlotShapeItem*>( plotItem );
|
||||
if ( plotCurve && m_originalCurveColors.count( plotCurve ) )
|
||||
{
|
||||
const QPen& existingPen = plotCurve->pen();
|
||||
@ -1036,7 +1036,7 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting()
|
||||
|
||||
plotCurve->setPen( colors.lineColor, existingPen.width(), existingPen.style() );
|
||||
plotCurve->setZ( zValue );
|
||||
QwtSymbol* symbol = const_cast<QwtSymbol*>( plotCurve->symbol() );
|
||||
auto* symbol = const_cast<QwtSymbol*>( plotCurve->symbol() );
|
||||
if ( symbol )
|
||||
{
|
||||
symbol->setColor( colors.symbolColor );
|
||||
@ -1068,7 +1068,7 @@ void RiuQwtPlotWidget::highlightPlotItemsForQwtAxis( QwtAxisId axisId )
|
||||
auto plotItemList = m_plot->itemList();
|
||||
for ( QwtPlotItem* plotItem : plotItemList )
|
||||
{
|
||||
QwtPlotCurve* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
|
||||
auto* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem );
|
||||
if ( plotCurve )
|
||||
{
|
||||
QwtAxisId xAxis = plotCurve->xAxis();
|
||||
@ -1143,7 +1143,10 @@ void RiuQwtPlotWidget::enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const
|
||||
{
|
||||
return m_plot->isAxisVisible( toQwtPlotAxis( axis ) );
|
||||
auto qwtPlotAxis = toQwtPlotAxis( axis );
|
||||
if ( qwtPlotAxis.pos < 0 ) return false;
|
||||
|
||||
return m_plot->isAxisVisible( qwtPlotAxis );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1202,12 +1205,10 @@ RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axi
|
||||
{
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
|
||||
QwtLogScaleEngine* logScaleEngine = dynamic_cast<QwtLogScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
QwtDateScaleEngine* dateScaleEngine = dynamic_cast<QwtDateScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
if ( logScaleEngine != nullptr )
|
||||
return AxisScaleType::LOGARITHMIC;
|
||||
else if ( dateScaleEngine != nullptr )
|
||||
return AxisScaleType::DATE;
|
||||
auto* logScaleEngine = dynamic_cast<QwtLogScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
auto* dateScaleEngine = dynamic_cast<QwtDateScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
if ( logScaleEngine != nullptr ) return AxisScaleType::LOGARITHMIC;
|
||||
if ( dateScaleEngine != nullptr ) return AxisScaleType::DATE;
|
||||
|
||||
return AxisScaleType::LINEAR;
|
||||
}
|
||||
@ -1299,7 +1300,7 @@ void RiuQwtPlotWidget::pruneAxes( const std::set<RiuPlotAxis>& usedAxes )
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto plotAxis : axesToRemove )
|
||||
for ( const auto& plotAxis : axesToRemove )
|
||||
moveAxis( plotAxis, RiuPlotAxis::defaultLeft() );
|
||||
}
|
||||
|
||||
@ -1388,9 +1389,6 @@ QwtAxisId RiuQwtPlotWidget::toQwtPlotAxis( RiuPlotAxis plotAxis ) const
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
CAF_ASSERT( false );
|
||||
return QwtAxisId( 0, 0 );
|
||||
}
|
||||
|
||||
return { -1, -1 };
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ void RiuSummaryPlot::showContextMenu( QPoint pos )
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicSavePlotTemplateFeature";
|
||||
|
||||
double distanceFromClick = std::numeric_limits<double>::infinity();
|
||||
|
||||
|
@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev")
|
||||
# Must be unique and increasing within one combination of major/minor/patch version
|
||||
# The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT
|
||||
# Format of text must be ".xx"
|
||||
set(RESINSIGHT_DEV_VERSION ".01")
|
||||
set(RESINSIGHT_DEV_VERSION ".02")
|
||||
|
||||
# https://github.com/CRAVA/crava/tree/master/libs/nrlib
|
||||
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")
|
||||
|
Loading…
Reference in New Issue
Block a user