mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -35,192 +35,200 @@
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "qwt_symbol.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_symbol.h"
|
||||
|
||||
// NB! Special macro for pure virtual class
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimPlotCurve, "PlotCurve");
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotCurve, "PlotCurve" );
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
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");
|
||||
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);
|
||||
setDefault( RiuQwtPlotCurve::INTERPOLATION_POINT_TO_POINT );
|
||||
}
|
||||
|
||||
template<>
|
||||
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");
|
||||
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);
|
||||
setDefault( RiuQwtPlotCurve::STYLE_SOLID );
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
template <>
|
||||
void RimPlotCurve::PointSymbol::setUp()
|
||||
{
|
||||
addItem(RiuQwtSymbol::SYMBOL_NONE, "SYMBOL_NONE", "None");
|
||||
addItem(RiuQwtSymbol::SYMBOL_ELLIPSE, "SYMBOL_ELLIPSE", "Ellipse");
|
||||
addItem(RiuQwtSymbol::SYMBOL_RECT, "SYMBOL_RECT", "Rect");
|
||||
addItem(RiuQwtSymbol::SYMBOL_DIAMOND, "SYMBOL_DIAMOND", "Diamond");
|
||||
addItem(RiuQwtSymbol::SYMBOL_TRIANGLE, "SYMBOL_TRIANGLE", "Triangle");
|
||||
addItem(RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE, "SYMBOL_DOWN_TRIANGLE", "Down Triangle");
|
||||
addItem(RiuQwtSymbol::SYMBOL_CROSS, "SYMBOL_CROSS", "Cross");
|
||||
addItem(RiuQwtSymbol::SYMBOL_XCROSS, "SYMBOL_XCROSS", "X Cross");
|
||||
addItem(RiuQwtSymbol::SYMBOL_STAR1, "SYMBOL_STAR1", "Star 1");
|
||||
addItem(RiuQwtSymbol::SYMBOL_STAR2, "SYMBOL_STAR2", "Star 2");
|
||||
addItem(RiuQwtSymbol::SYMBOL_HEXAGON, "SYMBOL_HEXAGON", "Hexagon");
|
||||
addItem(RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, "SYMBOL_LEFT_TRIANGLE", "Left Triangle");
|
||||
addItem(RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, "SYMBOL_RIGHT_TRIANGLE", "Right Triangle");
|
||||
setDefault(RiuQwtSymbol::SYMBOL_NONE);
|
||||
addItem( RiuQwtSymbol::SYMBOL_NONE, "SYMBOL_NONE", "None" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_ELLIPSE, "SYMBOL_ELLIPSE", "Ellipse" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_RECT, "SYMBOL_RECT", "Rect" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_DIAMOND, "SYMBOL_DIAMOND", "Diamond" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_TRIANGLE, "SYMBOL_TRIANGLE", "Triangle" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE, "SYMBOL_DOWN_TRIANGLE", "Down Triangle" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_CROSS, "SYMBOL_CROSS", "Cross" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_XCROSS, "SYMBOL_XCROSS", "X Cross" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_STAR1, "SYMBOL_STAR1", "Star 1" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_STAR2, "SYMBOL_STAR2", "Star 2" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_HEXAGON, "SYMBOL_HEXAGON", "Hexagon" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, "SYMBOL_LEFT_TRIANGLE", "Left Triangle" );
|
||||
addItem( RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, "SYMBOL_RIGHT_TRIANGLE", "Right Triangle" );
|
||||
setDefault( RiuQwtSymbol::SYMBOL_NONE );
|
||||
}
|
||||
|
||||
template<>
|
||||
template <>
|
||||
void RimPlotCurve::LabelPosition::setUp()
|
||||
{
|
||||
addItem(RiuQwtSymbol::LabelAboveSymbol, "LABEL_ABOVE_SYMBOL", "Label above Symbol");
|
||||
addItem(RiuQwtSymbol::LabelBelowSymbol, "LABEL_BELOW_SYMBOL", "Label below Symbol");
|
||||
addItem(RiuQwtSymbol::LabelLeftOfSymbol, "LABEL_LEFT_OF_SYMBOL", "Label left of Symbol");
|
||||
addItem(RiuQwtSymbol::LabelRightOfSymbol, "LABEL_RIGHT_OF_SYMBOL", "Label right of Symbol");
|
||||
setDefault(RiuQwtSymbol::LabelAboveSymbol);
|
||||
}
|
||||
|
||||
addItem( RiuQwtSymbol::LabelAboveSymbol, "LABEL_ABOVE_SYMBOL", "Label above Symbol" );
|
||||
addItem( RiuQwtSymbol::LabelBelowSymbol, "LABEL_BELOW_SYMBOL", "Label below Symbol" );
|
||||
addItem( RiuQwtSymbol::LabelLeftOfSymbol, "LABEL_LEFT_OF_SYMBOL", "Label left of Symbol" );
|
||||
addItem( RiuQwtSymbol::LabelRightOfSymbol, "LABEL_RIGHT_OF_SYMBOL", "Label right of Symbol" );
|
||||
setDefault( RiuQwtSymbol::LabelAboveSymbol );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCurve::RimPlotCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Curve", ":/WellLogCurve16x16.png", "", "");
|
||||
CAF_PDM_InitObject( "Curve", ":/WellLogCurve16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
|
||||
m_showCurve.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve", "", "", "" );
|
||||
m_showCurve.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_curveName, "CurveName", "Curve Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
|
||||
m_customCurveName.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "Curve Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_customCurveName, "CurveDescription", "Custom Name", "", "", "" );
|
||||
m_customCurveName.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_legendEntryText, "LegendDescription", "Legend Name", "", "", "");
|
||||
m_legendEntryText.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &m_legendEntryText, "LegendDescription", "Legend Name", "", "", "" );
|
||||
m_legendEntryText.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
|
||||
CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&m_curveThickness, "Thickness", 1, "Line Thickness", "", "", "");
|
||||
m_curveThickness.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitField( &m_curveColor, "Color", cvf::Color3f( cvf::Color3::BLACK ), "Color", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_curveInterpolation, "CurveInterpolation", "Interpolation", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_lineStyle, "LineStyle", "Line Style", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_pointSymbol, "PointSymbol", "Symbol", "", "", "");
|
||||
CAF_PDM_InitField(&m_symbolEdgeColor, "SymbolEdgeColor", cvf::Color3f(cvf::Color3::BLACK), "Symbol Edge Color", "", "", "");
|
||||
CAF_PDM_InitField( &m_curveThickness, "Thickness", 1, "Line Thickness", "", "", "" );
|
||||
m_curveThickness.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField(&m_symbolSkipPixelDistance, "SymbolSkipPxDist", 0.0f, "Symbol Skip Distance", "", "Minimum pixel distance between symbols", "");
|
||||
CAF_PDM_InitFieldNoDefault( &m_curveInterpolation, "CurveInterpolation", "Interpolation", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_lineStyle, "LineStyle", "Line Style", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_pointSymbol, "PointSymbol", "Symbol", "", "", "" );
|
||||
CAF_PDM_InitField( &m_symbolEdgeColor,
|
||||
"SymbolEdgeColor",
|
||||
cvf::Color3f( cvf::Color3::BLACK ),
|
||||
"Symbol Edge Color",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "");
|
||||
CAF_PDM_InitField( &m_symbolSkipPixelDistance,
|
||||
"SymbolSkipPxDist",
|
||||
0.0f,
|
||||
"Symbol Skip Distance",
|
||||
"",
|
||||
"Minimum pixel distance between symbols",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_symbolLabel, "SymbolLabel", "Symbol Label", "", "", "");
|
||||
CAF_PDM_InitField(&m_symbolSize, "SymbolSize", 6, "Symbol Size", "", "", "");
|
||||
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&m_showErrorBars, "ShowErrorBars", true, "Show Error Bars", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &m_symbolLabel, "SymbolLabel", "Symbol Label", "", "", "" );
|
||||
CAF_PDM_InitField( &m_symbolSize, "SymbolSize", 6, "Symbol Size", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position", "", "", "");
|
||||
|
||||
m_qwtPlotCurve = new RiuRimQwtPlotCurve(this);
|
||||
CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position", "", "", "" );
|
||||
|
||||
m_qwtPlotCurve = new RiuRimQwtPlotCurve( this );
|
||||
|
||||
m_parentQwtPlot = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotCurve::~RimPlotCurve()
|
||||
{
|
||||
if (m_qwtPlotCurve)
|
||||
if ( m_qwtPlotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->detach();
|
||||
delete m_qwtPlotCurve;
|
||||
m_qwtPlotCurve = nullptr;
|
||||
}
|
||||
|
||||
if (m_parentQwtPlot)
|
||||
if ( m_parentQwtPlot )
|
||||
{
|
||||
m_parentQwtPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if (changedField == &m_showCurve)
|
||||
if ( changedField == &m_showCurve )
|
||||
{
|
||||
this->updateCurveVisibility(true);
|
||||
if (m_showCurve()) loadDataAndUpdate(true);
|
||||
this->updateCurveVisibility( true );
|
||||
if ( m_showCurve() ) loadDataAndUpdate( true );
|
||||
}
|
||||
else if (changedField == &m_curveName)
|
||||
else if ( changedField == &m_curveName )
|
||||
{
|
||||
m_customCurveName = m_curveName;
|
||||
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)
|
||||
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 )
|
||||
{
|
||||
updateCurveAppearance();
|
||||
|
||||
if (&m_pointSymbol == changedField)
|
||||
if ( &m_pointSymbol == changedField )
|
||||
{
|
||||
m_symbolSize.uiCapability()->setUiReadOnly(m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE);
|
||||
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly(m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE);
|
||||
m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
|
||||
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE );
|
||||
}
|
||||
else if (&m_lineStyle == changedField)
|
||||
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() == RiuQwtPlotCurve::STYLE_NONE );
|
||||
m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE );
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_isUsingAutoName)
|
||||
else if ( changedField == &m_isUsingAutoName )
|
||||
{
|
||||
if (!m_isUsingAutoName)
|
||||
if ( !m_isUsingAutoName )
|
||||
{
|
||||
m_customCurveName = createCurveAutoName();
|
||||
}
|
||||
|
||||
updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
}
|
||||
else if (changedField == &m_showLegend)
|
||||
else if ( changedField == &m_showLegend )
|
||||
{
|
||||
updateLegendEntryVisibilityAndPlotLegend();
|
||||
}
|
||||
else if (changedField == &m_showErrorBars)
|
||||
else if ( changedField == &m_showErrorBars )
|
||||
{
|
||||
m_qwtPlotCurve->showErrorBars(m_showErrorBars);
|
||||
m_qwtPlotCurve->showErrorBars( m_showErrorBars );
|
||||
updateCurveAppearance();
|
||||
}
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotCurve::objectToggleField()
|
||||
{
|
||||
@@ -230,7 +238,7 @@ caf::PdmFieldHandle* RimPlotCurve::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setCustomName(const QString& customName)
|
||||
void RimPlotCurve::setCustomName( const QString& customName )
|
||||
{
|
||||
m_isUsingAutoName = false;
|
||||
m_customCurveName = customName;
|
||||
@@ -241,7 +249,7 @@ void RimPlotCurve::setCustomName(const QString& customName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotCurve::legendEntryText() const
|
||||
{
|
||||
if (!m_legendEntryText().isEmpty())
|
||||
if ( !m_legendEntryText().isEmpty() )
|
||||
{
|
||||
return m_legendEntryText;
|
||||
}
|
||||
@@ -251,26 +259,26 @@ QString RimPlotCurve::legendEntryText() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setLegendEntryText(const QString& legendEntryText)
|
||||
void RimPlotCurve::setLegendEntryText( const QString& legendEntryText )
|
||||
{
|
||||
m_legendEntryText = legendEntryText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveVisibility(bool updateParentPlot)
|
||||
void RimPlotCurve::updateCurveVisibility( bool updateParentPlot )
|
||||
{
|
||||
if (canCurveBeAttached())
|
||||
if ( canCurveBeAttached() )
|
||||
{
|
||||
m_qwtPlotCurve->attach(m_parentQwtPlot);
|
||||
m_qwtPlotCurve->attach( m_parentQwtPlot );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->detach();
|
||||
}
|
||||
|
||||
if (updateParentPlot)
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
@@ -281,20 +289,20 @@ void RimPlotCurve::updateCurveVisibility(bool updateParentPlot)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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_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 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurvePresentation(bool updatePlotLegendAndTitle)
|
||||
void RimPlotCurve::updateCurvePresentation( bool updatePlotLegendAndTitle )
|
||||
{
|
||||
this->updateCurveVisibility(updatePlotLegendAndTitle);
|
||||
this->updateCurveVisibility( updatePlotLegendAndTitle );
|
||||
|
||||
if (updatePlotLegendAndTitle)
|
||||
if ( updatePlotLegendAndTitle )
|
||||
{
|
||||
this->updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
this->updatePlotTitle();
|
||||
@@ -308,27 +316,27 @@ void RimPlotCurve::updateCurvePresentation(bool updatePlotLegendAndTitle)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setParentQwtPlotAndReplot(QwtPlot* plot)
|
||||
void RimPlotCurve::setParentQwtPlotAndReplot( QwtPlot* plot )
|
||||
{
|
||||
m_parentQwtPlot = plot;
|
||||
if (canCurveBeAttached())
|
||||
if ( canCurveBeAttached() )
|
||||
{
|
||||
m_qwtPlotCurve->attach(m_parentQwtPlot);
|
||||
m_qwtPlotCurve->attach( m_parentQwtPlot );
|
||||
m_parentQwtPlot->replot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setParentQwtPlotNoReplot(QwtPlot* plot)
|
||||
void RimPlotCurve::setParentQwtPlotNoReplot( QwtPlot* plot )
|
||||
{
|
||||
m_parentQwtPlot = plot;
|
||||
if (canCurveBeAttached())
|
||||
if ( canCurveBeAttached() )
|
||||
{
|
||||
m_qwtPlotCurve->attach(m_parentQwtPlot);
|
||||
m_qwtPlotCurve->attach( m_parentQwtPlot );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -337,7 +345,7 @@ void RimPlotCurve::setParentQwtPlotNoReplot(QwtPlot* plot)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotCurve::userDescriptionField()
|
||||
{
|
||||
@@ -345,15 +353,15 @@ caf::PdmFieldHandle* RimPlotCurve::userDescriptionField()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setColor(const cvf::Color3f& color)
|
||||
void RimPlotCurve::setColor( const cvf::Color3f& color )
|
||||
{
|
||||
m_curveColor = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::detachQwtCurve()
|
||||
{
|
||||
@@ -366,14 +374,14 @@ void RimPlotCurve::detachQwtCurve()
|
||||
void RimPlotCurve::reattachQwtCurve()
|
||||
{
|
||||
detachQwtCurve();
|
||||
if (canCurveBeAttached())
|
||||
if ( canCurveBeAttached() )
|
||||
{
|
||||
m_qwtPlotCurve->attach(m_parentQwtPlot);
|
||||
m_qwtPlotCurve->attach( m_parentQwtPlot );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QwtPlotCurve* RimPlotCurve::qwtPlotCurve() const
|
||||
{
|
||||
@@ -381,7 +389,7 @@ QwtPlotCurve* RimPlotCurve::qwtPlotCurve() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::isCurveVisible() const
|
||||
{
|
||||
@@ -389,9 +397,9 @@ bool RimPlotCurve::isCurveVisible() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setCurveVisiblity(bool visible)
|
||||
void RimPlotCurve::setCurveVisiblity( bool visible )
|
||||
{
|
||||
m_showCurve = visible;
|
||||
}
|
||||
@@ -401,7 +409,7 @@ void RimPlotCurve::setCurveVisiblity(bool visible)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveName()
|
||||
{
|
||||
if (m_isUsingAutoName)
|
||||
if ( m_isUsingAutoName )
|
||||
{
|
||||
m_curveName = this->createCurveAutoName();
|
||||
}
|
||||
@@ -410,19 +418,18 @@ void RimPlotCurve::updateCurveName()
|
||||
m_curveName = m_customCurveName;
|
||||
}
|
||||
|
||||
if (!m_legendEntryText().isEmpty())
|
||||
if ( !m_legendEntryText().isEmpty() )
|
||||
{
|
||||
m_qwtPlotCurve->setTitle(m_legendEntryText);
|
||||
m_qwtPlotCurve->setTitle( m_legendEntryText );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setTitle(m_curveName);
|
||||
m_qwtPlotCurve->setTitle( m_curveName );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveNameAndUpdatePlotLegendAndTitle()
|
||||
{
|
||||
@@ -431,31 +438,30 @@ void RimPlotCurve::updateCurveNameAndUpdatePlotLegendAndTitle()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveNameNoLegendUpdate()
|
||||
{
|
||||
{
|
||||
updateCurveName();
|
||||
updateLegendEntryVisibilityNoPlotUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateOptionSensitivity()
|
||||
{
|
||||
m_curveName.uiCapability()->setUiReadOnly(m_isUsingAutoName);
|
||||
m_curveName.uiCapability()->setUiReadOnly( m_isUsingAutoName );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updatePlotTitle()
|
||||
{
|
||||
RimNameConfigHolderInterface* nameConfigHolder = nullptr;
|
||||
this->firstAncestorOrThisOfType(nameConfigHolder);
|
||||
if (nameConfigHolder)
|
||||
this->firstAncestorOrThisOfType( nameConfigHolder );
|
||||
if ( nameConfigHolder )
|
||||
{
|
||||
nameConfigHolder->updateHolder();
|
||||
}
|
||||
@@ -466,7 +472,7 @@ void RimPlotCurve::updatePlotTitle()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateLegendsInPlot()
|
||||
{
|
||||
if (m_parentQwtPlot != nullptr)
|
||||
if ( m_parentQwtPlot != nullptr )
|
||||
{
|
||||
m_parentQwtPlot->updateLegend();
|
||||
}
|
||||
@@ -475,34 +481,33 @@ void RimPlotCurve::updateLegendsInPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimPlotCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
throw std::logic_error("The method or operation is not implemented.");
|
||||
throw std::logic_error( "The method or operation is not implemented." );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
void RimPlotCurve::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add(&m_curveColor);
|
||||
uiOrdering.add(&m_pointSymbol);
|
||||
uiOrdering.add(&m_symbolEdgeColor);
|
||||
uiOrdering.add(&m_symbolSize);
|
||||
uiOrdering.add(&m_symbolSkipPixelDistance);
|
||||
uiOrdering.add(&m_lineStyle);
|
||||
uiOrdering.add(&m_curveThickness);
|
||||
uiOrdering.add(&m_curveInterpolation);
|
||||
|
||||
uiOrdering.add( &m_curveColor );
|
||||
uiOrdering.add( &m_pointSymbol );
|
||||
uiOrdering.add( &m_symbolEdgeColor );
|
||||
uiOrdering.add( &m_symbolSize );
|
||||
uiOrdering.add( &m_symbolSkipPixelDistance );
|
||||
uiOrdering.add( &m_lineStyle );
|
||||
uiOrdering.add( &m_curveThickness );
|
||||
uiOrdering.add( &m_curveInterpolation );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add(&m_isUsingAutoName);
|
||||
uiOrdering.add(&m_curveName);
|
||||
uiOrdering.add( &m_isUsingAutoName );
|
||||
uiOrdering.add( &m_curveName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -510,29 +515,29 @@ void RimPlotCurve::curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateUiIconFromPlotSymbol()
|
||||
{
|
||||
if (m_pointSymbol() != RiuQwtSymbol::NoSymbol)
|
||||
if ( m_pointSymbol() != RiuQwtSymbol::NoSymbol )
|
||||
{
|
||||
CVF_ASSERT(RiaGuiApplication::isRunning());
|
||||
QColor curveColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
||||
CVF_ASSERT( RiaGuiApplication::isRunning() );
|
||||
QColor curveColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
||||
|
||||
QSizeF iconSize(24, 24);
|
||||
QwtGraphic graphic = m_qwtPlotCurve->legendIcon(0, iconSize);
|
||||
QPixmap pixmap = graphic.toPixmap();
|
||||
setUiIcon(caf::QIconProvider(pixmap));
|
||||
QSizeF iconSize( 24, 24 );
|
||||
QwtGraphic graphic = m_qwtPlotCurve->legendIcon( 0, iconSize );
|
||||
QPixmap pixmap = graphic.toPixmap();
|
||||
setUiIcon( caf::QIconProvider( pixmap ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::canCurveBeAttached() const
|
||||
{
|
||||
if (!m_parentQwtPlot)
|
||||
if ( !m_parentQwtPlot )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_showCurve())
|
||||
if ( !m_showCurve() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -541,89 +546,92 @@ bool RimPlotCurve::canCurveBeAttached() const
|
||||
|
||||
{
|
||||
RimSummaryCurveCollection* summaryCurveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType(summaryCurveCollection);
|
||||
if (summaryCurveCollection) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible();
|
||||
this->firstAncestorOrThisOfType( summaryCurveCollection );
|
||||
if ( summaryCurveCollection ) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible();
|
||||
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
firstAncestorOrThisOfType(ensembleCurveSet);
|
||||
if (ensembleCurveSet) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible();
|
||||
firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
if ( ensembleCurveSet ) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible();
|
||||
}
|
||||
|
||||
return isVisibleInPossibleParent;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateCurveAppearance()
|
||||
{
|
||||
CVF_ASSERT(m_qwtPlotCurve);
|
||||
CVF_ASSERT( m_qwtPlotCurve );
|
||||
|
||||
QColor curveColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
||||
QColor curveColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
||||
QwtSymbol* symbol = nullptr;
|
||||
|
||||
if (m_pointSymbol() != RiuQwtSymbol::SYMBOL_NONE)
|
||||
if ( m_pointSymbol() != RiuQwtSymbol::SYMBOL_NONE )
|
||||
{
|
||||
// QwtPlotCurve will take ownership of the symbol
|
||||
symbol = new RiuQwtSymbol(m_pointSymbol(), m_symbolLabel(), m_symbolLabelPosition());
|
||||
symbol->setSize(m_symbolSize, m_symbolSize);
|
||||
symbol->setColor(curveColor);
|
||||
symbol = new RiuQwtSymbol( m_pointSymbol(), m_symbolLabel(), m_symbolLabelPosition() );
|
||||
symbol->setSize( m_symbolSize, m_symbolSize );
|
||||
symbol->setColor( curveColor );
|
||||
|
||||
QColor symbolEdgeColor(m_symbolEdgeColor.value().rByte(), m_symbolEdgeColor.value().gByte(), m_symbolEdgeColor.value().bByte());
|
||||
QColor symbolEdgeColor( m_symbolEdgeColor.value().rByte(),
|
||||
m_symbolEdgeColor.value().gByte(),
|
||||
m_symbolEdgeColor.value().bByte() );
|
||||
|
||||
symbol->setPen(symbolEdgeColor);
|
||||
symbol->setPen( symbolEdgeColor );
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setAppearance(m_lineStyle(), m_curveInterpolation(), m_curveThickness(), curveColor);
|
||||
m_qwtPlotCurve->setSymbol(symbol);
|
||||
m_qwtPlotCurve->setSymbolSkipPixelDistance(m_symbolSkipPixelDistance());
|
||||
m_qwtPlotCurve->setAppearance( m_lineStyle(), m_curveInterpolation(), m_curveThickness(), curveColor );
|
||||
m_qwtPlotCurve->setSymbol( symbol );
|
||||
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_symbolSkipPixelDistance() );
|
||||
|
||||
m_qwtPlotCurve->setErrorBarsColor(curveColor);
|
||||
m_qwtPlotCurve->setErrorBarsColor( curveColor );
|
||||
|
||||
// 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() != RiuQwtPlotCurve::STYLE_NONE )
|
||||
{
|
||||
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||
|
||||
int symbolWidth = 0;
|
||||
if (symbol)
|
||||
if ( symbol )
|
||||
{
|
||||
symbolWidth = symbol->boundingRect().size().width() + 2;
|
||||
}
|
||||
|
||||
int width = std::max(10 * m_curveThickness, (symbolWidth * 3) / 2);
|
||||
int width = std::max( 10 * m_curveThickness, ( symbolWidth * 3 ) / 2 );
|
||||
|
||||
legendIconSize.setWidth(width);
|
||||
m_qwtPlotCurve->setLegendIconSize(legendIconSize);
|
||||
legendIconSize.setWidth( width );
|
||||
m_qwtPlotCurve->setLegendIconSize( legendIconSize );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::isCrossPlotCurve() const
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(crossPlot);
|
||||
if (crossPlot) return true;
|
||||
this->firstAncestorOrThisOfType( crossPlot );
|
||||
if ( crossPlot ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_curveThickness)
|
||||
if ( fieldNeedingOptions == &m_curveThickness )
|
||||
{
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
for ( size_t i = 0; i < 10; i++ )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(QString::number(i + 1), QVariant::fromValue(i + 1)));
|
||||
options.push_back( caf::PdmOptionItemInfo( QString::number( i + 1 ), QVariant::fromValue( i + 1 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,22 +639,22 @@ QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions(const caf::Pdm
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::loadDataAndUpdate(bool updateParentPlot)
|
||||
void RimPlotCurve::loadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
this->onLoadDataAndUpdate(updateParentPlot);
|
||||
this->onLoadDataAndUpdate( updateParentPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::xValueRange(double* minimumValue, double* maximumValue) const
|
||||
bool RimPlotCurve::xValueRange( double* minimumValue, double* maximumValue ) const
|
||||
{
|
||||
CVF_ASSERT(minimumValue && maximumValue);
|
||||
CVF_ASSERT(m_qwtPlotCurve);
|
||||
CVF_ASSERT( minimumValue && maximumValue );
|
||||
CVF_ASSERT( m_qwtPlotCurve );
|
||||
|
||||
if (m_qwtPlotCurve->data()->size() < 1)
|
||||
if ( m_qwtPlotCurve->data()->size() < 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -660,12 +668,12 @@ bool RimPlotCurve::xValueRange(double* minimumValue, double* maximumValue) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotCurve::yValueRange(double* minimumValue, double* maximumValue) const
|
||||
bool RimPlotCurve::yValueRange( double* minimumValue, double* maximumValue ) const
|
||||
{
|
||||
CVF_ASSERT(minimumValue && maximumValue);
|
||||
CVF_ASSERT(m_qwtPlotCurve);
|
||||
CVF_ASSERT( minimumValue && maximumValue );
|
||||
CVF_ASSERT( m_qwtPlotCurve );
|
||||
|
||||
if (m_qwtPlotCurve->data()->size() < 1)
|
||||
if ( m_qwtPlotCurve->data()->size() < 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -677,23 +685,23 @@ bool RimPlotCurve::yValueRange(double* minimumValue, double* maximumValue) const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setLineStyle(RiuQwtPlotCurve::LineStyleEnum lineStyle)
|
||||
void RimPlotCurve::setLineStyle( RiuQwtPlotCurve::LineStyleEnum lineStyle )
|
||||
{
|
||||
m_lineStyle = lineStyle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSymbol(RiuQwtSymbol::PointSymbolEnum symbolStyle)
|
||||
void RimPlotCurve::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle )
|
||||
{
|
||||
m_pointSymbol = symbolStyle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtSymbol::PointSymbolEnum RimPlotCurve::symbol()
|
||||
{
|
||||
@@ -719,23 +727,23 @@ cvf::Color3f RimPlotCurve::symbolEdgeColor() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSymbolEdgeColor(const cvf::Color3f& edgeColor)
|
||||
void RimPlotCurve::setSymbolEdgeColor( const cvf::Color3f& edgeColor )
|
||||
{
|
||||
m_symbolEdgeColor = edgeColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSymbolSkipDistance(float distance)
|
||||
void RimPlotCurve::setSymbolSkipDistance( float distance )
|
||||
{
|
||||
m_symbolSkipPixelDistance = distance;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSymbolLabel(const QString& label)
|
||||
void RimPlotCurve::setSymbolLabel( const QString& label )
|
||||
{
|
||||
m_symbolLabel = label;
|
||||
}
|
||||
@@ -743,44 +751,44 @@ void RimPlotCurve::setSymbolLabel(const QString& label)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSymbolLabelPosition(RiuQwtSymbol::LabelPosition labelPosition)
|
||||
void RimPlotCurve::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition )
|
||||
{
|
||||
m_symbolLabelPosition = labelPosition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setSymbolSize(int sizeInPixels)
|
||||
void RimPlotCurve::setSymbolSize( int sizeInPixels )
|
||||
{
|
||||
m_symbolSize = sizeInPixels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setLineThickness(int thickness)
|
||||
void RimPlotCurve::setLineThickness( int thickness )
|
||||
{
|
||||
m_curveThickness = thickness;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::resetAppearance()
|
||||
{
|
||||
setColor(cvf::Color3f(cvf::Color3::BLACK));
|
||||
setSymbolEdgeColor(cvf::Color3f(cvf::Color3::BLACK));
|
||||
setLineThickness(2);
|
||||
setLineStyle(RiuQwtPlotCurve::STYLE_SOLID);
|
||||
setSymbol(RiuQwtSymbol::SYMBOL_NONE);
|
||||
setSymbolSkipDistance(10);
|
||||
setColor( cvf::Color3f( cvf::Color3::BLACK ) );
|
||||
setSymbolEdgeColor( cvf::Color3f( cvf::Color3::BLACK ) );
|
||||
setLineThickness( 2 );
|
||||
setLineStyle( RiuQwtPlotCurve::STYLE_SOLID );
|
||||
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
|
||||
setSymbolSkipDistance( 10 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::showLegend(bool show)
|
||||
void RimPlotCurve::showLegend( bool show )
|
||||
{
|
||||
m_showLegend = show;
|
||||
updateLegendEntryVisibilityNoPlotUpdate();
|
||||
@@ -789,11 +797,11 @@ void RimPlotCurve::showLegend(bool show)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setZOrder(double z)
|
||||
void RimPlotCurve::setZOrder( double z )
|
||||
{
|
||||
if (m_qwtPlotCurve != nullptr)
|
||||
if ( m_qwtPlotCurve != nullptr )
|
||||
{
|
||||
m_qwtPlotCurve->setZ(z);
|
||||
m_qwtPlotCurve->setZ( z );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,24 +820,23 @@ void RimPlotCurve::updateLegendEntryVisibilityAndPlotLegend()
|
||||
void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
|
||||
{
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType(ensembleCurveSet);
|
||||
if (ensembleCurveSet)
|
||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
if ( ensembleCurveSet )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(summaryPlot);
|
||||
this->firstAncestorOrThisOfType( summaryPlot );
|
||||
|
||||
bool showLegendInQwt = m_showLegend();
|
||||
if (summaryPlot)
|
||||
if ( summaryPlot )
|
||||
{
|
||||
|
||||
if (summaryPlot->ensembleCurveSetCollection()->curveSets().empty() && summaryPlot->curveCount() == 1)
|
||||
if ( summaryPlot->ensembleCurveSetCollection()->curveSets().empty() && summaryPlot->curveCount() == 1 )
|
||||
{
|
||||
// Disable display of legend if the summary plot has only one single curve
|
||||
showLegendInQwt = false;
|
||||
}
|
||||
}
|
||||
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, showLegendInQwt);
|
||||
m_qwtPlotCurve->setItemAttribute( QwtPlotItem::Legend, showLegendInQwt );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user