Example #1
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
{
    RimEnsembleCurveSet* ensembleCurveSet = nullptr;
    this->firstAncestorOrThisOfType(ensembleCurveSet);
    if (ensembleCurveSet)
    {
        return;
    }

    RimSummaryPlot* summaryPlot = nullptr;
    this->firstAncestorOrThisOfType(summaryPlot);

    if (summaryPlot)
    {
        bool showLegendInQwt = m_showLegend();

        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);
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicClearSourceSteppingSummaryCurveFeature::isCommandEnabled()
{
    std::vector<caf::PdmObject*> objects;
    caf::SelectionManager::instance()->objectsByType(&objects);

    if (objects.size() == 1)
    {
        auto c = objects[0];

        RimSummaryPlot* summaryPlot = nullptr;
        c->firstAncestorOrThisOfTypeAsserted(summaryPlot);
        if (summaryPlot)
        {
            if (summaryPlot->ensembleCurveSetCollection()->curveSetForSourceStepping()
                || summaryPlot->summaryCurveCollection()->curveForSourceStepping())
            {
                return true;
            }
        }
    }

    return false;
}
Example #3
0
//--------------------------------------------------------------------------------------------------
/// Populate curve creator from the given curve collection
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::populateCurveCreator(const RimSummaryPlot& sourceSummaryPlot)
{
    std::vector<RiaSummaryCurveDefinition> curveDefs;

    m_previewPlot->deleteAllSummaryCurves();
    m_previewPlot->ensembleCurveSetCollection()->deleteAllCurveSets();

    for (const auto& curve : sourceSummaryPlot.summaryCurves())
    {
        curveDefs.push_back(RiaSummaryCurveDefinition(curve->summaryCaseY(), curve->summaryAddressY()));

        // Copy curve object to the preview plot
        copyCurveAndAddToPlot(curve, m_previewPlot.get(), true);
    }

    RimEnsembleCurveSetCollection* previewCurveSetColl = m_previewPlot->ensembleCurveSetCollection();
    for (const auto& curveSet : sourceSummaryPlot.ensembleCurveSetCollection()->curveSets())
    {
        RimEnsembleCurveSet* newCurveSet = curveSet->clone();
        previewCurveSetColl->addCurveSet(newCurveSet);

        RimSummaryCaseCollection* ensemble = curveSet->summaryCaseCollection();
        for (const auto& curve : curveSet->curves())
        {
            curveDefs.push_back(RiaSummaryCurveDefinition(curve->summaryCaseY(), curve->summaryAddressY(), ensemble));
        }
    }

    m_previewPlot->copyAxisPropertiesFromOther(sourceSummaryPlot);
    m_previewPlot->enableAutoPlotTitle(sourceSummaryPlot.autoPlotTitle());
    m_previewPlot->updatePlotTitle();
    m_previewPlot->updateAxes();

    m_summaryCurveSelectionEditor->summaryAddressSelection()->setSelectedCurveDefinitions(curveDefs);

    updateAppearanceEditor();
}