Skip to content
Permalink
Browse files

More doxymentation

  • Loading branch information
m-kuhn committed Aug 14, 2017
1 parent a4dac6a commit 8294c434c6114d11b8fcb6b4c2e3514853a0eefa
@@ -9,7 +9,6 @@




class QgsVectorLayerEditUtils
{

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

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

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

QgsGeometry::OperationResult addPart( const QgsPointSequence &ring, QgsFeatureId featureId );
%Docstring
Adds a new part polygon to a multipart feature
@returns QgsGeometry.OperationResult a result code: success or reason of failure

:return:
- QgsGeometry.Success
- QgsGeometry.AddPartSelectedGeometryNotFound
- QgsGeometry.AddPartNotMultiGeometry
- QgsGeometry.InvalidBaseGeometry
- QgsGeometry.InvalidInput
.. note::

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

QgsGeometry::OperationResult addPart( QgsCurve *ring, QgsFeatureId featureId ) /PyName=addCurvedPart/;
%Docstring
Add a new part polygon to a multipart feature

:return:
- QgsGeometry.Success
- QgsGeometry.AddPartSelectedGeometryNotFound
- QgsGeometry.AddPartNotMultiGeometry
- QgsGeometry.InvalidBaseGeometry
- QgsGeometry.InvalidInput

.. note::

available in python bindings as addCurvedPart
:rtype: QgsGeometry.OperationResult
%End

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

QgsGeometry::OperationResult splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
%Docstring
Split parts cut by the given line
\param splitLine line that splits the layer feature parts
\param topologicalEditing true if topological editing is enabled
:return:
- QgsGeometry.InvalidBaseGeometry
- QgsGeometry.Success
- QgsGeometry.InvalidInput
- QgsGeometry.NothingHappened if a selection is present but no feature has been split
- QgsGeometry.InvalidBaseGeometry
- QgsGeometry.GeometryEngineError
- QgsGeometry.SplitCannotSplitPoint
:rtype: QgsGeometry.OperationResult
%End

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

@@ -99,7 +99,7 @@ class CORE_EXPORT QgsGeometry

/**
* Success or failure of a geometry operation.
* This gived details about cause of failure.
* This gives details about cause of failure.
*/
enum OperationResult
{
@@ -443,7 +443,7 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
fit = mLayer->getFeatures( QgsFeatureRequest().setFilterRect( bBox ).setFlags( QgsFeatureRequest::ExactIntersect ) );
}

int addPartRet = 0;
QgsGeometry::OperationResult addPartRet = QgsGeometry::Success;

QgsFeature feat;
while ( fit.nextFeature( feat ) )
@@ -472,25 +472,6 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
{
mLayer->editBuffer()->changeGeometry( feat.id(), featureGeom );
}
else
{
// Test addPartRet
switch ( addPartRet )
{
case 1:
QgsDebugMsg( "Not a multipolygon" );
break;

case 2:
QgsDebugMsg( "Not a valid geometry" );
break;

case 3:
QgsDebugMsg( "New polygon ring" );
break;
}
}
mLayer->editBuffer()->changeGeometry( feat.id(), featureGeom );

if ( topologicalEditing )
{
@@ -502,13 +483,13 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
}
++numberOfSplitParts;
}
else if ( splitFunctionReturn > 1 ) //1 means no split but also no error
else if ( splitFunctionReturn != QgsGeometry::Success && splitFunctionReturn != QgsGeometry::NothingHappened )
{
returnCode = splitFunctionReturn;
}
}

if ( numberOfSplitParts == 0 && mLayer->selectedFeatureCount() > 0 && returnCode == 0 )
if ( numberOfSplitParts == 0 && mLayer->selectedFeatureCount() > 0 && returnCode == QgsGeometry::Success )
{
//There is a selection but no feature has been split.
//Maybe user forgot that only the selected features are split
@@ -65,67 +65,95 @@ class CORE_EXPORT QgsVectorLayerEditUtils
QgsVectorLayer::EditResult deleteVertex( QgsFeatureId featureId, int vertex );

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

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

/**
* Adds a new part polygon to a multipart feature
* @returns QgsGeometry::OperationResult a result code: success or reason of failure
* \return
* - QgsGeometry::Success
* - QgsGeometry::AddPartSelectedGeometryNotFound
* - QgsGeometry::AddPartNotMultiGeometry
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::InvalidInput
*/
QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring, QgsFeatureId featureId );

/**
* Adds a new part polygon to a multipart feature
* @returns QgsGeometry::OperationResult a result code: success or reason of failure
* @note available in python bindings as addPartV2
*
* \return
* - QgsGeometry::Success
* - QgsGeometry::AddPartSelectedGeometryNotFound
* - QgsGeometry::AddPartNotMultiGeometry
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::InvalidInput
* \note available in python bindings as addPartV2
*/
QgsGeometry::OperationResult addPart( const QgsPointSequence &ring, QgsFeatureId featureId );

// @note available in python bindings as addCurvedPart
/**
* Add a new part polygon to a multipart feature
*
* \return
* - QgsGeometry::Success
* - QgsGeometry::AddPartSelectedGeometryNotFound
* - QgsGeometry::AddPartNotMultiGeometry
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::InvalidInput
*
* \note available in python bindings as addCurvedPart
*/
QgsGeometry::OperationResult addPart( QgsCurve *ring, QgsFeatureId featureId ) SIP_PYNAME( addCurvedPart );

/** Translates feature by dx, dy
/**
* Translates feature by dx, dy
* \param featureId id of the feature to translate
* \param dx translation of x-coordinate
* \param dy translation of y-coordinate
* \returns 0 in case of success
* \return 0 in case of success
*/
int translateFeature( QgsFeatureId featureId, double dx, double dy );

/** Splits parts cut by the given line
* \param splitLine line that splits the layer feature parts
* \param topologicalEditing true if topological editing is enabled
* \returns
* 0 in case of success,
* 4 if there is a selection but no feature split
/**
* Split parts cut by the given line
* \param splitLine line that splits the layer feature parts
* \param topologicalEditing true if topological editing is enabled
* \return
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::Success
* - QgsGeometry::InvalidInput
* - QgsGeometry::NothingHappened if a selection is present but no feature has been split
* - QgsGeometry::InvalidBaseGeometry
* - QgsGeometry::GeometryEngineError
* - QgsGeometry::SplitCannotSplitPoint
*/
// TODO QGIS 3.0 returns an enum instead of a magic constant
QgsGeometry::OperationResult splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );

/** Splits features cut by the given line
* \param splitLine line that splits the layer features
* \param topologicalEditing true if topological editing is enabled
* \returns
* 0 in case of success,
* 4 if there is a selection but no feature split
/**
* Splits features cut by the given line
* \param splitLine line that splits the layer features
* \param topologicalEditing true if topological editing is enabled
* \return
* 0 in case of success,
* 4 if there is a selection but no feature split
*/
// TODO QGIS 3.0 returns an enum instead of a magic constant
QgsGeometry::OperationResult splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );

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

0 comments on commit 8294c43

Please sign in to comment.
You can’t perform that action at this time.