mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3132 Increase legend sample line lengths and scale by curve thickness
* Otherwise we can't distinguish between curves in the legend.
This commit is contained in:
parent
a898f909e1
commit
3dec239c99
@ -159,9 +159,21 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
|
||||
|| &m_pointSymbol == changedField
|
||||
|| &m_lineStyle == changedField
|
||||
|| &m_symbolSkipPixelDistance == changedField
|
||||
|| &m_curveInterpolation == changedField)
|
||||
|| &m_curveInterpolation == changedField
|
||||
|| &m_symbolSize)
|
||||
{
|
||||
updateCurveAppearance();
|
||||
|
||||
if (&m_pointSymbol == changedField)
|
||||
{
|
||||
m_symbolSize.uiCapability()->setUiReadOnly(m_pointSymbol() == RimPlotCurve::SYMBOL_NONE);
|
||||
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly(m_pointSymbol() == RimPlotCurve::SYMBOL_NONE);
|
||||
}
|
||||
else if (&m_lineStyle == changedField)
|
||||
{
|
||||
m_curveThickness.uiCapability()->setUiReadOnly(m_lineStyle() == RimPlotCurve::STYLE_NONE);
|
||||
m_curveInterpolation.uiCapability()->setUiReadOnly(m_lineStyle() == RimPlotCurve::STYLE_NONE);
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_isUsingAutoName)
|
||||
{
|
||||
@ -233,6 +245,17 @@ void RimPlotCurve::updateCurveVisibility(bool updateParentPlot)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::initAfterRead()
|
||||
{
|
||||
m_symbolSize.uiCapability()->setUiReadOnly(m_pointSymbol() == RimPlotCurve::SYMBOL_NONE);
|
||||
m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly(m_pointSymbol() == RimPlotCurve::SYMBOL_NONE);
|
||||
m_curveThickness.uiCapability()->setUiReadOnly(m_lineStyle() == RimPlotCurve::STYLE_NONE);
|
||||
m_curveInterpolation.uiCapability()->setUiReadOnly(m_lineStyle() == RimPlotCurve::STYLE_NONE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -377,10 +400,12 @@ void RimPlotCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_curveColor);
|
||||
uiOrdering.add(&m_pointSymbol);
|
||||
uiOrdering.add(&m_symbolSize);
|
||||
uiOrdering.add(&m_symbolSkipPixelDistance);
|
||||
uiOrdering.add(&m_curveThickness);
|
||||
uiOrdering.add(&m_lineStyle);
|
||||
uiOrdering.add(&m_curveThickness);
|
||||
uiOrdering.add(&m_curveInterpolation);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -488,6 +513,22 @@ void RimPlotCurve::updateCurveAppearance()
|
||||
m_qwtPlotCurve->setSymbolSkipPixelDistance(m_symbolSkipPixelDistance());
|
||||
|
||||
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.
|
||||
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||
|
||||
int symbolWidth = 0;
|
||||
if (symbol)
|
||||
{
|
||||
symbolWidth = symbol->boundingRect().size().width() + 2;
|
||||
}
|
||||
|
||||
int width = std::max(10 * m_curveThickness, (symbolWidth * 3) / 2);
|
||||
|
||||
legendIconSize.setWidth(width);
|
||||
m_qwtPlotCurve->setLegendIconSize(legendIconSize);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -112,7 +112,7 @@ protected:
|
||||
virtual QString createCurveAutoName() = 0;
|
||||
virtual void updateZoomInParentPlot() = 0;
|
||||
virtual void onLoadDataAndUpdate(bool updateParentPlot) = 0;
|
||||
|
||||
virtual void initAfterRead() override;
|
||||
void updateCurvePresentation(bool updatePlotLegend);
|
||||
|
||||
void updateOptionSensitivity();
|
||||
|
@ -134,15 +134,16 @@ void RigGeoMechWellLogExtractor::wellPathAngles(const RigFemResultAddress& resAd
|
||||
cvf::Vec3d projectedTangentXY = wellPathTangent;
|
||||
projectedTangentXY.z() = 0.0;
|
||||
|
||||
// Do tangentXY to true north for counter clockwise angles.
|
||||
// Do tangentXY to true north for clockwise angles.
|
||||
double dotProduct = projectedTangentXY * trueNorth;
|
||||
double crossProduct = (projectedTangentXY ^ trueNorth) * up;
|
||||
// http://www.glossary.oilfield.slb.com/Terms/a/azimuth.aspx
|
||||
azimuth = cvf::Math::toDegrees(std::atan2(crossProduct, dotProduct));
|
||||
if (azimuth < 0.0)
|
||||
{
|
||||
// Straight atan2 gives angle from -PI to PI yielding angles from -180 to 180.
|
||||
// We want angles from 0 to 360, so add 180 degrees.
|
||||
// Straight atan2 gives angle from -PI to PI yielding angles from -180 to 180
|
||||
// where the negative angles are counter clockwise.
|
||||
// To get all positive clockwise angles, we add 360 degrees to negative angles.
|
||||
azimuth = azimuth + 360.0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user