Skip to content
Permalink
Browse files

Add return cases to the docs and fully qualified enums

  • Loading branch information
elpaso committed Nov 24, 2017
1 parent 4f82adf commit 7a63a07f7f977fda49aa9db0d7fcd357ef604d9b
@@ -1049,6 +1049,13 @@ Return the provider type for this layer
\param ring ring to add
\param featureId if specified, feature ID for feature ring was added to will be stored in this parameter
:return: QgsGeometry.OperationResult
- Success
- LayerNotEditable
- AddRingNotInExistingFeature
- InvalidInputGeometryType
- AddRingNotClosed
- AddRingNotValid
- AddRingCrossesExistingRings
:rtype: QgsGeometry.OperationResult
%End

@@ -1058,6 +1065,13 @@ Return the provider type for this layer
\param ring ring to add
\param featureId if specified, feature ID for feature ring was added to will be stored in this parameter
:return: QgsGeometry.OperationResult
- Success
- LayerNotEditable
- AddRingNotInExistingFeature
- InvalidInputGeometryType
- AddRingNotClosed
- AddRingNotValid
- AddRingCrossesExistingRings
.. note::

available in Python as addCurvedRing
@@ -1068,13 +1082,29 @@ Return the provider type for this layer
%Docstring
Adds a new part polygon to a multipart feature
:return: QgsGeometry.OperationResult
- Success
- LayerNotEditable
- SelectionIsEmpty
- SelectionIsGreaterThanOne
- AddPartSelectedGeometryNotFound
- AddPartNotMultiGeometry
- InvalidBaseGeometry
- InvalidInputGeometryType
:rtype: QgsGeometry.OperationResult
%End

QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) /PyName=addPartV2/;
%Docstring
Adds a new part polygon to a multipart feature
:return: QgsGeometry.OperationResult
- Success
- LayerNotEditable
- SelectionIsEmpty
- SelectionIsGreaterThanOne
- AddPartSelectedGeometryNotFound
- AddPartNotMultiGeometry
- InvalidBaseGeometry
- InvalidInputGeometryType
.. note::

available in Python bindings as addPartV2
@@ -1105,6 +1135,13 @@ Return the provider type for this layer
\param splitLine line that splits the layer features
\param topologicalEditing true if topological editing is enabled
:return: QgsGeometry.OperationResult
- Success
- NothingHappened
- LayerNotEditable
- InvalidInputGeometryType
- InvalidBaseGeometry
- GeometryEngineError
- SplitCannotSplitPoint
:rtype: QgsGeometry.OperationResult
%End

@@ -1114,6 +1151,13 @@ Return the provider type for this layer
\param splitLine line that splits the layer features
\param topologicalEditing true if topological editing is enabled
:return: QgsGeometry.OperationResult
- Success
- NothingHappened
- LayerNotEditable
- InvalidInputGeometryType
- InvalidBaseGeometry
- GeometryEngineError
- SplitCannotSplitPoint
:rtype: QgsGeometry.OperationResult
%End

