mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merged intersection-box into dev
This commit is contained in:
commit
cbb626aa31
@ -41,6 +41,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SocketInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
||||
@ -146,6 +147,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
|
||||
ModelVisualization/CMakeLists_files.cmake
|
||||
ModelVisualization/GridBox/CMakeLists_files.cmake
|
||||
ModelVisualization/Intersections/CMakeLists_files.cmake
|
||||
|
||||
Commands/CMakeLists_files.cmake
|
||||
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
|
||||
@ -156,6 +158,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
Commands/SummaryPlotCommands/CMakeLists_files.cmake
|
||||
Commands/WellPathCommands/CMakeLists_files.cmake
|
||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
|
||||
)
|
||||
|
||||
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
|
||||
@ -389,8 +392,10 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
set_source_files_properties (UnitTests/opm-parser-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# variables at global file scope
|
||||
set_source_files_properties (ModelVisualization/RivCrossSectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/RivCrossSectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
set_source_files_properties (ModelVisualization/GridBox/RivGridBoxGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
|
@ -5,17 +5,17 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAppendCrossSectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSimWellCrossSectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellPathCrossSectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewPolylineCrossSectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSimWellIntersectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellPathIntersectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewPolylineIntersectionFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicAppendCrossSectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSimWellCrossSectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellPathCrossSectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewPolylineCrossSectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSimWellIntersectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellPathIntersectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewPolylineIntersectionFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -17,10 +17,10 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicAppendCrossSectionFeature.h"
|
||||
#include "RicAppendIntersectionFeature.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@ -29,12 +29,12 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAppendCrossSectionFeature, "RicAppendCrossSectionFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicAppendIntersectionFeature, "RicAppendIntersectionFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAppendCrossSectionFeature::isCommandEnabled()
|
||||
bool RicAppendIntersectionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -42,25 +42,25 @@ bool RicAppendCrossSectionFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
void RicAppendIntersectionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType(&collection);
|
||||
CVF_ASSERT(collection.size() == 1);
|
||||
|
||||
RimCrossSectionCollection* crossSectionCollection = NULL;
|
||||
RimIntersectionCollection* crossSectionCollection = NULL;
|
||||
collection[0]->firstAncestorOrThisOfType(crossSectionCollection);
|
||||
|
||||
CVF_ASSERT(crossSectionCollection);
|
||||
|
||||
RicAppendCrossSectionFeatureCmd* cmd = new RicAppendCrossSectionFeatureCmd(crossSectionCollection);
|
||||
RicAppendIntersectionFeatureCmd* cmd = new RicAppendIntersectionFeatureCmd(crossSectionCollection);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicAppendIntersectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
||||
actionToSetup->setText("New Intersection");
|
||||
@ -69,7 +69,7 @@ void RicAppendCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicAppendCrossSectionFeatureCmd::RicAppendCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection)
|
||||
RicAppendIntersectionFeatureCmd::RicAppendIntersectionFeatureCmd(RimIntersectionCollection* crossSectionCollection)
|
||||
: CmdExecuteCommand(NULL),
|
||||
m_crossSectionCollection(crossSectionCollection)
|
||||
{
|
||||
@ -78,14 +78,14 @@ RicAppendCrossSectionFeatureCmd::RicAppendCrossSectionFeatureCmd(RimCrossSection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicAppendCrossSectionFeatureCmd::~RicAppendCrossSectionFeatureCmd()
|
||||
RicAppendIntersectionFeatureCmd::~RicAppendIntersectionFeatureCmd()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicAppendCrossSectionFeatureCmd::name()
|
||||
QString RicAppendIntersectionFeatureCmd::name()
|
||||
{
|
||||
return "New Intersection";
|
||||
}
|
||||
@ -93,11 +93,11 @@ QString RicAppendCrossSectionFeatureCmd::name()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendCrossSectionFeatureCmd::redo()
|
||||
void RicAppendIntersectionFeatureCmd::redo()
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionCollection);
|
||||
|
||||
RimCrossSection* crossSection = new RimCrossSection();
|
||||
RimIntersection* crossSection = new RimIntersection();
|
||||
crossSection->name = QString("Intersection");
|
||||
m_crossSectionCollection->appendCrossSection(crossSection);
|
||||
}
|
||||
@ -105,6 +105,6 @@ void RicAppendCrossSectionFeatureCmd::redo()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendCrossSectionFeatureCmd::undo()
|
||||
void RicAppendIntersectionFeatureCmd::undo()
|
||||
{
|
||||
}
|
@ -23,24 +23,24 @@
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimCrossSectionCollection;
|
||||
class RimIntersectionCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAppendCrossSectionFeatureCmd : public caf::CmdExecuteCommand
|
||||
class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicAppendCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection);
|
||||
virtual ~RicAppendCrossSectionFeatureCmd();
|
||||
RicAppendIntersectionFeatureCmd(RimIntersectionCollection* crossSectionCollection);
|
||||
virtual ~RicAppendIntersectionFeatureCmd();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
|
||||
caf::PdmPointer<RimIntersectionCollection> m_crossSectionCollection;
|
||||
};
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ private:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAppendCrossSectionFeature : public caf::CmdFeature
|
||||
class RicAppendIntersectionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
@ -17,13 +17,13 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewPolylineCrossSectionFeature.h"
|
||||
#include "RicNewPolylineIntersectionFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@ -36,12 +36,12 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewPolylineCrossSectionFeature, "RicNewPolylineCrossSectionFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicNewPolylineIntersectionFeature, "RicNewPolylineIntersectionFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewPolylineCrossSectionFeature::RicNewPolylineCrossSectionFeature()
|
||||
RicNewPolylineIntersectionFeature::RicNewPolylineIntersectionFeature()
|
||||
{
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ RicNewPolylineCrossSectionFeature::RicNewPolylineCrossSectionFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineCrossSectionFeature::isCommandEnabled()
|
||||
bool RicNewPolylineIntersectionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -57,19 +57,19 @@ bool RicNewPolylineCrossSectionFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
void RicNewPolylineIntersectionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
RicNewPolylineCrossSectionFeatureCmd* cmd = new RicNewPolylineCrossSectionFeatureCmd(activeView->crossSectionCollection);
|
||||
RicNewPolylineIntersectionFeatureCmd* cmd = new RicNewPolylineIntersectionFeatureCmd(activeView->crossSectionCollection);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicNewPolylineIntersectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
||||
actionToSetup->setText("New Polyline Intersection");
|
||||
@ -78,9 +78,9 @@ void RicNewPolylineCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPolylineCrossSectionFeature::handleEvent(cvf::Object* eventObject)
|
||||
bool RicNewPolylineIntersectionFeature::handleEvent(cvf::Object* eventObject)
|
||||
{
|
||||
std::vector<RimCrossSection*> selection;
|
||||
std::vector<RimIntersection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
if (selection.size() == 1)
|
||||
@ -88,7 +88,7 @@ bool RicNewPolylineCrossSectionFeature::handleEvent(cvf::Object* eventObject)
|
||||
RicViewerEventObject* polylineUiEvent = dynamic_cast<RicViewerEventObject*>(eventObject);
|
||||
if (polylineUiEvent)
|
||||
{
|
||||
RimCrossSection* crossSection = selection[0];
|
||||
RimIntersection* crossSection = selection[0];
|
||||
if (crossSection->inputFromViewerEnabled())
|
||||
{
|
||||
RimCase* rimCase = NULL;
|
||||
@ -109,7 +109,7 @@ bool RicNewPolylineCrossSectionFeature::handleEvent(cvf::Object* eventObject)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewPolylineCrossSectionFeatureCmd::RicNewPolylineCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection)
|
||||
RicNewPolylineIntersectionFeatureCmd::RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* crossSectionCollection)
|
||||
: CmdExecuteCommand(NULL),
|
||||
m_crossSectionCollection(crossSectionCollection)
|
||||
{
|
||||
@ -118,14 +118,14 @@ RicNewPolylineCrossSectionFeatureCmd::RicNewPolylineCrossSectionFeatureCmd(RimCr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewPolylineCrossSectionFeatureCmd::~RicNewPolylineCrossSectionFeatureCmd()
|
||||
RicNewPolylineIntersectionFeatureCmd::~RicNewPolylineIntersectionFeatureCmd()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicNewPolylineCrossSectionFeatureCmd::name()
|
||||
QString RicNewPolylineIntersectionFeatureCmd::name()
|
||||
{
|
||||
return "Start Polyline Intersection";
|
||||
}
|
||||
@ -133,13 +133,13 @@ QString RicNewPolylineCrossSectionFeatureCmd::name()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineCrossSectionFeatureCmd::redo()
|
||||
void RicNewPolylineIntersectionFeatureCmd::redo()
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionCollection);
|
||||
|
||||
RimCrossSection* crossSection = new RimCrossSection();
|
||||
RimIntersection* crossSection = new RimIntersection();
|
||||
crossSection->name = "Polyline";
|
||||
crossSection->type = RimCrossSection::CS_POLYLINE;
|
||||
crossSection->type = RimIntersection::CS_POLYLINE;
|
||||
crossSection->inputFromViewerEnabled = true;
|
||||
|
||||
m_crossSectionCollection->appendCrossSection(crossSection);
|
||||
@ -152,6 +152,6 @@ void RicNewPolylineCrossSectionFeatureCmd::redo()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineCrossSectionFeatureCmd::undo()
|
||||
void RicNewPolylineIntersectionFeatureCmd::undo()
|
||||
{
|
||||
}
|
@ -28,24 +28,24 @@
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
class RimCrossSectionCollection;
|
||||
class RimIntersectionCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPolylineCrossSectionFeatureCmd : public caf::CmdExecuteCommand
|
||||
class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicNewPolylineCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection);
|
||||
virtual ~RicNewPolylineCrossSectionFeatureCmd();
|
||||
RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* crossSectionCollection);
|
||||
virtual ~RicNewPolylineIntersectionFeatureCmd();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
|
||||
caf::PdmPointer<RimIntersectionCollection> m_crossSectionCollection;
|
||||
};
|
||||
|
||||
|
||||
@ -53,12 +53,12 @@ private:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewPolylineCrossSectionFeature : public caf::CmdFeature, public RicViewerEventInterface
|
||||
class RicNewPolylineIntersectionFeature : public caf::CmdFeature, public RicViewerEventInterface
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicNewPolylineCrossSectionFeature();
|
||||
RicNewPolylineIntersectionFeature();
|
||||
|
||||
protected:
|
||||
// Overrides
|
@ -17,10 +17,10 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewSimWellCrossSectionFeature.h"
|
||||
#include "RicNewSimWellIntersectionFeature.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
@ -31,12 +31,12 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewSimWellCrossSectionFeature, "RicNewSimWellCrossSectionFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicNewSimWellIntersectionFeature, "RicNewSimWellIntersectionFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSimWellCrossSectionFeature::isCommandEnabled()
|
||||
bool RicNewSimWellIntersectionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -44,7 +44,7 @@ bool RicNewSimWellCrossSectionFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
void RicNewSimWellIntersectionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType(&collection);
|
||||
@ -56,14 +56,14 @@ void RicNewSimWellCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
eclWell->firstAncestorOrThisOfType(eclView);
|
||||
CVF_ASSERT(eclView);
|
||||
|
||||
RicNewSimWellCrossSectionCmd* cmd = new RicNewSimWellCrossSectionCmd(eclView->crossSectionCollection, eclWell);
|
||||
RicNewSimWellIntersectionCmd* cmd = new RicNewSimWellIntersectionCmd(eclView->crossSectionCollection, eclWell);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicNewSimWellIntersectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
||||
actionToSetup->setText("New Intersection");
|
||||
@ -72,7 +72,7 @@ void RicNewSimWellCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewSimWellCrossSectionCmd::RicNewSimWellCrossSectionCmd(RimCrossSectionCollection* crossSectionCollection, RimEclipseWell* simWell)
|
||||
RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd(RimIntersectionCollection* crossSectionCollection, RimEclipseWell* simWell)
|
||||
: CmdExecuteCommand(NULL),
|
||||
m_crossSectionCollection(crossSectionCollection),
|
||||
m_wellPath(simWell)
|
||||
@ -82,14 +82,14 @@ RicNewSimWellCrossSectionCmd::RicNewSimWellCrossSectionCmd(RimCrossSectionCollec
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewSimWellCrossSectionCmd::~RicNewSimWellCrossSectionCmd()
|
||||
RicNewSimWellIntersectionCmd::~RicNewSimWellIntersectionCmd()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicNewSimWellCrossSectionCmd::name()
|
||||
QString RicNewSimWellIntersectionCmd::name()
|
||||
{
|
||||
return "Create Intersection From Well";
|
||||
}
|
||||
@ -97,14 +97,14 @@ QString RicNewSimWellCrossSectionCmd::name()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellCrossSectionCmd::redo()
|
||||
void RicNewSimWellIntersectionCmd::redo()
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionCollection);
|
||||
CVF_ASSERT(m_wellPath);
|
||||
|
||||
RimCrossSection* crossSection = new RimCrossSection();
|
||||
RimIntersection* crossSection = new RimIntersection();
|
||||
crossSection->name = m_wellPath->name;
|
||||
crossSection->type = RimCrossSection::CS_SIMULATION_WELL;
|
||||
crossSection->type = RimIntersection::CS_SIMULATION_WELL;
|
||||
crossSection->simulationWell = m_wellPath;
|
||||
|
||||
m_crossSectionCollection->appendCrossSection(crossSection);
|
||||
@ -113,6 +113,6 @@ void RicNewSimWellCrossSectionCmd::redo()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellCrossSectionCmd::undo()
|
||||
void RicNewSimWellIntersectionCmd::undo()
|
||||
{
|
||||
}
|
@ -23,25 +23,25 @@
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimCrossSectionCollection;
|
||||
class RimIntersectionCollection;
|
||||
class RimEclipseWell;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewSimWellCrossSectionCmd : public caf::CmdExecuteCommand
|
||||
class RicNewSimWellIntersectionCmd : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicNewSimWellCrossSectionCmd(RimCrossSectionCollection* crossSectionCollection, RimEclipseWell* simWell);
|
||||
virtual ~RicNewSimWellCrossSectionCmd();
|
||||
RicNewSimWellIntersectionCmd(RimIntersectionCollection* crossSectionCollection, RimEclipseWell* simWell);
|
||||
virtual ~RicNewSimWellIntersectionCmd();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
|
||||
caf::PdmPointer<RimIntersectionCollection> m_crossSectionCollection;
|
||||
caf::PdmPointer<RimEclipseWell> m_wellPath;
|
||||
};
|
||||
|
||||
@ -50,7 +50,7 @@ private:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewSimWellCrossSectionFeature : public caf::CmdFeature
|
||||
class RicNewSimWellIntersectionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
@ -17,12 +17,12 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewWellPathCrossSectionFeature.h"
|
||||
#include "RicNewWellPathIntersectionFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimView.h"
|
||||
|
||||
@ -33,12 +33,12 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewWellPathCrossSectionFeature, "RicNewWellPathCrossSectionFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicNewWellPathIntersectionFeature, "RicNewWellPathIntersectionFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewWellPathCrossSectionFeature::RicNewWellPathCrossSectionFeature()
|
||||
RicNewWellPathIntersectionFeature::RicNewWellPathIntersectionFeature()
|
||||
{
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ RicNewWellPathCrossSectionFeature::RicNewWellPathCrossSectionFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewWellPathCrossSectionFeature::isCommandEnabled()
|
||||
bool RicNewWellPathIntersectionFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -54,7 +54,7 @@ bool RicNewWellPathCrossSectionFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
void RicNewWellPathIntersectionFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
@ -65,14 +65,14 @@ void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RimWellPath* wellPath = collection[0];
|
||||
|
||||
RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(activeView->crossSectionCollection, wellPath);
|
||||
RicNewWellPathIntersectionFeatureCmd* cmd = new RicNewWellPathIntersectionFeatureCmd(activeView->crossSectionCollection, wellPath);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicNewWellPathIntersectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
||||
actionToSetup->setText("New Intersection");
|
||||
@ -81,7 +81,7 @@ void RicNewWellPathCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewWellPathCrossSectionFeatureCmd::RicNewWellPathCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection, RimWellPath* wellPath)
|
||||
RicNewWellPathIntersectionFeatureCmd::RicNewWellPathIntersectionFeatureCmd(RimIntersectionCollection* crossSectionCollection, RimWellPath* wellPath)
|
||||
: CmdExecuteCommand(NULL),
|
||||
m_crossSectionCollection(crossSectionCollection),
|
||||
m_wellPath(wellPath)
|
||||
@ -91,14 +91,14 @@ RicNewWellPathCrossSectionFeatureCmd::RicNewWellPathCrossSectionFeatureCmd(RimCr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicNewWellPathCrossSectionFeatureCmd::~RicNewWellPathCrossSectionFeatureCmd()
|
||||
RicNewWellPathIntersectionFeatureCmd::~RicNewWellPathIntersectionFeatureCmd()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicNewWellPathCrossSectionFeatureCmd::name()
|
||||
QString RicNewWellPathIntersectionFeatureCmd::name()
|
||||
{
|
||||
return "Create Intersection From Well Path";
|
||||
}
|
||||
@ -106,14 +106,14 @@ QString RicNewWellPathCrossSectionFeatureCmd::name()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathCrossSectionFeatureCmd::redo()
|
||||
void RicNewWellPathIntersectionFeatureCmd::redo()
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionCollection);
|
||||
CVF_ASSERT(m_wellPath);
|
||||
|
||||
RimCrossSection* crossSection = new RimCrossSection();
|
||||
RimIntersection* crossSection = new RimIntersection();
|
||||
crossSection->name = m_wellPath->name;
|
||||
crossSection->type = RimCrossSection::CS_WELL_PATH;
|
||||
crossSection->type = RimIntersection::CS_WELL_PATH;
|
||||
crossSection->wellPath = m_wellPath;
|
||||
|
||||
m_crossSectionCollection->appendCrossSection(crossSection);
|
||||
@ -122,6 +122,6 @@ void RicNewWellPathCrossSectionFeatureCmd::redo()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathCrossSectionFeatureCmd::undo()
|
||||
void RicNewWellPathIntersectionFeatureCmd::undo()
|
||||
{
|
||||
}
|
@ -23,25 +23,25 @@
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimCrossSectionCollection;
|
||||
class RimIntersectionCollection;
|
||||
class RimWellPath;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewWellPathCrossSectionFeatureCmd : public caf::CmdExecuteCommand
|
||||
class RicNewWellPathIntersectionFeatureCmd : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicNewWellPathCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection, RimWellPath* wellPath);
|
||||
virtual ~RicNewWellPathCrossSectionFeatureCmd();
|
||||
RicNewWellPathIntersectionFeatureCmd(RimIntersectionCollection* crossSectionCollection, RimWellPath* wellPath);
|
||||
virtual ~RicNewWellPathIntersectionFeatureCmd();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
|
||||
caf::PdmPointer<RimIntersectionCollection> m_crossSectionCollection;
|
||||
caf::PdmPointer<RimWellPath> m_wellPath;
|
||||
};
|
||||
|
||||
@ -50,12 +50,12 @@ private:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewWellPathCrossSectionFeature : public caf::CmdFeature
|
||||
class RicNewWellPathIntersectionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicNewWellPathCrossSectionFeature();
|
||||
RicNewWellPathIntersectionFeature();
|
||||
|
||||
protected:
|
||||
// Overrides
|
@ -0,0 +1,29 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
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
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\IntersectionBox" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
@ -0,0 +1,101 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicAppendIntersectionBoxFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimView.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAppendIntersectionBoxFeature::isCommandEnabled()
|
||||
{
|
||||
RimIntersectionBoxCollection* coll = RicAppendIntersectionBoxFeature::intersectionBoxCollection();
|
||||
if (coll) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendIntersectionBoxFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimIntersectionBoxCollection* coll = RicAppendIntersectionBoxFeature::intersectionBoxCollection();
|
||||
|
||||
if (coll)
|
||||
{
|
||||
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
|
||||
intersectionBox->name = QString("Intersection Box");
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
|
||||
intersectionBox->setToDefaultSizeBox();
|
||||
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
coll->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
rimView->showGridCells(false);
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendIntersectionBoxFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/IntersectionBox16x16.png"));
|
||||
actionToSetup->setText("New Intersection Box");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionBoxCollection* RicAppendIntersectionBoxFeature::intersectionBoxCollection()
|
||||
{
|
||||
RimIntersectionBoxCollection* intersectionBoxColl = nullptr;
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedObjects);
|
||||
if (selectedObjects.size() == 1)
|
||||
{
|
||||
selectedObjects[0]->firstAnchestorOrThisOfType(intersectionBoxColl);
|
||||
}
|
||||
|
||||
return intersectionBoxColl;
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RicAppendIntersectionBoxFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
static RimIntersectionBoxCollection* intersectionBoxCollection();
|
||||
};
|
||||
|
@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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)");
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_X, domainCoord);
|
||||
|
||||
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,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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)");
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Y, domainCoord);
|
||||
|
||||
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,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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)");
|
||||
|
||||
coll->appendIntersectionBox(intersectionBox);
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Z, domainCoord);
|
||||
|
||||
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 );
|
||||
};
|
||||
|
@ -22,9 +22,10 @@
|
||||
#include "RicDeleteItemExecData.h"
|
||||
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
@ -103,13 +104,20 @@ void RicDeleteItemExec::redo()
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
RimCrossSectionCollection* crossSectionColl;
|
||||
RimIntersectionCollection* crossSectionColl;
|
||||
parentObj->firstAncestorOrThisOfType(crossSectionColl);
|
||||
if (view && crossSectionColl)
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
RimIntersectionBoxCollection* intersectionBoxColl;
|
||||
parentObj->firstAnchestorOrThisOfType(intersectionBoxColl);
|
||||
if (view && intersectionBoxColl)
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
RimWellPathCollection* wellPathColl;
|
||||
parentObj->firstAncestorOrThisOfType(wellPathColl);
|
||||
|
||||
|
@ -18,16 +18,23 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicToggleItemsFeatureImpl.h"
|
||||
#include <vector>
|
||||
#include "cafPdmUiObjectHandle.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
#include <QModelIndex>
|
||||
#include "RiuMainWindow.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
#include "cafPdmUiObjectHandle.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QModelIndex>
|
||||
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleItemsFeatureImpl::isToggleCommandsAvailable()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
@ -72,6 +79,9 @@ bool RicToggleItemsFeatureImpl::isToggleCommandsAvailable()
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleItemsFeatureImpl::isToggleCommandsForSubItems()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
@ -83,7 +93,6 @@ bool RicToggleItemsFeatureImpl::isToggleCommandsForSubItems()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Set toggle state for list of model indices.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,6 +37,5 @@ public:
|
||||
static bool isToggleCommandsAvailable();
|
||||
static bool isToggleCommandsForSubItems();
|
||||
static void setObjectToggleStateForSelection(SelectionToggleType state);
|
||||
|
||||
};
|
||||
|
||||
|
@ -9,8 +9,6 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeEffectGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivColorTableArray.h
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivNNCGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivGridPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivTernarySaturationOverlayItem.h
|
||||
@ -36,7 +34,6 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h
|
||||
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
|
||||
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionSourceInfo.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -44,8 +41,6 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeEffectGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivColorTableArray.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivNNCGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivFaultGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivGridPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivTernarySaturationOverlayItem.cpp
|
||||
@ -69,7 +64,6 @@ ${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivWellPipeSourceInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionSourceInfo.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,35 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionSourceInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RivHexGridIntersectionTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxSourceInfo.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionSourceInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivHexGridIntersectionTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxSourceInfo.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ModelVisualization\\Intersections" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
@ -0,0 +1,174 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigFemPart.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivEclipseIntersectionGrid::RivEclipseIntersectionGrid(const RigMainGrid * mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool showInactiveCells)
|
||||
: m_mainGrid(mainGrid),
|
||||
m_activeCellInfo(activeCellInfo),
|
||||
m_showInactiveCells(showInactiveCells)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivEclipseIntersectionGrid::displayOffset() const
|
||||
{
|
||||
return m_mainGrid->displayModelOffset();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivEclipseIntersectionGrid::boundingBox() const
|
||||
{
|
||||
return m_mainGrid->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseIntersectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_mainGrid->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivEclipseIntersectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
|
||||
if (m_showInactiveCells)
|
||||
return !(cell.isInvalid() || (cell.subGrid() != NULL));
|
||||
else
|
||||
return m_activeCellInfo->isActive(cellIndex) && (cell.subGrid() == NULL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseIntersectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
m_mainGrid->cellCornerVertices(cellIndex, cellCorners);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseIntersectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices();
|
||||
memcpy(cornerIndices, cornerIndicesSource.data(), 8);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFemIntersectionGrid::RivFemIntersectionGrid(const RigFemPart * femPart) : m_femPart(femPart)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivFemIntersectionGrid::displayOffset() const
|
||||
{
|
||||
return cvf::Vec3d::ZERO;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivFemIntersectionGrid::boundingBox() const
|
||||
{
|
||||
return m_femPart->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemIntersectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_femPart->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivFemIntersectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemIntersectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return;
|
||||
|
||||
const std::vector<cvf::Vec3f>& nodeCoords = m_femPart->nodes().coordinates;
|
||||
const int* cornerIndices = m_femPart->connectivities(cellIndex);
|
||||
|
||||
cellCorners[0] = cvf::Vec3d(nodeCoords[cornerIndices[0]]);
|
||||
cellCorners[1] = cvf::Vec3d(nodeCoords[cornerIndices[1]]);
|
||||
cellCorners[2] = cvf::Vec3d(nodeCoords[cornerIndices[2]]);
|
||||
cellCorners[3] = cvf::Vec3d(nodeCoords[cornerIndices[3]]);
|
||||
cellCorners[4] = cvf::Vec3d(nodeCoords[cornerIndices[4]]);
|
||||
cellCorners[5] = cvf::Vec3d(nodeCoords[cornerIndices[5]]);
|
||||
cellCorners[6] = cvf::Vec3d(nodeCoords[cornerIndices[6]]);
|
||||
cellCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemIntersectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return;
|
||||
int elmIdx = static_cast<int>(cellIndex);
|
||||
cornerIndices[0] = m_femPart->elementNodeResultIdx(elmIdx, 0);
|
||||
cornerIndices[1] = m_femPart->elementNodeResultIdx(elmIdx, 1);
|
||||
cornerIndices[2] = m_femPart->elementNodeResultIdx(elmIdx, 2);
|
||||
cornerIndices[3] = m_femPart->elementNodeResultIdx(elmIdx, 3);
|
||||
cornerIndices[4] = m_femPart->elementNodeResultIdx(elmIdx, 4);
|
||||
cornerIndices[5] = m_femPart->elementNodeResultIdx(elmIdx, 5);
|
||||
cornerIndices[6] = m_femPart->elementNodeResultIdx(elmIdx, 6);
|
||||
cornerIndices[7] = m_femPart->elementNodeResultIdx(elmIdx, 7);
|
||||
}
|
||||
|
@ -0,0 +1,186 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigActiveCellInfo;
|
||||
class RigFemPart;
|
||||
class RigMainGrid;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Interface definition used to compute the geometry for planes intersecting a grid
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivIntersectionHexGridInterface : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual cvf::Vec3d displayOffset() const = 0;
|
||||
virtual cvf::BoundingBox boundingBox() const = 0;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const = 0;
|
||||
virtual bool useCell(size_t cellIndex) const = 0;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const = 0;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const = 0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivEclipseIntersectionGrid : public RivIntersectionHexGridInterface
|
||||
{
|
||||
public:
|
||||
RivEclipseIntersectionGrid(const RigMainGrid * mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigMainGrid> m_mainGrid;
|
||||
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
|
||||
bool m_showInactiveCells;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivFemIntersectionGrid : public RivIntersectionHexGridInterface
|
||||
{
|
||||
public:
|
||||
RivFemIntersectionGrid(const RigFemPart * femPart);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPart> m_femPart;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivIntersectionVertexWeights
|
||||
{
|
||||
public:
|
||||
explicit RivIntersectionVertexWeights(): m_count(0) {}
|
||||
|
||||
/*
|
||||
v111 k11 v11 v112 v211 k21 v21 v212
|
||||
+------+-----+ +--------+------+
|
||||
| |
|
||||
|k1 |k2
|
||||
| k |
|
||||
v1+--------+------------+v2
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+------+----+ +--------+-------+
|
||||
v121 k12 v12 v122 v221 k22 v22 v222
|
||||
|
||||
Where the k's are normalized distances along the edge, from the edge start vertex .
|
||||
|
||||
This is the interpolation sceme:
|
||||
|
||||
v = (1 - k )* v1 + k *v2;
|
||||
|
||||
v1 = (1 - k1 )* v11 + k1*v12;
|
||||
v2 = (1 - k2 )* v21 + k2*v22;
|
||||
|
||||
v11 = (1 - k11)* v111 + k11*v112;
|
||||
v12 = (1 - k12)* v121 + k12*v122;
|
||||
v21 = (1 - k21)* v211 + k21*v212;
|
||||
v22 = (1 - k22)* v221 + k22*v222;
|
||||
|
||||
Substitution and reorganizing gives the expressions seen below.
|
||||
|
||||
*/
|
||||
|
||||
explicit RivIntersectionVertexWeights( size_t edgeVx111, size_t edgeVx112, double k11,
|
||||
size_t edgeVx121, size_t edgeVx122, double k12,
|
||||
size_t edgeVx211, size_t edgeVx212, double k21,
|
||||
size_t edgeVx221, size_t edgeVx222, double k22,
|
||||
double k1,
|
||||
double k2,
|
||||
double k) : m_count(8)
|
||||
{
|
||||
m_vxIds[0] = (edgeVx111);
|
||||
m_vxIds[1] = (edgeVx112);
|
||||
m_vxIds[2] = (edgeVx121);
|
||||
m_vxIds[3] = (edgeVx122);
|
||||
m_vxIds[4] = (edgeVx211);
|
||||
m_vxIds[5] = (edgeVx212);
|
||||
m_vxIds[6] = (edgeVx221);
|
||||
m_vxIds[7] = (edgeVx222);
|
||||
|
||||
m_weights[7] = ((float)(k * k2 * k22));
|
||||
m_weights[6] = ((float)(k * k2 - k * k2 * k22));
|
||||
m_weights[5] = ((float)(( k - k * k2 ) * k21));
|
||||
m_weights[4] = ((float)((k * k2 - k ) * k21 - k * k2 + k));
|
||||
m_weights[3] = ((float)((1-k) * k1 * k12));
|
||||
m_weights[2] = ((float)((k-1) * k1 * k12 + ( 1 - k ) * k1));
|
||||
m_weights[1] = ((float)(( (k-1) * k1 - k + 1 ) * k11));
|
||||
m_weights[0] = ((float)(( (1-k) * k1 + k - 1 ) * k11 + ( k - 1 ) * k1 - k + 1));
|
||||
}
|
||||
|
||||
explicit RivIntersectionVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1,
|
||||
size_t edge2Vx1, size_t edge2Vx2, double normDistFromE2V1,
|
||||
double normDistFromE1Cut) : m_count(4)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
m_vxIds[2] = (edge2Vx1);
|
||||
m_vxIds[3] = (edge2Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1 - normDistFromE1Cut + normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[1] = ((float)(normDistFromE1V1 - normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[2] = ((float)(normDistFromE1Cut - normDistFromE2V1*normDistFromE1Cut));
|
||||
m_weights[3] = ((float)(normDistFromE2V1*normDistFromE1Cut));
|
||||
}
|
||||
|
||||
explicit RivIntersectionVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1) : m_count(2)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1));
|
||||
m_weights[1] = ((float)(normDistFromE1V1));
|
||||
}
|
||||
|
||||
int size() const { return m_count; }
|
||||
size_t vxId(int idx) const { return m_vxIds[idx]; }
|
||||
float weight(int idx)const { return m_weights[idx]; }
|
||||
|
||||
private:
|
||||
|
||||
size_t m_vxIds[8];
|
||||
float m_weights[8];
|
||||
int m_count;
|
||||
};
|
@ -0,0 +1,454 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfPlane.h"
|
||||
#include <array>
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxGeometryGenerator::RivIntersectionBoxGeometryGenerator(const RimIntersectionBox* intersectionBox, const RivIntersectionHexGridInterface* grid)
|
||||
: m_intersectionBoxDefinition(intersectionBox),
|
||||
m_hexGrid(grid)
|
||||
{
|
||||
m_triangleVxes = new cvf::Vec3fArray;
|
||||
m_cellBorderLineVxes = new cvf::Vec3fArray;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxGeometryGenerator::~RivIntersectionBoxGeometryGenerator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivIntersectionBoxGeometryGenerator::isAnyGeometryPresent() const
|
||||
{
|
||||
if (m_triangleVxes->size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionBoxGeometryGenerator::generateSurface()
|
||||
{
|
||||
calculateArrays();
|
||||
|
||||
CVF_ASSERT(m_triangleVxes.notNull());
|
||||
|
||||
if (m_triangleVxes->size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setFromTriangleVertexArray(m_triangleVxes.p());
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionBoxGeometryGenerator::createMeshDrawable()
|
||||
{
|
||||
if (!(m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0)) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray(m_cellBorderLineVxes.p());
|
||||
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> prim = new cvf::PrimitiveSetDirect(cvf::PT_LINES);
|
||||
prim->setIndexCount(m_cellBorderLineVxes->size());
|
||||
|
||||
geo->addPrimitiveSet(prim.p());
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivIntersectionBoxGeometryGenerator::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triangleToCellIdxMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RivIntersectionVertexWeights>& RivIntersectionBoxGeometryGenerator::triangleVxToCellCornerInterpolationWeights() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triVxToCellCornerWeights;
|
||||
}
|
||||
|
||||
|
||||
class Box
|
||||
{
|
||||
public:
|
||||
using FaceType = cvf::StructGridInterface::FaceType;
|
||||
|
||||
Box(const cvf::Mat4d& origin, const cvf::Vec3d& size) : m_origin(origin), m_size(size) {}
|
||||
|
||||
std::array<cvf::Plane, 6> planes()
|
||||
{
|
||||
std::array<cvf::Plane, 6> boxPlanes;
|
||||
|
||||
boxPlanes[FaceType::POS_I].setFromPointAndNormal( m_origin.translation() + m_size, cvf::Vec3d(m_origin.col(0)));
|
||||
boxPlanes[FaceType::NEG_I].setFromPointAndNormal( m_origin.translation() , -cvf::Vec3d(m_origin.col(0)));
|
||||
boxPlanes[FaceType::POS_J].setFromPointAndNormal( m_origin.translation() + m_size, cvf::Vec3d(m_origin.col(1)));
|
||||
boxPlanes[FaceType::NEG_J].setFromPointAndNormal( m_origin.translation() , -cvf::Vec3d(m_origin.col(1)));
|
||||
boxPlanes[FaceType::POS_K].setFromPointAndNormal( m_origin.translation() + m_size, cvf::Vec3d(m_origin.col(2)));
|
||||
boxPlanes[FaceType::NEG_K].setFromPointAndNormal( m_origin.translation() , -cvf::Vec3d(m_origin.col(2)));
|
||||
|
||||
return boxPlanes;
|
||||
}
|
||||
|
||||
std::array<cvf::Vec3d, 4> faceCorners(FaceType face)
|
||||
{
|
||||
std::array<cvf::Vec3d, 4> corners;
|
||||
|
||||
cvf::Vec3d sx = cvf::Vec3d(m_origin.col(0)) * m_size[0] ;
|
||||
cvf::Vec3d sy = cvf::Vec3d(m_origin.col(1)) * m_size[1] ;
|
||||
cvf::Vec3d sz = cvf::Vec3d(m_origin.col(2)) * m_size[2] ;
|
||||
|
||||
switch(face)
|
||||
{
|
||||
case FaceType::POS_I:
|
||||
corners[0] = m_origin.translation() + sx;
|
||||
corners[1] = m_origin.translation() + sx + sy;
|
||||
corners[2] = m_origin.translation() + sx + sy + sz;
|
||||
corners[3] = m_origin.translation() + sx + sz;
|
||||
break;
|
||||
case FaceType::NEG_I:
|
||||
corners[0] = m_origin.translation();
|
||||
corners[1] = m_origin.translation() + sz;
|
||||
corners[2] = m_origin.translation() + sy + sz;
|
||||
corners[3] = m_origin.translation() + sy;
|
||||
break;
|
||||
case FaceType::POS_J:
|
||||
corners[0] = m_origin.translation() + sy;
|
||||
corners[1] = m_origin.translation() + sy + sz;
|
||||
corners[2] = m_origin.translation() + sy + sx + sz;
|
||||
corners[3] = m_origin.translation() + sy + sx;
|
||||
break;
|
||||
case FaceType::NEG_J:
|
||||
corners[0] = m_origin.translation() ;
|
||||
corners[1] = m_origin.translation() + sx;
|
||||
corners[2] = m_origin.translation() + sx + sz;
|
||||
corners[3] = m_origin.translation() + sz;
|
||||
break;
|
||||
case FaceType::POS_K:
|
||||
corners[0] = m_origin.translation() + sz;
|
||||
corners[1] = m_origin.translation() + sz + sx;
|
||||
corners[2] = m_origin.translation() + sz + sx + sy;
|
||||
corners[3] = m_origin.translation() + sz + sy;
|
||||
break;
|
||||
case FaceType::NEG_K:
|
||||
corners[0] = m_origin.translation();
|
||||
corners[1] = m_origin.translation() + sy;
|
||||
corners[2] = m_origin.translation() + sx + sy;
|
||||
corners[3] = m_origin.translation() + sx;
|
||||
break;
|
||||
}
|
||||
|
||||
return corners;
|
||||
}
|
||||
|
||||
// Returns the four adjacent faces in the Pos, Neg, Pos, Neg order
|
||||
|
||||
std::array<FaceType, 4> adjacentFaces(FaceType face)
|
||||
{
|
||||
std::array<FaceType, 4> clipFaces;
|
||||
FaceType oppFace = cvf::StructGridInterface::oppositeFace(face);
|
||||
int clipFaceCount = 0;
|
||||
for (int faceCand = 0; faceCand < 6; ++faceCand )
|
||||
{
|
||||
if (faceCand != face && faceCand != oppFace)
|
||||
{
|
||||
clipFaces[clipFaceCount] = (FaceType) faceCand;
|
||||
clipFaceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return clipFaces;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
cvf::Mat4d m_origin;
|
||||
cvf::Vec3d m_size;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimIntersectionBox* RivIntersectionBoxGeometryGenerator::intersectionBox() const
|
||||
{
|
||||
return m_intersectionBoxDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxGeometryGenerator::calculateArrays()
|
||||
{
|
||||
if(m_triangleVxes->size()) return;
|
||||
|
||||
std::vector<cvf::Vec3f> triangleVertices;
|
||||
std::vector<cvf::Vec3f> cellBorderLineVxes;
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
|
||||
|
||||
Box box(m_intersectionBoxDefinition->boxOrigin(), m_intersectionBoxDefinition->boxSize());
|
||||
std::array<cvf::Plane, 6> boxPlanes = box.planes();
|
||||
|
||||
RimIntersectionBox::SinglePlaneState singlePlane = m_intersectionBoxDefinition->singlePlaneState();
|
||||
|
||||
int startFace = 0; int endFace = 5;
|
||||
if (singlePlane == RimIntersectionBox::PLANE_STATE_X) startFace = endFace = Box::FaceType::POS_I;
|
||||
if (singlePlane == RimIntersectionBox::PLANE_STATE_Y) startFace = endFace = Box::FaceType::POS_J;
|
||||
if (singlePlane == RimIntersectionBox::PLANE_STATE_Z) startFace = endFace = Box::FaceType::POS_K;
|
||||
|
||||
for (int faceIdx = startFace; faceIdx <= endFace; ++faceIdx)
|
||||
{
|
||||
cvf::Plane plane = boxPlanes[faceIdx];
|
||||
|
||||
std::array<Box::FaceType, 4> clipFaces = box.adjacentFaces((Box::FaceType)faceIdx);
|
||||
|
||||
cvf::Plane p1Plane = boxPlanes[clipFaces[1]];
|
||||
cvf::Plane p2Plane = boxPlanes[clipFaces[0]];
|
||||
cvf::Plane p3Plane = boxPlanes[clipFaces[3]];
|
||||
cvf::Plane p4Plane = boxPlanes[clipFaces[2]];
|
||||
|
||||
p1Plane.flip();
|
||||
p2Plane.flip();
|
||||
p3Plane.flip();
|
||||
p4Plane.flip();
|
||||
|
||||
std::array<cvf::Vec3d, 4> faceCorners = box.faceCorners((Box::FaceType)faceIdx);
|
||||
|
||||
cvf::BoundingBox sectionBBox;
|
||||
|
||||
for (cvf::Vec3d& corner : faceCorners) sectionBBox.add(corner);
|
||||
|
||||
// Similar code as IntersectionGenerator :
|
||||
|
||||
std::vector<size_t> columnCellCandidates;
|
||||
m_hexGrid->findIntersectingCells(sectionBBox, &columnCellCandidates);
|
||||
|
||||
std::vector<caf::HexGridIntersectionTools::ClipVx> hexPlaneCutTriangleVxes;
|
||||
hexPlaneCutTriangleVxes.reserve(5*3);
|
||||
std::vector<bool> isTriangleEdgeCellContour;
|
||||
isTriangleEdgeCellContour.reserve(5*3);
|
||||
cvf::Vec3d cellCorners[8];
|
||||
size_t cornerIndices[8];
|
||||
|
||||
for(size_t cccIdx = 0; cccIdx < columnCellCandidates.size(); ++cccIdx)
|
||||
{
|
||||
size_t globalCellIdx = columnCellCandidates[cccIdx];
|
||||
|
||||
if(!m_hexGrid->useCell(globalCellIdx)) continue;
|
||||
|
||||
hexPlaneCutTriangleVxes.clear();
|
||||
m_hexGrid->cellCornerVertices(globalCellIdx, cellCorners);
|
||||
m_hexGrid->cellCornerIndices(globalCellIdx, cornerIndices);
|
||||
|
||||
caf::HexGridIntersectionTools::planeHexIntersectionMC(plane,
|
||||
cellCorners,
|
||||
cornerIndices,
|
||||
&hexPlaneCutTriangleVxes,
|
||||
&isTriangleEdgeCellContour);
|
||||
|
||||
std::vector<caf::HexGridIntersectionTools::ClipVx> clippedTriangleVxes_once;
|
||||
std::vector<bool> isClippedTriEdgeCellContour_once;
|
||||
caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes(hexPlaneCutTriangleVxes, isTriangleEdgeCellContour, p1Plane, p2Plane,
|
||||
&clippedTriangleVxes_once, &isClippedTriEdgeCellContour_once);
|
||||
|
||||
for (caf::HexGridIntersectionTools::ClipVx& clvx : clippedTriangleVxes_once) if (!clvx.isVxIdsNative) clvx.derivedVxLevel = 0;
|
||||
|
||||
std::vector<caf::HexGridIntersectionTools::ClipVx> clippedTriangleVxes;
|
||||
std::vector<bool> isClippedTriEdgeCellContour;
|
||||
|
||||
caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes(clippedTriangleVxes_once, isClippedTriEdgeCellContour_once, p3Plane, p4Plane,
|
||||
&clippedTriangleVxes, &isClippedTriEdgeCellContour);
|
||||
for (caf::HexGridIntersectionTools::ClipVx& clvx : clippedTriangleVxes) if (!clvx.isVxIdsNative && clvx.derivedVxLevel == -1) clvx.derivedVxLevel = 1;
|
||||
|
||||
size_t clippedTriangleCount = clippedTriangleVxes.size()/3;
|
||||
|
||||
for(uint tIdx = 0; tIdx < clippedTriangleCount; ++tIdx)
|
||||
{
|
||||
uint triVxIdx = tIdx*3;
|
||||
|
||||
// Accumulate triangle vertices
|
||||
|
||||
cvf::Vec3f p0(clippedTriangleVxes[triVxIdx+0].vx - displayOffset);
|
||||
cvf::Vec3f p1(clippedTriangleVxes[triVxIdx+1].vx - displayOffset);
|
||||
cvf::Vec3f p2(clippedTriangleVxes[triVxIdx+2].vx - displayOffset);
|
||||
|
||||
triangleVertices.push_back(p0);
|
||||
triangleVertices.push_back(p1);
|
||||
triangleVertices.push_back(p2);
|
||||
|
||||
|
||||
// Accumulate mesh lines
|
||||
|
||||
if(isClippedTriEdgeCellContour[triVxIdx])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p0);
|
||||
cellBorderLineVxes.push_back(p1);
|
||||
}
|
||||
if(isClippedTriEdgeCellContour[triVxIdx+1])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p1);
|
||||
cellBorderLineVxes.push_back(p2);
|
||||
}
|
||||
if(isClippedTriEdgeCellContour[triVxIdx+2])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p2);
|
||||
cellBorderLineVxes.push_back(p0);
|
||||
}
|
||||
|
||||
// Mapping to cell index
|
||||
|
||||
m_triangleToCellIdxMap.push_back(globalCellIdx);
|
||||
|
||||
// Interpolation from nodes
|
||||
for(int i = 0; i < 3; ++i)
|
||||
{
|
||||
caf::HexGridIntersectionTools::ClipVx cvx = clippedTriangleVxes[triVxIdx + i];
|
||||
if(cvx.isVxIdsNative)
|
||||
{
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivIntersectionVertexWeights(cvx.clippedEdgeVx1Id, cvx.clippedEdgeVx2Id, cvx.normDistFromEdgeVx1));
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::HexGridIntersectionTools::ClipVx cvx1;
|
||||
caf::HexGridIntersectionTools::ClipVx cvx2;
|
||||
|
||||
if (cvx.derivedVxLevel == 0)
|
||||
{
|
||||
cvx1 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx1Id];
|
||||
cvx2 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx2Id];
|
||||
}
|
||||
else if(cvx.derivedVxLevel == 1)
|
||||
{
|
||||
cvx1 = clippedTriangleVxes_once[cvx.clippedEdgeVx1Id];
|
||||
cvx2 = clippedTriangleVxes_once[cvx.clippedEdgeVx2Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
|
||||
if(cvx1.isVxIdsNative && cvx2.isVxIdsNative)
|
||||
{
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivIntersectionVertexWeights(cvx1.clippedEdgeVx1Id, cvx1.clippedEdgeVx2Id, cvx1.normDistFromEdgeVx1,
|
||||
cvx2.clippedEdgeVx1Id, cvx2.clippedEdgeVx2Id, cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1));
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::HexGridIntersectionTools::ClipVx cvx11;
|
||||
caf::HexGridIntersectionTools::ClipVx cvx12;
|
||||
caf::HexGridIntersectionTools::ClipVx cvx21;
|
||||
caf::HexGridIntersectionTools::ClipVx cvx22;
|
||||
|
||||
if(cvx1.isVxIdsNative)
|
||||
{
|
||||
cvx11 = cvx1;
|
||||
cvx12 = cvx1;
|
||||
}
|
||||
else if(cvx1.derivedVxLevel == 0)
|
||||
{
|
||||
cvx11 = hexPlaneCutTriangleVxes[cvx1.clippedEdgeVx1Id];
|
||||
cvx12 = hexPlaneCutTriangleVxes[cvx1.clippedEdgeVx2Id];
|
||||
}
|
||||
else if(cvx2.derivedVxLevel == 1)
|
||||
{
|
||||
cvx11 = clippedTriangleVxes_once[cvx1.clippedEdgeVx1Id];
|
||||
cvx12 = clippedTriangleVxes_once[cvx1.clippedEdgeVx2Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
|
||||
|
||||
if(cvx2.isVxIdsNative)
|
||||
{
|
||||
cvx21 = cvx2;
|
||||
cvx22 = cvx2;
|
||||
}
|
||||
else if(cvx2.derivedVxLevel == 0)
|
||||
{
|
||||
cvx21 = hexPlaneCutTriangleVxes[cvx2.clippedEdgeVx1Id];
|
||||
cvx22 = hexPlaneCutTriangleVxes[cvx2.clippedEdgeVx2Id];
|
||||
}
|
||||
else if(cvx2.derivedVxLevel == 1)
|
||||
{
|
||||
cvx21 = clippedTriangleVxes_once[cvx2.clippedEdgeVx1Id];
|
||||
cvx22 = clippedTriangleVxes_once[cvx2.clippedEdgeVx2Id];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
|
||||
CVF_TIGHT_ASSERT(cvx11.isVxIdsNative && cvx12.isVxIdsNative && cvx21.isVxIdsNative && cvx22.isVxIdsNative);
|
||||
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivIntersectionVertexWeights(cvx11.clippedEdgeVx1Id, cvx11.clippedEdgeVx2Id, cvx11.normDistFromEdgeVx1,
|
||||
cvx12.clippedEdgeVx1Id, cvx12.clippedEdgeVx2Id, cvx2.normDistFromEdgeVx1,
|
||||
cvx21.clippedEdgeVx1Id, cvx21.clippedEdgeVx2Id, cvx21.normDistFromEdgeVx1,
|
||||
cvx22.clippedEdgeVx1Id, cvx22.clippedEdgeVx2Id, cvx22.normDistFromEdgeVx1,
|
||||
cvx1.normDistFromEdgeVx1,
|
||||
cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_cellBorderLineVxes->assign(cellBorderLineVxes);
|
||||
m_triangleVxes->assign(triangleVertices);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimIntersectionBox;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ScalarMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
|
||||
class RivIntersectionBoxGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionBoxGeometryGenerator(const RimIntersectionBox* intersectionBox,
|
||||
const RivIntersectionHexGridInterface* grid);
|
||||
|
||||
~RivIntersectionBoxGeometryGenerator();
|
||||
|
||||
bool isAnyGeometryPresent() const;
|
||||
|
||||
// Generate geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
|
||||
// Mapping between cells and geometry
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const;
|
||||
|
||||
const RimIntersectionBox* intersectionBox() const;
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
|
||||
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;
|
||||
|
||||
// Output arrays
|
||||
cvf::ref<cvf::Vec3fArray> m_triangleVxes;
|
||||
cvf::ref<cvf::Vec3fArray> m_cellBorderLineVxes;
|
||||
std::vector<size_t> m_triangleToCellIdxMap;
|
||||
std::vector<RivIntersectionVertexWeights> m_triVxToCellCornerWeights;
|
||||
|
||||
const RimIntersectionBox* m_intersectionBoxDefinition;
|
||||
};
|
||||
|
@ -0,0 +1,428 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "RivIntersectionBoxPartMgr.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfRenderState_FF.h"
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfRenderStatePoint.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxPartMgr::RivIntersectionBoxPartMgr(const RimIntersectionBox* intersectionBox)
|
||||
: m_rimIntersectionBox(intersectionBox),
|
||||
m_defaultColor(cvf::Color3::WHITE)
|
||||
{
|
||||
CVF_ASSERT(m_rimIntersectionBox);
|
||||
|
||||
m_intersectionBoxFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
|
||||
m_intersectionBoxGenerator = new RivIntersectionBoxGeometryGenerator(m_rimIntersectionBox, hexGrid.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::applySingleColorEffect()
|
||||
{
|
||||
m_defaultColor = cvf::Color3f::OLIVE;//m_rimCrossSection->CrossSectionColor();
|
||||
this->updatePartEffect();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
|
||||
if (!m_intersectionBoxGenerator->isAnyGeometryPresent()) return;
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimIntersectionBox->firstAnchestorOrThisOfType(eclipseView);
|
||||
|
||||
if (eclipseView)
|
||||
{
|
||||
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
|
||||
CVF_ASSERT(cellResultColors);
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
RigCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
|
||||
|
||||
// CrossSections
|
||||
if (m_intersectionBoxFaces.notNull())
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(), timeStepIndex);
|
||||
|
||||
texturer.createTextureCoords(m_intersectionBoxFacesTextureCoords.p(), m_intersectionBoxGenerator->triangleToCellIndex());
|
||||
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_intersectionBoxFaces.p(),
|
||||
m_intersectionBoxFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(m_intersectionBoxGenerator.notNull());
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
cvf::ref<RigResultAccessor> resultAccessor;
|
||||
|
||||
if (RimDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
|
||||
{
|
||||
resultAccessor = new RigHugeValResultAccessor;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
|
||||
0,
|
||||
timeStepIndex,
|
||||
cellResultColors);
|
||||
}
|
||||
|
||||
RivIntersectionBoxPartMgr::calculateEclipseTextureCoordinates(m_intersectionBoxFacesTextureCoords.p(),
|
||||
m_intersectionBoxGenerator->triangleToCellIndex(),
|
||||
resultAccessor.p(),
|
||||
mapper);
|
||||
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_intersectionBoxFaces.p(),
|
||||
m_intersectionBoxFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
m_rimIntersectionBox->firstAnchestorOrThisOfType(geoView);
|
||||
|
||||
if (geoView)
|
||||
{
|
||||
RimGeoMechCellColors* cellResultColors = geoView->cellResult();
|
||||
RigGeoMechCaseData* caseData = cellResultColors->ownerCaseData();
|
||||
|
||||
if (!caseData) return;
|
||||
|
||||
RigFemResultAddress resVarAddress = cellResultColors->resultAddress();
|
||||
|
||||
// Do a "Hack" to show elm nodal and not nodal POR results
|
||||
if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
|
||||
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights = m_intersectionBoxGenerator->triangleVxToCellCornerInterpolationWeights();
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, 0, (int)timeStepIndex);
|
||||
bool isElementNodalResult = !(resVarAddress.resultPosType == RIG_NODAL);
|
||||
RigFemPart* femPart = caseData->femParts()->part(0);
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
RivIntersectionBoxPartMgr::calculateGeoMechTextureCoords(m_intersectionBoxFacesTextureCoords.p(),
|
||||
vertexWeights,
|
||||
resultValues,
|
||||
isElementNodalResult,
|
||||
femPart,
|
||||
mapper);
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_intersectionBoxFaces.p(),
|
||||
m_intersectionBoxFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
geoView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights,
|
||||
const std::vector<float> &resultValues,
|
||||
bool isElementNodalResult,
|
||||
const RigFemPart* femPart,
|
||||
const cvf::ScalarMapper* mapper)
|
||||
{
|
||||
textureCoords->resize(vertexWeights.size());
|
||||
|
||||
if (resultValues.size() == 0)
|
||||
{
|
||||
textureCoords->setAll(cvf::Vec2f(0.0, 1.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Vec2f* rawPtr = textureCoords->ptr();
|
||||
|
||||
int vxCount = static_cast<int>(vertexWeights.size());
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int triangleVxIdx = 0; triangleVxIdx < vxCount; ++triangleVxIdx)
|
||||
{
|
||||
float resValue = 0;
|
||||
int weightCount = vertexWeights[triangleVxIdx].size();
|
||||
for (int wIdx = 0; wIdx < weightCount; ++wIdx)
|
||||
{
|
||||
size_t resIdx = isElementNodalResult ? vertexWeights[triangleVxIdx].vxId(wIdx) :
|
||||
femPart->nodeIdxFromElementNodeResultIdx(vertexWeights[triangleVxIdx].vxId(wIdx));
|
||||
resValue += resultValues[resIdx] * vertexWeights[triangleVxIdx].weight(wIdx);
|
||||
}
|
||||
|
||||
if (resValue == HUGE_VAL || resValue != resValue) // a != a is true for NAN's
|
||||
{
|
||||
rawPtr[triangleVxIdx][1] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
rawPtr[triangleVxIdx] = mapper->mapToTextureCoord(resValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Calculates the texture coordinates in a "nearly" one dimensional texture.
|
||||
/// Undefined values are coded with a y-texture coordinate value of 1.0 instead of the normal 0.5
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<size_t>& triangleToCellIdxMap,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const cvf::ScalarMapper* mapper)
|
||||
{
|
||||
if (!resultAccessor) return;
|
||||
|
||||
size_t numVertices = triangleToCellIdxMap.size()*3;
|
||||
|
||||
textureCoords->resize(numVertices);
|
||||
cvf::Vec2f* rawPtr = textureCoords->ptr();
|
||||
|
||||
int triangleCount = static_cast<int>(triangleToCellIdxMap.size());
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int tIdx = 0; tIdx < triangleCount; tIdx++)
|
||||
{
|
||||
double cellScalarValue = resultAccessor->cellScalarGlobIdx(triangleToCellIdxMap[tIdx]);
|
||||
cvf::Vec2f texCoord = mapper->mapToTextureCoord(cellScalarValue);
|
||||
if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's
|
||||
{
|
||||
texCoord[1] = 1.0f;
|
||||
}
|
||||
|
||||
size_t j;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
rawPtr[tIdx*3 + j] = texCoord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int priCrossSectionGeo = 1;
|
||||
const int priNncGeo = 2;
|
||||
const int priMesh = 3;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::generatePartGeometry()
|
||||
{
|
||||
|
||||
bool useBufferObjects = true;
|
||||
// Surface geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geo = m_intersectionBoxGenerator->generateSurface();
|
||||
if (geo.notNull())
|
||||
{
|
||||
geo->computeNormals();
|
||||
|
||||
if (useBufferObjects)
|
||||
{
|
||||
geo->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("Intersection Box");
|
||||
part->setDrawable(geo.p());
|
||||
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivIntersectionBoxSourceInfo> si = new RivIntersectionBoxSourceInfo(m_intersectionBoxGenerator.p());
|
||||
part->setSourceInfo(si.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priCrossSectionGeo);
|
||||
|
||||
m_intersectionBoxFaces = part;
|
||||
}
|
||||
}
|
||||
|
||||
// Mesh geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geoMesh = m_intersectionBoxGenerator->createMeshDrawable();
|
||||
if (geoMesh.notNull())
|
||||
{
|
||||
if (useBufferObjects)
|
||||
{
|
||||
geoMesh->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("Intersection box mesh");
|
||||
part->setDrawable(geoMesh.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(priMesh);
|
||||
|
||||
m_intersectionBoxGridLines = part;
|
||||
}
|
||||
}
|
||||
|
||||
updatePartEffect();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::updatePartEffect()
|
||||
{
|
||||
// Set deCrossSection effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(m_defaultColor, caf::PO_1);
|
||||
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
|
||||
|
||||
if (m_intersectionBoxFaces.notNull())
|
||||
{
|
||||
m_intersectionBoxFaces->setEffect(geometryOnlyEffect.p());
|
||||
}
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
//RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(cvf::Color3::WHITE);//prefs->defaultCrossSectionGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
|
||||
if (m_intersectionBoxGridLines.notNull())
|
||||
{
|
||||
m_intersectionBoxGridLines->setEffect(eff.p());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_intersectionBoxFaces.isNull() && m_intersectionBoxGridLines.isNull())
|
||||
{
|
||||
generatePartGeometry();
|
||||
}
|
||||
|
||||
if (m_intersectionBoxFaces.notNull())
|
||||
{
|
||||
m_intersectionBoxFaces->setTransform(scaleTransform);
|
||||
model->addPart(m_intersectionBoxFaces.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_intersectionBoxFaces.isNull() && m_intersectionBoxGridLines.isNull())
|
||||
{
|
||||
generatePartGeometry();
|
||||
}
|
||||
|
||||
if (m_intersectionBoxGridLines.notNull())
|
||||
{
|
||||
m_intersectionBoxGridLines->setTransform(scaleTransform);
|
||||
model->addPart(m_intersectionBoxGridLines.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RivIntersectionHexGridInterface> RivIntersectionBoxPartMgr::createHexGridInterface()
|
||||
{
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimIntersectionBox->firstAnchestorOrThisOfType(eclipseView);
|
||||
if (eclipseView)
|
||||
{
|
||||
RigMainGrid* grid = NULL;
|
||||
grid = eclipseView->eclipseCase()->reservoirData()->mainGrid();
|
||||
|
||||
// TODO: Should flag for inactive cells be available at a centralized object?
|
||||
return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), false);
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
m_rimIntersectionBox->firstAnchestorOrThisOfType(geoView);
|
||||
if (geoView)
|
||||
{
|
||||
RigFemPart* femPart = geoView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
return new RivFemIntersectionGrid(femPart);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Part;
|
||||
}
|
||||
|
||||
class RigMainGrid;
|
||||
class RigResultAccessor;
|
||||
class RimCellEdgeColors;
|
||||
class RimEclipseCellColors;
|
||||
class RimIntersectionBox;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RivIntersectionBoxPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionBoxPartMgr(const RimIntersectionBox* intersectionBox);
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
|
||||
|
||||
void appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
void appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
private:
|
||||
void updatePartEffect();
|
||||
void generatePartGeometry();
|
||||
|
||||
static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<size_t>& triangleToCellIdxMap,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
|
||||
static void calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights,
|
||||
const std::vector<float> &resultValues,
|
||||
bool isElementNodalResult,
|
||||
const RigFemPart* femPart,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
|
||||
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
|
||||
private:
|
||||
const RimIntersectionBox* m_rimIntersectionBox;
|
||||
|
||||
cvf::Color3f m_defaultColor;
|
||||
|
||||
cvf::ref<cvf::Part> m_intersectionBoxFaces;
|
||||
cvf::ref<cvf::Part> m_intersectionBoxGridLines;
|
||||
cvf::ref<cvf::Vec2fArray> m_intersectionBoxFacesTextureCoords;
|
||||
|
||||
cvf::ref<RivIntersectionBoxGeometryGenerator> m_intersectionBoxGenerator;
|
||||
};
|
@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "RivIntersectionBoxSourceInfo.h"
|
||||
|
||||
#include "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxSourceInfo::RivIntersectionBoxSourceInfo(RivIntersectionBoxGeometryGenerator* geometryGenerator)
|
||||
: m_intersectionBoxGeometryGenerator(geometryGenerator)
|
||||
{
|
||||
CVF_ASSERT(m_intersectionBoxGeometryGenerator.notNull());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivIntersectionBoxSourceInfo::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_intersectionBoxGeometryGenerator.notNull());
|
||||
|
||||
return m_intersectionBoxGeometryGenerator->triangleToCellIndex();
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 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 "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RivIntersectionBoxGeometryGenerator;
|
||||
class RimIntersectionBox;
|
||||
|
||||
class RivIntersectionBoxSourceInfo : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionBoxSourceInfo(RivIntersectionBoxGeometryGenerator* geometryGenerator);
|
||||
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
|
||||
private:
|
||||
cvf::cref<RivIntersectionBoxGeometryGenerator> m_intersectionBoxGeometryGenerator;
|
||||
};
|
@ -0,0 +1,387 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RivIntersectionGeometryGenerator.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "RimIntersection.h"
|
||||
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionGeometryGenerator::RivIntersectionGeometryGenerator(const RimIntersection* crossSection,
|
||||
std::vector<std::vector<cvf::Vec3d> > &polylines,
|
||||
const cvf::Vec3d& extrusionDirection,
|
||||
const RivIntersectionHexGridInterface* grid)
|
||||
: m_crossSection(crossSection),
|
||||
m_polyLines(polylines),
|
||||
m_extrusionDirection(extrusionDirection),
|
||||
m_hexGrid(grid)
|
||||
{
|
||||
m_triangleVxes = new cvf::Vec3fArray;
|
||||
m_cellBorderLineVxes = new cvf::Vec3fArray;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionGeometryGenerator::~RivIntersectionGeometryGenerator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionGeometryGenerator::calculateArrays()
|
||||
{
|
||||
if (m_triangleVxes->size()) return;
|
||||
|
||||
m_extrusionDirection.normalize();
|
||||
std::vector<cvf::Vec3f> triangleVertices;
|
||||
std::vector<cvf::Vec3f> cellBorderLineVxes;
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
|
||||
|
||||
if (m_polyLine.size() < 2) continue;
|
||||
|
||||
std::vector<cvf::Vec3d> m_adjustedPolyline;
|
||||
adjustPolyline(m_polyLine, m_extrusionDirection, &m_adjustedPolyline);
|
||||
|
||||
size_t lineCount = m_adjustedPolyline.size();
|
||||
for (size_t lIdx = 0; lIdx < lineCount - 1; ++lIdx)
|
||||
{
|
||||
cvf::Vec3d p1 = m_adjustedPolyline[lIdx];
|
||||
cvf::Vec3d p2 = m_adjustedPolyline[lIdx+1];
|
||||
|
||||
cvf::BoundingBox sectionBBox;
|
||||
sectionBBox.add(p1);
|
||||
sectionBBox.add(p2);
|
||||
double maxSectionHeight = gridBBox.radius();
|
||||
sectionBBox.add(p1 + m_extrusionDirection*maxSectionHeight);
|
||||
sectionBBox.add(p1 - m_extrusionDirection*maxSectionHeight);
|
||||
sectionBBox.add(p2 + m_extrusionDirection*maxSectionHeight);
|
||||
sectionBBox.add(p2 - m_extrusionDirection*maxSectionHeight);
|
||||
|
||||
std::vector<size_t> columnCellCandidates;
|
||||
m_hexGrid->findIntersectingCells(sectionBBox, &columnCellCandidates);
|
||||
|
||||
cvf::Plane plane;
|
||||
plane.setFromPoints(p1, p2, p2 + m_extrusionDirection*maxSectionHeight);
|
||||
|
||||
cvf::Plane p1Plane;
|
||||
p1Plane.setFromPoints(p1, p1 + m_extrusionDirection*maxSectionHeight, p1 + plane.normal());
|
||||
cvf::Plane p2Plane;
|
||||
p2Plane.setFromPoints(p2, p2 + m_extrusionDirection*maxSectionHeight, p2 - plane.normal());
|
||||
|
||||
|
||||
std::vector<caf::HexGridIntersectionTools::ClipVx> hexPlaneCutTriangleVxes;
|
||||
hexPlaneCutTriangleVxes.reserve(5*3);
|
||||
std::vector<bool> isTriangleEdgeCellContour;
|
||||
isTriangleEdgeCellContour.reserve(5*3);
|
||||
cvf::Vec3d cellCorners[8];
|
||||
size_t cornerIndices[8];
|
||||
|
||||
for (size_t cccIdx = 0; cccIdx < columnCellCandidates.size(); ++cccIdx)
|
||||
{
|
||||
size_t globalCellIdx = columnCellCandidates[cccIdx];
|
||||
|
||||
if (!m_hexGrid->useCell(globalCellIdx)) continue;
|
||||
|
||||
hexPlaneCutTriangleVxes.clear();
|
||||
m_hexGrid->cellCornerVertices(globalCellIdx, cellCorners);
|
||||
m_hexGrid->cellCornerIndices(globalCellIdx, cornerIndices);
|
||||
|
||||
caf::HexGridIntersectionTools::planeHexIntersectionMC(plane,
|
||||
cellCorners,
|
||||
cornerIndices,
|
||||
&hexPlaneCutTriangleVxes,
|
||||
&isTriangleEdgeCellContour);
|
||||
|
||||
std::vector<caf::HexGridIntersectionTools::ClipVx> clippedTriangleVxes;
|
||||
std::vector<bool> isClippedTriEdgeCellContour;
|
||||
|
||||
caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes(hexPlaneCutTriangleVxes, isTriangleEdgeCellContour, p1Plane, p2Plane,
|
||||
&clippedTriangleVxes, &isClippedTriEdgeCellContour);
|
||||
|
||||
size_t clippedTriangleCount = clippedTriangleVxes.size()/3;
|
||||
|
||||
for (uint tIdx = 0; tIdx < clippedTriangleCount; ++tIdx)
|
||||
{
|
||||
uint triVxIdx = tIdx*3;
|
||||
|
||||
// Accumulate triangle vertices
|
||||
|
||||
cvf::Vec3f p0(clippedTriangleVxes[triVxIdx+0].vx - displayOffset);
|
||||
cvf::Vec3f p1(clippedTriangleVxes[triVxIdx+1].vx - displayOffset);
|
||||
cvf::Vec3f p2(clippedTriangleVxes[triVxIdx+2].vx - displayOffset);
|
||||
|
||||
triangleVertices.push_back(p0);
|
||||
triangleVertices.push_back(p1);
|
||||
triangleVertices.push_back(p2);
|
||||
|
||||
|
||||
// Accumulate mesh lines
|
||||
|
||||
if (isClippedTriEdgeCellContour[triVxIdx])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p0);
|
||||
cellBorderLineVxes.push_back(p1);
|
||||
}
|
||||
if (isClippedTriEdgeCellContour[triVxIdx+1])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p1);
|
||||
cellBorderLineVxes.push_back(p2);
|
||||
}
|
||||
if (isClippedTriEdgeCellContour[triVxIdx+2])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p2);
|
||||
cellBorderLineVxes.push_back(p0);
|
||||
}
|
||||
|
||||
// Mapping to cell index
|
||||
|
||||
m_triangleToCellIdxMap.push_back(globalCellIdx);
|
||||
|
||||
// Interpolation from nodes
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
caf::HexGridIntersectionTools::ClipVx cvx = clippedTriangleVxes[triVxIdx + i];
|
||||
if (cvx.isVxIdsNative)
|
||||
{
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivIntersectionVertexWeights(cvx.clippedEdgeVx1Id, cvx.clippedEdgeVx2Id, cvx.normDistFromEdgeVx1));
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::HexGridIntersectionTools::ClipVx cvx1 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx1Id];
|
||||
caf::HexGridIntersectionTools::ClipVx cvx2 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx2Id];
|
||||
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivIntersectionVertexWeights(cvx1.clippedEdgeVx1Id, cvx1.clippedEdgeVx2Id, cvx1.normDistFromEdgeVx1,
|
||||
cvx2.clippedEdgeVx1Id, cvx2.clippedEdgeVx2Id, cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_triangleVxes->assign(triangleVertices);
|
||||
m_cellBorderLineVxes->assign(cellBorderLineVxes);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Generate surface drawable geo from the specified region
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::generateSurface()
|
||||
{
|
||||
calculateArrays();
|
||||
|
||||
CVF_ASSERT(m_triangleVxes.notNull());
|
||||
|
||||
if (m_triangleVxes->size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setFromTriangleVertexArray(m_triangleVxes.p());
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createMeshDrawable()
|
||||
{
|
||||
if (!(m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0)) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray(m_cellBorderLineVxes.p());
|
||||
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> prim = new cvf::PrimitiveSetDirect(cvf::PT_LINES);
|
||||
prim->setIndexCount(m_cellBorderLineVxes->size());
|
||||
|
||||
geo->addPrimitiveSet(prim.p());
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPolylineDrawable()
|
||||
{
|
||||
std::vector<cvf::uint> lineIndices;
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
|
||||
if (m_polyLine.size() < 2) continue;
|
||||
|
||||
for (size_t i = 0; i < m_polyLine.size(); ++i)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(m_polyLine[i] - displayOffset));
|
||||
if (i < m_polyLine.size() - 1)
|
||||
{
|
||||
lineIndices.push_back(static_cast<cvf::uint>(i));
|
||||
lineIndices.push_back(static_cast<cvf::uint>(i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray;
|
||||
vx->assign(vertices);
|
||||
cvf::ref<cvf::UIntArray> idxes = new cvf::UIntArray;
|
||||
idxes->assign(lineIndices);
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);
|
||||
prim->setIndices(idxes.p());
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = new cvf::DrawableGeo;
|
||||
polylineGeo->setVertexArray(vx.p());
|
||||
polylineGeo->addPrimitiveSet(prim.p());
|
||||
|
||||
return polylineGeo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPolylineDrawable()
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
|
||||
for (size_t i = 0; i < m_polyLine.size(); ++i)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(m_polyLine[i] - displayOffset));
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> primSet = new cvf::PrimitiveSetDirect(cvf::PT_POINTS);
|
||||
primSet->setStartIndex(0);
|
||||
primSet->setIndexCount(vertices.size());
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray(vertices);
|
||||
geo->setVertexArray(vx.p());
|
||||
geo->addPrimitiveSet(primSet.p());
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Remove the lines from the polyline that is nearly parallel to the extrusion direction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionGeometryGenerator::adjustPolyline(const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
std::vector<cvf::Vec3d>* adjustedPolyline)
|
||||
{
|
||||
size_t lineCount = polyLine.size();
|
||||
if (!polyLine.size()) return;
|
||||
|
||||
adjustedPolyline->push_back(polyLine[0]);
|
||||
cvf::Vec3d p1 = polyLine[0];
|
||||
|
||||
for (size_t lIdx = 1; lIdx < lineCount; ++lIdx)
|
||||
{
|
||||
cvf::Vec3d p2 = polyLine[lIdx];
|
||||
cvf::Vec3d p1p2 = p2 - p1;
|
||||
|
||||
if ((p1p2 - (p1p2 * extrDir)*extrDir).length() > 0.1 )
|
||||
{
|
||||
adjustedPolyline->push_back(p2);
|
||||
p1 = p2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivIntersectionGeometryGenerator::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triangleToCellIdxMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RivIntersectionVertexWeights>& RivIntersectionGeometryGenerator::triangleVxToCellCornerInterpolationWeights() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triVxToCellCornerWeights;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimIntersection* RivIntersectionGeometryGenerator::crossSection() const
|
||||
{
|
||||
return m_crossSection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivIntersectionGeometryGenerator::isAnyGeometryPresent() const
|
||||
{
|
||||
if (m_triangleVxes->size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,88 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigMainGrid;
|
||||
class RigActiveCellInfo;
|
||||
class RigResultAccessor;
|
||||
class RimIntersection;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ScalarMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
|
||||
class RivIntersectionGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionGeometryGenerator(const RimIntersection* crossSection,
|
||||
std::vector<std::vector<cvf::Vec3d> > &polylines,
|
||||
const cvf::Vec3d& extrusionDirection,
|
||||
const RivIntersectionHexGridInterface* grid );
|
||||
|
||||
~RivIntersectionGeometryGenerator();
|
||||
|
||||
bool isAnyGeometryPresent() const;
|
||||
|
||||
// Generate geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable();
|
||||
|
||||
// Mapping between cells and geometry
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const;
|
||||
|
||||
const RimIntersection* crossSection() const;
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
static void adjustPolyline(const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
std::vector<cvf::Vec3d>* adjustedPolyline);
|
||||
|
||||
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;
|
||||
const std::vector<std::vector<cvf::Vec3d> > m_polyLines;
|
||||
cvf::Vec3d m_extrusionDirection;
|
||||
|
||||
// Output arrays
|
||||
cvf::ref<cvf::Vec3fArray> m_triangleVxes;
|
||||
cvf::ref<cvf::Vec3fArray> m_cellBorderLineVxes;
|
||||
std::vector<size_t> m_triangleToCellIdxMap;
|
||||
std::vector<RivIntersectionVertexWeights> m_triVxToCellCornerWeights;
|
||||
|
||||
const RimIntersection* m_crossSection;
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivCrossSectionPartMgr.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
@ -27,7 +27,7 @@
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
@ -37,7 +37,7 @@
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivCrossSectionSourceInfo.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
@ -55,7 +55,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivCrossSectionPartMgr::RivCrossSectionPartMgr(const RimCrossSection* rimCrossSection)
|
||||
RivIntersectionPartMgr::RivIntersectionPartMgr(const RimIntersection* rimCrossSection)
|
||||
: m_rimCrossSection(rimCrossSection),
|
||||
m_defaultColor(cvf::Color3::WHITE)
|
||||
{
|
||||
@ -69,7 +69,7 @@ RivCrossSectionPartMgr::RivCrossSectionPartMgr(const RimCrossSection* rimCrossSe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::applySingleColorEffect()
|
||||
void RivIntersectionPartMgr::applySingleColorEffect()
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
@ -80,7 +80,7 @@ void RivCrossSectionPartMgr::applySingleColorEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
@ -133,7 +133,7 @@ void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
cellResultColors);
|
||||
}
|
||||
|
||||
RivCrossSectionPartMgr::calculateEclipseTextureCoordinates(m_crossSectionFacesTextureCoords.p(),
|
||||
RivIntersectionPartMgr::calculateEclipseTextureCoordinates(m_crossSectionFacesTextureCoords.p(),
|
||||
m_crossSectionGenerator->triangleToCellIndex(),
|
||||
resultAccessor.p(),
|
||||
mapper);
|
||||
@ -164,13 +164,13 @@ void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
// Do a "Hack" to show elm nodal and not nodal POR results
|
||||
if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
|
||||
|
||||
const std::vector<RivVertexWeights> &vertexWeights = m_crossSectionGenerator->triangleVxToCellCornerInterpolationWeights();
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights = m_crossSectionGenerator->triangleVxToCellCornerInterpolationWeights();
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, 0, (int)timeStepIndex);
|
||||
bool isElementNodalResult = !(resVarAddress.resultPosType == RIG_NODAL);
|
||||
RigFemPart* femPart = caseData->femParts()->part(0);
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
RivCrossSectionPartMgr::calculateGeoMechTextureCoords(m_crossSectionFacesTextureCoords.p(),
|
||||
RivIntersectionPartMgr::calculateGeoMechTextureCoords(m_crossSectionFacesTextureCoords.p(),
|
||||
vertexWeights,
|
||||
resultValues,
|
||||
isElementNodalResult,
|
||||
@ -190,8 +190,8 @@ void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivVertexWeights> &vertexWeights,
|
||||
void RivIntersectionPartMgr::calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights,
|
||||
const std::vector<float> &resultValues,
|
||||
bool isElementNodalResult,
|
||||
const RigFemPart* femPart,
|
||||
@ -239,7 +239,7 @@ void RivCrossSectionPartMgr::calculateGeoMechTextureCoords(cvf::Vec2fArray* text
|
||||
/// Calculates the texture coordinates in a "nearly" one dimensional texture.
|
||||
/// Undefined values are coded with a y-texturecoordinate value of 1.0 instead of the normal 0.5
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
void RivIntersectionPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<size_t>& triangleToCellIdxMap,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const cvf::ScalarMapper* mapper)
|
||||
@ -278,7 +278,7 @@ const int priMesh = 3;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
void RivIntersectionPartMgr::generatePartGeometry()
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
@ -300,7 +300,7 @@ void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
part->setDrawable(geo.p());
|
||||
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivCrossSectionSourceInfo> si = new RivCrossSectionSourceInfo(m_crossSectionGenerator.p());
|
||||
cvf::ref<RivIntersectionSourceInfo> si = new RivIntersectionSourceInfo(m_crossSectionGenerator.p());
|
||||
part->setSourceInfo(si.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
@ -338,7 +338,7 @@ void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
m_highlightLineAlongPolyline = NULL;
|
||||
m_highlightPointsForPolyline = NULL;
|
||||
|
||||
if (m_rimCrossSection->type == RimCrossSection::CS_POLYLINE)
|
||||
if (m_rimCrossSection->type == RimIntersection::CS_POLYLINE)
|
||||
{
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = m_crossSectionGenerator->createLineAlongPolylineDrawable();
|
||||
@ -416,7 +416,7 @@ void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::updatePartEffect()
|
||||
void RivIntersectionPartMgr::updatePartEffect()
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
@ -447,7 +447,7 @@ void RivCrossSectionPartMgr::updatePartEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
void RivIntersectionPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_crossSectionFaces.isNull())
|
||||
{
|
||||
@ -465,7 +465,7 @@ void RivCrossSectionPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
void RivIntersectionPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_crossSectionGridLines.isNull())
|
||||
{
|
||||
@ -483,7 +483,7 @@ void RivCrossSectionPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* mod
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::appendPolylinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
void RivIntersectionPartMgr::appendPolylinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_highlightLineAlongPolyline.notNull())
|
||||
{
|
||||
@ -500,21 +500,21 @@ void RivCrossSectionPartMgr::appendPolylinePartsToModel(cvf::ModelBasicList* mod
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::computeData()
|
||||
void RivIntersectionPartMgr::computeData()
|
||||
{
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLines = m_rimCrossSection->polyLines();
|
||||
if (polyLines.size() > 0)
|
||||
{
|
||||
cvf::Vec3d direction = extrusionDirection(polyLines[0]);
|
||||
cvf::ref<RivCrossSectionHexGridIntf> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivCrossSectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p());
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RivCrossSectionHexGridIntf> RivCrossSectionPartMgr::createHexGridInterface()
|
||||
cvf::ref<RivIntersectionHexGridInterface> RivIntersectionPartMgr::createHexGridInterface()
|
||||
{
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
@ -523,7 +523,7 @@ cvf::ref<RivCrossSectionHexGridIntf> RivCrossSectionPartMgr::createHexGridInterf
|
||||
{
|
||||
RigMainGrid* grid = NULL;
|
||||
grid = eclipseView->eclipseCase()->reservoirData()->mainGrid();
|
||||
return new RivEclipseCrossSectionGrid(grid, eclipseView->currentActiveCellInfo(), m_rimCrossSection->showInactiveCells());
|
||||
return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), m_rimCrossSection->showInactiveCells());
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
@ -531,7 +531,7 @@ cvf::ref<RivCrossSectionHexGridIntf> RivCrossSectionPartMgr::createHexGridInterf
|
||||
if (geoView)
|
||||
{
|
||||
RigFemPart* femPart = geoView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
return new RivFemCrossSectionGrid(femPart);
|
||||
return new RivFemIntersectionGrid(femPart);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -540,13 +540,13 @@ cvf::ref<RivCrossSectionHexGridIntf> RivCrossSectionPartMgr::createHexGridInterf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivCrossSectionPartMgr::extrusionDirection(const std::vector<cvf::Vec3d>& polyline) const
|
||||
cvf::Vec3d RivIntersectionPartMgr::extrusionDirection(const std::vector<cvf::Vec3d>& polyline) const
|
||||
{
|
||||
CVF_ASSERT(m_rimCrossSection);
|
||||
|
||||
cvf::Vec3d dir = cvf::Vec3d::Z_AXIS;
|
||||
|
||||
if (m_rimCrossSection->direction == RimCrossSection::CS_HORIZONTAL &&
|
||||
if (m_rimCrossSection->direction == RimIntersection::CS_HORIZONTAL &&
|
||||
polyline.size() > 1)
|
||||
{
|
||||
// Use first and last point of polyline to approximate orientation of polyline
|
@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivCrossSectionGeometryGenerator.h"
|
||||
#include "RivIntersectionGeometryGenerator.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
@ -37,17 +37,17 @@ namespace cvf
|
||||
class RigMainGrid;
|
||||
class RimEclipseCellColors;
|
||||
class RimCellEdgeColors;
|
||||
class RimCrossSection;
|
||||
class RimIntersection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RivCrossSectionPartMgr : public cvf::Object
|
||||
class RivIntersectionPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivCrossSectionPartMgr(const RimCrossSection* rimCrossSection);
|
||||
RivIntersectionPartMgr(const RimIntersection* rimCrossSection);
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
@ -68,19 +68,19 @@ private:
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
static void calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivVertexWeights> &vertexWeights,
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights,
|
||||
const std::vector<float> &resultValues,
|
||||
bool isElementNodalResult,
|
||||
const RigFemPart* femPart,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
cvf::ref<RivCrossSectionHexGridIntf> createHexGridInterface();
|
||||
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
|
||||
private:
|
||||
|
||||
const RimCrossSection* m_rimCrossSection;
|
||||
const RimIntersection* m_rimCrossSection;
|
||||
|
||||
cvf::Color3f m_defaultColor;
|
||||
|
||||
cvf::ref<RivCrossSectionGeometryGenerator> m_crossSectionGenerator;
|
||||
cvf::ref<RivIntersectionGeometryGenerator> m_crossSectionGenerator;
|
||||
cvf::ref<cvf::Part> m_crossSectionFaces;
|
||||
cvf::ref<cvf::Part> m_crossSectionGridLines;
|
||||
cvf::ref<cvf::Vec2fArray> m_crossSectionFacesTextureCoords;
|
@ -17,15 +17,15 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivCrossSectionSourceInfo.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
|
||||
#include "RivCrossSectionGeometryGenerator.h"
|
||||
#include "RivIntersectionGeometryGenerator.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivCrossSectionSourceInfo::RivCrossSectionSourceInfo(RivCrossSectionGeometryGenerator* geometryGenerator)
|
||||
RivIntersectionSourceInfo::RivIntersectionSourceInfo(RivIntersectionGeometryGenerator* geometryGenerator)
|
||||
: m_crossSectionGeometryGenerator(geometryGenerator)
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionGeometryGenerator.notNull());
|
||||
@ -34,7 +34,7 @@ RivCrossSectionSourceInfo::RivCrossSectionSourceInfo(RivCrossSectionGeometryGene
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivCrossSectionSourceInfo::triangleToCellIndex() const
|
||||
const std::vector<size_t>& RivIntersectionSourceInfo::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionGeometryGenerator.notNull());
|
||||
|
||||
@ -44,7 +44,7 @@ const std::vector<size_t>& RivCrossSectionSourceInfo::triangleToCellIndex() cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimCrossSection* RivCrossSectionSourceInfo::crossSection() const
|
||||
const RimIntersection* RivIntersectionSourceInfo::crossSection() const
|
||||
{
|
||||
return m_crossSectionGeometryGenerator->crossSection();
|
||||
}
|
@ -23,18 +23,18 @@
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RivCrossSectionGeometryGenerator;
|
||||
class RimCrossSection;
|
||||
class RivIntersectionGeometryGenerator;
|
||||
class RimIntersection;
|
||||
|
||||
class RivCrossSectionSourceInfo : public cvf::Object
|
||||
class RivIntersectionSourceInfo : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivCrossSectionSourceInfo(RivCrossSectionGeometryGenerator* geometryGenerator);
|
||||
RivIntersectionSourceInfo(RivIntersectionGeometryGenerator* geometryGenerator);
|
||||
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
|
||||
const RimCrossSection* crossSection() const;
|
||||
const RimIntersection* crossSection() const;
|
||||
|
||||
private:
|
||||
cvf::cref<RivCrossSectionGeometryGenerator> m_crossSectionGeometryGenerator;
|
||||
cvf::cref<RivIntersectionGeometryGenerator> m_crossSectionGeometryGenerator;
|
||||
};
|
@ -1,173 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// 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 "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigMainGrid;
|
||||
class RigActiveCellInfo;
|
||||
class RigResultAccessor;
|
||||
class RimCrossSection;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ScalarMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class RivCrossSectionHexGridIntf : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual cvf::Vec3d displayOffset() const = 0;
|
||||
virtual cvf::BoundingBox boundingBox() const = 0;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const = 0;
|
||||
virtual bool useCell(size_t cellIndex) const = 0;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const = 0;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const = 0;
|
||||
};
|
||||
|
||||
|
||||
class RivEclipseCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivEclipseCrossSectionGrid(const RigMainGrid * mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigMainGrid> m_mainGrid;
|
||||
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
|
||||
bool m_showInactiveCells;
|
||||
};
|
||||
|
||||
class RigFemPart;
|
||||
|
||||
class RivFemCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivFemCrossSectionGrid(const RigFemPart * femPart);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPart> m_femPart;
|
||||
};
|
||||
|
||||
class RivVertexWeights
|
||||
{
|
||||
public:
|
||||
explicit RivVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1,
|
||||
size_t edge2Vx1, size_t edge2Vx2, double normDistFromE2V1,
|
||||
double normDistFromE1Cut) : m_count(4)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
m_vxIds[2] = (edge2Vx1);
|
||||
m_vxIds[3] = (edge2Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1 - normDistFromE1Cut + normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[1] = ((float)(normDistFromE1V1 - normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[2] = ((float)(normDistFromE1Cut - normDistFromE2V1*normDistFromE1Cut));
|
||||
m_weights[3] = ((float)(normDistFromE2V1*normDistFromE1Cut));
|
||||
}
|
||||
|
||||
explicit RivVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1) : m_count(2)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1));
|
||||
m_weights[1] = ((float)(normDistFromE1V1));
|
||||
}
|
||||
|
||||
int size() const { return m_count;}
|
||||
size_t vxId(int idx) const { return m_vxIds[idx];}
|
||||
float weight(int idx)const { return m_weights[idx];}
|
||||
|
||||
private:
|
||||
|
||||
size_t m_vxIds[4];
|
||||
float m_weights[4];
|
||||
int m_count;
|
||||
};
|
||||
|
||||
class RivCrossSectionGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivCrossSectionGeometryGenerator(const RimCrossSection* crossSection,
|
||||
std::vector<std::vector<cvf::Vec3d> > &polylines,
|
||||
const cvf::Vec3d& extrusionDirection,
|
||||
const RivCrossSectionHexGridIntf* grid );
|
||||
|
||||
~RivCrossSectionGeometryGenerator();
|
||||
|
||||
bool isAnyGeometryPresent() const;
|
||||
|
||||
// Generate geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable();
|
||||
|
||||
// Mapping between cells and geometry
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
const std::vector<RivVertexWeights>& triangleVxToCellCornerInterpolationWeights() const;
|
||||
|
||||
const RimCrossSection* crossSection() const;
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
static void adjustPolyline(const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
std::vector<cvf::Vec3d>* adjustedPolyline);
|
||||
|
||||
cvf::cref<RivCrossSectionHexGridIntf> m_hexGrid;
|
||||
const std::vector<std::vector<cvf::Vec3d> > m_polyLines;
|
||||
cvf::Vec3d m_extrusionDirection;
|
||||
|
||||
// Output arrays
|
||||
cvf::ref<cvf::Vec3fArray> m_triangleVxes;
|
||||
cvf::ref<cvf::Vec3fArray> m_cellBorderLineVxes;
|
||||
std::vector<size_t> m_triangleToCellIdxMap;
|
||||
std::vector<RivVertexWeights> m_triVxToCellCornerWeights;
|
||||
|
||||
const RimCrossSection* m_crossSection;
|
||||
};
|
||||
|
@ -75,8 +75,8 @@ ${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFile.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFileChannel.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFileCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCrossSection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
|
||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.h
|
||||
@ -91,6 +91,8 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCurveAppearanceCalculator.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBoxCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -164,8 +166,8 @@ ${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFile.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFileChannel.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogFileCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCrossSection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.cpp
|
||||
@ -180,6 +182,8 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCurveAppearanceCalculator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBoxCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@ -42,6 +42,8 @@
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
@ -211,7 +213,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellPathCrossSectionFeature";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
commandIds << "RicWellPathDeleteFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCalcScript*>(uiItem))
|
||||
@ -297,19 +299,29 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicAddWellLogToPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCrossSectionCollection*>(uiItem))
|
||||
else if (dynamic_cast<RimIntersectionCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendCrossSectionFeature";
|
||||
commandIds << "RicAppendIntersectionFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCrossSection*>(uiItem))
|
||||
else if (dynamic_cast<RimIntersection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendCrossSectionFeature";
|
||||
commandIds << "RicAppendIntersectionFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimIntersectionBoxCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendIntersectionBoxFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimIntersectionBox*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendIntersectionBoxFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseWell*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSimWellCrossSectionFeature";
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
}
|
||||
else if(dynamic_cast<RimFormationNames*>(uiItem))
|
||||
{
|
||||
|
@ -25,14 +25,15 @@
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigFormationNames.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
@ -41,6 +42,7 @@
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFaultCollection.h"
|
||||
#include "RimGridCollection.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
@ -74,7 +76,6 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <limits.h>
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
|
||||
|
||||
@ -428,6 +429,7 @@ void RimEclipseView::createDisplayModel()
|
||||
|
||||
m_crossSectionVizModel->removeAllParts();
|
||||
crossSectionCollection->appendPartsToModel(m_crossSectionVizModel.p(), m_reservoirGridPartManager->scaleTransform());
|
||||
intersectionBoxCollection->appendPartsToModel(m_crossSectionVizModel.p(), m_reservoirGridPartManager->scaleTransform());
|
||||
m_viewer->addStaticModelOnce(m_crossSectionVizModel.p());
|
||||
|
||||
|
||||
@ -636,10 +638,12 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
|
||||
{
|
||||
crossSectionCollection->updateCellResultColor(m_currentTimeStep);
|
||||
intersectionBoxCollection->updateCellResultColor(m_currentTimeStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
crossSectionCollection->applySingleColorEffect();
|
||||
intersectionBoxCollection->applySingleColorEffect();
|
||||
}
|
||||
|
||||
// Simulation Well pipes
|
||||
@ -1342,6 +1346,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
|
||||
uiTreeOrdering.add(m_rangeFilterCollection());
|
||||
uiTreeOrdering.add(m_propertyFilterCollection());
|
||||
uiTreeOrdering.add(intersectionBoxCollection());
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class RimEclipseCellColors;
|
||||
class RimEclipseWellCollection;
|
||||
class RiuViewer;
|
||||
class RivReservoirPipesPartMgr;
|
||||
class RivCrossSectionPartMgr;
|
||||
class RivIntersectionPartMgr;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
|
||||
|
@ -25,16 +25,18 @@
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartGrid.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigFormationNames.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGridCollection.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
@ -61,7 +63,6 @@
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechView, "GeoMechView");
|
||||
@ -162,7 +163,7 @@ void RimGeoMechView::loadDataAndUpdate()
|
||||
updateViewerWidget();
|
||||
|
||||
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
|
||||
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
progress.incrementProgress();
|
||||
@ -251,6 +252,7 @@ void RimGeoMechView::createDisplayModel()
|
||||
|
||||
m_crossSectionVizModel->removeAllParts();
|
||||
crossSectionCollection->appendPartsToModel(m_crossSectionVizModel.p(), scaleTransform());
|
||||
intersectionBoxCollection->appendPartsToModel(m_crossSectionVizModel.p(), scaleTransform());
|
||||
m_viewer->addStaticModelOnce(m_crossSectionVizModel.p());
|
||||
|
||||
// If the animation was active before recreating everything, make viewer view current frame
|
||||
@ -264,6 +266,9 @@ void RimGeoMechView::createDisplayModel()
|
||||
{
|
||||
updateLegends();
|
||||
m_vizLogic->updateStaticCellColors(-1);
|
||||
crossSectionCollection->applySingleColorEffect();
|
||||
intersectionBoxCollection->applySingleColorEffect();
|
||||
|
||||
m_overlayInfoConfig()->update3DInfo();
|
||||
}
|
||||
}
|
||||
@ -299,14 +304,22 @@ void RimGeoMechView::updateCurrentTimeStep()
|
||||
m_vizLogic->updateStaticCellColors(m_currentTimeStep());
|
||||
|
||||
if (this->cellResult()->hasResult())
|
||||
{
|
||||
crossSectionCollection->updateCellResultColor(m_currentTimeStep);
|
||||
intersectionBoxCollection->updateCellResultColor(m_currentTimeStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
crossSectionCollection->applySingleColorEffect();
|
||||
|
||||
intersectionBoxCollection->applySingleColorEffect();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_vizLogic->updateStaticCellColors(-1);
|
||||
crossSectionCollection->applySingleColorEffect();
|
||||
intersectionBoxCollection->applySingleColorEffect();
|
||||
|
||||
m_viewer->animationControl()->slotPause(); // To avoid animation timer spinning in the background
|
||||
}
|
||||
|
||||
@ -677,7 +690,9 @@ void RimGeoMechView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
||||
|
||||
uiTreeOrdering.add(m_rangeFilterCollection());
|
||||
uiTreeOrdering.add(m_propertyFilterCollection());
|
||||
|
||||
|
||||
uiTreeOrdering.add(intersectionBoxCollection());
|
||||
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimGridSummaryCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "RigSummaryCaseData.h"
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -76,6 +78,8 @@ QString RimGridSummaryCase::summaryHeaderFilename() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGridSummaryCase::caseName() const
|
||||
{
|
||||
if (!m_eclipseCase()) return QString();
|
||||
|
||||
return m_eclipseCase()->caseUserDescription();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimIntersection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RivCrossSectionPartMgr.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
@ -44,31 +44,31 @@
|
||||
namespace caf {
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RimCrossSection::CrossSectionEnum >::setUp()
|
||||
void caf::AppEnum< RimIntersection::CrossSectionEnum >::setUp()
|
||||
{
|
||||
addItem(RimCrossSection::CS_WELL_PATH, "CS_WELL_PATH", "Well Path");
|
||||
addItem(RimCrossSection::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well");
|
||||
addItem(RimCrossSection::CS_POLYLINE, "CS_POLYLINE", "Polyline");
|
||||
setDefault(RimCrossSection::CS_WELL_PATH);
|
||||
addItem(RimIntersection::CS_WELL_PATH, "CS_WELL_PATH", "Well Path");
|
||||
addItem(RimIntersection::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well");
|
||||
addItem(RimIntersection::CS_POLYLINE, "CS_POLYLINE", "Polyline");
|
||||
setDefault(RimIntersection::CS_WELL_PATH);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RimCrossSection::CrossSectionDirEnum >::setUp()
|
||||
void caf::AppEnum< RimIntersection::CrossSectionDirEnum >::setUp()
|
||||
{
|
||||
addItem(RimCrossSection::CS_VERTICAL, "CS_VERTICAL", "Vertical");
|
||||
addItem(RimCrossSection::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal");
|
||||
setDefault(RimCrossSection::CS_VERTICAL);
|
||||
addItem(RimIntersection::CS_VERTICAL, "CS_VERTICAL", "Vertical");
|
||||
addItem(RimIntersection::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal");
|
||||
setDefault(RimIntersection::CS_VERTICAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimCrossSection, "CrossSection");
|
||||
CAF_PDM_SOURCE_INIT(RimIntersection, "CrossSection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCrossSection::RimCrossSection()
|
||||
RimIntersection::RimIntersection()
|
||||
{
|
||||
CAF_PDM_InitObject("Intersection", ":/CrossSection16x16.png", "", "");
|
||||
|
||||
@ -98,7 +98,7 @@ RimCrossSection::RimCrossSection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCrossSection::~RimCrossSection()
|
||||
RimIntersection::~RimIntersection()
|
||||
{
|
||||
|
||||
}
|
||||
@ -106,7 +106,7 @@ RimCrossSection::~RimCrossSection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimIntersection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &isActive ||
|
||||
changedField == &type ||
|
||||
@ -147,7 +147,7 @@ void RimCrossSection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&name);
|
||||
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Intersecting Geometry");
|
||||
@ -195,7 +195,7 @@ void RimCrossSection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCrossSection::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
@ -256,7 +256,7 @@ QList<caf::PdmOptionItemInfo> RimCrossSection::calculateValueOptions(const caf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCrossSection::userDescriptionField()
|
||||
caf::PdmFieldHandle* RimIntersection::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
@ -264,7 +264,7 @@ caf::PdmFieldHandle* RimCrossSection::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCrossSection::objectToggleField()
|
||||
caf::PdmFieldHandle* RimIntersection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
@ -272,7 +272,7 @@ caf::PdmFieldHandle* RimCrossSection::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseWellCollection* RimCrossSection::simulationWellCollection()
|
||||
RimEclipseWellCollection* RimIntersection::simulationWellCollection()
|
||||
{
|
||||
RimEclipseView* eclipseView = NULL;
|
||||
firstAncestorOrThisOfType(eclipseView);
|
||||
@ -288,7 +288,7 @@ RimEclipseWellCollection* RimCrossSection::simulationWellCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::vector <cvf::Vec3d> > RimCrossSection::polyLines() const
|
||||
std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLines() const
|
||||
{
|
||||
std::vector< std::vector <cvf::Vec3d> > lines;
|
||||
if (type == CS_WELL_PATH)
|
||||
@ -336,9 +336,9 @@ std::vector< std::vector <cvf::Vec3d> > RimCrossSection::polyLines() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivCrossSectionPartMgr* RimCrossSection::crossSectionPartMgr()
|
||||
RivIntersectionPartMgr* RimIntersection::crossSectionPartMgr()
|
||||
{
|
||||
if (m_crossSectionPartMgr.isNull()) m_crossSectionPartMgr = new RivCrossSectionPartMgr(this);
|
||||
if (m_crossSectionPartMgr.isNull()) m_crossSectionPartMgr = new RivIntersectionPartMgr(this);
|
||||
|
||||
return m_crossSectionPartMgr.p();
|
||||
}
|
||||
@ -346,7 +346,7 @@ RivCrossSectionPartMgr* RimCrossSection::crossSectionPartMgr()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::updateWellCenterline() const
|
||||
void RimIntersection::updateWellCenterline() const
|
||||
{
|
||||
if (isActive() && type == CS_SIMULATION_WELL && simulationWell())
|
||||
{
|
||||
@ -366,7 +366,7 @@ void RimCrossSection::updateWellCenterline() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::addExtents(std::vector<cvf::Vec3d> &polyLine) const
|
||||
void RimIntersection::addExtents(std::vector<cvf::Vec3d> &polyLine) const
|
||||
{
|
||||
size_t lineVxCount = polyLine.size();
|
||||
|
||||
@ -422,7 +422,7 @@ void RimCrossSection::addExtents(std::vector<cvf::Vec3d> &polyLine) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::updateWellExtentDefaultValue()
|
||||
void RimIntersection::updateWellExtentDefaultValue()
|
||||
{
|
||||
RimCase* ownerCase = NULL;
|
||||
firstAncestorOrThisOfType(ownerCase);
|
||||
@ -440,7 +440,7 @@ void RimCrossSection::updateWellExtentDefaultValue()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::updateName()
|
||||
void RimIntersection::updateName()
|
||||
{
|
||||
if (type == CS_SIMULATION_WELL && simulationWell())
|
||||
{
|
||||
@ -460,7 +460,7 @@ void RimCrossSection::updateName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::clipToReservoir(std::vector<cvf::Vec3d> &polyLine) const
|
||||
void RimIntersection::clipToReservoir(std::vector<cvf::Vec3d> &polyLine) const
|
||||
{
|
||||
RimCase* ownerCase = NULL;
|
||||
firstAncestorOrThisOfType(ownerCase);
|
||||
@ -506,7 +506,7 @@ void RimCrossSection::clipToReservoir(std::vector<cvf::Vec3d> &polyLine) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &inputFromViewerEnabled)
|
||||
{
|
||||
@ -534,7 +534,7 @@ void RimCrossSection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::appendPointToPolyLine(const cvf::Vec3d& point)
|
||||
void RimIntersection::appendPointToPolyLine(const cvf::Vec3d& point)
|
||||
{
|
||||
m_userPolyline.v().push_back(point);
|
||||
|
||||
@ -546,7 +546,7 @@ void RimCrossSection::appendPointToPolyLine(const cvf::Vec3d& point)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSection::rebuildGeometryAndScheduleCreateDisplayModel()
|
||||
void RimIntersection::rebuildGeometryAndScheduleCreateDisplayModel()
|
||||
{
|
||||
m_crossSectionPartMgr = NULL;
|
||||
|
@ -32,14 +32,14 @@
|
||||
class RimEclipseWell;
|
||||
class RimEclipseWellCollection;
|
||||
class RimWellPath;
|
||||
class RivCrossSectionPartMgr;
|
||||
class RivIntersectionPartMgr;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimCrossSection : public caf::PdmObject
|
||||
class RimIntersection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -58,8 +58,8 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
RimCrossSection();
|
||||
~RimCrossSection();
|
||||
RimIntersection();
|
||||
~RimIntersection();
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> isActive;
|
||||
@ -74,7 +74,7 @@ public:
|
||||
caf::PdmField< bool > inputFromViewerEnabled;
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLines() const;
|
||||
RivCrossSectionPartMgr* crossSectionPartMgr();
|
||||
RivIntersectionPartMgr* crossSectionPartMgr();
|
||||
|
||||
void appendPointToPolyLine(const cvf::Vec3d& point);
|
||||
|
||||
@ -104,7 +104,7 @@ private:
|
||||
void updateName();
|
||||
void rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
private:
|
||||
cvf::ref<RivCrossSectionPartMgr> m_crossSectionPartMgr;
|
||||
cvf::ref<RivIntersectionPartMgr> m_crossSectionPartMgr;
|
||||
|
||||
mutable
|
||||
std::vector< std::vector <cvf::Vec3d> > m_wellBranchCenterlines;
|
406
ApplicationCode/ProjectDataModel/RimIntersectionBox.cpp
Normal file
406
ApplicationCode/ProjectDataModel/RimIntersectionBox.cpp
Normal file
@ -0,0 +1,406 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimIntersectionBox.h"
|
||||
|
||||
#include "RimView.h"
|
||||
#include "RivIntersectionBoxPartMgr.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "RimCase.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void AppEnum< RimIntersectionBox::SinglePlaneState >::setUp()
|
||||
{
|
||||
addItem(RimIntersectionBox::PLANE_STATE_NONE, "PLANE_STATE_NONE", "None");
|
||||
addItem(RimIntersectionBox::PLANE_STATE_X, "PLANE_STATE_X", "X Plane");
|
||||
addItem(RimIntersectionBox::PLANE_STATE_Y, "PLANE_STATE_Y", "Y Plane");
|
||||
addItem(RimIntersectionBox::PLANE_STATE_Z, "PLANE_STATE_Z", "Z Plane");
|
||||
setDefault(RimIntersectionBox::PLANE_STATE_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimIntersectionBox, "IntersectionBox");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionBox::RimIntersectionBox()
|
||||
{
|
||||
CAF_PDM_InitObject("Intersection Box", ":/IntersectionBox16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Intersection Name"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_singlePlaneState, "singlePlaneState", caf::AppEnum<SinglePlaneState>(SinglePlaneState::PLANE_STATE_NONE), "Collapse box to plane", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_minXCoord, "MinXCoord", 0.0, "MinXCoord", "", "", "");
|
||||
m_minXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_maxXCoord, "MaxXCoord", 0.0, "MaxXCoord", "", "", "");
|
||||
m_maxXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_minYCoord, "MinYCoord", 0.0, "MinYCoord", "", "", "");
|
||||
m_minYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_maxYCoord, "MaxYCoord", 0.0, "MaxYCoord", "", "", "");
|
||||
m_maxYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_minZCoord, "MinZCoord", 0.0, "MinZCoord", "", "", "");
|
||||
m_minZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&m_maxZCoord, "MaxZCoord", 0.0, "MaxZCoord", "", "", "");
|
||||
m_maxZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionBox::~RimIntersectionBox()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Mat4d RimIntersectionBox::boxOrigin() const
|
||||
{
|
||||
cvf::Mat4d mx(cvf::Mat4d::IDENTITY);
|
||||
mx.setTranslation(cvf::Vec3d(m_minXCoord, m_minYCoord, m_minZCoord));
|
||||
return mx;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimIntersectionBox::boxSize() const
|
||||
{
|
||||
return cvf::Vec3d(m_maxXCoord, m_maxYCoord, m_maxZCoord) - cvf::Vec3d(m_minXCoord, m_minYCoord, m_minZCoord);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionBox::SinglePlaneState RimIntersectionBox::singlePlaneState() const
|
||||
{
|
||||
return m_singlePlaneState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::setToDefaultSizeBox()
|
||||
{
|
||||
cvf::BoundingBox boundingBox = currentCellBoundingBox();
|
||||
cvf::Vec3d center = boundingBox.center();
|
||||
|
||||
double defaultWidthFactor = 0.5;
|
||||
|
||||
m_minXCoord = center.x() - 0.5 * boundingBox.extent().x() * defaultWidthFactor;
|
||||
m_minYCoord = center.y() - 0.5 * boundingBox.extent().y() * defaultWidthFactor;
|
||||
m_minZCoord = center.z() - 0.5 * boundingBox.extent().z() * defaultWidthFactor;
|
||||
m_maxXCoord = center.x() + 0.5 * boundingBox.extent().x() * defaultWidthFactor;
|
||||
m_maxYCoord = center.y() + 0.5 * boundingBox.extent().y() * defaultWidthFactor;
|
||||
m_maxZCoord = center.z() + 0.5 * boundingBox.extent().z() * defaultWidthFactor;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::setToDefaultSizeSlice(SinglePlaneState plane, const cvf::Vec3d& position)
|
||||
{
|
||||
m_singlePlaneState = plane;
|
||||
|
||||
cvf::BoundingBox boundingBox = currentCellBoundingBox();
|
||||
cvf::Vec3d center = position;
|
||||
|
||||
if (center.isUndefined()) center = boundingBox.center();
|
||||
|
||||
double defaultWidthFactor = 0.5;
|
||||
|
||||
m_minXCoord = center[0] - 0.5 * boundingBox.extent().x() * defaultWidthFactor;
|
||||
m_minYCoord = center[1] - 0.5 * boundingBox.extent().y() * defaultWidthFactor;
|
||||
m_minZCoord = center[2] - 0.5 * boundingBox.extent().z() * defaultWidthFactor;
|
||||
m_maxXCoord = center[0] + 0.5 * boundingBox.extent().x() * defaultWidthFactor;
|
||||
m_maxYCoord = center[1] + 0.5 * boundingBox.extent().y() * defaultWidthFactor;
|
||||
m_maxZCoord = center[2] + 0.5 * boundingBox.extent().z() * defaultWidthFactor;
|
||||
|
||||
switch (plane)
|
||||
{
|
||||
case PLANE_STATE_X: m_minXCoord = m_maxXCoord = center[0]; break;
|
||||
case PLANE_STATE_Y: m_minYCoord = m_maxYCoord = center[1]; break;
|
||||
case PLANE_STATE_Z: m_minZCoord = m_maxZCoord = center[2]; break;
|
||||
}
|
||||
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::updateLabelsFromBoundingBox()
|
||||
{
|
||||
cvf::BoundingBox cellsBoundingBox = currentCellBoundingBox();
|
||||
{
|
||||
QString range = QString(" [%1 - %2]").arg(cellsBoundingBox.min().x()).arg(cellsBoundingBox.max().x());
|
||||
m_minXCoord.uiCapability()->setUiName(QString("Min X") + range);
|
||||
m_maxXCoord.uiCapability()->setUiName(QString("Max X") + range);
|
||||
}
|
||||
|
||||
{
|
||||
QString range = QString(" [%1 - %2]").arg(cellsBoundingBox.min().y()).arg(cellsBoundingBox.max().y());
|
||||
m_minYCoord.uiCapability()->setUiName(QString("Min Y") + range);
|
||||
m_maxYCoord.uiCapability()->setUiName(QString("Max Y") + range);
|
||||
}
|
||||
|
||||
{
|
||||
QString range = QString(" [%1 - %2]").arg(cellsBoundingBox.min().z()).arg(cellsBoundingBox.max().z());
|
||||
m_minZCoord.uiCapability()->setUiName(QString("Min Z") + range);
|
||||
m_maxZCoord.uiCapability()->setUiName(QString("Max Z") + range);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxPartMgr* RimIntersectionBox::intersectionBoxPartMgr()
|
||||
{
|
||||
if (m_intersectionBoxPartMgr.isNull()) m_intersectionBoxPartMgr = new RivIntersectionBoxPartMgr(this);
|
||||
|
||||
return m_intersectionBoxPartMgr.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_singlePlaneState)
|
||||
{
|
||||
updateVisibility();
|
||||
clampSinglePlaneValues();
|
||||
}
|
||||
else if (changedField == &m_minXCoord)
|
||||
{
|
||||
clampSinglePlaneValues();
|
||||
m_minXCoord = CVF_MIN(m_maxXCoord, m_minXCoord);
|
||||
}
|
||||
else if (changedField == &m_minYCoord)
|
||||
{
|
||||
clampSinglePlaneValues();
|
||||
m_minYCoord = CVF_MIN(m_maxYCoord, m_minYCoord);
|
||||
}
|
||||
else if (changedField == &m_minZCoord)
|
||||
{
|
||||
clampSinglePlaneValues();
|
||||
m_minZCoord = CVF_MIN(m_maxZCoord, m_minZCoord);
|
||||
}
|
||||
else if (changedField == &m_maxXCoord)
|
||||
{
|
||||
m_maxXCoord = CVF_MAX(m_maxXCoord, m_minXCoord);
|
||||
}
|
||||
else if (changedField == &m_maxYCoord)
|
||||
{
|
||||
m_maxYCoord = CVF_MAX(m_maxYCoord, m_minYCoord);
|
||||
}
|
||||
else if (changedField == &m_maxZCoord)
|
||||
{
|
||||
m_maxZCoord = CVF_MAX(m_maxZCoord, m_minZCoord);
|
||||
}
|
||||
|
||||
|
||||
if (changedField != &name)
|
||||
{
|
||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = static_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
|
||||
if (myAttr)
|
||||
{
|
||||
cvf::BoundingBox cellsBoundingBox = currentCellBoundingBox();
|
||||
if (field == &m_minXCoord || field == &m_maxXCoord)
|
||||
{
|
||||
myAttr->m_minimum = cellsBoundingBox.min().x();
|
||||
myAttr->m_maximum = cellsBoundingBox.max().x();
|
||||
}
|
||||
else if (field == &m_minYCoord || field == &m_maxYCoord)
|
||||
{
|
||||
myAttr->m_minimum = cellsBoundingBox.min().y();
|
||||
myAttr->m_maximum = cellsBoundingBox.max().y();
|
||||
}
|
||||
else if (field == &m_minZCoord || field == &m_maxZCoord)
|
||||
{
|
||||
myAttr->m_minimum = cellsBoundingBox.min().z();
|
||||
myAttr->m_maximum = cellsBoundingBox.max().z();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&name);
|
||||
uiOrdering.add(&m_singlePlaneState);
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("X Coordinates");
|
||||
group->add(&m_minXCoord);
|
||||
group->add(&m_maxXCoord);
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Y Coordinates");
|
||||
group->add(&m_minYCoord);
|
||||
group->add(&m_maxYCoord);
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Z Coordinates");
|
||||
group->add(&m_minZCoord);
|
||||
group->add(&m_maxZCoord);
|
||||
}
|
||||
|
||||
updateLabelsFromBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::initAfterRead()
|
||||
{
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionBox::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionBox::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::rebuildGeometryAndScheduleCreateDisplayModel()
|
||||
{
|
||||
m_intersectionBoxPartMgr = nullptr;
|
||||
|
||||
RimView* rimView = NULL;
|
||||
this->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::updateVisibility()
|
||||
{
|
||||
m_maxXCoord.uiCapability()->setUiReadOnly(false);
|
||||
m_maxYCoord.uiCapability()->setUiReadOnly(false);
|
||||
m_maxZCoord.uiCapability()->setUiReadOnly(false);
|
||||
|
||||
if (m_singlePlaneState == PLANE_STATE_X)
|
||||
{
|
||||
m_maxXCoord.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else if (m_singlePlaneState == PLANE_STATE_Y)
|
||||
{
|
||||
m_maxYCoord.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else if (m_singlePlaneState == PLANE_STATE_Z)
|
||||
{
|
||||
m_maxZCoord.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::clampSinglePlaneValues()
|
||||
{
|
||||
if (m_singlePlaneState == PLANE_STATE_X)
|
||||
{
|
||||
m_maxXCoord = m_minXCoord;
|
||||
}
|
||||
else if (m_singlePlaneState == PLANE_STATE_Y)
|
||||
{
|
||||
m_maxYCoord = m_minYCoord;
|
||||
}
|
||||
else if (m_singlePlaneState == PLANE_STATE_Z)
|
||||
{
|
||||
m_maxZCoord = m_minZCoord;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimIntersectionBox::currentCellBoundingBox()
|
||||
{
|
||||
RimCase* rimCase = NULL;
|
||||
this->firstAnchestorOrThisOfType(rimCase);
|
||||
|
||||
CVF_ASSERT(rimCase);
|
||||
|
||||
RimEclipseView* eclView = nullptr;
|
||||
this->firstAnchestorOrThisOfType(eclView);
|
||||
|
||||
bool useAllCells = true;
|
||||
if (eclView)
|
||||
{
|
||||
useAllCells = eclView->showInactiveCells();
|
||||
}
|
||||
|
||||
if(false)//useAllCells) // For now, only use the active CellsBBox.
|
||||
return rimCase->allCellsBoundingBox();
|
||||
else
|
||||
return rimCase->activeCellsBoundingBox();
|
||||
|
||||
}
|
||||
|
93
ApplicationCode/ProjectDataModel/RimIntersectionBox.h
Normal file
93
ApplicationCode/ProjectDataModel/RimIntersectionBox.h
Normal file
@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
class RivIntersectionBoxPartMgr;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimIntersectionBox : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum SinglePlaneState
|
||||
{
|
||||
PLANE_STATE_NONE,
|
||||
PLANE_STATE_X,
|
||||
PLANE_STATE_Y,
|
||||
PLANE_STATE_Z
|
||||
};
|
||||
|
||||
public:
|
||||
RimIntersectionBox();
|
||||
~RimIntersectionBox();
|
||||
|
||||
// Fields
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
cvf::Mat4d boxOrigin() const;
|
||||
cvf::Vec3d boxSize() const;
|
||||
SinglePlaneState singlePlaneState() const;
|
||||
|
||||
RivIntersectionBoxPartMgr* intersectionBoxPartMgr();
|
||||
|
||||
void setToDefaultSizeBox();
|
||||
void setToDefaultSizeSlice(SinglePlaneState plane, const cvf::Vec3d& position);
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
void updateVisibility();
|
||||
void updateLabelsFromBoundingBox();
|
||||
void clampSinglePlaneValues();
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum< SinglePlaneState > > m_singlePlaneState;
|
||||
|
||||
caf::PdmField<double> m_minXCoord;
|
||||
caf::PdmField<double> m_minYCoord;
|
||||
caf::PdmField<double> m_minZCoord;
|
||||
|
||||
caf::PdmField<double> m_maxXCoord;
|
||||
caf::PdmField<double> m_maxYCoord;
|
||||
caf::PdmField<double> m_maxZCoord;
|
||||
|
||||
|
||||
cvf::BoundingBox currentCellBoundingBox();
|
||||
|
||||
cvf::ref<RivIntersectionBoxPartMgr> m_intersectionBoxPartMgr;
|
||||
};
|
@ -0,0 +1,163 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimIntersectionBoxCollection.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RivIntersectionBoxPartMgr.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimIntersectionBoxCollection, "IntersectionBoxCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionBoxCollection::RimIntersectionBoxCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Intersection Boxes", ":/IntersectionBoxes16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_intersectionBoxes, "IntersectionBoxes", "IntersectionBoxes", "", "", "");
|
||||
m_intersectionBoxes.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionBoxCollection::~RimIntersectionBoxCollection()
|
||||
{
|
||||
m_intersectionBoxes.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimIntersectionBoxCollection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBoxCollection::applySingleColorEffect()
|
||||
{
|
||||
if (!isActive) return;
|
||||
|
||||
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
|
||||
{
|
||||
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
|
||||
if (cs->isActive)
|
||||
{
|
||||
cs->intersectionBoxPartMgr()->applySingleColorEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBoxCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if (!isActive) return;
|
||||
|
||||
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
|
||||
{
|
||||
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
|
||||
if (cs->isActive)
|
||||
{
|
||||
cs->intersectionBoxPartMgr()->updateCellResultColor(timeStepIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBoxCollection::appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (!isActive) return;
|
||||
|
||||
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
|
||||
{
|
||||
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
|
||||
if (cs->isActive)
|
||||
{
|
||||
cs->intersectionBoxPartMgr()->appendNativeCrossSectionFacesToModel(model, scaleTransform);
|
||||
cs->intersectionBoxPartMgr()->appendMeshLinePartsToModel(model, scaleTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBoxCollection::appendIntersectionBox(RimIntersectionBox* intersectionBox)
|
||||
{
|
||||
m_intersectionBoxes.push_back(intersectionBox);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBoxCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &isActive)
|
||||
{
|
||||
RimView* rimView = NULL;
|
||||
firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
{
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimIntersectionBoxCollection::hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const
|
||||
{
|
||||
if (!isActive) return false;
|
||||
|
||||
/*
|
||||
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
|
||||
{
|
||||
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
|
||||
|
||||
if (cs->isActive &&
|
||||
cs->type() == RimIntersectionBox::CS_SIMULATION_WELL &&
|
||||
cs->simulationWell() == eclipseWell)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmObject.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimIntersectionBox;
|
||||
class RimEclipseCellColors;
|
||||
class RimEclipseWell;
|
||||
|
||||
namespace cvf {
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimIntersectionBoxCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimIntersectionBoxCollection();
|
||||
~RimIntersectionBoxCollection();
|
||||
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
void appendIntersectionBox(RimIntersectionBox* intersectionBox);
|
||||
|
||||
bool hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const;
|
||||
|
||||
// Visualization interface
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
void appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimIntersectionBox*> m_intersectionBoxes;
|
||||
};
|
@ -17,23 +17,23 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RivCrossSectionPartMgr.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimCrossSectionCollection, "CrossSectionCollection");
|
||||
CAF_PDM_SOURCE_INIT(RimIntersectionCollection, "CrossSectionCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCrossSectionCollection::RimCrossSectionCollection()
|
||||
RimIntersectionCollection::RimIntersectionCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Intersections", ":/CrossSections16x16.png", "", "");
|
||||
|
||||
@ -47,7 +47,7 @@ RimCrossSectionCollection::RimCrossSectionCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCrossSectionCollection::~RimCrossSectionCollection()
|
||||
RimIntersectionCollection::~RimIntersectionCollection()
|
||||
{
|
||||
m_crossSections.deleteAllChildObjects();
|
||||
}
|
||||
@ -55,7 +55,7 @@ RimCrossSectionCollection::~RimCrossSectionCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCrossSectionCollection::objectToggleField()
|
||||
caf::PdmFieldHandle* RimIntersectionCollection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
@ -63,11 +63,13 @@ caf::PdmFieldHandle* RimCrossSectionCollection::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSectionCollection::applySingleColorEffect()
|
||||
void RimIntersectionCollection::applySingleColorEffect()
|
||||
{
|
||||
if(!this->isActive()) return;
|
||||
|
||||
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
||||
{
|
||||
RimCrossSection* cs = m_crossSections[csIdx];
|
||||
RimIntersection* cs = m_crossSections[csIdx];
|
||||
if (cs->isActive)
|
||||
{
|
||||
cs->crossSectionPartMgr()->applySingleColorEffect();
|
||||
@ -78,12 +80,14 @@ void RimCrossSectionCollection::applySingleColorEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
void RimIntersectionCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
||||
if(!this->isActive()) return;
|
||||
|
||||
for(size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
||||
{
|
||||
RimCrossSection* cs = m_crossSections[csIdx];
|
||||
if (cs->isActive)
|
||||
RimIntersection* cs = m_crossSections[csIdx];
|
||||
if(cs->isActive)
|
||||
{
|
||||
cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex);
|
||||
}
|
||||
@ -93,13 +97,13 @@ void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSectionCollection::appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
void RimIntersectionCollection::appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (!isActive) return;
|
||||
|
||||
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
||||
{
|
||||
RimCrossSection* cs = m_crossSections[csIdx];
|
||||
RimIntersection* cs = m_crossSections[csIdx];
|
||||
if (cs->isActive)
|
||||
{
|
||||
cs->crossSectionPartMgr()->appendNativeCrossSectionFacesToModel(model, scaleTransform);
|
||||
@ -116,7 +120,7 @@ void RimCrossSectionCollection::appendPartsToModel(cvf::ModelBasicList* model, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSectionCollection::appendCrossSection(RimCrossSection* crossSection)
|
||||
void RimIntersectionCollection::appendCrossSection(RimIntersection* crossSection)
|
||||
{
|
||||
m_crossSections.push_back(crossSection);
|
||||
|
||||
@ -134,7 +138,7 @@ void RimCrossSectionCollection::appendCrossSection(RimCrossSection* crossSection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimIntersectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &isActive)
|
||||
{
|
||||
@ -150,16 +154,16 @@ void RimCrossSectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* chan
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCrossSectionCollection::hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const
|
||||
bool RimIntersectionCollection::hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const
|
||||
{
|
||||
if (!isActive) return false;
|
||||
|
||||
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
||||
{
|
||||
RimCrossSection* cs = m_crossSections[csIdx];
|
||||
RimIntersection* cs = m_crossSections[csIdx];
|
||||
|
||||
if (cs->isActive &&
|
||||
cs->type() == RimCrossSection::CS_SIMULATION_WELL &&
|
||||
cs->type() == RimIntersection::CS_SIMULATION_WELL &&
|
||||
cs->simulationWell() == eclipseWell)
|
||||
{
|
||||
return true;
|
@ -23,7 +23,7 @@
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimCrossSection;
|
||||
class RimIntersection;
|
||||
class RimEclipseCellColors;
|
||||
class RimEclipseWell;
|
||||
|
||||
@ -37,17 +37,17 @@ namespace cvf {
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimCrossSectionCollection : public caf::PdmObject
|
||||
class RimIntersectionCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCrossSectionCollection();
|
||||
~RimCrossSectionCollection();
|
||||
RimIntersectionCollection();
|
||||
~RimIntersectionCollection();
|
||||
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
void appendCrossSection(RimCrossSection* crossSection);
|
||||
void appendCrossSection(RimIntersection* crossSection);
|
||||
|
||||
bool hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const;
|
||||
|
||||
@ -62,5 +62,5 @@ protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimCrossSection*> m_crossSections;
|
||||
caf::PdmChildArrayField<RimIntersection*> m_crossSections;
|
||||
};
|
@ -7,10 +7,11 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCrossSectionCollection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridCollection.h"
|
||||
#include "RimIntersectionBoxCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
@ -124,7 +125,11 @@ RimView::RimView(void)
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&crossSectionCollection, "CrossSections", "Intersections", "", "", "");
|
||||
crossSectionCollection.uiCapability()->setUiHidden(true);
|
||||
crossSectionCollection = new RimCrossSectionCollection();
|
||||
crossSectionCollection = new RimIntersectionCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&intersectionBoxCollection, "IntersectionBoxes", "Intersection Boxes", "", "", "");
|
||||
intersectionBoxCollection.uiCapability()->setUiHidden(true);
|
||||
intersectionBoxCollection = new RimIntersectionBoxCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_gridCollection, "GridCollection", "GridCollection", "", "", "");
|
||||
m_gridCollection.uiCapability()->setUiHidden(true);
|
||||
@ -178,6 +183,7 @@ RimView::~RimView(void)
|
||||
|
||||
delete m_rangeFilterCollection;
|
||||
delete m_overrideRangeFilterCollection;
|
||||
delete intersectionBoxCollection;
|
||||
delete crossSectionCollection;
|
||||
delete m_gridCollection;
|
||||
}
|
||||
|
@ -43,9 +43,10 @@
|
||||
class Rim3dOverlayInfoConfig;
|
||||
class RimCase;
|
||||
class RimCellRangeFilter;
|
||||
class RimGridCollection;
|
||||
class RimCellRangeFilterCollection;
|
||||
class RimCrossSectionCollection;
|
||||
class RimIntersectionCollection;
|
||||
class RimGridCollection;
|
||||
class RimIntersectionBoxCollection;
|
||||
class RimPropertyFilterCollection;
|
||||
class RimViewController;
|
||||
class RimViewLinker;
|
||||
@ -96,7 +97,8 @@ public:
|
||||
void replaceRangeFilterCollectionWithOverride();
|
||||
|
||||
|
||||
caf::PdmChildField<RimCrossSectionCollection*> crossSectionCollection;
|
||||
caf::PdmChildField<RimIntersectionCollection*> crossSectionCollection;
|
||||
caf::PdmChildField<RimIntersectionBoxCollection*> intersectionBoxCollection;
|
||||
|
||||
// Draw style
|
||||
|
||||
|
BIN
ApplicationCode/Resources/IntersectionBox16x16.png
Normal file
BIN
ApplicationCode/Resources/IntersectionBox16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 687 B |
BIN
ApplicationCode/Resources/IntersectionBoxes16x16.png
Normal file
BIN
ApplicationCode/Resources/IntersectionBoxes16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 848 B |
@ -57,15 +57,16 @@
|
||||
<file>CrossSection16x16.png</file>
|
||||
<file>CrossSections16x16.png</file>
|
||||
<file>Refresh-32.png</file>
|
||||
<file>SummaryPlot16x16.png</file>
|
||||
<file>SummaryPlots16x16.png</file>
|
||||
<file>SummaryCurve16x16.png</file>
|
||||
<file>SummaryCurveFilter16x16.png</file>
|
||||
<file>FormationCollection16x16.png</file>
|
||||
<file>Formations16x16.png</file>
|
||||
<file>Parallel16x16.png</file>
|
||||
<file>Perspective16x16.png</file>
|
||||
|
||||
<file>SummaryPlot16x16.png</file>
|
||||
<file>SummaryPlots16x16.png</file>
|
||||
<file>SummaryCurve16x16.png</file>
|
||||
<file>SummaryCurveFilter16x16.png</file>
|
||||
<file>FormationCollection16x16.png</file>
|
||||
<file>Formations16x16.png</file>
|
||||
<file>Parallel16x16.png</file>
|
||||
<file>Perspective16x16.png</file>
|
||||
<file>IntersectionBox16x16.png</file>
|
||||
<file>IntersectionBoxes16x16.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader/">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
@ -700,6 +700,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();
|
||||
|
@ -19,10 +19,13 @@
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicViewerEventInterface.h"
|
||||
#include "RicEclipsePropertyFilterNewExec.h"
|
||||
#include "RicGeoMechPropertyFilterNewExec.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
#include "WellPathCommands/RicWellPathViewerEventHandler.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
#include "RigFault.h"
|
||||
@ -32,7 +35,7 @@
|
||||
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimDefines.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@ -54,9 +57,10 @@
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivCrossSectionSourceInfo.h"
|
||||
#include "RivFemPartGeometryGenerator.h"
|
||||
#include "RivFemPickSourceInfo.h"
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivSourceInfo.h"
|
||||
#include "RivTernarySaturationOverlayItem.h"
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
@ -72,13 +76,12 @@
|
||||
#include "cvfOverlayScalarMapperLegend.h"
|
||||
#include "cvfPart.h"
|
||||
|
||||
#include "WellPathCommands/RicWellPathViewerEventHandler.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// RiaViewerCommands
|
||||
@ -92,10 +95,11 @@ 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("RicNewPolylineCrossSectionFeature");
|
||||
caf::CmdFeature* cmdFeature = caf::CmdFeatureManager::instance()->getCommandFeature("RicNewPolylineIntersectionFeature");
|
||||
CVF_ASSERT(cmdFeature);
|
||||
|
||||
m_viewerEventHandlers.push_back(dynamic_cast<RicViewerEventInterface*>(cmdFeature));
|
||||
@ -141,20 +145,36 @@ 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)
|
||||
{
|
||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivCrossSectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivCrossSectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
|
||||
|
||||
if (rivSourceInfo || femSourceInfo || crossSectionSourceInfo)
|
||||
if (rivSourceInfo || femSourceInfo || crossSectionSourceInfo || intersectionBoxSourceInfo)
|
||||
{
|
||||
if (rivSourceInfo)
|
||||
{
|
||||
@ -175,10 +195,15 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
{
|
||||
findCellAndGridIndex(crossSectionSourceInfo, firstPartTriangleIndex, &m_currentCellIndex, &m_currentGridIdx);
|
||||
m_currentFaceIndex = cvf::StructGridInterface::NO_FACE;
|
||||
m_currentCrossSection = const_cast<RimCrossSection*>(crossSectionSourceInfo->crossSection());
|
||||
m_currentCrossSection = const_cast<RimIntersection*>(crossSectionSourceInfo->crossSection());
|
||||
|
||||
menu.addAction(QString("Hide intersection"), this, SLOT(slotHideIntersection()));
|
||||
}
|
||||
else if (intersectionBoxSourceInfo)
|
||||
{
|
||||
findCellAndGridIndex(intersectionBoxSourceInfo, firstPartTriangleIndex, &m_currentCellIndex, &m_currentGridIdx);
|
||||
m_currentFaceIndex = cvf::StructGridInterface::NO_FACE;
|
||||
}
|
||||
|
||||
// IJK -slice commands
|
||||
|
||||
@ -190,6 +215,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());
|
||||
@ -255,7 +288,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellPathCrossSectionFeature";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,7 +300,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
{
|
||||
caf::SelectionManager::instance()->setSelectedItem(well);
|
||||
|
||||
commandIds << "RicNewSimWellCrossSectionFeature";
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,7 +315,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
commandIds << "RicSetMasterViewFeature";
|
||||
}
|
||||
|
||||
commandIds << "RicNewPolylineCrossSectionFeature";
|
||||
commandIds << "RicNewPolylineIntersectionFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
|
||||
@ -464,7 +497,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
{
|
||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivCrossSectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivCrossSectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
|
||||
|
||||
if (rivSourceInfo)
|
||||
{
|
||||
@ -486,6 +520,10 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
{
|
||||
findCellAndGridIndex(crossSectionSourceInfo, firstPartTriangleIndex, &cellIndex, &gridIndex);
|
||||
}
|
||||
else if (intersectionBoxSourceInfo)
|
||||
{
|
||||
findCellAndGridIndex(intersectionBoxSourceInfo, firstPartTriangleIndex, &cellIndex, &gridIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (firstNncHitPart && firstNncHitPart->sourceInfo())
|
||||
@ -548,7 +586,15 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::findCellAndGridIndex(const RivCrossSectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
|
||||
cvf::Vec3d RiuViewerCommands::lastPickPositionInDomainCoords() const
|
||||
{
|
||||
return m_currentPickPositionInDomainCoords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
|
||||
{
|
||||
CVF_ASSERT(cellIndex && gridIndex);
|
||||
|
||||
@ -569,6 +615,30 @@ void RiuViewerCommands::findCellAndGridIndex(const RivCrossSectionSourceInfo* cr
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
|
||||
{
|
||||
CVF_ASSERT(cellIndex && gridIndex);
|
||||
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
||||
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(m_reservoirView.p());
|
||||
if (eclipseView)
|
||||
{
|
||||
size_t globalCellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
|
||||
|
||||
const RigCell& cell = eclipseView->eclipseCase()->reservoirData()->mainGrid()->globalCellArray()[globalCellIndex];
|
||||
*cellIndex = cell.gridLocalCellIndex();
|
||||
*gridIndex = cell.hostGrid()->gridIndex();
|
||||
}
|
||||
else if (geomView)
|
||||
{
|
||||
*cellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
|
||||
*gridIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -25,13 +25,14 @@
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
class RimCrossSection;
|
||||
class RicViewerEventInterface;
|
||||
class RimEclipseView;
|
||||
class RimGeoMechView;
|
||||
class RimIntersection;
|
||||
class RimView;
|
||||
class RiuViewer;
|
||||
class RivCrossSectionSourceInfo;
|
||||
class RicViewerEventInterface;
|
||||
class RivIntersectionBoxSourceInfo;
|
||||
class RivIntersectionSourceInfo;
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
@ -52,8 +53,7 @@ public:
|
||||
|
||||
void displayContextMenu(QMouseEvent* event);
|
||||
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
|
||||
|
||||
void findCellAndGridIndex(const RivCrossSectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
|
||||
private slots:
|
||||
void slotRangeFilterI();
|
||||
@ -65,6 +65,9 @@ private slots:
|
||||
void slotHideIntersection();
|
||||
|
||||
private:
|
||||
void findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
void findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
|
||||
void ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
||||
void createSliceRangeFilter(int ijOrk);
|
||||
void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit);
|
||||
@ -74,9 +77,10 @@ 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<RimCrossSection> m_currentCrossSection;
|
||||
caf::PdmPointer<RimIntersection> m_currentCrossSection;
|
||||
|
||||
QPointer<RiuViewer> m_viewer;
|
||||
|
||||
|
@ -170,6 +170,8 @@ namespace caf {
|
||||
progDialog = new QProgressDialog();
|
||||
|
||||
progDialog->hide();
|
||||
progDialog->setAutoClose(false);
|
||||
progDialog->setAutoReset(false);
|
||||
}
|
||||
return progDialog;
|
||||
}
|
||||
@ -420,7 +422,6 @@ namespace caf {
|
||||
if (progressDialog() != NULL)
|
||||
{
|
||||
progressDialog()->hide();
|
||||
delete progressDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,4 +26,7 @@ add_library( ${PROJECT_NAME}
|
||||
TranspWB_CombinationFrag.glsl
|
||||
TranspWB_PartlyTranspPartsFrag.glsl
|
||||
TranspWB_TransparentPartsFrag.glsl
|
||||
|
||||
cafHexGridIntersectionTools/cafHexGridIntersectionTools.h
|
||||
cafHexGridIntersectionTools/cafHexGridIntersectionTools.cpp
|
||||
)
|
||||
|
@ -1,57 +1,23 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RivCrossSectionGeometryGenerator.h"
|
||||
#include "cafHexGridIntersectionTools.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "cvfPlane.h"
|
||||
|
||||
#include "RimCrossSection.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivCrossSectionGeometryGenerator::RivCrossSectionGeometryGenerator(const RimCrossSection* crossSection,
|
||||
std::vector<std::vector<cvf::Vec3d> > &polylines,
|
||||
const cvf::Vec3d& extrusionDirection,
|
||||
const RivCrossSectionHexGridIntf* grid)
|
||||
: m_crossSection(crossSection),
|
||||
m_polyLines(polylines),
|
||||
m_extrusionDirection(extrusionDirection),
|
||||
m_hexGrid(grid)
|
||||
HexGridIntersectionTools::ClipVx::ClipVx()
|
||||
: vx(cvf::Vec3d::ZERO),
|
||||
normDistFromEdgeVx1(HUGE_VAL),
|
||||
clippedEdgeVx1Id(-1),
|
||||
clippedEdgeVx2Id(-1),
|
||||
isVxIdsNative(true),
|
||||
derivedVxLevel(-1)
|
||||
{
|
||||
m_triangleVxes = new cvf::Vec3fArray;
|
||||
m_cellBorderLineVxes = new cvf::Vec3fArray;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivCrossSectionGeometryGenerator::~RivCrossSectionGeometryGenerator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +33,7 @@ RivCrossSectionGeometryGenerator::~RivCrossSectionGeometryGenerator()
|
||||
///
|
||||
/// \return True if line segment intersects the plane
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool planeLineIntersect(const cvf::Plane& plane, const cvf::Vec3d& a, const cvf::Vec3d& b, cvf::Vec3d* intersection, double* normalizedDistFromA)
|
||||
bool HexGridIntersectionTools::planeLineIntersect(const cvf::Plane& plane, const cvf::Vec3d& a, const cvf::Vec3d& b, cvf::Vec3d* intersection, double* normalizedDistFromA)
|
||||
{
|
||||
// From Real-Time Collision Detection by Christer Eriscon, published by Morgen Kaufmann Publishers, (c) 2005 Elsevier Inc
|
||||
|
||||
@ -90,19 +56,6 @@ bool planeLineIntersect(const cvf::Plane& plane, const cvf::Vec3d& a, const cvf:
|
||||
}
|
||||
|
||||
|
||||
struct ClipVx
|
||||
{
|
||||
ClipVx() : vx(cvf::Vec3d::ZERO), normDistFromEdgeVx1(HUGE_VAL), clippedEdgeVx1Id(-1), clippedEdgeVx2Id(-1), isVxIdsNative(true) {}
|
||||
|
||||
cvf::Vec3d vx;
|
||||
|
||||
double normDistFromEdgeVx1;
|
||||
size_t clippedEdgeVx1Id;
|
||||
size_t clippedEdgeVx2Id;
|
||||
|
||||
bool isVxIdsNative;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns whether the triangle was hit by the plane.
|
||||
/// isMostVxesOnPositiveSide returns true if all or two of the vxes is on the positive side of the plane.
|
||||
@ -131,20 +84,20 @@ struct ClipVx
|
||||
// \+ +/
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
bool planeTriangleIntersection(const cvf::Plane& plane,
|
||||
const cvf::Vec3d& p1, size_t p1Id,
|
||||
const cvf::Vec3d& p2, size_t p2Id,
|
||||
const cvf::Vec3d& p3, size_t p3Id,
|
||||
ClipVx* newVx1, ClipVx* newVx2,
|
||||
bool * isMostVxesOnPositiveSide)
|
||||
bool HexGridIntersectionTools::planeTriangleIntersection(const cvf::Plane& plane,
|
||||
const cvf::Vec3d& p1, size_t p1Id,
|
||||
const cvf::Vec3d& p2, size_t p2Id,
|
||||
const cvf::Vec3d& p3, size_t p3Id,
|
||||
ClipVx* newVx1, ClipVx* newVx2,
|
||||
bool * isMostVxesOnPositiveSide)
|
||||
{
|
||||
int onPosSide[3];
|
||||
onPosSide[0] = plane.distanceSquared(p1) >= 0 ;
|
||||
onPosSide[1] = plane.distanceSquared(p2) >= 0 ;
|
||||
onPosSide[2] = plane.distanceSquared(p3) >= 0 ;
|
||||
onPosSide[0] = plane.distanceSquared(p1) >= 0;
|
||||
onPosSide[1] = plane.distanceSquared(p2) >= 0;
|
||||
onPosSide[2] = plane.distanceSquared(p3) >= 0;
|
||||
|
||||
const int numPositiveVertices = onPosSide[0] + onPosSide[1] + onPosSide[2];
|
||||
|
||||
|
||||
// The entire triangle is on the negative side
|
||||
// Clip everything
|
||||
if (numPositiveVertices == 0)
|
||||
@ -154,7 +107,7 @@ bool planeTriangleIntersection(const cvf::Plane& plane,
|
||||
}
|
||||
|
||||
// All triangle vertices are on the positive side
|
||||
if (numPositiveVertices == 3)
|
||||
if (numPositiveVertices == 3)
|
||||
{
|
||||
(*isMostVxesOnPositiveSide) = true;
|
||||
return false;
|
||||
@ -215,8 +168,8 @@ bool planeTriangleIntersection(const cvf::Plane& plane,
|
||||
}
|
||||
|
||||
CVF_TIGHT_ASSERT(ok1 && ok2);
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -251,18 +204,19 @@ bool planeTriangleIntersection(const cvf::Plane& plane,
|
||||
// The isTriangleEdgeCellContour bits refer to the edge after the corresponding triangle vertex.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
void clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx> &triangleVxes,
|
||||
const std::vector<bool> &isTriangleEdgeCellContour,
|
||||
const cvf::Plane& p1Plane, const cvf::Plane& p2Plane,
|
||||
std::vector<ClipVx> *clippedTriangleVxes,
|
||||
std::vector<bool> *isClippedTriEdgeCellContour)
|
||||
void HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx>& triangleVxes,
|
||||
const std::vector<bool>& isTriangleEdgeCellContour,
|
||||
const cvf::Plane& p1Plane,
|
||||
const cvf::Plane& p2Plane,
|
||||
std::vector<ClipVx>* clippedTriangleVxes,
|
||||
std::vector<bool>* isClippedTriEdgeCellContour)
|
||||
{
|
||||
size_t triangleCount = triangleVxes.size()/3;
|
||||
size_t triangleCount = triangleVxes.size() / 3;
|
||||
|
||||
for (size_t tIdx = 0; tIdx < triangleCount; ++tIdx)
|
||||
{
|
||||
|
||||
size_t triVxIdx = tIdx*3;
|
||||
size_t triVxIdx = tIdx * 3;
|
||||
|
||||
ClipVx newVx1OnP1;
|
||||
newVx1OnP1.isVxIdsNative = false;
|
||||
@ -270,6 +224,7 @@ void clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx> &triangleVx
|
||||
newVx2OnP1.isVxIdsNative = false;
|
||||
|
||||
bool isMostVxesOnPositiveSideOfP1 = false;
|
||||
|
||||
bool isIntersectingP1 = planeTriangleIntersection(p1Plane,
|
||||
triangleVxes[triVxIdx + 0].vx, triVxIdx + 0,
|
||||
triangleVxes[triVxIdx + 1].vx, triVxIdx + 1,
|
||||
@ -286,7 +241,9 @@ void clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx> &triangleVx
|
||||
newVx1OnP2.isVxIdsNative = false;
|
||||
ClipVx newVx2OnP2;
|
||||
newVx2OnP2.isVxIdsNative = false;
|
||||
|
||||
bool isMostVxesOnPositiveSideOfP2 = false;
|
||||
|
||||
bool isIntersectingP2 = planeTriangleIntersection(p2Plane,
|
||||
triangleVxes[triVxIdx + 0].vx, triVxIdx + 0,
|
||||
triangleVxes[triVxIdx + 1].vx, triVxIdx + 1,
|
||||
@ -298,12 +255,12 @@ void clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx> &triangleVx
|
||||
continue; // Discard triangle
|
||||
}
|
||||
|
||||
bool p1KeepAll = (!isIntersectingP1 && isMostVxesOnPositiveSideOfP1);
|
||||
bool p2KeepAll = (!isIntersectingP2 && isMostVxesOnPositiveSideOfP2);
|
||||
bool p1KeepQuad = (isIntersectingP1 && isMostVxesOnPositiveSideOfP1);
|
||||
bool p2KeepQuad = (isIntersectingP2 && isMostVxesOnPositiveSideOfP2);
|
||||
bool p1KeepTop = (isIntersectingP1 && !isMostVxesOnPositiveSideOfP1);
|
||||
bool p2KeepTop = (isIntersectingP2 && !isMostVxesOnPositiveSideOfP2);
|
||||
bool p1KeepAll = (!isIntersectingP1 && isMostVxesOnPositiveSideOfP1);
|
||||
bool p2KeepAll = (!isIntersectingP2 && isMostVxesOnPositiveSideOfP2);
|
||||
bool p1KeepQuad = ( isIntersectingP1 && isMostVxesOnPositiveSideOfP1);
|
||||
bool p2KeepQuad = ( isIntersectingP2 && isMostVxesOnPositiveSideOfP2);
|
||||
bool p1KeepTop = ( isIntersectingP1 && !isMostVxesOnPositiveSideOfP1);
|
||||
bool p2KeepTop = ( isIntersectingP2 && !isMostVxesOnPositiveSideOfP2);
|
||||
|
||||
if (p1KeepAll && p2KeepAll)
|
||||
{
|
||||
@ -496,7 +453,7 @@ void clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx> &triangleVx
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Will return the intersection point. If the plane is outside the line, it returns the closest line endpoint
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d planeLineIntersectionForMC(const cvf::Plane& plane, const cvf::Vec3d& p1, const cvf::Vec3d& p2, double* normalizedDistFromP1)
|
||||
cvf::Vec3d HexGridIntersectionTools::planeLineIntersectionForMC(const cvf::Plane& plane, const cvf::Vec3d& p1, const cvf::Vec3d& p2, double* normalizedDistFromP1)
|
||||
{
|
||||
// From http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/
|
||||
//
|
||||
@ -517,7 +474,7 @@ cvf::Vec3d planeLineIntersectionForMC(const cvf::Plane& plane, const cvf::Vec3d&
|
||||
double denominator = -(plane.A()*v.x() + plane.B()*v.y() + plane.C()*v.z());
|
||||
if (denominator != 0)
|
||||
{
|
||||
double u = (plane.A()*p1.x() + plane.B()*p1.y() + plane.C()*p1.z() + plane.D())/denominator;
|
||||
double u = (plane.A()*p1.x() + plane.B()*p1.y() + plane.C()*p1.z() + plane.D()) / denominator;
|
||||
(*normalizedDistFromP1) = u;
|
||||
if (u > 0.0 && u < 1.0)
|
||||
{
|
||||
@ -544,17 +501,17 @@ cvf::Vec3d planeLineIntersectionForMC(const cvf::Plane& plane, const cvf::Vec3d&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int planeHexIntersectionMC(const cvf::Plane& plane,
|
||||
const cvf::Vec3d cell[8],
|
||||
const size_t hexCornersIds[8],
|
||||
std::vector<ClipVx>* triangleVxes,
|
||||
std::vector<bool>* isTriEdgeCellContour)
|
||||
int HexGridIntersectionTools::planeHexIntersectionMC(const cvf::Plane& plane,
|
||||
const cvf::Vec3d cell[8],
|
||||
const size_t hexCornersIds[8],
|
||||
std::vector<ClipVx>* triangleVxes,
|
||||
std::vector<bool>* isTriEdgeCellContour)
|
||||
{
|
||||
|
||||
// Based on description and implementation from Paul Bourke:
|
||||
// http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
|
||||
// Based on description and implementation from Paul Bourke:
|
||||
// http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
|
||||
|
||||
static const uint cubeIdxToCutEdgeBitfield[256] =
|
||||
static const cvf::uint cubeIdxToCutEdgeBitfield[256] =
|
||||
{
|
||||
0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
|
||||
0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
|
||||
@ -886,24 +843,24 @@ int planeHexIntersectionMC(const cvf::Plane& plane,
|
||||
|
||||
|
||||
// Compute vertex coordinates on the edges where we have intersections
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 1) edgeIntersections[0] = planeLineIntersectionForMC(plane, cell[0], cell[1], &normDistAlongEdge[0] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 2) edgeIntersections[1] = planeLineIntersectionForMC(plane, cell[1], cell[2], &normDistAlongEdge[1] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 4) edgeIntersections[2] = planeLineIntersectionForMC(plane, cell[2], cell[3], &normDistAlongEdge[2] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 8) edgeIntersections[3] = planeLineIntersectionForMC(plane, cell[3], cell[0], &normDistAlongEdge[3] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 16) edgeIntersections[4] = planeLineIntersectionForMC(plane, cell[4], cell[5], &normDistAlongEdge[4] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 32) edgeIntersections[5] = planeLineIntersectionForMC(plane, cell[5], cell[6], &normDistAlongEdge[5] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 64) edgeIntersections[6] = planeLineIntersectionForMC(plane, cell[6], cell[7], &normDistAlongEdge[6] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 128) edgeIntersections[7] = planeLineIntersectionForMC(plane, cell[7], cell[4], &normDistAlongEdge[7] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 256) edgeIntersections[8] = planeLineIntersectionForMC(plane, cell[0], cell[4], &normDistAlongEdge[8] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 512) edgeIntersections[9] = planeLineIntersectionForMC(plane, cell[1], cell[5], &normDistAlongEdge[9] );
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 1024) edgeIntersections[10] = planeLineIntersectionForMC(plane, cell[2], cell[6], &normDistAlongEdge[10]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 2048) edgeIntersections[11] = planeLineIntersectionForMC(plane, cell[3], cell[7], &normDistAlongEdge[11]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 1) edgeIntersections[0] = planeLineIntersectionForMC(plane, cell[0], cell[1], &normDistAlongEdge[0]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 2) edgeIntersections[1] = planeLineIntersectionForMC(plane, cell[1], cell[2], &normDistAlongEdge[1]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 4) edgeIntersections[2] = planeLineIntersectionForMC(plane, cell[2], cell[3], &normDistAlongEdge[2]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 8) edgeIntersections[3] = planeLineIntersectionForMC(plane, cell[3], cell[0], &normDistAlongEdge[3]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 16) edgeIntersections[4] = planeLineIntersectionForMC(plane, cell[4], cell[5], &normDistAlongEdge[4]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 32) edgeIntersections[5] = planeLineIntersectionForMC(plane, cell[5], cell[6], &normDistAlongEdge[5]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 64) edgeIntersections[6] = planeLineIntersectionForMC(plane, cell[6], cell[7], &normDistAlongEdge[6]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 128) edgeIntersections[7] = planeLineIntersectionForMC(plane, cell[7], cell[4], &normDistAlongEdge[7]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 256) edgeIntersections[8] = planeLineIntersectionForMC(plane, cell[0], cell[4], &normDistAlongEdge[8]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 512) edgeIntersections[9] = planeLineIntersectionForMC(plane, cell[1], cell[5], &normDistAlongEdge[9]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 1024) edgeIntersections[10] = planeLineIntersectionForMC(plane, cell[2], cell[6], &normDistAlongEdge[10]);
|
||||
if (cubeIdxToCutEdgeBitfield[cubeIndex] & 2048) edgeIntersections[11] = planeLineIntersectionForMC(plane, cell[3], cell[7], &normDistAlongEdge[11]);
|
||||
|
||||
|
||||
// Create the triangles
|
||||
|
||||
const int* triangleIndicesToCubeEdges = cubeIdxToTriangleIndices[cubeIndex];
|
||||
uint triangleVxIdx = 0;
|
||||
cvf::uint triangleVxIdx = 0;
|
||||
int cubeEdgeIdx = triangleIndicesToCubeEdges[triangleVxIdx];
|
||||
|
||||
|
||||
@ -920,9 +877,9 @@ int planeHexIntersectionMC(const cvf::Plane& plane,
|
||||
cubeEdgeIdx = triangleIndicesToCubeEdges[triangleVxIdx];
|
||||
}
|
||||
|
||||
uint triangleCount = triangleVxIdx/3;
|
||||
cvf::uint triangleCount = triangleVxIdx / 3;
|
||||
|
||||
int triangleEdgeCount[12][12] ={
|
||||
int triangleEdgeCount[12][12] = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
@ -940,516 +897,36 @@ int planeHexIntersectionMC(const cvf::Plane& plane,
|
||||
(*isTriEdgeCellContour).clear();
|
||||
(*isTriEdgeCellContour).resize(triangleVxIdx, false);
|
||||
|
||||
for (uint tIdx = 0; tIdx < triangleCount; ++tIdx)
|
||||
for (cvf::uint tIdx = 0; tIdx < triangleCount; ++tIdx)
|
||||
{
|
||||
uint triVxIdx = 3*tIdx;
|
||||
cvf::uint triVxIdx = 3 * tIdx;
|
||||
int cubeEdgeIdx1 = triangleIndicesToCubeEdges[triVxIdx];
|
||||
int cubeEdgeIdx2 = triangleIndicesToCubeEdges[triVxIdx + 1];
|
||||
int cubeEdgeIdx3 = triangleIndicesToCubeEdges[triVxIdx + 2 ];
|
||||
int cubeEdgeIdx3 = triangleIndicesToCubeEdges[triVxIdx + 2];
|
||||
|
||||
cubeEdgeIdx1 < cubeEdgeIdx2 ? ++triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx2]: ++triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx1];
|
||||
cubeEdgeIdx2 < cubeEdgeIdx3 ? ++triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx3]: ++triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx2];
|
||||
cubeEdgeIdx3 < cubeEdgeIdx1 ? ++triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx1]: ++triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx3];
|
||||
cubeEdgeIdx1 < cubeEdgeIdx2 ? ++triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx2] : ++triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx1];
|
||||
cubeEdgeIdx2 < cubeEdgeIdx3 ? ++triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx3] : ++triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx2];
|
||||
cubeEdgeIdx3 < cubeEdgeIdx1 ? ++triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx1] : ++triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx3];
|
||||
}
|
||||
|
||||
for (uint tIdx = 0; tIdx < triangleCount; ++tIdx)
|
||||
for (cvf::uint tIdx = 0; tIdx < triangleCount; ++tIdx)
|
||||
{
|
||||
uint triVxIdx = 3*tIdx;
|
||||
cvf::uint triVxIdx = 3 * tIdx;
|
||||
|
||||
int cubeEdgeIdx1 = triangleIndicesToCubeEdges[triVxIdx];
|
||||
int cubeEdgeIdx2 = triangleIndicesToCubeEdges[triVxIdx + 1];
|
||||
int cubeEdgeIdx3 = triangleIndicesToCubeEdges[triVxIdx + 2 ];
|
||||
int cubeEdgeIdx3 = triangleIndicesToCubeEdges[triVxIdx + 2];
|
||||
|
||||
(*isTriEdgeCellContour)[triVxIdx+0] = (1 == (cubeEdgeIdx1 < cubeEdgeIdx2 ? triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx2]: triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx1]));
|
||||
(*isTriEdgeCellContour)[triVxIdx+1] = (1 == (cubeEdgeIdx2 < cubeEdgeIdx3 ? triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx3]: triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx2]));
|
||||
(*isTriEdgeCellContour)[triVxIdx+2] = (1 == (cubeEdgeIdx3 < cubeEdgeIdx1 ? triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx1]: triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx3]));
|
||||
(*isTriEdgeCellContour)[triVxIdx + 0] = (1 == (cubeEdgeIdx1 < cubeEdgeIdx2 ? triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx2] : triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx1]));
|
||||
(*isTriEdgeCellContour)[triVxIdx + 1] = (1 == (cubeEdgeIdx2 < cubeEdgeIdx3 ? triangleEdgeCount[cubeEdgeIdx2][cubeEdgeIdx3] : triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx2]));
|
||||
(*isTriEdgeCellContour)[triVxIdx + 2] = (1 == (cubeEdgeIdx3 < cubeEdgeIdx1 ? triangleEdgeCount[cubeEdgeIdx3][cubeEdgeIdx1] : triangleEdgeCount[cubeEdgeIdx1][cubeEdgeIdx3]));
|
||||
}
|
||||
|
||||
return triangleCount;
|
||||
}
|
||||
|
||||
|
||||
void RivCrossSectionGeometryGenerator::calculateArrays()
|
||||
{
|
||||
if (m_triangleVxes->size()) return;
|
||||
|
||||
m_extrusionDirection.normalize();
|
||||
std::vector<cvf::Vec3f> triangleVertices;
|
||||
std::vector<cvf::Vec3f> cellBorderLineVxes;
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
|
||||
|
||||
if (m_polyLine.size() < 2) continue;
|
||||
|
||||
std::vector<cvf::Vec3d> m_adjustedPolyline;
|
||||
adjustPolyline(m_polyLine, m_extrusionDirection, &m_adjustedPolyline);
|
||||
|
||||
size_t lineCount = m_adjustedPolyline.size();
|
||||
for (size_t lIdx = 0; lIdx < lineCount - 1; ++lIdx)
|
||||
{
|
||||
cvf::Vec3d p1 = m_adjustedPolyline[lIdx];
|
||||
cvf::Vec3d p2 = m_adjustedPolyline[lIdx+1];
|
||||
|
||||
cvf::BoundingBox sectionBBox;
|
||||
sectionBBox.add(p1);
|
||||
sectionBBox.add(p2);
|
||||
double maxSectionHeight = gridBBox.radius();
|
||||
sectionBBox.add(p1 + m_extrusionDirection*maxSectionHeight);
|
||||
sectionBBox.add(p1 - m_extrusionDirection*maxSectionHeight);
|
||||
sectionBBox.add(p2 + m_extrusionDirection*maxSectionHeight);
|
||||
sectionBBox.add(p2 - m_extrusionDirection*maxSectionHeight);
|
||||
|
||||
std::vector<size_t> columnCellCandidates;
|
||||
m_hexGrid->findIntersectingCells(sectionBBox, &columnCellCandidates);
|
||||
|
||||
cvf::Plane plane;
|
||||
plane.setFromPoints(p1, p2, p2 + m_extrusionDirection*maxSectionHeight);
|
||||
|
||||
cvf::Plane p1Plane;
|
||||
p1Plane.setFromPoints(p1, p1 + m_extrusionDirection*maxSectionHeight, p1 + plane.normal());
|
||||
cvf::Plane p2Plane;
|
||||
p2Plane.setFromPoints(p2, p2 + m_extrusionDirection*maxSectionHeight, p2 - plane.normal());
|
||||
|
||||
|
||||
std::vector<ClipVx> hexPlaneCutTriangleVxes;
|
||||
hexPlaneCutTriangleVxes.reserve(5*3);
|
||||
std::vector<bool> isTriangleEdgeCellContour;
|
||||
isTriangleEdgeCellContour.reserve(5*3);
|
||||
cvf::Vec3d cellCorners[8];
|
||||
size_t cornerIndices[8];
|
||||
|
||||
for (size_t cccIdx = 0; cccIdx < columnCellCandidates.size(); ++cccIdx)
|
||||
{
|
||||
size_t globalCellIdx = columnCellCandidates[cccIdx];
|
||||
|
||||
if (!m_hexGrid->useCell(globalCellIdx)) continue;
|
||||
|
||||
hexPlaneCutTriangleVxes.clear();
|
||||
m_hexGrid->cellCornerVertices(globalCellIdx, cellCorners);
|
||||
m_hexGrid->cellCornerIndices(globalCellIdx, cornerIndices);
|
||||
|
||||
planeHexIntersectionMC(plane,
|
||||
cellCorners,
|
||||
cornerIndices,
|
||||
&hexPlaneCutTriangleVxes,
|
||||
&isTriangleEdgeCellContour);
|
||||
|
||||
std::vector<ClipVx> clippedTriangleVxes;
|
||||
std::vector<bool> isClippedTriEdgeCellContour;
|
||||
|
||||
clipTrianglesBetweenTwoParallelPlanes(hexPlaneCutTriangleVxes, isTriangleEdgeCellContour, p1Plane, p2Plane,
|
||||
&clippedTriangleVxes, &isClippedTriEdgeCellContour);
|
||||
|
||||
size_t clippedTriangleCount = clippedTriangleVxes.size()/3;
|
||||
|
||||
for (uint tIdx = 0; tIdx < clippedTriangleCount; ++tIdx)
|
||||
{
|
||||
uint triVxIdx = tIdx*3;
|
||||
|
||||
// Accumulate triangle vertices
|
||||
|
||||
cvf::Vec3f p0(clippedTriangleVxes[triVxIdx+0].vx - displayOffset);
|
||||
cvf::Vec3f p1(clippedTriangleVxes[triVxIdx+1].vx - displayOffset);
|
||||
cvf::Vec3f p2(clippedTriangleVxes[triVxIdx+2].vx - displayOffset);
|
||||
|
||||
triangleVertices.push_back(p0);
|
||||
triangleVertices.push_back(p1);
|
||||
triangleVertices.push_back(p2);
|
||||
|
||||
|
||||
// Accumulate mesh lines
|
||||
|
||||
if (isClippedTriEdgeCellContour[triVxIdx])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p0);
|
||||
cellBorderLineVxes.push_back(p1);
|
||||
}
|
||||
if (isClippedTriEdgeCellContour[triVxIdx+1])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p1);
|
||||
cellBorderLineVxes.push_back(p2);
|
||||
}
|
||||
if (isClippedTriEdgeCellContour[triVxIdx+2])
|
||||
{
|
||||
cellBorderLineVxes.push_back(p2);
|
||||
cellBorderLineVxes.push_back(p0);
|
||||
}
|
||||
|
||||
// Mapping to cell index
|
||||
|
||||
m_triangleToCellIdxMap.push_back(globalCellIdx);
|
||||
|
||||
// Interpolation from nodes
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
ClipVx cvx = clippedTriangleVxes[triVxIdx+i];
|
||||
if (cvx.isVxIdsNative)
|
||||
{
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivVertexWeights(cvx.clippedEdgeVx1Id, cvx.clippedEdgeVx2Id, cvx.normDistFromEdgeVx1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ClipVx cvx1 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx1Id];
|
||||
ClipVx cvx2 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx2Id];
|
||||
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivVertexWeights(cvx1.clippedEdgeVx1Id, cvx1.clippedEdgeVx2Id, cvx1.normDistFromEdgeVx1,
|
||||
cvx2.clippedEdgeVx1Id, cvx2.clippedEdgeVx2Id, cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_triangleVxes->assign(triangleVertices);
|
||||
m_cellBorderLineVxes->assign(cellBorderLineVxes);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Generate surface drawable geo from the specified region
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivCrossSectionGeometryGenerator::generateSurface()
|
||||
{
|
||||
calculateArrays();
|
||||
|
||||
CVF_ASSERT(m_triangleVxes.notNull());
|
||||
|
||||
if (m_triangleVxes->size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setFromTriangleVertexArray(m_triangleVxes.p());
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivCrossSectionGeometryGenerator::createMeshDrawable()
|
||||
{
|
||||
if (!(m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0)) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray(m_cellBorderLineVxes.p());
|
||||
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> prim = new cvf::PrimitiveSetDirect(cvf::PT_LINES);
|
||||
prim->setIndexCount(m_cellBorderLineVxes->size());
|
||||
|
||||
geo->addPrimitiveSet(prim.p());
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivCrossSectionGeometryGenerator::createLineAlongPolylineDrawable()
|
||||
{
|
||||
std::vector<cvf::uint> lineIndices;
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
|
||||
if (m_polyLine.size() < 2) continue;
|
||||
|
||||
for (size_t i = 0; i < m_polyLine.size(); ++i)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(m_polyLine[i] - displayOffset));
|
||||
if (i < m_polyLine.size() - 1)
|
||||
{
|
||||
lineIndices.push_back(static_cast<cvf::uint>(i));
|
||||
lineIndices.push_back(static_cast<cvf::uint>(i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray;
|
||||
vx->assign(vertices);
|
||||
cvf::ref<cvf::UIntArray> idxes = new cvf::UIntArray;
|
||||
idxes->assign(lineIndices);
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);
|
||||
prim->setIndices(idxes.p());
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> polylineGeo = new cvf::DrawableGeo;
|
||||
polylineGeo->setVertexArray(vx.p());
|
||||
polylineGeo->addPrimitiveSet(prim.p());
|
||||
|
||||
return polylineGeo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivCrossSectionGeometryGenerator::createPointsFromPolylineDrawable()
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
|
||||
for (size_t i = 0; i < m_polyLine.size(); ++i)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(m_polyLine[i] - displayOffset));
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> primSet = new cvf::PrimitiveSetDirect(cvf::PT_POINTS);
|
||||
primSet->setStartIndex(0);
|
||||
primSet->setIndexCount(vertices.size());
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray(vertices);
|
||||
geo->setVertexArray(vx.p());
|
||||
geo->addPrimitiveSet(primSet.p());
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Remove the lines from the polyline that is nearly parallel to the extrusion direction
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionGeometryGenerator::adjustPolyline(const std::vector<cvf::Vec3d>& polyLine,
|
||||
const cvf::Vec3d extrDir,
|
||||
std::vector<cvf::Vec3d>* adjustedPolyline)
|
||||
{
|
||||
size_t lineCount = polyLine.size();
|
||||
if (!polyLine.size()) return;
|
||||
|
||||
adjustedPolyline->push_back(polyLine[0]);
|
||||
cvf::Vec3d p1 = polyLine[0];
|
||||
|
||||
for (size_t lIdx = 1; lIdx < lineCount; ++lIdx)
|
||||
{
|
||||
cvf::Vec3d p2 = polyLine[lIdx];
|
||||
cvf::Vec3d p1p2 = p2 - p1;
|
||||
|
||||
if ((p1p2 - (p1p2 * extrDir)*extrDir).length() > 0.1 )
|
||||
{
|
||||
adjustedPolyline->push_back(p2);
|
||||
p1 = p2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivCrossSectionGeometryGenerator::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triangleToCellIdxMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RivVertexWeights>& RivCrossSectionGeometryGenerator::triangleVxToCellCornerInterpolationWeights() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triVxToCellCornerWeights;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimCrossSection* RivCrossSectionGeometryGenerator::crossSection() const
|
||||
{
|
||||
return m_crossSection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivCrossSectionGeometryGenerator::isAnyGeometryPresent() const
|
||||
{
|
||||
if (m_triangleVxes->size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#include "RigActiveCellInfo.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivEclipseCrossSectionGrid::RivEclipseCrossSectionGrid(const RigMainGrid * mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool showInactiveCells)
|
||||
: m_mainGrid(mainGrid),
|
||||
m_activeCellInfo(activeCellInfo),
|
||||
m_showInactiveCells(showInactiveCells)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivEclipseCrossSectionGrid::displayOffset() const
|
||||
{
|
||||
return m_mainGrid->displayModelOffset();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivEclipseCrossSectionGrid::boundingBox() const
|
||||
{
|
||||
return m_mainGrid->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_mainGrid->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivEclipseCrossSectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
|
||||
if (m_showInactiveCells)
|
||||
return !(cell.isInvalid() || (cell.subGrid() != NULL));
|
||||
else
|
||||
return m_activeCellInfo->isActive(cellIndex) && (cell.subGrid() == NULL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
m_mainGrid->cellCornerVertices(cellIndex, cellCorners);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices();
|
||||
memcpy(cornerIndices, cornerIndicesSource.data(), 8);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#include "RigFemPart.h"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFemCrossSectionGrid::RivFemCrossSectionGrid(const RigFemPart * femPart): m_femPart(femPart)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivFemCrossSectionGrid::displayOffset() const
|
||||
{
|
||||
return cvf::Vec3d::ZERO;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivFemCrossSectionGrid::boundingBox() const
|
||||
{
|
||||
return m_femPart->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemCrossSectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_femPart->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivFemCrossSectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemCrossSectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return ;
|
||||
|
||||
const std::vector<cvf::Vec3f>& nodeCoords = m_femPart->nodes().coordinates;
|
||||
const int* cornerIndices = m_femPart->connectivities(cellIndex);
|
||||
|
||||
cellCorners[0] = cvf::Vec3d(nodeCoords[cornerIndices[0]]);
|
||||
cellCorners[1] = cvf::Vec3d(nodeCoords[cornerIndices[1]]);
|
||||
cellCorners[2] = cvf::Vec3d(nodeCoords[cornerIndices[2]]);
|
||||
cellCorners[3] = cvf::Vec3d(nodeCoords[cornerIndices[3]]);
|
||||
cellCorners[4] = cvf::Vec3d(nodeCoords[cornerIndices[4]]);
|
||||
cellCorners[5] = cvf::Vec3d(nodeCoords[cornerIndices[5]]);
|
||||
cellCorners[6] = cvf::Vec3d(nodeCoords[cornerIndices[6]]);
|
||||
cellCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return ;
|
||||
int elmIdx = static_cast<int>(cellIndex);
|
||||
cornerIndices[0] = m_femPart->elementNodeResultIdx(elmIdx, 0);
|
||||
cornerIndices[1] = m_femPart->elementNodeResultIdx(elmIdx, 1);
|
||||
cornerIndices[2] = m_femPart->elementNodeResultIdx(elmIdx, 2);
|
||||
cornerIndices[3] = m_femPart->elementNodeResultIdx(elmIdx, 3);
|
||||
cornerIndices[4] = m_femPart->elementNodeResultIdx(elmIdx, 4);
|
||||
cornerIndices[5] = m_femPart->elementNodeResultIdx(elmIdx, 5);
|
||||
cornerIndices[6] = m_femPart->elementNodeResultIdx(elmIdx, 6);
|
||||
cornerIndices[7] = m_femPart->elementNodeResultIdx(elmIdx, 7);
|
||||
}
|
||||
} // namespace cvf
|
||||
|
@ -0,0 +1,68 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace cvf {
|
||||
class Plane;
|
||||
};
|
||||
|
||||
|
||||
namespace caf {
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class HexGridIntersectionTools
|
||||
{
|
||||
public:
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
struct ClipVx
|
||||
{
|
||||
ClipVx();
|
||||
|
||||
cvf::Vec3d vx;
|
||||
|
||||
double normDistFromEdgeVx1;
|
||||
size_t clippedEdgeVx1Id;
|
||||
size_t clippedEdgeVx2Id;
|
||||
|
||||
bool isVxIdsNative; //< Pointing to real vertices, or indices to ClipVx's in the supplied triangle vertices array
|
||||
int derivedVxLevel; //< Helper data to make it possible to track what set of ClipVx's the indices is reffering to in case of consecutive clips
|
||||
};
|
||||
|
||||
static bool planeLineIntersect(const cvf::Plane& plane, const cvf::Vec3d& a, const cvf::Vec3d& b, cvf::Vec3d* intersection, double* normalizedDistFromA);
|
||||
|
||||
static bool planeTriangleIntersection(const cvf::Plane& plane,
|
||||
const cvf::Vec3d& p1, size_t p1Id,
|
||||
const cvf::Vec3d& p2, size_t p2Id,
|
||||
const cvf::Vec3d& p3, size_t p3Id,
|
||||
ClipVx* newVx1, ClipVx* newVx2,
|
||||
bool* isMostVxesOnPositiveSide);
|
||||
|
||||
static void clipTrianglesBetweenTwoParallelPlanes(const std::vector<ClipVx>& triangleVxes,
|
||||
const std::vector<bool>& isTriangleEdgeCellContour,
|
||||
const cvf::Plane& p1Plane, const cvf::Plane& p2Plane,
|
||||
std::vector<ClipVx>* clippedTriangleVxes,
|
||||
std::vector<bool>* isClippedTriEdgeCellContour);
|
||||
|
||||
static cvf::Vec3d planeLineIntersectionForMC(const cvf::Plane& plane, const cvf::Vec3d& p1, const cvf::Vec3d& p2, double* normalizedDistFromP1);
|
||||
|
||||
static int planeHexIntersectionMC(const cvf::Plane& plane,
|
||||
const cvf::Vec3d cell[8],
|
||||
const size_t hexCornersIds[8],
|
||||
std::vector<ClipVx>* triangleVxes,
|
||||
std::vector<bool>* isTriEdgeCellContour);
|
||||
|
||||
};
|
||||
|
||||
}; // namespace caf
|
Loading…
Reference in New Issue
Block a user