Skip to content

Commit

Permalink
Add some SIP_THROW( QgsCsException ) annotations
Browse files Browse the repository at this point in the history
Incomplete, but allows proper QgsCsException catching
for these methods
  • Loading branch information
nyalldawson committed May 22, 2018
1 parent f82b639 commit 6165e4c
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ Returns a GeoJSON representation of the geometry.
%End


virtual void transform( const QgsCoordinateTransform &ct,
QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) = 0;
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException ) = 0;
%Docstring
Transforms the geometry using a coordinate transform

Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgscircularstring.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ Sets the circular string's points

virtual void draw( QPainter &p ) const;

virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );

virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );

virtual void addToPainterPath( QPainterPath &path ) const;
Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgscompoundcurve.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Adds a vertex to the end of the geometry.

virtual void draw( QPainter &p ) const;

virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );

virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );

virtual void addToPainterPath( QPainterPath &path ) const;
Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgscurvepolygon.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ area will be removed.

virtual void draw( QPainter &p ) const;

virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );

virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );


Expand Down
4 changes: 1 addition & 3 deletions python/core/auto_generated/geometry/qgsgeometry.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,7 @@ Translates this geometry by dx, dy, dz and dm.
:return: OperationResult a result code: success or reason of failure
%End

OperationResult transform( const QgsCoordinateTransform &ct,
QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
OperationResult transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );
%Docstring
Transforms this geometry as described by the coordinate transform ``ct``.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Removes a geometry from the collection.
:return: true if removal was successful.
%End

virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );

virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );


Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgslinestring.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ of the curve.
virtual void draw( QPainter &p ) const;


virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );

virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );


Expand Down
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgspoint.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ Example:

virtual void draw( QPainter &p ) const;

virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) throw( QgsCsException );

virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );

virtual QgsCoordinateSequence coordinateSequence() const;
Expand Down
12 changes: 6 additions & 6 deletions python/core/auto_generated/qgscoordinatetransform.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ transform coordinates to.
.. seealso:: :py:func:`sourceCrs`
%End

QgsPointXY transform( const QgsPointXY &point, TransformDirection direction = ForwardTransform ) const;
QgsPointXY transform( const QgsPointXY &point, TransformDirection direction = ForwardTransform ) const throw( QgsCsException );
%Docstring
Transform the point from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination,
Expand All @@ -204,7 +204,7 @@ otherwise points are transformed from destination to source CRS.
:return: transformed point
%End

QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const;
QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const throw( QgsCsException );
%Docstring
Transforms a rectangle from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination,
Expand All @@ -221,7 +221,7 @@ crossing the 180 degree longitude line is required
:return: rectangle in destination CRS
%End

void transformInPlace( double &x, double &y, double &z, TransformDirection direction = ForwardTransform ) const;
void transformInPlace( double &x, double &y, double &z, TransformDirection direction = ForwardTransform ) const throw( QgsCsException );
%Docstring
Transforms an array of x, y and z double coordinates in place, from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination,
Expand All @@ -239,15 +239,15 @@ heights) and must be expressed in its vertical units (generally meters)



void transformPolygon( QPolygonF &polygon, TransformDirection direction = ForwardTransform ) const;
void transformPolygon( QPolygonF &polygon, TransformDirection direction = ForwardTransform ) const throw( QgsCsException );
%Docstring
Transforms a polygon to the destination coordinate system.

:param polygon: polygon to transform (occurs in place)
:param direction: transform direction (defaults to forward transformation)
%End

QgsRectangle transform( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform ) const;
QgsRectangle transform( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform ) const throw( QgsCsException );
%Docstring
Transforms a rectangle to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination,
Expand All @@ -259,7 +259,7 @@ otherwise points are transformed from destination to source CRS.
:return: transformed rectangle
%End

void transformCoords( int numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const;
void transformCoords( int numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const throw( QgsCsException );
%Docstring
Transform an array of coordinates to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination,
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgsfeatureiterator.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ QgsFeatureRequest.destinationCrs() set on the request is respected.
%End


QgsRectangle filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const;
QgsRectangle filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const throw( QgsCsException );
%Docstring
Returns a rectangle representing the original request's :py:func:`QgsFeatureRequest.filterRect()`
If ``transform`` is a valid coordinate transform, the return rectangle will represent
Expand Down
4 changes: 1 addition & 3 deletions src/core/geometry/qgsabstractgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ class CORE_EXPORT QgsAbstractGeometry
* units (generally meters). If false, then z coordinates will not be changed by the
* transform.
*/
virtual void transform( const QgsCoordinateTransform &ct,
QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) = 0;
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) SIP_THROW( QgsCsException ) = 0;

/**
* Transforms the x and y components of the geometry using a QTransform object \a t.
Expand Down
3 changes: 1 addition & 2 deletions src/core/geometry/qgscircularstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ class CORE_EXPORT QgsCircularString: public QgsCurve
bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false ) override;

void draw( QPainter &p ) const override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) override SIP_THROW( QgsCsException );
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
void addToPainterPath( QPainterPath &path ) const override;
void drawAsPolygon( QPainter &p ) const override;
Expand Down
3 changes: 1 addition & 2 deletions src/core/geometry/qgscompoundcurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve
void addVertex( const QgsPoint &pt );

void draw( QPainter &p ) const override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) override SIP_THROW( QgsCsException );
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
void addToPainterPath( QPainterPath &path ) const override;
void drawAsPolygon( QPainter &p ) const override;
Expand Down
3 changes: 1 addition & 2 deletions src/core/geometry/qgscurvepolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface
void removeInteriorRings( double minimumAllowedArea = -1 );

void draw( QPainter &p ) const override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) override SIP_THROW( QgsCsException );
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;

bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
Expand Down
4 changes: 1 addition & 3 deletions src/core/geometry/qgsgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,7 @@ class CORE_EXPORT QgsGeometry
*
* \returns OperationResult a result code: success or reason of failure
*/
OperationResult transform( const QgsCoordinateTransform &ct,
QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false );
OperationResult transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) SIP_THROW( QgsCsException );