@@ -674,7 +674,7 @@ QgsGeometry::OperationResult QgsGeometry::addPart( QgsAbstractGeometry *part, Qg
break;
default:
reset( nullptr );
return QgsGeometry::AddPartNotMultiGeometry;
return QgsGeometry::OperationResult::AddPartNotMultiGeometry;
}
}
else
@@ -785,7 +785,7 @@ QgsGeometry::OperationResult QgsGeometry::splitGeometry( const QVector<QgsPointX
{
if ( !d->geometry )
{
return InvalidBaseGeometry;
return QgsGeometry::OperationResult::InvalidBaseGeometry;
}

QVector<QgsGeometry > newGeoms;
@@ -808,19 +808,19 @@ QgsGeometry::OperationResult QgsGeometry::splitGeometry( const QVector<QgsPointX
switch ( result )
{
case QgsGeometryEngine::Success:
return QgsGeometry::Success;
return QgsGeometry::OperationResult::Success;
case QgsGeometryEngine::MethodNotImplemented:
case QgsGeometryEngine::EngineError:
case QgsGeometryEngine::NodedGeometryError:
return QgsGeometry::GeometryEngineError;
return QgsGeometry::OperationResult::GeometryEngineError;
case QgsGeometryEngine::InvalidBaseGeometry:
return QgsGeometry::InvalidBaseGeometry;
return QgsGeometry::OperationResult::InvalidBaseGeometry;
case QgsGeometryEngine::InvalidInput:
return QgsGeometry::InvalidInputGeometryType;
return QgsGeometry::OperationResult::InvalidInputGeometryType;
case QgsGeometryEngine::SplitCannotSplitPoint:
return QgsGeometry::SplitCannotSplitPoint;
return QgsGeometry::OperationResult::SplitCannotSplitPoint;
case QgsGeometryEngine::NothingHappened:
return QgsGeometry::NothingHappened;
return QgsGeometry::OperationResult::NothingHappened;
//default: do not implement default to handle properly all cases
}

@@ -50,17 +50,17 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addRing( QgsAbstractGeometry
}
else
{
return QgsGeometry::InvalidInputGeometryType; //not polygon / multipolygon;
return QgsGeometry::OperationResult::InvalidInputGeometryType; //not polygon / multipolygon;
}

//ring must be closed
if ( !ring->isClosed() )
{
return QgsGeometry::AddRingNotClosed;
return QgsGeometry::OperationResult::AddRingNotClosed;
}
else if ( !ring->isRing() )
{
return QgsGeometry::AddRingNotValid;
return QgsGeometry::OperationResult::AddRingNotValid;
}

std::unique_ptr<QgsGeometryEngine> ringGeom( QgsGeometry::createGeometryEngine( ring.get() ) );
@@ -78,7 +78,7 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addRing( QgsAbstractGeometry
{
if ( !ringGeom->disjoint( ( *polyIter )->interiorRing( i ) ) )
{
return QgsGeometry::AddRingCrossesExistingRings;
return QgsGeometry::OperationResult::AddRingCrossesExistingRings;
}
}

@@ -89,29 +89,29 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addRing( QgsAbstractGeometry
ring->addMValue( 0 );

( *polyIter )->addInteriorRing( ring.release() );
return QgsGeometry::Success; //success
return QgsGeometry::OperationResult::Success; //success
}
}
return QgsGeometry::AddRingNotInExistingFeature; //not contained in any outer ring
return QgsGeometry::OperationResult::AddRingNotInExistingFeature; //not contained in any outer ring
}

QgsGeometry::OperationResult QgsGeometryEditUtils::addPart( QgsAbstractGeometry *geom, std::unique_ptr<QgsAbstractGeometry> part )
{
if ( !geom )
{
return QgsGeometry::InvalidBaseGeometry;
return QgsGeometry::OperationResult::InvalidBaseGeometry;
}

if ( !part )
{
return QgsGeometry::InvalidInputGeometryType;
return QgsGeometry::OperationResult::InvalidInputGeometryType;
}

//multitype?
QgsGeometryCollection *geomCollection = qgsgeometry_cast<QgsGeometryCollection *>( geom );
if ( !geomCollection )
{
return QgsGeometry::AddPartNotMultiGeometry;
return QgsGeometry::OperationResult::AddPartNotMultiGeometry;
}

bool added = false;
@@ -155,19 +155,19 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addPart( QgsAbstractGeometry
{
while ( geomCollection->numGeometries() > n )
geomCollection->removeGeometry( n );
return QgsGeometry::InvalidInputGeometryType;
return QgsGeometry::OperationResult::InvalidInputGeometryType;
}
}
else
{
return QgsGeometry::InvalidInputGeometryType;
return QgsGeometry::OperationResult::InvalidInputGeometryType;
}
}
else
{
added = geomCollection->addGeometry( part.release() );
}
return added ? QgsGeometry::Success : QgsGeometry::InvalidInputGeometryType;
return added ? QgsGeometry::Success : QgsGeometry::OperationResult::InvalidInputGeometryType;
}

bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometry *geom, int ringNum, int partNum )
@@ -1050,6 +1050,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* \param ring ring to add
* \param featureId if specified, feature ID for feature ring was added to will be stored in this parameter
* \returns QgsGeometry::OperationResult
* - Success
* - LayerNotEditable
* - AddRingNotInExistingFeature
* - InvalidInputGeometryType
* - AddRingNotClosed
* - AddRingNotValid
* - AddRingCrossesExistingRings
*/
QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );

@@ -1058,19 +1065,42 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* \param ring ring to add
* \param featureId if specified, feature ID for feature ring was added to will be stored in this parameter
* \returns QgsGeometry::OperationResult
* - Success
* - LayerNotEditable
* - AddRingNotInExistingFeature
* - InvalidInputGeometryType
* - AddRingNotClosed
* - AddRingNotValid
* - AddRingCrossesExistingRings
* \note available in Python as addCurvedRing
*/
QgsGeometry::OperationResult addRing( QgsCurve *ring SIP_TRANSFER, QgsFeatureId *featureId = nullptr ) SIP_PYNAME( addCurvedRing );

/**
* Adds a new part polygon to a multipart feature
* \returns QgsGeometry::OperationResult
* - Success
* - LayerNotEditable
* - SelectionIsEmpty
* - SelectionIsGreaterThanOne
* - AddPartSelectedGeometryNotFound
* - AddPartNotMultiGeometry
* - InvalidBaseGeometry
* - InvalidInputGeometryType
*/
QgsGeometry::OperationResult addPart( const QList<QgsPointXY> &ring );

/**
* Adds a new part polygon to a multipart feature
* \returns QgsGeometry::OperationResult
* - Success
* - LayerNotEditable
* - SelectionIsEmpty
* - SelectionIsGreaterThanOne
* - AddPartSelectedGeometryNotFound
* - AddPartNotMultiGeometry
* - InvalidBaseGeometry
* - InvalidInputGeometryType
* \note available in Python bindings as addPartV2
*/
QgsGeometry::OperationResult addPart( const QgsPointSequence &ring ) SIP_PYNAME( addPartV2 );
@@ -1092,6 +1122,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* \param splitLine line that splits the layer features
* \param topologicalEditing true if topological editing is enabled
* \returns QgsGeometry::OperationResult
* - Success
* - NothingHappened
* - LayerNotEditable
* - InvalidInputGeometryType
* - InvalidBaseGeometry
* - GeometryEngineError
* - SplitCannotSplitPoint
*/
QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );

@@ -1100,6 +1137,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* \param splitLine line that splits the layer features
* \param topologicalEditing true if topological editing is enabled
* \returns QgsGeometry::OperationResult
* - Success
* - NothingHappened
* - LayerNotEditable
* - InvalidInputGeometryType
* - InvalidBaseGeometry
* - GeometryEngineError
* - SplitCannotSplitPoint
*/
QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );

0 comments on commit 7a63a07

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