mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactored IJKslot commands
Preparations to create IJK slice commands in 3Dview
This commit is contained in:
parent
3e06028690
commit
b74364087a
@ -272,37 +272,7 @@ void RiuViewer::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuViewer::slotRangeFilterI()
|
void RiuViewer::slotRangeFilterI()
|
||||||
{
|
{
|
||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
createSliceRangeFilter(0);
|
||||||
if (!eclipseView) return;
|
|
||||||
|
|
||||||
size_t i, j, k;
|
|
||||||
ijkFromCellIndex(m_currentGridIdx, m_currentCellIndex, &i, &j, &k);
|
|
||||||
|
|
||||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
|
||||||
RimUiTreeModelPdm* myModel = mainWindow->uiPdmModel();
|
|
||||||
if (myModel)
|
|
||||||
{
|
|
||||||
RimCellRangeFilterCollection* rangeFilterCollection = eclipseView->rangeFilterCollection();
|
|
||||||
|
|
||||||
QModelIndex collectionModelIndex = myModel->getModelIndexFromPdmObject(rangeFilterCollection);
|
|
||||||
|
|
||||||
QModelIndex insertedIndex;
|
|
||||||
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
|
||||||
|
|
||||||
rangeFilter->name = QString("Slice I (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
|
||||||
rangeFilter->cellCountI = 1;
|
|
||||||
int startIndex = CVF_MAX(static_cast<int>(i + 1), 1);
|
|
||||||
rangeFilter->startIndexI = startIndex;
|
|
||||||
|
|
||||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
||||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
||||||
|
|
||||||
rangeFilterCollection->reservoirView()->createDisplayModelAndRedraw();
|
|
||||||
|
|
||||||
mainWindow->setCurrentObjectInTreeView(rangeFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
eclipseView->setSurfaceDrawstyle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -310,43 +280,18 @@ void RiuViewer::slotRangeFilterI()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuViewer::slotRangeFilterJ()
|
void RiuViewer::slotRangeFilterJ()
|
||||||
{
|
{
|
||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
createSliceRangeFilter(1);
|
||||||
if (!eclipseView) return;
|
|
||||||
|
|
||||||
size_t i, j, k;
|
|
||||||
ijkFromCellIndex(m_currentGridIdx, m_currentCellIndex, &i, &j, &k);
|
|
||||||
|
|
||||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
|
||||||
RimUiTreeModelPdm* myModel = mainWindow->uiPdmModel();
|
|
||||||
if (myModel)
|
|
||||||
{
|
|
||||||
RimCellRangeFilterCollection* rangeFilterCollection = eclipseView->rangeFilterCollection();
|
|
||||||
|
|
||||||
QModelIndex collectionModelIndex = myModel->getModelIndexFromPdmObject(rangeFilterCollection);
|
|
||||||
|
|
||||||
QModelIndex insertedIndex;
|
|
||||||
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
|
||||||
|
|
||||||
rangeFilter->name = QString("Slice J (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
|
||||||
rangeFilter->cellCountJ = 1;
|
|
||||||
int startIndex = CVF_MAX(static_cast<int>(j + 1), 1);
|
|
||||||
rangeFilter->startIndexJ = startIndex;
|
|
||||||
|
|
||||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
||||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
||||||
|
|
||||||
rangeFilterCollection->reservoirView()->createDisplayModelAndRedraw();
|
|
||||||
|
|
||||||
mainWindow->setCurrentObjectInTreeView(rangeFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
eclipseView->setSurfaceDrawstyle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuViewer::slotRangeFilterK()
|
void RiuViewer::slotRangeFilterK()
|
||||||
|
{
|
||||||
|
createSliceRangeFilter(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RiuViewer::createSliceRangeFilter(int ijOrk)
|
||||||
{
|
{
|
||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
||||||
if (!eclipseView) return;
|
if (!eclipseView) return;
|
||||||
@ -365,10 +310,26 @@ void RiuViewer::slotRangeFilterK()
|
|||||||
QModelIndex insertedIndex;
|
QModelIndex insertedIndex;
|
||||||
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
||||||
|
|
||||||
rangeFilter->name = QString("Slice K (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
if (ijOrk == 0){
|
||||||
rangeFilter->cellCountK = 1;
|
rangeFilter->name = QString("Slice I (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
||||||
int startIndex = CVF_MAX(static_cast<int>(k + 1), 1);
|
rangeFilter->cellCountI = 1;
|
||||||
rangeFilter->startIndexK = startIndex;
|
int startIndex = CVF_MAX(static_cast<int>(i + 1), 1);
|
||||||
|
rangeFilter->startIndexI = startIndex;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (ijOrk == 1){
|
||||||
|
rangeFilter->name = QString("Slice J (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
||||||
|
rangeFilter->cellCountJ = 1;
|
||||||
|
int startIndex = CVF_MAX(static_cast<int>(j + 1), 1);
|
||||||
|
rangeFilter->startIndexJ = startIndex;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (ijOrk == 2){
|
||||||
|
rangeFilter->name = QString("Slice K (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
||||||
|
rangeFilter->cellCountK = 1;
|
||||||
|
int startIndex = CVF_MAX(static_cast<int>(k + 1), 1);
|
||||||
|
rangeFilter->startIndexK = startIndex;
|
||||||
|
}
|
||||||
|
|
||||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||||
|
@ -92,7 +92,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
void ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
||||||
|
void createSliceRangeFilter(int ijOrk);
|
||||||
private:
|
private:
|
||||||
caf::QtMouseState m_mouseState;
|
caf::QtMouseState m_mouseState;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user