Janitor : Move defines into separate file

This commit is contained in:
Magne Sjaastad 2021-01-05 14:01:10 +01:00
parent 5b9371c5f3
commit f0b3ab27be
21 changed files with 258 additions and 137 deletions

View File

@ -266,7 +266,7 @@ void RicNewStimPlanModelPlotFeature::createFaciesTrack( RimStimPlanModelPlot* pl
curve->setEclipseResultCategory( faciesDefinition->resultType() );
curve->setEclipseResultVariable( faciesDefinition->resultVariable() );
curve->setColor( colors.cycledColor3f( 0 ) );
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
curve->setLineThickness( 2 );
curve->setAutoNameComponents( false, true, false, false, false );
@ -317,7 +317,7 @@ void RicNewStimPlanModelPlotFeature::createLayersTrack( RimStimPlanModelPlot* pl
curve->setStimPlanModel( stimPlanModel );
curve->setCase( eclipseCase );
curve->setColor( colors.cycledColor3f( 0 ) );
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
curve->setLineThickness( 2 );
curve->setAutoNameComponents( false, true, false, false, false );
@ -372,12 +372,12 @@ void RicNewStimPlanModelPlotFeature::createParametersTrack( RimStimPlanModelPlot
curve->setEclipseResultVariable( resultVariable );
curve->setEclipseResultCategory( resultCategoryType );
curve->setColor( colors.cycledColor3f( colorIndex ) );
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
curve->setLineThickness( 2 );
if ( propertyType == RiaDefines::CurveProperty::STRESS_GRADIENT )
{
curve->setInterpolation( RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT );
curve->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );
}
if ( fixedInitialTimeStep )

View File

@ -194,7 +194,8 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi
CAF_PDM_InitField( &m_curveLineStyle,
"LineStyle",
caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum>( RiuQwtPlotCurve::STYLE_NONE ),
caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum>(
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ),
"Line Style",
"",
"",

View File

@ -59,9 +59,9 @@ public:
bool assumeNumericDataColumns;
RiuQwtPlotCurve::LineStyleEnum curveLineStyle;
RiuQwtSymbol::PointSymbolEnum curveSymbol;
float curveSymbolSkipDistance;
RiuQwtPlotCurveDefines::LineStyleEnum curveLineStyle;
RiuQwtSymbol::PointSymbolEnum curveSymbol;
float curveSymbolSkipDistance;
};
//==================================================================================================
@ -159,9 +159,9 @@ private:
caf::PdmField<CellSeparatorEnum> m_cellSeparator;
caf::PdmField<QString> m_timeSeriesColumnName;
caf::PdmField<caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum>> m_curveLineStyle;
caf::PdmField<caf::AppEnum<RiuQwtSymbol::PointSymbolEnum>> m_curveSymbol;
caf::PdmField<float> m_curveSymbolSkipDistance;
caf::PdmField<caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum>> m_curveLineStyle;
caf::PdmField<caf::AppEnum<RiuQwtSymbol::PointSymbolEnum>> m_curveSymbol;
caf::PdmField<float> m_curveSymbolSkipDistance;
bool m_createNewPlot;
caf::PdmField<QString> m_previewText;

View File

@ -265,10 +265,10 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
paramCurvesTrack->setShowWindow( false );
std::set<RigWbsParameter> parameters = RigWbsParameter::allParameters();
caf::ColorTable colors = RiaColorTables::contrastCategoryPaletteColors();
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = { RiuQwtPlotCurve::STYLE_SOLID,
RiuQwtPlotCurve::STYLE_DASH,
RiuQwtPlotCurve::STYLE_DASH_DOT };
caf::ColorTable colors = RiaColorTables::contrastCategoryPaletteColors();
std::vector<RiuQwtPlotCurveDefines::LineStyleEnum> lineStyles = { RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID,
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH,
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH_DOT };
size_t i = 0;
for ( const RigWbsParameter& param : parameters )
@ -322,8 +322,9 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
cvf::Color3f::DARK_GREEN,
cvf::Color3f::OLIVE };
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles( resultNames.size(), RiuQwtPlotCurve::STYLE_SOLID );
lineStyles.back() = RiuQwtPlotCurve::STYLE_DASH;
std::vector<RiuQwtPlotCurveDefines::LineStyleEnum> lineStyles( resultNames.size(),
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
lineStyles.back() = RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH;
for ( size_t i = 0; i < resultNames.size(); ++i )
{
@ -383,7 +384,8 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
std::vector<cvf::Color3f> colors = { cvf::Color3f::GREEN, cvf::Color3f::DARK_ORANGE };
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = { RiuQwtPlotCurve::STYLE_DASH, RiuQwtPlotCurve::STYLE_SOLID };
std::vector<RiuQwtPlotCurveDefines::LineStyleEnum> lineStyles = { RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH,
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID };
for ( size_t i = 0; i < resultNames.size(); ++i )
{

View File

@ -24,10 +24,6 @@
#include "RiaStatisticsTools.h"
#include "RiaTextStringTools.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuSummaryVectorSelectionDialog.h"
#include "RifSummaryReaderInterface.h"
#include "RimDerivedSummaryCase.h"
@ -42,6 +38,11 @@
#include "RimSummaryCaseCollection.h"
#include "RimSummaryPlotAxisFormatter.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtPlotCurve.h"
#include "RiuSummaryQwtPlot.h"
#include "RiuSummaryVectorSelectionDialog.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiPushButtonEditor.h"

View File

@ -57,6 +57,7 @@
#include "RiuAbstractLegendFrame.h"
#include "RiuAbstractOverlayContentFrame.h"
#include "RiuDraggableOverlayFrame.h"
#include "RiuQwtPlotCurveDefines.h"
#include "RiuQwtPlotWidget.h"
#include "cafPdmUiListEditor.h"
@ -153,8 +154,8 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* curve )
{
applyCurveColor( curve );
RiaRftPltCurveDefinition curveDef = RimWellPlotTools::curveDefFromCurve( curve );
RiuQwtPlotCurve::LineStyleEnum lineStyle = RiuQwtPlotCurve::STYLE_SOLID;
RiaRftPltCurveDefinition curveDef = RimWellPlotTools::curveDefFromCurve( curve );
RiuQwtPlotCurveDefines::LineStyleEnum lineStyle = RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID;
RiuQwtSymbol::PointSymbolEnum currentSymbol = RiuQwtSymbol::SYMBOL_NONE;
if ( curveDef.address().sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT )
@ -165,7 +166,8 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* curve )
bool isObservedData = curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED ||
curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT;
// Observed data
lineStyle = isObservedData ? RiuQwtPlotCurve::STYLE_NONE : RiuQwtPlotCurve::STYLE_SOLID;
lineStyle = isObservedData ? RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE
: RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID;
curve->setSymbol( currentSymbol );
curve->setLineStyle( lineStyle );
@ -522,7 +524,8 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
curveDefToAdd.timeStep(),
RifEclipseRftAddress::PRESSURE );
curve->setRftAddress( address );
curve->setZOrder( RiuQwtPlotCurve::Z_SINGLE_CURVE_OBSERVED );
curve->setZOrder(
RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED ) );
applyCurveAppearance( curve );
}
else if ( m_showEnsembleCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT )
@ -571,7 +574,8 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
curve->setRftAddress( rftAddress );
curve->setObservedFmuRftData(
this->findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) );
curve->setZOrder( RiuQwtPlotCurve::Z_ENSEMBLE_STAT_CURVE );
curve->setZOrder(
RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ) );
applyCurveAppearance( curve );
auto symbol = statisticsCurveSymbolFromAddress( rftAddress );
RiuQwtSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress( rftAddress );
@ -579,7 +583,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
curve->setSymbolLabelPosition( labelPos );
curve->setSymbolSize( curve->symbolSize() + 3 );
curve->setSymbolSkipDistance( 150 );
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
QString uiText =
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( rftAddress.wellLogChannel() );
QString label = uiText.replace( ": Pressure", "" );

