Esempio n. 1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    this->RimPlotCurve::fieldChangedByUi(changedField,oldValue,newValue);
    
    RimSummaryPlot* plot = nullptr;
    firstAncestorOrThisOfType(plot);
    CVF_ASSERT(plot);

    if(changedField == &m_uiFilterResultSelection)
    {
        if (0 <= m_uiFilterResultSelection() && static_cast<size_t>(m_uiFilterResultSelection()) < summaryReader()->allResultAddresses().size())
        {
            m_curveVariable->setAddress(summaryReader()->allResultAddresses()[m_uiFilterResultSelection()]);
        }
        else
        {
            m_curveVariable->setAddress(RifEclipseSummaryAddress());
        }

        this->loadDataAndUpdate();

        plot->updateAxes();
    } 
    else if (&m_showCurve == changedField)
    {
        plot->updateAxes();
    }
    else if (changedField == &m_plotAxis)
    {
        updateQwtPlotAxis();

        plot->updateAxes();
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
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);
    }
}
Esempio n. 3
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();
    }
}
Esempio n. 4
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);
    }
}
Esempio n. 5
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::updateZoomInParentPlot()
{
    RimSummaryPlot* plot = nullptr;
    firstAncestorOrThisOfType(plot);

    plot->updateZoomInQwt(); 
}
Esempio n. 6
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar()
{
    RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>(m_activePlotViewWindow.p());
    if (summaryPlot)
    {
        std::vector<caf::PdmFieldHandle*> toolBarFields;
        toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
    
        if (!m_summaryPlotToolBarEditor->isEditorDataValid(toolBarFields))
        {
            m_summaryPlotToolBarEditor->setFields(toolBarFields);
            m_summaryPlotToolBarEditor->updateUi();
        }

        m_summaryPlotToolBarEditor->show();
    }
    else
    {
        m_summaryPlotToolBarEditor->clear();

        m_summaryPlotToolBarEditor->hide();
    }

    refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
                                                     const QVariant&            oldValue,
                                                     const QVariant&            newValue)
{
    if (changedField == &m_showCurves)
    {
        loadDataAndUpdate(true);

        RimSummaryPlot* summaryPlot = nullptr;
        this->firstAncestorOrThisOfTypeAsserted(summaryPlot);
        summaryPlot->updateConnectedEditors();
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot)
{
    for (RimEnsembleCurveSet* curveSet : m_curveSets)
    {
        curveSet->loadDataAndUpdate(false);
    }

    if (updateParentPlot)
    {
        RimSummaryPlot* parentPlot;
        firstAncestorOrThisOfTypeAsserted(parentPlot);
        parentPlot->updateAll();
    }
}
Esempio n. 9
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::createNewPlot()
{
    RimProject* proj = RiaApplication::instance()->project();

    RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection();
    if (summaryPlotColl)
    {
        RimSummaryPlot* newSummaryPlot = nullptr;
        if (m_useAutoPlotTitleProxy())
        {
            newSummaryPlot = summaryPlotColl->createSummaryPlotWithAutoTitle();
        }
        else
        {
            QString candidatePlotName;
            if (m_previewPlot)
            {
                candidatePlotName = m_previewPlot->generatedPlotTitleFromAllCurves();
            }

            {
                bool ok           = false;
                candidatePlotName = QInputDialog::getText(nullptr,
                                                          "New Summary Plot Name",
                                                          "New Summary Plot Name",
                                                          QLineEdit::Normal,
                                                          candidatePlotName,
                                                          &ok,
                                                          RiuTools::defaultDialogFlags());
                if (!ok)
                {
                    return;
                }

                newSummaryPlot = summaryPlotColl->createNamedSummaryPlot(candidatePlotName);
            }
        }

        if (newSummaryPlot)
        {
            newSummaryPlot->loadDataAndUpdate();

            summaryPlotColl->updateConnectedEditors();

            m_targetPlot = newSummaryPlot;
            updateTargetPlot();
        }
    }
}
Esempio n. 10
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar(bool forceUpdateUi)
{
    RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>(m_activePlotViewWindow.p());
    if (summaryPlot)
    {
        std::vector<caf::PdmFieldHandle*> toolBarFields;

        RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr;

        caf::PdmObjectHandle* selectedObj =
            dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
        if (selectedObj)
        {
            selectedObj->firstAncestorOrThisOfType(ensembleCurveSetColl);
        }

        if (ensembleCurveSetColl)
        {
            toolBarFields = ensembleCurveSetColl->fieldsToShowInToolbar();
        }
        else
        {
            toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
        }

        if (!m_summaryPlotToolBarEditor->isEditorDataValid(toolBarFields))
        {
            m_summaryPlotToolBarEditor->setFields(toolBarFields);
        }
        else if (forceUpdateUi)
        {
            m_summaryPlotToolBarEditor->updateUi();
        }

        m_summaryPlotToolBarEditor->updateUi();

        m_summaryPlotToolBarEditor->show();
    }
    else
    {
        m_summaryPlotToolBarEditor->clear();

        m_summaryPlotToolBarEditor->hide();
    }

    refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSummaryCaseCollection* ensemble)
{
    RiaApplication* app  = RiaApplication::instance();
    RimProject*     proj = app->project();

    RimSummaryPlotCollection* summaryPlotCollection = proj->mainPlotCollection->summaryPlotCollection();
    RimSummaryPlot*           plot                  = summaryPlotCollection->createSummaryPlotWithAutoTitle();

    RimEnsembleCurveSet* curveSet = RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet(plot, ensemble);
    plot->loadDataAndUpdate();
    summaryPlotCollection->updateConnectedEditors();

    RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
    if (mainPlotWindow)
    {
        mainPlotWindow->selectAsCurrentItem(curveSet);
        mainPlotWindow->updateSummaryPlotToolBar();
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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;
}
Esempio n. 13
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();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
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();
    }
}
Esempio n. 15
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
                                                    const QVariant& newValue)
{
    RimSummaryCurveCollection* curveCollection = nullptr;
    this->firstAncestorOrThisOfTypeAsserted(curveCollection);

    bool triggerLoadDataAndUpdate = false;

    if (changedField == &m_summaryCase)
    {
        if (m_summaryCase())
        {
            for (auto curve : curveCollection->curves())
            {
                if (isYAxisStepping())
                {
                    curve->setSummaryCaseY(m_summaryCase);
                }

                if (isXAxisStepping())
                {
                    curve->setSummaryCaseX(m_summaryCase);
                }
            }

            triggerLoadDataAndUpdate = true;
        }

        m_wellName.uiCapability()->updateConnectedEditors();
        m_wellGroupName.uiCapability()->updateConnectedEditors();
        m_region.uiCapability()->updateConnectedEditors();
        m_quantity.uiCapability()->updateConnectedEditors();
    }
    else if (changedField == &m_wellName)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
                {
                    adr.setWellName(m_wellName().toStdString());

                    curve->setSummaryAddressY(adr);
                }
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
                {
                    adr.setWellName(m_wellName().toStdString());

                    curve->setSummaryAddressX(adr);
                }
            }
        }

        triggerLoadDataAndUpdate = true;
    }
    else if (changedField == &m_region)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
                {
                    adr.setRegion(m_region());

                    curve->setSummaryAddressY(adr);
                }
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
                {
                    adr.setRegion(m_region());

                    curve->setSummaryAddressX(adr);
                }
            }
        }

        triggerLoadDataAndUpdate = true;
    }
    else if (changedField == &m_quantity)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                adr.setQuantityName(m_quantity().toStdString());

                curve->setSummaryAddressY(adr);
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                adr.setQuantityName(m_quantity().toStdString());

                curve->setSummaryAddressX(adr);
            }
        }

        triggerLoadDataAndUpdate = true;
    }
    else if (changedField == &m_wellGroupName)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
                {
                    adr.setWellGroupName(m_wellGroupName().toStdString());

                    curve->setSummaryAddressY(adr);
                }
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
                {
                    adr.setWellGroupName(m_wellGroupName().toStdString());

                    curve->setSummaryAddressX(adr);
                }
            }
        }

        triggerLoadDataAndUpdate = true;
    }

    if (triggerLoadDataAndUpdate)
    {
        RimSummaryPlot* summaryPlot = nullptr;
        this->firstAncestorOrThisOfTypeAsserted(summaryPlot);

        summaryPlot->updatePlotTitle();
        summaryPlot->loadDataAndUpdate();

        RimSummaryCrossPlot* summaryCrossPlot = dynamic_cast<RimSummaryCrossPlot*>(summaryPlot);
        if (summaryCrossPlot)
        {
            // Trigger update of curve collection (and summary toolbar in main window), as the visibility of combo boxes might
            // have been changed due to the updates in this function
            curveCollection->updateConnectedEditors();

            RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
            mainPlotWindow->updateSummaryPlotToolBar();
        }
    }
}
Esempio n. 16
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicDeleteItemExec::redo()
{
    caf::PdmFieldHandle* field = caf::PdmReferenceHelper::fieldFromReference(m_commandData->m_rootObject, m_commandData->m_pathToField);

    caf::PdmChildArrayFieldHandle* listField = dynamic_cast<caf::PdmChildArrayFieldHandle*>(field);
    if (listField)
    {
        std::vector<caf::PdmObjectHandle*> children;
        listField->childObjects(&children);

        caf::PdmObjectHandle* obj = children[m_commandData->m_indexToObject];
        caf::SelectionManager::instance()->removeObjectFromAllSelections(obj);

        std::vector<caf::PdmObjectHandle*> referringObjects;
        obj->objectsWithReferringPtrFields(referringObjects);

        if (m_commandData->m_deletedObjectAsXml().isEmpty())
        {
            m_commandData->m_deletedObjectAsXml = xmlObj(obj)->writeObjectToXmlString();
        }

        delete obj;

        listField->erase(m_commandData->m_indexToObject);

        caf::PdmObjectHandle* parentObj = listField->ownerObject();
        parentObj->uiCapability()->updateConnectedEditors();
        
        Rim3dView* view = nullptr;
        parentObj->firstAncestorOrThisOfType(view);

        // Range Filters

        RimCellRangeFilterCollection* rangeFilterColl;
        parentObj->firstAncestorOrThisOfType(rangeFilterColl);

        if (rangeFilterColl)
        {
            rangeFilterColl->updateDisplayModeNotifyManagedViews(nullptr);
        }

        // Prop Filter

        RimEclipsePropertyFilterCollection* eclipsePropColl;
        parentObj->firstAncestorOrThisOfType(eclipsePropColl);
        
        RimGeoMechPropertyFilterCollection* geoMechPropColl;
        parentObj->firstAncestorOrThisOfType(geoMechPropColl);

        if (view && (eclipsePropColl || geoMechPropColl))
        {
            view->scheduleGeometryRegen(PROPERTY_FILTERED);
            view->scheduleCreateDisplayModelAndRedraw();
        }

        // Intersections

        RimIntersectionCollection* crossSectionColl;
        parentObj->firstAncestorOrThisOfType(crossSectionColl);
        if (view && crossSectionColl)
        {
            crossSectionColl->syncronize2dIntersectionViews();
            view->scheduleCreateDisplayModelAndRedraw();
        }
        else
        {
            RimCase* parentCase = dynamic_cast<RimCase*>(parentObj);
            if ( parentCase ) // A view was deleted. Need to update the list of intersection views
            {
                parentCase->intersectionViewCollection()->syncFromExistingIntersections(true);
            }
        }

        // SimWell Fractures
        RimSimWellInView* simWell;
        parentObj->firstAncestorOrThisOfType(simWell);
        if (view && simWell)
        {
            view->scheduleCreateDisplayModelAndRedraw();
        }

        RimFractureTemplateCollection* fracTemplateColl;
        parentObj->firstAncestorOrThisOfType(fracTemplateColl);
        if (fracTemplateColl)
        {
            RimProject* proj = nullptr;
            parentObj->firstAncestorOrThisOfType(proj);
            if (proj)
            {
                proj->createDisplayModelAndRedrawAllViews();
            }

            std::vector<Rim3dView*> views;
            proj->allVisibleViews(views);
            for (Rim3dView* view : views)
            {
                if (dynamic_cast<RimEclipseView*>(view))
                {
                    view->updateConnectedEditors();
                }
            }
        }


        // Well paths

        RimWellPath* wellPath;
        parentObj->firstAncestorOrThisOfType(wellPath);

        if (wellPath)
        {
            wellPath->updateConnectedEditors();
        }

        RimWellPathCollection* wellPathColl;
        parentObj->firstAncestorOrThisOfType(wellPathColl);

        if (wellPathColl)
        {
            wellPathColl->scheduleRedrawAffectedViews();
            wellPathColl->uiCapability()->updateConnectedEditors();
        }

        // Update due to deletion of curves (not tracks, handled separatly)

        RimWellLogPlot* wellLogPlot;
        parentObj->firstAncestorOrThisOfType(wellLogPlot);
        if (wellLogPlot)
        {
            wellLogPlot->calculateAvailableDepthRange();
            wellLogPlot->updateDepthZoom();
        }

        RimWellLogTrack* wellLogPlotTrack;
        parentObj->firstAncestorOrThisOfType(wellLogPlotTrack);
        if (wellLogPlotTrack)
        {
            wellLogPlotTrack->updateXZoom();
        }
        
        // Update due to delete plots
        // Make sure the plot collection disappears with the last plot

        RimWellLogPlotCollection* wellLogPlotCollection = dynamic_cast<RimWellLogPlotCollection*>(parentObj);
        if (wellLogPlotCollection)
        {
            if (wellLogPlotCollection->wellLogPlots.empty())
            {
                RimProject* project = nullptr;
                parentObj->firstAncestorOrThisOfType(project);
                if (project)
                {
                    project->updateConnectedEditors();
                }
            }
        }
        
        // Linked views

        RimViewLinkerCollection* viewLinkerCollection = nullptr;
        parentObj->firstAncestorOrThisOfType(viewLinkerCollection);
        if (viewLinkerCollection)
        {
            viewLinkerCollection->uiCapability()->updateConnectedEditors();

            RimProject* project = nullptr;
            parentObj->firstAncestorOrThisOfType(project);
            if (project)
            {
                // Update visibility of top level Linked Views item in the project tree
                // Not visible if no views are linked
                project->uiCapability()->updateConnectedEditors();
            }
        }

        // Formation names

        RimFormationNamesCollection* formationNamesCollection;
        parentObj->firstAncestorOrThisOfType(formationNamesCollection);
        if (formationNamesCollection)
        {
            for(caf::PdmObjectHandle* reffingObj :referringObjects)
            {
                RimCase* aCase = dynamic_cast<RimCase*>(reffingObj);
                if (aCase) aCase->updateFormationNamesData();
            }
        }


        RimSummaryPlotCollection* summaryPlotCollection = nullptr;
        parentObj->firstAncestorOrThisOfType(summaryPlotCollection);
        if (summaryPlotCollection)
        {
            summaryPlotCollection->updateSummaryNameHasChanged();
            RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
            mainPlotWindow->updateSummaryPlotToolBar();
        }

        RimSummaryCrossPlotCollection* summaryCrossPlotCollection = nullptr;
        parentObj->firstAncestorOrThisOfType(summaryCrossPlotCollection);
        if (summaryCrossPlotCollection)
        {
            RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
            mainPlotWindow->updateSummaryPlotToolBar();
        }

        RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr;
        parentObj->firstAncestorOrThisOfType(ensembleCurveSetColl);
        if (ensembleCurveSetColl)
        {
            RimSummaryPlot* plot = nullptr;
            ensembleCurveSetColl->firstAncestorOrThisOfType(plot);
            if (plot) plot->updateConnectedEditors();
        }
    }
}
Esempio n. 17
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::onLoadDataAndUpdate()
{
    this->RimPlotCurve::updateCurvePresentation();

    m_selectedVariableDisplayField = QString::fromStdString(m_curveVariable->address().uiText());

    RifReaderEclipseSummary* reader = summaryReader();
    if (reader)
    {
        const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();

        for (size_t i = 0; i < allAddresses.size(); i++)
        {
            if (allAddresses[i].uiText() == m_curveVariable->address().uiText())
            {
                m_uiFilterResultSelection = static_cast<int>(i);
                updateConnectedEditors();
            }
        }
    }

    if (isCurveVisible())
    {
        std::vector<time_t> dateTimes = this->timeSteps();
        std::vector<double> values = this->yValues();

        RimSummaryPlot* plot = nullptr;
        firstAncestorOrThisOfType(plot);
        bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis());

        if (dateTimes.size() > 0 && dateTimes.size() == values.size())
        {
            if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
            {
                m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
            }
            else
            {
                double timeScale  = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();

                std::vector<double> times;
                if ( dateTimes.size() )
                {
                    time_t startDate = dateTimes[0];
                    for ( time_t& date: dateTimes )
                    {
                        times.push_back(timeScale*(date - startDate));
                    }
                }

                m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
            }
           
        }
        else
        {
            m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
        }

        updateZoomInParentPlot();

        if (m_parentQwtPlot) m_parentQwtPlot->replot();
    }

    updateQwtPlotAxis();
}