Skip to content

Commit

Permalink
Prepare for release 2024.12
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Dec 6, 2024
2 parents 28c46a4 + 4eb2a2d commit 19ae259
Show file tree
Hide file tree
Showing 18 changed files with 6,506 additions and 39 deletions.
5,882 changes: 5,882 additions & 0 deletions ApplicationLibCode/Adm/projectfilekeywords/2024.12/ri-fieldKeywords.txt

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonCollection.h"
#include "Polygons/RimPolygonInView.h"

#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmFieldReorderCapability.h"
Expand Down Expand Up @@ -619,7 +620,13 @@ std::vector<RimPolygonInView*> RimCellFilterCollection::enabledCellFilterPolygon

if ( auto polygonFilter = dynamic_cast<RimPolygonFilter*>( filter.p() ) )
{
polyInView.push_back( polygonFilter->polygonInView() );
if ( !polygonFilter->isSelected() ) continue;

auto piv = polygonFilter->polygonInView();
if ( piv && piv->showLines() )
{
polyInView.push_back( piv );
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"

#include "cafPdmUiPushButtonEditor.h"
#include "cafSelectionManager.h"

#include <limits>

Expand Down Expand Up @@ -92,6 +93,7 @@ RimPolygonFilter::RimPolygonFilter()
: RimCellFilter( RimCellFilter::INDEX )
, m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
, m_intervalTool( true )
, m_isSelected( false )
{
CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polygon.png" );

Expand Down Expand Up @@ -174,6 +176,14 @@ bool RimPolygonFilter::isFilterEnabled() const
return m_isActive() && m_enableFiltering;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPolygonFilter::isSelected() const
{
return m_isSelected;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1003,6 +1013,21 @@ void RimPolygonFilter::onObjectChanged( const caf::SignalEmitter* emitter )
updateIconState();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolygonFilter::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
{
bool selectedState = m_isSelected;
auto selectedFilter = dynamic_cast<RimPolygonFilter*>( caf::SelectionManager::instance()->selectedItem() );
m_isSelected = ( selectedFilter == this );

if ( selectedState != m_isSelected )
{
filterChanged.send();
}
}

//--------------------------------------------------------------------------------------------------
/// Find which K layer we hit, in any of the grids, for any of the selected points
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "cafPdmChildField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafSelectionChangedReceiver.h"

class RimPolygon;
class RimPolylineTarget;
Expand All @@ -40,7 +41,7 @@ class RicPolylineTargetsPickEventHandler;
///
///
//==================================================================================================
class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface
class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface, public caf::SelectionChangedReceiver
{
CAF_PDM_HEADER_INIT;

Expand Down Expand Up @@ -77,8 +78,10 @@ class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface
void setPolygon( RimPolygon* polygon );

bool isFilterEnabled() const override;
bool isSelected() const;

void enablePicking( bool enable );
bool pickingEnabled() const override;

void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ) override;
void onGridChanged() override;
Expand All @@ -96,6 +99,8 @@ class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface

QString fullName() const override;

void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;

private:
void updateCells();
void updateCellsForEclipse( const std::vector<cvf::Vec3d>& points, RimEclipseCase* eCase );
Expand Down Expand Up @@ -124,7 +129,6 @@ class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface
void updateEditorsAndVisualization() override;
void updateVisualization() override;
std::vector<RimPolylineTarget*> activeTargets() const override;
bool pickingEnabled() const override;
caf::PickEventHandler* pickEventHandler() const override;

caf::AppEnum<GeometricalShape> geometricalShape() const;
Expand All @@ -144,6 +148,8 @@ class RimPolygonFilter : public RimCellFilter, public RimPolylinePickerInterface

RimCellFilterIntervalTool m_intervalTool;

bool m_isSelected;

// Local polygon and polygon editor
caf::PdmPtrField<RimPolygon*> m_cellFilterPolygon;
caf::PdmChildField<RimPolygon*> m_internalPolygon;
Expand Down
11 changes: 9 additions & 2 deletions ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ void RimPolygon::setColor( const cvf::Color3f& color )
m_appearance->setLineColor( color );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPolygon::showLines() const
{
return m_appearance->showLines();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -186,7 +194,6 @@ void RimPolygon::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
if ( changedField == &m_pointsInDomainCoords )
{
coordinatesChanged.send();
objectChanged.send();
}

if ( changedField == &m_editPolygonButton )
Expand All @@ -195,9 +202,9 @@ void RimPolygon::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
RimPolygonTools::activate3dEditOfPolygonInView( this, activeView );

m_editPolygonButton = false;

return;
}
objectChanged.send();
}

//--------------------------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class RimPolygon : public RimNamedObject, public RimPolylinesDataInterface
cvf::Color3f color() const;
void setColor( const cvf::Color3f& color );

bool showLines() const;

cvf::ref<RigPolyLinesData> polyLinesData() const override;

void uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ bool RimPolygonAppearance::isClosed() const
return m_isClosed();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPolygonAppearance::showLines() const
{
return m_showLines();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class RimPolygonAppearance : public caf::PdmObject
cvf::Color3f lineColor() const;
void setLineColor( const cvf::Color3f& color );

bool showLines() const;

public:
RimPolygonAppearance();

Expand Down
21 changes: 17 additions & 4 deletions ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ RimPolygonFile::RimPolygonFile()
{
CAF_PDM_InitObject( "PolygonFile", ":/Folder.png" );

CAF_PDM_InitFieldNoDefault( &m_fileName, "StimPlanFileName", "File Name" );
CAF_PDM_InitFieldNoDefault( &m_fileName, "FileName", "File Name" );
m_fileName.registerKeywordAlias( "StimPlanFileName" );
m_fileName.uiCapability()->setUiReadOnly( true );

CAF_PDM_InitFieldNoDefault( &m_polygons, "Polygons", "Polygons" );

setDeletable( true );
Expand All @@ -62,12 +65,18 @@ void RimPolygonFile::loadData()
{
auto polygonsFromFile = importDataFromFile( m_fileName().path() );

if ( polygonsFromFile.size() == 1 )
{
polygonsFromFile[0]->setName( name() );
}

if ( m_polygons.size() == polygonsFromFile.size() )
{
for ( size_t i = 0; i < m_polygons.size(); i++ )
{
auto projectPoly = m_polygons()[i];
auto filePoly = polygonsFromFile[i];
projectPoly->setDeletable( false );
auto filePoly = polygonsFromFile[i];
projectPoly->setPointsInDomainCoords( filePoly->pointsInDomainCoords() );
projectPoly->coordinatesChanged.send(); // updates editors
projectPoly->objectChanged.send(); // updates filters
Expand Down Expand Up @@ -157,14 +166,18 @@ std::vector<RimPolygon*> RimPolygonFile::importDataFromFile( const QString& file

std::vector<RimPolygon*> polygons;

QFileInfo fi( fileName );
const QString basename = fi.baseName();

for ( const auto& [polygonId, filePolygon] : filePolygons )
{
auto polygon = new RimPolygon();
polygon->disableStorageOfPolygonPoints();
polygon->setReadOnly( true );
polygon->setDeletable( false );

int id = ( polygonId != -1 ) ? polygonId : static_cast<int>( polygons.size() + 1 );
polygon->setName( QString( "Polygon %1" ).arg( id ) );
polygon->setName( QString( "%1 (%2)" ).arg( basename ).arg( id ) );
polygon->setPointsInDomainCoords( filePolygon );
polygons.push_back( polygon );
}
Expand All @@ -183,7 +196,7 @@ std::vector<RimPolygon*> RimPolygonFile::importDataFromFile( const QString& file
void RimPolygonFile::updateName()
{
QFileInfo fileInfo( m_fileName().path() );
setName( fileInfo.fileName() );
setName( fileInfo.baseName() );
}

//--------------------------------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ void RimPolygonInView::updateVisualization()
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPolygonInView::showLines() const
{
if ( auto poly = polygon() )
{
return poly->showLines() && isChecked();
}
return false;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -389,6 +401,11 @@ void RimPolygonInView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder
//--------------------------------------------------------------------------------------------------
void RimPolygonInView::onObjectChanged( const caf::SignalEmitter* emitter )
{
// make sure name is in sync
if ( dynamic_cast<const RimPolygon*>( emitter ) )
{
setName( m_polygon->name() );
}
updateVisualization();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class RimPolygonInView : public RimCheckableNamedObject, public RimPolylinesData

cvf::ref<RigPolyLinesData> polyLinesData() const override;

bool showLines() const;

void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects ) override;
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimPolygonInViewCollection, "RimPolygonInViewCollection" );
//--------------------------------------------------------------------------------------------------
RimPolygonInViewCollection::RimPolygonInViewCollection()
{
CAF_PDM_InitObject( "Polygons", ":/PolylinesFromFile16x16.png" );
CAF_PDM_InitObject( "Polygons", ":/Folder.png" );

CAF_PDM_InitFieldNoDefault( &m_polygonsInView, "Polygons", "Polygons" );
CAF_PDM_InitFieldNoDefault( &m_collectionsInView, "Collections", "Collections" );
Expand Down Expand Up @@ -172,6 +172,7 @@ void RimPolygonInViewCollection::syncCollectionsWithView()
for ( auto polygonFile : polygonCollection->polygonFiles() )
{
if ( polygonFile->polygons().empty() ) continue;
if ( polygonFile->polygons().size() == 1 ) continue;

auto viewPolygonFile = getCollectionInViewForPolygonFile( polygonFile );
if ( viewPolygonFile == nullptr )
Expand Down Expand Up @@ -217,6 +218,13 @@ void RimPolygonInViewCollection::syncPolygonsWithView()
{
auto polygonCollection = RimTools::polygonCollection();
polygons = polygonCollection->userDefinedPolygons();
for ( auto polyfile : polygonCollection->polygonFiles() )
{
if ( polyfile->polygons().size() == 1 )
{
polygons.push_back( polyfile->polygons()[0] );
}
}
}

std::vector<RimPolygonInView*> newPolygonsInView;
Expand Down
1 change: 1 addition & 0 deletions ApplicationLibCode/ProjectDataModel/RimGridView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ RimGridView::RimGridView()

CAF_PDM_InitFieldNoDefault( &m_polygonInViewCollection, "PolygonInViewCollection", "Polygon Collection Field" );
m_polygonInViewCollection = new RimPolygonInViewCollection();
m_polygonInViewCollection->uiCapability()->setUiIcon( caf::IconProvider( ":/PolylinesFromFile16x16.png" ) );

CAF_PDM_InitFieldNoDefault( &m_cellFilterCollection, "RangeFilters", "Cell Filter Collection Field" );
m_cellFilterCollection = new RimCellFilterCollection();
Expand Down
21 changes: 0 additions & 21 deletions ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,27 +558,6 @@ std::pair<int, int> RiuMultiPlotPage::rowAndColumnCount( int plotWidgetCount ) c
return std::make_pair( rowCount, columnCount );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels )
{
if ( !m_plotDefinition ) return;

for ( RiuPlotWidget* plotWidget : m_plotWidgets )
{
if ( !plotWidget ) continue;
RimPlot* plot = plotWidget->plotDefinition();
if ( !plot ) continue;

bool isSelected = false;
for ( int changedLevel : changedSelectionLevels )
{
isSelected = isSelected || caf::SelectionManager::instance()->isSelected( plot, changedLevel );
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
5 changes: 1 addition & 4 deletions ApplicationLibCode/UserInterface/RiuMultiPlotPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "RiaDefines.h"

#include "cafPdmPointer.h"
#include "cafSelectionChangedReceiver.h"

#include "qwt_axis_id.h"

Expand Down Expand Up @@ -55,7 +54,7 @@ class QwtPlot;
// RiuMultiPlotPage
//
//==================================================================================================
class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, public RiuInterfaceToViewWindow
class RiuMultiPlotPage : public QWidget, public RiuInterfaceToViewWindow
{
Q_OBJECT

Expand Down Expand Up @@ -117,8 +116,6 @@ public slots:
void alignAxes();
void alignAxis( QwtAxisId axis, int row, std::function<bool( int, int, int )> positionMatcher );

void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;

virtual bool showYAxis( int row, int column ) const;

virtual void reinsertPlotWidgets();
Expand Down
Loading

0 comments on commit 19ae259

Please sign in to comment.