//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionsToOtherViews(RimCase& gridCase, std::vector<RimIntersection*> intersections)
{
    for (RimIntersection* intersection : intersections)
    {
        for (Rim3dView* const view : gridCase.views())
        {
            RimGridView* currGridView = dynamic_cast<RimGridView*>(view);
            RimGridView* parentView = nullptr;
            intersection->firstAncestorOrThisOfType(parentView);

            if (currGridView && parentView != nullptr && parentView != currGridView)
            {
                RimIntersectionCollection* destCollection = currGridView->crossSectionCollection();

                RimIntersection* copy = dynamic_cast<RimIntersection*>(intersection->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
                CVF_ASSERT(copy);

                destCollection->appendIntersectionAndUpdate(copy);

                // Resolve references after object has been inserted into the project data model
                copy->resolveReferencesRecursively();
                copy->updateConnectedEditors();
            }
        }
    }
}
Beispiel #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicHideIntersectionFeature::onActionTriggered(bool isChecked)
{
    Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
    if (!activeView) return;

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

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

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

        activeView->scheduleCreateDisplayModelAndRedraw();
    }
}