This commit is contained in:
Nyall Dawson 2020-09-18 09:06:10 +10:00
parent c293d2c60d
commit fe70bb2440
20 changed files with 144 additions and 13 deletions

View File

@ -842,13 +842,17 @@ Clears any cached parameters associated with the geometry, e.g., bounding boxes
struct QgsVertexId
{
enum VertexType
{
SegmentVertex,
CurveVertex
CurveVertex,
};
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex );
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex ) /HoldGIL/;
%Docstring
Constructor for QgsVertexId.
%End
bool isValid() const /HoldGIL/;
%Docstring
@ -857,14 +861,35 @@ Returns ``True`` if the vertex id is valid
bool operator==( QgsVertexId other ) const /HoldGIL/;
bool operator!=( QgsVertexId other ) const /HoldGIL/;
bool partEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID belongs to the same part as another vertex ID.
%End
bool ringEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID belongs to the same ring as another vertex ID (i.e. the part
and ring number are equal).
%End
bool vertexEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID corresponds to the same vertex as another vertex ID (i.e. the part,
ring number and vertex number are equal).
%End
bool isValid( const QgsAbstractGeometry *geom ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID is valid for the specified ``geom``.
%End
int part;
int ring;
int vertex;
VertexType type;
SIP_PYOBJECT __repr__();

View File

@ -24,7 +24,13 @@ Geometry collection
#include "qgsgeometrycollection.h"
%End
public:
QgsGeometryCollection() /HoldGIL/;
%Docstring
Constructor for an empty geometry collection.
%End
QgsGeometryCollection( const QgsGeometryCollection &c );
~QgsGeometryCollection();

View File

@ -25,7 +25,11 @@ Line string geometry type, with support for z-dimension and m-values.
#include "qgslinestring.h"
%End
public:
QgsLineString() /HoldGIL/;
%Docstring
Constructor for an empty linestring geometry.
%End
QgsLineString( const QVector<QgsPoint> &points ) /HoldGIL/;
%Docstring

View File

@ -21,7 +21,11 @@ Multi line string geometry collection.
#include "qgsmultilinestring.h"
%End
public:
QgsMultiLineString() /HoldGIL/;
%Docstring
Constructor for an empty multilinestring geometry.
%End

View File

@ -20,8 +20,11 @@ Multi point geometry collection.
#include "qgsmultipoint.h"
%End
public:
QgsMultiPoint() /HoldGIL/;
QgsMultiPoint() /HoldGIL/;
%Docstring
Constructor for an empty multipoint geometry.
%End
SIP_PYOBJECT pointN( int index ) /TypeHint="QgsPoint"/;

View File

@ -21,7 +21,11 @@ Multi polygon geometry collection.
#include "qgsmultipolygon.h"
%End
public:
QgsMultiPolygon() /HoldGIL/;
%Docstring
Constructor for an empty multipolygon geometry.
%End

View File

@ -22,8 +22,11 @@ Multi surface geometry collection.
#include "qgsmultisurface.h"
%End
public:
QgsMultiSurface() /HoldGIL/;
QgsMultiSurface() /HoldGIL/;
%Docstring
Constructor for an empty multisurface geometry.
%End
SIP_PYOBJECT surfaceN( int index ) /TypeHint="QgsSurface"/;

View File

@ -22,7 +22,12 @@ Polygon geometry type.
#include "qgspolygon.h"
%End
public:
QgsPolygon() /HoldGIL/;
%Docstring
Constructor for an empty polygon geometry.
%End
QgsPolygon( QgsLineString *exterior /Transfer/, const QList< QgsLineString * > &rings /Transfer/ = QList< QgsLineString * >() ) /HoldGIL/;
%Docstring

View File

@ -24,7 +24,11 @@ This class allows the creation of simple quadrilateral (which does not self-inte
#include "qgsquadrilateral.h"
%End
public:
QgsQuadrilateral() /HoldGIL/;
%Docstring
Constructor for an empty quadrilateral geometry.
%End
QgsQuadrilateral( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, const QgsPoint &p4 ) /HoldGIL/;
%Docstring

View File

@ -21,7 +21,11 @@ Triangle geometry type.
#include "qgstriangle.h"
%End
public:
QgsTriangle() /HoldGIL/;
%Docstring
Constructor for an empty triangle geometry.
%End
QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) /HoldGIL/;
%Docstring

View File

@ -1048,17 +1048,24 @@ class CORE_EXPORT QgsAbstractGeometry
*/
struct CORE_EXPORT QgsVertexId
{
/**
* Type of vertex
*/
enum VertexType
{
SegmentVertex = 1, //start / endpoint of a segment
CurveVertex
SegmentVertex = 1, //!< The actual start or end point of a segment
CurveVertex, //!< An intermediate point on a segment defining the curvature of the segment
};
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex )
: part( _part )
, ring( _ring )
, vertex( _vertex )
, type( _type )
/**
* Constructor for QgsVertexId.
*/
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex ) SIP_HOLDGIL
: part( _part )
, ring( _ring )
, vertex( _vertex )
, type( _type )
{}
/**
@ -1074,18 +1081,36 @@ struct CORE_EXPORT QgsVertexId
{
return part != other.part || ring != other.ring || vertex != other.vertex;
}
/**
* Returns TRUE if this vertex ID belongs to the same part as another vertex ID.
*/
bool partEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return part >= 0 && o.part == part;
}
/**
* Returns TRUE if this vertex ID belongs to the same ring as another vertex ID (i.e. the part
* and ring number are equal).
*/
bool ringEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return partEqual( o ) && ( ring >= 0 && o.ring == ring );
}
/**
* Returns TRUE if this vertex ID corresponds to the same vertex as another vertex ID (i.e. the part,
* ring number and vertex number are equal).
*/
bool vertexEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return ringEqual( o ) && ( vertex >= 0 && o.ring == ring );
}
/**
* Returns TRUE if this vertex ID is valid for the specified \a geom.
*/
bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL
{
return ( part >= 0 && part < geom->partCount() ) &&
@ -1093,9 +1118,16 @@ struct CORE_EXPORT QgsVertexId
( vertex < 0 || vertex < geom->vertexCount( part, ring ) );
}
//! Part number
int part;
//! Ring number
int ring;
//! Vertex number
int vertex;
//! Vertex type
VertexType type;
#ifdef SIP_RUN

