mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#902 Create box at position - context command
This commit is contained in:
+15
-4
@@ -30,6 +30,8 @@
|
|||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RiuViewer.h"
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxFeature");
|
CAF_CMD_SOURCE_INIT(RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxFeature");
|
||||||
|
|
||||||
@@ -38,10 +40,10 @@ CAF_CMD_SOURCE_INIT(RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxFe
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicAppendIntersectionBoxFeature::isCommandEnabled()
|
bool RicAppendIntersectionBoxFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
|
//RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
|
||||||
if (coll) return true;
|
//if (coll) return true;
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -58,7 +60,16 @@ void RicAppendIntersectionBoxFeature::onActionTriggered(bool isChecked)
|
|||||||
|
|
||||||
coll->appendIntersectionBox(intersectionBox);
|
coll->appendIntersectionBox(intersectionBox);
|
||||||
|
|
||||||
intersectionBox->setToDefaultSizeBox();
|
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||||
|
if(activeView)
|
||||||
|
{
|
||||||
|
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||||
|
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_NONE, domainCoord);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intersectionBox->setToDefaultSizeBox();
|
||||||
|
}
|
||||||
|
|
||||||
coll->updateConnectedEditors();
|
coll->updateConnectedEditors();
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
|
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
|||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
|
menu.addAction(caf::CmdFeatureManager::instance()->action("RicAppendIntersectionBoxFeature"));
|
||||||
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxXSliceFeature"));
|
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxXSliceFeature"));
|
||||||
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxYSliceFeature"));
|
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxYSliceFeature"));
|
||||||
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxZSliceFeature"));
|
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxZSliceFeature"));
|
||||||
|
|||||||
Reference in New Issue
Block a user