View File

@ -15,10 +15,10 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridCrossPlotCurve.h"
#include "RigCaseCellResultCalculator.h"
#include "RiuQwtSymbol.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
@ -26,6 +26,9 @@
#include "RimGridCrossPlot.h"
#include "RimTools.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtSymbol.h"
#include "cafPdmUiComboBoxEditor.h"
#include <QDebug>
@ -49,7 +52,7 @@ RimGridCrossPlotCurve::RimGridCrossPlotCurve()
{
CAF_PDM_InitObject( "Cross Plot Points", ":/WellLogCurve16x16.png", "", "" );
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
setSymbolSize( 4 );
}

View File

@ -1,3 +1,21 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPlot.h"
#include "RicfCommandObject.h"
@ -12,6 +30,8 @@
#include "cafPdmObject.h"
#include "qwt_plot_curve.h"
namespace caf
{
template <>

View File

@ -15,6 +15,7 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaDefines.h"

View File

@ -52,27 +52,6 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotCurve, "PlotCurve" );
namespace caf
{
template <>
void RimPlotCurve::CurveInterpolation::setUp()
{
addItem( RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT, "INTERPOLATION_POINT_TO_POINT", "Point to Point" );
addItem( RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT, "INTERPOLATION_STEP_LEFT", "Step Left" );
setDefault( RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT );
}
template <>
void RimPlotCurve::LineStyle::setUp()
{
addItem( RiuQwtPlotCurve::STYLE_NONE, "STYLE_NONE", "None" );
addItem( RiuQwtPlotCurve::STYLE_SOLID, "STYLE_SOLID", "Solid" );
addItem( RiuQwtPlotCurve::STYLE_DASH, "STYLE_DASH", "Dashes" );
addItem( RiuQwtPlotCurve::STYLE_DOT, "STYLE_DOT", "Dots" );
addItem( RiuQwtPlotCurve::STYLE_DASH_DOT, "STYLE_DASH_DOT", "Dashes and Dots" );
setDefault( RiuQwtPlotCurve::STYLE_SOLID );
}
template <>
void RimPlotCurve::PointSymbol::setUp()
{
@ -175,7 +154,7 @@ RimPlotCurve::RimPlotCurve()
m_qwtCurveErrorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve );
m_qwtCurveErrorBars->setSymbol( new QwtIntervalSymbol( QwtIntervalSymbol::Bar ) );
m_qwtCurveErrorBars->setItemAttribute( QwtPlotItem::Legend, false );
m_qwtCurveErrorBars->setZ( RiuQwtPlotCurve::Z_ERROR_BARS );
m_qwtCurveErrorBars->setZ( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ERROR_BARS ) );
m_parentQwtPlot = nullptr;
}
@ -235,8 +214,10 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
}
else if ( &m_lineStyle == changedField )
{
m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE );
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE );
m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() ==
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() ==
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
}
appearanceChanged.send();
@ -332,8 +313,8 @@ void RimPlotCurve::initAfterRead()
{
m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE );
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE );
m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
checkAndApplyDefaultFillColor();
}
@ -799,7 +780,7 @@ void RimPlotCurve::updateCurveAppearance()
// Make sure the legend lines are long enough to distinguish between line types.
// Standard width in Qwt is 8 which is too short.
// Use 10 and scale this by curve thickness + add space for displaying symbol.
if ( m_lineStyle() != RiuQwtPlotCurve::STYLE_NONE )
if ( m_lineStyle() != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE )
{
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
@ -901,7 +882,7 @@ bool RimPlotCurve::yValueRangeInQwt( double* minimumValue, double* maximumValue
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setLineStyle( RiuQwtPlotCurve::LineStyleEnum lineStyle )
void RimPlotCurve::setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle )
{
m_lineStyle = lineStyle;
}
@ -917,7 +898,7 @@ void RimPlotCurve::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setInterpolation( RiuQwtPlotCurve::CurveInterpolationEnum curveInterpolation )
void RimPlotCurve::setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum curveInterpolation )
{
m_curveInterpolation = curveInterpolation;
}
@ -1002,7 +983,7 @@ void RimPlotCurve::resetAppearance()
setColor( RiaColorTools::textColor3f() );
setSymbolEdgeColor( RiaColorTools::textColor3f() );
setLineThickness( 2 );
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
setSymbolSkipDistance( 10 );
}

