Skip to content

Commit 8294c43

Browse files
committed
More doxymentation
1 parent a4dac6a commit 8294c43

File tree

4 files changed

+111
-63
lines changed

4 files changed

+111
-63
lines changed

python/core/qgsvectorlayereditutils.sip

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010

1111

12-
1312
class QgsVectorLayerEditUtils
1413
{
1514

@@ -66,22 +65,22 @@ class QgsVectorLayerEditUtils
6665
QgsGeometry::OperationResult addRing( const QList<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 );
6766
%Docstring
6867
Adds a ring to polygon/multipolygon features
69-
@param ring ring to add
70-
@param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
68+
\param ring ring to add
69+
\param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
7170
all intersecting features are tested and the ring is added to the first valid feature.
72-
@param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
73-
@return OperationResult result code: success or reason of failure
71+
\param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
72+
:return: OperationResult result code: success or reason of failure
7473
:rtype: QgsGeometry.OperationResult
7574
%End
7675

7776
QgsGeometry::OperationResult addRing( QgsCurve *ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 ) /PyName=addCurvedRing/;
7877
%Docstring
7978
Adds a ring to polygon/multipolygon features
80-
@param ring ring to add
81-
@param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
79+
\param ring ring to add
80+
\param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
8281
all intersecting features are tested and the ring is added to the first valid feature.
83-
@param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
84-
@return OperationResult result code: success or reason of failure
82+
\param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
83+
:return: OperationResult result code: success or reason of failure
8584
.. note::
8685

8786
available in python bindings as addCurvedRing
@@ -91,14 +90,25 @@ class QgsVectorLayerEditUtils
9190
QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring, QgsFeatureId featureId );
9291
%Docstring
9392
Adds a new part polygon to a multipart feature
94-
@returns QgsGeometry.OperationResult a result code: success or reason of failure
93+
:return:
94+
- QgsGeometry.Success
95+
- QgsGeometry.AddPartSelectedGeometryNotFound
96+
- QgsGeometry.AddPartNotMultiGeometry
97+
- QgsGeometry.InvalidBaseGeometry
98+
- QgsGeometry.InvalidInput
9599
:rtype: QgsGeometry.OperationResult
96100
%End
97101

98102
QgsGeometry::OperationResult addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
99103
%Docstring
100104
Adds a new part polygon to a multipart feature
101-
@returns QgsGeometry.OperationResult a result code: success or reason of failure
105+
106+
:return:
107+
- QgsGeometry.Success
108+
- QgsGeometry.AddPartSelectedGeometryNotFound
109+
- QgsGeometry.AddPartNotMultiGeometry
110+
- QgsGeometry.InvalidBaseGeometry
111+
- QgsGeometry.InvalidInput
102112
.. note::
103113

104114
available in python bindings as addPartV2
@@ -107,6 +117,18 @@ class QgsVectorLayerEditUtils
107117

108118
QgsGeometry::OperationResult addPart( QgsCurve *ring, QgsFeatureId featureId ) /PyName=addCurvedPart/;
109119
%Docstring
120+
Add a new part polygon to a multipart feature
121+
122+
:return:
123+
- QgsGeometry.Success
124+
- QgsGeometry.AddPartSelectedGeometryNotFound
125+
- QgsGeometry.AddPartNotMultiGeometry
126+
- QgsGeometry.InvalidBaseGeometry
127+
- QgsGeometry.InvalidInput
128+
129+
.. note::
130+
131+
available in python bindings as addCurvedPart
110132
:rtype: QgsGeometry.OperationResult
111133
%End
112134

@@ -122,11 +144,28 @@ class QgsVectorLayerEditUtils
122144

123145
QgsGeometry::OperationResult splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
124146
%Docstring
147+
Split parts cut by the given line
148+
\param splitLine line that splits the layer feature parts
149+
\param topologicalEditing true if topological editing is enabled
150+
:return:
151+
- QgsGeometry.InvalidBaseGeometry
152+
- QgsGeometry.Success
153+
- QgsGeometry.InvalidInput
154+
- QgsGeometry.NothingHappened if a selection is present but no feature has been split
155+
- QgsGeometry.InvalidBaseGeometry
156+
- QgsGeometry.GeometryEngineError
157+
- QgsGeometry.SplitCannotSplitPoint
125158
:rtype: QgsGeometry.OperationResult
126159
%End
127160

