mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7805 Convert RimPlotCurve to use RimPlotCurveAppearance configuration.
This commit is contained in:
parent
ea3fdef281
commit
dfa378fb85
@ -67,7 +67,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimContextCommandBuilder.h
|
${CMAKE_CURRENT_LIST_DIR}/RimContextCommandBuilder.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimGridCollection.h
|
${CMAKE_CURRENT_LIST_DIR}/RimGridCollection.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurve.h
|
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurve.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurveCurve.h
|
${CMAKE_CURRENT_LIST_DIR}/RimPlotCurveAppearance.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimStackablePlotCurve.h
|
${CMAKE_CURRENT_LIST_DIR}/RimStackablePlotCurve.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimBoxIntersection.h
|
${CMAKE_CURRENT_LIST_DIR}/RimBoxIntersection.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimAdvancedSnapshotExportDefinition.h
|
${CMAKE_CURRENT_LIST_DIR}/RimAdvancedSnapshotExportDefinition.h
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "RiuQwtPlotCurve.h"
|
#include "RiuQwtPlotCurve.h"
|
||||||
|
|
||||||
|
#include "RiaColorTools.h"
|
||||||
|
|
||||||
#include "qwt_plot.h"
|
#include "qwt_plot.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -201,10 +203,9 @@ void RimWellFlowRateCurve::updateCurveAppearance()
|
|||||||
if ( m_doFillCurve || isLastCurveInGroup ) // Fill the last curve in group with a transparent color to "tie" the
|
if ( m_doFillCurve || isLastCurveInGroup ) // Fill the last curve in group with a transparent color to "tie" the
|
||||||
// group together
|
// group together
|
||||||
{
|
{
|
||||||
QColor curveQColor =
|
QColor curveQColor = RiaColorTools::toQColor( m_curveAppearance->color() );
|
||||||
QColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
QColor fillColor = curveQColor;
|
||||||
QColor fillColor = curveQColor;
|
QColor lineColor = curveQColor.darker();
|
||||||
QColor lineColor = curveQColor.darker();
|
|
||||||
|
|
||||||
if ( !m_doFillCurve && isLastCurveInGroup )
|
if ( !m_doFillCurve && isLastCurveInGroup )
|
||||||
{
|
{
|
||||||
@ -239,8 +240,6 @@ void RimWellFlowRateCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd
|
|||||||
{
|
{
|
||||||
uiOrdering.add( &m_curveName );
|
uiOrdering.add( &m_curveName );
|
||||||
m_curveName.uiCapability()->setUiReadOnly( true );
|
m_curveName.uiCapability()->setUiReadOnly( true );
|
||||||
uiOrdering.add( &m_curveColor );
|
|
||||||
m_curveColor.uiCapability()->setUiReadOnly( true );
|
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields();
|
uiOrdering.skipRemainingFields();
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimEnsembleCurveSetCollection.h"
|
#include "RimEnsembleCurveSetCollection.h"
|
||||||
#include "RimNameConfig.h"
|
#include "RimNameConfig.h"
|
||||||
|
#include "RimProject.h"
|
||||||
#include "RimSummaryCrossPlot.h"
|
#include "RimSummaryCrossPlot.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimSummaryCurveCollection.h"
|
#include "RimSummaryCurveCollection.h"
|
||||||
@ -72,35 +73,64 @@ RimPlotCurve::RimPlotCurve()
|
|||||||
m_legendEntryText.uiCapability()->setUiHidden( true );
|
m_legendEntryText.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" );
|
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" );
|
||||||
|
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "" );
|
||||||
|
CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_curveColor, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
|
// Obsolete field: appearance configuration is moved to RimPlotCurveAppearance
|
||||||
CAF_PDM_InitField( &m_fillColor, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color", "", "", "" );
|
CAF_PDM_InitField( &m_curveColor_OBSOLETE, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" );
|
||||||
|
m_curveColor_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_curveThickness, "Thickness", 1, "Line Thickness", "", "", "" );
|
CAF_PDM_InitField( &m_fillColor_OBSOLETE, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color", "", "", "" );
|
||||||
m_curveThickness.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
m_fillColor_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_curveInterpolation, "CurveInterpolation", "Interpolation", "", "", "" );
|
CAF_PDM_InitField( &m_curveThickness_OBSOLETE, "Thickness", 1, "Line Thickness", "", "", "" );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_lineStyle, "LineStyle", "Line Style", "", "", "" );
|
m_curveThickness_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_fillStyle, "FillStyle", "Area Fill Style", "", "", "" );
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_pointSymbol, "PointSymbol", "Symbol", "", "", "" );
|
|
||||||
CAF_PDM_InitField( &m_symbolEdgeColor, "SymbolEdgeColor", RiaColorTools::textColor3f(), "Symbol Edge Color", "", "", "" );
|
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_symbolSkipPixelDistance,
|
CAF_PDM_InitFieldNoDefault( &m_curveInterpolation_OBSOLETE, "CurveInterpolation", "Interpolation", "", "", "" );
|
||||||
|
m_curveInterpolation_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_lineStyle_OBSOLETE, "LineStyle", "Line Style", "", "", "" );
|
||||||
|
m_lineStyle_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_fillStyle_OBSOLETE, "FillStyle", "Area Fill Style", "", "", "" );
|
||||||
|
m_fillStyle_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_pointSymbol_OBSOLETE, "PointSymbol", "Symbol", "", "", "" );
|
||||||
|
m_pointSymbol_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitField( &m_symbolEdgeColor_OBSOLETE,
|
||||||
|
"SymbolEdgeColor",
|
||||||
|
RiaColorTools::textColor3f(),
|
||||||
|
"Symbol Edge Color",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"" );
|
||||||
|
m_symbolEdgeColor_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
|
CAF_PDM_InitField( &m_symbolSkipPixelDistance_OBSOLETE,
|
||||||
"SymbolSkipPxDist",
|
"SymbolSkipPxDist",
|
||||||
0.0f,
|
0.0f,
|
||||||
"Symbol Skip Distance",
|
"Symbol Skip Distance",
|
||||||
"",
|
"",
|
||||||
"Minimum pixel distance between symbols",
|
"Minimum pixel distance between symbols",
|
||||||
"" );
|
"" );
|
||||||
|
m_symbolSkipPixelDistance_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_symbolLabel_OBSOLETE, "SymbolLabel", "Symbol Label", "", "", "" );
|
||||||
|
m_symbolLabel_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_symbolLabel, "SymbolLabel", "Symbol Label", "", "", "" );
|
CAF_PDM_InitField( &m_symbolSize_OBSOLETE, "SymbolSize", 6, "Symbol Size", "", "", "" );
|
||||||
CAF_PDM_InitField( &m_symbolSize, "SymbolSize", 6, "Symbol Size", "", "", "" );
|
m_symbolSize_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition_OBSOLETE, "SymbolLabelPosition", "Symbol Label Position", "", "", "" );
|
||||||
|
m_symbolLabelPosition_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_curveAppearance, "PlotCurveAppearance", "PlotCurveAppearance", "", "", "" );
|
||||||
|
m_curveAppearance = new RimPlotCurveAppearance;
|
||||||
|
m_curveAppearance.uiCapability()->setUiTreeHidden( true );
|
||||||
|
m_curveAppearance.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
|
m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onCurveAppearanceChanged );
|
||||||
|
m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onFillColorChanged );
|
||||||
|
|
||||||
m_qwtPlotCurve = new RiuRimQwtPlotCurve( this );
|
m_qwtPlotCurve = new RiuRimQwtPlotCurve( this );
|
||||||
m_qwtCurveErrorBars = new QwtPlotIntervalCurve();
|
m_qwtCurveErrorBars = new QwtPlotIntervalCurve();
|
||||||
@ -148,33 +178,6 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
|
|||||||
m_customCurveName = m_curveName;
|
m_customCurveName = m_curveName;
|
||||||
updateCurveNameAndUpdatePlotLegendAndTitle();
|
updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||||
}
|
}
|
||||||
else if ( &m_curveColor == changedField || &m_curveThickness == changedField || &m_pointSymbol == changedField ||
|
|
||||||
&m_lineStyle == changedField || &m_symbolSkipPixelDistance == changedField ||
|
|
||||||
&m_curveInterpolation == changedField || &m_symbolSize == changedField ||
|
|
||||||
&m_symbolEdgeColor == changedField || &m_fillStyle == changedField || &m_fillColor == changedField )
|
|
||||||
{
|
|
||||||
if ( &m_fillStyle == changedField )
|
|
||||||
{
|
|
||||||
checkAndApplyDefaultFillColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCurveAppearance();
|
|
||||||
|
|
||||||
if ( &m_pointSymbol == changedField )
|
|
||||||
{
|
|
||||||
m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
|
|
||||||
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
|
|
||||||
}
|
|
||||||
else if ( &m_lineStyle == changedField )
|
|
||||||
{
|
|
||||||
m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() ==
|
|
||||||
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
|
||||||
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() ==
|
|
||||||
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
|
||||||
}
|
|
||||||
|
|
||||||
appearanceChanged.send();
|
|
||||||
}
|
|
||||||
else if ( changedField == &m_isUsingAutoName )
|
else if ( changedField == &m_isUsingAutoName )
|
||||||
{
|
{
|
||||||
if ( !m_isUsingAutoName )
|
if ( !m_isUsingAutoName )
|
||||||
@ -264,12 +267,22 @@ void RimPlotCurve::updateCurveVisibility()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::initAfterRead()
|
void RimPlotCurve::initAfterRead()
|
||||||
{
|
{
|
||||||
m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
|
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2024.10.1" ) )
|
||||||
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
|
{
|
||||||
m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
// Forward values of obsolete fields to appearance object
|
||||||
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
m_curveAppearance->setSymbolSize( m_symbolSize_OBSOLETE );
|
||||||
|
m_curveAppearance->setSymbolLabel( m_symbolLabel_OBSOLETE );
|
||||||
checkAndApplyDefaultFillColor();
|
m_curveAppearance->setColor( m_curveColor_OBSOLETE );
|
||||||
|
m_curveAppearance->setLineThickness( m_curveThickness_OBSOLETE );
|
||||||
|
m_curveAppearance->setSymbolSkipDistance( m_symbolSkipPixelDistance_OBSOLETE );
|
||||||
|
m_curveAppearance->setSymbol( m_pointSymbol_OBSOLETE() );
|
||||||
|
m_curveAppearance->setLineStyle( m_lineStyle_OBSOLETE() );
|
||||||
|
m_curveAppearance->setFillStyle( m_fillStyle_OBSOLETE() );
|
||||||
|
m_curveAppearance->setFillColor( m_fillColor_OBSOLETE );
|
||||||
|
m_curveAppearance->setInterpolation( m_curveInterpolation_OBSOLETE() );
|
||||||
|
m_curveAppearance->setSymbolLabelPosition( m_symbolLabelPosition_OBSOLETE() );
|
||||||
|
m_curveAppearance->setSymbolEdgeColor( m_symbolEdgeColor_OBSOLETE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -336,8 +349,16 @@ caf::PdmFieldHandle* RimPlotCurve::userDescriptionField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setColor( const cvf::Color3f& color )
|
void RimPlotCurve::setColor( const cvf::Color3f& color )
|
||||||
{
|
{
|
||||||
m_curveColor = color;
|
m_curveAppearance->setColor( color );
|
||||||
m_fillColor = color;
|
m_curveAppearance->setFillColor( color );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Color3f RimPlotCurve::color() const
|
||||||
|
{
|
||||||
|
return m_curveAppearance->color();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -576,22 +597,8 @@ void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector<time_t>& dat
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
void RimPlotCurve::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_curveColor );
|
QString configName = "AppearanceOrdering";
|
||||||
uiOrdering.add( &m_pointSymbol );
|
m_curveAppearance->uiOrdering( configName, uiOrdering );
|
||||||
if ( RiuQwtSymbol::isFilledSymbol( m_pointSymbol() ) )
|
|
||||||
{
|
|
||||||
uiOrdering.add( &m_symbolEdgeColor );
|
|
||||||
}
|
|
||||||
uiOrdering.add( &m_symbolSize );
|
|
||||||
uiOrdering.add( &m_symbolSkipPixelDistance );
|
|
||||||
uiOrdering.add( &m_lineStyle );
|
|
||||||
uiOrdering.add( &m_fillStyle );
|
|
||||||
if ( m_fillStyle != Qt::BrushStyle::NoBrush )
|
|
||||||
{
|
|
||||||
uiOrdering.add( &m_fillColor );
|
|
||||||
}
|
|
||||||
uiOrdering.add( &m_curveThickness );
|
|
||||||
uiOrdering.add( &m_curveInterpolation );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -608,11 +615,9 @@ void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::updateUiIconFromPlotSymbol()
|
void RimPlotCurve::updateUiIconFromPlotSymbol()
|
||||||
{
|
{
|
||||||
if ( m_pointSymbol() != RiuQwtSymbol::NoSymbol && m_qwtPlotCurve )
|
if ( m_curveAppearance->symbol() != RiuQwtSymbol::SYMBOL_NONE && m_qwtPlotCurve )
|
||||||
{
|
{
|
||||||
CVF_ASSERT( RiaGuiApplication::isRunning() );
|
CVF_ASSERT( RiaGuiApplication::isRunning() );
|
||||||
QColor curveColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
|
||||||
|
|
||||||
QSizeF iconSize( 24, 24 );
|
QSizeF iconSize( 24, 24 );
|
||||||
QwtGraphic graphic = m_qwtPlotCurve->legendIcon( 0, iconSize );
|
QwtGraphic graphic = m_qwtPlotCurve->legendIcon( 0, iconSize );
|
||||||
QPixmap pixmap = graphic.toPixmap();
|
QPixmap pixmap = graphic.toPixmap();
|
||||||
@ -668,10 +673,10 @@ void RimPlotCurve::attachCurveAndErrorBars()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::checkAndApplyDefaultFillColor()
|
void RimPlotCurve::checkAndApplyDefaultFillColor()
|
||||||
{
|
{
|
||||||
if ( !m_fillColor().isValid() )
|
// if ( m_curveAppearance->fillColor().isValid() )
|
||||||
{
|
// {
|
||||||
m_fillColor = m_curveColor;
|
// m_curveAppearance->fillColor() = m_curveAppearance->color();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -679,10 +684,10 @@ void RimPlotCurve::checkAndApplyDefaultFillColor()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::updateCurveAppearance()
|
void RimPlotCurve::updateCurveAppearance()
|
||||||
{
|
{
|
||||||
QColor curveColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
QColor curveColor = RiaColorTools::toQColor( m_curveAppearance->color() );
|
||||||
QwtSymbol* symbol = nullptr;
|
QwtSymbol* symbol = nullptr;
|
||||||
|
|
||||||
if ( m_pointSymbol() != RiuQwtSymbol::SYMBOL_NONE )
|
if ( m_curveAppearance->symbol() != RiuQwtSymbol::SYMBOL_NONE )
|
||||||
{
|
{
|
||||||
int legendFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(),
|
int legendFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(),
|
||||||
caf::FontTools::RelativeSize::Small );
|
caf::FontTools::RelativeSize::Small );
|
||||||
@ -694,18 +699,18 @@ void RimPlotCurve::updateCurveAppearance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// QwtPlotCurve will take ownership of the symbol
|
// QwtPlotCurve will take ownership of the symbol
|
||||||
symbol = new RiuQwtSymbol( m_pointSymbol(), m_symbolLabel(), m_symbolLabelPosition(), legendFontSize );
|
symbol = new RiuQwtSymbol( m_curveAppearance->symbol(),
|
||||||
symbol->setSize( m_symbolSize, m_symbolSize );
|
m_curveAppearance->symbolLabel(),
|
||||||
|
m_curveAppearance->symbolLabelPosition(),
|
||||||
|
legendFontSize );
|
||||||
|
symbol->setSize( m_curveAppearance->symbolSize(), m_curveAppearance->symbolSize() );
|
||||||
symbol->setColor( curveColor );
|
symbol->setColor( curveColor );
|
||||||
|
|
||||||
// If the symbol is a "filled" symbol, we can have a different edge color
|
// If the symbol is a "filled" symbol, we can have a different edge color
|
||||||
// Otherwise we'll have to use the curve color.
|
// Otherwise we'll have to use the curve color.
|
||||||
if ( RiuQwtSymbol::isFilledSymbol( m_pointSymbol() ) )
|
if ( RiuQwtSymbol::isFilledSymbol( m_curveAppearance->symbol() ) )
|
||||||
{
|
{
|
||||||
QColor symbolEdgeColor( m_symbolEdgeColor.value().rByte(),
|
QColor symbolEdgeColor = RiaColorTools::toQColor( m_curveAppearance->symbolEdgeColor() );
|
||||||
m_symbolEdgeColor.value().gByte(),
|
|
||||||
m_symbolEdgeColor.value().bByte() );
|
|
||||||
|
|
||||||
symbol->setPen( symbolEdgeColor );
|
symbol->setPen( symbolEdgeColor );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -723,17 +728,22 @@ void RimPlotCurve::updateCurveAppearance()
|
|||||||
|
|
||||||
if ( m_qwtPlotCurve )
|
if ( m_qwtPlotCurve )
|
||||||
{
|
{
|
||||||
QColor fillColor( m_fillColor.value().rByte(), m_fillColor.value().gByte(), m_fillColor.value().bByte() );
|
QColor fillColor = RiaColorTools::toQColor( m_curveAppearance->fillColor() );
|
||||||
|
|
||||||
fillColor = RiaColorTools::blendQColors( fillColor, QColor( Qt::white ), 3, 1 );
|
fillColor = RiaColorTools::blendQColors( fillColor, QColor( Qt::white ), 3, 1 );
|
||||||
QBrush fillBrush( fillColor, m_fillStyle() );
|
QBrush fillBrush( fillColor, m_curveAppearance->fillStyle() );
|
||||||
m_qwtPlotCurve->setAppearance( m_lineStyle(), m_curveInterpolation(), m_curveThickness(), curveColor, fillBrush );
|
m_qwtPlotCurve->setAppearance( m_curveAppearance->lineStyle(),
|
||||||
|
m_curveAppearance->interpolation(),
|
||||||
|
m_curveAppearance->lineThickness(),
|
||||||
|
curveColor,
|
||||||
|
fillBrush );
|
||||||
m_qwtPlotCurve->setSymbol( symbol );
|
m_qwtPlotCurve->setSymbol( symbol );
|
||||||
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_symbolSkipPixelDistance() );
|
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_curveAppearance->symbolSkipDistance() );
|
||||||
|
|
||||||
// Make sure the legend lines are long enough to distinguish between line types.
|
// Make sure the legend lines are long enough to distinguish between line types.
|
||||||
// Standard width in Qwt is 8 which is too short.
|
// Standard width in Qwt is 8 which is too short.
|
||||||
// Use 10 and scale this by curve thickness + add space for displaying symbol.
|
// Use 10 and scale this by curve thickness + add space for displaying symbol.
|
||||||
if ( m_lineStyle() != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE )
|
if ( m_curveAppearance->lineStyle() != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE )
|
||||||
{
|
{
|
||||||
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||||
|
|
||||||
@ -743,7 +753,7 @@ void RimPlotCurve::updateCurveAppearance()
|
|||||||
symbolWidth = symbol->boundingRect().size().width() + 2;
|
symbolWidth = symbol->boundingRect().size().width() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = std::max( 10 * m_curveThickness, ( symbolWidth * 3 ) / 2 );
|
int width = std::max( 10 * m_curveAppearance->lineThickness(), ( symbolWidth * 3 ) / 2 );
|
||||||
|
|
||||||
legendIconSize.setWidth( width );
|
legendIconSize.setWidth( width );
|
||||||
m_qwtPlotCurve->setLegendIconSize( legendIconSize );
|
m_qwtPlotCurve->setLegendIconSize( legendIconSize );
|
||||||
@ -763,25 +773,6 @@ bool RimPlotCurve::isCrossPlotCurve() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
||||||
bool* useOptionsOnly )
|
|
||||||
{
|
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
|
||||||
|
|
||||||
if ( fieldNeedingOptions == &m_curveThickness )
|
|
||||||
{
|
|
||||||
for ( size_t i = 0; i < 10; i++ )
|
|
||||||
{
|
|
||||||
options.push_back( caf::PdmOptionItemInfo( QString::number( i + 1 ), QVariant::fromValue( i + 1 ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -837,7 +828,7 @@ bool RimPlotCurve::yValueRangeInQwt( double* minimumValue, double* maximumValue
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle )
|
void RimPlotCurve::setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle )
|
||||||
{
|
{
|
||||||
m_lineStyle = lineStyle;
|
m_curveAppearance->setLineStyle( lineStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -845,7 +836,7 @@ void RimPlotCurve::setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle )
|
void RimPlotCurve::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle )
|
||||||
{
|
{
|
||||||
m_pointSymbol = symbolStyle;
|
m_curveAppearance->setSymbol( symbolStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -853,7 +844,7 @@ void RimPlotCurve::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum curveInterpolation )
|
void RimPlotCurve::setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum curveInterpolation )
|
||||||
{
|
{
|
||||||
m_curveInterpolation = curveInterpolation;
|
m_curveAppearance->setInterpolation( curveInterpolation );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -861,7 +852,7 @@ void RimPlotCurve::setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationE
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuQwtSymbol::PointSymbolEnum RimPlotCurve::symbol()
|
RiuQwtSymbol::PointSymbolEnum RimPlotCurve::symbol()
|
||||||
{
|
{
|
||||||
return m_pointSymbol();
|
return m_curveAppearance->symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -869,7 +860,7 @@ RiuQwtSymbol::PointSymbolEnum RimPlotCurve::symbol()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RimPlotCurve::symbolSize() const
|
int RimPlotCurve::symbolSize() const
|
||||||
{
|
{
|
||||||
return m_symbolSize();
|
return m_curveAppearance->symbolSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -877,7 +868,7 @@ int RimPlotCurve::symbolSize() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::Color3f RimPlotCurve::symbolEdgeColor() const
|
cvf::Color3f RimPlotCurve::symbolEdgeColor() const
|
||||||
{
|
{
|
||||||
return m_symbolEdgeColor;
|
return m_curveAppearance->symbolEdgeColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -885,7 +876,7 @@ cvf::Color3f RimPlotCurve::symbolEdgeColor() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setSymbolEdgeColor( const cvf::Color3f& edgeColor )
|
void RimPlotCurve::setSymbolEdgeColor( const cvf::Color3f& edgeColor )
|
||||||
{
|
{
|
||||||
m_symbolEdgeColor = edgeColor;
|
m_curveAppearance->setSymbolEdgeColor( edgeColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -893,7 +884,7 @@ void RimPlotCurve::setSymbolEdgeColor( const cvf::Color3f& edgeColor )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setSymbolSkipDistance( float distance )
|
void RimPlotCurve::setSymbolSkipDistance( float distance )
|
||||||
{
|
{
|
||||||
m_symbolSkipPixelDistance = distance;
|
m_curveAppearance->setSymbolSkipDistance( distance );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -901,7 +892,7 @@ void RimPlotCurve::setSymbolSkipDistance( float distance )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setSymbolLabel( const QString& label )
|
void RimPlotCurve::setSymbolLabel( const QString& label )
|
||||||
{
|
{
|
||||||
m_symbolLabel = label;
|
m_curveAppearance->setSymbolLabel( label );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -909,7 +900,7 @@ void RimPlotCurve::setSymbolLabel( const QString& label )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition )
|
void RimPlotCurve::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition )
|
||||||
{
|
{
|
||||||
m_symbolLabelPosition = labelPosition;
|
m_curveAppearance->setSymbolLabelPosition( labelPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -917,7 +908,7 @@ void RimPlotCurve::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosi
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setSymbolSize( int sizeInPixels )
|
void RimPlotCurve::setSymbolSize( int sizeInPixels )
|
||||||
{
|
{
|
||||||
m_symbolSize = sizeInPixels;
|
m_curveAppearance->setSymbolSize( sizeInPixels );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -925,7 +916,7 @@ void RimPlotCurve::setSymbolSize( int sizeInPixels )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setLineThickness( int thickness )
|
void RimPlotCurve::setLineThickness( int thickness )
|
||||||
{
|
{
|
||||||
m_curveThickness = thickness;
|
m_curveAppearance->setLineThickness( thickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -946,7 +937,7 @@ void RimPlotCurve::resetAppearance()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
Qt::BrushStyle RimPlotCurve::fillStyle() const
|
Qt::BrushStyle RimPlotCurve::fillStyle() const
|
||||||
{
|
{
|
||||||
return m_fillStyle();
|
return m_curveAppearance->fillStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -954,7 +945,7 @@ Qt::BrushStyle RimPlotCurve::fillStyle() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setFillStyle( Qt::BrushStyle brushStyle )
|
void RimPlotCurve::setFillStyle( Qt::BrushStyle brushStyle )
|
||||||
{
|
{
|
||||||
m_fillStyle = brushStyle;
|
m_curveAppearance->setFillStyle( brushStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -962,7 +953,7 @@ void RimPlotCurve::setFillStyle( Qt::BrushStyle brushStyle )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurve::setFillColor( const cvf::Color3f& fillColor )
|
void RimPlotCurve::setFillColor( const cvf::Color3f& fillColor )
|
||||||
{
|
{
|
||||||
m_fillColor = fillColor;
|
m_curveAppearance->setFillColor( fillColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1050,3 +1041,20 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
|
|||||||
}
|
}
|
||||||
m_qwtPlotCurve->setItemAttribute( QwtPlotItem::Legend, showLegendInQwt );
|
m_qwtPlotCurve->setItemAttribute( QwtPlotItem::Legend, showLegendInQwt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::onCurveAppearanceChanged( const caf::SignalEmitter* emitter )
|
||||||
|
{
|
||||||
|
checkAndApplyDefaultFillColor();
|
||||||
|
updateCurveAppearance();
|
||||||
|
appearanceChanged.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::onFillColorChanged( const caf::SignalEmitter* emitter )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "RiuQwtPlotCurveDefines.h"
|
#include "RiuQwtPlotCurveDefines.h"
|
||||||
#include "RiuQwtSymbol.h"
|
#include "RiuQwtSymbol.h"
|
||||||
|
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmFieldCvfColor.h"
|
#include "cafPdmFieldCvfColor.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
@ -69,7 +70,7 @@ public:
|
|||||||
QwtPlotCurve* qwtPlotCurve() const;
|
QwtPlotCurve* qwtPlotCurve() const;
|
||||||
|
|
||||||
void setColor( const cvf::Color3f& color );
|
void setColor( const cvf::Color3f& color );
|
||||||
cvf::Color3f color() const { return m_curveColor; }
|
cvf::Color3f color() const;
|
||||||
void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle );
|
void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle );
|
||||||
void setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle );
|
void setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle );
|
||||||
void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum );
|
void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum );
|
||||||
@ -147,13 +148,14 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
caf::PdmFieldHandle* objectToggleField() override;
|
caf::PdmFieldHandle* objectToggleField() override;
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||||
bool* useOptionsOnly ) override;
|
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||||
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
|
||||||
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
virtual void onCurveAppearanceChanged( const caf::SignalEmitter* emitter );
|
||||||
|
virtual void onFillColorChanged( const caf::SignalEmitter* emitter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool canCurveBeAttached() const;
|
bool canCurveBeAttached() const;
|
||||||
@ -170,21 +172,22 @@ protected:
|
|||||||
caf::PdmField<QString> m_curveName;
|
caf::PdmField<QString> m_curveName;
|
||||||
caf::PdmField<QString> m_customCurveName;
|
caf::PdmField<QString> m_customCurveName;
|
||||||
caf::PdmField<bool> m_showLegend;
|
caf::PdmField<bool> m_showLegend;
|
||||||
caf::PdmField<QString> m_symbolLabel;
|
|
||||||
caf::PdmField<int> m_symbolSize;
|
|
||||||
caf::PdmField<QString> m_legendEntryText;
|
caf::PdmField<QString> m_legendEntryText;
|
||||||
|
caf::PdmField<bool> m_showErrorBars;
|
||||||
|
caf::PdmField<bool> m_isUsingAutoName;
|
||||||
|
|
||||||
caf::PdmField<bool> m_isUsingAutoName;
|
caf::PdmChildField<RimPlotCurveAppearance*> m_curveAppearance;
|
||||||
caf::PdmField<cvf::Color3f> m_curveColor;
|
|
||||||
caf::PdmField<int> m_curveThickness;
|
|
||||||
caf::PdmField<float> m_symbolSkipPixelDistance;
|
|
||||||
caf::PdmField<bool> m_showErrorBars;
|
|
||||||
|
|
||||||
caf::PdmField<RimPlotCurveAppearance::PointSymbol> m_pointSymbol;
|
caf::PdmField<QString> m_symbolLabel_OBSOLETE;
|
||||||
caf::PdmField<RimPlotCurveAppearance::LineStyle> m_lineStyle;
|
caf::PdmField<int> m_symbolSize_OBSOLETE;
|
||||||
caf::PdmField<RimPlotCurveAppearance::FillStyle> m_fillStyle;
|
caf::PdmField<cvf::Color3f> m_curveColor_OBSOLETE;
|
||||||
caf::PdmField<cvf::Color3f> m_fillColor;
|
caf::PdmField<int> m_curveThickness_OBSOLETE;
|
||||||
caf::PdmField<RimPlotCurveAppearance::CurveInterpolation> m_curveInterpolation;
|
caf::PdmField<float> m_symbolSkipPixelDistance_OBSOLETE;
|
||||||
caf::PdmField<RimPlotCurveAppearance::LabelPosition> m_symbolLabelPosition;
|
caf::PdmField<RimPlotCurveAppearance::PointSymbol> m_pointSymbol_OBSOLETE;
|
||||||
caf::PdmField<cvf::Color3f> m_symbolEdgeColor;
|
caf::PdmField<RimPlotCurveAppearance::LineStyle> m_lineStyle_OBSOLETE;
|
||||||
|
caf::PdmField<RimPlotCurveAppearance::FillStyle> m_fillStyle_OBSOLETE;
|
||||||
|
caf::PdmField<cvf::Color3f> m_fillColor_OBSOLETE;
|
||||||
|
caf::PdmField<RimPlotCurveAppearance::CurveInterpolation> m_curveInterpolation_OBSOLETE;
|
||||||
|
caf::PdmField<RimPlotCurveAppearance::LabelPosition> m_symbolLabelPosition_OBSOLETE;
|
||||||
|
caf::PdmField<cvf::Color3f> m_symbolEdgeColor_OBSOLETE;
|
||||||
};
|
};
|
||||||
|
@ -78,6 +78,7 @@ void RimPlotCurveAppearance::FillStyle::setUp()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimPlotCurveAppearance::RimPlotCurveAppearance()
|
RimPlotCurveAppearance::RimPlotCurveAppearance()
|
||||||
: appearanceChanged( this )
|
: appearanceChanged( this )
|
||||||
|
, fillColorChanged( this )
|
||||||
, m_colorVisible( true )
|
, m_colorVisible( true )
|
||||||
, m_interpolationVisible( true )
|
, m_interpolationVisible( true )
|
||||||
, m_fillOptionsVisible( true )
|
, m_fillOptionsVisible( true )
|
||||||
@ -141,6 +142,10 @@ void RimPlotCurveAppearance::fieldChangedByUi( const caf::PdmFieldHandle* change
|
|||||||
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() ==
|
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() ==
|
||||||
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
||||||
}
|
}
|
||||||
|
else if ( &m_fillColor == changedField )
|
||||||
|
{
|
||||||
|
fillColorChanged.send();
|
||||||
|
}
|
||||||
|
|
||||||
appearanceChanged.send();
|
appearanceChanged.send();
|
||||||
}
|
}
|
||||||
@ -169,7 +174,15 @@ void RimPlotCurveAppearance::setColor( const cvf::Color3f& color )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPlotCurveAppearance::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
cvf::Color3f RimPlotCurveAppearance::color() const
|
||||||
|
{
|
||||||
|
return m_curveColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurveAppearance::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_curveColor );
|
uiOrdering.add( &m_curveColor );
|
||||||
m_curveColor.uiCapability()->setUiHidden( !m_colorVisible );
|
m_curveColor.uiCapability()->setUiHidden( !m_colorVisible );
|
||||||
@ -240,6 +253,14 @@ void RimPlotCurveAppearance::setInterpolation( RiuQwtPlotCurveDefines::CurveInte
|
|||||||
m_curveInterpolation = curveInterpolation;
|
m_curveInterpolation = curveInterpolation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuQwtPlotCurveDefines::CurveInterpolationEnum RimPlotCurveAppearance::interpolation() const
|
||||||
|
{
|
||||||
|
return m_curveInterpolation();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -304,6 +325,14 @@ void RimPlotCurveAppearance::setSymbolLabel( const QString& label )
|
|||||||
m_symbolLabel = label;
|
m_symbolLabel = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimPlotCurveAppearance::symbolLabel() const
|
||||||
|
{
|
||||||
|
return m_symbolLabel;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -312,6 +341,14 @@ void RimPlotCurveAppearance::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition
|
|||||||
m_symbolLabelPosition = labelPosition;
|
m_symbolLabelPosition = labelPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuQwtSymbol::LabelPosition RimPlotCurveAppearance::symbolLabelPosition() const
|
||||||
|
{
|
||||||
|
return m_symbolLabelPosition.value();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -373,6 +410,14 @@ void RimPlotCurveAppearance::setFillColor( const cvf::Color3f& fillColor )
|
|||||||
m_fillColor = fillColor;
|
m_fillColor = fillColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Color3f RimPlotCurveAppearance::fillColor() const
|
||||||
|
{
|
||||||
|
return m_fillColor;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -37,6 +37,7 @@ class RimPlotCurveAppearance : public caf::PdmObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
caf::Signal<> appearanceChanged;
|
caf::Signal<> appearanceChanged;
|
||||||
|
caf::Signal<> fillColorChanged;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef caf::AppEnum<RiuQwtPlotCurveDefines::CurveInterpolationEnum> CurveInterpolation;
|
typedef caf::AppEnum<RiuQwtPlotCurveDefines::CurveInterpolationEnum> CurveInterpolation;
|
||||||
@ -50,7 +51,7 @@ public:
|
|||||||
~RimPlotCurveAppearance() override;
|
~RimPlotCurveAppearance() override;
|
||||||
|
|
||||||
void setColor( const cvf::Color3f& color );
|
void setColor( const cvf::Color3f& color );
|
||||||
cvf::Color3f color() const { return m_curveColor; }
|
cvf::Color3f color() const;
|
||||||
|
|
||||||
void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle );
|
void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle );
|
||||||
RiuQwtPlotCurveDefines::LineStyleEnum lineStyle() const;
|
RiuQwtPlotCurveDefines::LineStyleEnum lineStyle() const;
|
||||||
@ -70,23 +71,27 @@ public:
|
|||||||
void setSymbolSkipDistance( float distance );
|
void setSymbolSkipDistance( float distance );
|
||||||
float symbolSkipDistance() const;
|
float symbolSkipDistance() const;
|
||||||
|
|
||||||
void setSymbolLabel( const QString& label );
|
void setSymbolLabel( const QString& label );
|
||||||
|
QString symbolLabel() const;
|
||||||
|
|
||||||
void setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition );
|
void setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition );
|
||||||
RiuQwtSymbol::LabelPosition systemLabelPosition();
|
RiuQwtSymbol::LabelPosition symbolLabelPosition() const;
|
||||||
|
|
||||||
void resetAppearance();
|
void resetAppearance();
|
||||||
Qt::BrushStyle fillStyle() const;
|
Qt::BrushStyle fillStyle() const;
|
||||||
void setFillStyle( Qt::BrushStyle brushStyle );
|
void setFillStyle( Qt::BrushStyle brushStyle );
|
||||||
void setFillColor( const cvf::Color3f& fillColor );
|
|
||||||
|
|
||||||
void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum );
|
void setFillColor( const cvf::Color3f& fillColor );
|
||||||
|
cvf::Color3f fillColor() const;
|
||||||
|
|
||||||
|
void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum );
|
||||||
|
RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolation() const;
|
||||||
|
|
||||||
void setInterpolationVisible( bool isVisible );
|
void setInterpolationVisible( bool isVisible );
|
||||||
void setColorVisible( bool isVisible );
|
void setColorVisible( bool isVisible );
|
||||||
void setFillOptionsVisible( bool isVisible );
|
void setFillOptionsVisible( bool isVisible );
|
||||||
|
|
||||||
void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
|
@ -65,13 +65,13 @@ void RimStackablePlotCurve::assignStackColor( size_t index, size_t count )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fillColor = curveColor;
|
setFillColor( curveColor );
|
||||||
|
|
||||||
{
|
{
|
||||||
auto moreSaturatedColor = RiaColorTools::toQColor( curveColor );
|
auto moreSaturatedColor = RiaColorTools::toQColor( curveColor );
|
||||||
moreSaturatedColor = RiaColorTools::modifySaturation( moreSaturatedColor, 1.2 );
|
moreSaturatedColor = RiaColorTools::modifySaturation( moreSaturatedColor, 1.2 );
|
||||||
|
|
||||||
m_curveColor = RiaColorTools::fromQColorTo3f( moreSaturatedColor );
|
m_curveAppearance->setColor( RiaColorTools::fromQColorTo3f( moreSaturatedColor ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
this->updateCurveAppearance();
|
this->updateCurveAppearance();
|
||||||
@ -100,10 +100,10 @@ void RimStackablePlotCurve::setIsStacked( bool stacked )
|
|||||||
{
|
{
|
||||||
m_isStacked = stacked;
|
m_isStacked = stacked;
|
||||||
|
|
||||||
if ( !m_isStacked() && m_fillStyle() != Qt::NoBrush )
|
if ( !m_isStacked() && fillStyle() != Qt::NoBrush )
|
||||||
{
|
{
|
||||||
// Switch off area fill when turning off stacking.
|
// Switch off area fill when turning off stacking.
|
||||||
m_fillStyle = Qt::NoBrush;
|
setFillStyle( Qt::NoBrush );
|
||||||
}
|
}
|
||||||
stackingChanged.send( m_isStacked() );
|
stackingChanged.send( m_isStacked() );
|
||||||
}
|
}
|
||||||
@ -119,10 +119,10 @@ void RimStackablePlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
|||||||
|
|
||||||
if ( changedField == &m_isStacked )
|
if ( changedField == &m_isStacked )
|
||||||
{
|
{
|
||||||
if ( !m_isStacked() && m_fillStyle() != Qt::NoBrush )
|
if ( !m_isStacked() && fillStyle() != Qt::NoBrush )
|
||||||
{
|
{
|
||||||
// Switch off area fill when turning off stacking.
|
// Switch off area fill when turning off stacking.
|
||||||
m_fillStyle = Qt::NoBrush;
|
setFillStyle( Qt::NoBrush );
|
||||||
}
|
}
|
||||||
stackingChanged.send( m_isStacked() );
|
stackingChanged.send( m_isStacked() );
|
||||||
}
|
}
|
||||||
@ -130,11 +130,16 @@ void RimStackablePlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
|||||||
{
|
{
|
||||||
stackingColorsChanged.send( m_isStackedWithPhaseColors() );
|
stackingColorsChanged.send( m_isStackedWithPhaseColors() );
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_fillColor )
|
}
|
||||||
{
|
|
||||||
m_isStackedWithPhaseColors = false;
|
//--------------------------------------------------------------------------------------------------
|
||||||
this->updateConnectedEditors();
|
///
|
||||||
}
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStackablePlotCurve::onFillColorChanged( const caf::SignalEmitter* emitter )
|
||||||
|
{
|
||||||
|
m_isStackedWithPhaseColors = false;
|
||||||
|
this->updateConnectedEditors();
|
||||||
|
stackingColorsChanged.send( m_isStackedWithPhaseColors() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -38,6 +38,8 @@ protected:
|
|||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void stackingUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
void stackingUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||||
|
|
||||||
|
void onFillColorChanged( const caf::SignalEmitter* emitter ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
caf::PdmField<bool> m_isStacked;
|
caf::PdmField<bool> m_isStacked;
|
||||||
caf::PdmField<bool> m_isStackedWithPhaseColors;
|
caf::PdmField<bool> m_isStackedWithPhaseColors;
|
||||||
|
@ -49,8 +49,8 @@ RimAsciiDataCurve::RimAsciiDataCurve()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values", "", "", "" );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_title, "Title", "Title", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_title, "Title", "Title", "", "", "" );
|
||||||
|
|
||||||
m_symbolSkipPixelDistance = 10.0f;
|
setSymbolSkipDistance( 10.0f );
|
||||||
m_curveThickness = 2;
|
setLineThickness( 2 );
|
||||||
|
|
||||||
setDeletable( true );
|
setDeletable( true );
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,8 @@ RimSummaryCurve::RimSummaryCurve()
|
|||||||
CAF_PDM_InitField( &m_isTopZWithinCategory, "isTopZWithinCategory", false, "", "", "", "" );
|
CAF_PDM_InitField( &m_isTopZWithinCategory, "isTopZWithinCategory", false, "", "", "", "" );
|
||||||
m_isTopZWithinCategory.uiCapability()->setUiHidden( true );
|
m_isTopZWithinCategory.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
m_symbolSkipPixelDistance = 10.0f;
|
setSymbolSkipDistance( 10.0f );
|
||||||
m_curveThickness = 2;
|
setLineThickness( 2 );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" );
|
||||||
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
|
m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
@ -380,7 +380,8 @@ double RimSummaryCurve::yValueAtTimeT( time_t time ) const
|
|||||||
}
|
}
|
||||||
else if ( i < timeSteps.size() - 1u && timeSteps[i] < time && time < timeSteps[i + 1] )
|
else if ( i < timeSteps.size() - 1u && timeSteps[i] < time && time < timeSteps[i + 1] )
|
||||||
{
|
{
|
||||||
if ( m_curveInterpolation == RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT )
|
if ( m_curveAppearance->interpolation() ==
|
||||||
|
RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT )
|
||||||
{
|
{
|
||||||
return values[i + 1];
|
return values[i + 1];
|
||||||
}
|
}
|
||||||
@ -976,7 +977,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
|
|||||||
|
|
||||||
if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferencesSummary::SummaryHistoryCurveStyleMode::SYMBOLS )
|
if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferencesSummary::SummaryHistoryCurveStyleMode::SYMBOLS )
|
||||||
{
|
{
|
||||||
m_symbolEdgeColor = m_curveColor;
|
setSymbolEdgeColor( m_curveAppearance->color() );
|
||||||
|
|
||||||
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
||||||
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
||||||
@ -984,7 +985,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
|
|||||||
else if ( prefs->defaultSummaryHistoryCurveStyle() ==
|
else if ( prefs->defaultSummaryHistoryCurveStyle() ==
|
||||||
RiaPreferencesSummary::SummaryHistoryCurveStyleMode::SYMBOLS_AND_LINES )
|
RiaPreferencesSummary::SummaryHistoryCurveStyleMode::SYMBOLS_AND_LINES )
|
||||||
{
|
{
|
||||||
m_symbolEdgeColor = m_curveColor;
|
setSymbolEdgeColor( m_curveAppearance->color() );
|
||||||
|
|
||||||
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
setSymbol( RiuQwtSymbol::SYMBOL_XCROSS );
|
||||||
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
|
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
|
||||||
@ -1262,11 +1263,12 @@ void RimSummaryCurve::calculateCurveInterpolationFromAddress()
|
|||||||
auto address = m_yValuesSummaryAddress()->address();
|
auto address = m_yValuesSummaryAddress()->address();
|
||||||
if ( RiaSummaryTools::hasAccumulatedData( address ) )
|
if ( RiaSummaryTools::hasAccumulatedData( address ) )
|
||||||
{
|
{
|
||||||
m_curveInterpolation = RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT;
|
m_curveAppearance->setInterpolation(
|
||||||
|
RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_curveInterpolation = RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT;
|
m_curveAppearance->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,7 +488,8 @@ void RimEnsembleWellLogCurveSet::defineUiOrdering( QString uiConfigName, caf::Pd
|
|||||||
m_statistics->defineUiOrdering( uiConfigName, *statGroup );
|
m_statistics->defineUiOrdering( uiConfigName, *statGroup );
|
||||||
|
|
||||||
caf::PdmUiGroup* curveAppearanceGroup = uiOrdering.addNewGroup( "Curve Appearance" );
|
caf::PdmUiGroup* curveAppearanceGroup = uiOrdering.addNewGroup( "Curve Appearance" );
|
||||||
m_curveAppearance->appearanceUiOrdering( *curveAppearanceGroup );
|
QString configName = "AppearanceOrdering";
|
||||||
|
m_curveAppearance->uiOrdering( configName, *curveAppearanceGroup );
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields( true );
|
uiOrdering.skipRemainingFields( true );
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ const RigWellLogCurveData* RimWellLogCurve::curveData() const
|
|||||||
void RimWellLogCurve::updateCurveAppearance()
|
void RimWellLogCurve::updateCurveAppearance()
|
||||||
{
|
{
|
||||||
RimPlotCurve::updateCurveAppearance();
|
RimPlotCurve::updateCurveAppearance();
|
||||||
if ( m_fillStyle != Qt::BrushStyle::NoBrush )
|
if ( fillStyle() != Qt::BrushStyle::NoBrush )
|
||||||
{
|
{
|
||||||
m_qwtPlotCurve->setOrientation( Qt::Horizontal );
|
m_qwtPlotCurve->setOrientation( Qt::Horizontal );
|
||||||
m_qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
|
m_qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
|
||||||
|
Loading…
Reference in New Issue
Block a user