//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimGridInfo::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { RimGridView* rimView = nullptr; this->firstAncestorOrThisOfType(rimView); rimView->scheduleCreateDisplayModelAndRedraw(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- 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(); } } } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid) { RimViewController* masterViewLink = m_reservoirView->viewController(); CVF_ASSERT(masterViewLink); RimGridView* masterView = masterViewLink->ownerViewLinker()->masterView(); // get cell visibility #if 1 cvf::ref<cvf::UByteArray> totCellVisibility = masterView->currentTotalCellVisibility(); #else // Could get something more like std::vector<std::vector<cvf::UByteArray*> > gridsWithCellSetVisibility = masterView->getAllGridsCurrentCellSetsCellVisibility(); #endif CVF_ASSERT(cellVisibility != nullptr); CVF_ASSERT(grid != nullptr); size_t gridCellCount = grid->cellCount(); cellVisibility->resize(gridCellCount); cellVisibility->setAll(false); const RigCaseToCaseCellMapper* cellMapper = masterViewLink->cellMapper(); for (size_t lcIdx = 0; lcIdx < gridCellCount; ++lcIdx) { #if 1 int reservoirCellIdx = static_cast<int>(grid->reservoirCellIndex(lcIdx)); int cellCount = 0; const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndices(reservoirCellIdx, &cellCount); for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx) { (*cellVisibility)[lcIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show } #else const RigGridCells& masterCaseCells = cellMapper->masterCaseGridAndLocalCellIndex(grid->gridIndex, lcIdx); for (int mcIdx = 0; mcIdx < masterCaseCells.cellCount(); ++mcIdx) { int cellSetCount = gridsWithCellSetVisibility[ masterCaseCells.gridIndex[mcIdx] ].size(); for (int csIdx = 0; csIdx < cellSetCount; ++csIdx) { (*cellVisibility)[lcIdx] |= gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]][masterCaseCells.cellIndex[mcIdx]]; } } #endif } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimGridCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_isActive) { RimGridView* rimView = nullptr; this->firstAncestorOrThisOfType(rimView); CVF_ASSERT(rimView); if (rimView) rimView->showGridCells(m_isActive); updateUiIconFromState(m_isActive); } RimGridView* rimView = nullptr; this->firstAncestorOrThisOfType(rimView); rimView->scheduleCreateDisplayModelAndRedraw(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionBoxesToOtherViews(RimCase& gridCase, std::vector<RimIntersectionBox*> intersectionBoxes) { for (RimIntersectionBox* intersectionBox : intersectionBoxes) { for (Rim3dView* const view : gridCase.views()) { RimGridView* currGridView = dynamic_cast<RimGridView*>(view); RimGridView* parentView = nullptr; intersectionBox->firstAncestorOrThisOfType(parentView); if (currGridView && parentView != nullptr && parentView != currGridView) { RimIntersectionCollection* destCollection = currGridView->crossSectionCollection(); RimIntersectionBox* copy = dynamic_cast<RimIntersectionBox*>(intersectionBox->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance())); CVF_ASSERT(copy); destCollection->appendIntersectionBoxAndUpdate(copy); } } } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicRangeFilterNewExec::redo() { RimCellRangeFilter* rangeFilter = createRangeFilter(); if (rangeFilter) { m_cellRangeFilterCollection->rangeFilters.push_back(rangeFilter); rangeFilter->setDefaultValues(); applyCommandDataOnFilter(rangeFilter); m_cellRangeFilterCollection->updateDisplayModeNotifyManagedViews(nullptr); m_cellRangeFilterCollection->updateConnectedEditors(); Riu3DMainWindowTools::selectAsCurrentItem(rangeFilter); RimGridView* view = nullptr; m_cellRangeFilterCollection->firstAncestorOrThisOfTypeAsserted(view); //Enable display of grid cells, to be able to show generated range filter view->showGridCells(true); } }