Exemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if (changedField == &isActive)
    {
        Rim3dView* rimView = nullptr;
        firstAncestorOrThisOfType(rimView);
        if (rimView)
        {
            rimView->scheduleCreateDisplayModelAndRedraw();
        }
    }
}
Exemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimCellRangeFilter::isRangeFilterControlled() const
{
    Rim3dView* rimView = nullptr;
    firstAncestorOrThisOfTypeAsserted(rimView);

    bool isRangeFilterControlled = false;
    if (rimView && rimView->viewController() && rimView->viewController()->isRangeFiltersControlled())
    {
        isRangeFilterControlled = true;
    }

    return isRangeFilterControlled;
}
Exemplo n.º 3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::appendIntersectionBoxAndUpdate(RimIntersectionBox* intersectionBox)
{
    m_intersectionBoxes.push_back(intersectionBox);

    updateConnectedEditors();
    Riu3DMainWindowTools::selectAsCurrentItem(intersectionBox);

    Rim3dView* rimView = nullptr;
    firstAncestorOrThisOfType(rimView);
    if (rimView)
    {
        rimView->scheduleCreateDisplayModelAndRedraw();
    }
}
Exemplo n.º 4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
{
    bool isPropertyFilterControlled = false;

    Rim3dView* rimView = nullptr;
    firstAncestorOrThisOfType(rimView);
    CVF_ASSERT(rimView);
    if (rimView)
    {
        RimViewController* vc = rimView->viewController();
        if (vc && vc->isPropertyFilterOveridden())
        {
            isPropertyFilterControlled = true;
        }
    }
   
    return isPropertyFilterControlled;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicHideIntersectionBoxFeature::onActionTriggered(bool isChecked)
{
    Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
    if (!activeView) return;

    Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
    RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);

    RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>(selItem);
    if (!generalSelectionItem) return;

    RimIntersectionBox* intersectionBox = dynamic_cast<RimIntersectionBox*>(generalSelectionItem->m_object);
    if (intersectionBox)
    {
        intersectionBox->isActive = false;
        intersectionBox->updateConnectedEditors();

        activeView->scheduleCreateDisplayModelAndRedraw();
    }
}
Exemplo n.º 6
0
//--------------------------------------------------------------------------------------------------
/// Internal functions
//--------------------------------------------------------------------------------------------------
Rim2dIntersectionView* corresponding2dIntersectionView(RimSimWellInView *simWellInView)
{
    Rim3dView* tdView;
    simWellInView->firstAncestorOrThisOfType(tdView);

    std::vector<RimIntersectionCollection*> intersectionColls;
    if (tdView)
    {
        tdView->descendantsIncludingThisOfType(intersectionColls);
        if (intersectionColls.size() == 1)
        {
            for (const auto intersection : intersectionColls[0]->intersections())
            {
                if (intersection->simulationWell() == simWellInView)
                {
                    return intersection->correspondingIntersectionView();
                }
            }
        }
    }
    return nullptr;
}
Exemplo n.º 7
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& eventObject)
{
    if (eventObject.m_partAndTriangleIndexPairs.empty()) return false;

    const caf::PdmObject* objectToSelect = nullptr;

    cvf::uint wellPathTriangleIndex = cvf::UNDEFINED_UINT;
    const RivWellPathSourceInfo* wellPathSourceInfo = nullptr;

    if(!eventObject.m_partAndTriangleIndexPairs.empty())
    {
        const auto & partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front();
        const cvf::Part* part = partAndTriangleIndexPair.first;
        
        const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo());
        if (sourceInfo)
        {
            if (dynamic_cast<RimPerforationInterval*>(sourceInfo->object()))
            {
                objectToSelect = sourceInfo->object();

                if (eventObject.m_partAndTriangleIndexPairs.size() > 1)
                {
                    const auto& secondPair = eventObject.m_partAndTriangleIndexPairs[1];
                    const cvf::Part* secondPickedPart = secondPair.first;
                    if (secondPickedPart)
                    {
                        auto wellPathSourceCandidate = dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
                        if (wellPathSourceCandidate)
                        {
                            RimWellPath* perforationWellPath = nullptr;
                            objectToSelect->firstAncestorOrThisOfType(perforationWellPath);
                            if (perforationWellPath == wellPathSourceCandidate->wellPath())
                            {
                                wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
                                wellPathTriangleIndex = secondPair.second;
                            }
                        }
                    }
                }
            }
        }

        if (part && dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo()))
        {
            wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo());
            wellPathTriangleIndex = partAndTriangleIndexPair.second;
        }
    }

    if (wellPathSourceInfo)
    {
        Rim3dView* rimView = RiaApplication::instance()->activeReservoirView();
        if (!rimView) return false;

        cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
        cvf::Vec3d pickedPositionInUTM = transForm->transformToDomainCoord(eventObject.m_globalIntersectionPoint);

        if (auto intersectionView = dynamic_cast<Rim2dIntersectionView*>(rimView))
        {
            pickedPositionInUTM = intersectionView->transformToUtm(pickedPositionInUTM);
        }

        double measuredDepth = wellPathSourceInfo->measuredDepth(wellPathTriangleIndex, pickedPositionInUTM);

        // NOTE: This computation was used to find the location for a fracture when clicking on a well path
        // It turned out that the computation was a bit inaccurate
        // Consider to use code in RigSimulationWellCoordsAndMD instead
        cvf::Vec3d trueVerticalDepth = wellPathSourceInfo->closestPointOnCenterLine(wellPathTriangleIndex, pickedPositionInUTM);

        QString wellPathText;
        wellPathText += QString("Well path name : %1\n").arg(wellPathSourceInfo->wellPath()->name());
        wellPathText += QString("Measured depth : %1\n").arg(measuredDepth);

        QString formattedText;
        formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", trueVerticalDepth.x(), trueVerticalDepth.y(), -trueVerticalDepth.z());
        wellPathText += formattedText;

        RiuMainWindow::instance()->setResultInfo(wellPathText);

        if (objectToSelect)
        {
            RiuMainWindow::instance()->selectAsCurrentItem(objectToSelect);
        }
        else
        {
            RiuMainWindow::instance()->selectAsCurrentItem(wellPathSourceInfo->wellPath());
        }

        return true;
    }

    return false;
}
Exemplo n.º 8
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();
        }
    }
}