mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use polygon as data source for intersection
- Use polygon as data source for intersection - Add padlock icon - Show padlock icon on read only polygons - Add Fwk function appendMenuItems() to make it possible to define context menu content in a PdmObject - Context menu "Create Polygon Intersection" - Updates to make visualization consistent with object and object collection enabled state
This commit is contained in:
parent
09151ec6af
commit
28d281e1d6
@ -285,6 +285,7 @@
|
|||||||
<file>plot-template-ensemble.svg</file>
|
<file>plot-template-ensemble.svg</file>
|
||||||
<file>decline-curve.svg</file>
|
<file>decline-curve.svg</file>
|
||||||
<file>regression-curve.svg</file>
|
<file>regression-curve.svg</file>
|
||||||
|
<file>padlock.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/Shader">
|
<qresource prefix="/Shader">
|
||||||
<file>fs_CellFace.glsl</file>
|
<file>fs_CellFace.glsl</file>
|
||||||
|
11
ApplicationExeCode/Resources/padlock.svg
Normal file
11
ApplicationExeCode/Resources/padlock.svg
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg fill="#000000" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
viewBox="0 0 485 485" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<path d="M345,175v-72.5C345,45.981,299.019,0,242.5,0S140,45.981,140,102.5V175H70v310h345V175H345z M170,102.5
|
||||||
|
c0-39.977,32.523-72.5,72.5-72.5S315,62.523,315,102.5V175H170V102.5z M385,455H100V205h285V455z"/>
|
||||||
|
<path d="M227.5,338.047v53.568h30v-53.569c11.814-5.628,20-17.682,20-31.616c0-19.299-15.701-35-35-35c-19.299,0-35,15.701-35,35
|
||||||
|
C207.5,320.365,215.686,332.42,227.5,338.047z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 727 B |
@ -662,7 +662,10 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( riv->showWindow() )
|
||||||
|
{
|
||||||
setActiveReservoirView( riv );
|
setActiveReservoirView( riv );
|
||||||
|
}
|
||||||
|
|
||||||
RimGridView* rigv = dynamic_cast<RimGridView*>( riv );
|
RimGridView* rigv = dynamic_cast<RimGridView*>( riv );
|
||||||
if ( rigv ) rigv->cellFilterCollection()->updateIconState();
|
if ( rigv ) rigv->cellFilterCollection()->updateIconState();
|
||||||
|
@ -48,7 +48,7 @@ void RicNewPolygonFilter3dviewFeature::onActionTriggered( bool isChecked )
|
|||||||
// and the case to use
|
// and the case to use
|
||||||
RimCase* sourceCase = viewOrComparisonView->ownerCase();
|
RimCase* sourceCase = viewOrComparisonView->ownerCase();
|
||||||
|
|
||||||
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
|
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase, nullptr );
|
||||||
if ( lastCreatedOrUpdated )
|
if ( lastCreatedOrUpdated )
|
||||||
{
|
{
|
||||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||||
|
@ -18,10 +18,14 @@
|
|||||||
|
|
||||||
#include "RicNewPolygonFilterFeature.h"
|
#include "RicNewPolygonFilterFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "Polygons/RimPolygon.h"
|
||||||
#include "Polygons/RimPolygonInView.h"
|
#include "Polygons/RimPolygonInView.h"
|
||||||
|
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
#include "RimCellFilterCollection.h"
|
#include "RimCellFilterCollection.h"
|
||||||
|
#include "RimGridView.h"
|
||||||
#include "RimPolygonFilter.h"
|
#include "RimPolygonFilter.h"
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
@ -38,16 +42,31 @@ CAF_CMD_SOURCE_INIT( RicNewPolygonFilterFeature, "RicNewPolygonFilterFeature" );
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
|
void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
|
||||||
{
|
{
|
||||||
// Find the selected Cell Filter Collection
|
auto cellFilterCollection = caf::SelectionManager::instance()->selectedItemOfType<RimCellFilterCollection>();
|
||||||
std::vector<RimCellFilterCollection*> colls = caf::selectedObjectsByTypeStrict<RimCellFilterCollection*>();
|
|
||||||
if ( colls.empty() ) return;
|
|
||||||
RimCellFilterCollection* filtColl = colls[0];
|
|
||||||
|
|
||||||
// and the case to use
|
if ( !cellFilterCollection )
|
||||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
{
|
||||||
|
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||||
|
if ( activeView )
|
||||||
|
{
|
||||||
|
cellFilterCollection = activeView->cellFilterCollection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
|
if ( !cellFilterCollection ) return;
|
||||||
if ( lastCreatedOrUpdated )
|
|
||||||
|
auto polygon = caf::SelectionManager::instance()->selectedItemOfType<RimPolygon>();
|
||||||
|
if ( !polygon )
|
||||||
|
{
|
||||||
|
if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>() )
|
||||||
|
{
|
||||||
|
polygon = polygonInView->polygon();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto sourceCase = cellFilterCollection->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||||
|
|
||||||
|
if ( auto lastCreatedOrUpdated = cellFilterCollection->addNewPolygonFilter( sourceCase, polygon ) )
|
||||||
{
|
{
|
||||||
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
Riu3DMainWindowTools::selectAsCurrentItem( lastCreatedOrUpdated );
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonIntersectionFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCE_GROUP_SOURCE_FILES
|
set(SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineIntersectionFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewAzimuthDipIntersectionFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicCopyIntersectionsToAllViewsInCaseFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicNewPolygonIntersectionFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||||
|
@ -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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// 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 <QAction>
|
||||||
|
|
||||||
|
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<RimPolygon>();
|
||||||
|
if ( !polygon )
|
||||||
|
{
|
||||||
|
if ( auto polygonInView = caf::SelectionManager::instance()->selectedItemOfType<RimPolygonInView>() )
|
||||||
|
{
|
||||||
|
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" );
|
||||||
|
}
|
@ -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 <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// 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;
|
||||||
|
};
|
@ -47,6 +47,7 @@ bool RicSeismicSectionFromIntersectionFeature::isCommandEnabled() const
|
|||||||
if ( intersection != nullptr )
|
if ( intersection != nullptr )
|
||||||
{
|
{
|
||||||
return ( ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE ) ||
|
return ( ( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE ) ||
|
||||||
|
( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYGON ) ||
|
||||||
( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH ) );
|
( intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ void RicSeismicSectionFromIntersectionFeature::onActionTriggered( bool isChecked
|
|||||||
RimSeismicSection* newSection = seisColl->addNewSection();
|
RimSeismicSection* newSection = seisColl->addNewSection();
|
||||||
if ( !newSection ) return;
|
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->setSectionType( RiaDefines::SeismicSectionType::SS_POLYLINE );
|
||||||
newSection->setUserDescription( intersection->name() );
|
newSection->setUserDescription( intersection->name() );
|
||||||
|
@ -62,7 +62,7 @@ void RicPolyline3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
|||||||
}
|
}
|
||||||
m_targetEditors.clear();
|
m_targetEditors.clear();
|
||||||
|
|
||||||
if ( !pickerInterface ) return;
|
if ( !pickerInterface || !pickerInterface->pickEventHandler() ) return;
|
||||||
|
|
||||||
if ( pickerInterface->pickingEnabled() )
|
if ( pickerInterface->pickingEnabled() )
|
||||||
{
|
{
|
||||||
|
@ -44,9 +44,8 @@ bool RicIntersectionPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& e
|
|||||||
std::vector<RimExtrudedCurveIntersection*> selection;
|
std::vector<RimExtrudedCurveIntersection*> selection;
|
||||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||||
|
|
||||||
if ( selection.size() == 1 )
|
if ( selection.size() != 1 ) return false;
|
||||||
{
|
|
||||||
{
|
|
||||||
RimExtrudedCurveIntersection* intersection = selection[0];
|
RimExtrudedCurveIntersection* intersection = selection[0];
|
||||||
|
|
||||||
RimGridView* gridView = intersection->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
RimGridView* gridView = intersection->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||||
@ -81,8 +80,6 @@ bool RicIntersectionPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& e
|
|||||||
// Further Ui processing is stopped when true is returned
|
// Further Ui processing is stopped when true is returned
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ bool RivPolylinePartMgr::isPolylinesInBoundingBox( std::vector<std::vector<cvf::
|
|||||||
void RivPolylinePartMgr::buildPolylineParts( const caf::DisplayCoordTransform* displayXf, const cvf::BoundingBox& boundingBox )
|
void RivPolylinePartMgr::buildPolylineParts( const caf::DisplayCoordTransform* displayXf, const cvf::BoundingBox& boundingBox )
|
||||||
{
|
{
|
||||||
auto polylineDef = m_polylineInterface->polyLinesData();
|
auto polylineDef = m_polylineInterface->polyLinesData();
|
||||||
if ( polylineDef.isNull() || polylineDef->polyLines().empty() )
|
if ( polylineDef.isNull() || polylineDef->rawPolyLines().empty() )
|
||||||
{
|
{
|
||||||
clearAllGeometry();
|
clearAllGeometry();
|
||||||
return;
|
return;
|
||||||
@ -192,7 +192,7 @@ void RivPolylinePartMgr::buildPolylineParts( const caf::DisplayCoordTransform* d
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<std::vector<cvf::Vec3d>> RivPolylinePartMgr::getPolylinesPointsInDomain( RigPolyLinesData* lineDef )
|
std::vector<std::vector<cvf::Vec3d>> RivPolylinePartMgr::getPolylinesPointsInDomain( RigPolyLinesData* lineDef )
|
||||||
{
|
{
|
||||||
auto polylines = lineDef->polyLines();
|
auto polylines = lineDef->rawPolyLines();
|
||||||
if ( !lineDef->lockToZPlane() ) return polylines;
|
if ( !lineDef->lockToZPlane() ) return polylines;
|
||||||
|
|
||||||
const double planeZ = lineDef->lockedZValue();
|
const double planeZ = lineDef->lockedZValue();
|
||||||
|
@ -158,7 +158,7 @@ bool RimPolylinesFromFileAnnotation::isEmpty()
|
|||||||
{
|
{
|
||||||
if ( m_polyLinesData.isNull() ) return true;
|
if ( m_polyLinesData.isNull() ) return true;
|
||||||
|
|
||||||
for ( const std::vector<cvf::Vec3d>& line : m_polyLinesData->polyLines() )
|
for ( const std::vector<cvf::Vec3d>& line : m_polyLinesData->rawPolyLines() )
|
||||||
{
|
{
|
||||||
if ( !line.empty() ) return false;
|
if ( !line.empty() ) return false;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,12 @@ void RimCellFilterCollection::fieldChangedByUi( const caf::PdmFieldHandle* chang
|
|||||||
uiCapability()->updateConnectedEditors();
|
uiCapability()->updateConnectedEditors();
|
||||||
|
|
||||||
onFilterUpdated( nullptr );
|
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();
|
RimPolygonFilter* pFilter = new RimPolygonFilter();
|
||||||
pFilter->setCase( srcCase );
|
pFilter->setCase( srcCase );
|
||||||
|
pFilter->setPolygon( polygon );
|
||||||
addFilter( pFilter );
|
addFilter( pFilter );
|
||||||
pFilter->configurePolygonEditor();
|
pFilter->configurePolygonEditor();
|
||||||
|
if ( polygon )
|
||||||
|
{
|
||||||
|
pFilter->enableFilter( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
pFilter->enablePicking( true );
|
pFilter->enablePicking( true );
|
||||||
|
}
|
||||||
|
|
||||||
onFilterUpdated( pFilter );
|
onFilterUpdated( pFilter );
|
||||||
return pFilter;
|
return pFilter;
|
||||||
}
|
}
|
||||||
@ -490,12 +505,14 @@ void RimCellFilterCollection::updateCellVisibilityByIndex( cvf::UByteArray* incl
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimPolygonInView*> RimCellFilterCollection::cellFilterPolygons() const
|
std::vector<RimPolygonInView*> RimCellFilterCollection::enabledCellFilterPolygons() const
|
||||||
{
|
{
|
||||||
std::vector<RimPolygonInView*> polyInView;
|
std::vector<RimPolygonInView*> polyInView;
|
||||||
|
|
||||||
for ( const auto& filter : m_cellFilters )
|
for ( const auto& filter : m_cellFilters )
|
||||||
{
|
{
|
||||||
|
if ( !filter->isActive() ) continue;
|
||||||
|
|
||||||
if ( auto polygonFilter = dynamic_cast<RimPolygonFilter*>( filter.p() ) )
|
if ( auto polygonFilter = dynamic_cast<RimPolygonFilter*>( filter.p() ) )
|
||||||
{
|
{
|
||||||
polyInView.push_back( polygonFilter->polygonInView() );
|
polyInView.push_back( polygonFilter->polygonInView() );
|
||||||
|
@ -33,6 +33,7 @@ class RimUserDefinedFilter;
|
|||||||
class RimUserDefinedIndexFilter;
|
class RimUserDefinedIndexFilter;
|
||||||
class RimCase;
|
class RimCase;
|
||||||
class RimPolygonInView;
|
class RimPolygonInView;
|
||||||
|
class RimPolygon;
|
||||||
|
|
||||||
namespace cvf
|
namespace cvf
|
||||||
{
|
{
|
||||||
@ -53,7 +54,7 @@ public:
|
|||||||
|
|
||||||
caf::Signal<> filtersChanged;
|
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 );
|
RimCellRangeFilter* addNewCellRangeFilter( RimCase* srcCase, int gridIndex, int sliceDirection = -1, int defaultSlice = -1 );
|
||||||
RimCellIndexFilter* addNewCellIndexFilter( RimCase* srcCase );
|
RimCellIndexFilter* addNewCellIndexFilter( RimCase* srcCase );
|
||||||
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
RimUserDefinedFilter* addNewUserDefinedFilter( RimCase* srcCase );
|
||||||
@ -70,7 +71,7 @@ public:
|
|||||||
void compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const;
|
void compoundCellRangeFilter( cvf::CellRangeFilter* cellRangeFilter, size_t gridIndex ) const;
|
||||||
void updateCellVisibilityByIndex( cvf::UByteArray* cellsIncluded, cvf::UByteArray* cellsExcluded, size_t gridIndex ) const;
|
void updateCellVisibilityByIndex( cvf::UByteArray* cellsIncluded, cvf::UByteArray* cellsExcluded, size_t gridIndex ) const;
|
||||||
|
|
||||||
std::vector<RimPolygonInView*> cellFilterPolygons() const;
|
std::vector<RimPolygonInView*> enabledCellFilterPolygons() const;
|
||||||
std::vector<RimCellFilter*> filters() const;
|
std::vector<RimCellFilter*> filters() const;
|
||||||
|
|
||||||
bool hasActiveFilters() const;
|
bool hasActiveFilters() const;
|
||||||
|
@ -389,7 +389,7 @@ void RimEclipsePropertyFilter::defineObjectEditorAttribute( QString uiConfigName
|
|||||||
if ( treeItemAttribute )
|
if ( treeItemAttribute )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tags.clear();
|
treeItemAttribute->tags.clear();
|
||||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->icon = caf::IconProvider( ":/chain.png" );
|
tag->icon = caf::IconProvider( ":/chain.png" );
|
||||||
|
|
||||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "RigMainGrid.h"
|
#include "RigMainGrid.h"
|
||||||
#include "RigReservoirGridTools.h"
|
#include "RigReservoirGridTools.h"
|
||||||
|
|
||||||
|
#include "RimCellFilterCollection.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimGeoMechCase.h"
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimPolylineTarget.h"
|
#include "RimPolylineTarget.h"
|
||||||
@ -153,6 +154,18 @@ void RimPolygonFilter::enableKFilter( bool bEnable )
|
|||||||
m_enableKFilter = 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 );
|
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" );
|
auto group = uiOrdering.addNewGroup( "General" );
|
||||||
group->add( &m_filterMode );
|
group->add( &m_filterMode );
|
||||||
group->add( &m_geometricalShape );
|
group->add( &m_geometricalShape );
|
||||||
group->add( &m_enableFiltering );
|
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" );
|
auto group1 = uiOrdering.addNewGroup( "Polygon Selection" );
|
||||||
group1->add( &m_polyFilterMode );
|
group1->add( &m_polyFilterMode );
|
||||||
@ -319,7 +330,7 @@ void RimPolygonFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
|||||||
{
|
{
|
||||||
if ( changedField == &m_editPolygonButton )
|
if ( changedField == &m_editPolygonButton )
|
||||||
{
|
{
|
||||||
RimPolygonTools::selectPolygonInView( m_cellFilterPolygon(), this );
|
RimPolygonTools::selectAndActivatePolygonInView( m_cellFilterPolygon(), this );
|
||||||
|
|
||||||
m_editPolygonButton = false;
|
m_editPolygonButton = false;
|
||||||
|
|
||||||
@ -768,9 +779,9 @@ void RimPolygonFilter::updateCells()
|
|||||||
// get polyline as vector
|
// get polyline as vector
|
||||||
std::vector<cvf::Vec3d> points;
|
std::vector<cvf::Vec3d> 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
|
// 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
|
caf::PickEventHandler* RimPolygonFilter::pickEventHandler() const
|
||||||
{
|
{
|
||||||
|
auto filterColl = firstAncestorOfType<RimCellFilterCollection>();
|
||||||
|
if ( filterColl && !filterColl->isActive() ) return nullptr;
|
||||||
|
|
||||||
|
if ( !isActive() ) return nullptr;
|
||||||
|
|
||||||
return m_pickTargetsEventHandler.get();
|
return m_pickTargetsEventHandler.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ public:
|
|||||||
|
|
||||||
void enableFilter( bool bEnable );
|
void enableFilter( bool bEnable );
|
||||||
void enableKFilter( bool bEnable );
|
void enableKFilter( bool bEnable );
|
||||||
|
void setPolygon( RimPolygon* polygon );
|
||||||
|
|
||||||
bool isFilterEnabled() const override;
|
bool isFilterEnabled() const override;
|
||||||
|
|
||||||
|
@ -21,23 +21,20 @@
|
|||||||
|
|
||||||
#include "RiaVec3Tools.h"
|
#include "RiaVec3Tools.h"
|
||||||
|
|
||||||
#include "RigEclipseCaseData.h"
|
|
||||||
#include "RigMainGrid.h"
|
#include "RigMainGrid.h"
|
||||||
|
#include "RigPolyLinesData.h"
|
||||||
#include "RigSimulationWellCenterLineCalculator.h"
|
#include "RigSimulationWellCenterLineCalculator.h"
|
||||||
#include "RigWellPath.h"
|
#include "RigWellPath.h"
|
||||||
|
|
||||||
|
#include "Polygons/RimPolygon.h"
|
||||||
|
#include "Polygons/RimPolygonCollection.h"
|
||||||
|
#include "Polygons/RimPolygonTools.h"
|
||||||
|
|
||||||
#include "Rim2dIntersectionView.h"
|
#include "Rim2dIntersectionView.h"
|
||||||
#include "Rim3dView.h"
|
#include "Rim3dView.h"
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
#include "RimEclipseCase.h"
|
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimEnsembleSurface.h"
|
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimGridView.h"
|
|
||||||
#include "RimIntersectionResultDefinition.h"
|
|
||||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
|
||||||
#include "RimOilField.h"
|
|
||||||
#include "RimProject.h"
|
|
||||||
#include "RimSimWellInView.h"
|
#include "RimSimWellInView.h"
|
||||||
#include "RimSimWellInViewCollection.h"
|
#include "RimSimWellInViewCollection.h"
|
||||||
#include "RimSurface.h"
|
#include "RimSurface.h"
|
||||||
@ -48,12 +45,8 @@
|
|||||||
#include "RimTools.h"
|
#include "RimTools.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
#include "RiuViewer.h"
|
|
||||||
|
|
||||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||||
|
|
||||||
#include "cafCmdFeature.h"
|
|
||||||
#include "cafCmdFeatureManager.h"
|
|
||||||
#include "cafPdmFieldScriptingCapability.h"
|
#include "cafPdmFieldScriptingCapability.h"
|
||||||
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
||||||
#include "cafPdmObjectScriptingCapability.h"
|
#include "cafPdmObjectScriptingCapability.h"
|
||||||
@ -61,12 +54,9 @@
|
|||||||
#include "cafPdmUiDoubleSliderEditor.h"
|
#include "cafPdmUiDoubleSliderEditor.h"
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
#include "cafPdmUiPushButtonEditor.h"
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
#include "cafPdmUiSliderEditor.h"
|
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafPdmUiTreeSelectionEditor.h"
|
|
||||||
#include "cvfBoundingBox.h"
|
#include "cvfBoundingBox.h"
|
||||||
#include "cvfGeometryTools.h"
|
#include "cvfGeometryTools.h"
|
||||||
#include "cvfPlane.h"
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -77,6 +67,7 @@ void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionEnum>::setUp()
|
|||||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
|
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
|
||||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
|
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
|
||||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
|
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
|
||||||
|
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYGON, "CS_POLYGON", "Project Polygon" );
|
||||||
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE );
|
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,6 +177,17 @@ void RimExtrudedCurveIntersection::configureForPolyLine()
|
|||||||
m_inputPolylineFromViewerEnabled = true;
|
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_InitFieldNoDefault( &m_direction, "Direction", "Direction" );
|
||||||
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path " );
|
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path " );
|
||||||
CAF_PDM_InitScriptableFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" );
|
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_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", "" );
|
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 )
|
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 ||
|
if ( changedField == &m_isActive || changedField == &m_type || changedField == &m_direction || changedField == &m_wellPath ||
|
||||||
changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength ||
|
changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || changedField == &m_lengthUp ||
|
||||||
changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells ||
|
changedField == &m_lengthDown || changedField == &m_showInactiveCells || changedField == &m_useSeparateDataSource ||
|
||||||
changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold ||
|
changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold || changedField == &m_depthLowerThreshold ||
|
||||||
changedField == &m_depthLowerThreshold || changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType ||
|
changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType || changedField == &m_enableKFilter ||
|
||||||
changedField == &m_enableKFilter || changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride )
|
changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride || changedField == &m_projectPolygon )
|
||||||
{
|
{
|
||||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||||
}
|
}
|
||||||
@ -453,7 +460,8 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
|
|||||||
recomputeSimulationWellBranchData();
|
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();
|
updateName();
|
||||||
}
|
}
|
||||||
@ -511,6 +519,15 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
|
|||||||
{
|
{
|
||||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
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_userPolylineXydForUi );
|
||||||
geometryGroup->add( &m_inputPolylineFromViewerEnabled );
|
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 )
|
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
|
||||||
{
|
{
|
||||||
geometryGroup->add( &m_twoAzimuthPoints );
|
geometryGroup->add( &m_twoAzimuthPoints );
|
||||||
@ -668,6 +690,19 @@ QList<caf::PdmOptionItemInfo> RimExtrudedCurveIntersection::calculateValueOption
|
|||||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
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 )
|
else if ( fieldNeedingOptions == &m_branchIndex )
|
||||||
{
|
{
|
||||||
updateSimulationWellCenterline();
|
updateSimulationWellCenterline();
|
||||||
@ -775,8 +810,6 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
|
|||||||
{
|
{
|
||||||
if ( m_simulationWell() )
|
if ( m_simulationWell() )
|
||||||
{
|
{
|
||||||
updateSimulationWellCenterline();
|
|
||||||
|
|
||||||
int branchIndexToUse = branchIndex();
|
int branchIndexToUse = branchIndex();
|
||||||
|
|
||||||
if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast<int>( m_simulationWellBranchCenterlines.size() ) )
|
if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast<int>( m_simulationWellBranchCenterlines.size() ) )
|
||||||
@ -794,6 +827,13 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
|
|||||||
{
|
{
|
||||||
lines.push_back( m_userPolylineXyz );
|
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 )
|
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
|
||||||
{
|
{
|
||||||
lines.push_back( m_twoAzimuthPoints );
|
lines.push_back( m_twoAzimuthPoints );
|
||||||
@ -863,7 +903,7 @@ std::vector<cvf::Vec3d> RimExtrudedCurveIntersection::polyLinesForExtrusionDirec
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimExtrudedCurveIntersection::updateSimulationWellCenterline() const
|
void RimExtrudedCurveIntersection::updateSimulationWellCenterline()
|
||||||
{
|
{
|
||||||
if ( m_isActive() && type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
|
if ( m_isActive() && type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
|
||||||
{
|
{
|
||||||
@ -954,6 +994,10 @@ void RimExtrudedCurveIntersection::updateName()
|
|||||||
{
|
{
|
||||||
m_name = m_wellPath()->name();
|
m_name = m_wellPath()->name();
|
||||||
}
|
}
|
||||||
|
else if ( m_type() == CrossSectionEnum::CS_POLYGON && m_projectPolygon() )
|
||||||
|
{
|
||||||
|
m_name = m_projectPolygon->name();
|
||||||
|
}
|
||||||
|
|
||||||
Rim2dIntersectionView* iView = correspondingIntersectionView();
|
Rim2dIntersectionView* iView = correspondingIntersectionView();
|
||||||
if ( iView )
|
if ( iView )
|
||||||
@ -1081,6 +1125,14 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan
|
|||||||
{
|
{
|
||||||
setBaseColor( m_inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
|
setBaseColor( m_inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( field == &m_editPolygonButton )
|
||||||
|
{
|
||||||
|
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||||
|
{
|
||||||
|
attrib->m_buttonText = "Edit";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
#include "RimIntersectionEnums.h"
|
#include "RimIntersectionEnums.h"
|
||||||
|
|
||||||
#include "cafPdmChildField.h"
|
#include "cafPdmChildField.h"
|
||||||
|
#include "cafPdmFieldCvfVec3d.h"
|
||||||
#include "cafPdmProxyValueField.h"
|
#include "cafPdmProxyValueField.h"
|
||||||
|
|
||||||
#include <QString>
|
#include "cvfVector3.h"
|
||||||
|
|
||||||
class RimWellPath;
|
class RimWellPath;
|
||||||
class RivExtrudedCurveIntersectionPartMgr;
|
class RivExtrudedCurveIntersectionPartMgr;
|
||||||
@ -40,6 +41,7 @@ class RimSurfaceCollection;
|
|||||||
class RimSurfaceIntersectionCollection;
|
class RimSurfaceIntersectionCollection;
|
||||||
class RimSurfaceIntersectionCurve;
|
class RimSurfaceIntersectionCurve;
|
||||||
class RimSurfaceIntersectionBand;
|
class RimSurfaceIntersectionBand;
|
||||||
|
class RimPolygon;
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -62,7 +64,8 @@ public:
|
|||||||
CS_WELL_PATH,
|
CS_WELL_PATH,
|
||||||
CS_SIMULATION_WELL,
|
CS_SIMULATION_WELL,
|
||||||
CS_POLYLINE,
|
CS_POLYLINE,
|
||||||
CS_AZIMUTHLINE
|
CS_AZIMUTHLINE,
|
||||||
|
CS_POLYGON,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class CrossSectionDirEnum
|
enum class CrossSectionDirEnum
|
||||||
@ -102,6 +105,7 @@ public:
|
|||||||
void configureForSimulationWell( RimSimWellInView* simWell );
|
void configureForSimulationWell( RimSimWellInView* simWell );
|
||||||
void configureForWellPath( RimWellPath* wellPath );
|
void configureForWellPath( RimWellPath* wellPath );
|
||||||
void configureForPolyLine();
|
void configureForPolyLine();
|
||||||
|
void configureForProjectPolyLine( RimPolygon* polygon );
|
||||||
void configureForAzimuthLine();
|
void configureForAzimuthLine();
|
||||||
|
|
||||||
std::vector<std::vector<cvf::Vec3d>> polyLines( cvf::Vec3d* flattenedPolylineStartPoint = nullptr ) const;
|
std::vector<std::vector<cvf::Vec3d>> polyLines( cvf::Vec3d* flattenedPolylineStartPoint = nullptr ) const;
|
||||||
@ -134,7 +138,7 @@ public:
|
|||||||
int branchIndex() const;
|
int branchIndex() const;
|
||||||
void rebuildGeometryAndScheduleCreateDisplayModel();
|
void rebuildGeometryAndScheduleCreateDisplayModel();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
caf::PdmFieldHandle* userDescriptionField() final;
|
caf::PdmFieldHandle* userDescriptionField() final;
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
@ -143,13 +147,12 @@ protected:
|
|||||||
|
|
||||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||||
|
|
||||||
private:
|
|
||||||
static void setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute );
|
static void setPushButtonText( bool buttonEnable, caf::PdmUiPushButtonEditorAttribute* attribute );
|
||||||
static void setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute );
|
static void setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute );
|
||||||
|
|
||||||
RimSimWellInViewCollection* simulationWellCollection() const;
|
RimSimWellInViewCollection* simulationWellCollection() const;
|
||||||
void updateAzimuthLine();
|
void updateAzimuthLine();
|
||||||
void updateSimulationWellCenterline() const;
|
void updateSimulationWellCenterline();
|
||||||
void addExtents( std::vector<cvf::Vec3d>& polyLine ) const;
|
void addExtents( std::vector<cvf::Vec3d>& polyLine ) const;
|
||||||
void updateName();
|
void updateName();
|
||||||
static double azimuthInRadians( cvf::Vec3d vec );
|
static double azimuthInRadians( cvf::Vec3d vec );
|
||||||
@ -181,6 +184,9 @@ private:
|
|||||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||||
caf::PdmPtrField<RimSimWellInView*> m_simulationWell;
|
caf::PdmPtrField<RimSimWellInView*> m_simulationWell;
|
||||||
|
|
||||||
|
caf::PdmPtrField<RimPolygon*> m_projectPolygon;
|
||||||
|
caf::PdmField<bool> m_editPolygonButton;
|
||||||
|
|
||||||
caf::PdmField<bool> m_inputPolylineFromViewerEnabled;
|
caf::PdmField<bool> m_inputPolylineFromViewerEnabled;
|
||||||
caf::PdmField<bool> m_inputExtrusionPointsFromViewerEnabled;
|
caf::PdmField<bool> m_inputExtrusionPointsFromViewerEnabled;
|
||||||
caf::PdmField<bool> m_inputTwoAzimuthPointsFromViewerEnabled;
|
caf::PdmField<bool> m_inputTwoAzimuthPointsFromViewerEnabled;
|
||||||
@ -202,7 +208,7 @@ private:
|
|||||||
|
|
||||||
cvf::ref<RivExtrudedCurveIntersectionPartMgr> m_crossSectionPartMgr;
|
cvf::ref<RivExtrudedCurveIntersectionPartMgr> m_crossSectionPartMgr;
|
||||||
|
|
||||||
mutable std::vector<std::vector<cvf::Vec3d>> m_simulationWellBranchCenterlines;
|
std::vector<std::vector<cvf::Vec3d>> m_simulationWellBranchCenterlines;
|
||||||
|
|
||||||
caf::PdmField<bool> m_enableKFilter;
|
caf::PdmField<bool> m_enableKFilter;
|
||||||
caf::PdmField<QString> m_kFilterText;
|
caf::PdmField<QString> m_kFilterText;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "RimIntersection.h"
|
#include "RimIntersection.h"
|
||||||
|
|
||||||
#include "RigEclipseCaseData.h"
|
#include "RigEclipseCaseData.h"
|
||||||
#include "RigFemPartCollection.h"
|
|
||||||
#include "RigGeoMechCaseData.h"
|
#include "RigGeoMechCaseData.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseResultDefinition.h"
|
#include "RimEclipseResultDefinition.h"
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmFieldCvfVec3d.h"
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmPtrField.h"
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
@ -19,7 +19,15 @@
|
|||||||
#include "RimPolygon.h"
|
#include "RimPolygon.h"
|
||||||
|
|
||||||
#include "RigPolyLinesData.h"
|
#include "RigPolyLinesData.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "Rim3dView.h"
|
||||||
#include "RimPolygonAppearance.h"
|
#include "RimPolygonAppearance.h"
|
||||||
|
#include "RimPolygonTools.h"
|
||||||
|
|
||||||
|
#include "cafCmdFeatureMenuBuilder.h"
|
||||||
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
|
#include "cafPdmUiTreeAttributes.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimPolygon, "RimPolygon" );
|
CAF_PDM_SOURCE_INIT( RimPolygon, "RimPolygon" );
|
||||||
|
|
||||||
@ -33,6 +41,10 @@ RimPolygon::RimPolygon()
|
|||||||
|
|
||||||
CAF_PDM_InitField( &m_isReadOnly, "IsReadOnly", false, "Read Only" );
|
CAF_PDM_InitField( &m_isReadOnly, "IsReadOnly", false, "Read Only" );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_pointsInDomainCoords, "PointsInDomainCoords", "Points" );
|
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" );
|
CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance" );
|
||||||
m_appearance = new RimPolygonAppearance;
|
m_appearance = new RimPolygonAppearance;
|
||||||
m_appearance.uiCapability()->setUiTreeChildrenHidden( true );
|
m_appearance.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
@ -61,6 +73,15 @@ void RimPolygon::uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrde
|
|||||||
m_appearance->uiOrdering( uiConfigName, uiOrdering );
|
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();
|
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( nameField() );
|
||||||
uiOrdering.add( &m_isReadOnly );
|
uiOrdering.add( &m_isReadOnly );
|
||||||
|
uiOrdering.add( &m_editPolygonButton );
|
||||||
|
|
||||||
auto groupPoints = uiOrdering.addNewGroup( "Points" );
|
auto groupPoints = uiOrdering.addNewGroup( "Points" );
|
||||||
groupPoints->setCollapsedByDefault();
|
groupPoints->setCollapsedByDefault();
|
||||||
groupPoints->add( &m_pointsInDomainCoords );
|
groupPoints->add( &m_pointsInDomainCoords );
|
||||||
|
|
||||||
|
m_pointsInDomainCoords.uiCapability()->setUiReadOnly( m_isReadOnly() );
|
||||||
|
|
||||||
auto group = uiOrdering.addNewGroup( "Appearance" );
|
auto group = uiOrdering.addNewGroup( "Appearance" );
|
||||||
m_appearance->uiOrdering( uiConfigName, *group );
|
m_appearance->uiOrdering( uiConfigName, *group );
|
||||||
}
|
}
|
||||||
@ -120,6 +160,16 @@ void RimPolygon::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
|
|||||||
{
|
{
|
||||||
objectChanged.send();
|
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();
|
objectChanged.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPolygon::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||||
|
{
|
||||||
|
if ( field == &m_editPolygonButton )
|
||||||
|
{
|
||||||
|
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( 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" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
|
|
||||||
class RimPolygonAppearance;
|
class RimPolygonAppearance;
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
class CmdFeatureMenuBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
class RimPolygon : public RimNamedObject, public RimPolylinesDataInterface
|
class RimPolygon : public RimNamedObject, public RimPolylinesDataInterface
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
@ -43,17 +48,24 @@ public:
|
|||||||
void setIsClosed( bool isClosed );
|
void setIsClosed( bool isClosed );
|
||||||
bool isClosed() const;
|
bool isClosed() const;
|
||||||
|
|
||||||
|
void setReadOnly( bool isReadOnly );
|
||||||
|
bool isReadOnly() const;
|
||||||
|
|
||||||
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
||||||
|
|
||||||
void uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
void uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||||
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
||||||
|
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||||
|
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_isReadOnly;
|
caf::PdmField<bool> m_isReadOnly;
|
||||||
|
caf::PdmField<bool> m_editPolygonButton;
|
||||||
caf::PdmField<std::vector<cvf::Vec3d>> m_pointsInDomainCoords;
|
caf::PdmField<std::vector<cvf::Vec3d>> m_pointsInDomainCoords;
|
||||||
caf::PdmChildField<RimPolygonAppearance*> m_appearance;
|
caf::PdmChildField<RimPolygonAppearance*> m_appearance;
|
||||||
};
|
};
|
||||||
|
@ -139,6 +139,7 @@ std::vector<RimPolygon*> RimPolygonCollection::allPolygons() const
|
|||||||
void RimPolygonCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects )
|
void RimPolygonCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||||
{
|
{
|
||||||
updateViewTreeItems();
|
updateViewTreeItems();
|
||||||
|
scheduleRedrawViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -22,12 +22,14 @@
|
|||||||
|
|
||||||
#include "Rim3dView.h"
|
#include "Rim3dView.h"
|
||||||
#include "RimPolygon.h"
|
#include "RimPolygon.h"
|
||||||
|
#include "RimPolygonInViewCollection.h"
|
||||||
#include "RimPolylineTarget.h"
|
#include "RimPolylineTarget.h"
|
||||||
#include "RimTools.h"
|
#include "RimTools.h"
|
||||||
|
|
||||||
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
|
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
|
||||||
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
|
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
|
||||||
|
|
||||||
|
#include "Riu3DMainWindowTools.h"
|
||||||
#include "RiuGuiTheme.h"
|
#include "RiuGuiTheme.h"
|
||||||
|
|
||||||
#include "RivPolylinePartMgr.h"
|
#include "RivPolylinePartMgr.h"
|
||||||
@ -36,6 +38,7 @@
|
|||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
#include "cafPdmUiPushButtonEditor.h"
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
#include "cafPdmUiTableViewEditor.h"
|
#include "cafPdmUiTableViewEditor.h"
|
||||||
|
#include "cafPdmUiTreeAttributes.h"
|
||||||
|
|
||||||
#include "cvfModelBasicList.h"
|
#include "cvfModelBasicList.h"
|
||||||
|
|
||||||
@ -57,6 +60,9 @@ RimPolygonInView::RimPolygonInView()
|
|||||||
CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "" );
|
CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "" );
|
||||||
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_enablePicking );
|
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_InitField( &m_handleScalingFactor, "HandleScalingFactor", 1.0, "Handle Scaling Factor" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" );
|
CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" );
|
||||||
@ -175,6 +181,13 @@ bool RimPolygonInView::pickingEnabled() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
caf::PickEventHandler* RimPolygonInView::pickEventHandler() const
|
caf::PickEventHandler* RimPolygonInView::pickEventHandler() const
|
||||||
{
|
{
|
||||||
|
auto filterColl = firstAncestorOfType<RimPolygonInViewCollection>();
|
||||||
|
if ( filterColl && !filterColl->isChecked() ) return nullptr;
|
||||||
|
|
||||||
|
if ( !isChecked() ) return nullptr;
|
||||||
|
|
||||||
|
if ( m_polygon() && polygon()->isReadOnly() ) return nullptr;
|
||||||
|
|
||||||
return m_pickTargetsEventHandler.get();
|
return m_pickTargetsEventHandler.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,10 +257,24 @@ void RimPolygonInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
|||||||
{
|
{
|
||||||
updateNameField();
|
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_polygon );
|
||||||
|
|
||||||
|
if ( enableEdit )
|
||||||
|
{
|
||||||
uiOrdering.add( &m_enablePicking );
|
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();
|
updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( changedField == &m_selectPolygon && m_polygon() )
|
||||||
|
{
|
||||||
|
Riu3DMainWindowTools::selectAsCurrentItem( m_polygon() );
|
||||||
|
}
|
||||||
|
|
||||||
updateVisualization();
|
updateVisualization();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,6 +321,11 @@ void RimPolygonInView::defineObjectEditorAttribute( QString uiConfigName, caf::P
|
|||||||
attrib->pickEventHandler = m_pickTargetsEventHandler;
|
attrib->pickEventHandler = m_pickTargetsEventHandler;
|
||||||
attrib->enablePicking = m_enablePicking;
|
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 );
|
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<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||||
|
if ( pbAttribute )
|
||||||
|
{
|
||||||
|
pbAttribute->m_buttonText = "Go to Polygon";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( field == &m_targets )
|
if ( field == &m_targets )
|
||||||
{
|
{
|
||||||
if ( auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute ) )
|
if ( auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute ) )
|
||||||
@ -351,6 +405,8 @@ void RimPolygonInView::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimPolygonInView::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget )
|
void RimPolygonInView::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget )
|
||||||
{
|
{
|
||||||
|
if ( m_polygon() && m_polygon->isReadOnly() ) return;
|
||||||
|
|
||||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||||
|
|
||||||
menuBuilder << "RicNewPolylineTargetFeature";
|
menuBuilder << "RicNewPolylineTargetFeature";
|
||||||
|
@ -78,6 +78,7 @@ protected:
|
|||||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) 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 defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
|
||||||
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateNameField();
|
void updateNameField();
|
||||||
@ -88,6 +89,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
caf::PdmPtrField<RimPolygon*> m_polygon;
|
caf::PdmPtrField<RimPolygon*> m_polygon;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_selectPolygon;
|
||||||
caf::PdmField<bool> m_enablePicking;
|
caf::PdmField<bool> m_enablePicking;
|
||||||
caf::PdmField<double> m_handleScalingFactor;
|
caf::PdmField<double> m_handleScalingFactor;
|
||||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "RimPolygonInViewCollection.h"
|
#include "RimPolygonInViewCollection.h"
|
||||||
|
|
||||||
|
#include "Rim3dView.h"
|
||||||
#include "RimPolygon.h"
|
#include "RimPolygon.h"
|
||||||
#include "RimPolygonCollection.h"
|
#include "RimPolygonCollection.h"
|
||||||
#include "RimPolygonInView.h"
|
#include "RimPolygonInView.h"
|
||||||
@ -83,3 +84,24 @@ std::vector<RimPolygonInView*> RimPolygonInViewCollection::polygonsInView() cons
|
|||||||
{
|
{
|
||||||
return m_polygons.childrenByType();
|
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<Rim3dView>() )
|
||||||
|
{
|
||||||
|
view->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RimCheckableObject.h"
|
||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmObject.h"
|
|
||||||
|
|
||||||
class RimPolygonInView;
|
class RimPolygonInView;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class RimPolygonInView;
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimPolygonInViewCollection : public caf::PdmObject
|
class RimPolygonInViewCollection : public RimCheckableObject
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
@ -38,6 +38,9 @@ public:
|
|||||||
|
|
||||||
std::vector<RimPolygonInView*> polygonsInView() const;
|
std::vector<RimPolygonInView*> polygonsInView() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmChildArrayField<RimPolygonInView*> m_polygons;
|
caf::PdmChildArrayField<RimPolygonInView*> m_polygons;
|
||||||
};
|
};
|
||||||
|
@ -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 );
|
auto polygonInView = findPolygonInView( polygon, sourceObject );
|
||||||
if ( polygonInView )
|
if ( polygonInView )
|
||||||
@ -46,7 +46,12 @@ void RimPolygonTools::selectPolygonInView( RimPolygon* polygon, caf::PdmObject*
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimPolygonInView* RimPolygonTools::findPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject )
|
RimPolygonInView* RimPolygonTools::findPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject )
|
||||||
{
|
{
|
||||||
if ( auto gridView = sourceObject->firstAncestorOfType<RimGridView>() )
|
if ( !polygon || !sourceObject )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( auto gridView = sourceObject->firstAncestorOrThisOfType<RimGridView>() )
|
||||||
{
|
{
|
||||||
auto polyCollection = gridView->polygonInViewCollection();
|
auto polyCollection = gridView->polygonInViewCollection();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class PdmObject;
|
|||||||
class RimPolygonTools
|
class RimPolygonTools
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void selectPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
|
static void selectAndActivatePolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static RimPolygonInView* findPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
|
static RimPolygonInView* findPolygonInView( RimPolygon* polygon, caf::PdmObject* sourceObject );
|
||||||
|
@ -1157,6 +1157,11 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
|
|
||||||
if ( firstUiItem )
|
if ( firstUiItem )
|
||||||
{
|
{
|
||||||
|
if ( auto pdmObject = dynamic_cast<caf::PdmUiObjectHandle*>( firstUiItem ) )
|
||||||
|
{
|
||||||
|
pdmObject->appendMenuItems( menuBuilder );
|
||||||
|
}
|
||||||
|
|
||||||
// Work in progress -- Start
|
// Work in progress -- Start
|
||||||
// All commands should be aware of selection of multiple objects
|
// All commands should be aware of selection of multiple objects
|
||||||
// Based on the selection, the command feature can decide if the command
|
// Based on the selection, the command feature can decide if the command
|
||||||
|
@ -405,14 +405,21 @@ void RimGridView::appendPolygonPartsToModel( caf::DisplayCoordTransform* scaleTr
|
|||||||
m_polygonVizModel->removeAllParts();
|
m_polygonVizModel->removeAllParts();
|
||||||
|
|
||||||
std::vector<RimPolygonInView*> polygonsInView;
|
std::vector<RimPolygonInView*> 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() );
|
polygonsInView.insert( polygonsInView.end(), cellFilterPolygonsInView.begin(), cellFilterPolygonsInView.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ void RimPlotAxisProperties::defineObjectEditorAttribute( QString uiConfigName, c
|
|||||||
if ( treeItemAttribute )
|
if ( treeItemAttribute )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tags.clear();
|
treeItemAttribute->tags.clear();
|
||||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->icon = caf::IconProvider( ":/chain.png" );
|
tag->icon = caf::IconProvider( ":/chain.png" );
|
||||||
|
|
||||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||||
|
@ -1262,7 +1262,7 @@ void RimPlotCurve::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUi
|
|||||||
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
|
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tags.clear();
|
treeItemAttribute->tags.clear();
|
||||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
|
|
||||||
// Blend with background for a nice look
|
// Blend with background for a nice look
|
||||||
auto backgroundColor = RiuGuiTheme::getColorByVariableName( "backgroundColor1" );
|
auto backgroundColor = RiuGuiTheme::getColorByVariableName( "backgroundColor1" );
|
||||||
|
@ -319,7 +319,7 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU
|
|||||||
if ( treeItemAttribute && RiaPreferencesSystem::current()->showViewIdInProjectTree() && id() >= 0 )
|
if ( treeItemAttribute && RiaPreferencesSystem::current()->showViewIdInProjectTree() && id() >= 0 )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tags.clear();
|
treeItemAttribute->tags.clear();
|
||||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->text = QString( "%1" ).arg( id() );
|
tag->text = QString( "%1" ).arg( id() );
|
||||||
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );
|
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );
|
||||||
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
|
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
|
||||||
|
@ -1062,7 +1062,7 @@ void RimEnsembleCurveSet::defineObjectEditorAttribute( QString uiConfigName, caf
|
|||||||
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
|
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tags.clear();
|
treeItemAttribute->tags.clear();
|
||||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->bgColor = RiaColorTools::toQColor( m_colorForRealizations );
|
tag->bgColor = RiaColorTools::toQColor( m_colorForRealizations );
|
||||||
tag->fgColor = RiaColorTools::toQColor( m_statistics->color() );
|
tag->fgColor = RiaColorTools::toQColor( m_statistics->color() );
|
||||||
tag->text = "---";
|
tag->text = "---";
|
||||||
|
@ -204,7 +204,7 @@ void RimSummaryTimeAxisProperties::defineObjectEditorAttribute( QString uiConfig
|
|||||||
if ( treeItemAttribute )
|
if ( treeItemAttribute )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tags.clear();
|
treeItemAttribute->tags.clear();
|
||||||
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->icon = caf::IconProvider( ":/chain.png" );
|
tag->icon = caf::IconProvider( ":/chain.png" );
|
||||||
|
|
||||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||||
|
@ -44,11 +44,37 @@ RigPolyLinesData::~RigPolyLinesData()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const std::vector<std::vector<cvf::Vec3d>>& RigPolyLinesData::polyLines() const
|
const std::vector<std::vector<cvf::Vec3d>>& RigPolyLinesData::rawPolyLines() const
|
||||||
{
|
{
|
||||||
return m_polylines;
|
return m_polylines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Returns the polylines with the last point equal to the first point if the polyline is closed
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::vector<std::vector<cvf::Vec3d>> RigPolyLinesData::completePolyLines() const
|
||||||
|
{
|
||||||
|
if ( !m_closePolyline ) return m_polylines;
|
||||||
|
|
||||||
|
std::vector<std::vector<cvf::Vec3d>> 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;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -34,7 +34,8 @@ public:
|
|||||||
RigPolyLinesData();
|
RigPolyLinesData();
|
||||||
~RigPolyLinesData() override;
|
~RigPolyLinesData() override;
|
||||||
|
|
||||||
const std::vector<std::vector<cvf::Vec3d>>& polyLines() const;
|
const std::vector<std::vector<cvf::Vec3d>>& rawPolyLines() const;
|
||||||
|
const std::vector<std::vector<cvf::Vec3d>> completePolyLines() const;
|
||||||
|
|
||||||
void setPolyLines( const std::vector<std::vector<cvf::Vec3d>>& polyLines );
|
void setPolyLines( const std::vector<std::vector<cvf::Vec3d>>& polyLines );
|
||||||
void setPolyLine( const std::vector<cvf::Vec3d>& polyline );
|
void setPolyLine( const std::vector<cvf::Vec3d>& polyline );
|
||||||
|
@ -13,6 +13,7 @@ class PdmObjectHandle;
|
|||||||
class PdmUiOrdering;
|
class PdmUiOrdering;
|
||||||
class PdmFieldHandle;
|
class PdmFieldHandle;
|
||||||
class PdmUiEditorAttribute;
|
class PdmUiEditorAttribute;
|
||||||
|
class CmdFeatureMenuBuilder;
|
||||||
|
|
||||||
class PdmUiObjectHandle : public PdmUiItem, public PdmObjectCapability
|
class PdmUiObjectHandle : public PdmUiItem, public PdmObjectCapability
|
||||||
{
|
{
|
||||||
@ -44,6 +45,9 @@ public:
|
|||||||
|
|
||||||
void updateUiIconFromToggleField();
|
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
|
// Virtual interface to override in subclasses to support special behaviour if needed
|
||||||
public: // Virtual
|
public: // Virtual
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return nullptr; }
|
virtual caf::PdmFieldHandle* userDescriptionField() { return nullptr; }
|
||||||
|
@ -182,6 +182,7 @@ set(PROJECT_FILES
|
|||||||
cafPdmUiTreeViewItemDelegate.h
|
cafPdmUiTreeViewItemDelegate.h
|
||||||
cafPdmUiTreeViewItemDelegate.cpp
|
cafPdmUiTreeViewItemDelegate.cpp
|
||||||
cafPdmUiTreeAttributes.h
|
cafPdmUiTreeAttributes.h
|
||||||
|
cafPdmUiTreeAttributes.cpp
|
||||||
cafUiAppearanceSettings.cpp
|
cafUiAppearanceSettings.cpp
|
||||||
cafUiIconFactory.cpp
|
cafUiIconFactory.cpp
|
||||||
cafPdmUiSliderTools.h
|
cafPdmUiSliderTools.h
|
||||||
|
61
Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp
Normal file
61
Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp
Normal file
@ -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 <<http://www.gnu.org/licenses/gpl.html>>
|
||||||
|
// 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 <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
//##################################################################################################
|
||||||
|
|
||||||
|
#include "cafPdmUiTreeAttributes.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::unique_ptr<caf::PdmUiTreeViewItemAttribute::Tag> caf::PdmUiTreeViewItemAttribute::createTag()
|
||||||
|
{
|
||||||
|
return std::make_unique<Tag>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute,
|
||||||
|
const QString& iconResourceString )
|
||||||
|
{
|
||||||
|
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
|
||||||
|
{
|
||||||
|
treeItemAttribute->tags.clear();
|
||||||
|
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||||
|
tag->icon = caf::IconProvider( iconResourceString );
|
||||||
|
|
||||||
|
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
//##################################################################################################
|
//##################################################################################################
|
||||||
//
|
//
|
||||||
// Custom Visualization Core library
|
// Custom Visualization Core library
|
||||||
@ -73,12 +71,13 @@ public:
|
|||||||
|
|
||||||
caf::Signal<size_t> clicked;
|
caf::Signal<size_t> clicked;
|
||||||
|
|
||||||
static std::unique_ptr<Tag> create() { return std::make_unique<Tag>(); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tag& operator=( const Tag& rhs ) { return *this; }
|
Tag& operator=( const Tag& rhs ) { return *this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static std::unique_ptr<Tag> createTag();
|
||||||
|
static void createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, const QString& iconString );
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Tag>> tags;
|
std::vector<std::unique_ptr<Tag>> tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
|
|||||||
{
|
{
|
||||||
size_t indexInParentField = reorderability->indexOf( pdmObject );
|
size_t indexInParentField = reorderability->indexOf( pdmObject );
|
||||||
{
|
{
|
||||||
auto tag = PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->icon = caf::IconProvider( ":/caf/Up16x16.png" );
|
tag->icon = caf::IconProvider( ":/caf/Up16x16.png" );
|
||||||
tag->selectedOnly = true;
|
tag->selectedOnly = true;
|
||||||
if ( reorderability->canItemBeMovedUp( indexInParentField ) )
|
if ( reorderability->canItemBeMovedUp( indexInParentField ) )
|
||||||
@ -630,7 +630,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
|
|||||||
m_delegate->addTag( filterIndex, std::move( tag ) );
|
m_delegate->addTag( filterIndex, std::move( tag ) );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto tag = PdmUiTreeViewItemAttribute::Tag::create();
|
auto tag = PdmUiTreeViewItemAttribute::createTag();
|
||||||
tag->icon = IconProvider( ":/caf/Down16x16.png" );
|
tag->icon = IconProvider( ":/caf/Down16x16.png" );
|
||||||
tag->selectedOnly = true;
|
tag->selectedOnly = true;
|
||||||
if ( reorderability->canItemBeMovedDown( indexInParentField ) )
|
if ( reorderability->canItemBeMovedDown( indexInParentField ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user