コード例 #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewSummaryPlotFeature::createNewSummaryPlot(RimSummaryPlotCollection* summaryPlotColl, RimSummaryCase* summaryCase)
{
    RimSummaryPlot* plot = new RimSummaryPlot();
    summaryPlotColl->m_summaryPlots().push_back(plot);

    plot->setDescription(QString("Summary Plot %1").arg(summaryPlotColl->m_summaryPlots.size()));

    RimSummaryCurveFilter* newCurveFilter = new RimSummaryCurveFilter();

    if (summaryCase)
    {
        newCurveFilter->createCurves(summaryCase, RiaApplication::instance()->preferences()->defaultCurveFilter());
    }

    plot->addCurveFilter(newCurveFilter);

    summaryPlotColl->updateConnectedEditors();
    plot->loadDataAndUpdate();

    RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
    if (mainPlotWindow)
    {
        mainPlotWindow->selectAsCurrentItem(newCurveFilter);
        mainPlotWindow->setExpanded(newCurveFilter, true);
    }
}
コード例 #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection(RimSummaryPlot *sourcePlot)
{
    RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlotCollection*>();

    if (plotColl)
    {
        RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>(sourcePlot->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
        CVF_ASSERT(newSummaryPlot);

        plotColl->summaryPlots.push_back(newSummaryPlot);

        // Resolve references after object has been inserted into the data model
        newSummaryPlot->resolveReferencesRecursively();
        newSummaryPlot->initAfterReadRecursively();

        QString nameOfCopy = QString("Copy of ") + newSummaryPlot->description();
        newSummaryPlot->setDescription(nameOfCopy);

        plotColl->updateConnectedEditors();

        newSummaryPlot->loadDataAndUpdate();
    }
}