#2162 Context menu: Remove hide intersection slot and use command features

This commit is contained in:
Rebecca Cox 2017-11-29 14:37:17 +01:00
parent 0a8b2111bc
commit 4b57599162
2 changed files with 8 additions and 34 deletions

View File

@ -137,7 +137,6 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
m_currentGridIdx = cvf::UNDEFINED_SIZE_T;
m_currentCellIndex = cvf::UNDEFINED_SIZE_T;
m_currentPickedObject = nullptr;
int winPosX = event->x();
int winPosY = event->y();
@ -196,16 +195,21 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
{
findCellAndGridIndex(crossSectionSourceInfo, firstPartTriangleIndex, &m_currentCellIndex, &m_currentGridIdx);
m_currentFaceIndex = cvf::StructGridInterface::NO_FACE;
m_currentPickedObject = const_cast<RimIntersection*>(crossSectionSourceInfo->crossSection());
menu.addAction(QString("Hide intersection"), this, SLOT(slotHideIntersection()));
RiuSelectionItem* selItem = new RiuGeneralSelectionItem(crossSectionSourceInfo->crossSection());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
menuBuilder << "RicHideIntersectionFeature";
}
else if (intersectionBoxSourceInfo)
{
findCellAndGridIndex(intersectionBoxSourceInfo, firstPartTriangleIndex, &m_currentCellIndex, &m_currentGridIdx);
m_currentFaceIndex = cvf::StructGridInterface::NO_FACE;
m_currentPickedObject = const_cast<RimIntersectionBox*>(intersectionBoxSourceInfo->intersectionBox());
RiuSelectionItem* selItem = new RiuGeneralSelectionItem(intersectionBoxSourceInfo->intersectionBox());
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
menuBuilder << "RicHideIntersectionBoxFeature";
}
// IJK -slice commands
@ -386,24 +390,6 @@ void RiuViewerCommands::slotAddGeoMechPropertyFilter()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::slotHideIntersection()
{
RimIntersection* rimIntersection = dynamic_cast<RimIntersection*>(currentPickedObject());
if (rimIntersection)
{
rimIntersection->isActive = false;
rimIntersection->updateConnectedEditors();
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -579,14 +565,6 @@ cvf::Vec3d RiuViewerCommands::lastPickPositionInDomainCoords() const
return m_currentPickPositionInDomainCoords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RiuViewerCommands::currentPickedObject() const
{
return m_currentPickedObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -59,11 +59,8 @@ public:
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
cvf::Vec3d lastPickPositionInDomainCoords() const;
caf::PdmObject* currentPickedObject() const;
private slots:
void slotAddGeoMechPropertyFilter();
void slotHideIntersection();
private:
void findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
@ -80,7 +77,6 @@ private:
cvf::Vec3d m_currentPickPositionInDomainCoords;
caf::PdmPointer<RimView> m_reservoirView;
caf::PdmPointer<caf::PdmObject> m_currentPickedObject;
QPointer<RiuViewer> m_viewer;