diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc
index 32ff262ffc..1a1b8b97d9 100644
--- a/ApplicationExeCode/Resources/ResInsight.qrc
+++ b/ApplicationExeCode/Resources/ResInsight.qrc
@@ -277,14 +277,15 @@
SeismicDelta16x16.png
SeismicView16x16.png
SeismicView24x24.png
- SeismicViews24x24.png
- SeismicData24x24.png
- SeismicSection16x16.png
- Fullscreen.png
+ SeismicViews24x24.png
+ SeismicData24x24.png
+ SeismicSection16x16.png
+ Fullscreen.png
plot-template-standard.svg
plot-template-ensemble.svg
decline-curve.svg
regression-curve.svg
+ padlock.svg
fs_CellFace.glsl
diff --git a/ApplicationExeCode/Resources/padlock.svg b/ApplicationExeCode/Resources/padlock.svg
new file mode 100644
index 0000000000..5009f6cebf
--- /dev/null
+++ b/ApplicationExeCode/Resources/padlock.svg
@@ -0,0 +1,11 @@
+
+
+
\ No newline at end of file
diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp
index 98f8af811e..7bef9598e1 100644
--- a/ApplicationLibCode/Application/RiaApplication.cpp
+++ b/ApplicationLibCode/Application/RiaApplication.cpp
@@ -662,7 +662,10 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
}
}
- setActiveReservoirView( riv );
+ if ( riv->showWindow() )
+ {
+ setActiveReservoirView( riv );
+ }
RimGridView* rigv = dynamic_cast( riv );
if ( rigv ) rigv->cellFilterCollection()->updateIconState();
diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilter3dviewFeature.cpp b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilter3dviewFeature.cpp
index a33936e93f..def2a95673 100644
--- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilter3dviewFeature.cpp
+++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilter3dviewFeature.cpp
@@ -48,7 +48,7 @@ void RicNewPolygonFilter3dviewFeature::onActionTriggered( bool isChecked )
// and the case to use
RimCase* sourceCase = viewOrComparisonView->ownerCase();
- RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
+ RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase, nullptr );
if ( lastCreatedOrUpdated )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp
index 343d8ed97c..8ffa493ef8 100644
--- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp
+++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.cpp
@@ -18,10 +18,14 @@
#include "RicNewPolygonFilterFeature.h"
+#include "RiaApplication.h"
+
+#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonInView.h"
#include "RimCase.h"
#include "RimCellFilterCollection.h"
+#include "RimGridView.h"
#include "RimPolygonFilter.h"
#include "Riu3DMainWindowTools.h"
@@ -38,16 +42,31 @@ CAF_CMD_SOURCE_INIT( RicNewPolygonFilterFeature, "RicNewPolygonFilterFeature" );
//--------------------------------------------------------------------------------------------------
void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
{
- // Find the selected Cell Filter Collection
- std::vector colls = caf::selectedObjectsByTypeStrict();
- if ( colls.empty() ) return;
- RimCellFilterCollection* filtColl = colls[0];
+ auto cellFilterCollection = caf::SelectionManager::instance()->selectedItemOfType();
+
+ if ( !cellFilterCollection )
+ {
+ RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
+ if ( activeView )
+ {
+ cellFilterCollection = activeView->cellFilterCollection();
+ }
+ }
+
+ if ( !cellFilterCollection ) return;
+
+ auto polygon = caf::SelectionManager::instance()->selectedItemOfType();
+ if ( !polygon )
+ {
+ if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType() )
+ {
+ polygon = polygonInView->polygon();
+ }
+ }
- // and the case to use
- RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted();
+ auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted();
- RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
- if ( lastCreatedOrUpdated )
+ if ( auto lastCreatedOrUpdated = cellFilterCollection->addNewPolygonFilter( sourceCase, polygon ) )
{
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
}
diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CrossSectionCommands/CMakeLists_files.cmake
index d1a18ed21d..bb0d00bef9 100644
--- a/ApplicationLibCode/Commands/CrossSectionCommands/CMakeLists_files.cmake
+++ b/ApplicationLibCode/Commands/CrossSectionCommands/CMakeLists_files.cmake
@@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.h
+ ${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonIntersectionFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.cpp
+ ${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonIntersectionFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp
new file mode 100644
index 0000000000..3ee2f4e7a3
--- /dev/null
+++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.cpp
@@ -0,0 +1,68 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2024 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicNewPolygonIntersectionFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RimExtrudedCurveIntersection.h"
+#include "RimGridView.h"
+#include "RimIntersectionCollection.h"
+
+#include "Polygons/RimPolygon.h"
+#include "Polygons/RimPolygonInView.h"
+
+#include "cafSelectionManager.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT( RicNewPolygonIntersectionFeature, "RicNewPolygonIntersectionFeature" );
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicNewPolygonIntersectionFeature::onActionTriggered( bool isChecked )
+{
+ RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
+ if ( !activeView ) return;
+
+ auto collection = activeView->intersectionCollection();
+ if ( !collection ) return;
+
+ auto polygon = caf::SelectionManager::instance()->selectedItemOfType();
+ if ( !polygon )
+ {
+ if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType() )
+ {
+ polygon = polygonInView->polygon();
+ }
+ }
+
+ auto intersection = new RimExtrudedCurveIntersection();
+ intersection->configureForProjectPolyLine( polygon );
+ collection->appendIntersectionAndUpdate( intersection );
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicNewPolygonIntersectionFeature::setupActionLook( QAction* actionToSetup )
+{
+ actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
+ actionToSetup->setText( "Create Polygon Intersection" );
+}
diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h
new file mode 100644
index 0000000000..f06741ab06
--- /dev/null
+++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewPolygonIntersectionFeature.h
@@ -0,0 +1,33 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2024 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicNewPolygonIntersectionFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ void onActionTriggered( bool isChecked ) override;
+ void setupActionLook( QAction* actionToSetup ) override;
+};
diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp
index 445ead3336..180db89511 100644
--- a/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp
+++ b/ApplicationLibCode/Commands/SeismicCommands/RicSeismicSectionFromIntersectionFeature.cpp
@@ -47,6 +47,7 @@ bool RicSeismicSectionFromIntersectionFeature::isCommandEnabled() const
if ( intersection != nullptr )
{
return ( ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE ) ||
+ ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYGON ) ||
( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH ) );
}
@@ -70,7 +71,8 @@ void RicSeismicSectionFromIntersectionFeature::onActionTriggered( bool isChecked
RimSeismicSection* newSection = seisColl->addNewSection();
if ( !newSection ) return;
- if ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE )
+ if ( ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE ) ||
+ ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYGON ) )
{
newSection->setSectionType( RiaDefines::SeismicSectionType::SS_POLYLINE );
newSection->setUserDescription( intersection->name() );
diff --git a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.cpp b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.cpp
index f67db7f3ff..2c0c094dd0 100644
--- a/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.cpp
+++ b/ApplicationLibCode/Commands/WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.cpp
@@ -62,7 +62,7 @@ void RicPolyline3dEditor::configureAndUpdateUi( const QString& uiConfigName )
}
m_targetEditors.clear();
- if ( !pickerInterface ) return;
+ if ( !pickerInterface || !pickerInterface->pickEventHandler() ) return;
if ( pickerInterface->pickingEnabled() )
{
diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicIntersectionPickEventHandler.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicIntersectionPickEventHandler.cpp
index bcdb1233c1..b699df4383 100644
--- a/ApplicationLibCode/Commands/WellPathCommands/RicIntersectionPickEventHandler.cpp
+++ b/ApplicationLibCode/Commands/WellPathCommands/RicIntersectionPickEventHandler.cpp
@@ -44,44 +44,41 @@ bool RicIntersectionPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& e
std::vector selection;
caf::SelectionManager::instance()->objectsByType( &selection );
- if ( selection.size() == 1 )
+ if ( selection.size() != 1 ) return false;
+
+ RimExtrudedCurveIntersection* intersection = selection[0];
+
+ RimGridView* gridView = intersection->firstAncestorOrThisOfTypeAsserted();
+
+ if ( RiaApplication::instance()->activeMainOrComparisonGridView() != gridView )
+ {
+ return false;
+ }
+
+ cvf::ref transForm = gridView->displayCoordTransform();
+
+ cvf::Vec3d domainCoord = transForm->transformToDomainCoord( eventObject.m_pickItemInfos.front().globalPickedPoint() );
+
+ if ( intersection->inputPolyLineFromViewerEnabled() )
{
- {
- RimExtrudedCurveIntersection* intersection = selection[0];
-
- RimGridView* gridView = intersection->firstAncestorOrThisOfTypeAsserted();
-
- if ( RiaApplication::instance()->activeMainOrComparisonGridView() != gridView )
- {
- return false;
- }
-
- cvf::ref transForm = gridView->displayCoordTransform();
-
- cvf::Vec3d domainCoord = transForm->transformToDomainCoord( eventObject.m_pickItemInfos.front().globalPickedPoint() );
-
- if ( intersection->inputPolyLineFromViewerEnabled() )
- {
- intersection->appendPointToPolyLine( domainCoord );
-
- // Further Ui processing is stopped when true is returned
- return true;
- }
- else if ( intersection->inputExtrusionPointsFromViewerEnabled() )
- {
- intersection->appendPointToExtrusionDirection( domainCoord );
-
- // Further Ui processing is stopped when true is returned
- return true;
- }
- else if ( intersection->inputTwoAzimuthPointsFromViewerEnabled() )
- {
- intersection->appendPointToAzimuthLine( domainCoord );
-
- // Further Ui processing is stopped when true is returned
- return true;
- }
- }
+ intersection->appendPointToPolyLine( domainCoord );
+
+ // Further Ui processing is stopped when true is returned
+ return true;
+ }
+ else if ( intersection->inputExtrusionPointsFromViewerEnabled() )
+ {
+ intersection->appendPointToExtrusionDirection( domainCoord );
+
+ // Further Ui processing is stopped when true is returned
+ return true;
+ }
+ else if ( intersection->inputTwoAzimuthPointsFromViewerEnabled() )
+ {
+ intersection->appendPointToAzimuthLine( domainCoord );
+
+ // Further Ui processing is stopped when true is returned
+ return true;
}
return false;
diff --git a/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp
index 95b7a54332..d7c15ced50 100644
--- a/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp
+++ b/ApplicationLibCode/ModelVisualization/RivPolylinePartMgr.cpp
@@ -82,7 +82,7 @@ bool RivPolylinePartMgr::isPolylinesInBoundingBox( std::vectorpolyLinesData();
- if ( polylineDef.isNull() || polylineDef->polyLines().empty() )
+ if ( polylineDef.isNull() || polylineDef->rawPolyLines().empty() )
{
clearAllGeometry();
return;
@@ -192,7 +192,7 @@ void RivPolylinePartMgr::buildPolylineParts( const caf::DisplayCoordTransform* d
//--------------------------------------------------------------------------------------------------
std::vector> RivPolylinePartMgr::getPolylinesPointsInDomain( RigPolyLinesData* lineDef )
{
- auto polylines = lineDef->polyLines();
+ auto polylines = lineDef->rawPolyLines();
if ( !lineDef->lockToZPlane() ) return polylines;
const double planeZ = lineDef->lockedZValue();
diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp
index a78843ddd0..ca7a0c6efc 100644
--- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp
@@ -158,7 +158,7 @@ bool RimPolylinesFromFileAnnotation::isEmpty()
{
if ( m_polyLinesData.isNull() ) return true;
- for ( const std::vector& line : m_polyLinesData->polyLines() )
+ for ( const std::vector& line : m_polyLinesData->rawPolyLines() )
{
if ( !line.empty() ) return false;
}
diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp
index ef0c5feaf8..c6b0c38d64 100644
--- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp
+++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp
@@ -145,6 +145,12 @@ void RimCellFilterCollection::fieldChangedByUi( const caf::PdmFieldHandle* chang
uiCapability()->updateConnectedEditors();
onFilterUpdated( nullptr );
+
+ for ( const auto& filter : m_cellFilters )
+ {
+ // Update the filters to make sure the 3D polygon targets are removed if the filter collection is disabled
+ filter->updateConnectedEditors();
+ }
}
//--------------------------------------------------------------------------------------------------
@@ -255,13 +261,22 @@ bool RimCellFilterCollection::hasActiveIncludeRangeFilters() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-RimPolygonFilter* RimCellFilterCollection::addNewPolygonFilter( RimCase* srcCase )
+RimPolygonFilter* RimCellFilterCollection::addNewPolygonFilter( RimCase* srcCase, RimPolygon* polygon )
{
RimPolygonFilter* pFilter = new RimPolygonFilter();
pFilter->setCase( srcCase );
+ pFilter->setPolygon( polygon );
addFilter( pFilter );
pFilter->configurePolygonEditor();
- pFilter->enablePicking( true );
+ if ( polygon )
+ {
+ pFilter->enableFilter( true );
+ }
+ else
+ {
+ pFilter->enablePicking( true );
+ }
+
onFilterUpdated( pFilter );
return pFilter;
}
@@ -490,12 +505,14 @@ void RimCellFilterCollection::updateCellVisibilityByIndex( cvf::UByteArray* incl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-std::vector RimCellFilterCollection::cellFilterPolygons() const
+std::vector RimCellFilterCollection::enabledCellFilterPolygons() const
{
std::vector polyInView;
for ( const auto& filter : m_cellFilters )
{
+ if ( !filter->isActive() ) continue;
+
if ( auto polygonFilter = dynamic_cast( filter.p() ) )
{
polyInView.push_back( polygonFilter->polygonInView() );
diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.h
index 1ad20dc819..7184a32541 100644
--- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.h
+++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.h
@@ -33,6 +33,7 @@ class RimUserDefinedFilter;
class RimUserDefinedIndexFilter;
class RimCase;
class RimPolygonInView;
+class RimPolygon;
namespace cvf
{
@@ -53,7 +54,7 @@ class RimCellFilterCollection : public caf::PdmObject
caf::Signal<> filtersChanged;
- RimPolygonFilter* addNewPolygonFilter( RimCase* srcCase );
+ RimPolygonFilter* addNewPolygonFilter( RimCase* srcCase, RimPolygon* polygon );
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int gridIndex, int sliceDirection = -1, int defaultSlice = -1 );
RimCellIndexFilter* addNewCellIndexFilter( RimCase* srcCase );
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
@@ -70,7 +71,7 @@ class RimCellFilterCollection : public caf::PdmObject
void compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const;
void updateCellVisibilityByIndex( cvf::UByteArray* cellsIncluded, cvf::UByteArray* cellsExcluded, size_t gridIndex ) const;
- std::vector cellFilterPolygons() const;
+ std::vector enabledCellFilterPolygons() const;
std::vector filters() const;
bool hasActiveFilters() const;
diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp
index 6722a70070..81d2479bfe 100644
--- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp
+++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp
@@ -389,7 +389,7 @@ void RimEclipsePropertyFilter::defineObjectEditorAttribute( QString uiConfigName
if ( treeItemAttribute )
{
treeItemAttribute->tags.clear();
- auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
tag->icon = caf::IconProvider( ":/chain.png" );
treeItemAttribute->tags.push_back( std::move( tag ) );
diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp
index 16e97401a3..54614df48c 100644
--- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp
+++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp
@@ -26,6 +26,7 @@
#include "RigMainGrid.h"
#include "RigReservoirGridTools.h"
+#include "RimCellFilterCollection.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimPolylineTarget.h"
@@ -153,6 +154,18 @@ void RimPolygonFilter::enableKFilter( bool bEnable )
m_enableKFilter = bEnable;
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygonFilter::setPolygon( RimPolygon* polygon )
+{
+ if ( polygon )
+ {
+ m_polygonDataSource = PolygonDataSource::GLOBAL_POLYGON;
+ m_cellFilterPolygon = polygon;
+ }
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -238,18 +251,16 @@ void RimPolygonFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
{
uiOrdering.add( &m_name );
- auto dataSourceGroup = uiOrdering.addNewGroup( "Polygon Data Source" );
- dataSourceGroup->add( &m_polygonDataSource );
- if ( !isPolygonDefinedLocally() )
- {
- dataSourceGroup->add( &m_cellFilterPolygon );
- dataSourceGroup->add( &m_editPolygonButton, { .newRow = false } );
- }
-
auto group = uiOrdering.addNewGroup( "General" );
group->add( &m_filterMode );
group->add( &m_geometricalShape );
group->add( &m_enableFiltering );
+ group->add( &m_polygonDataSource );
+ if ( !isPolygonDefinedLocally() )
+ {
+ group->add( &m_cellFilterPolygon );
+ group->add( &m_editPolygonButton, { .newRow = false } );
+ }
auto group1 = uiOrdering.addNewGroup( "Polygon Selection" );
group1->add( &m_polyFilterMode );
@@ -319,7 +330,7 @@ void RimPolygonFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField
{
if ( changedField == &m_editPolygonButton )
{
- RimPolygonTools::selectPolygonInView( m_cellFilterPolygon(), this );
+ RimPolygonTools::selectAndActivatePolygonInView( m_cellFilterPolygon(), this );
m_editPolygonButton = false;
@@ -768,9 +779,9 @@ void RimPolygonFilter::updateCells()
// get polyline as vector
std::vector points;
- for ( auto target : m_polygonEditor->activeTargets() )
+ if ( m_polygonEditor && m_polygonEditor->polygon() )
{
- points.push_back( target->targetPointXYZ() );
+ points = m_polygonEditor->polygon()->pointsInDomainCoords();
}
// We need at least three points to make a closed polygon, or just 2 for a polyline
@@ -870,6 +881,11 @@ bool RimPolygonFilter::pickingEnabled() const
//--------------------------------------------------------------------------------------------------
caf::PickEventHandler* RimPolygonFilter::pickEventHandler() const
{
+ auto filterColl = firstAncestorOfType();
+ if ( filterColl && !filterColl->isActive() ) return nullptr;
+
+ if ( !isActive() ) return nullptr;
+
return m_pickTargetsEventHandler.get();
}
diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.h
index ec9acefa91..52e82a064f 100644
--- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.h
+++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.h
@@ -74,6 +74,7 @@ class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface
void enableFilter( bool bEnable );
void enableKFilter( bool bEnable );
+ void setPolygon( RimPolygon* polygon );
bool isFilterEnabled() const override;
diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp
index 8231f8da23..42fd132f98 100644
--- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp
@@ -21,23 +21,20 @@
#include "RiaVec3Tools.h"
-#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
+#include "RigPolyLinesData.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigWellPath.h"
+#include "Polygons/RimPolygon.h"
+#include "Polygons/RimPolygonCollection.h"
+#include "Polygons/RimPolygonTools.h"
+
#include "Rim2dIntersectionView.h"
#include "Rim3dView.h"
#include "RimCase.h"
-#include "RimEclipseCase.h"
#include "RimEclipseView.h"
-#include "RimEnsembleSurface.h"
#include "RimGeoMechView.h"
-#include "RimGridView.h"
-#include "RimIntersectionResultDefinition.h"
-#include "RimIntersectionResultsDefinitionCollection.h"
-#include "RimOilField.h"
-#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimSurface.h"
@@ -48,12 +45,8 @@
#include "RimTools.h"
#include "RimWellPath.h"
-#include "RiuViewer.h"
-
#include "RivExtrudedCurveIntersectionPartMgr.h"
-#include "cafCmdFeature.h"
-#include "cafCmdFeatureManager.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
#include "cafPdmObjectScriptingCapability.h"
@@ -61,12 +54,9 @@
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPushButtonEditor.h"
-#include "cafPdmUiSliderEditor.h"
#include "cafPdmUiTreeOrdering.h"
-#include "cafPdmUiTreeSelectionEditor.h"
#include "cvfBoundingBox.h"
#include "cvfGeometryTools.h"
-#include "cvfPlane.h"
namespace caf
{
@@ -77,6 +67,7 @@ void caf::AppEnum::setUp()
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
+ addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYGON, "CS_POLYGON", "Project Polygon" );
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE );
}
@@ -186,6 +177,17 @@ void RimExtrudedCurveIntersection::configureForPolyLine()
m_inputPolylineFromViewerEnabled = true;
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimExtrudedCurveIntersection::configureForProjectPolyLine( RimPolygon* polygon )
+{
+ m_type = CrossSectionEnum::CS_POLYGON;
+ m_projectPolygon = polygon;
+
+ updateName();
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -207,6 +209,11 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path " );
CAF_PDM_InitScriptableFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" );
+
+ CAF_PDM_InitFieldNoDefault( &m_projectPolygon, "ProjectPolygon", "Project Polygon" );
+ CAF_PDM_InitField( &m_editPolygonButton, "EditPolygonButton", false, "Edit" );
+ caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_editPolygonButton );
+
CAF_PDM_InitScriptableFieldNoDefault( &m_userPolylineXyz, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
CAF_PDM_InitFieldNoDefault( &m_userPolylineXydForUi, "PointsUi", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
@@ -439,11 +446,11 @@ void RimExtrudedCurveIntersection::setKFilterOverride( bool collectionOverride,
void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
if ( changedField == &m_isActive || changedField == &m_type || changedField == &m_direction || changedField == &m_wellPath ||
- changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength ||
- changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells ||
- changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold ||
- changedField == &m_depthLowerThreshold || changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType ||
- changedField == &m_enableKFilter || changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride )
+ changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || changedField == &m_lengthUp ||
+ changedField == &m_lengthDown || changedField == &m_showInactiveCells || changedField == &m_useSeparateDataSource ||
+ changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold || changedField == &m_depthLowerThreshold ||
+ changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType || changedField == &m_enableKFilter ||
+ changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride || changedField == &m_projectPolygon )
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
@@ -453,7 +460,8 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
recomputeSimulationWellBranchData();
}
- if ( changedField == &m_simulationWell || changedField == &m_wellPath || changedField == &m_branchIndex )
+ if ( changedField == &m_simulationWell || changedField == &m_wellPath || changedField == &m_branchIndex ||
+ changedField == &m_projectPolygon || changedField == &m_type )
{
updateName();
}
@@ -511,6 +519,15 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
+
+ if ( changedField == &m_editPolygonButton )
+ {
+ RimPolygonTools::selectAndActivatePolygonInView( m_projectPolygon(), this );
+
+ m_editPolygonButton = false;
+
+ return;
+ }
}
//--------------------------------------------------------------------------------------------------
@@ -540,6 +557,11 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf::
geometryGroup->add( &m_userPolylineXydForUi );
geometryGroup->add( &m_inputPolylineFromViewerEnabled );
}
+ else if ( type() == CrossSectionEnum::CS_POLYGON )
+ {
+ geometryGroup->add( &m_projectPolygon );
+ geometryGroup->add( &m_editPolygonButton, { .newRow = false } );
+ }
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
{
geometryGroup->add( &m_twoAzimuthPoints );
@@ -668,6 +690,19 @@ QList RimExtrudedCurveIntersection::calculateValueOption
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
}
+ else if ( fieldNeedingOptions == &m_projectPolygon )
+ {
+ options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
+
+ RimTools::polygonOptionItems( &options );
+
+ if ( m_projectPolygon() == nullptr )
+ {
+ auto polygonCollection = RimTools::polygonCollection();
+ auto polygons = polygonCollection->allPolygons();
+ if ( !polygons.empty() ) m_projectPolygon = polygons.front();
+ }
+ }
else if ( fieldNeedingOptions == &m_branchIndex )
{
updateSimulationWellCenterline();
@@ -775,8 +810,6 @@ std::vector> RimExtrudedCurveIntersection::polyLines( cv
{
if ( m_simulationWell() )
{
- updateSimulationWellCenterline();
-
int branchIndexToUse = branchIndex();
if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast( m_simulationWellBranchCenterlines.size() ) )
@@ -794,6 +827,13 @@ std::vector> RimExtrudedCurveIntersection::polyLines( cv
{
lines.push_back( m_userPolylineXyz );
}
+ else if ( type() == CrossSectionEnum::CS_POLYGON )
+ {
+ if ( m_projectPolygon )
+ {
+ lines = m_projectPolygon->polyLinesData()->completePolyLines();
+ }
+ }
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
{
lines.push_back( m_twoAzimuthPoints );
@@ -863,7 +903,7 @@ std::vector RimExtrudedCurveIntersection::polyLinesForExtrusionDirec
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RimExtrudedCurveIntersection::updateSimulationWellCenterline() const
+void RimExtrudedCurveIntersection::updateSimulationWellCenterline()
{
if ( m_isActive() && type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
{
@@ -954,6 +994,10 @@ void RimExtrudedCurveIntersection::updateName()
{
m_name = m_wellPath()->name();
}
+ else if ( m_type() == CrossSectionEnum::CS_POLYGON && m_projectPolygon() )
+ {
+ m_name = m_projectPolygon->name();
+ }
Rim2dIntersectionView* iView = correspondingIntersectionView();
if ( iView )
@@ -1081,6 +1125,14 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan
{
setBaseColor( m_inputExtrusionPointsFromViewerEnabled, dynamic_cast( attribute ) );
}
+
+ if ( field == &m_editPolygonButton )
+ {
+ if ( auto attrib = dynamic_cast( attribute ) )
+ {
+ attrib->m_buttonText = "Edit";
+ }
+ }
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h
index a27079113e..22d6836593 100644
--- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h
+++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h
@@ -24,9 +24,10 @@
#include "RimIntersectionEnums.h"
#include "cafPdmChildField.h"
+#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmProxyValueField.h"
-#include
+#include "cvfVector3.h"
class RimWellPath;
class RivExtrudedCurveIntersectionPartMgr;
@@ -40,6 +41,7 @@ class RimSurfaceCollection;
class RimSurfaceIntersectionCollection;
class RimSurfaceIntersectionCurve;
class RimSurfaceIntersectionBand;
+class RimPolygon;
namespace caf
{
@@ -62,7 +64,8 @@ class RimExtrudedCurveIntersection : public RimIntersection
CS_WELL_PATH,
CS_SIMULATION_WELL,
CS_POLYLINE,
- CS_AZIMUTHLINE
+ CS_AZIMUTHLINE,
+ CS_POLYGON,
};
enum class CrossSectionDirEnum
@@ -102,6 +105,7 @@ class RimExtrudedCurveIntersection : public RimIntersection
void configureForSimulationWell( RimSimWellInView* simWell );
void configureForWellPath( RimWellPath* wellPath );
void configureForPolyLine();
+ void configureForProjectPolyLine( RimPolygon* polygon );
void configureForAzimuthLine();
std::vector> polyLines( cvf::Vec3d* flattenedPolylineStartPoint = nullptr ) const;
@@ -134,7 +138,7 @@ class RimExtrudedCurveIntersection : public RimIntersection
int branchIndex() const;
void rebuildGeometryAndScheduleCreateDisplayModel();
-protected:
+private:
caf::PdmFieldHandle* userDescriptionField() final;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
@@ -143,13 +147,12 @@ class RimExtrudedCurveIntersection : public RimIntersection
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
-private:
static void setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute );
static void setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute );
RimSimWellInViewCollection* simulationWellCollection() const;
void updateAzimuthLine();
- void updateSimulationWellCenterline() const;
+ void updateSimulationWellCenterline();
void addExtents( std::vector& polyLine ) const;
void updateName();
static double azimuthInRadians( cvf::Vec3d vec );
@@ -181,6 +184,9 @@ class RimExtrudedCurveIntersection : public RimIntersection
caf::PdmPtrField m_wellPath;
caf::PdmPtrField m_simulationWell;
+ caf::PdmPtrField m_projectPolygon;
+ caf::PdmField m_editPolygonButton;
+
caf::PdmField m_inputPolylineFromViewerEnabled;
caf::PdmField m_inputExtrusionPointsFromViewerEnabled;
caf::PdmField m_inputTwoAzimuthPointsFromViewerEnabled;
@@ -202,11 +208,11 @@ class RimExtrudedCurveIntersection : public RimIntersection
cvf::ref m_crossSectionPartMgr;
- mutable std::vector> m_simulationWellBranchCenterlines;
+ std::vector> m_simulationWellBranchCenterlines;
caf::PdmField m_enableKFilter;
caf::PdmField m_kFilterText;
caf::PdmField m_kFilterCollectionOverride;
caf::PdmField m_kFilterCollectionText;
-};
\ No newline at end of file
+};
diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp
index a5226cf1a5..5eabceaf88 100644
--- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp
@@ -19,7 +19,6 @@
#include "RimIntersection.h"
#include "RigEclipseCaseData.h"
-#include "RigFemPartCollection.h"
#include "RigGeoMechCaseData.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h
index e94d2ff776..df8b70d7ba 100644
--- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h
+++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h
@@ -18,7 +18,6 @@
#pragma once
#include "cafPdmField.h"
-#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp
index 074a7d20e8..04d65d24c0 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp
@@ -19,7 +19,15 @@
#include "RimPolygon.h"
#include "RigPolyLinesData.h"
+
+#include "RiaApplication.h"
+#include "Rim3dView.h"
#include "RimPolygonAppearance.h"
+#include "RimPolygonTools.h"
+
+#include "cafCmdFeatureMenuBuilder.h"
+#include "cafPdmUiPushButtonEditor.h"
+#include "cafPdmUiTreeAttributes.h"
CAF_PDM_SOURCE_INIT( RimPolygon, "RimPolygon" );
@@ -33,6 +41,10 @@ RimPolygon::RimPolygon()
CAF_PDM_InitField( &m_isReadOnly, "IsReadOnly", false, "Read Only" );
CAF_PDM_InitFieldNoDefault( &m_pointsInDomainCoords, "PointsInDomainCoords", "Points" );
+
+ CAF_PDM_InitField( &m_editPolygonButton, "EditPolygonButton", false, "Edit" );
+ caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_editPolygonButton );
+
CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance" );
m_appearance = new RimPolygonAppearance;
m_appearance.uiCapability()->setUiTreeChildrenHidden( true );
@@ -61,6 +73,15 @@ void RimPolygon::uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrde
m_appearance->uiOrdering( uiConfigName, uiOrdering );
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygon::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
+{
+ menuBuilder << "RicNewPolygonIntersectionFeature";
+ menuBuilder << "RicNewPolygonFilterFeature";
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -95,6 +116,22 @@ bool RimPolygon::isClosed() const
return m_appearance->isClosed();
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygon::setReadOnly( bool isReadOnly )
+{
+ m_isReadOnly = isReadOnly;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RimPolygon::isReadOnly() const
+{
+ return m_isReadOnly();
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -102,11 +139,14 @@ void RimPolygon::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiO
{
uiOrdering.add( nameField() );
uiOrdering.add( &m_isReadOnly );
+ uiOrdering.add( &m_editPolygonButton );
auto groupPoints = uiOrdering.addNewGroup( "Points" );
groupPoints->setCollapsedByDefault();
groupPoints->add( &m_pointsInDomainCoords );
+ m_pointsInDomainCoords.uiCapability()->setUiReadOnly( m_isReadOnly() );
+
auto group = uiOrdering.addNewGroup( "Appearance" );
m_appearance->uiOrdering( uiConfigName, *group );
}
@@ -120,6 +160,16 @@ void RimPolygon::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
{
objectChanged.send();
}
+
+ if ( changedField == &m_editPolygonButton )
+ {
+ auto activeView = RiaApplication::instance()->activeReservoirView();
+ RimPolygonTools::selectAndActivatePolygonInView( this, activeView );
+
+ m_editPolygonButton = false;
+
+ return;
+ }
}
//--------------------------------------------------------------------------------------------------
@@ -129,3 +179,28 @@ void RimPolygon::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildF
{
objectChanged.send();
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygon::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
+{
+ if ( field == &m_editPolygonButton )
+ {
+ if ( auto attrib = dynamic_cast( attribute ) )
+ {
+ attrib->m_buttonText = "Edit in Active View";
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygon::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
+{
+ if ( m_isReadOnly )
+ {
+ caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( attribute, ":/padlock.svg" );
+ }
+}
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.h b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.h
index 455ace4578..0562acd652 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.h
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.h
@@ -28,6 +28,11 @@
class RimPolygonAppearance;
+namespace caf
+{
+class CmdFeatureMenuBuilder;
+}
+
class RimPolygon : public RimNamedObject, public RimPolylinesDataInterface
{
CAF_PDM_HEADER_INIT;
@@ -43,17 +48,24 @@ class RimPolygon : public RimNamedObject, public RimPolylinesDataInterface
void setIsClosed( bool isClosed );
bool isClosed() const;
+ void setReadOnly( bool isReadOnly );
+ bool isReadOnly() const;
+
cvf::ref polyLinesData() const override;
void uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
+ void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
+ void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
+ void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
private:
caf::PdmField m_isReadOnly;
+ caf::PdmField m_editPolygonButton;
caf::PdmField> m_pointsInDomainCoords;
caf::PdmChildField m_appearance;
};
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp
index ea085b6522..32cfc6732b 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp
@@ -139,6 +139,7 @@ std::vector RimPolygonCollection::allPolygons() const
void RimPolygonCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects )
{
updateViewTreeItems();
+ scheduleRedrawViews();
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp
index 5e817e75d0..d45b557261 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp
@@ -22,12 +22,14 @@
#include "Rim3dView.h"
#include "RimPolygon.h"
+#include "RimPolygonInViewCollection.h"
#include "RimPolylineTarget.h"
#include "RimTools.h"
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
+#include "Riu3DMainWindowTools.h"
#include "RiuGuiTheme.h"
#include "RivPolylinePartMgr.h"
@@ -36,6 +38,7 @@
#include "cafDisplayCoordTransform.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTableViewEditor.h"
+#include "cafPdmUiTreeAttributes.h"
#include "cvfModelBasicList.h"
@@ -57,6 +60,9 @@ RimPolygonInView::RimPolygonInView()
CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "" );
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_enablePicking );
+ CAF_PDM_InitField( &m_selectPolygon, "SelectPolygon", false, "" );
+ caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_selectPolygon );
+
CAF_PDM_InitField( &m_handleScalingFactor, "HandleScalingFactor", 1.0, "Handle Scaling Factor" );
CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" );
@@ -175,6 +181,13 @@ bool RimPolygonInView::pickingEnabled() const
//--------------------------------------------------------------------------------------------------
caf::PickEventHandler* RimPolygonInView::pickEventHandler() const
{
+ auto filterColl = firstAncestorOfType();
+ if ( filterColl && !filterColl->isChecked() ) return nullptr;
+
+ if ( !isChecked() ) return nullptr;
+
+ if ( m_polygon() && polygon()->isReadOnly() ) return nullptr;
+
return m_pickTargetsEventHandler.get();
}
@@ -244,10 +257,24 @@ void RimPolygonInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
{
updateNameField();
- uiOrdering.add( &m_handleScalingFactor );
+ bool enableEdit = true;
+ if ( m_polygon() && m_polygon->isReadOnly() ) enableEdit = false;
- if ( m_polygon() ) uiOrdering.add( m_polygon );
- uiOrdering.add( &m_enablePicking );
+ uiOrdering.add( m_polygon );
+
+ if ( enableEdit )
+ {
+ uiOrdering.add( &m_enablePicking );
+ uiOrdering.add( &m_targets );
+ uiOrdering.add( &m_handleScalingFactor );
+ }
+
+ if ( m_polygon() )
+ {
+ uiOrdering.add( &m_selectPolygon );
+ }
+
+ uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
@@ -260,6 +287,11 @@ void RimPolygonInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
updateConnectedEditors();
}
+ if ( changedField == &m_selectPolygon && m_polygon() )
+ {
+ Riu3DMainWindowTools::selectAsCurrentItem( m_polygon() );
+ }
+
updateVisualization();
}
@@ -289,6 +321,11 @@ void RimPolygonInView::defineObjectEditorAttribute( QString uiConfigName, caf::P
attrib->pickEventHandler = m_pickTargetsEventHandler;
attrib->enablePicking = m_enablePicking;
}
+
+ if ( m_polygon() && m_polygon->isReadOnly() )
+ {
+ caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( attribute, ":/padlock.svg" );
+ }
}
//--------------------------------------------------------------------------------------------------
@@ -301,6 +338,14 @@ void RimPolygonInView::uiOrderingForLocalPolygon( QString uiConfigName, caf::Pdm
uiOrdering.add( &m_handleScalingFactor );
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygonInView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
+{
+ if ( m_polygon() ) m_polygon->appendMenuItems( menuBuilder );
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -330,6 +375,15 @@ void RimPolygonInView::defineEditorAttribute( const caf::PdmFieldHandle* field,
}
}
+ if ( field == &m_selectPolygon )
+ {
+ auto* pbAttribute = dynamic_cast( attribute );
+ if ( pbAttribute )
+ {
+ pbAttribute->m_buttonText = "Go to Polygon";
+ }
+ }
+
if ( field == &m_targets )
{
if ( auto tvAttribute = dynamic_cast( attribute ) )
@@ -351,6 +405,8 @@ void RimPolygonInView::defineEditorAttribute( const caf::PdmFieldHandle* field,
//--------------------------------------------------------------------------------------------------
void RimPolygonInView::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget )
{
+ if ( m_polygon() && m_polygon->isReadOnly() ) return;
+
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicNewPolylineTargetFeature";
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.h b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.h
index 2883ead0c7..c77494d0d3 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.h
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.h
@@ -78,6 +78,7 @@ class RimPolygonInView : public RimCheckableNamedObject, public RimPolylinesData
QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
+ void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
private:
void updateNameField();
@@ -88,6 +89,7 @@ class RimPolygonInView : public RimCheckableNamedObject, public RimPolylinesData
private:
caf::PdmPtrField m_polygon;
+ caf::PdmField m_selectPolygon;
caf::PdmField m_enablePicking;
caf::PdmField m_handleScalingFactor;
caf::PdmChildArrayField m_targets;
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.cpp
index 9aa7034018..3ee9722878 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.cpp
@@ -18,6 +18,7 @@
#include "RimPolygonInViewCollection.h"
+#include "Rim3dView.h"
#include "RimPolygon.h"
#include "RimPolygonCollection.h"
#include "RimPolygonInView.h"
@@ -83,3 +84,24 @@ std::vector RimPolygonInViewCollection::polygonsInView() cons
{
return m_polygons.childrenByType();
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimPolygonInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
+{
+ RimCheckableObject::fieldChangedByUi( changedField, oldValue, newValue );
+
+ if ( changedField == &m_isChecked )
+ {
+ for ( auto poly : polygonsInView() )
+ {
+ poly->updateConnectedEditors();
+ }
+
+ if ( auto view = firstAncestorOfType() )
+ {
+ view->scheduleCreateDisplayModelAndRedraw();
+ }
+ }
+}
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.h b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.h
index 2659f0beee..87e947d83a 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.h
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInViewCollection.h
@@ -18,8 +18,8 @@
#pragma once
+#include "RimCheckableObject.h"
#include "cafPdmChildArrayField.h"
-#include "cafPdmObject.h"
class RimPolygonInView;
@@ -27,7 +27,7 @@ class RimPolygonInView;
///
///
//==================================================================================================
-class RimPolygonInViewCollection : public caf::PdmObject
+class RimPolygonInViewCollection : public RimCheckableObject
{
CAF_PDM_HEADER_INIT;
@@ -38,6 +38,9 @@ class RimPolygonInViewCollection : public caf::PdmObject
std::vector polygonsInView() const;
+private:
+ void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
+
private:
caf::PdmChildArrayField m_polygons;
};
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp
index d42ebbc9d5..52c5fd37c5 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.cpp
@@ -31,7 +31,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RimPolygonTools::selectPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject )
+void RimPolygonTools::selectAndActivatePolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject )
{
auto polygonInView = findPolygonInView( polygon, sourceObject );
if ( polygonInView )
@@ -46,7 +46,12 @@ void RimPolygonTools::selectPolygonInView( RimPolygon* polygon, caf::PdmObject*
//--------------------------------------------------------------------------------------------------
RimPolygonInView* RimPolygonTools::findPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject )
{
- if ( auto gridView = sourceObject->firstAncestorOfType() )
+ if ( !polygon || !sourceObject )
+ {
+ return nullptr;
+ }
+
+ if ( auto gridView = sourceObject->firstAncestorOrThisOfType() )
{
auto polyCollection = gridView->polygonInViewCollection();
diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h
index e45826e4e8..8f7d3a65d3 100644
--- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h
+++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonTools.h
@@ -29,7 +29,7 @@ class PdmObject;
class RimPolygonTools
{
public:
- static void selectPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
+ static void selectAndActivatePolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
private:
static RimPolygonInView* findPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp
index 6c6b658358..7adc007c08 100644
--- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp
@@ -1157,6 +1157,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
if ( firstUiItem )
{
+ if ( auto pdmObject = dynamic_cast( firstUiItem ) )
+ {
+ pdmObject->appendMenuItems( menuBuilder );
+ }
+
// Work in progress -- Start
// All commands should be aware of selection of multiple objects
// Based on the selection, the command feature can decide if the command
diff --git a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp
index 8b2c9a33cf..51813b0e7d 100644
--- a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp
@@ -405,14 +405,21 @@ void RimGridView::appendPolygonPartsToModel( caf::DisplayCoordTransform* scaleTr
m_polygonVizModel->removeAllParts();
std::vector polygonsInView;
- if ( m_polygonInViewCollection )
+ if ( m_polygonInViewCollection && m_polygonInViewCollection->isChecked() )
{
- polygonsInView = m_polygonInViewCollection->polygonsInView();
+ auto candidates = m_polygonInViewCollection->polygonsInView();
+ for ( auto polygonInView : candidates )
+ {
+ if ( polygonInView->isChecked() )
+ {
+ polygonsInView.push_back( polygonInView );
+ }
+ }
}
- if ( cellFilterCollection() )
+ if ( cellFilterCollection() && cellFilterCollection()->isActive() )
{
- auto cellFilterPolygonsInView = cellFilterCollection()->cellFilterPolygons();
+ auto cellFilterPolygonsInView = cellFilterCollection()->enabledCellFilterPolygons();
polygonsInView.insert( polygonsInView.end(), cellFilterPolygonsInView.begin(), cellFilterPolygonsInView.end() );
}
diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp
index 9d4cf3cae0..25060d3655 100644
--- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp
@@ -731,7 +731,7 @@ void RimPlotAxisProperties::defineObjectEditorAttribute( QString uiConfigName, c
if ( treeItemAttribute )
{
treeItemAttribute->tags.clear();
- auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
tag->icon = caf::IconProvider( ":/chain.png" );
treeItemAttribute->tags.push_back( std::move( tag ) );
diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp
index 5e3a6143cf..5fb6ce2068 100644
--- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp
@@ -1262,7 +1262,7 @@ void RimPlotCurve::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUi
if ( auto* treeItemAttribute = dynamic_cast( attribute ) )
{
treeItemAttribute->tags.clear();
- auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
// Blend with background for a nice look
auto backgroundColor = RiuGuiTheme::getColorByVariableName( "backgroundColor1" );
diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp
index 7300d1220a..516128c6c2 100644
--- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp
+++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp
@@ -319,7 +319,7 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU
if ( treeItemAttribute && RiaPreferencesSystem::current()->showViewIdInProjectTree() && id() >= 0 )
{
treeItemAttribute->tags.clear();
- auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
tag->text = QString( "%1" ).arg( id() );
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp
index c9cc9c8975..5cf84dff46 100644
--- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp
@@ -1062,7 +1062,7 @@ void RimEnsembleCurveSet::defineObjectEditorAttribute( QString uiConfigName, caf
if ( auto* treeItemAttribute = dynamic_cast( attribute ) )
{
treeItemAttribute->tags.clear();
- auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
tag->bgColor = RiaColorTools::toQColor( m_colorForRealizations );
tag->fgColor = RiaColorTools::toQColor( m_statistics->color() );
tag->text = "---";
diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp
index aa706887e0..4d10357f62 100644
--- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp
+++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp
@@ -204,7 +204,7 @@ void RimSummaryTimeAxisProperties::defineObjectEditorAttribute( QString uiConfig
if ( treeItemAttribute )
{
treeItemAttribute->tags.clear();
- auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
tag->icon = caf::IconProvider( ":/chain.png" );
treeItemAttribute->tags.push_back( std::move( tag ) );
diff --git a/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.cpp b/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.cpp
index 88318e1ec5..7a282e3a85 100644
--- a/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.cpp
+++ b/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.cpp
@@ -44,11 +44,37 @@ RigPolyLinesData::~RigPolyLinesData()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-const std::vector>& RigPolyLinesData::polyLines() const
+const std::vector>& RigPolyLinesData::rawPolyLines() const
{
return m_polylines;
}
+//--------------------------------------------------------------------------------------------------
+/// Returns the polylines with the last point equal to the first point if the polyline is closed
+//--------------------------------------------------------------------------------------------------
+const std::vector> RigPolyLinesData::completePolyLines() const
+{
+ if ( !m_closePolyline ) return m_polylines;
+
+ std::vector> completeLines;
+ for ( const auto& polyline : m_polylines )
+ {
+ auto completePolyline = polyline;
+ if ( !polyline.empty() )
+ {
+ const double epsilon = 1e-6;
+
+ if ( polyline.front().pointDistance( polyline.back() ) > epsilon )
+ {
+ completePolyline.push_back( polyline.front() );
+ }
+ }
+ completeLines.push_back( completePolyline );
+ }
+
+ return completeLines;
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.h b/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.h
index 5e0fcf176b..f11c92dc27 100644
--- a/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.h
+++ b/ApplicationLibCode/ReservoirDataModel/RigPolyLinesData.h
@@ -34,7 +34,8 @@ class RigPolyLinesData : public cvf::Object
RigPolyLinesData();
~RigPolyLinesData() override;
- const std::vector>& polyLines() const;
+ const std::vector>& rawPolyLines() const;
+ const std::vector> completePolyLines() const;
void setPolyLines( const std::vector>& polyLines );
void setPolyLine( const std::vector& polyline );
diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h
index ee395297a1..b65fc7d242 100644
--- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h
+++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h
@@ -13,6 +13,7 @@ class PdmObjectHandle;
class PdmUiOrdering;
class PdmFieldHandle;
class PdmUiEditorAttribute;
+class CmdFeatureMenuBuilder;
class PdmUiObjectHandle : public PdmUiItem, public PdmObjectCapability
{
@@ -44,6 +45,9 @@ class PdmUiObjectHandle : public PdmUiItem, public PdmObjectCapability
void updateUiIconFromToggleField();
+ /// Append actions to menu builder
+ virtual void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const {}
+
// Virtual interface to override in subclasses to support special behaviour if needed
public: // Virtual
virtual caf::PdmFieldHandle* userDescriptionField() { return nullptr; }
diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt
index ed547d8be9..06453f27ec 100644
--- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt
+++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt
@@ -182,6 +182,7 @@ set(PROJECT_FILES
cafPdmUiTreeViewItemDelegate.h
cafPdmUiTreeViewItemDelegate.cpp
cafPdmUiTreeAttributes.h
+ cafPdmUiTreeAttributes.cpp
cafUiAppearanceSettings.cpp
cafUiIconFactory.cpp
cafPdmUiSliderTools.h
diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp
new file mode 100644
index 0000000000..06172c8a57
--- /dev/null
+++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp
@@ -0,0 +1,61 @@
+//##################################################################################################
+//
+// Custom Visualization Core library
+// Copyright (C) 2011-2013 Ceetron AS
+//
+// This library may be used under the terms of either the GNU General Public License or
+// the GNU Lesser General Public License as follows:
+//
+// GNU General Public License Usage
+// This library 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.
+//
+// This library 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 <>
+// for more details.
+//
+// GNU Lesser General Public License Usage
+// This library is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation; either version 2.1 of the License, or
+// (at your option) any later version.
+//
+// This library 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 Lesser General Public License at <>
+// for more details.
+//
+//##################################################################################################
+
+#include "cafPdmUiTreeAttributes.h"
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+std::unique_ptr caf::PdmUiTreeViewItemAttribute::createTag()
+{
+ return std::make_unique();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute,
+ const QString& iconResourceString )
+{
+ if ( auto* treeItemAttribute = dynamic_cast( attribute ) )
+ {
+ treeItemAttribute->tags.clear();
+ auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
+ tag->icon = caf::IconProvider( iconResourceString );
+
+ treeItemAttribute->tags.push_back( std::move( tag ) );
+ }
+}
diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h
index de171f7000..c138db8a2f 100644
--- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h
+++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h
@@ -1,5 +1,3 @@
-
-
//##################################################################################################
//
// Custom Visualization Core library
@@ -73,12 +71,13 @@ class PdmUiTreeViewItemAttribute : public PdmUiEditorAttribute
caf::Signal clicked;
- static std::unique_ptr create() { return std::make_unique(); }
-
private:
Tag& operator=( const Tag& rhs ) { return *this; }
};
+ static std::unique_ptr createTag();
+ static void createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, const QString& iconString );
+
std::vector> tags;
};
diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp
index e77c3038cc..3c036fcef3 100644
--- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp
+++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp
@@ -615,7 +615,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
{
size_t indexInParentField = reorderability->indexOf( pdmObject );
{
- auto tag = PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = PdmUiTreeViewItemAttribute::createTag();
tag->icon = caf::IconProvider( ":/caf/Up16x16.png" );
tag->selectedOnly = true;
if ( reorderability->canItemBeMovedUp( indexInParentField ) )
@@ -630,7 +630,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
m_delegate->addTag( filterIndex, std::move( tag ) );
}
{
- auto tag = PdmUiTreeViewItemAttribute::Tag::create();
+ auto tag = PdmUiTreeViewItemAttribute::createTag();
tag->icon = IconProvider( ":/caf/Down16x16.png" );
tag->selectedOnly = true;
if ( reorderability->canItemBeMovedDown( indexInParentField ) )