mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/dev-deeper' into dev
This commit is contained in:
commit
1dc65855ae
4
.gitignore
vendored
4
.gitignore
vendored
@ -69,3 +69,7 @@ Ankh.NoLoad
|
||||
/Resinsight_Host.creator
|
||||
/Resinsight_Host.config
|
||||
*.RESINSIGHT_IDX
|
||||
/Fwk/VizFwk/.vs/VizFramework/v15/Solution.VC.db-wal
|
||||
/Fwk/VizFwk/.vs/VizFramework/v15/Solution.VC.db-shm
|
||||
/Fwk/VizFwk/.vs/VizFramework/v15/Solution.VC.db
|
||||
/Fwk/VizFwk/.vs/VizFramework/v15/Browse.VC.db
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "HoloLensCommands/RicHoloLensSessionManager.h"
|
||||
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
@ -78,7 +79,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuProcessMonitor.h"
|
||||
#include "RiuRecentFileActionProvider.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
@ -611,6 +612,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
{
|
||||
sumCaseGroup->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
oilField->annotationCollection()->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
loadAndUpdatePlotData();
|
||||
@ -1595,8 +1598,8 @@ bool RiaApplication::enableDevelopmentFeatures()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::clearAllSelections()
|
||||
{
|
||||
RiuSelectionManager::instance()->deleteAllItems(RiuSelectionManager::RUI_APPLICATION_GLOBAL);
|
||||
RiuSelectionManager::instance()->deleteAllItems(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager::instance()->deleteAllItems(Riu3dSelectionManager::RUI_APPLICATION_GLOBAL);
|
||||
Riu3dSelectionManager::instance()->deleteAllItems(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
caf::SelectionManager::instance()->clearAll();
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaGitDiff.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaQIconTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -76,6 +77,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaGitDiff.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaQIconTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -97,7 +97,7 @@ bool RiaArgumentParser::parseArguments()
|
||||
#if defined(_MSC_VER) && defined(_WIN32)
|
||||
RiaApplication::instance()->showFormattedTextInMessageBox(helpText);
|
||||
#else
|
||||
fprintf(stdout, "%s\n", helpText.toAscii().data());
|
||||
fprintf(stdout, "%s\n", helpText.toLatin1().data());
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return false;
|
||||
|
34
ApplicationCode/Application/Tools/RiaBoundingBoxTools.cpp
Normal file
34
ApplicationCode/Application/Tools/RiaBoundingBoxTools.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron 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 "RiaBoundingBoxTools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RiaBoundingBoxTools::inflate(const cvf::BoundingBox& boundingBox, double factor)
|
||||
{
|
||||
cvf::Vec3d center = boundingBox.center();
|
||||
cvf::Vec3d sizes = boundingBox.extent() * factor;
|
||||
|
||||
cvf::Vec3d newMin(center.x() - sizes.x() / 2.0, center.y() - sizes.y() / 2.0, center.z() - sizes.z() / 2.0);
|
||||
cvf::Vec3d newMax(center.x() + sizes.x() / 2.0, center.y() + sizes.y() / 2.0, center.z() + sizes.z() / 2.0);
|
||||
return cvf::BoundingBox(newMin, newMax);
|
||||
}
|
35
ApplicationCode/Application/Tools/RiaBoundingBoxTools.h
Normal file
35
ApplicationCode/Application/Tools/RiaBoundingBoxTools.h
Normal file
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron 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 <cvfBase.h>
|
||||
#include <cvfBoundingBox.h>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaBoundingBoxTools
|
||||
{
|
||||
public:
|
||||
static cvf::BoundingBox inflate(const cvf::BoundingBox& boundingBox, double factor);
|
||||
};
|
@ -43,6 +43,8 @@ public:
|
||||
static double meterToInch(double meter) { return meter * feetPerMeter()*12.0; }
|
||||
static double inchToMeter(double inch) { return (inch / 12.0) * meterPerFeet(); }
|
||||
static double inchToFeet (double inch) { return (inch / 12.0); }
|
||||
static double mmToMeter(double mm) { return mm / 1000.0; }
|
||||
static double meterToMm(double meter) { return 1000.0 * meter; }
|
||||
|
||||
static double darcysConstant(UnitSystem unitSystem);
|
||||
|
||||
|
@ -2,6 +2,19 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (ApplicationCode)
|
||||
|
||||
# Open GL
|
||||
find_package( OpenGL )
|
||||
|
||||
find_package(Qt5Core CONFIG QUIET)
|
||||
if (Qt5Core_FOUND)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Widgets)
|
||||
else()
|
||||
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript)
|
||||
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
# NB: The generated file is written to Cmake binary folder to avoid source tree pollution
|
||||
# This folder is added to include_directories
|
||||
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.h.cmake
|
||||
@ -37,6 +50,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CommandFileInterface/Core
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Annotations
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Completions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
@ -90,6 +104,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ProjectDataModel/Summary/CMakeLists_files.cmake
|
||||
ProjectDataModel/Flow/CMakeLists_files.cmake
|
||||
ProjectDataModel/Annotations/CMakeLists_files.cmake
|
||||
ProjectDataModel/Completions/CMakeLists_files.cmake
|
||||
|
||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||
@ -103,6 +118,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
|
||||
Commands/CMakeLists_files.cmake
|
||||
Commands/ApplicationCommands/CMakeLists_files.cmake
|
||||
Commands/AnnotationCommands/CMakeLists_files.cmake
|
||||
Commands/CompletionCommands/CMakeLists_files.cmake
|
||||
Commands/CompletionExportCommands/CMakeLists_files.cmake
|
||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||
@ -217,9 +233,14 @@ set ( QT_MOC_HEADERS
|
||||
SocketInterface/RiaSocketServer.h
|
||||
)
|
||||
|
||||
qt4_wrap_cpp( MOC_FILES_CPP ${QT_MOC_HEADERS} )
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
else()
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
endif()
|
||||
|
||||
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
|
||||
# NOTE! Resources in subfolders must append to QRC_FILES using the following statement
|
||||
# set( QRC_FILES
|
||||
@ -234,7 +255,17 @@ set( QRC_FILES
|
||||
)
|
||||
|
||||
# Runs RCC on specified files
|
||||
qt4_add_resources( QRC_FILES_CPP ${QRC_FILES} )
|
||||
if ( NOT CMAKE_AUTOMOC)
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
else()
|
||||
qt4_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
endif(Qt5Core_FOUND)
|
||||
endif(NOT CMAKE_AUTOMOC)
|
||||
|
||||
# Adding resource (RC) files for Windows
|
||||
if ( MSVC )
|
||||
@ -270,7 +301,7 @@ endif()
|
||||
set( EXE_FILES
|
||||
${EXE_FILES}
|
||||
${CPP_SOURCES}
|
||||
${MOC_FILES_CPP}
|
||||
${MOC_SOURCE_FILES}
|
||||
${FORM_FILES_CPP}
|
||||
${QRC_FILES_CPP}
|
||||
${WIN_RESOURCE}
|
||||
@ -398,11 +429,19 @@ endif()
|
||||
if (MSVC)
|
||||
|
||||
# Qt DLLs
|
||||
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd QtScript QtScriptd QtScriptTools QtScriptToolsd)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}4.dll)
|
||||
endforeach( qtlib )
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
message(STATUS "Creating post build step for copying Qt DLLs")
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:ResInsight>
|
||||
)
|
||||
endforeach(qtlib)
|
||||
else()
|
||||
set (QTLIBLIST QtCore4 QtCored4 QtGui4 QtGuid4 QtOpenGl4 QtOpenGld4 QtNetwork4 QtNetworkd4 QtScript4 QtScriptd4 QtScriptTools4 QtScriptToolsd4)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}.dll)
|
||||
endforeach( qtlib )
|
||||
endif()
|
||||
# Odb Dlls
|
||||
if (RESINSIGHT_USE_ODB_API)
|
||||
# Find all the dlls
|
||||
|
@ -0,0 +1,34 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationIn3dViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportPolylinesAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateTextAnnotationIn3dViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateUserDefinedPolylinesAnnotationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.h
|
||||
)
|
||||
|
||||
|
||||
source_group( "CommandFeature\\AnnotationCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicCreateReachCircleAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateReachCircleAnnotationFeature, "RicCreateReachCircleAnnotationFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
return selObjs.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateReachCircleAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimReachCircleAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(coll->lineBasedAnnotationsCount());
|
||||
newAnnotation->appearance()->setColor(newColor);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateReachCircleAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/ReachCircle16x16.png"));
|
||||
actionToSetup->setText("Create Reach Circle Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicCreateReachCircleAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RiaPreferences.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateReachCircleAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
RimAnnotationCollection* annotationCollection() const;
|
||||
};
|
@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicCreateTextAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateTextAnnotationFeature, "RicCreateTextAnnotationFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateTextAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjsGlobal = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selObjs2InView = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
|
||||
|
||||
return selObjsGlobal.size() == 1 || selObjs2InView.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
{
|
||||
auto coll = annotationCollectionBase();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
actionToSetup->setText("Create Text Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollectionBase* RicCreateTextAnnotationFeature::annotationCollectionBase() const
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollectionBase*>();
|
||||
return selObjs.size() == 1 ? selObjs.front() : nullptr;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RiaPreferences.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
class RimAnnotationCollectionBase;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateTextAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
RimAnnotationCollectionBase* annotationCollectionBase() const;
|
||||
};
|
@ -0,0 +1,106 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicCreateTextAnnotationIn3dViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimContourMapView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfCamera.h"
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateTextAnnotationIn3dViewFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimContourMapView * contMapView = dynamic_cast<RimContourMapView*>(activeView);
|
||||
|
||||
if ( activeView )
|
||||
{
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = activeView->ownerCase()->activeCellsBoundingBox();
|
||||
|
||||
if (contMapView) domainCoord[2] = bbox.max().z() - bbox.extent().z() * 0.2;
|
||||
|
||||
auto coll = activeView->annotationCollection();
|
||||
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
newAnnotation->setAnchorPoint(domainCoord);
|
||||
cvf::Vec3d labelPos = domainCoord;
|
||||
|
||||
if (activeView->viewer()->mainCamera()->direction().z() <= 0)
|
||||
{
|
||||
labelPos.z() = bbox.max().z();
|
||||
}
|
||||
else
|
||||
{
|
||||
labelPos.z() = bbox.min().z();
|
||||
}
|
||||
|
||||
cvf::Vec3d horizontalRight = activeView->viewer()->mainCamera()->direction() ^ cvf::Vec3d::Z_AXIS;
|
||||
cvf::Vec3d horizontalUp = activeView->viewer()->mainCamera()->up() - (cvf::Vec3d::Z_AXIS * (activeView->viewer()->mainCamera()->up() * cvf::Vec3d::Z_AXIS) );
|
||||
bool isOk = horizontalRight.normalize();
|
||||
if (!isOk) horizontalRight = {1.0, 0.0, 0.0};
|
||||
|
||||
double height = fabs(labelPos.z() - domainCoord.z());
|
||||
newAnnotation->setLabelPoint(labelPos + 2.0*height * (horizontalRight + horizontalUp));
|
||||
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->scheduleRedrawOfRelevantViews();
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationIn3dViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
actionToSetup->setText("Create Text Annotation");
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateTextAnnotationIn3dViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
};
|
@ -0,0 +1,146 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- 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 "RicCreateTextAnnotationPickEventHandler.h"
|
||||
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
#include "RimWellPathTarget.h"
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicCreateTextAnnotationPickEventHandler::RicCreateTextAnnotationPickEventHandler(RimTextAnnotation* textAnnotation)
|
||||
: m_annotationToEdit(textAnnotation)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicCreateTextAnnotationPickEventHandler::~RicCreateTextAnnotationPickEventHandler() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationPickEventHandler::notifyUnregistered()
|
||||
{
|
||||
m_annotationToEdit->enableTargetPointPicking(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateTextAnnotationPickEventHandler::handlePickEvent(const Ric3DPickEvent& eventObject)
|
||||
{
|
||||
if (!caf::SelectionManager::instance()->isSelected(m_annotationToEdit.p(), 0))
|
||||
{
|
||||
m_annotationToEdit->enableTargetPointPicking(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_annotationToEdit)
|
||||
{
|
||||
Rim3dView* rimView = eventObject.m_view;
|
||||
cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO;
|
||||
|
||||
// If clicked on an other well path, snap target point to well path center line
|
||||
auto firstPickItem = eventObject.m_pickItemInfos.front();
|
||||
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstPickItem.sourceInfo());
|
||||
|
||||
auto intersectionPointInDomain =
|
||||
rimView->displayCoordTransform()->transformToDomainCoord(firstPickItem.globalPickedPoint());
|
||||
bool doSetAzimuthAndInclination = false;
|
||||
double azimuth = 0.0;
|
||||
double inclination = 0.0;
|
||||
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
targetPointInDomain =
|
||||
wellPathSourceInfo->closestPointOnCenterLine(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
|
||||
double md = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd(
|
||||
md, wellPathSourceInfo->wellPath()->wellPathGeometry(), &azimuth, &inclination);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetPointInDomain = intersectionPointInDomain;
|
||||
doSetAzimuthAndInclination = false;
|
||||
}
|
||||
|
||||
if (!m_annotationToEdit->firstActiveTarget())
|
||||
{
|
||||
m_annotationToEdit->setReferencePointXyz(targetPointInDomain);
|
||||
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
double mdrkbAtFirstTarget = wellPathSourceInfo->measuredDepth(firstPickItem.faceIdx(), intersectionPointInDomain);
|
||||
|
||||
RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>(wellPathSourceInfo->wellPath());
|
||||
if (modeledWellPath)
|
||||
{
|
||||
mdrkbAtFirstTarget += modeledWellPath->geometryDefinition()->mdrkbAtFirstTarget();
|
||||
}
|
||||
|
||||
m_annotationToEdit->setMdrkbAtFirstTarget(mdrkbAtFirstTarget);
|
||||
}
|
||||
}
|
||||
|
||||
cvf::Vec3d referencePoint = m_annotationToEdit->referencePointXyz();
|
||||
cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint;
|
||||
|
||||
RimWellPathTarget* newTarget = new RimWellPathTarget;
|
||||
|
||||
if (doSetAzimuthAndInclination)
|
||||
{
|
||||
newTarget->setAsPointXYZAndTangentTarget(
|
||||
cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), relativeTagetPoint.z()), azimuth, inclination);
|
||||
}
|
||||
else
|
||||
{
|
||||
newTarget->setAsPointTargetXYD(cvf::Vec3d(relativeTagetPoint.x(), relativeTagetPoint.y(), -relativeTagetPoint.z()));
|
||||
}
|
||||
|
||||
m_annotationToEdit->insertTarget(nullptr, newTarget);
|
||||
|
||||
m_annotationToEdit->updateConnectedEditors();
|
||||
m_annotationToEdit->updateWellPathVisualization();
|
||||
|
||||
return true; // Todo: See if we really should eat the event instead
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- 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 "RicPickEventHandler.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimTextAnnotation;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateTextAnnotationPickEventHandler : public RicPickEventHandler
|
||||
{
|
||||
public:
|
||||
RicCreateTextAnnotationPickEventHandler(RimTextAnnotation* textAnnotation);
|
||||
~RicCreateTextAnnotationPickEventHandler();
|
||||
|
||||
protected:
|
||||
bool handlePickEvent(const Ric3DPickEvent& eventObject) override;
|
||||
void notifyUnregistered() override;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimTextAnnotation> m_annotationToEdit;
|
||||
};
|
@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicCreateUserDefinedPolylinesAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
return selObjs.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(coll->lineBasedAnnotationsCount());
|
||||
newAnnotation->appearance()->setColor(newColor);
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("Create User Defined Polyline Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RiaPreferences.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimAnnotationCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateUserDefinedPolylinesAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
RimAnnotationCollection* annotationCollection() const;
|
||||
};
|
@ -0,0 +1,94 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicDeleteAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeleteAnnotationFeature, "RicDeleteAnnotationFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto textAnnots = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
auto lineBasedAnnots = caf::selectedObjectsByTypeStrict<RimLineBasedAnnotation*>();
|
||||
|
||||
return !textAnnots.empty() || !lineBasedAnnots.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
{
|
||||
auto annotations = caf::selectedObjectsByTypeStrict<RimTextAnnotation*>();
|
||||
while(!annotations.empty())
|
||||
{
|
||||
auto annotation = annotations.front();
|
||||
|
||||
RimAnnotationCollection* coll;
|
||||
annotation->firstAncestorOrThisOfType(coll);
|
||||
if (coll)
|
||||
{
|
||||
coll->addAnnotation()
|
||||
}
|
||||
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto coll = annotationInViewCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/minus-sign-red.png"));
|
||||
actionToSetup->setText("Delete Annotation");
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicImportPolylinesAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicImportPolylinesAnnotationFeature, "RicImportPolylinesAnnotationFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportPolylinesAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Poly Lines Annotation",
|
||||
defaultDir,
|
||||
"Text File (*.txt);Polylines (*.dat);All Files (*.*)");
|
||||
|
||||
if (fileNames.isEmpty()) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setLastUsedDialogDirectory("BINARY_GRID", QFileInfo(fileNames.last()).absolutePath());
|
||||
|
||||
// Find or create the AnnotationsCollection
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimAnnotationCollection* annotColl = proj->activeOilField()->annotationCollection();
|
||||
|
||||
if (!annotColl)
|
||||
{
|
||||
annotColl = new RimAnnotationCollection;
|
||||
proj->activeOilField()->annotationCollection = annotColl;
|
||||
}
|
||||
|
||||
// For each file,
|
||||
|
||||
RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile(fileNames);
|
||||
|
||||
proj->updateConnectedEditors();
|
||||
|
||||
if (lastCreatedOrUpdated)
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(lastCreatedOrUpdated);
|
||||
}
|
||||
|
||||
annotColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/PolylinesFromFile16x16.png"));
|
||||
actionToSetup->setText("Import Poly Lines Annotation");
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicImportPolylinesAnnotationFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,188 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicTextAnnotation3dEditor.h"
|
||||
|
||||
#include "../WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfPart.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicTextAnnotation3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicTextAnnotation3dEditor::RicTextAnnotation3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicTextAnnotation3dEditor::~RicTextAnnotation3dEditor()
|
||||
{
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
|
||||
if (m_cvfModel.notNull() && ownerRiuViewer)
|
||||
{
|
||||
|
||||
// Could result in some circularities ....
|
||||
ownerRiuViewer->removeStaticModel(m_cvfModel.p());
|
||||
}
|
||||
|
||||
auto textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
if (textAnnot)
|
||||
{
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
textAnnot->m_labelPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
|
||||
delete m_labelManipulator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
|
||||
if ( !textAnnot || !textAnnot->isActive())
|
||||
{
|
||||
m_cvfModel->removeAllParts();
|
||||
return;
|
||||
}
|
||||
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->addFieldEditor(this);
|
||||
textAnnot->m_labelPointXyd.uiCapability()->addFieldEditor(this);
|
||||
|
||||
|
||||
if (m_labelManipulator.isNull())
|
||||
{
|
||||
m_labelManipulator = new RicPointTangentManipulator(ownerRiuViewer);
|
||||
m_anchorManipulator = new RicPointTangentManipulator(ownerRiuViewer);
|
||||
QObject::connect(m_labelManipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotLabelUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
QObject::connect(m_anchorManipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotAnchorUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
ownerRiuViewer->addStaticModelOnce(m_cvfModel.p());
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
double handleSize = 1.0;
|
||||
{
|
||||
dispXf = ownerRiuViewer->ownerReservoirView()->displayCoordTransform();
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>(ownerRiuViewer->ownerReservoirView());
|
||||
handleSize = 0.7 * view->ownerCase()->characteristicCellSize();
|
||||
}
|
||||
cvf::Vec3d labelPos(textAnnot->m_labelPointXyd());
|
||||
labelPos.z() *= -1.0;
|
||||
m_labelManipulator->setOrigin(dispXf->transformToDisplayCoord( labelPos ));
|
||||
m_labelManipulator->setHandleSize(handleSize);
|
||||
|
||||
cvf::Vec3d anchorPos(textAnnot->m_anchorPointXyd());
|
||||
anchorPos.z() *= -1.0;
|
||||
m_anchorManipulator->setOrigin(dispXf->transformToDisplayCoord( anchorPos ));
|
||||
m_anchorManipulator->setHandleSize(handleSize);
|
||||
|
||||
|
||||
m_cvfModel->removeAllParts();
|
||||
m_labelManipulator->appendPartsToModel(m_cvfModel.p());
|
||||
m_anchorManipulator->appendPartsToModel(m_cvfModel.p());
|
||||
|
||||
m_cvfModel->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::cleanupBeforeSettingPdmObject()
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
if (textAnnot)
|
||||
{
|
||||
textAnnot->m_anchorPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
textAnnot->m_labelPointXyd.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::slotLabelUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent)
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
|
||||
if ( !textAnnot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
updatePoint(textAnnot->m_labelPointXyd.uiCapability(), origin);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::slotAnchorUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& dummy)
|
||||
{
|
||||
RimTextAnnotation* textAnnot = dynamic_cast<RimTextAnnotation*>(this->pdmObject());
|
||||
|
||||
if ( !textAnnot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
updatePoint(textAnnot->m_anchorPointXyd.uiCapability(), origin);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTextAnnotation3dEditor::updatePoint(caf::PdmUiFieldHandle* uiField, const cvf::Vec3d& newPos)
|
||||
{
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
{
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
}
|
||||
|
||||
cvf::Vec3d domainPos = dispXf->transformToDomainCoord( newPos);
|
||||
domainPos.z() = -domainPos.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainPos);
|
||||
|
||||
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField(uiField, originVariant);
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "cafPdmUi3dObjectEditorHandle.h"
|
||||
|
||||
class RicPointTangentManipulator;
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
namespace cvf {
|
||||
class ModelBasicList;
|
||||
}
|
||||
|
||||
class QString;
|
||||
#include <QPointer>
|
||||
|
||||
class RicTextAnnotation3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicTextAnnotation3dEditor();
|
||||
~RicTextAnnotation3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
void cleanupBeforeSettingPdmObject() override;
|
||||
|
||||
private slots:
|
||||
void slotLabelUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& dummy);
|
||||
void slotAnchorUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& dummy);
|
||||
private:
|
||||
void updatePoint(caf::PdmUiFieldHandle* uiField, const cvf::Vec3d& newPos);
|
||||
|
||||
QPointer<RicPointTangentManipulator> m_labelManipulator;
|
||||
QPointer<RicPointTangentManipulator> m_anchorManipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -70,8 +70,8 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem* RicNewFishbonesSubsAtMeasuredDepthFeature::wellPathSelectionItem()
|
||||
{
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>(selItem);
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -70,8 +70,8 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem* RicNewPerforationIntervalAtMeasuredDepthFeature::wellPathSelectionItem()
|
||||
{
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>(selItem);
|
||||
|
||||
|
@ -252,8 +252,8 @@ RicMswSegment::RicMswSegment(const QString& label,
|
||||
, m_holeDiameter(RicMswExportInfo::defaultDoubleValue())
|
||||
, m_openHoleRoughnessFactor(5.0e-5)
|
||||
, m_skinFactor(RicMswExportInfo::defaultDoubleValue())
|
||||
, m_icdFlowCoefficient(RicMswExportInfo::defaultDoubleValue())
|
||||
, m_icdArea(RicMswExportInfo::defaultDoubleValue())
|
||||
, m_icdFlowCoefficient(0.0)
|
||||
, m_icdArea(0.0)
|
||||
, m_subIndex(subIndex)
|
||||
, m_segmentNumber(segmentNumber)
|
||||
{
|
||||
@ -395,6 +395,14 @@ std::vector<RicMswCompletion>& RicMswSegment::completions()
|
||||
return m_completions;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicMswSegment::setLabel(const QString& label)
|
||||
{
|
||||
m_label = label;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -152,6 +152,7 @@ public:
|
||||
const std::vector<RicMswCompletion>& completions() const;
|
||||
std::vector<RicMswCompletion>& completions();
|
||||
|
||||
void setLabel(const QString& label);
|
||||
void setEffectiveDiameter(double effectiveDiameter);
|
||||
void setHoleDiameter(double holeDiameter);
|
||||
void setOpenHoleRoughnessFactor(double roughnessFactor);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RiaFractureDefines.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaWeightedMeanCalculator.h"
|
||||
|
||||
#include "../ExportCommands/RicExportLgrFeature.h"
|
||||
#include "RicExportCompletionDataSettingsUi.h"
|
||||
@ -61,6 +62,7 @@
|
||||
#include "RimWellPathCompletions.h"
|
||||
#include "RimWellPathFracture.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@ -328,7 +330,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
||||
std::vector<RigCompletionData> completionsForWell;
|
||||
for (const auto& completion : completions)
|
||||
{
|
||||
if (completion.wellName() == wellPath->completions()->wellNameForExport())
|
||||
if (RicWellPathExportCompletionDataFeatureImpl::isCompletionWellPathEqual(completion, wellPath))
|
||||
{
|
||||
completionsForWell.push_back(completion);
|
||||
}
|
||||
@ -369,10 +371,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
||||
std::vector<RigCompletionData> completionsForWell;
|
||||
for (const auto& completion : completions)
|
||||
{
|
||||
if (completion.wellName() == wellPath->completions()->wellNameForExport() &&
|
||||
completionType == completion.completionType())
|
||||
if (completionType == completion.completionType())
|
||||
{
|
||||
completionsForWell.push_back(completion);
|
||||
if (RicWellPathExportCompletionDataFeatureImpl::isCompletionWellPathEqual(completion, wellPath))
|
||||
{
|
||||
completionsForWell.push_back(completion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -675,7 +679,7 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(RifEclipse
|
||||
}
|
||||
|
||||
{
|
||||
generateWelsegsSegments(formatter, exportInfo, {RigCompletionData::ICD, RigCompletionData::FISHBONES});
|
||||
generateWelsegsSegments(formatter, exportInfo, {RigCompletionData::FISHBONES_ICD, RigCompletionData::FISHBONES});
|
||||
generateWelsegsSegments(formatter, exportInfo, {RigCompletionData::FRACTURE});
|
||||
}
|
||||
|
||||
@ -703,7 +707,7 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWelsegsSegments(
|
||||
generatedHeader = true;
|
||||
}
|
||||
|
||||
if (completion.completionType() == RigCompletionData::ICD) // Found ICD
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD) // Found ICD
|
||||
{
|
||||
formatter.comment(completion.label());
|
||||
formatter.add(completion.subSegments().front().segmentNumber());
|
||||
@ -773,9 +777,15 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWelsegsCompletionCommen
|
||||
{
|
||||
formatter.comment("Main stem");
|
||||
}
|
||||
else if (completionType == RigCompletionData::ICD)
|
||||
else if (completionType == RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
formatter.comment("Fishbone Laterals");
|
||||
formatter.comment("Fishbones segments");
|
||||
formatter.comment("Diam: MSW - Tubing Radius");
|
||||
formatter.comment("Rough: MSW - Open Hole Roughness Factor");
|
||||
}
|
||||
else if (completionType == RigCompletionData::PERFORATION_ICD)
|
||||
{
|
||||
formatter.comment("Perforation valve segments");
|
||||
formatter.comment("Diam: MSW - Tubing Radius");
|
||||
formatter.comment("Rough: MSW - Open Hole Roughness Factor");
|
||||
}
|
||||
@ -799,7 +809,8 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(RifEclips
|
||||
*/
|
||||
|
||||
{
|
||||
std::set<RigCompletionData::CompletionType> fishbonesTypes = {RigCompletionData::ICD, RigCompletionData::FISHBONES};
|
||||
std::set<RigCompletionData::CompletionType> fishbonesTypes = {RigCompletionData::FISHBONES_ICD,
|
||||
RigCompletionData::FISHBONES};
|
||||
generateCompsegTable(formatter, exportInfo, false, fishbonesTypes);
|
||||
if (exportInfo.hasSubGridIntersections())
|
||||
{
|
||||
@ -817,11 +828,12 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(RifEclips
|
||||
}
|
||||
|
||||
{
|
||||
std::set<RigCompletionData::CompletionType> completionTypes = {RigCompletionData::PERFORATION};
|
||||
generateCompsegTable(formatter, exportInfo, false, completionTypes);
|
||||
std::set<RigCompletionData::CompletionType> perforationTypes = {RigCompletionData::PERFORATION,
|
||||
RigCompletionData::PERFORATION_ICD};
|
||||
generateCompsegTable(formatter, exportInfo, false, perforationTypes);
|
||||
if (exportInfo.hasSubGridIntersections())
|
||||
{
|
||||
generateCompsegTable(formatter, exportInfo, true, completionTypes);
|
||||
generateCompsegTable(formatter, exportInfo, true, perforationTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -843,7 +855,7 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegTable(
|
||||
|
||||
for (const RicMswCompletion& completion : location.completions())
|
||||
{
|
||||
if (exportCompletionTypes.count(completion.completionType()))
|
||||
if (!completion.subSegments().empty() && exportCompletionTypes.count(completion.completionType()))
|
||||
{
|
||||
if (!generatedHeader)
|
||||
{
|
||||
@ -853,7 +865,8 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegTable(
|
||||
|
||||
for (const RicMswSubSegment& segment : completion.subSegments())
|
||||
{
|
||||
if (completion.completionType() == RigCompletionData::ICD)
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD ||
|
||||
completion.completionType() == RigCompletionData::PERFORATION_ICD)
|
||||
{
|
||||
startMD = segment.startMD();
|
||||
}
|
||||
@ -910,10 +923,14 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegHeader(RifEclips
|
||||
formatter.keyword("COMPSEGS");
|
||||
}
|
||||
|
||||
if (completionType == RigCompletionData::ICD)
|
||||
if (completionType == RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
formatter.comment("Fishbones");
|
||||
}
|
||||
else if (completionType == RigCompletionData::PERFORATION_ICD)
|
||||
{
|
||||
formatter.comment("Perforation valves");
|
||||
}
|
||||
else if (completionType == RigCompletionData::FRACTURE)
|
||||
{
|
||||
formatter.comment("Fractures");
|
||||
@ -953,32 +970,56 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegHeader(RifEclips
|
||||
void RicWellPathExportCompletionDataFeatureImpl::generateWsegvalvTable(RifEclipseDataTableFormatter& formatter,
|
||||
const RicMswExportInfo& exportInfo)
|
||||
{
|
||||
{
|
||||
formatter.keyword("WSEGVALV");
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well Name"),
|
||||
RifEclipseOutputTableColumn("Seg No"),
|
||||
RifEclipseOutputTableColumn("Cv"),
|
||||
RifEclipseOutputTableColumn("Ac"),
|
||||
};
|
||||
formatter.header(header);
|
||||
}
|
||||
bool foundValve = false;
|
||||
|
||||
for (const RicMswSegment& location : exportInfo.wellSegmentLocations())
|
||||
{
|
||||
for (const RicMswCompletion& completion : location.completions())
|
||||
{
|
||||
if (completion.completionType() == RigCompletionData::ICD)
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD ||
|
||||
completion.completionType() == RigCompletionData::PERFORATION_ICD)
|
||||
{
|
||||
CVF_ASSERT(completion.subSegments().size() == 1u);
|
||||
formatter.add(exportInfo.wellPath()->name());
|
||||
formatter.add(completion.subSegments().front().segmentNumber());
|
||||
formatter.add(location.icdFlowCoefficient());
|
||||
formatter.add(location.icdArea());
|
||||
formatter.rowCompleted();
|
||||
if (!foundValve)
|
||||
{
|
||||
formatter.keyword("WSEGVALV");
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well Name"),
|
||||
RifEclipseOutputTableColumn("Seg No"),
|
||||
RifEclipseOutputTableColumn("Cv"),
|
||||
RifEclipseOutputTableColumn("Ac"),
|
||||
};
|
||||
formatter.header(header);
|
||||
|
||||
foundValve = true;
|
||||
}
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
if (!completion.subSegments().empty())
|
||||
{
|
||||
CVF_ASSERT(completion.subSegments().size() == 1u);
|
||||
formatter.add(exportInfo.wellPath()->name());
|
||||
formatter.add(completion.subSegments().front().segmentNumber());
|
||||
formatter.add(location.icdFlowCoefficient());
|
||||
formatter.add(location.icdArea());
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formatter.comment(completion.label());
|
||||
formatter.add(exportInfo.wellPath()->name());
|
||||
formatter.add(location.segmentNumber());
|
||||
formatter.add(location.icdFlowCoefficient());
|
||||
formatter.add(QString("%1").arg(location.icdArea(), 8, 'f', 6));
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
formatter.tableCompleted();
|
||||
if (foundValve)
|
||||
{
|
||||
formatter.tableCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@ -990,6 +1031,11 @@ RigCompletionData
|
||||
{
|
||||
CVF_ASSERT(!completions.empty());
|
||||
|
||||
if (completions.size() == 1)
|
||||
{
|
||||
return completions[0];
|
||||
}
|
||||
|
||||
const RigCompletionData& firstCompletion = completions[0];
|
||||
|
||||
const QString& wellName = firstCompletion.wellName();
|
||||
@ -998,6 +1044,7 @@ RigCompletionData
|
||||
|
||||
RigCompletionData resultCompletion(wellName, cellIndexIJK, firstCompletion.firstOrderingValue());
|
||||
resultCompletion.setSecondOrderingValue(firstCompletion.secondOrderingValue());
|
||||
resultCompletion.setSourcePdmObject(firstCompletion.sourcePdmObject());
|
||||
|
||||
bool anyNonDarcyFlowPresent = false;
|
||||
for (const auto& c : completions)
|
||||
@ -1803,7 +1850,7 @@ RicMswExportInfo RicWellPathExportCompletionDataFeatureImpl::generateFishbonesMs
|
||||
if (ssi == 0)
|
||||
{
|
||||
// Add completion for ICD
|
||||
RicMswCompletion icdCompletion(RigCompletionData::ICD, QString("ICD"));
|
||||
RicMswCompletion icdCompletion(RigCompletionData::FISHBONES_ICD, QString("ICD"));
|
||||
RicMswSubSegment icdSegment(subEndMD, 0.1, subEndTVD, 0.0);
|
||||
icdCompletion.addSubSegment(icdSegment);
|
||||
location.addCompletion(icdCompletion);
|
||||
@ -2015,10 +2062,14 @@ RicMswExportInfo RicWellPathExportCompletionDataFeatureImpl::generatePerforation
|
||||
|
||||
size_t i = 0u, j = 0u, k = 0u;
|
||||
localGrid->ijkFromCellIndex(localGridIdx, &i, &j, &k);
|
||||
QString label = QString("Main stem segment %1").arg(++mainBoreSegment);
|
||||
QString label = QString("Main stem segment %1").arg(++mainBoreSegment);
|
||||
|
||||
RicMswSegment location(label, cellIntInfo.startMD, cellIntInfo.endMD, startTVD, endTVD);
|
||||
|
||||
// Check if fractures are to be assigned to current main bore segment
|
||||
int nICDs = 0, nICVs = 0;
|
||||
double totalIcdArea = 0.0;
|
||||
RiaWeightedMeanCalculator<double> coeffMeanCalc;
|
||||
|
||||
for (const RimPerforationInterval* interval : perforationIntervals)
|
||||
{
|
||||
double intervalStartMD = interval->startMD();
|
||||
@ -2026,14 +2077,79 @@ RicMswExportInfo RicWellPathExportCompletionDataFeatureImpl::generatePerforation
|
||||
|
||||
if (cellIntInfo.endMD > intervalStartMD && cellIntInfo.startMD < intervalEndMD)
|
||||
{
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
interval->descendantsIncludingThisOfType(perforationValves);
|
||||
for (const RimWellPathValve* valve : perforationValves)
|
||||
{
|
||||
if (!valve->isChecked()) continue;
|
||||
|
||||
for (const std::pair<double, double>& segment : valve->segmentsBetweenValves())
|
||||
{
|
||||
double segmentLength = segment.second - segment.first;
|
||||
double overlapStart = std::max(segment.first, cellIntInfo.startMD);
|
||||
double overlapEnd = std::min(segment.second, cellIntInfo.endMD);
|
||||
double overlap = std::max(0.0, overlapEnd - overlapStart);
|
||||
|
||||
if (overlap > 0.0)
|
||||
{
|
||||
cvf::Vec3d segStartPoint = wellPathGeometry->interpolatedPointAlongWellPath(overlapStart);
|
||||
cvf::Vec3d segEndPoint = wellPathGeometry->interpolatedPointAlongWellPath(overlapEnd);
|
||||
|
||||
if (valve->componentType() == RiaDefines::ICV || valve->componentType() == RiaDefines::ICD)
|
||||
{
|
||||
if (valve->componentType() == RiaDefines::ICV)
|
||||
nICVs++;
|
||||
else
|
||||
nICDs++;
|
||||
double icdOrificeRadius = valve->orificeDiameter(unitSystem) / 2;
|
||||
double icdArea = icdOrificeRadius * icdOrificeRadius * cvf::PI_D * overlap / segmentLength;
|
||||
totalIcdArea += icdArea;
|
||||
coeffMeanCalc.addValueAndWeight(valve->flowCoefficient(), icdArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RigCompletionData> completionData =
|
||||
generatePerforationsCompdatValues(wellPath, {interval}, exportSettings);
|
||||
assignPerforationIntervalIntersections(
|
||||
caseToApply, interval, completionData, &location, &cellIntInfo, &foundSubGridIntersections);
|
||||
if (std::fabs(location.endMD() - location.startMD()) > 1.0e-8)
|
||||
{
|
||||
assignPerforationIntervalIntersections(
|
||||
caseToApply, interval, completionData, &location, &cellIntInfo, &foundSubGridIntersections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exportInfo.addWellSegmentLocation(location);
|
||||
if (totalIcdArea > 0.0)
|
||||
{
|
||||
location.setIcdArea(totalIcdArea);
|
||||
if (coeffMeanCalc.validAggregatedWeight())
|
||||
{
|
||||
location.setIcdFlowCoefficient(coeffMeanCalc.weightedMean());
|
||||
}
|
||||
QStringList valveLabelComponents;
|
||||
if (nICDs)
|
||||
{
|
||||
valveLabelComponents += QString("%1 ICDs").arg(nICDs);
|
||||
}
|
||||
if (nICVs)
|
||||
{
|
||||
valveLabelComponents += QString("%1 ICVs").arg(nICVs);
|
||||
}
|
||||
QString valveLabel;
|
||||
if (!valveLabelComponents.isEmpty())
|
||||
{
|
||||
valveLabel += QString("Contribution from %1").arg(valveLabelComponents.join(" and "));
|
||||
}
|
||||
|
||||
RicMswCompletion valveCompletion(RigCompletionData::PERFORATION_ICD, valveLabel);
|
||||
location.addCompletion(valveCompletion);
|
||||
}
|
||||
|
||||
if (std::fabs(location.endMD() - location.startMD()) > 1.0e-8)
|
||||
{
|
||||
exportInfo.addWellSegmentLocation(location);
|
||||
}
|
||||
}
|
||||
exportInfo.setHasSubGridIntersections(foundSubGridIntersections);
|
||||
exportInfo.sortLocations();
|
||||
@ -2209,7 +2325,7 @@ void RicWellPathExportCompletionDataFeatureImpl::assignBranchAndSegmentNumbers(c
|
||||
{
|
||||
completion.setBranchNumber(1);
|
||||
}
|
||||
else if (completion.completionType() != RigCompletionData::ICD)
|
||||
else if (completion.completionType() != RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
++(*branchNum);
|
||||
completion.setBranchNumber(*branchNum);
|
||||
@ -2223,7 +2339,7 @@ void RicWellPathExportCompletionDataFeatureImpl::assignBranchAndSegmentNumbers(c
|
||||
|
||||
for (auto& subSegment : completion.subSegments())
|
||||
{
|
||||
if (completion.completionType() == RigCompletionData::ICD)
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
subSegment.setSegmentNumber(location->segmentNumber() + 1);
|
||||
icdSegmentNumber = subSegment.segmentNumber();
|
||||
@ -2254,10 +2370,13 @@ void RicWellPathExportCompletionDataFeatureImpl::assignBranchAndSegmentNumbers(c
|
||||
location.setSegmentNumber(++segmentNumber);
|
||||
for (RicMswCompletion& completion : location.completions())
|
||||
{
|
||||
if (completion.completionType() == RigCompletionData::ICD)
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
++segmentNumber; // Skip a segment number because we need one for the ICD
|
||||
completion.setBranchNumber(++branchNumber);
|
||||
if (completion.completionType() == RigCompletionData::FISHBONES_ICD)
|
||||
{
|
||||
completion.setBranchNumber(++branchNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2650,6 +2769,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(
|
||||
RifEclipseDataTableFormatter formatter(stream);
|
||||
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
|
||||
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo);
|
||||
RicWellPathExportCompletionDataFeatureImpl::generateWsegvalvTable(formatter, exportInfo);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -2669,6 +2789,23 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCarfinForTemporaryLgrs(co
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathExportCompletionDataFeatureImpl::isCompletionWellPathEqual(const RigCompletionData& completion,
|
||||
const RimWellPath* wellPath)
|
||||
{
|
||||
if (!wellPath) return false;
|
||||
|
||||
RimWellPath* parentWellPath = nullptr;
|
||||
if (completion.sourcePdmObject())
|
||||
{
|
||||
completion.sourcePdmObject()->firstAncestorOrThisOfType(parentWellPath);
|
||||
}
|
||||
|
||||
return (parentWellPath == wellPath);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal function
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -290,4 +290,5 @@ private:
|
||||
|
||||
static void exportCarfinForTemporaryLgrs(const RimEclipseCase* sourceCase, const QString& folder);
|
||||
|
||||
static bool isCompletionWellPathEqual(const RigCompletionData& completion, const RimWellPath* wellPath);
|
||||
};
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
@ -124,7 +124,7 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo()
|
||||
|
||||
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
|
||||
|
||||
RiuSelectionManager::instance()->deleteAllItems();
|
||||
Riu3dSelectionManager::instance()->deleteAllItems();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(intersection);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
@ -114,7 +114,7 @@ void RicNewPolylineIntersectionFeatureCmd::redo()
|
||||
|
||||
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
|
||||
|
||||
RiuSelectionManager::instance()->deleteAllItems();
|
||||
Riu3dSelectionManager::instance()->deleteAllItems();
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem(intersection);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "RimStimPlanColors.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@ -57,8 +57,8 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuSimWellSelectionItem* simWellItem = static_cast<RiuSimWellSelectionItem*>(selItem);
|
||||
if (!simWellItem) return;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -40,8 +40,8 @@ void RicNewWellPathFractureAtPosFeature::onActionTriggered(bool isChecked)
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (proj->allFractureTemplates().empty()) return;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>(selItem);
|
||||
if (!wellPathItem) return;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "RimIntersection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
@ -102,8 +102,8 @@ std::set<RimIntersection*> RicNewIntersectionViewFeature::selectedIntersections(
|
||||
{
|
||||
std::set<RimIntersection*> objects;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>(selItem);
|
||||
if (generalSelectionItem)
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "RimWellPathCompletions.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
|
@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicCreateUserDefinedPolylinesAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateUserDefinedPolylinesAnnotationFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
return selObjs.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimUserDefinedPolylinesAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateUserDefinedPolylinesAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("Create User Defined Polyline Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicCreateUserDefinedPolylinesAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
@ -24,6 +24,8 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
@ -300,6 +302,24 @@ void RicDeleteItemExec::redo()
|
||||
ensembleCurveFilterColl->firstAncestorOrThisOfType(plot);
|
||||
if (plot) plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
{
|
||||
RimAnnotationCollection* annotationColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType(annotationColl);
|
||||
if (annotationColl)
|
||||
{
|
||||
annotationColl->onAnnotationDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RimAnnotationInViewCollection* annotationColl = nullptr;
|
||||
parentObj->firstAncestorOrThisOfType(annotationColl);
|
||||
if (annotationColl)
|
||||
{
|
||||
annotationColl->onAnnotationDeleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,8 @@
|
||||
#include "RimWellLogRftCurve.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimLineBasedAnnotation.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
#include "RimSimWellFracture.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
@ -125,7 +126,8 @@ bool isDeletable(caf::PdmUiItem* uiItem)
|
||||
if (dynamic_cast<RimEnsembleCurveFilter*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimDerivedEnsembleCaseCollection*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimWellPathValve*>(uiItem)) return true;
|
||||
|
||||
if (dynamic_cast<RimTextAnnotation*>(uiItem)) return true;
|
||||
if (dynamic_cast<RimLineBasedAnnotation*>(uiItem)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -37,8 +37,8 @@ bool RicHideIntersectionBoxFeature::isCommandEnabled()
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return false;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>(selItem);
|
||||
if (!generalSelectionItem) return false;
|
||||
@ -59,8 +59,8 @@ void RicHideIntersectionBoxFeature::onActionTriggered(bool isChecked)
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>(selItem);
|
||||
if (!generalSelectionItem) return;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "RimIntersection.h"
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -37,8 +37,8 @@ bool RicHideIntersectionFeature::isCommandEnabled()
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return false;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>(selItem);
|
||||
if (!generalSelectionItem) return false;
|
||||
@ -59,8 +59,8 @@ void RicHideIntersectionFeature::onActionTriggered(bool isChecked)
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>(selItem);
|
||||
if (!generalSelectionItem) return;
|
||||
|
149
ApplicationCode/Commands/RicNewAnnotationFeature.cpp
Normal file
149
ApplicationCode/Commands/RicNewAnnotationFeature.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicNewAnnotationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <cafSelectionManagerTools.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewAnnotationFeature, "RicNewAnnotationFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicNewTextAnnotationFeature, "RicNewTextAnnotationFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicNewReachCircleAnnotationFeature, "RicNewReachCircleAnnotationFeature");
|
||||
CAF_CMD_SOURCE_INIT(RicNewPolylineAnnotationFeature, "RicNewPolygonAnnotationFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewAnnotationFeature::isCommandEnabled()
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
return selObjs.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("(Not valid)");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection* RicNewAnnotationFeature::annotationCollection() const
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
auto oilField = project->activeOilField();
|
||||
return oilField ? oilField->annotationCollection() : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewTextAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewTextAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("New Text Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewReachCircleAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimReachCircleAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewReachCircleAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("New Reach Circle Annotation");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineAnnotationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (coll)
|
||||
{
|
||||
auto newAnnotation = new RimUserDefinedPolyLinesAnnotation();
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPolylineAnnotationFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/Plus.png"));
|
||||
actionToSetup->setText("New Polyline Annotation");
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "RifReaderEclipseRft.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSimWellInView* RicWellLogTools::selectedSimulationWell(int *branchIndex)
|
||||
{
|
||||
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
|
||||
if (simWellSelItem)
|
||||
{
|
||||
@ -93,8 +93,8 @@ bool RicWellLogTools::wellHasRftData(const QString& wellName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellLogTools::isWellPathOrSimWellSelectedInView()
|
||||
{
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RiuSimWellSelectionItem* simWellSelectionItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
|
||||
if (simWellSelectionItem) return true;
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafPdmReferenceHelper.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
@ -206,7 +206,7 @@ bool RicNewGridTimeHistoryCurveFeature::isCommandEnabled()
|
||||
if (RicWellLogTools::isWellPathOrSimWellSelectedInView()) return false;
|
||||
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->selectedItems(items);
|
||||
Riu3dSelectionManager::instance()->selectedItems(items);
|
||||
|
||||
if (items.size() > 0)
|
||||
{
|
||||
@ -234,7 +234,7 @@ void RicNewGridTimeHistoryCurveFeature::onActionTriggered(bool isChecked)
|
||||
if (!summaryPlot) return;
|
||||
|
||||
std::vector<RiuSelectionItem*> items;
|
||||
RiuSelectionManager::instance()->selectedItems(items);
|
||||
Riu3dSelectionManager::instance()->selectedItems(items);
|
||||
CVF_ASSERT(items.size() > 0);
|
||||
|
||||
for (auto item : items)
|
||||
|
@ -123,7 +123,11 @@ QWidget* RicSummaryCurveCalculatorEditor::createWidget(QWidget* parent)
|
||||
m_pdmTableView->enableHeaderText(false);
|
||||
|
||||
QHeaderView* verticalHeader = m_pdmTableView->tableView()->verticalHeader();
|
||||
#if QT_VERSION >= 0x050000
|
||||
verticalHeader->setSectionResizeMode(QHeaderView::Interactive);
|
||||
#else
|
||||
verticalHeader->setResizeMode(QHeaderView::Interactive);
|
||||
#endif
|
||||
|
||||
m_pdmTableView->tableView()->resizeColumnsToContents();
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "RimEclipseResultCase.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
@ -152,7 +152,7 @@ RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex) const
|
||||
{
|
||||
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
|
||||
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
|
||||
if (simWellSelItem)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
|
@ -16,6 +16,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateWellTargetsPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionPickEventHandler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFormationsImportFileFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellPathGeometry3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -35,6 +38,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateWellTargetsPickEventHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicIntersectionPickEventHandler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFormationsImportFileFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellPathGeometry3dEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulatorPartMgr.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
@ -47,6 +53,9 @@ ${SOURCE_GROUP_SOURCE_FILES}
|
||||
|
||||
list(APPEND QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellPathGeometry3dEditor.h
|
||||
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\WellPath" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
@ -19,7 +19,11 @@
|
||||
|
||||
#include "RicPointTangentManipulator.h"
|
||||
|
||||
#include "RicPointTangentManipulatorPartMgr.h"
|
||||
#include "RivPartPriority.h"
|
||||
|
||||
#include "cafViewer.h"
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
@ -30,9 +34,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
#include "RivPartPriority.h"
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -158,757 +159,3 @@ bool RicPointTangentManipulator::eventFilter(QObject *obj, QEvent* inputEvent)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
|
||||
#include "RicPointTangentManipulator.h"
|
||||
|
||||
#include "cafBoxManipulatorGeometryGenerator.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafLine.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfBoxGenerator.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfGeometryBuilderFaceList.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfPrimitiveSetIndexedUShort.h"
|
||||
#include "cvfRay.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfHitItem.h"
|
||||
#include <QDebug>
|
||||
|
||||
#include "cvfGeometryBuilderTriangles.h"
|
||||
#include "cvfGeometryUtils.h"
|
||||
//
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPointTangentManipulatorPartMgr::RicPointTangentManipulatorPartMgr()
|
||||
: m_tangentOnStartManipulation(cvf::Vec3d::UNDEFINED),
|
||||
m_originOnStartManipulation(cvf::Vec3d::UNDEFINED),
|
||||
m_currentHandleIndex(cvf::UNDEFINED_SIZE_T),
|
||||
m_handleSize(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPointTangentManipulatorPartMgr::~RicPointTangentManipulatorPartMgr()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setOrigin(const cvf::Vec3d& origin)
|
||||
{
|
||||
if (isManipulatorActive()) return;
|
||||
|
||||
m_origin = origin;
|
||||
if (m_originOnStartManipulation.isUndefined()) m_originOnStartManipulation = origin;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setTangent(const cvf::Vec3d& tangent)
|
||||
{
|
||||
if(isManipulatorActive()) return;
|
||||
|
||||
m_tangent = tangent;
|
||||
if (m_tangentOnStartManipulation.isUndefined()) m_tangentOnStartManipulation = m_tangent;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setHandleSize(double handleSize)
|
||||
{
|
||||
m_handleSize = handleSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::originAndTangent(cvf::Vec3d* origin, cvf::Vec3d* tangent)
|
||||
{
|
||||
*origin = m_origin;
|
||||
*tangent = m_tangent;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPointTangentManipulatorPartMgr::isManipulatorActive() const
|
||||
{
|
||||
return m_currentHandleIndex != cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
|
||||
{
|
||||
if (!m_handleParts.size())
|
||||
{
|
||||
recreateAllGeometryAndParts();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_handleParts.size(); i++)
|
||||
{
|
||||
model->addPart(m_handleParts.at(i));
|
||||
}
|
||||
|
||||
for (auto activeModePart: m_activeDragModeParts)
|
||||
{
|
||||
model->addPart(activeModePart.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::tryToActivateManipulator(const cvf::HitItem* hitItem)
|
||||
{
|
||||
endManipulator();
|
||||
|
||||
if (!hitItem) return;
|
||||
|
||||
const cvf::Part* pickedPart = hitItem->part();
|
||||
const cvf::Vec3d intersectionPoint = hitItem->intersectionPoint();
|
||||
|
||||
if (!pickedPart) return;
|
||||
|
||||
for (size_t i = 0; i < m_handleParts.size(); i++)
|
||||
{
|
||||
if (pickedPart == m_handleParts.at(i))
|
||||
{
|
||||
m_initialPickPoint = intersectionPoint;
|
||||
m_tangentOnStartManipulation = m_tangent;
|
||||
m_originOnStartManipulation = m_origin;
|
||||
m_currentHandleIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Calculate new origin and tangent based on the new ray position
|
||||
/// Clear geometry to trigger regeneration
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay(const cvf::Ray* newMouseRay)
|
||||
{
|
||||
if (!isManipulatorActive()) return;
|
||||
|
||||
if ( m_handleIds[m_currentHandleIndex] == HORIZONTAL_PLANE )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
plane.setFromPointAndNormal(m_origin, cvf::Vec3d::Z_AXIS);
|
||||
cvf::Vec3d newIntersection;
|
||||
newMouseRay->planeIntersect(plane, &newIntersection);
|
||||
|
||||
cvf::Vec3d newOrigin = m_originOnStartManipulation + (newIntersection - m_initialPickPoint);
|
||||
|
||||
m_origin = newOrigin;
|
||||
}
|
||||
else if ( m_handleIds[m_currentHandleIndex] == VERTICAL_AXIS )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
cvf::Vec3d planeNormal = (newMouseRay->direction() ^ cvf::Vec3d::Z_AXIS) ^ cvf::Vec3d::Z_AXIS;
|
||||
double length = planeNormal.length();
|
||||
|
||||
if (length < 1e-5) return;
|
||||
|
||||
planeNormal /= length;
|
||||
plane.setFromPointAndNormal(m_initialPickPoint, planeNormal );
|
||||
cvf::Vec3d newIntersection;
|
||||
newMouseRay->planeIntersect(plane, &newIntersection);
|
||||
|
||||
cvf::Vec3d newOrigin = m_originOnStartManipulation;
|
||||
newOrigin.z() += (newIntersection.z() - m_initialPickPoint.z());
|
||||
|
||||
m_origin = newOrigin;
|
||||
}
|
||||
//m_tangent = newTangent;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::endManipulator()
|
||||
{
|
||||
m_currentHandleIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::clearAllGeometryAndParts()
|
||||
{
|
||||
m_handleIds.clear();
|
||||
m_handleParts.clear();
|
||||
m_activeDragModeParts.clear();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
||||
{
|
||||
createAllHandleParts();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createAllHandleParts()
|
||||
{
|
||||
createHorizontalPlaneHandle();
|
||||
createVerticalAxisHandle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createHorizontalPlaneHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(6);
|
||||
|
||||
vertexArray->set(0, {-1, -1, 0} );
|
||||
vertexArray->set(1, { 1, -1, 0});
|
||||
vertexArray->set(2, { 1, 1, 0});
|
||||
vertexArray->set(3, {-1, -1, 0});
|
||||
vertexArray->set(4, { 1, 1, 0});
|
||||
vertexArray->set(5, {-1, 1, 0});
|
||||
|
||||
Vec3f origin(m_origin);
|
||||
for (cvf::Vec3f& vx: *vertexArray)
|
||||
{
|
||||
vx *= 0.5*m_handleSize;
|
||||
vx += origin;
|
||||
}
|
||||
|
||||
ref<DrawableGeo> geo = createTriangelDrawableGeo(vertexArray.p());
|
||||
|
||||
HandleType handleId = HORIZONTAL_PLANE;
|
||||
cvf::Color4f color = cvf::Color4f(1.0f, 0.0f, 1.0f, 0.5f);
|
||||
cvf::String partName("PointTangentManipulator Horizontal Plane Handle");
|
||||
|
||||
addHandlePart(geo.p(), color, handleId, partName);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
|
||||
cvf::ref< cvf::GeometryBuilderTriangles> geomBuilder = new cvf::GeometryBuilderTriangles;
|
||||
cvf::GeometryUtils::createBox({-0.3f, -0.3f, -1.0f}, { 0.3f, 0.3f, 1.0f}, geomBuilder.p());
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = geomBuilder->vertices();
|
||||
cvf::ref<cvf::UIntArray> indexArray = geomBuilder->triangles();
|
||||
|
||||
Vec3f origin(m_origin);
|
||||
for (cvf::Vec3f& vx: *vertexArray)
|
||||
{
|
||||
vx *= 0.5*m_handleSize;
|
||||
vx += origin;
|
||||
}
|
||||
|
||||
ref<DrawableGeo> geo = createIndexedTriangelDrawableGeo(vertexArray.p(), indexArray.p());
|
||||
|
||||
HandleType handleId = VERTICAL_AXIS;
|
||||
cvf::Color4f color = cvf::Color4f(0.0f, 0.2f, 0.8f, 0.5f);
|
||||
cvf::String partName("PointTangentManipulator Vertical Axis Handle");
|
||||
|
||||
addHandlePart(geo.p(), color, handleId, partName);
|
||||
}
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createAzimuthHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
|
||||
cvf::ref< cvf::GeometryBuilderTriangles> geomBuilder = new cvf::GeometryBuilderTriangles;
|
||||
cvf::GeometryUtils::createDisc(1.3, 1.1, 16, geomBuilder.p());
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = geomBuilder->vertices();
|
||||
cvf::ref<cvf::UIntArray> indexArray = geomBuilder->triangles();
|
||||
|
||||
Vec3f origin(m_origin);
|
||||
for (cvf::Vec3f& vx: *vertexArray)
|
||||
{
|
||||
vx *= 0.5*m_handleSize;
|
||||
vx += origin;
|
||||
}
|
||||
|
||||
ref<DrawableGeo> geo = createIndexedTriangelDrawableGeo(vertexArray.p(), indexArray.p());
|
||||
|
||||
HandleType handleId = AZIMUTH;
|
||||
cvf::Color4f color = cvf::Color4f(0.0f, 0.2f, 0.8f, 0.5f);
|
||||
cvf::String partName("PointTangentManipulator Azimuth Handle");
|
||||
|
||||
addHandlePart(geo.p(), color, handleId, partName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createIndexedTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray,
|
||||
cvf::UIntArray* triangleIndices)
|
||||
{
|
||||
using namespace cvf;
|
||||
ref<DrawableGeo> geo = new DrawableGeo;
|
||||
ref<PrimitiveSetIndexedUInt> primSet = new PrimitiveSetIndexedUInt(PT_TRIANGLES, triangleIndices);
|
||||
|
||||
geo->setVertexArray(triangleVertexArray);
|
||||
geo->addPrimitiveSet(primSet.p());
|
||||
geo->computeNormals();
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray)
|
||||
{
|
||||
using namespace cvf;
|
||||
ref<DrawableGeo> geo = new DrawableGeo;
|
||||
|
||||
geo->setVertexArray(triangleVertexArray);
|
||||
ref<cvf::PrimitiveSetDirect> primSet = new cvf::PrimitiveSetDirect(cvf::PT_TRIANGLES);
|
||||
primSet->setIndexCount(triangleVertexArray->size());
|
||||
|
||||
geo->addPrimitiveSet(primSet.p());
|
||||
geo->computeNormals();
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::addHandlePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName)
|
||||
{
|
||||
cvf::ref<cvf::Part> handlePart = createPart(geo, color, partName);
|
||||
|
||||
m_handleParts.push_back(handlePart.p());
|
||||
m_handleIds.push_back(handleId);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::addActiveModePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName)
|
||||
{
|
||||
cvf::ref<cvf::Part> handlePart = createPart(geo, color, partName);
|
||||
|
||||
m_activeDragModeParts.push_back(handlePart.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RicPointTangentManipulatorPartMgr::createPart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
const cvf::String& partName)
|
||||
{
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName(partName);
|
||||
part->setDrawable(geo);
|
||||
part->updateBoundingBox();
|
||||
|
||||
caf::SurfaceEffectGenerator surfaceGen(color, caf::PO_1);
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
part->setEffect(eff.p());
|
||||
if (color.a() < 1.0) part->setPriority(RivPartPriority::Transparent);
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
namespace caf
|
||||
{
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUi3dObjectEditorHandle::PdmUi3dObjectEditorHandle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUi3dObjectEditorHandle::~PdmUi3dObjectEditorHandle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUi3dObjectEditorHandle::setViewer(caf::Viewer* ownerViewer)
|
||||
{
|
||||
// Not allowed to change viewer. Should be constructor argument, but makes factory stuff difficult.
|
||||
CAF_ASSERT(m_ownerViewer.isNull());
|
||||
m_ownerViewer = ownerViewer;
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiSelectionVisualizer3d::PdmUiSelectionVisualizer3d(caf::Viewer* ownerViewer)
|
||||
: m_ownerViewer(ownerViewer)
|
||||
{
|
||||
this->setParent(ownerViewer); // Makes this owned by the viewer.
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiSelectionVisualizer3d::~PdmUiSelectionVisualizer3d()
|
||||
{
|
||||
for (auto editor: m_active3DEditors)
|
||||
{
|
||||
delete editor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiSelectionVisualizer3d::updateVisibleEditors()
|
||||
{
|
||||
for (auto editor: m_active3DEditors)
|
||||
{
|
||||
if (editor) editor->updateUi();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiSelectionVisualizer3d::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
|
||||
{
|
||||
if (!changedSelectionLevels.count(0)) return;
|
||||
|
||||
for (auto editor: m_active3DEditors)
|
||||
{
|
||||
delete editor;
|
||||
}
|
||||
|
||||
m_active3DEditors.clear();
|
||||
|
||||
if (!m_ownerViewer) return;
|
||||
|
||||
// Todo: How do we deduce the editor from the selected object ?
|
||||
// Alt 1: Register the rim object type name as key in the factory as well
|
||||
// Alt 2: Set the editor type name as PdmUiItem::setUiEditorTypeName
|
||||
// Alt 3: Use a specific config-name in alt 2.
|
||||
// Alt 4: Introduce a PdmUiItem::editorTypeName3d
|
||||
|
||||
std::vector<RimWellPathGeometryDef*> wellPathGeomDefs;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPathGeomDefs);
|
||||
|
||||
for (auto geomDef: wellPathGeomDefs)
|
||||
{
|
||||
auto editor = new RicWellPathGeometry3dEditor();
|
||||
editor->setViewer(m_ownerViewer);
|
||||
editor->setPdmObject(geomDef);
|
||||
m_active3DEditors.push_back(editor);
|
||||
editor->updateUi();
|
||||
}
|
||||
m_ownerViewer->update();
|
||||
}
|
||||
|
||||
} // caf
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
#include "RimWellPathTarget.h"
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicWellPathGeometry3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellPathGeometry3dEditor::RicWellPathGeometry3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellPathGeometry3dEditor::~RicWellPathGeometry3dEditor()
|
||||
{
|
||||
for (auto targetEditor: m_targetEditors)
|
||||
{
|
||||
delete targetEditor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathGeometry3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
RimWellPathGeometryDef* geomDef = dynamic_cast<RimWellPathGeometryDef*>(this->pdmObject());
|
||||
|
||||
for (auto targetEditor: m_targetEditors)
|
||||
{
|
||||
delete targetEditor;
|
||||
}
|
||||
m_targetEditors.clear();
|
||||
|
||||
if (!geomDef) return;
|
||||
|
||||
|
||||
std::vector<RimWellPathTarget*> targets = geomDef->activeWellTargets();
|
||||
|
||||
for (auto target: targets)
|
||||
{
|
||||
auto targetEditor = new RicWellTarget3dEditor;
|
||||
targetEditor->setViewer(m_ownerViewer);
|
||||
targetEditor->setPdmObject(target);
|
||||
m_targetEditors.push_back(targetEditor);
|
||||
targetEditor->updateUi();
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
#include "RimWellPathTarget.h"
|
||||
#include "RiuViewer.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicWellTarget3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellTarget3dEditor::RicWellTarget3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellTarget3dEditor::~RicWellTarget3dEditor()
|
||||
{
|
||||
if (m_cvfModel.notNull() && m_ownerViewer)
|
||||
{
|
||||
// Could result in some circularities ....
|
||||
m_ownerViewer->removeStaticModel(m_cvfModel.p());
|
||||
}
|
||||
|
||||
RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if (oldTarget)
|
||||
{
|
||||
oldTarget->m_targetType.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_azimuth.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_inclination.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
|
||||
delete m_manipulator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
|
||||
if ( !target || !target->isEnabled())
|
||||
{
|
||||
m_cvfModel->removeAllParts();
|
||||
return;
|
||||
}
|
||||
|
||||
RimWellPathGeometryDef* geomDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted(geomDef);
|
||||
|
||||
target->m_targetType.uiCapability()->addFieldEditor(this);
|
||||
target->m_targetPoint.uiCapability()->addFieldEditor(this);
|
||||
target->m_azimuth.uiCapability()->addFieldEditor(this);
|
||||
target->m_inclination.uiCapability()->addFieldEditor(this);
|
||||
|
||||
if (m_manipulator.isNull())
|
||||
{
|
||||
m_manipulator = new RicPointTangentManipulator(m_ownerViewer);
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifySelected() ),
|
||||
this,
|
||||
SLOT( slotSelectedIn3D() ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifyDragFinished() ),
|
||||
this,
|
||||
SLOT( slotDragFinished() ) );
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
m_ownerViewer->addStaticModelOnce(m_cvfModel.p());
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
double handleSize = 1.0;
|
||||
{
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>(m_ownerViewer.data());
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>(viewer->ownerReservoirView());
|
||||
handleSize = 0.7 * view->ownerCase()->characteristicCellSize();
|
||||
}
|
||||
|
||||
m_manipulator->setOrigin(dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePointXyz()));
|
||||
m_manipulator->setTangent(target->tangent());
|
||||
m_manipulator->setHandleSize(handleSize);
|
||||
m_cvfModel->removeAllParts();
|
||||
m_manipulator->appendPartsToModel(m_cvfModel.p());
|
||||
|
||||
m_cvfModel->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::cleanupBeforeSettingPdmObject()
|
||||
{
|
||||
RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if (oldTarget)
|
||||
{
|
||||
oldTarget->m_targetType.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_azimuth.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_inclination.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent)
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
{
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>(m_ownerViewer.data());
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
}
|
||||
|
||||
RimWellPathGeometryDef* geomDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted(geomDef);
|
||||
|
||||
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin) - geomDef->referencePointXyz();
|
||||
domainOrigin.z() = -domainOrigin.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainOrigin);
|
||||
|
||||
target->enableFullUpdate(false);
|
||||
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField(target->m_targetPoint.uiCapability(), originVariant);
|
||||
target->enableFullUpdate(true);
|
||||
}
|
||||
|
||||
void RicWellTarget3dEditor::slotSelectedIn3D()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItemAtLevel(target, caf::SelectionManager::FIRST_LEVEL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotDragFinished()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimModeledWellPath* wellpath;
|
||||
target->firstAncestorOrThisOfTypeAsserted(wellpath);
|
||||
wellpath->scheduleUpdateOfDependentVisualization();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Statoil ASA
|
||||
// Copyright (C) 2018- equinor 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
|
||||
@ -72,228 +72,3 @@ private:
|
||||
cvf::ref<RicPointTangentManipulatorPartMgr> m_partManager;
|
||||
};
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "cvfMatrix4.h"
|
||||
#include "cvfString.h"
|
||||
#include "cvfColor4.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Part;
|
||||
class DrawableGeo;
|
||||
class Ray;
|
||||
class HitItem;
|
||||
|
||||
template <typename> class Array;
|
||||
typedef Array<Vec3f> Vec3fArray;
|
||||
typedef Array<uint> UIntArray;
|
||||
|
||||
}
|
||||
|
||||
class RicPointTangentManipulatorPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
enum HandleType
|
||||
{
|
||||
HORIZONTAL_PLANE,
|
||||
VERTICAL_AXIS,
|
||||
AZIMUTH,
|
||||
INCLINATION
|
||||
};
|
||||
|
||||
public:
|
||||
RicPointTangentManipulatorPartMgr();
|
||||
~RicPointTangentManipulatorPartMgr() override;
|
||||
|
||||
void setOrigin(const cvf::Vec3d& origin);
|
||||
void setTangent(const cvf::Vec3d& tangent);
|
||||
void setHandleSize(double handleSize);
|
||||
void originAndTangent(cvf::Vec3d* origin, cvf::Vec3d* tangent);
|
||||
|
||||
bool isManipulatorActive() const;
|
||||
void tryToActivateManipulator(const cvf::HitItem* hitItem);
|
||||
void updateManipulatorFromRay(const cvf::Ray* ray);
|
||||
void endManipulator();
|
||||
|
||||
void appendPartsToModel(cvf::ModelBasicList* model);
|
||||
|
||||
private:
|
||||
void createAllHandleParts();
|
||||
void clearAllGeometryAndParts();
|
||||
void recreateAllGeometryAndParts();
|
||||
|
||||
void createHorizontalPlaneHandle();
|
||||
void createVerticalAxisHandle();
|
||||
|
||||
void addHandlePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName);
|
||||
|
||||
void addActiveModePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName);
|
||||
|
||||
static cvf::ref<cvf::DrawableGeo> createTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray);
|
||||
static cvf::ref<cvf::DrawableGeo> createIndexedTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray,
|
||||
cvf::UIntArray* triangleIndices);
|
||||
static cvf::ref<cvf::Part> createPart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
const cvf::String& partName);
|
||||
private:
|
||||
size_t m_currentHandleIndex;
|
||||
std::vector< HandleType > m_handleIds; // These arrays have the same length
|
||||
cvf::Collection<cvf::Part> m_handleParts; // These arrays have the same length
|
||||
cvf::Collection<cvf::Part> m_activeDragModeParts;
|
||||
|
||||
cvf::Vec3d m_origin;
|
||||
cvf::Vec3d m_tangent;
|
||||
double m_handleSize;
|
||||
|
||||
cvf::Vec3d m_initialPickPoint;
|
||||
cvf::Vec3d m_tangentOnStartManipulation;
|
||||
cvf::Vec3d m_originOnStartManipulation;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
#include "cafSelectionChangedReceiver.h"
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
#include "cafFactory.h"
|
||||
// PdmUiObjectEditorHandle -<| PdmUiWidgetObjectEditorHandle --<| PdmUiFormLayoutObjectEditor
|
||||
// -<| PdmUi3dObjectEditorHandle
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
/// Macros helping in development of PDM UI 3d editors
|
||||
//==================================================================================================
|
||||
|
||||
/// CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT assists the factory used when creating editors
|
||||
/// Place this in the header file inside the class definition of your PdmUiEditor
|
||||
|
||||
#define CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT \
|
||||
public: \
|
||||
static QString uiEditorTypeName()
|
||||
|
||||
/// CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT implements editorTypeName() and registers the field editor in the field editor factory
|
||||
/// Place this in the cpp file, preferably above the constructor
|
||||
|
||||
#define CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(EditorClassName) \
|
||||
QString EditorClassName::uiEditorTypeName() { return #EditorClassName; } \
|
||||
CAF_FACTORY_REGISTER(caf::PdmUi3dObjectEditorHandle, EditorClassName, QString, EditorClassName::uiEditorTypeName())
|
||||
|
||||
|
||||
class PdmUi3dObjectEditorHandle : public caf::PdmUiObjectEditorHandle
|
||||
{
|
||||
public:
|
||||
PdmUi3dObjectEditorHandle();
|
||||
~PdmUi3dObjectEditorHandle() override;
|
||||
|
||||
void setViewer(caf::Viewer* ownerViewer);
|
||||
|
||||
protected:
|
||||
// To be removed when splitting the PdmUiObjectEditorHandle
|
||||
QWidget* createWidget(QWidget* parent) override { return nullptr;}
|
||||
|
||||
QPointer<caf::Viewer> m_ownerViewer;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
// Selected object 3D editor visualizer
|
||||
class PdmUiSelectionVisualizer3d : public QObject, caf::SelectionChangedReceiver
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PdmUiSelectionVisualizer3d(caf::Viewer* ownerViewer);
|
||||
~PdmUiSelectionVisualizer3d() override;
|
||||
|
||||
void updateVisibleEditors();
|
||||
protected:
|
||||
void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;
|
||||
|
||||
std::vector< QPointer<PdmUi3dObjectEditorHandle> > m_active3DEditors;
|
||||
|
||||
QPointer<caf::Viewer> m_ownerViewer;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RicWellTarget3dEditor;
|
||||
|
||||
class RicWellPathGeometry3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicWellPathGeometry3dEditor();
|
||||
~RicWellPathGeometry3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<RicWellTarget3dEditor*> m_targetEditors;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
class RicWellTarget3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicWellTarget3dEditor();
|
||||
~RicWellTarget3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
void cleanupBeforeSettingPdmObject() override;
|
||||
|
||||
private slots:
|
||||
void slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent);
|
||||
void slotSelectedIn3D();
|
||||
void slotDragFinished();
|
||||
private:
|
||||
QPointer<RicPointTangentManipulator> m_manipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
};
|
||||
|
||||
class RiuViewer;
|
||||
|
||||
// 3D editor manager
|
||||
|
@ -0,0 +1,422 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicPointTangentManipulatorPartMgr.h"
|
||||
|
||||
#include "RivPartPriority.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafLine.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfBoxGenerator.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfGeometryBuilderFaceList.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfRay.h"
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfHitItem.h"
|
||||
|
||||
#include "cvfGeometryBuilderTriangles.h"
|
||||
#include "cvfGeometryUtils.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPointTangentManipulatorPartMgr::RicPointTangentManipulatorPartMgr()
|
||||
: m_tangentOnStartManipulation(cvf::Vec3d::UNDEFINED),
|
||||
m_originOnStartManipulation(cvf::Vec3d::UNDEFINED),
|
||||
m_currentHandleIndex(cvf::UNDEFINED_SIZE_T),
|
||||
m_handleSize(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPointTangentManipulatorPartMgr::~RicPointTangentManipulatorPartMgr()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setOrigin(const cvf::Vec3d& origin)
|
||||
{
|
||||
if (isManipulatorActive()) return;
|
||||
|
||||
m_origin = origin;
|
||||
if (m_originOnStartManipulation.isUndefined()) m_originOnStartManipulation = origin;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setTangent(const cvf::Vec3d& tangent)
|
||||
{
|
||||
if(isManipulatorActive()) return;
|
||||
|
||||
m_tangent = tangent;
|
||||
if (m_tangentOnStartManipulation.isUndefined()) m_tangentOnStartManipulation = m_tangent;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setHandleSize(double handleSize)
|
||||
{
|
||||
m_handleSize = handleSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::originAndTangent(cvf::Vec3d* origin, cvf::Vec3d* tangent)
|
||||
{
|
||||
*origin = m_origin;
|
||||
*tangent = m_tangent;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPointTangentManipulatorPartMgr::isManipulatorActive() const
|
||||
{
|
||||
return m_currentHandleIndex != cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
|
||||
{
|
||||
if (!m_handleParts.size())
|
||||
{
|
||||
recreateAllGeometryAndParts();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_handleParts.size(); i++)
|
||||
{
|
||||
model->addPart(m_handleParts.at(i));
|
||||
}
|
||||
|
||||
for (auto activeModePart: m_activeDragModeParts)
|
||||
{
|
||||
model->addPart(activeModePart.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::tryToActivateManipulator(const cvf::HitItem* hitItem)
|
||||
{
|
||||
endManipulator();
|
||||
|
||||
if (!hitItem) return;
|
||||
|
||||
const cvf::Part* pickedPart = hitItem->part();
|
||||
const cvf::Vec3d intersectionPoint = hitItem->intersectionPoint();
|
||||
|
||||
if (!pickedPart) return;
|
||||
|
||||
for (size_t i = 0; i < m_handleParts.size(); i++)
|
||||
{
|
||||
if (pickedPart == m_handleParts.at(i))
|
||||
{
|
||||
m_initialPickPoint = intersectionPoint;
|
||||
m_tangentOnStartManipulation = m_tangent;
|
||||
m_originOnStartManipulation = m_origin;
|
||||
m_currentHandleIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Calculate new origin and tangent based on the new ray position
|
||||
/// Clear geometry to trigger regeneration
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay(const cvf::Ray* newMouseRay)
|
||||
{
|
||||
if (!isManipulatorActive()) return;
|
||||
|
||||
if ( m_handleIds[m_currentHandleIndex] == HORIZONTAL_PLANE )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
plane.setFromPointAndNormal(m_origin, cvf::Vec3d::Z_AXIS);
|
||||
cvf::Vec3d newIntersection;
|
||||
newMouseRay->planeIntersect(plane, &newIntersection);
|
||||
|
||||
cvf::Vec3d newOrigin = m_originOnStartManipulation + (newIntersection - m_initialPickPoint);
|
||||
|
||||
m_origin = newOrigin;
|
||||
}
|
||||
else if ( m_handleIds[m_currentHandleIndex] == VERTICAL_AXIS )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
cvf::Vec3d planeNormal = (newMouseRay->direction() ^ cvf::Vec3d::Z_AXIS) ^ cvf::Vec3d::Z_AXIS;
|
||||
double length = planeNormal.length();
|
||||
|
||||
if (length < 1e-5) return;
|
||||
|
||||
planeNormal /= length;
|
||||
plane.setFromPointAndNormal(m_initialPickPoint, planeNormal );
|
||||
cvf::Vec3d newIntersection;
|
||||
newMouseRay->planeIntersect(plane, &newIntersection);
|
||||
|
||||
cvf::Vec3d newOrigin = m_originOnStartManipulation;
|
||||
newOrigin.z() += (newIntersection.z() - m_initialPickPoint.z());
|
||||
|
||||
m_origin = newOrigin;
|
||||
}
|
||||
//m_tangent = newTangent;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::endManipulator()
|
||||
{
|
||||
m_currentHandleIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::clearAllGeometryAndParts()
|
||||
{
|
||||
m_handleIds.clear();
|
||||
m_handleParts.clear();
|
||||
m_activeDragModeParts.clear();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
||||
{
|
||||
createAllHandleParts();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createAllHandleParts()
|
||||
{
|
||||
createHorizontalPlaneHandle();
|
||||
createVerticalAxisHandle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createHorizontalPlaneHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = new cvf::Vec3fArray(6);
|
||||
|
||||
vertexArray->set(0, {-1, -1, 0} );
|
||||
vertexArray->set(1, { 1, -1, 0});
|
||||
vertexArray->set(2, { 1, 1, 0});
|
||||
vertexArray->set(3, {-1, -1, 0});
|
||||
vertexArray->set(4, { 1, 1, 0});
|
||||
vertexArray->set(5, {-1, 1, 0});
|
||||
|
||||
Vec3f origin(m_origin);
|
||||
for (cvf::Vec3f& vx: *vertexArray)
|
||||
{
|
||||
vx *= 0.5*m_handleSize;
|
||||
vx += origin;
|
||||
}
|
||||
|
||||
ref<DrawableGeo> geo = createTriangelDrawableGeo(vertexArray.p());
|
||||
|
||||
HandleType handleId = HORIZONTAL_PLANE;
|
||||
cvf::Color4f color = cvf::Color4f(1.0f, 0.0f, 1.0f, 0.5f);
|
||||
cvf::String partName("PointTangentManipulator Horizontal Plane Handle");
|
||||
|
||||
addHandlePart(geo.p(), color, handleId, partName);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
|
||||
cvf::ref< cvf::GeometryBuilderTriangles> geomBuilder = new cvf::GeometryBuilderTriangles;
|
||||
cvf::GeometryUtils::createBox({-0.3f, -0.3f, -1.0f}, { 0.3f, 0.3f, 1.0f}, geomBuilder.p());
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = geomBuilder->vertices();
|
||||
cvf::ref<cvf::UIntArray> indexArray = geomBuilder->triangles();
|
||||
|
||||
Vec3f origin(m_origin);
|
||||
for (cvf::Vec3f& vx: *vertexArray)
|
||||
{
|
||||
vx *= 0.5*m_handleSize;
|
||||
vx += origin;
|
||||
}
|
||||
|
||||
ref<DrawableGeo> geo = createIndexedTriangelDrawableGeo(vertexArray.p(), indexArray.p());
|
||||
|
||||
HandleType handleId = VERTICAL_AXIS;
|
||||
cvf::Color4f color = cvf::Color4f(0.0f, 0.2f, 0.8f, 0.5f);
|
||||
cvf::String partName("PointTangentManipulator Vertical Axis Handle");
|
||||
|
||||
addHandlePart(geo.p(), color, handleId, partName);
|
||||
}
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createAzimuthHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
|
||||
cvf::ref< cvf::GeometryBuilderTriangles> geomBuilder = new cvf::GeometryBuilderTriangles;
|
||||
cvf::GeometryUtils::createDisc(1.3, 1.1, 16, geomBuilder.p());
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = geomBuilder->vertices();
|
||||
cvf::ref<cvf::UIntArray> indexArray = geomBuilder->triangles();
|
||||
|
||||
Vec3f origin(m_origin);
|
||||
for (cvf::Vec3f& vx: *vertexArray)
|
||||
{
|
||||
vx *= 0.5*m_handleSize;
|
||||
vx += origin;
|
||||
}
|
||||
|
||||
ref<DrawableGeo> geo = createIndexedTriangelDrawableGeo(vertexArray.p(), indexArray.p());
|
||||
|
||||
HandleType handleId = AZIMUTH;
|
||||
cvf::Color4f color = cvf::Color4f(0.0f, 0.2f, 0.8f, 0.5f);
|
||||
cvf::String partName("PointTangentManipulator Azimuth Handle");
|
||||
|
||||
addHandlePart(geo.p(), color, handleId, partName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createIndexedTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray,
|
||||
cvf::UIntArray* triangleIndices)
|
||||
{
|
||||
using namespace cvf;
|
||||
ref<DrawableGeo> geo = new DrawableGeo;
|
||||
ref<PrimitiveSetIndexedUInt> primSet = new PrimitiveSetIndexedUInt(PT_TRIANGLES, triangleIndices);
|
||||
|
||||
geo->setVertexArray(triangleVertexArray);
|
||||
geo->addPrimitiveSet(primSet.p());
|
||||
geo->computeNormals();
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray)
|
||||
{
|
||||
using namespace cvf;
|
||||
ref<DrawableGeo> geo = new DrawableGeo;
|
||||
|
||||
geo->setVertexArray(triangleVertexArray);
|
||||
ref<cvf::PrimitiveSetDirect> primSet = new cvf::PrimitiveSetDirect(cvf::PT_TRIANGLES);
|
||||
primSet->setIndexCount(triangleVertexArray->size());
|
||||
|
||||
geo->addPrimitiveSet(primSet.p());
|
||||
geo->computeNormals();
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::addHandlePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName)
|
||||
{
|
||||
cvf::ref<cvf::Part> handlePart = createPart(geo, color, partName);
|
||||
|
||||
m_handleParts.push_back(handlePart.p());
|
||||
m_handleIds.push_back(handleId);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::addActiveModePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName)
|
||||
{
|
||||
cvf::ref<cvf::Part> handlePart = createPart(geo, color, partName);
|
||||
|
||||
m_activeDragModeParts.push_back(handlePart.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RicPointTangentManipulatorPartMgr::createPart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
const cvf::String& partName)
|
||||
{
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName(partName);
|
||||
part->setDrawable(geo);
|
||||
part->updateBoundingBox();
|
||||
|
||||
caf::SurfaceEffectGenerator surfaceGen(color, caf::PO_1);
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
part->setEffect(eff.p());
|
||||
if (color.a() < 1.0) part->setPriority(RivPartPriority::Transparent);
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "cvfVector3.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "cvfMatrix4.h"
|
||||
#include "cvfColor4.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
|
||||
class ModelBasicList;
|
||||
class Part;
|
||||
class DrawableGeo;
|
||||
class Ray;
|
||||
class HitItem;
|
||||
class String;
|
||||
|
||||
template <typename> class Array;
|
||||
typedef Array<Vec3f> Vec3fArray;
|
||||
typedef Array<uint> UIntArray;
|
||||
|
||||
}
|
||||
|
||||
class RicPointTangentManipulatorPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
enum HandleType
|
||||
{
|
||||
HORIZONTAL_PLANE,
|
||||
VERTICAL_AXIS,
|
||||
AZIMUTH,
|
||||
INCLINATION
|
||||
};
|
||||
|
||||
public:
|
||||
RicPointTangentManipulatorPartMgr();
|
||||
~RicPointTangentManipulatorPartMgr() override;
|
||||
|
||||
void setOrigin(const cvf::Vec3d& origin);
|
||||
void setTangent(const cvf::Vec3d& tangent);
|
||||
void setHandleSize(double handleSize);
|
||||
void originAndTangent(cvf::Vec3d* origin, cvf::Vec3d* tangent);
|
||||
|
||||
bool isManipulatorActive() const;
|
||||
void tryToActivateManipulator(const cvf::HitItem* hitItem);
|
||||
void updateManipulatorFromRay(const cvf::Ray* ray);
|
||||
void endManipulator();
|
||||
|
||||
void appendPartsToModel(cvf::ModelBasicList* model);
|
||||
|
||||
private:
|
||||
void createAllHandleParts();
|
||||
void clearAllGeometryAndParts();
|
||||
void recreateAllGeometryAndParts();
|
||||
|
||||
void createHorizontalPlaneHandle();
|
||||
void createVerticalAxisHandle();
|
||||
|
||||
void addHandlePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName);
|
||||
|
||||
void addActiveModePart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
HandleType handleId,
|
||||
const cvf::String& partName);
|
||||
|
||||
static cvf::ref<cvf::DrawableGeo> createTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray);
|
||||
static cvf::ref<cvf::DrawableGeo> createIndexedTriangelDrawableGeo(cvf::Vec3fArray* triangleVertexArray,
|
||||
cvf::UIntArray* triangleIndices);
|
||||
static cvf::ref<cvf::Part> createPart(cvf::DrawableGeo* geo,
|
||||
const cvf::Color4f& color,
|
||||
const cvf::String& partName);
|
||||
private:
|
||||
size_t m_currentHandleIndex;
|
||||
std::vector< HandleType > m_handleIds; // These arrays have the same length
|
||||
cvf::Collection<cvf::Part> m_handleParts; // These arrays have the same length
|
||||
cvf::Collection<cvf::Part> m_activeDragModeParts;
|
||||
cvf::Vec3d m_origin;
|
||||
cvf::Vec3d m_tangent;
|
||||
double m_handleSize;
|
||||
cvf::Vec3d m_initialPickPoint;
|
||||
cvf::Vec3d m_tangentOnStartManipulation;
|
||||
cvf::Vec3d m_originOnStartManipulation;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicWellPathGeometry3dEditor.h"
|
||||
|
||||
#include "RicWellPathGeometry3dEditor.h"
|
||||
#include "RicWellTarget3dEditor.h"
|
||||
|
||||
#include "RimWellPathTarget.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicWellPathGeometry3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellPathGeometry3dEditor::RicWellPathGeometry3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellPathGeometry3dEditor::~RicWellPathGeometry3dEditor()
|
||||
{
|
||||
for (auto targetEditor: m_targetEditors)
|
||||
{
|
||||
delete targetEditor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathGeometry3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
RimWellPathGeometryDef* geomDef = dynamic_cast<RimWellPathGeometryDef*>(this->pdmObject());
|
||||
|
||||
for (auto targetEditor: m_targetEditors)
|
||||
{
|
||||
delete targetEditor;
|
||||
}
|
||||
m_targetEditors.clear();
|
||||
|
||||
if (!geomDef) return;
|
||||
|
||||
|
||||
std::vector<RimWellPathTarget*> targets = geomDef->activeWellTargets();
|
||||
|
||||
for (auto target: targets)
|
||||
{
|
||||
auto targetEditor = new RicWellTarget3dEditor;
|
||||
targetEditor->setViewer(ownerViewer());
|
||||
targetEditor->setPdmObject(target);
|
||||
m_targetEditors.push_back(targetEditor);
|
||||
targetEditor->updateUi();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "cafPdmUi3dObjectEditorHandle.h"
|
||||
|
||||
class RicWellTarget3dEditor;
|
||||
|
||||
class RicWellPathGeometry3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicWellPathGeometry3dEditor();
|
||||
~RicWellPathGeometry3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<RicWellTarget3dEditor*> m_targetEditors;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,204 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RicWellTarget3dEditor.h"
|
||||
|
||||
#include "RicPointTangentManipulator.h"
|
||||
|
||||
#include "RimWellPathTarget.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfPart.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_SOURCE_INIT(RicWellTarget3dEditor);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellTarget3dEditor::RicWellTarget3dEditor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellTarget3dEditor::~RicWellTarget3dEditor()
|
||||
{
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
|
||||
if (m_cvfModel.notNull() && ownerRiuViewer)
|
||||
{
|
||||
|
||||
// Could result in some circularities ....
|
||||
ownerRiuViewer->removeStaticModel(m_cvfModel.p());
|
||||
}
|
||||
|
||||
RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if (oldTarget)
|
||||
{
|
||||
oldTarget->m_targetType.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_azimuth.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_inclination.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
|
||||
delete m_manipulator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
|
||||
if ( !target || !target->isEnabled())
|
||||
{
|
||||
m_cvfModel->removeAllParts();
|
||||
return;
|
||||
}
|
||||
|
||||
RimWellPathGeometryDef* geomDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted(geomDef);
|
||||
|
||||
target->m_targetType.uiCapability()->addFieldEditor(this);
|
||||
target->m_targetPoint.uiCapability()->addFieldEditor(this);
|
||||
target->m_azimuth.uiCapability()->addFieldEditor(this);
|
||||
target->m_inclination.uiCapability()->addFieldEditor(this);
|
||||
|
||||
if (m_manipulator.isNull())
|
||||
{
|
||||
m_manipulator = new RicPointTangentManipulator(ownerRiuViewer);
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifyUpdate(const cvf::Vec3d& , const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotUpdated(const cvf::Vec3d& , const cvf::Vec3d& ) ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifySelected() ),
|
||||
this,
|
||||
SLOT( slotSelectedIn3D() ) );
|
||||
QObject::connect(m_manipulator,
|
||||
SIGNAL( notifyDragFinished() ),
|
||||
this,
|
||||
SLOT( slotDragFinished() ) );
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
ownerRiuViewer->addStaticModelOnce(m_cvfModel.p());
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
double handleSize = 1.0;
|
||||
{
|
||||
dispXf = ownerRiuViewer->ownerReservoirView()->displayCoordTransform();
|
||||
Rim3dView* view = dynamic_cast<Rim3dView*>(ownerRiuViewer->ownerReservoirView());
|
||||
handleSize = 0.7 * view->ownerCase()->characteristicCellSize();
|
||||
}
|
||||
|
||||
m_manipulator->setOrigin(dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePointXyz()));
|
||||
m_manipulator->setTangent(target->tangent());
|
||||
m_manipulator->setHandleSize(handleSize);
|
||||
m_cvfModel->removeAllParts();
|
||||
m_manipulator->appendPartsToModel(m_cvfModel.p());
|
||||
|
||||
m_cvfModel->updateBoundingBoxesRecursive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::cleanupBeforeSettingPdmObject()
|
||||
{
|
||||
RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if (oldTarget)
|
||||
{
|
||||
oldTarget->m_targetType.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_azimuth.uiCapability()->removeFieldEditor(this);
|
||||
oldTarget->m_inclination.uiCapability()->removeFieldEditor(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent)
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf;
|
||||
{
|
||||
RiuViewer* viewer = dynamic_cast<RiuViewer*>(ownerViewer());
|
||||
dispXf = viewer->ownerReservoirView()->displayCoordTransform();
|
||||
}
|
||||
|
||||
RimWellPathGeometryDef* geomDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted(geomDef);
|
||||
|
||||
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin) - geomDef->referencePointXyz();
|
||||
domainOrigin.z() = -domainOrigin.z();
|
||||
QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainOrigin);
|
||||
|
||||
target->enableFullUpdate(false);
|
||||
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField(target->m_targetPoint.uiCapability(), originVariant);
|
||||
target->enableFullUpdate(true);
|
||||
}
|
||||
|
||||
void RicWellTarget3dEditor::slotSelectedIn3D()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItemAtLevel(target, caf::SelectionManager::FIRST_LEVEL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotDragFinished()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>(this->pdmObject());
|
||||
if ( !target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimModeledWellPath* wellpath;
|
||||
target->firstAncestorOrThisOfTypeAsserted(wellpath);
|
||||
wellpath->scheduleUpdateOfDependentVisualization();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "cafPdmUi3dObjectEditorHandle.h"
|
||||
|
||||
class RicPointTangentManipulator;
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
namespace cvf {
|
||||
class ModelBasicList;
|
||||
}
|
||||
|
||||
class QString;
|
||||
#include <QPointer>
|
||||
|
||||
class RicWellTarget3dEditor : public caf::PdmUi3dObjectEditorHandle
|
||||
{
|
||||
CAF_PDM_UI_3D_OBJECT_EDITOR_HEADER_INIT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicWellTarget3dEditor();
|
||||
~RicWellTarget3dEditor() override;
|
||||
|
||||
protected:
|
||||
void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
void cleanupBeforeSettingPdmObject() override;
|
||||
|
||||
private slots:
|
||||
void slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent);
|
||||
void slotSelectedIn3D();
|
||||
void slotDragFinished();
|
||||
private:
|
||||
QPointer<RicPointTangentManipulator> m_manipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
};
|
||||
|
||||
|
@ -159,7 +159,7 @@ void RifCaseRealizationParametersReader::parse()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!RiaStdStringTools::isNumber(strValue.toStdString(), QLocale::c().decimalPoint().toAscii()))
|
||||
if (!RiaStdStringTools::isNumber(strValue.toStdString(), QLocale::c().decimalPoint().toLatin1()))
|
||||
{
|
||||
throw FileParseException(QString("RifEnsembleParametersReader: Invalid number format in line %1").arg(lineNo));
|
||||
}
|
||||
@ -264,7 +264,7 @@ void RifCaseRealizationRunspecificationReader::parse()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!RiaStdStringTools::isNumber(paramStrValue.toStdString(), QLocale::c().decimalPoint().toAscii()))
|
||||
if (!RiaStdStringTools::isNumber(paramStrValue.toStdString(), QLocale::c().decimalPoint().toLatin1()))
|
||||
{
|
||||
throw FileParseException(QString("RifEnsembleParametersReader: Invalid number format in line %1").arg(xml->lineNumber()));
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ bool RifCsvUserDataParser::parseColumnBasedData(const AsciiDataParseOptions& par
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parseOptions.assumeNumericDataColumns || RiaStdStringTools::isNumber(colData, parseOptions.locale.decimalPoint().toAscii()))
|
||||
if (parseOptions.assumeNumericDataColumns || RiaStdStringTools::isNumber(colData, parseOptions.locale.decimalPoint().toLatin1()))
|
||||
{
|
||||
col.dataType = Column::NUMERIC;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ void RifEclipseInputFileTools::findKeywordsOnFile(const QString &fileName, std::
|
||||
lineLength = data.readLine(buf, sizeof(buf));
|
||||
if (lineLength > 0)
|
||||
{
|
||||
line = QString::fromAscii(buf);
|
||||
line = QString::fromLatin1(buf);
|
||||
if (line.size() && line[0].isLetter())
|
||||
{
|
||||
RifKeywordAndFilePos keyPos;
|
||||
@ -400,7 +400,7 @@ void RifEclipseInputFileTools::parseAndReadPathAliasKeyword(const QString &fileN
|
||||
qint64 lineLength = data.readLine(buf, sizeof(buf));
|
||||
if (lineLength > 0)
|
||||
{
|
||||
line = QString::fromAscii(buf);
|
||||
line = QString::fromLatin1(buf);
|
||||
if (line.size() && (line[0].isLetter() || foundPathsKeyword))
|
||||
{
|
||||
line = line.trimmed();
|
||||
|
@ -189,7 +189,7 @@ bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t t
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t fileGridCount = ecl_file_get_num_named_kw(m_ecl_files[timeStep], resultName.toAscii().data());
|
||||
size_t fileGridCount = ecl_file_get_num_named_kw(m_ecl_files[timeStep], resultName.toLatin1().data());
|
||||
|
||||
// No results for this result variable for current time step found
|
||||
if (fileGridCount == 0) return true;
|
||||
|
@ -249,7 +249,7 @@ bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, size
|
||||
{
|
||||
ecl_file_select_block(m_ecl_file, INTEHEAD_KW, static_cast<int>(timeStep * gridCount + i));
|
||||
|
||||
int namedKeywordCount = ecl_file_get_num_named_kw(m_ecl_file, resultName.toAscii().data());
|
||||
int namedKeywordCount = ecl_file_get_num_named_kw(m_ecl_file, resultName.toLatin1().data());
|
||||
for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++)
|
||||
{
|
||||
std::vector<double> partValues;
|
||||
|
@ -52,7 +52,7 @@ void JsonReader::dumpToFile(std::vector<cvf::Vec3d>& points, QString filePath)
|
||||
cvf::Vec3d point = points[idx];
|
||||
QString string;
|
||||
string.sprintf("(%0.10e, %0.10e, %0.10e)\n", point.x(), point.y(), point.z());
|
||||
QByteArray byteArray(string.toAscii());
|
||||
QByteArray byteArray(string.toLatin1());
|
||||
file.write(byteArray);
|
||||
}
|
||||
file.close();
|
||||
|
@ -993,7 +993,7 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, RiaDefines::Por
|
||||
{
|
||||
std::vector<double> fileValues;
|
||||
|
||||
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_init_file, result.toAscii().data());
|
||||
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_init_file, result.toLatin1().data());
|
||||
size_t i;
|
||||
for (i = 0; i < numOccurrences; i++)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "RimGeoMechView.h"
|
||||
|
||||
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechGeometrySelectionItem, "GeoMechGeometrySelectionItem");
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (RifOdbReader)
|
||||
|
||||
|
@ -46,6 +46,14 @@ ${CMAKE_CURRENT_LIST_DIR}/RivSimWellConnectionSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogDrawSurfaceGenerator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivMeshLinesSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivContourMapProjectionPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivAnnotationsPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylinesAnnotationSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -90,6 +98,14 @@ ${CMAKE_CURRENT_LIST_DIR}/RivSimWellConnectionSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/Riv3dWellLogDrawSurfaceGenerator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivMeshLinesSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivContourMapProjectionPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivAnnotationsPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineAnnotationPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivTextAnnotationSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylinesAnnotationSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
#include "RivPolylineGenerator.h"
|
||||
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
@ -483,7 +484,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createFaultMeshDraw
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPolylineDrawable()
|
||||
{
|
||||
return createLineAlongPolylineDrawable(m_flattenedOrOffsettedPolyLines);
|
||||
return RivPolylineGenerator::createLineAlongPolylineDrawable(m_flattenedOrOffsettedPolyLines);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -499,48 +500,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongExtr
|
||||
displayCoords.push_back(transform->translateToDisplayCoord(pt));
|
||||
}
|
||||
|
||||
return createLineAlongPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({ displayCoords }));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines)
|
||||
{
|
||||
std::vector<cvf::uint> lineIndices;
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& polyLine = polyLines[pLineIdx];
|
||||
if (polyLine.size() < 2) continue;
|
||||
|
||||
for (size_t i = 0; i < polyLine.size(); ++i)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(polyLine[i]));
|
||||
if (i < 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 nullptr;
|
||||
|
||||
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;
|
||||
return RivPolylineGenerator::createLineAlongPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({ displayCoords }));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -548,7 +508,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createLineAlongPoly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPolylineDrawable()
|
||||
{
|
||||
return createPointsFromPolylineDrawable(m_flattenedOrOffsettedPolyLines);
|
||||
return RivPolylineGenerator::createPointsFromPolylineDrawable(m_flattenedOrOffsettedPolyLines);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -564,39 +524,7 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromExt
|
||||
displayCoords.push_back(transform->translateToDisplayCoord(pt));
|
||||
}
|
||||
|
||||
return createPointsFromPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({displayCoords}));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines)
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
for (size_t pLineIdx = 0; pLineIdx < polyLines.size(); ++pLineIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& polyLine = polyLines[pLineIdx];
|
||||
for (size_t i = 0; i < polyLine.size(); ++i)
|
||||
{
|
||||
vertices.push_back(cvf::Vec3f(polyLine[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.size() == 0) return nullptr;
|
||||
|
||||
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;
|
||||
|
||||
return RivPolylineGenerator::createPointsFromPolylineDrawable(std::vector<std::vector<cvf::Vec3d>>({displayCoords}));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -83,9 +83,6 @@ public:
|
||||
cvf::Mat4d unflattenTransformMatrix(const cvf::Vec3d& intersectionPointFlat);
|
||||
|
||||
private:
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d> >& polyLines);
|
||||
|
||||
void calculateArrays();
|
||||
void calculateSegementTransformPrLinePoint();
|
||||
void calculateFlattenedOrOffsetedPolyline();
|
||||
|
142
ApplicationCode/ModelVisualization/RivAnnotationsPartMgr.cpp
Normal file
142
ApplicationCode/ModelVisualization/RivAnnotationsPartMgr.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron 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 "RivAnnotationsPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
|
||||
#include "RivTextAnnotationPartMgr.h"
|
||||
#include "RivReachCircleAnnotationPartMgr.h"
|
||||
#include "RivPolylineAnnotationPartMgr.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivAnnotationsPartMgr::RivAnnotationsPartMgr(Rim3dView* view)
|
||||
: m_rimView(view)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivAnnotationsPartMgr::~RivAnnotationsPartMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivAnnotationsPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
createAnnotationPartManagers();
|
||||
|
||||
for (auto& partMgr : m_textAnnotationPartMgrs)
|
||||
{
|
||||
partMgr->appendDynamicGeometryPartsToModel(model, displayCoordTransform, boundingBox);
|
||||
}
|
||||
for (auto& partMgr : m_reachCircleAnnotationPartMgrs)
|
||||
{
|
||||
partMgr->appendDynamicGeometryPartsToModel(model, displayCoordTransform, boundingBox);
|
||||
}
|
||||
for (auto& partMgr : m_polylineAnnotationPartMgrs)
|
||||
{
|
||||
partMgr->appendDynamicGeometryPartsToModel(model, displayCoordTransform, boundingBox);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivAnnotationsPartMgr::createAnnotationPartManagers()
|
||||
{
|
||||
std::vector<RimAnnotationInViewCollection*> colls;
|
||||
m_rimView->descendantsIncludingThisOfType(colls);
|
||||
|
||||
if (colls.empty()) return;
|
||||
auto coll = colls.front();
|
||||
|
||||
auto localTextAnnotations = coll->textAnnotations();
|
||||
auto textAnnotations = coll->globalTextAnnotations();
|
||||
auto reachCircleAnnotations = coll->globalReachCircleAnnotations();
|
||||
auto userDefinedPolylineAnnotations = coll->globalUserDefinedPolylineAnnotations();
|
||||
auto polylineFromFileAnnotations = coll->globalPolylineFromFileAnnotations();
|
||||
|
||||
clearGeometryCache();
|
||||
|
||||
if (m_textAnnotationPartMgrs.size() != localTextAnnotations.size() + textAnnotations.size())
|
||||
{
|
||||
for (auto annotation : localTextAnnotations)
|
||||
{
|
||||
auto* apm = new RivTextAnnotationPartMgr(m_rimView, annotation);
|
||||
m_textAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
for (auto annotation : textAnnotations)
|
||||
{
|
||||
auto* apm = new RivTextAnnotationPartMgr(m_rimView, annotation);
|
||||
m_textAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
}
|
||||
if (m_reachCircleAnnotationPartMgrs.size() != reachCircleAnnotations.size())
|
||||
{
|
||||
for (auto annotation : reachCircleAnnotations)
|
||||
{
|
||||
auto* apm = new RivReachCircleAnnotationPartMgr(m_rimView, annotation);
|
||||
m_reachCircleAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
}
|
||||
if (m_polylineAnnotationPartMgrs.size() != userDefinedPolylineAnnotations.size() + polylineFromFileAnnotations.size())
|
||||
{
|
||||
for (auto annotation : userDefinedPolylineAnnotations)
|
||||
{
|
||||
auto* apm = new RivPolylineAnnotationPartMgr(m_rimView, annotation);
|
||||
m_polylineAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
for (auto annotation : polylineFromFileAnnotations)
|
||||
{
|
||||
auto* apm = new RivPolylineAnnotationPartMgr(m_rimView, annotation);
|
||||
m_polylineAnnotationPartMgrs.push_back(apm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivAnnotationsPartMgr::clearGeometryCache()
|
||||
{
|
||||
m_textAnnotationPartMgrs.clear();
|
||||
m_reachCircleAnnotationPartMgrs.clear();
|
||||
m_polylineAnnotationPartMgrs.clear();
|
||||
}
|
69
ApplicationCode/ModelVisualization/RivAnnotationsPartMgr.h
Normal file
69
ApplicationCode/ModelVisualization/RivAnnotationsPartMgr.h
Normal file
@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "cvfBase.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
class Part;
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Font;
|
||||
}
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class Rim3dView;
|
||||
class RimAnnotationInViewCollection;
|
||||
class RivTextAnnotationPartMgr;
|
||||
class RivReachCircleAnnotationPartMgr;
|
||||
class RivPolylineAnnotationPartMgr;
|
||||
class RimSimWellInView;
|
||||
class RimSimWellInViewCollection;
|
||||
|
||||
class RivAnnotationsPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivAnnotationsPartMgr( Rim3dView* view);
|
||||
~RivAnnotationsPartMgr() override;
|
||||
|
||||
void appendGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
const cvf::BoundingBox& boundingBox);
|
||||
|
||||
void clearGeometryCache();
|
||||
|
||||
|
||||
private:
|
||||
void createAnnotationPartManagers();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
cvf::Collection<RivTextAnnotationPartMgr> m_textAnnotationPartMgrs;
|
||||
cvf::Collection<RivReachCircleAnnotationPartMgr> m_reachCircleAnnotationPartMgrs;
|
||||
cvf::Collection<RivPolylineAnnotationPartMgr> m_polylineAnnotationPartMgrs;
|
||||
};
|
@ -0,0 +1,205 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RivPolylineAnnotationPartMgr.h"
|
||||
|
||||
#include "RiaBoundingBoxTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
#include "RimPolylinesAnnotationInView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPolylinesAnnotationSourceInfo.h"
|
||||
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfTransform.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivPolylineAnnotationPartMgr::RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotationInView* annotationInView)
|
||||
: m_rimView(view), m_rimAnnotationInView(annotationInView)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivPolylineAnnotationPartMgr::~RivPolylineAnnotationPartMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf)
|
||||
{
|
||||
clearAllGeometry();
|
||||
|
||||
auto rimAnnotation = m_rimAnnotationInView->sourceAnnotation();
|
||||
if (!rimAnnotation->isEmpty() && rimAnnotation->isActive())
|
||||
{
|
||||
auto lineColor = rimAnnotation->appearance()->color();
|
||||
auto isDashedLine = rimAnnotation->appearance()->isDashed();
|
||||
auto lineThickness = rimAnnotation->appearance()->thickness();
|
||||
|
||||
auto* collection = annotationCollection();
|
||||
if (!collection) return;
|
||||
|
||||
auto linesInDomain = getPolylinesPointsInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||
auto linesInDisplay = transformPolylinesPointsToDisplay(linesInDomain, displayXf);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(linesInDisplay);
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
//part->setName("RivAnnotationPartMgr: text " + cvfString);
|
||||
part->setDrawable(drawableGeo.p());
|
||||
|
||||
caf::MeshEffectGenerator effgen(lineColor);
|
||||
effgen.setLineWidth(lineThickness);
|
||||
if (isDashedLine) effgen.setLineStipple(true);
|
||||
cvf::ref<cvf::Effect> eff = effgen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
|
||||
cvf::ref<RivPolylinesAnnotationSourceInfo> sourceInfo = new RivPolylinesAnnotationSourceInfo(rimAnnotation);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_part = part;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<RivPolylineAnnotationPartMgr::Vec3d>>
|
||||
RivPolylineAnnotationPartMgr::getPolylinesPointsInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
auto polylines = m_rimAnnotationInView->sourceAnnotation()->polyLinesData()->polyLines();
|
||||
if (!snapToPlaneZ) return polylines;
|
||||
|
||||
std::vector<std::vector<Vec3d>> polylinesInDisplay;
|
||||
for (const auto& pts : polylines)
|
||||
{
|
||||
std::vector<Vec3d> polyline;
|
||||
for (const auto& pt : pts)
|
||||
{
|
||||
auto ptInDisp = pt;
|
||||
ptInDisp.z() = planeZ;
|
||||
polyline.push_back(ptInDisp);
|
||||
}
|
||||
polylinesInDisplay.push_back(polyline);
|
||||
}
|
||||
return polylinesInDisplay;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<cvf::Vec3d>> RivPolylineAnnotationPartMgr::transformPolylinesPointsToDisplay(
|
||||
const std::vector<std::vector<Vec3d>>& pointsInDomain,
|
||||
const caf::DisplayCoordTransform* displayXf)
|
||||
{
|
||||
std::vector<std::vector<Vec3d>> pointsInDisplay;
|
||||
for (const auto& pts : pointsInDomain)
|
||||
{
|
||||
std::vector<Vec3d> polyline;
|
||||
for (const auto& pt : pts)
|
||||
{
|
||||
polyline.push_back(displayXf->transformToDisplayCoord(pt));
|
||||
}
|
||||
pointsInDisplay.push_back(polyline);
|
||||
|
||||
}
|
||||
return pointsInDisplay;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivPolylineAnnotationPartMgr::isPolylinesInBoundingBox(const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (!coll) return false;
|
||||
|
||||
auto effectiveBoundingBox = RiaBoundingBoxTools::inflate(boundingBox, 3);
|
||||
for (const auto& pts : getPolylinesPointsInDomain(coll->snapAnnotations(), coll->annotationPlaneZ()))
|
||||
{
|
||||
for (const auto& pt : pts)
|
||||
{
|
||||
if (effectiveBoundingBox.contains(pt)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivPolylineAnnotationPartMgr::clearAllGeometry()
|
||||
{
|
||||
m_part = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInViewCollection* RivPolylineAnnotationPartMgr::annotationCollection() const
|
||||
{
|
||||
std::vector<RimAnnotationInViewCollection*> colls;
|
||||
m_rimView->descendantsIncludingThisOfType(colls);
|
||||
return !colls.empty() ? colls.front() : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivPolylineAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform * displayXf,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
auto rimAnnotation = m_rimAnnotationInView->sourceAnnotation();
|
||||
if (rimAnnotation->isEmpty()) return;
|
||||
if (!m_rimAnnotationInView->isVisible()) return;
|
||||
|
||||
// Check bounding box
|
||||
if (!isPolylinesInBoundingBox(boundingBox)) return;
|
||||
|
||||
buildPolylineAnnotationParts(displayXf);
|
||||
|
||||
if ( m_part.notNull() )
|
||||
{
|
||||
model->addPart(m_part.p());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 equinor 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 "cvfAssert.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
class Part;
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Font;
|
||||
}
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class Rim3dView;
|
||||
class RimPolylinesAnnotationInView;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
|
||||
class RivPolylineAnnotationPartMgr : public cvf::Object
|
||||
{
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
public:
|
||||
RivPolylineAnnotationPartMgr(Rim3dView* view, RimPolylinesAnnotationInView* annotation);
|
||||
~RivPolylineAnnotationPartMgr() override;
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform * displayXf,
|
||||
const cvf::BoundingBox& boundingBox);
|
||||
private:
|
||||
void buildPolylineAnnotationParts(const caf::DisplayCoordTransform* displayXf);
|
||||
|
||||
std::vector<std::vector<Vec3d>> getPolylinesPointsInDomain(bool snapToPlaneZ, double planeZ);
|
||||
std::vector<std::vector<Vec3d>> transformPolylinesPointsToDisplay(const std::vector<std::vector<Vec3d>>& pointsInDomain,
|
||||
const caf::DisplayCoordTransform* displayXf);
|
||||
|
||||
bool isPolylinesInBoundingBox(const cvf::BoundingBox& boundingBox);
|
||||
|
||||
void clearAllGeometry();
|
||||
RimAnnotationInViewCollection* annotationCollection() const;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimPolylinesAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_part;
|
||||
};
|
118
ApplicationCode/ModelVisualization/RivPolylineGenerator.cpp
Normal file
118
ApplicationCode/ModelVisualization/RivPolylineGenerator.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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 "RivPolylineGenerator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine)
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d>> polyLines;
|
||||
polyLines.push_back(polyLine);
|
||||
return createLineAlongPolylineDrawable(polyLines);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo>
|
||||
RivPolylineGenerator::createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines)
|
||||
{
|
||||
std::vector<cvf::uint> lineIndices;
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
for (const std::vector<cvf::Vec3d>& polyLine : polyLines)
|
||||
{
|
||||
if (polyLine.size() < 2) continue;
|
||||
|
||||
size_t verticesCount = vertices.size();
|
||||
|
||||
for (size_t i = 0; i < polyLine.size(); ++i)
|
||||
{
|
||||
vertices.emplace_back(polyLine[i]);
|
||||
if (i < polyLine.size() - 1)
|
||||
{
|
||||
lineIndices.push_back(static_cast<cvf::uint>(verticesCount + i));
|
||||
lineIndices.push_back(static_cast<cvf::uint>(verticesCount + i + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.empty()) return nullptr;
|
||||
|
||||
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> RivPolylineGenerator::createPointsFromPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine)
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d>> polyLines;
|
||||
polyLines.push_back(polyLine);
|
||||
return createPointsFromPolylineDrawable( polyLines );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo>
|
||||
RivPolylineGenerator::createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines)
|
||||
{
|
||||
std::vector<cvf::Vec3f> vertices;
|
||||
|
||||
for (const std::vector<cvf::Vec3d>& polyLine : polyLines)
|
||||
{
|
||||
for (const auto& pl : polyLine)
|
||||
{
|
||||
vertices.emplace_back(pl);
|
||||
}
|
||||
}
|
||||
|
||||
if (vertices.empty()) return nullptr;
|
||||
|
||||
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;
|
||||
}
|
43
ApplicationCode/ModelVisualization/RivPolylineGenerator.h
Normal file
43
ApplicationCode/ModelVisualization/RivPolylineGenerator.h
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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 <cvfVector3.h>
|
||||
#include <vector>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RivPolylineGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
|
||||
static cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
|
||||
|
||||
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<cvf::Vec3d>& polyLine);
|
||||
static cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable(const std::vector<std::vector<cvf::Vec3d>>& polyLines);
|
||||
};
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- 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 "RivPolylinesAnnotationSourceInfo.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivPolylinesAnnotationSourceInfo::RivPolylinesAnnotationSourceInfo(RimPolylinesAnnotation* annotation)
|
||||
: m_annotation(annotation)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotation* RivPolylinesAnnotationSourceInfo::annotation() const
|
||||
{
|
||||
return m_annotation.p();
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- 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 "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimPolylinesAnnotation;
|
||||
|
||||
class RivPolylinesAnnotationSourceInfo : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivPolylinesAnnotationSourceInfo(RimPolylinesAnnotation* annotation);
|
||||
|
||||
RimPolylinesAnnotation* annotation() const;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimPolylinesAnnotation> m_annotation;
|
||||
};
|
@ -0,0 +1,230 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron 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 "RivReachCircleAnnotationPartMgr.h"
|
||||
|
||||
#include "RiaBoundingBoxTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimReachCircleAnnotationInView.h"
|
||||
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivReachCircleAnnotationSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivReachCircleAnnotationPartMgr::RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotationInView* annotationInView)
|
||||
: m_rimView(view), m_rimAnnotationInView(annotationInView)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivReachCircleAnnotationPartMgr::~RivReachCircleAnnotationPartMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReachCircleAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset)
|
||||
{
|
||||
auto rimAnnotation = m_rimAnnotationInView->sourceAnnotation();
|
||||
clearAllGeometry();
|
||||
|
||||
cvf::ref<RivReachCircleAnnotationSourceInfo> sourceInfo = new RivReachCircleAnnotationSourceInfo(rimAnnotation);
|
||||
|
||||
Vec3d centerPositionInDomain = rimAnnotation->centerPoint();
|
||||
|
||||
auto lineColor = rimAnnotation->appearance()->color();
|
||||
auto isDashedLine = rimAnnotation->appearance()->isDashed();
|
||||
auto lineThickness = rimAnnotation->appearance()->thickness();
|
||||
|
||||
// Circle part
|
||||
auto* collection = annotationCollection();
|
||||
if(collection)
|
||||
{
|
||||
std::vector<Vec3d> pointsInDomain = computeCirclePointsInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||
std::vector<Vec3d> points = transformCirclePointsToDisplay(pointsInDomain, displayXf);
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(points);
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(drawableGeo.p());
|
||||
|
||||
caf::MeshEffectGenerator effgen(lineColor);
|
||||
effgen.setLineWidth(lineThickness);
|
||||
if (isDashedLine) effgen.setLineStipple(true); // Currently, dashed lines are not supported
|
||||
cvf::ref<cvf::Effect> eff = effgen.generateUnCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_circlePart = part;
|
||||
}
|
||||
|
||||
// Center point part
|
||||
{
|
||||
auto centerPos = rimAnnotation->centerPoint();
|
||||
double symbolSize = 20;
|
||||
double xMin = centerPos.x() - symbolSize / 2.0;
|
||||
double xMax = xMin + symbolSize;
|
||||
double yMin = centerPos.y() - symbolSize / 2.0;
|
||||
double yMax = yMin + symbolSize;
|
||||
double z = centerPos.z();
|
||||
std::vector<Vec3d> line1 = { {xMin, yMin, z}, {xMax, yMax, z} };
|
||||
std::vector<Vec3d> line2 = { {xMax, yMin, z}, {xMin, yMax, z} };
|
||||
std::vector<std::vector<Vec3d>> symbol = { line1, line2 };
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(symbol);
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(drawableGeo.p());
|
||||
|
||||
caf::MeshEffectGenerator effgen(lineColor);
|
||||
effgen.setLineWidth(2);
|
||||
cvf::ref<cvf::Effect> eff = effgen.generateUnCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_centerPointPart = part;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReachCircleAnnotationPartMgr::clearAllGeometry()
|
||||
{
|
||||
m_circlePart = nullptr;
|
||||
m_centerPointPart = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReachCircleAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayXf,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
if (m_rimAnnotationInView.isNull() || !m_rimAnnotationInView->sourceAnnotation()) return;
|
||||
if (!m_rimAnnotationInView->isVisible()) return;
|
||||
|
||||
// Check bounding box
|
||||
if (!isCircleInBoundingBox(boundingBox)) return;
|
||||
|
||||
if (!validateAnnotation(m_rimAnnotationInView->sourceAnnotation())) return;
|
||||
|
||||
buildParts(displayXf, false, 0.0);
|
||||
model->addPart(m_circlePart.p());
|
||||
model->addPart(m_centerPointPart.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivReachCircleAnnotationPartMgr::validateAnnotation(const RimReachCircleAnnotation* annotation) const
|
||||
{
|
||||
auto a = m_rimAnnotationInView->sourceAnnotation();
|
||||
return a->centerPoint() != cvf::Vec3d::ZERO && a->radius() > 0.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivReachCircleAnnotationPartMgr::isCircleInBoundingBox(const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (!coll) return false;
|
||||
|
||||
auto effectiveBoundingBox = RiaBoundingBoxTools::inflate(boundingBox, 3);
|
||||
auto points = computeCirclePointsInDomain(coll->snapAnnotations(), coll->annotationPlaneZ());
|
||||
for (const auto& pt : points)
|
||||
{
|
||||
if (effectiveBoundingBox.contains(pt)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3d> RivReachCircleAnnotationPartMgr::computeCirclePointsInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
int numPoints = 36;
|
||||
auto centerPos = m_rimAnnotationInView->sourceAnnotation()->centerPoint();
|
||||
auto radius = m_rimAnnotationInView->sourceAnnotation()->radius();
|
||||
|
||||
if (snapToPlaneZ)
|
||||
{
|
||||
centerPos.z() = planeZ;
|
||||
}
|
||||
|
||||
std::vector<Vec3d> points;
|
||||
for (int i = 0; i < numPoints; i++)
|
||||
{
|
||||
double rad = 2 * cvf::PI_D * (double)i / (double)numPoints;
|
||||
Vec3d pt(centerPos.x() + cos(rad) * radius, centerPos.y() + sin(rad) * radius, centerPos.z());
|
||||
points.push_back(pt);
|
||||
}
|
||||
points.push_back(points.front());
|
||||
return points;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RivReachCircleAnnotationPartMgr::Vec3d>
|
||||
RivReachCircleAnnotationPartMgr::transformCirclePointsToDisplay(const std::vector<Vec3d>& pointsInDomain,
|
||||
const caf::DisplayCoordTransform* displayXf)
|
||||
{
|
||||
std::vector<Vec3d> pointsInDisplay;
|
||||
for (const auto& pt : pointsInDomain) pointsInDisplay.push_back(displayXf->transformToDisplayCoord(pt));
|
||||
return pointsInDisplay;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInViewCollection* RivReachCircleAnnotationPartMgr::annotationCollection() const
|
||||
{
|
||||
std::vector<RimAnnotationInViewCollection*> colls;
|
||||
m_rimView->descendantsIncludingThisOfType(colls);
|
||||
return !colls.empty() ? colls.front() : nullptr;
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "cvfBase.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
class Part;
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Font;
|
||||
}
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class Rim3dView;
|
||||
class RimReachCircleAnnotation;
|
||||
class RimReachCircleAnnotationInView;
|
||||
class RimAnnotationInViewCollection;
|
||||
|
||||
class RivReachCircleAnnotationPartMgr : public cvf::Object
|
||||
{
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
public:
|
||||
RivReachCircleAnnotationPartMgr(Rim3dView* view, RimReachCircleAnnotationInView* annotationInView);
|
||||
~RivReachCircleAnnotationPartMgr() override;
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayXf,
|
||||
const cvf::BoundingBox& boundingBox);
|
||||
|
||||
private:
|
||||
void buildParts(const caf::DisplayCoordTransform* displayXf, bool doFlatten, double xOffset);
|
||||
|
||||
void clearAllGeometry();
|
||||
bool validateAnnotation(const RimReachCircleAnnotation* annotation) const;
|
||||
bool isCircleInBoundingBox(const cvf::BoundingBox& boundingBox);
|
||||
|
||||
std::vector<Vec3d> computeCirclePointsInDomain(bool snapToPlaneZ, double planeZ);
|
||||
std::vector<Vec3d> transformCirclePointsToDisplay(const std::vector<Vec3d>& pointsInDomain,
|
||||
const caf::DisplayCoordTransform* displayXf);
|
||||
|
||||
RimAnnotationInViewCollection* annotationCollection() const;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimReachCircleAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_circlePart;
|
||||
cvf::ref<cvf::Part> m_centerPointPart;
|
||||
};
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- 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 "RivReachCircleAnnotationSourceInfo.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivReachCircleAnnotationSourceInfo::RivReachCircleAnnotationSourceInfo(RimReachCircleAnnotation* annotation)
|
||||
: m_annotation(annotation)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimReachCircleAnnotation* RivReachCircleAnnotationSourceInfo::annotation() const
|
||||
{
|
||||
return m_annotation.p();
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- 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 "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimReachCircleAnnotation;
|
||||
|
||||
class RivReachCircleAnnotationSourceInfo : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivReachCircleAnnotationSourceInfo(RimReachCircleAnnotation* annotation);
|
||||
|
||||
RimReachCircleAnnotation* annotation() const;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimReachCircleAnnotation> m_annotation;
|
||||
};
|
256
ApplicationCode/ModelVisualization/RivTextAnnotationPartMgr.cpp
Normal file
256
ApplicationCode/ModelVisualization/RivTextAnnotationPartMgr.cpp
Normal file
@ -0,0 +1,256 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron 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 "RivTextAnnotationPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaBoundingBoxTools.h"
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivTextAnnotationSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfqtUtils.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotationLocal)
|
||||
: m_rimView(view), m_rimAnnotationLocal(annotationLocal), m_rimAnnotationInView(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotationInView* annotationInView)
|
||||
: m_rimView(view)
|
||||
, m_rimAnnotationLocal(nullptr)
|
||||
, m_rimAnnotationInView(annotationInView)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::~RivTextAnnotationPartMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * displayXf,
|
||||
bool doFlatten,
|
||||
double xOffset)
|
||||
{
|
||||
clearAllGeometry();
|
||||
|
||||
cvf::ref<RivTextAnnotationSourceInfo> sourceInfo = new RivTextAnnotationSourceInfo(rimAnnotation());
|
||||
|
||||
auto collection = annotationCollection();
|
||||
if (!collection) return;
|
||||
|
||||
cvf::Vec3d anchorPositionInDomain = getAnchorPointInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||
cvf::Vec3d labelPositionInDomain = getLabelPointInDomain(collection->snapAnnotations(), collection->annotationPlaneZ());
|
||||
|
||||
cvf::Vec3d anchorPosition = displayXf->transformToDisplayCoord(anchorPositionInDomain);
|
||||
cvf::Vec3d labelPosition = displayXf->transformToDisplayCoord(labelPositionInDomain);
|
||||
QString text = rimAnnotation()->text();
|
||||
|
||||
// Line part
|
||||
{
|
||||
std::vector<cvf::Vec3d> points = { anchorPosition, labelPosition };
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> drawableGeo = RivPolylineGenerator::createLineAlongPolylineDrawable(points);
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(drawableGeo.p());
|
||||
|
||||
caf::MeshEffectGenerator colorEffgen(cvf::Color3f::BLACK);
|
||||
cvf::ref<cvf::Effect> eff = colorEffgen.generateUnCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_linePart = part;
|
||||
}
|
||||
|
||||
// Text part
|
||||
{
|
||||
auto app = RiaApplication::instance();
|
||||
cvf::Font* font = app->customFont();
|
||||
auto prefs = app->preferences();
|
||||
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(font);
|
||||
drawableText->setCheckPosVisible(false);
|
||||
drawableText->setUseDepthBuffer(true);
|
||||
drawableText->setDrawBorder(true);
|
||||
drawableText->setDrawBackground(true);
|
||||
drawableText->setVerticalAlignment(cvf::TextDrawer::BASELINE);
|
||||
drawableText->setBackgroundColor(prefs->defaultViewerBackgroundColor);
|
||||
drawableText->setBorderColor(RiaColorTools::computeOffsetColor(prefs->defaultViewerBackgroundColor, 0.3f));
|
||||
drawableText->setTextColor(cvf::Color3f::BLACK);
|
||||
|
||||
cvf::String cvfString = cvfqt::Utils::toString(text);
|
||||
|
||||
cvf::Vec3f textCoord(labelPosition);
|
||||
drawableText->addText(cvfString, textCoord);
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("RivTextAnnotationPartMgr: " + cvfString);
|
||||
part->setDrawable(drawableText.p());
|
||||
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect();
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_labelPart = part;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::Vec3d RivTextAnnotationPartMgr::getAnchorPointInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
auto pt = rimAnnotation()->anchorPoint();
|
||||
|
||||
if (snapToPlaneZ)
|
||||
{
|
||||
pt.z() = planeZ;
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationPartMgr::Vec3d RivTextAnnotationPartMgr::getLabelPointInDomain(bool snapToPlaneZ, double planeZ)
|
||||
{
|
||||
auto pt = rimAnnotation()->labelPoint();
|
||||
|
||||
if (snapToPlaneZ)
|
||||
{
|
||||
pt.z() = planeZ;
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTextAnnotationPartMgr::isTextInBoundingBox(const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
auto coll = annotationCollection();
|
||||
if (!coll) return false;
|
||||
|
||||
auto effectiveBoundingBox = RiaBoundingBoxTools::inflate(boundingBox, 3);
|
||||
if (effectiveBoundingBox.contains(getAnchorPointInDomain(coll->snapAnnotations(), coll->annotationPlaneZ())) ||
|
||||
effectiveBoundingBox.contains(getLabelPointInDomain(coll->snapAnnotations(), coll->annotationPlaneZ()))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTextAnnotationPartMgr::clearAllGeometry()
|
||||
{
|
||||
m_linePart = nullptr;
|
||||
m_labelPart = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivTextAnnotationPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform * displayXf,
|
||||
const cvf::BoundingBox& boundingBox)
|
||||
{
|
||||
if (!rimAnnotation() || !isAnnotationVisible()) return;
|
||||
|
||||
// Check bounding box
|
||||
if (!isTextInBoundingBox(boundingBox)) return;
|
||||
|
||||
if (!validateAnnotation(rimAnnotation())) return;
|
||||
|
||||
buildParts(displayXf, false, 0.0);
|
||||
model->addPart(m_linePart.p());
|
||||
model->addPart(m_labelPart.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTextAnnotationPartMgr::validateAnnotation(const RimTextAnnotation* annotation) const
|
||||
{
|
||||
return rimAnnotation()->anchorPoint() != cvf::Vec3d::ZERO && !rimAnnotation()->text().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInViewCollection* RivTextAnnotationPartMgr::annotationCollection() const
|
||||
{
|
||||
std::vector<RimAnnotationInViewCollection*> colls;
|
||||
m_rimView->descendantsIncludingThisOfType(colls);
|
||||
return !colls.empty() ? colls.front() : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotation* RivTextAnnotationPartMgr::rimAnnotation() const
|
||||
{
|
||||
return m_rimAnnotationLocal ? m_rimAnnotationLocal : m_rimAnnotationInView->sourceAnnotation();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivTextAnnotationPartMgr::isAnnotationVisible() const
|
||||
{
|
||||
if (m_rimAnnotationLocal)
|
||||
return m_rimAnnotationLocal->isVisible();
|
||||
if(m_rimAnnotationInView)
|
||||
return m_rimAnnotationInView->isVisible();
|
||||
return false;
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "cvfBase.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <cvfVector3.h>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
class Part;
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Font;
|
||||
}
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class Rim3dView;
|
||||
class RimAnnotationInViewCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimTextAnnotationInView;
|
||||
|
||||
class RivTextAnnotationPartMgr : public cvf::Object
|
||||
{
|
||||
using Vec3d = cvf::Vec3d;
|
||||
|
||||
public:
|
||||
RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotation* annotationLocal);
|
||||
RivTextAnnotationPartMgr(Rim3dView* view, RimTextAnnotationInView* annotationInView);
|
||||
~RivTextAnnotationPartMgr() override;
|
||||
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform * displayXf,
|
||||
const cvf::BoundingBox& boundingBox);
|
||||
|
||||
private:
|
||||
void buildParts(const caf::DisplayCoordTransform * displayXf,
|
||||
bool doFlatten,
|
||||
double xOffset);
|
||||
|
||||
Vec3d getAnchorPointInDomain(bool snapToPlaneZ, double planeZ);
|
||||
Vec3d getLabelPointInDomain(bool snapToPlaneZ, double planeZ);
|
||||
|
||||
bool isTextInBoundingBox(const cvf::BoundingBox& boundingBox);
|
||||
|
||||
void clearAllGeometry();
|
||||
bool validateAnnotation(const RimTextAnnotation* annotation) const;
|
||||
|
||||
RimAnnotationInViewCollection* annotationCollection() const;
|
||||
|
||||
RimTextAnnotation* rimAnnotation() const;
|
||||
bool isAnnotationVisible() const;
|
||||
|
||||
caf::PdmPointer<Rim3dView> m_rimView;
|
||||
caf::PdmPointer<RimTextAnnotation> m_rimAnnotationLocal;
|
||||
caf::PdmPointer<RimTextAnnotationInView> m_rimAnnotationInView;
|
||||
cvf::ref<cvf::Part> m_linePart;
|
||||
cvf::ref< cvf::Part > m_labelPart;
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RivTextAnnotationSourceInfo.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextAnnotationSourceInfo::RivTextAnnotationSourceInfo(RimTextAnnotation* annotation)
|
||||
: RivObjectSourceInfo(annotation)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTextAnnotation* RivTextAnnotationSourceInfo::annotation() const
|
||||
{
|
||||
return dynamic_cast<RimTextAnnotation*>( this->object() );
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RivObjectSourceInfo.h"
|
||||
|
||||
class RimTextAnnotation;
|
||||
|
||||
class RivTextAnnotationSourceInfo : public RivObjectSourceInfo
|
||||
{
|
||||
public:
|
||||
RivTextAnnotationSourceInfo(RimTextAnnotation* annotation);
|
||||
|
||||
RimTextAnnotation* annotation() const;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimTextAnnotation> m_annotation;
|
||||
};
|
@ -0,0 +1,53 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollectionBase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollectionBase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationLineAppearance.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLineBasedAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesFromFileAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedPolylinesAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPolylinesAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReachCircleAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTextAnnotationInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAnnotationGroupCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
source_group( "ProjectDataModel\\Annotations" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@ -0,0 +1,269 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RimAnnotationCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "QMessageBox"
|
||||
#include <QString>
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationCollection, "RimAnnotationCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection::RimAnnotationCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/Annotations16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_userDefinedPolylineAnnotations, "UserDefinedPolylineAnnotations", "User Defined Polyline Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_polylineFromFileAnnotations, "PolylineFromFileAnnotations", "Polylines From File", "", "", "");
|
||||
|
||||
m_reachCircleAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_userDefinedPolylineAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_polylineFromFileAnnotations.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_reachCircleAnnotations = new RimAnnotationGroupCollection("Reach Circle Annotations");
|
||||
m_userDefinedPolylineAnnotations = new RimAnnotationGroupCollection("User Defined Polyline Annotations");
|
||||
m_polylineFromFileAnnotations = new RimAnnotationGroupCollection("Polylines From File");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollection::~RimAnnotationCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation(RimReachCircleAnnotation* annotation)
|
||||
{
|
||||
m_reachCircleAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation(RimUserDefinedPolylinesAnnotation* annotation)
|
||||
{
|
||||
|
||||
m_userDefinedPolylineAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::addAnnotation(RimPolylinesFromFileAnnotation* annotation)
|
||||
{
|
||||
m_polylineFromFileAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimReachCircleAnnotation*> RimAnnotationCollection::reachCircleAnnotations() const
|
||||
{
|
||||
std::vector<RimReachCircleAnnotation*> annotations;
|
||||
for (auto& a : m_reachCircleAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimReachCircleAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> RimAnnotationCollection::userDefinedPolylineAnnotations() const
|
||||
{
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> annotations;
|
||||
for (auto& a : m_userDefinedPolylineAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimUserDefinedPolylinesAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylinesFromFileAnnotation*> RimAnnotationCollection::polylinesFromFileAnnotations() const
|
||||
{
|
||||
std::vector<RimPolylinesFromFileAnnotation*> annotations;
|
||||
for (auto& a : m_polylineFromFileAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimPolylinesFromFileAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylinesFromFile(const QStringList& fileNames)
|
||||
{
|
||||
QStringList newFileNames;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polyLinesObjsToReload;
|
||||
|
||||
for(const QString& newFileName : fileNames)
|
||||
{
|
||||
bool isFound = false;
|
||||
for(RimPolylinesFromFileAnnotation* polyLinesAnnot: polylinesFromFileAnnotations())
|
||||
{
|
||||
if(polyLinesAnnot->fileName() == newFileName)
|
||||
{
|
||||
polyLinesObjsToReload.push_back(polyLinesAnnot);
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isFound)
|
||||
{
|
||||
newFileNames.push_back(newFileName);
|
||||
}
|
||||
}
|
||||
|
||||
size_t newLinesIdx = 0;
|
||||
for(const QString& newFileName : newFileNames)
|
||||
{
|
||||
RimPolylinesFromFileAnnotation* newPolyLinesAnnot = new RimPolylinesFromFileAnnotation;
|
||||
|
||||
auto newColor = RiaColorTables::categoryPaletteColors().cycledColor3f(lineBasedAnnotationsCount());
|
||||
|
||||
newPolyLinesAnnot->setFileName(newFileName);
|
||||
newPolyLinesAnnot->setDescriptionFromFileName();
|
||||
newPolyLinesAnnot->appearance()->setColor(newColor);
|
||||
|
||||
m_polylineFromFileAnnotations->addAnnotation(newPolyLinesAnnot);
|
||||
polyLinesObjsToReload.push_back(newPolyLinesAnnot);
|
||||
|
||||
++newLinesIdx;
|
||||
}
|
||||
|
||||
reloadPolylinesFromFile(polyLinesObjsToReload);
|
||||
|
||||
if (!newFileNames.empty())
|
||||
{
|
||||
return polylinesFromFileAnnotations().back();
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimAnnotationCollection::lineBasedAnnotationsCount() const
|
||||
{
|
||||
return m_reachCircleAnnotations->annotations().size() +
|
||||
m_userDefinedPolylineAnnotations->annotations().size() +
|
||||
m_polylineFromFileAnnotations->annotations().size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Update view-local annotation collections, to mirror the state in the global collection (this collection)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::updateViewAnnotationCollections()
|
||||
{
|
||||
auto views = gridViewsContainingAnnotations();
|
||||
|
||||
for (const auto* view : views)
|
||||
{
|
||||
view->annotationCollection()->onGlobalCollectionChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::onAnnotationDeleted()
|
||||
{
|
||||
updateViewAnnotationCollections();
|
||||
RimAnnotationCollectionBase::onAnnotationDeleted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> RimAnnotationCollection::allPdmAnnotations() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> all;
|
||||
all.insert(all.end(), m_textAnnotations->m_annotations.begin(), m_textAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_reachCircleAnnotations->m_annotations.begin(), m_reachCircleAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_userDefinedPolylineAnnotations->m_annotations.begin(), m_userDefinedPolylineAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_polylineFromFileAnnotations->m_annotations.begin(), m_polylineFromFileAnnotations->m_annotations.end());
|
||||
return all;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload)
|
||||
{
|
||||
QString totalErrorMessage;
|
||||
|
||||
for ( RimPolylinesFromFileAnnotation* polyLinesAnnot: polyLinesObjsToReload )
|
||||
{
|
||||
QString errormessage;
|
||||
|
||||
polyLinesAnnot->readPolyLinesFile(&errormessage);
|
||||
if ( !errormessage.isEmpty() )
|
||||
{
|
||||
totalErrorMessage += "\nError in: " + polyLinesAnnot->fileName()
|
||||
+ "\n\t" + errormessage;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !totalErrorMessage.isEmpty() )
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Import Polylines", totalErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollection::loadDataAndUpdate()
|
||||
{
|
||||
reloadPolylinesFromFile(polylinesFromFileAnnotations());
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QString;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimReachCircleAnnotation;
|
||||
class RimUserDefinedPolylinesAnnotation;
|
||||
class RimPolylinesFromFileAnnotation;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationCollection : public RimAnnotationCollectionBase
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimAnnotationCollection();
|
||||
~RimAnnotationCollection() override;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void addAnnotation(RimReachCircleAnnotation* annotation);
|
||||
void addAnnotation(RimUserDefinedPolylinesAnnotation* annotation);
|
||||
void addAnnotation(RimPolylinesFromFileAnnotation* annotation);
|
||||
|
||||
std::vector<RimReachCircleAnnotation*> reachCircleAnnotations() const;
|
||||
std::vector<RimUserDefinedPolylinesAnnotation*> userDefinedPolylineAnnotations() const;
|
||||
std::vector<RimPolylinesFromFileAnnotation*> polylinesFromFileAnnotations() const;
|
||||
|
||||
RimPolylinesFromFileAnnotation* importOrUpdatePolylinesFromFile(const QStringList& fileNames );
|
||||
|
||||
size_t lineBasedAnnotationsCount() const;
|
||||
|
||||
void updateViewAnnotationCollections() override;
|
||||
void onAnnotationDeleted() override;
|
||||
|
||||
// Used by sync code
|
||||
std::vector<caf::PdmObject*> allPdmAnnotations() const;
|
||||
|
||||
private:
|
||||
void reloadPolylinesFromFile(const std::vector<RimPolylinesFromFileAnnotation *>& polyLinesObjsToReload);
|
||||
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_reachCircleAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_userDefinedPolylineAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_polylineFromFileAnnotations;
|
||||
};
|
@ -0,0 +1,165 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RimAnnotationCollectionBase.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
|
||||
#include "QMessageBox"
|
||||
#include <QString>
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationCollectionBase, "RimAnnotationCollectionBase");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollectionBase::RimAnnotationCollectionBase()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "");
|
||||
|
||||
m_textAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_textAnnotations = new RimAnnotationGroupCollection("Text Annotations");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationCollectionBase::~RimAnnotationCollectionBase()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationCollectionBase::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::addAnnotation(RimTextAnnotation* annotation)
|
||||
{
|
||||
m_textAnnotations->addAnnotation(annotation);
|
||||
updateViewAnnotationCollections();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimTextAnnotation*> RimAnnotationCollectionBase::textAnnotations() const
|
||||
{
|
||||
std::vector<RimTextAnnotation*> annotations;
|
||||
for (auto& a : m_textAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimTextAnnotation*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::updateViewAnnotationCollections()
|
||||
{
|
||||
// Default implementation: No op
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// At least one annotation have been deleted. Typically by the generic delete command
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::onAnnotationDeleted()
|
||||
{
|
||||
scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::scheduleRedrawOfRelevantViews()
|
||||
{
|
||||
// Todo: Do a Bounding Box check to see if this annotation actually is relevant for the view
|
||||
|
||||
auto views = gridViewsContainingAnnotations();
|
||||
if ( !views.empty() )
|
||||
{
|
||||
for ( auto& view : views )
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridView*> RimAnnotationCollectionBase::gridViewsContainingAnnotations() const
|
||||
{
|
||||
std::vector<RimGridView*> views;
|
||||
RimProject* project = nullptr;
|
||||
this->firstAncestorOrThisOfType(project);
|
||||
|
||||
if (!project) return views;
|
||||
|
||||
std::vector<RimGridView*> visibleGridViews;
|
||||
project->allVisibleGridViews(visibleGridViews);
|
||||
|
||||
for (auto& gridView : visibleGridViews)
|
||||
{
|
||||
/*if (gridView->annotationCollection()->annotationsCount() > 0)*/ views.push_back(gridView);
|
||||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationCollectionBase::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationCollectionBase::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QString;
|
||||
class RimTextAnnotation;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationCollectionBase : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimAnnotationCollectionBase();
|
||||
~RimAnnotationCollectionBase() override;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
void addAnnotation(RimTextAnnotation* annotation);
|
||||
|
||||
std::vector<RimTextAnnotation*> textAnnotations() const;
|
||||
|
||||
virtual void updateViewAnnotationCollections();
|
||||
virtual void onAnnotationDeleted();
|
||||
|
||||
void scheduleRedrawOfRelevantViews();
|
||||
std::vector<RimGridView*> gridViewsContainingAnnotations() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_textAnnotations;
|
||||
};
|
@ -0,0 +1,146 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RimAnnotationGroupCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "QMessageBox"
|
||||
#include <QString>
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationGroupCollection, "RimAnnotationGroupCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationGroupCollection::RimAnnotationGroupCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_title, "Title", QString("Annotations"), "Title", "", "", "");
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", "Annotations", "", "", "");
|
||||
|
||||
m_annotations.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationGroupCollection::RimAnnotationGroupCollection(const QString& title)
|
||||
: RimAnnotationGroupCollection()
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationGroupCollection::~RimAnnotationGroupCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::setTitle(const QString& title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationGroupCollection::isActive() const
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationGroupCollection::isVisible() const
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
bool visible = true;
|
||||
if (coll) visible = coll->isActive();
|
||||
if (visible) visible = m_isActive;
|
||||
return visible;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::addAnnotation(caf::PdmObject* annotation)
|
||||
{
|
||||
m_annotations.push_back(annotation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> RimAnnotationGroupCollection::annotations() const
|
||||
{
|
||||
return m_annotations.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationGroupCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
if(coll) coll->scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationGroupCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimAnnotationGroupCollection::userDescriptionField()
|
||||
{
|
||||
return &m_title;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QString;
|
||||
class RimTextAnnotation;
|
||||
class RimGridView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationGroupCollection : public caf::PdmObject
|
||||
{
|
||||
friend class RimAnnotationCollection;
|
||||
friend class RimAnnotationInViewCollection;
|
||||
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimAnnotationGroupCollection();
|
||||
RimAnnotationGroupCollection(const QString& title);
|
||||
~RimAnnotationGroupCollection() override;
|
||||
|
||||
void setTitle(const QString& title);
|
||||
bool isActive() const;
|
||||
bool isVisible() const;
|
||||
|
||||
void addAnnotation(caf::PdmObject* annotation);
|
||||
std::vector<caf::PdmObject*> annotations() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField<QString> m_title;
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildArrayField<caf::PdmObject*> m_annotations;
|
||||
};
|
@ -0,0 +1,365 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "RimAnnotationInViewCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationGroupCollection.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimReachCircleAnnotation.h"
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "RimPolylinesFromFileAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
#include "RimReachCircleAnnotationInView.h"
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
|
||||
#include <cvfBoundingBox.h>
|
||||
|
||||
#include <cafPdmUiDoubleSliderEditor.h>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal function
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* sourcePdmAnnotation(const caf::PdmObject* annotationInView)
|
||||
{
|
||||
auto t = dynamic_cast<const RimTextAnnotationInView*>(annotationInView);
|
||||
if (t)
|
||||
{
|
||||
return t->sourceAnnotation();
|
||||
}
|
||||
|
||||
auto c = dynamic_cast<const RimReachCircleAnnotationInView*>(annotationInView);
|
||||
if (c)
|
||||
{
|
||||
return c->sourceAnnotation();
|
||||
}
|
||||
|
||||
auto up = dynamic_cast<const RimUserDefinedPolylinesAnnotationInView*>(annotationInView);
|
||||
if (up)
|
||||
{
|
||||
return up->sourceAnnotation();
|
||||
}
|
||||
|
||||
auto pf = dynamic_cast<const RimPolylinesFromFileAnnotationInView*>(annotationInView);
|
||||
if (pf)
|
||||
{
|
||||
return pf->sourceAnnotation();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationInViewCollection, "Annotations");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInViewCollection::RimAnnotationInViewCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Annotations", ":/Annotations16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_annotationPlaneDepth, "AnnotationPlaneDepth", 0.0, "Annotation Plane Depth", "", "", "");
|
||||
CAF_PDM_InitField(&m_snapAnnotations, "SnapAnnotations", false, "Snap Annotations to Plane", "", "", "");
|
||||
|
||||
m_annotationPlaneDepth.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
m_annotationPlaneDepth.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LabelPosType::TOP);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalTextAnnotations, "TextAnnotationsInView", "Global Text Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalReachCircleAnnotations, "ReachCircleAnnotationsInView", "Global Reach Circle Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalUserDefinedPolylineAnnotations, "UserDefinedPolylinesAnnotationsInView", "Global User Defined Polylines Annotations", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_globalPolylineFromFileAnnotations, "PolylinesFromFileAnnotationsInView", "Global Polylines From File Annotations", "", "", "");
|
||||
|
||||
m_globalTextAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_globalReachCircleAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_globalUserDefinedPolylineAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_globalPolylineFromFileAnnotations.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_globalTextAnnotations = new RimAnnotationGroupCollection("Global Text Annotations");
|
||||
m_globalReachCircleAnnotations = new RimAnnotationGroupCollection("Global Reach Circle Annotations");
|
||||
m_globalUserDefinedPolylineAnnotations = new RimAnnotationGroupCollection("Global User Defined Polylines Annotations");
|
||||
m_globalPolylineFromFileAnnotations = new RimAnnotationGroupCollection("Global Polylines From File Annotations");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationInViewCollection::~RimAnnotationInViewCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimAnnotationInViewCollection::annotationPlaneZ() const
|
||||
{
|
||||
return -m_annotationPlaneDepth();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationInViewCollection::snapAnnotations() const
|
||||
{
|
||||
return m_snapAnnotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimTextAnnotationInView*> RimAnnotationInViewCollection::globalTextAnnotations() const
|
||||
{
|
||||
std::vector<RimTextAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalTextAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimTextAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimReachCircleAnnotationInView*> RimAnnotationInViewCollection::globalReachCircleAnnotations() const
|
||||
{
|
||||
std::vector<RimReachCircleAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalReachCircleAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimReachCircleAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimUserDefinedPolylinesAnnotationInView*> RimAnnotationInViewCollection::globalUserDefinedPolylineAnnotations() const
|
||||
{
|
||||
std::vector<RimUserDefinedPolylinesAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalUserDefinedPolylineAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimUserDefinedPolylinesAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylinesFromFileAnnotationInView*> RimAnnotationInViewCollection::globalPolylineFromFileAnnotations() const
|
||||
{
|
||||
std::vector<RimPolylinesFromFileAnnotationInView*> annotations;
|
||||
for (auto& a : m_globalPolylineFromFileAnnotations->annotations())
|
||||
{
|
||||
annotations.push_back(dynamic_cast<RimPolylinesFromFileAnnotationInView*>(a));
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Called when the global annotation collection has changed
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::onGlobalCollectionChanged(const RimAnnotationCollection* globalCollection)
|
||||
{
|
||||
// Sync annotations from global annotation collection
|
||||
auto globals = globalCollection->allPdmAnnotations();
|
||||
auto locals = allGlobalPdmAnnotations();
|
||||
std::vector<const caf::PdmObject*> globalAnnotationsToDelete;
|
||||
std::set<caf::PdmObject*> globalsSet(globals.begin(), globals.end());
|
||||
|
||||
for(const auto local : locals)
|
||||
{
|
||||
auto sourceAnnotation = sourcePdmAnnotation(local);
|
||||
if (globalsSet.count(sourceAnnotation) > 0)
|
||||
{
|
||||
globalsSet.erase(sourceAnnotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalAnnotationsToDelete.push_back(local);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove deleted global annotations
|
||||
for(auto a : globalAnnotationsToDelete)
|
||||
{
|
||||
deleteGlobalAnnotation(a);
|
||||
}
|
||||
|
||||
// Add newly added global annotations
|
||||
for (const auto& global : globalsSet)
|
||||
{
|
||||
addGlobalAnnotation(global);
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimAnnotationInViewCollection::annotationsCount() const
|
||||
{
|
||||
return m_textAnnotations->m_annotations.size() + allGlobalPdmAnnotations().size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_snapAnnotations);
|
||||
if(m_snapAnnotations())
|
||||
uiOrdering.add(&m_annotationPlaneDepth);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &m_annotationPlaneDepth)
|
||||
{
|
||||
auto* attr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
|
||||
if (attr)
|
||||
{
|
||||
RimCase* rimCase;
|
||||
firstAncestorOrThisOfType(rimCase);
|
||||
|
||||
if (rimCase)
|
||||
{
|
||||
auto bb = rimCase->allCellsBoundingBox();
|
||||
attr->m_minimum = -bb.max().z();
|
||||
attr->m_maximum = -bb.min().z();
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = 10000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObject*> RimAnnotationInViewCollection::allGlobalPdmAnnotations() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> all;
|
||||
all.insert(all.end(), m_globalTextAnnotations->m_annotations.begin(), m_globalTextAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_globalReachCircleAnnotations->m_annotations.begin(), m_globalReachCircleAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_globalUserDefinedPolylineAnnotations->m_annotations.begin(), m_globalUserDefinedPolylineAnnotations->m_annotations.end());
|
||||
all.insert(all.end(), m_globalPolylineFromFileAnnotations->m_annotations.begin(), m_globalPolylineFromFileAnnotations->m_annotations.end());
|
||||
return all;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::addGlobalAnnotation(caf::PdmObject* annotation)
|
||||
{
|
||||
auto t = dynamic_cast<RimTextAnnotation*>(annotation);
|
||||
if (t)
|
||||
{
|
||||
m_globalTextAnnotations->addAnnotation(new RimTextAnnotationInView(t));
|
||||
return;
|
||||
}
|
||||
|
||||
auto c = dynamic_cast< RimReachCircleAnnotation*>(annotation);
|
||||
if (c)
|
||||
{
|
||||
m_globalReachCircleAnnotations->addAnnotation(new RimReachCircleAnnotationInView(c));
|
||||
return;
|
||||
}
|
||||
|
||||
auto up = dynamic_cast<RimUserDefinedPolylinesAnnotation*>(annotation);
|
||||
if (up)
|
||||
{
|
||||
m_globalUserDefinedPolylineAnnotations->addAnnotation(new RimUserDefinedPolylinesAnnotationInView(up));
|
||||
return;
|
||||
}
|
||||
|
||||
auto pf = dynamic_cast<RimPolylinesFromFileAnnotation*>(annotation);
|
||||
if (pf)
|
||||
{
|
||||
m_globalPolylineFromFileAnnotations->addAnnotation(new RimPolylinesFromFileAnnotationInView(pf));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::deleteGlobalAnnotation(const caf::PdmObject* annotation)
|
||||
{
|
||||
for(size_t i = 0; i < m_globalTextAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalTextAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalTextAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_globalReachCircleAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalReachCircleAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalReachCircleAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_globalUserDefinedPolylineAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalUserDefinedPolylineAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalUserDefinedPolylineAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_globalPolylineFromFileAnnotations->m_annotations.size(); i++)
|
||||
{
|
||||
if (m_globalPolylineFromFileAnnotations->m_annotations[i] == annotation)
|
||||
{
|
||||
m_globalPolylineFromFileAnnotations->m_annotations.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "RimAnnotationCollectionBase.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
class RimAnnotationCollection;
|
||||
class RimAnnotationGroupCollection;
|
||||
class RimTextAnnotation;
|
||||
class RimTextAnnotationInView;
|
||||
class RimReachCircleAnnotationInView;
|
||||
class RimUserDefinedPolylinesAnnotationInView;
|
||||
class RimPolylinesFromFileAnnotationInView;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationInViewCollection : public RimAnnotationCollectionBase
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
|
||||
RimAnnotationInViewCollection();
|
||||
~RimAnnotationInViewCollection() override;
|
||||
|
||||
double annotationPlaneZ() const;
|
||||
bool snapAnnotations() const;
|
||||
|
||||
std::vector<RimTextAnnotationInView*> globalTextAnnotations() const;
|
||||
std::vector<RimReachCircleAnnotationInView*> globalReachCircleAnnotations() const;
|
||||
std::vector<RimUserDefinedPolylinesAnnotationInView*> globalUserDefinedPolylineAnnotations() const;
|
||||
std::vector<RimPolylinesFromFileAnnotationInView*> globalPolylineFromFileAnnotations() const;
|
||||
|
||||
void onGlobalCollectionChanged(const RimAnnotationCollection* globalCollection);
|
||||
size_t annotationsCount() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
private:
|
||||
std::vector<caf::PdmObject*> allGlobalPdmAnnotations() const;
|
||||
void addGlobalAnnotation(caf::PdmObject* annotation);
|
||||
void deleteGlobalAnnotation(const caf::PdmObject* annotation);
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_annotationPlaneDepth;
|
||||
caf::PdmField<bool> m_snapAnnotations;
|
||||
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalTextAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalReachCircleAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalUserDefinedPolylineAnnotations;
|
||||
caf::PdmChildField<RimAnnotationGroupCollection*> m_globalPolylineFromFileAnnotations;
|
||||
|
||||
|
||||
};
|
@ -0,0 +1,147 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "RimAnnotationLineAppearance.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "RifWellPathFormationsImporter.h"
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
#include "cafPdmUiEditorHandle.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RimAnnotationLineAppearance::LineStyle::setUp()
|
||||
{
|
||||
addItem(RimAnnotationLineAppearance::STYLE_SOLID, "STYLE_SOLID", "Solid");
|
||||
addItem(RimAnnotationLineAppearance::STYLE_DASH, "STYLE_DASH", "Dashes");
|
||||
|
||||
setDefault(RimAnnotationLineAppearance::STYLE_SOLID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnnotationLineAppearance, "RimAnnotationLineAppearance");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationLineAppearance::RimAnnotationLineAppearance()
|
||||
{
|
||||
CAF_PDM_InitObject("TextAnnotation", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_color, "Color", cvf::Color3f(cvf::Color3f::BLACK), "Color", "", "", "");
|
||||
CAF_PDM_InitField(&m_thickness, "Thickness", 2, "Thickness", "", "", "");
|
||||
|
||||
// Stippling not yet supported. Needs new stuff in VizFwk
|
||||
CAF_PDM_InitField(&m_style, "Style", LineStyle(), "Style", "", "", "");
|
||||
m_style.uiCapability()->setUiHidden(true);
|
||||
m_style.xmlCapability()->disableIO();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationLineAppearance::setColor(const cvf::Color3f& newColor)
|
||||
{
|
||||
m_color = newColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimAnnotationLineAppearance::color() const
|
||||
{
|
||||
return m_color();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnnotationLineAppearance::isDashed() const
|
||||
{
|
||||
return m_style() == STYLE_DASH;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimAnnotationLineAppearance::thickness() const
|
||||
{
|
||||
return m_thickness();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationLineAppearance::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_color);
|
||||
uiOrdering.add(&m_style);
|
||||
uiOrdering.add(&m_thickness);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationLineAppearance::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
RimAnnotationCollection* annColl = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(annColl);
|
||||
annColl->scheduleRedrawOfRelevantViews();
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "cafAppEnum.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnnotationLineAppearance : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum LineStyleEnum
|
||||
{
|
||||
STYLE_SOLID,
|
||||
STYLE_DASH
|
||||
};
|
||||
typedef caf::AppEnum<LineStyleEnum> LineStyle;
|
||||
|
||||
public:
|
||||
RimAnnotationLineAppearance();
|
||||
void setColor(const cvf::Color3f& newColor);
|
||||
cvf::Color3f color() const;
|
||||
bool isDashed() const;
|
||||
int thickness() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
caf::PdmField<LineStyle> m_style;
|
||||
caf::PdmField<int> m_thickness;
|
||||
|
||||
};
|
||||
|
@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "RimAnnotationLineAppearance.h"
|
||||
#include "RimAnnotationCollectionBase.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimLineBasedAnnotation, "RimLineBasedAnnotation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimLineBasedAnnotation::RimLineBasedAnnotation()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&m_appearance, "LineAppearance", "Line Appearance", "", "", "");
|
||||
|
||||
m_appearance = new RimAnnotationLineAppearance();
|
||||
m_appearance.uiCapability()->setUiTreeHidden(true);
|
||||
m_appearance.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "IsActive", true, "Is Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnnotationLineAppearance* RimLineBasedAnnotation::appearance() const
|
||||
{
|
||||
return m_appearance;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimLineBasedAnnotation::isActive()
|
||||
{
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimLineBasedAnnotation::isVisible()
|
||||
{
|
||||
RimAnnotationCollectionBase* coll;
|
||||
firstAncestorOrThisOfType(coll);
|
||||
|
||||
return coll && coll->isActive() && m_isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimLineBasedAnnotation::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor 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 "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class RimGridView;
|
||||
class RimAnnotationLineAppearance;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimLineBasedAnnotation : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimLineBasedAnnotation();
|
||||
RimAnnotationLineAppearance* appearance() const;
|
||||
|
||||
bool isActive();
|
||||
bool isVisible();
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimAnnotationLineAppearance*> m_appearance;
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RimPolylinesAnnotation.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "QFile"
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "QFileInfo"
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT(RimPolylinesAnnotation, "RimPolylinesAnnotation");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotation::RimPolylinesAnnotation()
|
||||
{
|
||||
CAF_PDM_InitObject("PolylineAnnotation", ":/WellCollection.png", "", "");
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylinesAnnotation::~RimPolylinesAnnotation()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- equinor 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 "RimLineBasedAnnotation.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RigPolyLinesData;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPolylinesAnnotation : public RimLineBasedAnnotation
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimPolylinesAnnotation();
|
||||
~RimPolylinesAnnotation();
|
||||
|
||||
virtual cvf::ref<RigPolyLinesData> polyLinesData() = 0;
|
||||
virtual bool isEmpty() = 0;
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user