//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewValveTemplateFeature::selectValveTemplateAndUpdate(RimValveTemplate* valveTemplate) { valveTemplate->loadDataAndUpdate(); RimValveTemplateCollection* templateCollection = nullptr; valveTemplate->firstAncestorOrThisOfType(templateCollection); if (templateCollection) { templateCollection->updateConnectedEditors(); } RimProject* project = RiaApplication::instance()->project(); std::vector<Rim3dView*> views; project->allVisibleViews(views); for (Rim3dView* view : views) { if (dynamic_cast<RimEclipseView*>(view)) { view->updateConnectedEditors(); } } Riu3DMainWindowTools::selectAsCurrentItem(valveTemplate); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) { RiaApplication* app = RiaApplication::instance(); QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID"); QString fileName = QFileDialog::getOpenFileName(nullptr, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)"); if (fileName.isEmpty()) return; RimProject* project = RiaApplication::instance()->project(); CVF_ASSERT(project); RimOilField* oilfield = project->activeOilField(); if (oilfield == nullptr) return; RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection(); if (fracDefColl) { RimStimPlanFractureTemplate* fractureDef = new RimStimPlanFractureTemplate(); fracDefColl->addFractureTemplate(fractureDef); QFileInfo stimplanfileFileInfo(fileName); QString name = stimplanfileFileInfo.baseName(); if (name.isEmpty()) { name = "StimPlan Fracture Template"; } fractureDef->setName(name); fractureDef->setFileName(fileName); fractureDef->loadDataAndUpdate(); fractureDef->setDefaultsBasedOnXMLfile(); fractureDef->setDefaultWellDiameterFromUnit(); fractureDef->updateFractureGrid(); fracDefColl->updateConnectedEditors(); std::vector<Rim3dView*> views; project->allVisibleViews(views); for (Rim3dView* view : views) { if (dynamic_cast<RimEclipseView*>(view)) { view->updateConnectedEditors(); } } Riu3DMainWindowTools::selectAsCurrentItem(fractureDef); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiuSelectionChangedHandler::scheduleUpdateForAllVisibleViews() const { RimProject* proj = RiaApplication::instance()->project(); if (proj) { std::vector<Rim3dView*> visibleViews; proj->allVisibleViews(visibleViews); for (size_t i = 0; i < visibleViews.size(); i++) { visibleViews[i]->createHighlightAndGridBoxDisplayModelWithRedraw(); } } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- 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(); } } }