View File

@ -22,7 +22,7 @@
#include "RiaCurveDataTools.h"
#include "RiaDefines.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtPlotCurveDefines.h"
#include "RiuQwtSymbol.h"
#include "cafPdmField.h"
@ -35,6 +35,7 @@
class QwtPlot;
class QwtPlotCurve;
class QwtPlotIntervalCurve;
class RiuQwtPlotCurve;
//==================================================================================================
///
@ -51,11 +52,11 @@ public:
caf::Signal<QString> nameChanged;
public:
typedef caf::AppEnum<RiuQwtPlotCurve::CurveInterpolationEnum> CurveInterpolation;
typedef caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum> LineStyle;
typedef caf::AppEnum<RiuQwtSymbol::PointSymbolEnum> PointSymbol;
typedef caf::AppEnum<RiuQwtSymbol::LabelPosition> LabelPosition;
typedef caf::AppEnum<Qt::BrushStyle> FillStyle;
typedef caf::AppEnum<RiuQwtPlotCurveDefines::CurveInterpolationEnum> CurveInterpolation;
typedef caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum> LineStyle;
typedef caf::AppEnum<RiuQwtSymbol::PointSymbolEnum> PointSymbol;
typedef caf::AppEnum<RiuQwtSymbol::LabelPosition> LabelPosition;
typedef caf::AppEnum<Qt::BrushStyle> FillStyle;
public:
RimPlotCurve();
@ -74,9 +75,9 @@ public:
void setColor( const cvf::Color3f& color );
cvf::Color3f color() const { return m_curveColor; }
void setLineStyle( RiuQwtPlotCurve::LineStyleEnum lineStyle );
void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle );
void setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle );
void setInterpolation( RiuQwtPlotCurve::CurveInterpolationEnum );
void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum );
RiuQwtSymbol::PointSymbolEnum symbol();
int symbolSize() const;
cvf::Color3f symbolEdgeColor() const;

