//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimPlotCurve::canCurveBeAttached() const { if (!m_parentQwtPlot) { return false; } if (!m_showCurve()) { return false; } bool isVisibleInPossibleParent = true; { RimSummaryCurveCollection* summaryCurveCollection = nullptr; this->firstAncestorOrThisOfType(summaryCurveCollection); if (summaryCurveCollection) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible(); RimEnsembleCurveSet* ensembleCurveSet = nullptr; firstAncestorOrThisOfType(ensembleCurveSet); if (ensembleCurveSet) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible(); } return isVisibleInPossibleParent; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimPlotCurve::updateCurveVisibility(bool updateParentPlot) { bool isVisibleInPossibleParent = true; { RimSummaryCurveCollection* summaryCurveCollection = nullptr; this->firstAncestorOrThisOfType(summaryCurveCollection); if (summaryCurveCollection) isVisibleInPossibleParent = summaryCurveCollection->isCurvesVisible(); RimEnsembleCurveSet* ensembleCurveSet = nullptr; firstAncestorOrThisOfType(ensembleCurveSet); if (ensembleCurveSet) isVisibleInPossibleParent = ensembleCurveSet->isCurvesVisible(); } if (m_showCurve() && m_parentQwtPlot && isVisibleInPossibleParent) { m_qwtPlotCurve->attach(m_parentQwtPlot); } else { m_qwtPlotCurve->detach(); } if (updateParentPlot) { updateZoomInParentPlot(); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_showCurve) { this->updateCurveVisibility(true); if (m_showCurve()) loadDataAndUpdate(true); } 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) { 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() == RiuQwtPlotCurve::STYLE_NONE); m_curveInterpolation.uiCapability()->setUiReadOnly(m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE); } } else if (changedField == &m_isUsingAutoName) { if (!m_isUsingAutoName) { m_customCurveName = createCurveAutoName(); } updateCurveNameAndUpdatePlotLegendAndTitle(); } else if (changedField == &m_showLegend) { updateLegendEntryVisibilityAndPlotLegend(); } else if (changedField == &m_showErrorBars) { m_qwtPlotCurve->showErrorBars(m_showErrorBars); updateCurveAppearance(); } RiuPlotMainWindowTools::refreshToolbars(); if (m_parentQwtPlot) m_parentQwtPlot->replot(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_showCurve) { this->updateCurveVisibility(true); if (m_showCurve()) loadDataAndUpdate(true); } else if (changedField == &m_curveName) { m_customCurveName = m_curveName; updateCurveNameAndUpdatePlotLegend(); } else if (&m_curveColor == changedField || &m_curveThickness == changedField || &m_pointSymbol == changedField || &m_lineStyle == changedField || &m_symbolSkipPixelDistance == changedField || &m_curveInterpolation == changedField) { updateCurveAppearance(); } else if (changedField == &m_isUsingAutoName) { if (!m_isUsingAutoName) { m_customCurveName = createCurveAutoName(); } updateCurveNameAndUpdatePlotLegend(); } else if (changedField == &m_showLegend) { updateLegendEntryVisibilityAndPlotLegend(); } if (m_parentQwtPlot) m_parentQwtPlot->replot(); }