Beispiel #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
{
    RimProject* project = RiaApplication::instance()->project();
    CVF_ASSERT(project);

    RimSummaryPlot* plot = selectedSummaryPlot();
    if (plot)
    {
        RimSummaryCurve* newCurve = new RimSummaryCurve();
        cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount());
        newCurve->setColor(curveColor);

        plot->addCurveAndUpdate(newCurve);

        RimSummaryCase* defaultCase = nullptr; 
        if (project->activeOilField()->summaryCaseMainCollection()->summaryCaseCount() > 0)
        {
            defaultCase = project->activeOilField()->summaryCaseMainCollection()->summaryCase(0);
            newCurve->setSummaryCaseY(defaultCase);

            newCurve->setSummaryAddressY(RifEclipseSummaryAddress::fieldVarAddress("FOPT"));

            newCurve->loadDataAndUpdate(true);
        }
        
        plot->updateConnectedEditors();

        RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);

        RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
        mainPlotWindow->updateSummaryPlotToolBar();
    }
}
Beispiel #2
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve* curve, RimSummaryPlot* plot, bool forceVisible)
{
    RimSummaryCurve* curveCopy =
        dynamic_cast<RimSummaryCurve*>(curve->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
    CVF_ASSERT(curveCopy);

    if (forceVisible)
    {
        curveCopy->setCurveVisiblity(true);
    }

    plot->addCurveNoUpdate(curveCopy);

    // The curve creator is not a descendant of the project, and need to be set manually
    curveCopy->setSummaryCaseY(curve->summaryCaseY());
    curveCopy->initAfterReadRecursively();
    curveCopy->loadDataAndUpdate(false);
}
Beispiel #3
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::updatePreviewCurvesFromCurveDefinitions(
    const std::set<RiaSummaryCurveDefinition>& allCurveDefsToDisplay,
    const std::set<RiaSummaryCurveDefinition>& curveDefsToAdd,
    const std::set<RimSummaryCurve*>&          curvesToDelete)
{
    static bool                         warningDisplayed               = false;

    RimSummaryCase*                     prevCase = nullptr;
    std::set<RiaSummaryCurveDefinition> summaryCurveDefsToDisplay;

    // Ignore curve sets when assigning colors to singe summary curves
    for (const auto& def : allCurveDefsToDisplay)
    {
        if (!def.isEnsembleCurve()) summaryCurveDefsToDisplay.insert(def);
    }

    RimSummaryCurveAppearanceCalculator curveLookCalc(
        summaryCurveDefsToDisplay, getAllSummaryCaseNames(), getAllSummaryWellNames());
    initCurveAppearanceCalculator(curveLookCalc);

    // Delete curves
    for (const auto& curve : curvesToDelete)
    {
        m_previewPlot->deleteCurve(curve);
    }

    size_t ensembleCurveCnt = ensembleCurveCount(allCurveDefsToDisplay);

    // Add new curves
    for (const auto& curveDef : curveDefsToAdd)
    {
        RimSummaryCase*  currentCase = curveDef.summaryCase();
        RimSummaryCurve* curve       = new RimSummaryCurve();
        curve->setSummaryCaseY(currentCase);
        curve->setSummaryAddressY(curveDef.summaryAddress());
        curve->applyCurveAutoNameSettings(*m_curveNameConfig());

        if (curveDef.isEnsembleCurve())
        {
            // Find curveSet
            RimEnsembleCurveSet* curveSet = nullptr;
            for (const auto& cs : m_previewPlot->ensembleCurveSetCollection()->curveSets())
            {
                if (cs->summaryCaseCollection() == curveDef.ensemble() && cs->summaryAddress() == curveDef.summaryAddress())
                {
                    curveSet = cs;
                    break;
                }
            }
            if (!curveSet)
            {
                curveSet = new RimEnsembleCurveSet();
                curveSet->setSummaryCaseCollection(curveDef.ensemble());
                curveSet->setSummaryAddress(curveDef.summaryAddress());
                m_previewPlot->ensembleCurveSetCollection()->addCurveSet(curveSet);

                // Set single curve set color
                size_t colorIndex = m_previewPlot->ensembleCurveSetCollection()->curveSetCount();
                curveSet->setColor(RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(colorIndex));

                if (m_previewPlot->ensembleCurveSetCollection()->curveSets().size() > 1 && ensembleCurveCnt > ENSEMBLE_CURVE_COUNT_THRESHOLD)
                {
                    // Toggle off new curve set and display warning
                    curveSet->showCurves(false);

                    if (!warningDisplayed)
                    {
                        QMessageBox mbox;
                        mbox.setIcon(QMessageBox::Icon::Warning);
                        mbox.setInformativeText(
                            "The new curve set is hidden. Too many visible curve sets may lead to poor performance");
                        mbox.exec();
                        warningDisplayed = true;
                    }
                }
            }
            curveSet->addCurve(curve);
        }
        else
        {
            m_previewPlot->addCurveNoUpdate(curve);
            curveLookCalc.setupCurveLook(curve);
        }
    }

    m_previewPlot->loadDataAndUpdate();
    m_previewPlot->zoomAll();
    m_previewPlot->updateConnectedEditors();
    m_previewPlot->summaryCurveCollection()->updateConnectedEditors();
}