View File

@ -142,7 +142,7 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
setSymbol( getSymbolForMeasurementKind( m_measurementKind() ) );
setColor( getColorForMeasurementKind( measurementKind() ) );
setSymbolEdgeColor( getColorForMeasurementKind( measurementKind() ) );
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
RiaDefines::DepthUnitType displayUnit = RiaDefines::DepthUnitType::UNIT_METER;
if ( wellLogPlot )

View File

@ -1756,7 +1756,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
curve->setSymbolLabel( RiaStatisticsTools::replacePercentileByPValueText(
QString::fromStdString( address.ensembleStatisticsQuantityName() ) ) );
}
curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
curve->setSummaryCaseY( m_ensembleStatCase.get() );
curve->setSummaryAddressYAndApplyInterpolation( address );
curve->setLeftOrRightAxisY( m_plotAxis() );

View File

@ -380,7 +380,7 @@ double RimSummaryCurve::yValueAtTimeT( time_t time ) const
}
else if ( i < timeSteps.size() - 1u && timeSteps[i] < time && time < timeSteps[i + 1] )
{
if ( m_curveInterpolation == RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT )
if ( m_curveInterpolation == RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT )
{
return values[i + 1];
}
@ -836,19 +836,19 @@ void RimSummaryCurve::setZIndexFromCurveInfo()
{
if ( sumCase->isObservedData() )
{
zOrder = RiuQwtPlotCurve::Z_SINGLE_CURVE_OBSERVED;
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED );
}
else if ( sumAddr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
{
zOrder = RiuQwtPlotCurve::Z_ENSEMBLE_STAT_CURVE;
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE );
}
else if ( sumCase->ensemble() )
{
zOrder = RiuQwtPlotCurve::Z_ENSEMBLE_CURVE;
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_CURVE );
}
else
{
zOrder = RiuQwtPlotCurve::Z_SINGLE_CURVE_NON_OBSERVED;
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_NON_OBSERVED );
}
}
@ -936,7 +936,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
{
if ( m_yValuesSummaryCase->isObservedData() )
{
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
return;
@ -952,19 +952,19 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
m_symbolEdgeColor = m_curveColor;
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
}
else if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::SummaryHistoryCurveStyleMode::SYMBOLS_AND_LINES )
{
m_symbolEdgeColor = m_curveColor;
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
}
else if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferences::SummaryHistoryCurveStyleMode::LINES )
{
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
}
return;
@ -1037,7 +1037,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( oldVal == nullptr && m_yValuesSummaryCase->isObservedData() )
{
// If no previous case selected and observed data, use symbols to indicate observed data curve
setLineStyle( RiuQwtPlotCurve::STYLE_NONE );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
}
plot->updateCaseNameHasChanged();
@ -1230,11 +1230,11 @@ void RimSummaryCurve::calculateCurveInterpolationFromAddress()
auto address = m_yValuesSummaryAddress()->address();
if ( RiaSummaryTools::hasAccumulatedData( address ) )
{
m_curveInterpolation = RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT;
m_curveInterpolation = RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT;
}
else
{
m_curveInterpolation = RiuQwtPlotCurve::INTERPOLATION_STEP_LEFT;
m_curveInterpolation = RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT;
}
}
}

View File