View File

@ -35,7 +35,13 @@ class QgsPoint;
class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry
{
public:
/**
* Constructor for an empty geometry collection.
*/
QgsGeometryCollection() SIP_HOLDGIL;
QgsGeometryCollection( const QgsGeometryCollection &c );
QgsGeometryCollection &operator=( const QgsGeometryCollection &c );
~QgsGeometryCollection() override;

View File

@ -43,6 +43,10 @@ class QgsLineSegment2D;
class CORE_EXPORT QgsLineString: public QgsCurve
{
public:
/**
* Constructor for an empty linestring geometry.
*/
QgsLineString() SIP_HOLDGIL;
/**

View File

@ -31,6 +31,10 @@ class QgsLineString;
class CORE_EXPORT QgsMultiLineString: public QgsMultiCurve
{
public:
/**
* Constructor for an empty multilinestring geometry.
*/
QgsMultiLineString() SIP_HOLDGIL;

View File

@ -29,8 +29,11 @@ email : marco.hugentobler at sourcepole dot com
class CORE_EXPORT QgsMultiPoint: public QgsGeometryCollection
{
public:
QgsMultiPoint() SIP_HOLDGIL;
/**
* Constructor for an empty multipoint geometry.
*/
QgsMultiPoint() SIP_HOLDGIL;
#ifndef SIP_RUN

View File

@ -31,6 +31,10 @@ class QgsPolygon;
class CORE_EXPORT QgsMultiPolygon: public QgsMultiSurface
{
public:
/**
* Constructor for an empty multipolygon geometry.
*/
QgsMultiPolygon() SIP_HOLDGIL;

View File

@ -32,8 +32,11 @@ class QgsSurface;
class CORE_EXPORT QgsMultiSurface: public QgsGeometryCollection
{
public:
QgsMultiSurface() SIP_HOLDGIL;
/**
* Constructor for an empty multisurface geometry.
*/
QgsMultiSurface() SIP_HOLDGIL;
#ifndef SIP_RUN

View File

@ -33,6 +33,11 @@ class QgsLineString;
class CORE_EXPORT QgsPolygon: public QgsCurvePolygon
{
public:
/**
* Constructor for an empty polygon geometry.
*/
QgsPolygon() SIP_HOLDGIL;
/**

View File

@ -35,6 +35,10 @@
class CORE_EXPORT QgsQuadrilateral
{
public:
/**
* Constructor for an empty quadrilateral geometry.
*/
QgsQuadrilateral() SIP_HOLDGIL;
/**

View File

@ -33,6 +33,10 @@
class CORE_EXPORT QgsTriangle : public QgsPolygon
{
public:
/**
* Constructor for an empty triangle geometry.
*/
QgsTriangle() SIP_HOLDGIL;
/**