128161
QgsGeometry::OperationResult splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
129162
%Docstring
163+
Splits features cut by the given line
164+
\param splitLine line that splits the layer features
165+
\param topologicalEditing true if topological editing is enabled
166+
:return:
167+
0 in case of success,
168+
4 if there is a selection but no feature split
130169
:rtype: QgsGeometry.OperationResult
131170
%End
132171

src/core/geometry/qgsgeometry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class CORE_EXPORT QgsGeometry
9999

100100
/**
101101
* Success or failure of a geometry operation.
102-
* This gived details about cause of failure.
102+
* This gives details about cause of failure.
103103
*/
104104
enum OperationResult
105105
{

src/core/qgsvectorlayereditutils.cpp

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
443443
fit = mLayer->getFeatures( QgsFeatureRequest().setFilterRect( bBox ).setFlags( QgsFeatureRequest::ExactIntersect ) );
444444
}
445445

446-
int addPartRet = 0;
446+
QgsGeometry::OperationResult addPartRet = QgsGeometry::Success;
447447

448448
QgsFeature feat;
449449
while ( fit.nextFeature( feat ) )
@@ -472,25 +472,6 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
472472
{
473473
mLayer->editBuffer()->changeGeometry( feat.id(), featureGeom );
474474
}
475-
else
476-
{
477-
// Test addPartRet
478-
switch ( addPartRet )
479-
{
480-
case 1:
481-
QgsDebugMsg( "Not a multipolygon" );
482-
break;
483-
484-
case 2:
485-
QgsDebugMsg( "Not a valid geometry" );
486-
break;
487-
488-
case 3:
489-
QgsDebugMsg( "New polygon ring" );
490-
break;
491-
}
492-
}
493-
mLayer->editBuffer()->changeGeometry( feat.id(), featureGeom );
494475

495476
if ( topologicalEditing )
496477
{
@@ -502,13 +483,13 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
502483
}
503484
++numberOfSplitParts;
504485
}
505-
else if ( splitFunctionReturn > 1 ) //1 means no split but also no error
486+
else if ( splitFunctionReturn != QgsGeometry::Success && splitFunctionReturn != QgsGeometry::NothingHappened )
506487
{
507488
returnCode = splitFunctionReturn;
508489
}
509490
}
510491

511-
if ( numberOfSplitParts == 0 && mLayer->selectedFeatureCount() > 0 && returnCode == 0 )
492+
if ( numberOfSplitParts == 0 && mLayer->selectedFeatureCount() > 0 && returnCode == QgsGeometry::Success )
512493
{
513494
//There is a selection but no feature has been split.
514495
//Maybe user forgot that only the selected features are split

src/core/qgsvectorlayereditutils.h

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,67 +65,95 @@ class CORE_EXPORT QgsVectorLayerEditUtils
6565
QgsVectorLayer::EditResult deleteVertex( QgsFeatureId featureId, int vertex );
6666

6767
/** Adds a ring to polygon/multipolygon features
68-
* @param ring ring to add
69-
* @param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
68+
* \param ring ring to add
69+
* \param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
7070
* all intersecting features are tested and the ring is added to the first valid feature.
71-
* @param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
72-
* @return OperationResult result code: success or reason of failure
71+
* \param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
72+
* \return OperationResult result code: success or reason of failure
7373
*/
7474
QgsGeometry::OperationResult addRing( const QList<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr );
7575

7676
/**
7777
* Adds a ring to polygon/multipolygon features
78-
* @param ring ring to add
79-
* @param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
78+
* \param ring ring to add
79+
* \param targetFeatureIds if specified, only these features will be the candidates for adding a ring. Otherwise
8080
* all intersecting features are tested and the ring is added to the first valid feature.
81-
* @param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
82-
* @return OperationResult result code: success or reason of failure
83-
* @note available in python bindings as addCurvedRing
81+
* \param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter
82+
* \return OperationResult result code: success or reason of failure
83+
* \note available in python bindings as addCurvedRing
8484
*/
8585
QgsGeometry::OperationResult addRing( QgsCurve *ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ) SIP_PYNAME( addCurvedRing );
8686

8787
/**
8888
* Adds a new part polygon to a multipart feature
89-
* @returns QgsGeometry::OperationResult a result code: success or reason of failure
89+
* \return
90+
* - QgsGeometry::Success
91+
* - QgsGeometry::AddPartSelectedGeometryNotFound
92+
* - QgsGeometry::AddPartNotMultiGeometry
93+
* - QgsGeometry::InvalidBaseGeometry
94+
* - QgsGeometry::InvalidInput
9095
*/
9196
QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring, QgsFeatureId featureId );
9297

