mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#818 Intersection Box: Added XYZ slices to context menu in 3D view
This commit is contained in:
parent
bb81009b33
commit
5c4b92f9b8
@ -6,10 +6,16 @@ endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionBoxFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxXSliceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxYSliceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxZSliceFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionBoxFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxXSliceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxYSliceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxZSliceFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,105 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicIntersectionBoxXSliceFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicIntersectionBoxXSliceFeature, "RicIntersectionBoxXSliceFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicIntersectionBoxXSliceFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicIntersectionBoxXSliceFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (activeView)
|
||||
{
|
||||
RimIntersectionBoxCollection* coll = activeView->intersectionBoxCollection();
|
||||
CVF_ASSERT(coll);
|
||||
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = QString("X-slice (Intersection box)");
|
||||
|
||||
RimCase* rimCase = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimCase);
|
||||
if (rimCase)
|
||||
{
|
||||
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
|
||||
if (!domainCoord.isUndefined())
|
||||
{
|
||||
intersectionBox->setXSlice(domainCoord.x());
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectionBox->setXSlice(rimCase->activeCellsBoundingBox().center().x());
|
||||
}
|
||||
}
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
rimView->showGridCells(false);
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicIntersectionBoxXSliceFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/IntersectionBox16x16.png"));
|
||||
actionToSetup->setText("X-slice Intersection Box");
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicIntersectionBoxXSliceFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
@ -0,0 +1,105 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicIntersectionBoxYSliceFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicIntersectionBoxYSliceFeature, "RicIntersectionBoxYSliceFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicIntersectionBoxYSliceFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicIntersectionBoxYSliceFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (activeView)
|
||||
{
|
||||
RimIntersectionBoxCollection* coll = activeView->intersectionBoxCollection();
|
||||
CVF_ASSERT(coll);
|
||||
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = QString("Y-slice (Intersection box)");
|
||||
|
||||
RimCase* rimCase = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimCase);
|
||||
if (rimCase)
|
||||
{
|
||||
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
|
||||
if (!domainCoord.isUndefined())
|
||||
{
|
||||
intersectionBox->setYSlice(domainCoord.y());
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectionBox->setYSlice(rimCase->activeCellsBoundingBox().center().y());
|
||||
}
|
||||
}
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
rimView->showGridCells(false);
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicIntersectionBoxYSliceFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/IntersectionBox16x16.png"));
|
||||
actionToSetup->setText("Y-slice Intersection Box");
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicIntersectionBoxYSliceFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
@ -0,0 +1,105 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicIntersectionBoxZSliceFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicIntersectionBoxZSliceFeature, "RicIntersectionBoxZSliceFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicIntersectionBoxZSliceFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicIntersectionBoxZSliceFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (activeView)
|
||||
{
|
||||
RimIntersectionBoxCollection* coll = activeView->intersectionBoxCollection();
|
||||
CVF_ASSERT(coll);
|
||||
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = QString("Z-slice (Intersection box)");
|
||||
|
||||
RimCase* rimCase = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimCase);
|
||||
if (rimCase)
|
||||
{
|
||||
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
|
||||
if (!domainCoord.isUndefined())
|
||||
{
|
||||
intersectionBox->setZSlice(domainCoord.z());
|
||||
}
|
||||
else
|
||||
{
|
||||
intersectionBox->setZSlice(rimCase->activeCellsBoundingBox().center().z());
|
||||
}
|
||||
}
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
rimView->showGridCells(false);
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicIntersectionBoxZSliceFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/IntersectionBox16x16.png"));
|
||||
actionToSetup->setText("Z-slice Intersection Box");
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicIntersectionBoxZSliceFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "RimCase.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
@ -55,22 +56,22 @@ RimIntersectionBox::RimIntersectionBox()
|
||||
CAF_PDM_InitField(&singlePlaneState, "singlePlaneState", caf::AppEnum<SinglePlaneState>(SinglePlaneState::PLANE_STATE_NONE), "Collapse box to plane", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&minXCoord, "MinXCoord", 0.0, "MinXCoord", "", "", "");
|
||||
minXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
minXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&maxXCoord, "MaxXCoord", 0.0, "MaxXCoord", "", "", "");
|
||||
maxXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
maxXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&minYCoord, "MinYCoord", 0.0, "MinYCoord", "", "", "");
|
||||
minYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
minYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&maxYCoord, "MaxYCoord", 0.0, "MaxYCoord", "", "", "");
|
||||
maxYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
maxYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&minZCoord, "MinZCoord", 0.0, "MinZCoord", "", "", "");
|
||||
minZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
minZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&maxZCoord, "MaxZCoord", 0.0, "MaxZCoord", "", "", "");
|
||||
maxZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
maxZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -117,6 +118,35 @@ void RimIntersectionBox::setModelBoundingBox(cvf::BoundingBox& boundingBox)
|
||||
updateLabelsFromBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::setXSlice(double xValue)
|
||||
{
|
||||
singlePlaneState = PLANE_STATE_X;
|
||||
minXCoord = xValue;
|
||||
maxXCoord = xValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::setYSlice(double yValue)
|
||||
{
|
||||
singlePlaneState = PLANE_STATE_Y;
|
||||
minYCoord = yValue;
|
||||
maxYCoord = yValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::setZSlice(double zValue)
|
||||
{
|
||||
singlePlaneState = PLANE_STATE_Z;
|
||||
minZCoord = zValue;
|
||||
maxZCoord = zValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -217,24 +247,24 @@ void RimIntersectionBox::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
caf::PdmUiSliderEditorAttribute* myAttr = static_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = static_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
|
||||
if (myAttr)
|
||||
{
|
||||
if (field == &minXCoord || field == &maxXCoord)
|
||||
{
|
||||
myAttr->m_minimum = cvf::Math::floor(m_boundingBox.min().x());
|
||||
myAttr->m_maximum = cvf::Math::ceil(m_boundingBox.max().x());
|
||||
myAttr->m_minimum = m_boundingBox.min().x();
|
||||
myAttr->m_maximum = m_boundingBox.max().x();
|
||||
}
|
||||
else if (field == &minYCoord || field == &maxYCoord)
|
||||
{
|
||||
myAttr->m_minimum = cvf::Math::floor(m_boundingBox.min().y());
|
||||
myAttr->m_maximum = cvf::Math::ceil(m_boundingBox.max().y());
|
||||
myAttr->m_minimum = m_boundingBox.min().y();
|
||||
myAttr->m_maximum = m_boundingBox.max().y();
|
||||
}
|
||||
else if (field == &minZCoord || field == &maxZCoord)
|
||||
{
|
||||
myAttr->m_minimum = cvf::Math::floor(m_boundingBox.min().z());
|
||||
myAttr->m_maximum = cvf::Math::ceil(m_boundingBox.max().z());
|
||||
myAttr->m_minimum = m_boundingBox.min().z();
|
||||
myAttr->m_maximum = m_boundingBox.max().z();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,10 @@ public:
|
||||
void initialize();
|
||||
void setModelBoundingBox(cvf::BoundingBox& boundingBox);
|
||||
|
||||
void setXSlice(double xValue);
|
||||
void setYSlice(double yValue);
|
||||
void setZSlice(double zValue);
|
||||
|
||||
void updateLabelsFromBoundingBox();
|
||||
|
||||
protected:
|
||||
|
@ -689,6 +689,16 @@ void RiuViewer::setAxisLabels(const cvf::String& xLabel, const cvf::String& yLab
|
||||
m_axisCross->setAxisLabels(xLabel, yLabel, zLabel);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RiuViewer::lastPickPositionInDomainCoords() const
|
||||
{
|
||||
CVF_ASSERT(m_viewerCommands);
|
||||
|
||||
return m_viewerCommands->lastPickPositionInDomainCoords();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -89,6 +89,8 @@ public:
|
||||
|
||||
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
|
||||
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
|
||||
public slots:
|
||||
virtual void slotSetCurrentFrame(int frameIndex);
|
||||
virtual void slotEndAnimation();
|
||||
|
@ -77,6 +77,7 @@
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include "RiaApplication.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@ -92,7 +93,8 @@ RiuViewerCommands::RiuViewerCommands(RiuViewer* ownerViewer)
|
||||
: QObject(ownerViewer),
|
||||
m_viewer(ownerViewer),
|
||||
m_currentGridIdx(-1),
|
||||
m_currentCellIndex(-1)
|
||||
m_currentCellIndex(-1),
|
||||
m_currentPickPositionInDomainCoords(cvf::Vec3d::UNDEFINED)
|
||||
{
|
||||
{
|
||||
caf::CmdFeature* cmdFeature = caf::CmdFeatureManager::instance()->getCommandFeature("RicNewPolylineIntersectionFeature");
|
||||
@ -141,11 +143,26 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
cvf::Part* firstHitPart = NULL;
|
||||
cvf::Part* nncFirstHitPart = NULL;
|
||||
|
||||
cvf::HitItemCollection hitItems;
|
||||
m_currentPickPositionInDomainCoords = cvf::Vec3d::UNDEFINED;
|
||||
|
||||
cvf::HitItemCollection hitItems;
|
||||
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
|
||||
{
|
||||
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &firstPartTriangleIndex, &nncFirstHitPart, NULL);
|
||||
|
||||
cvf::Vec3d displayModelOffset = cvf::Vec3d::ZERO;
|
||||
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
CVF_ASSERT(activeView);
|
||||
|
||||
RimCase* rimCase = NULL;
|
||||
activeView->firstAnchestorOrThisOfType(rimCase);
|
||||
if (rimCase)
|
||||
{
|
||||
displayModelOffset = rimCase->displayModelOffset();
|
||||
}
|
||||
|
||||
m_currentPickPositionInDomainCoords = localIntersectionPoint + displayModelOffset;
|
||||
}
|
||||
|
||||
if (firstHitPart && firstPartTriangleIndex != cvf::UNDEFINED_UINT)
|
||||
@ -190,6 +207,14 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
menu.addAction(QIcon(":/CellFilter_Range.png"), QString("I-slice range filter"), this, SLOT(slotRangeFilterI()));
|
||||
menu.addAction(QIcon(":/CellFilter_Range.png"), QString("J-slice range filter"), this, SLOT(slotRangeFilterJ()));
|
||||
menu.addAction(QIcon(":/CellFilter_Range.png"), QString("K-slice range filter"), this, SLOT(slotRangeFilterK()));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxXSliceFeature"));
|
||||
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxYSliceFeature"));
|
||||
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxZSliceFeature"));
|
||||
|
||||
menu.addSeparator();
|
||||
}
|
||||
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
||||
@ -545,6 +570,14 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RiuViewerCommands::lastPickPositionInDomainCoords() const
|
||||
{
|
||||
return m_currentPickPositionInDomainCoords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
|
||||
void displayContextMenu(QMouseEvent* event);
|
||||
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
|
||||
void findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
|
||||
@ -74,6 +75,7 @@ private:
|
||||
size_t m_currentGridIdx;
|
||||
size_t m_currentCellIndex;
|
||||
cvf::StructGridInterface::FaceType m_currentFaceIndex;
|
||||
cvf::Vec3d m_currentPickPositionInDomainCoords;
|
||||
|
||||
caf::PdmPointer<RimView> m_reservoirView;
|
||||
caf::PdmPointer<RimIntersection> m_currentCrossSection;
|
||||
|
Loading…
Reference in New Issue
Block a user