#6293 Make sure stacking is only available for some curv

* Well Log Curves and Summary Curves for now.
This commit is contained in:
Gaute Lindkvist
2020-08-11 09:11:10 +02:00
parent b92c61ac1c
commit af44659860
14 changed files with 200 additions and 108 deletions

View File

@@ -43,14 +43,14 @@ RicStackSelectedCurvesFeature::RicStackSelectedCurvesFeature()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotCurve*>
std::vector<RimStackablePlotCurve*>
RicStackSelectedCurvesFeature::plotCurvesFromSelection( const std::vector<caf::PdmUiItem*>& selectedItems )
{
std::vector<RimPlotCurve*> selectedPlotCurves;
std::vector<RimStackablePlotCurve*> selectedPlotCurves;
for ( caf::PdmUiItem* uiItem : selectedItems )
{
auto plotCurve = dynamic_cast<RimPlotCurve*>( uiItem );
auto plotCurve = dynamic_cast<RimStackablePlotCurve*>( uiItem );
if ( plotCurve )
{
selectedPlotCurves.push_back( plotCurve );
@@ -63,13 +63,13 @@ std::vector<RimPlotCurve*>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotCurve*>
RicStackSelectedCurvesFeature::subsetOfPlotCurvesFromStacking( const std::vector<RimPlotCurve*>& plotCurves,
bool isStacked )
std::vector<RimStackablePlotCurve*>
RicStackSelectedCurvesFeature::subsetOfPlotCurvesFromStacking( const std::vector<RimStackablePlotCurve*>& plotCurves,
bool isStacked )
{
std::vector<RimPlotCurve*> matchingPlotCurves;
std::vector<RimStackablePlotCurve*> matchingPlotCurves;
for ( RimPlotCurve* plotCurve : plotCurves )
for ( RimStackablePlotCurve* plotCurve : plotCurves )
{
if ( plotCurve->isStacked() == isStacked )
{

View File

@@ -19,7 +19,7 @@
#pragma once
#include "RicfCommandObject.h"
#include "RimPlotCurve.h"
#include "RimStackablePlotCurve.h"
#include "cafCmdFeature.h"
#include "cafPdmPtrArrayField.h"
@@ -36,9 +36,9 @@ public:
RicStackSelectedCurvesFeature();
caf::PdmScriptResponse execute() override;
static std::vector<RimPlotCurve*> plotCurvesFromSelection( const std::vector<caf::PdmUiItem*>& selectedItems );
static std::vector<RimPlotCurve*> subsetOfPlotCurvesFromStacking( const std::vector<RimPlotCurve*>& plotCurves,
bool isStacked );
static std::vector<RimStackablePlotCurve*> plotCurvesFromSelection( const std::vector<caf::PdmUiItem*>& selectedItems );
static std::vector<RimStackablePlotCurve*>
subsetOfPlotCurvesFromStacking( const std::vector<RimStackablePlotCurve*>& plotCurves, bool isStacked );
protected:
// Overrides
@@ -47,5 +47,5 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
caf::PdmPtrArrayField<RimPlotCurve*> m_curves;
caf::PdmPtrArrayField<RimStackablePlotCurve*> m_curves;
};

View File

@@ -21,7 +21,7 @@
#include "RicStackSelectedCurvesFeature.h"
#include "RicfCommandObject.h"
#include "RimPlotCurve.h"
#include "RimStackablePlotCurve.h"
#include "cafCmdFeature.h"
#include "cafPdmPtrArrayField.h"
@@ -44,5 +44,5 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
caf::PdmPtrArrayField<RimPlotCurve*> m_curves;
caf::PdmPtrArrayField<RimStackablePlotCurve*> m_curves;
};

View File

@@ -101,6 +101,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultsDefinitionCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimContextCommandBuilder.h
${CMAKE_CURRENT_LIST_DIR}/RimGridCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimStackablePlotCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimBoxIntersection.h
${CMAKE_CURRENT_LIST_DIR}/RimAdvancedSnapshotExportDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RimMdiWindowController.h
@@ -270,6 +271,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultsDefinitionCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimContextCommandBuilder.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimStackablePlotCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimBoxIntersection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAdvancedSnapshotExportDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMdiWindowController.cpp

View File

@@ -126,8 +126,6 @@ RimPlotCurve::RimPlotCurve()
, visibilityChanged( this )
, dataChanged( this )
, nameChanged( this )
, stackingChanged( this )
, stackingColorsChanged( this )
{
CAF_PDM_InitObject( "Curve", ":/WellLogCurve16x16.png", "", "" );
@@ -172,9 +170,6 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position", "", "", "" );
CAF_PDM_InitField( &m_isStacked, "StackCurve", false, "Stack Curve", "", "", "" );
CAF_PDM_InitField( &m_isStackedWithPhaseColors, "StackPhaseColors", false, " with Phase Colors", "", "", "" );
m_qwtPlotCurve = new RiuRimQwtPlotCurve( this );
m_qwtCurveErrorBars = new QwtPlotIntervalCurve();
m_qwtCurveErrorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve );
@@ -264,19 +259,6 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
{
updateCurveAppearance();
}
else if ( changedField == &m_isStacked )
{
if ( !m_isStacked() && m_fillStyle() != Qt::NoBrush )
{
// Switch off area fill when turning off stacking.
m_fillStyle = Qt::NoBrush;
}
stackingChanged.send( m_isStacked() );
}
else if ( changedField == &m_isStackedWithPhaseColors )
{
stackingColorsChanged.send( m_isStackedWithPhaseColors() );
}
RiuPlotMainWindowTools::refreshToolbars();
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
@@ -652,9 +634,6 @@ void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector<time_t>& dat
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_isStacked );
if ( m_isStacked() ) uiOrdering.add( &m_isStackedWithPhaseColors );
uiOrdering.add( &m_curveColor );
uiOrdering.add( &m_pointSymbol );
if ( RiuQwtSymbol::isFilledSymbol( m_pointSymbol() ) )
@@ -699,63 +678,6 @@ void RimPlotCurve::updateUiIconFromPlotSymbol()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::PhaseType RimPlotCurve::phaseType() const
{
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::assignStackColor( size_t index, size_t count )
{
auto allPhaseColors = RiaColorTables::phaseColors();
auto it = allPhaseColors.find( phaseType() );
if ( it != allPhaseColors.end() )
{
caf::ColorTable interpolatedPhaseColors = it->second.interpolated( count );
auto color = interpolatedPhaseColors.cycledColor3f( index );
this->setColor( color );
this->setFillColor( color );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::isStacked() const
{
return m_isStacked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::isStackedWithPhaseColors() const
{
return m_isStackedWithPhaseColors;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setIsStacked( bool stacked )
{
m_isStacked = stacked;
if ( !m_isStacked() && m_fillStyle() != Qt::NoBrush )
{
// Switch off area fill when turning off stacking.
m_fillStyle = Qt::NoBrush;
}
stackingChanged.send( m_isStacked() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -49,8 +49,6 @@ public:
caf::Signal<bool> visibilityChanged;
caf::Signal<> dataChanged;
caf::Signal<QString> nameChanged;
caf::Signal<bool> stackingChanged;
caf::Signal<bool> stackingColorsChanged;
public:
typedef caf::AppEnum<RiuQwtPlotCurve::CurveInterpolationEnum> CurveInterpolation;
@@ -121,12 +119,6 @@ public:
bool isCrossPlotCurve() const;
void updateUiIconFromPlotSymbol();
virtual RiaDefines::PhaseType phaseType() const;
void assignStackColor( size_t index, size_t count );
bool isStacked() const;
bool isStackedWithPhaseColors() const;
void setIsStacked( bool stacked );
protected:
virtual QString createCurveAutoName() = 0;
virtual void updateZoomInParentPlot() = 0;
@@ -196,7 +188,4 @@ protected:
caf::PdmField<CurveInterpolation> m_curveInterpolation;
caf::PdmField<LabelPosition> m_symbolLabelPosition;
caf::PdmField<cvf::Color3f> m_symbolEdgeColor;
caf::PdmField<bool> m_isStacked;
caf::PdmField<bool> m_isStackedWithPhaseColors;
};

View File

@@ -0,0 +1,123 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 "RimStackablePlotCurve.h"
#include "RiaColorTables.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimStackablePlotCurve::RimStackablePlotCurve()
: stackingChanged( this )
, stackingColorsChanged( this )
{
CAF_PDM_InitObject( "StackableCurve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitField( &m_isStacked, "StackCurve", false, "Stack Curve", "", "", "" );
CAF_PDM_InitField( &m_isStackedWithPhaseColors, "StackPhaseColors", false, " with Phase Colors", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::PhaseType RimStackablePlotCurve::phaseType() const
{
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStackablePlotCurve::assignStackColor( size_t index, size_t count )
{
auto allPhaseColors = RiaColorTables::phaseColors();
auto it = allPhaseColors.find( phaseType() );
if ( it != allPhaseColors.end() )
{
caf::ColorTable interpolatedPhaseColors = it->second.interpolated( count );
auto color = interpolatedPhaseColors.cycledColor3f( index );
this->setColor( color );
this->setFillColor( color );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStackablePlotCurve::isStacked() const
{
return m_isStacked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStackablePlotCurve::isStackedWithPhaseColors() const
{
return m_isStackedWithPhaseColors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStackablePlotCurve::setIsStacked( bool stacked )
{
m_isStacked = stacked;
if ( !m_isStacked() && m_fillStyle() != Qt::NoBrush )
{
// Switch off area fill when turning off stacking.
m_fillStyle = Qt::NoBrush;
}
stackingChanged.send( m_isStacked() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStackablePlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimPlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_isStacked )
{
if ( !m_isStacked() && m_fillStyle() != Qt::NoBrush )
{
// Switch off area fill when turning off stacking.
m_fillStyle = Qt::NoBrush;
}
stackingChanged.send( m_isStacked() );
}
else if ( changedField == &m_isStackedWithPhaseColors )
{
stackingColorsChanged.send( m_isStackedWithPhaseColors() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStackablePlotCurve::stackingUiOrdering( caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_isStacked );
if ( m_isStacked() ) uiOrdering.add( &m_isStackedWithPhaseColors );
}

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 "RimPlotCurve.h"
class RimStackablePlotCurve : public RimPlotCurve
{
public:
caf::Signal<bool> stackingChanged;
caf::Signal<bool> stackingColorsChanged;
public:
RimStackablePlotCurve();
virtual RiaDefines::PhaseType phaseType() const;
void assignStackColor( size_t index, size_t count );
bool isStacked() const;
bool isStackedWithPhaseColors() const;
void setIsStacked( bool stacked );
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void stackingUiOrdering( caf::PdmUiOrdering& uiOrdering );
protected:
caf::PdmField<bool> m_isStacked;
caf::PdmField<bool> m_isStackedWithPhaseColors;
};

View File

@@ -21,7 +21,7 @@
#include "RiaDefines.h"
#include "RiaWellLogUnitTools.h"
#include "RimPlotCurve.h"
#include "RimStackablePlotCurve.h"
#include "cafSignal.h"
#include "cvfObject.h"
@@ -32,7 +32,7 @@ class RigWellLogCurveData;
///
///
//==================================================================================================
class RimWellLogCurve : public RimPlotCurve
class RimWellLogCurve : public RimStackablePlotCurve
{
CAF_PDM_HEADER_INIT;

View File

@@ -728,6 +728,9 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm
curveDataGroup->add( &m_timeStep );
}
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );

View File

@@ -262,6 +262,9 @@ void RimWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
curveDataGroup->add( &m_wellLogFile );
curveDataGroup->add( &m_wellLogChannelName );
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );

View File

@@ -565,6 +565,9 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
curveDataGroup->add( &m_wellLogChannelName );
curveDataGroup->add( &m_timeStep );
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );

View File

@@ -711,6 +711,9 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, {false, 1, 0} );
}
caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" );
RimStackablePlotCurve::stackingUiOrdering( *stackingGroup );
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Appearance" );
RimPlotCurve::appearanceUiOrdering( *appearanceGroup );

View File

@@ -26,7 +26,7 @@
#include "RiaDefines.h"
#include "RifEclipseSummaryAddressQMetaType.h"
#include "RimPlotCurve.h"
#include "RimStackablePlotCurve.h"
#include "cafAppEnum.h"
@@ -41,7 +41,7 @@ class RimSummaryAddress;
///
///
//==================================================================================================
class RimSummaryCurve : public RimPlotCurve
class RimSummaryCurve : public RimStackablePlotCurve
{
CAF_PDM_HEADER_INIT;