9398
/**
9499
* Adds a new part polygon to a multipart feature
95-
* @returns QgsGeometry::OperationResult a result code: success or reason of failure
96-
* @note available in python bindings as addPartV2
100+
*
101+
* \return
102+
* - QgsGeometry::Success
103+
* - QgsGeometry::AddPartSelectedGeometryNotFound
104+
* - QgsGeometry::AddPartNotMultiGeometry
105+
* - QgsGeometry::InvalidBaseGeometry
106+
* - QgsGeometry::InvalidInput
107+
* \note available in python bindings as addPartV2
97108
*/
98109
QgsGeometry::OperationResult addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
99110

100-
// @note available in python bindings as addCurvedPart
111+
/**
112+
* Add a new part polygon to a multipart feature
113+
*
114+
* \return
115+
* - QgsGeometry::Success
116+
* - QgsGeometry::AddPartSelectedGeometryNotFound
117+
* - QgsGeometry::AddPartNotMultiGeometry
118+
* - QgsGeometry::InvalidBaseGeometry
119+
* - QgsGeometry::InvalidInput
120+
*
121+
* \note available in python bindings as addCurvedPart
122+
*/
101123
QgsGeometry::OperationResult addPart( QgsCurve *ring, QgsFeatureId featureId ) SIP_PYNAME( addCurvedPart );
102124

103-
/** Translates feature by dx, dy
125+
/**
126+
* Translates feature by dx, dy
104127
* \param featureId id of the feature to translate
105128
* \param dx translation of x-coordinate
106129
* \param dy translation of y-coordinate
107-
* \returns 0 in case of success
130+
* \return 0 in case of success
108131
*/
109132
int translateFeature( QgsFeatureId featureId, double dx, double dy );
110133

111-
/** Splits parts cut by the given line
112-
* \param splitLine line that splits the layer feature parts
113-
* \param topologicalEditing true if topological editing is enabled
114-
* \returns
115-
* 0 in case of success,
116-
* 4 if there is a selection but no feature split
134+
/**
135+
* Split parts cut by the given line
136+
* \param splitLine line that splits the layer feature parts
137+
* \param topologicalEditing true if topological editing is enabled
138+
* \return
139+
* - QgsGeometry::InvalidBaseGeometry
140+
* - QgsGeometry::Success
141+
* - QgsGeometry::InvalidInput
142+
* - QgsGeometry::NothingHappened if a selection is present but no feature has been split
143+
* - QgsGeometry::InvalidBaseGeometry
144+
* - QgsGeometry::GeometryEngineError
145+
* - QgsGeometry::SplitCannotSplitPoint
117146
*/
118-
// TODO QGIS 3.0 returns an enum instead of a magic constant
119147
QgsGeometry::OperationResult splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
120148

121-
/** Splits features cut by the given line
122-
* \param splitLine line that splits the layer features
123-
* \param topologicalEditing true if topological editing is enabled
124-
* \returns
125-
* 0 in case of success,
126-
* 4 if there is a selection but no feature split
149+
/**
150+
* Splits features cut by the given line
151+
* \param splitLine line that splits the layer features
152+
* \param topologicalEditing true if topological editing is enabled
153+
* \return
154+
* 0 in case of success,
155+
* 4 if there is a selection but no feature split
127156
*/
128-
// TODO QGIS 3.0 returns an enum instead of a magic constant
129157
QgsGeometry::OperationResult splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
130158

131159
/** Adds topological points for every vertex of the geometry.

0 commit comments

Comments
 (0)