Skip to content

Commit 66f9a3f

Browse files
committed
Cleanup
1 parent 839465d commit 66f9a3f

File tree

8 files changed

+43
-11
lines changed

8 files changed

+43
-11
lines changed

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ std::vector<cvf::Vec3d> RimPolygon::pointsInDomainCoords() const
7171
return m_pointsInDomainCoords();
7272
}
7373

74+
//--------------------------------------------------------------------------------------------------
75+
///
76+
//--------------------------------------------------------------------------------------------------
77+
bool RimPolygon::isClosed() const
78+
{
79+
return m_appearance->isClosed();
80+
}
81+
7482
//--------------------------------------------------------------------------------------------------
7583
///
7684
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class RimPolygon : public RimNamedObject, public RimPolylinesDataInterface
3939

4040
void setPointsInDomainCoords( const std::vector<cvf::Vec3d>& points );
4141
std::vector<cvf::Vec3d> pointsInDomainCoords() const;
42+
bool isClosed() const;
4243

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

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonAppearance.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ void RimPolygonAppearance::applyAppearanceSettings( RigPolyLinesData* polyLinesD
115115
polyLinesData->setVisibility( m_showLines, m_showSpheres );
116116
}
117117

118+
//--------------------------------------------------------------------------------------------------
119+
///
120+
//--------------------------------------------------------------------------------------------------
121+
bool RimPolygonAppearance::isClosed() const
122+
{
123+
return m_isClosed();
124+
}
125+
118126
//--------------------------------------------------------------------------------------------------
119127
///
120128
//--------------------------------------------------------------------------------------------------
@@ -139,6 +147,9 @@ void RimPolygonAppearance::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd
139147
{
140148
uiOrdering.add( &m_polygonPlaneDepth );
141149
}
150+
151+
uiOrdering.add( &m_isClosed );
152+
142153
uiOrdering.skipRemainingFields();
143154
}
144155

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonAppearance.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class RimPolygonAppearance : public caf::PdmObject
3131

3232
void applyAppearanceSettings( RigPolyLinesData* polyLinesData );
3333

34+
bool isClosed() const;
35+
3436
public:
3537
RimPolygonAppearance();
3638
~RimPolygonAppearance() override;

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ RimPolygonCollection::RimPolygonCollection()
3636
CAF_PDM_InitFieldNoDefault( &m_polygonFiles, "PolygonFiles", "Polygon Files" );
3737
}
3838

39-
4039
//--------------------------------------------------------------------------------------------------
4140
///
4241
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ RimPolygonFile::RimPolygonFile()
3434
setDeletable( true );
3535
}
3636

37-
3837
//--------------------------------------------------------------------------------------------------
3938
///
4039
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ RimPolygon* RimPolygonInView::polygon() const
8181
void RimPolygonInView::setPolygon( RimPolygon* polygon )
8282
{
8383
m_polygon = polygon;
84+
85+
updateTargetsFromPolygon();
8486
}
8587

8688
//--------------------------------------------------------------------------------------------------
8789
///
8890
//--------------------------------------------------------------------------------------------------
89-
void RimPolygonInView::appendPartsToModel( cvf::ModelBasicList* model,
90-
caf::DisplayCoordTransform* scaleTransform,
91-
const cvf::BoundingBox& boundingBox )
91+
void RimPolygonInView::appendPartsToModel( cvf::ModelBasicList* model,
92+
const caf::DisplayCoordTransform* scaleTransform,
93+
const cvf::BoundingBox& boundingBox )
9294
{
9395
auto view = firstAncestorOfType<Rim3dView>();
9496

@@ -97,6 +99,14 @@ void RimPolygonInView::appendPartsToModel( cvf::ModelBasicList* model,
9799
m_polylinePartMgr->appendDynamicGeometryPartsToModel( model, scaleTransform, boundingBox );
98100
}
99101

102+
//--------------------------------------------------------------------------------------------------
103+
///
104+
//--------------------------------------------------------------------------------------------------
105+
void RimPolygonInView::enablePicking( bool enable )
106+
{
107+
m_enablePicking = enable;
108+
}
109+
100110
//--------------------------------------------------------------------------------------------------
101111
///
102112
//--------------------------------------------------------------------------------------------------
@@ -233,7 +243,7 @@ void RimPolygonInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
233243
{
234244
updateNameField();
235245

236-
uiOrdering.add( m_polygon );
246+
if ( m_polygon() ) uiOrdering.add( m_polygon );
237247
uiOrdering.add( &m_enablePicking );
238248
}
239249

@@ -244,7 +254,7 @@ void RimPolygonInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
244254
{
245255
if ( changedField == &m_enablePicking )
246256
{
247-
updateAllRequiredEditors();
257+
updateConnectedEditors();
248258
}
249259

250260
updateVisualization();

ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class RimPolygonInView : public RimCheckableNamedObject, public RimPolylinesData
5050
RimPolygon* polygon() const;
5151
void setPolygon( RimPolygon* polygon );
5252

53-
void appendPartsToModel( cvf::ModelBasicList* model, caf::DisplayCoordTransform* scaleTransform, const cvf::BoundingBox& boundingBox );
53+
void appendPartsToModel( cvf::ModelBasicList* model, const caf::DisplayCoordTransform* scaleTransform, const cvf::BoundingBox& boundingBox );
54+
void enablePicking( bool enable );
5455

5556
// RimPolylinesDataInterface
5657
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
@@ -61,20 +62,21 @@ class RimPolygonInView : public RimCheckableNamedObject, public RimPolylinesData
6162
bool pickingEnabled() const override;
6263
caf::PickEventHandler* pickEventHandler() const override;
6364

65+
cvf::ref<RigPolyLinesData> polyLinesData() const override;
66+
6467
void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& updatedObjects ) override;
68+
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
6569

6670
protected:
6771
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
6872
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
6973
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
7074
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
71-
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
7275
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
7376
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
7477

7578
private:
76-
void updateNameField();
77-
cvf::ref<RigPolyLinesData> polyLinesData() const override;
79+
void updateNameField();
7880

7981
void updatePolygonFromTargets();
8082
void updateTargetsFromPolygon();

0 commit comments

Comments
 (0)