@ -250,8 +250,9 @@ std::map<std::string, size_t>
}
else if ( appearance == CurveAppearanceType::LINE_STYLE )
{
numOptions = caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum>::size() - 1; // -1 since the No symbol option is not
// counted see cycledLineStyle()
numOptions = caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum>::size() - 1; // -1 since the No symbol option
// is not counted see
// cycledLineStyle()
}
else
{
@ -512,12 +513,12 @@ cvf::Color3f RimSummaryCurveAppearanceCalculator::cycledBrownColor( int colorInd
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotCurve::LineStyleEnum RimSummaryCurveAppearanceCalculator::cycledLineStyle( int index )
RiuQwtPlotCurveDefines::LineStyleEnum RimSummaryCurveAppearanceCalculator::cycledLineStyle( int index )
{
if ( index < 0 ) return RiuQwtPlotCurve::STYLE_SOLID;
if ( index < 0 ) return RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID;
return caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum>::fromIndex(
1 + ( index % ( caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum>::size() - 1 ) ) );
return caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum>::fromIndex(
1 + ( index % ( caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum>::size() - 1 ) ) );
}
//--------------------------------------------------------------------------------------------------

View File

@ -17,10 +17,12 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimPlotCurve.h"
#include "RiuQwtPlotCurveDefines.h"
#include "RiuQwtSymbol.h"
#include "cvfColor3.h"
#include <map>
#include <set>
class RimSummaryCurve;
@ -64,16 +66,14 @@ public:
static RiuQwtSymbol::PointSymbolEnum cycledSymbol( int index );
private:
template <typename S>
int findMaxApperanceIndexInMap( const std::map<S, int>& mapToSearch ) const;
void setOneCurveAppearance( CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve );
void updateApperanceIndices();
std::map<std::string, size_t> mapNameToAppearanceIndex( CurveAppearanceType& appearance,
const std::set<std::string>& names );
RiuQwtPlotCurve::LineStyleEnum cycledLineStyle( int index );
int cycledLineThickness( int index );
float gradient( size_t totalCount, int index );
RiuQwtPlotCurveDefines::LineStyleEnum cycledLineStyle( int index );
int cycledLineThickness( int index );
float gradient( size_t totalCount, int index );
cvf::Color3f gradeColor( const cvf::Color3f& color, float factor );

View File

@ -8,6 +8,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuGeoQuestNavigation.h
${CMAKE_CURRENT_LIST_DIR}/RiuInterfaceToViewWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtSymbol.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurve.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurveDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiuRimQwtPlotCurve.h
${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindow.h
${CMAKE_CURRENT_LIST_DIR}/RiuMainWindow.h
@ -105,6 +106,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuGeoQuestNavigation.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuInterfaceToViewWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtSymbol.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurveDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuRimQwtPlotCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuMainWindow.cpp

View File

@ -262,27 +262,27 @@ void RiuQwtPlotCurve::setPerPointLabels( const std::vector<QString>& labels )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotCurve::setAppearance( LineStyleEnum lineStyle,
CurveInterpolationEnum interpolationType,
int requestedCurveThickness,
const QColor& curveColor,
const QBrush& fillBrush /* = QBrush( Qt::NoBrush )*/ )
void RiuQwtPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle,
RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType,
int requestedCurveThickness,
const QColor& curveColor,
const QBrush& fillBrush /* = QBrush( Qt::NoBrush )*/ )
{
QwtPlotCurve::CurveStyle curveStyle = QwtPlotCurve::NoCurve;
Qt::PenStyle penStyle = Qt::NoPen;
// Qwt bug workaround (#4135): need to set 0 curve thickness for STYLE_NONE
int curveThickness = 0;
if ( lineStyle != STYLE_NONE )
if ( lineStyle != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE )
{
curveThickness = requestedCurveThickness;
switch ( interpolationType )
{
case INTERPOLATION_STEP_LEFT:
case RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT:
curveStyle = QwtPlotCurve::Steps;
setCurveAttribute( QwtPlotCurve::Inverted, false );
break;
case INTERPOLATION_POINT_TO_POINT: // Fall through
case RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT: // Fall through
default:
curveStyle = QwtPlotCurve::Lines;
break;
@ -290,16 +290,16 @@ void RiuQwtPlotCurve::setAppearance( LineStyleEnum lineStyle,
switch ( lineStyle )
{
case STYLE_SOLID:
case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID:
penStyle = Qt::SolidLine;
break;
case STYLE_DASH:
case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH:
penStyle = Qt::DashLine;
break;
case STYLE_DOT:
case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DOT:
penStyle = Qt::DotLine;
break;
case STYLE_DASH_DOT:
case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH_DOT:
penStyle = Qt::DashDotLine;
break;

View File

@ -19,6 +19,8 @@
#pragma once
#include "RiuQwtPlotCurveDefines.h"
#include "qwt_plot_curve.h"
#include "qwt_plot_intervalcurve.h"
#include "qwt_symbol.h"
@ -46,32 +48,6 @@
//==================================================================================================
class RiuQwtPlotCurve : public QwtPlotCurve
{
public:
enum CurveInterpolationEnum
{
INTERPOLATION_POINT_TO_POINT,
INTERPOLATION_STEP_LEFT,
};
enum LineStyleEnum
{
STYLE_NONE,
STYLE_SOLID,
STYLE_DASH,
STYLE_DOT,
STYLE_DASH_DOT
};
// Z index. Higher Z is painted in front
enum ZIndex
{
Z_ENSEMBLE_CURVE = 100,
Z_ENSEMBLE_STAT_CURVE = 200,
Z_SINGLE_CURVE_NON_OBSERVED = 300,
Z_ERROR_BARS = 400,
Z_SINGLE_CURVE_OBSERVED = 500
};
public:
explicit RiuQwtPlotCurve( const QString& title = QString() );
~RiuQwtPlotCurve() override;
@ -93,11 +69,11 @@ public:
void setSymbolSkipPixelDistance( float distance );
void setPerPointLabels( const std::vector<QString>& labels );
void setAppearance( LineStyleEnum lineStyle,
CurveInterpolationEnum interpolationType,
int curveThickness,
const QColor& curveColor,
const QBrush& fillBrush = QBrush( Qt::NoBrush ) );
void setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle,
RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType,
int curveThickness,
const QColor& curveColor,
const QBrush& fillBrush = QBrush( Qt::NoBrush ) );
void setBlackAndWhiteLegendIcon( bool blackAndWhite );
QwtGraphic legendIcon( int index, const QSizeF& size ) const override;

View File

@ -0,0 +1,77 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RiuQwtPlotCurveDefines.h"
#include "cafAppEnum.h"
namespace caf
{
template <>
void caf::AppEnum<RiuQwtPlotCurveDefines::CurveInterpolationEnum>::setUp()
{
addItem( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT,
"INTERPOLATION_POINT_TO_POINT",
"Point to Point" );
addItem( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT, "INTERPOLATION_STEP_LEFT", "Step Left" );
setDefault( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT );
}
template <>
void caf::AppEnum<RiuQwtPlotCurveDefines::LineStyleEnum>::setUp()
{
addItem( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE, "STYLE_NONE", "None" );
addItem( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID, "STYLE_SOLID", "Solid" );
addItem( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH, "STYLE_DASH", "Dashes" );
addItem( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DOT, "STYLE_DOT", "Dots" );
addItem( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH_DOT, "STYLE_DASH_DOT", "Dashes and Dots" );
setDefault( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuQwtPlotCurveDefines::zDepthForIndex( ZIndex index )
{
switch ( index )
{
case RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_CURVE:
return 100;
break;
case RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE:
return 200;
break;
case RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_NON_OBSERVED:
return 300;
break;
case RiuQwtPlotCurveDefines::ZIndex::Z_ERROR_BARS:
return 400;
break;
case RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED:
return 500;
break;
default:
break;
}
return 0;
}

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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
namespace RiuQwtPlotCurveDefines
{
enum class CurveInterpolationEnum
{
INTERPOLATION_POINT_TO_POINT,
INTERPOLATION_STEP_LEFT,
};
enum class LineStyleEnum
{
STYLE_NONE,
STYLE_SOLID,
STYLE_DASH,
STYLE_DOT,
STYLE_DASH_DOT
};
// Z index. Higher Z is painted in front
enum class ZIndex
{
Z_ENSEMBLE_CURVE,
Z_ENSEMBLE_STAT_CURVE,
Z_SINGLE_CURVE_NON_OBSERVED,
Z_ERROR_BARS,
Z_SINGLE_CURVE_OBSERVED
};
int zDepthForIndex( ZIndex index );
}; // namespace RiuQwtPlotCurveDefines