/**
* Transforms the x and y components of the geometry using a QTransform object \a t.
Expand Down
3 changes: 1 addition & 2 deletions src/core/geometry/qgsgeometrycollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry
*/
virtual bool removeGeometry( int nr );

void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) override SIP_THROW( QgsCsException );
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;

void draw( QPainter &p ) const override;
Expand Down
3 changes: 1 addition & 2 deletions src/core/geometry/qgslinestring.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve

void draw( QPainter &p ) const override;

void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) override SIP_THROW( QgsCsException );
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;

void addToPainterPath( QPainterPath &path ) const override;
Expand Down
3 changes: 1 addition & 2 deletions src/core/geometry/qgspoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,7 @@ class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
QString asJson( int precision = 17 ) const override;
void draw( QPainter &p ) const override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
bool transformZ = false ) override;
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, bool transformZ = false ) override SIP_THROW( QgsCsException );
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
QgsCoordinateSequence coordinateSequence() const override;
int nCoordinates() const override;
Expand Down
12 changes: 6 additions & 6 deletions src/core/qgscoordinatetransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class CORE_EXPORT QgsCoordinateTransform
* \param direction transform direction (defaults to ForwardTransform)
* \returns transformed point
*/
QgsPointXY transform( const QgsPointXY &point, TransformDirection direction = ForwardTransform ) const;
QgsPointXY transform( const QgsPointXY &point, TransformDirection direction = ForwardTransform ) const SIP_THROW( QgsCsException );

/**
* Transform the point specified by x,y from the source CRS to the destination CRS.
Expand All @@ -229,7 +229,7 @@ class CORE_EXPORT QgsCoordinateTransform
* crossing the 180 degree longitude line is required
* \returns rectangle in destination CRS
*/
QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const;
QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const SIP_THROW( QgsCsException );

/**
* Transforms an array of x, y and z double coordinates in place, from the source CRS to the destination CRS.
Expand All @@ -242,7 +242,7 @@ class CORE_EXPORT QgsCoordinateTransform
* heights) and must be expressed in its vertical units (generally meters)
* \param direction transform direction (defaults to ForwardTransform)
*/
void transformInPlace( double &x, double &y, double &z, TransformDirection direction = ForwardTransform ) const;
void transformInPlace( double &x, double &y, double &z, TransformDirection direction = ForwardTransform ) const SIP_THROW( QgsCsException );

/**
* Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS.
Expand Down Expand Up @@ -307,7 +307,7 @@ class CORE_EXPORT QgsCoordinateTransform
* \param polygon polygon to transform (occurs in place)
* \param direction transform direction (defaults to forward transformation)
*/
void transformPolygon( QPolygonF &polygon, TransformDirection direction = ForwardTransform ) const;
void transformPolygon( QPolygonF &polygon, TransformDirection direction = ForwardTransform ) const SIP_THROW( QgsCsException );

/**
* Transforms a rectangle to the destination CRS.
Expand All @@ -317,7 +317,7 @@ class CORE_EXPORT QgsCoordinateTransform
* \param direction transform direction (defaults to ForwardTransform)
* \returns transformed rectangle
*/
QgsRectangle transform( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform ) const;
QgsRectangle transform( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform ) const SIP_THROW( QgsCsException );

/**
* Transform an array of coordinates to the destination CRS.
Expand All @@ -329,7 +329,7 @@ class CORE_EXPORT QgsCoordinateTransform
* \param z array of z coordinates to transform
* \param direction transform direction (defaults to ForwardTransform)
*/
void transformCoords( int numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const;
void transformCoords( int numPoint, double *x, double *y, double *z, TransformDirection direction = ForwardTransform ) const SIP_THROW( QgsCsException );

/**
* Returns true if the transform short circuits because the source and destination are equivalent.
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsfeatureiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CORE_EXPORT QgsAbstractFeatureIterator
* Will throw a QgsCsException if the rect cannot be transformed from the destination CRS.
* \since QGIS 3.0
*/
QgsRectangle filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const;
QgsRectangle filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const SIP_THROW( QgsCsException );

//! A copy of the feature request.
QgsFeatureRequest mRequest;
Expand Down

0 comments on commit 6165e4c

Please sign in to comment.