diff --git a/python/analysis/network/qgsgraph.sip b/python/analysis/network/qgsgraph.sip index 21f2aa83218..63672e6135a 100644 --- a/python/analysis/network/qgsgraph.sip +++ b/python/analysis/network/qgsgraph.sip @@ -71,7 +71,7 @@ class QgsGraphVertex %End - QgsGraphVertex( const QgsPoint &point ); + QgsGraphVertex( const QgsPointXY &point ); %Docstring This constructor initializes QgsGraphVertex object and associates a vertex with a point %End @@ -88,10 +88,10 @@ class QgsGraphVertex :rtype: QgsGraphEdgeIds %End - QgsPoint point() const; + QgsPointXY point() const; %Docstring Returns point associated with graph vertex - :rtype: QgsPoint + :rtype: QgsPointXY %End }; @@ -110,7 +110,7 @@ class QgsGraph QgsGraph(); - int addVertex( const QgsPoint &pt ); + int addVertex( const QgsPointXY &pt ); %Docstring Add a vertex to the graph :rtype: int @@ -146,7 +146,7 @@ class QgsGraph :rtype: QgsGraphEdge %End - int findVertex( const QgsPoint &pt ) const; + int findVertex( const QgsPointXY &pt ) const; %Docstring Find vertex by associated point :return: vertex index diff --git a/python/analysis/network/qgsgraphbuilder.sip b/python/analysis/network/qgsgraphbuilder.sip index 04cb03b2684..85bbcef5a60 100644 --- a/python/analysis/network/qgsgraphbuilder.sip +++ b/python/analysis/network/qgsgraphbuilder.sip @@ -29,12 +29,12 @@ class QgsGraphBuilder : QgsGraphBuilderInterface ~QgsGraphBuilder(); - virtual void addVertex( int id, const QgsPoint &pt ); + virtual void addVertex( int id, const QgsPointXY &pt ); %Docstring MANDATORY BUILDER PROPERTY DECLARATION %End - virtual void addEdge( int pt1id, const QgsPoint &pt1, int pt2id, const QgsPoint &pt2, const QVector< QVariant > &prop ); + virtual void addEdge( int pt1id, const QgsPointXY &pt1, int pt2id, const QgsPointXY &pt2, const QVector< QVariant > &prop ); QgsGraph *graph() /Factory/; %Docstring diff --git a/python/analysis/network/qgsgraphbuilderinterface.sip b/python/analysis/network/qgsgraphbuilderinterface.sip index 83f49d2aafa..3de8f628b5e 100644 --- a/python/analysis/network/qgsgraphbuilderinterface.sip +++ b/python/analysis/network/qgsgraphbuilderinterface.sip @@ -67,7 +67,7 @@ Returns measurement tool :rtype: QgsDistanceArea %End - virtual void addVertex( int id, const QgsPoint &pt ); + virtual void addVertex( int id, const QgsPointXY &pt ); %Docstring Add vertex to the graph \param id vertex identifier @@ -77,7 +77,7 @@ Returns measurement tool id and pt are redundant. You can use pt or id to identify the vertex %End - virtual void addEdge( int pt1id, const QgsPoint &pt1, int pt2id, const QgsPoint &pt2, const QVector< QVariant > &strategies ); + virtual void addEdge( int pt1id, const QgsPointXY &pt1, int pt2id, const QgsPointXY &pt2, const QVector< QVariant > &strategies ); %Docstring Add edge to the graph \param pt1id first vertex identificator diff --git a/python/analysis/network/qgsgraphdirector.sip b/python/analysis/network/qgsgraphdirector.sip index bba2bdb4816..c0c3d008c71 100644 --- a/python/analysis/network/qgsgraphdirector.sip +++ b/python/analysis/network/qgsgraphdirector.sip @@ -46,8 +46,8 @@ Emitted to report information about graph building virtual ~QgsGraphDirector(); virtual void makeGraph( QgsGraphBuilderInterface *builder, - const QVector< QgsPoint > &additionalPoints, - QVector< QgsPoint > &snappedPoints /Out/ ) const; + const QVector< QgsPointXY > &additionalPoints, + QVector< QgsPointXY > &snappedPoints /Out/ ) const; %Docstring Make a graph using QgsGraphBuilder @@ -56,7 +56,7 @@ Emitted to report information about graph building \param snappedPoints list of snapped points .. note:: - if snappedPoints[i] == QgsPoint(0.0,0.0) then snapping failed. + if snappedPoints[i] == QgsPointXY(0.0,0.0) then snapping failed. %End void addStrategy( QgsNetworkStrategy *prop /Transfer/ ); diff --git a/python/analysis/network/qgsvectorlayerdirector.sip b/python/analysis/network/qgsvectorlayerdirector.sip index 0bf48d978c0..1badb079b66 100644 --- a/python/analysis/network/qgsvectorlayerdirector.sip +++ b/python/analysis/network/qgsvectorlayerdirector.sip @@ -50,8 +50,8 @@ class QgsVectorLayerDirector : QgsGraphDirector virtual ~QgsVectorLayerDirector(); virtual void makeGraph( QgsGraphBuilderInterface *builder, - const QVector< QgsPoint > &additionalPoints, - QVector< QgsPoint> &snappedPoints /Out/ ) const; + const QVector< QgsPointXY > &additionalPoints, + QVector< QgsPointXY> &snappedPoints /Out/ ) const; %Docstring MANDATORY DIRECTOR PROPERTY DECLARATION %End diff --git a/python/analysis/openstreetmap/qgsosmbase.sip b/python/analysis/openstreetmap/qgsosmbase.sip index 48c3ddc49a3..bd219824f99 100644 --- a/python/analysis/openstreetmap/qgsosmbase.sip +++ b/python/analysis/openstreetmap/qgsosmbase.sip @@ -69,11 +69,11 @@ point features or be used to define the path of a way. %End public: QgsOSMNode(); - QgsOSMNode( QgsOSMId id, const QgsPoint &point ); + QgsOSMNode( QgsOSMId id, const QgsPointXY &point ); - QgsPoint point() const; + QgsPointXY point() const; %Docstring - :rtype: QgsPoint + :rtype: QgsPointXY %End }; diff --git a/python/core/annotations/qgsannotation.sip b/python/core/annotations/qgsannotation.sip index a9311d797af..913e69d6cc7 100644 --- a/python/core/annotations/qgsannotation.sip +++ b/python/core/annotations/qgsannotation.sip @@ -86,17 +86,17 @@ class QgsAnnotation : QObject .. seealso:: hasFixedMapPosition() %End - QgsPoint mapPosition() const; + QgsPointXY mapPosition() const; %Docstring Returns the map position of the annotation, if it is attached to a fixed map position. .. seealso:: setMapPosition() .. seealso:: hasFixedMapPosition() .. seealso:: mapPositionCrs() - :rtype: QgsPoint + :rtype: QgsPointXY %End - void setMapPosition( const QgsPoint &position ); + void setMapPosition( const QgsPointXY &position ); %Docstring Sets the map position of the annotation, if it is attached to a fixed map position. diff --git a/python/core/conversions.sip b/python/core/conversions.sip index 3b7fb9ffa8a..985bf659e0e 100644 --- a/python/core/conversions.sip +++ b/python/core/conversions.sip @@ -41,7 +41,7 @@ template if ((l = PyList_New(sipCpp->size())) == NULL) return NULL; - const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector"); + const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector"); // Set the list elements. for (int i = 0; i < sipCpp->size(); ++i) @@ -62,7 +62,7 @@ template %End %ConvertToTypeCode - const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector"); + const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector"); // Check the type if that is all that is required. if (sipIsErr == NULL) @@ -118,7 +118,7 @@ template if ((l = PyList_New(sipCpp->size())) == NULL) return NULL; - const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector >"); + const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector >"); // Set the list elements. for (int i = 0; i < sipCpp->size(); ++i) @@ -139,7 +139,7 @@ template %ConvertToTypeCode - const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector >"); + const sipMappedType *qvector_qgspoint = sipFindMappedType("QVector >"); // Check the type if that is all that is required. if (sipIsErr == NULL) @@ -255,7 +255,7 @@ template }; -%MappedType QList< QList > +%MappedType QList< QList > { %TypeHeaderCode #include @@ -269,12 +269,12 @@ template if ((l = PyList_New(sipCpp->size())) == NULL) return NULL; - const sipMappedType *qlist_type = sipFindMappedType("QList"); + const sipMappedType *qlist_type = sipFindMappedType("QList"); // Set the list elements. for (int i = 0; i < sipCpp->size(); ++i) { - QList *t = new QList(sipCpp->at(i)); + QList *t = new QList(sipCpp->at(i)); PyObject *tobj; if ((tobj = sipConvertFromMappedType(t, qlist_type, sipTransferObj)) == NULL) @@ -290,7 +290,7 @@ template %End %ConvertToTypeCode - const sipMappedType *qlist_type = sipFindMappedType("QList"); + const sipMappedType *qlist_type = sipFindMappedType("QList"); // Check the type if that is all that is required. if (sipIsErr == NULL) @@ -306,13 +306,13 @@ template } - QList< QList > *ql = new QList< QList >; + QList< QList > *ql = new QList< QList >; for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) { int state; //TYPE *t = reinterpret_cast(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); - QList *t = reinterpret_cast< QList * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); + QList *t = reinterpret_cast< QList * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); if (*sipIsErr) { @@ -329,7 +329,7 @@ template %End }; -%MappedType QList< QList< QList > > +%MappedType QList< QList< QList > > { %TypeHeaderCode #include @@ -342,7 +342,7 @@ template { return NULL; } - const sipMappedType *qlist_type = sipFindMappedType("QList >"); + const sipMappedType *qlist_type = sipFindMappedType("QList >"); if(!qlist_type ) { Py_DECREF(l); return NULL; @@ -350,7 +350,7 @@ template for (int i = 0; i < sipCpp->size(); ++i) { - QList< QList > *t = new QList >(sipCpp->at(i)); + QList< QList > *t = new QList >(sipCpp->at(i)); PyObject *tobj; if ((tobj = sipConvertFromMappedType(t, qlist_type, sipTransferObj)) == NULL) { @@ -363,16 +363,16 @@ template return l; %End %ConvertToTypeCode - const sipMappedType *qlist_type = sipFindMappedType("QList >"); + const sipMappedType *qlist_type = sipFindMappedType("QList >"); if (sipIsErr == NULL) { return 0; } - QList< QList< QList > > *ql = new QList< QList< QList > >(); + QList< QList< QList > > *ql = new QList< QList< QList > >(); for( int i = 0;i < PyList_GET_SIZE(sipPy); ++i) { int state; - QList > *t = reinterpret_cast< QList< QList > * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); + QList > *t = reinterpret_cast< QList< QList > * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); if( *sipIsErr ) { sipReleaseMappedType(t, qlist_type, state); diff --git a/python/core/dxf/qgsdxfexport.sip b/python/core/dxf/qgsdxfexport.sip index 2338f0e083b..a29dc402306 100644 --- a/python/core/dxf/qgsdxfexport.sip +++ b/python/core/dxf/qgsdxfexport.sip @@ -174,7 +174,7 @@ class QgsDxfExport * @note available in python bindings as writeGroupPointV2 * @note added in 2.15 */ - void writeGroup( int code, const QgsPointV2 &p ) /PyName=writeGroupPointV2/; + void writeGroup( int code, const QgsPoint &p ) /PyName=writeGroupPointV2/; /** * Write a group code with color value @@ -243,32 +243,32 @@ class QgsDxfExport //! Write line (as a polyline) //! @note added in 2.15 - void writeLine( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width = -1 ); + void writeLine( const QgsPoint &pt1, const QgsPoint &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width = -1 ); //! Write point //! @note available in Python bindings as writePointV2 //! @note added in 2.15 - void writePoint( const QString &layer, const QColor &color, const QgsPointV2 &pt ) /PyName=writePointV2/; + void writePoint( const QString &layer, const QColor &color, const QgsPoint &pt ) /PyName=writePointV2/; //! Write filled circle (as hatch) //! @note available in Python bindings as writePointV2 //! @note added in 2.15 - void writeFilledCircle( const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius ) /PyName=writeFillCircleV2/; + void writeFilledCircle( const QString &layer, const QColor &color, const QgsPoint &pt, double radius ) /PyName=writeFillCircleV2/; //! Write circle (as polyline) //! @note available in Python bindings as writeCircleV2 //! @note added in 2.15 - void writeCircle( const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius, const QString &lineStyleName, double width ) /PyName=writeCircleV2/; + void writeCircle( const QString &layer, const QColor &color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width ) /PyName=writeCircleV2/; //! Write text (TEXT) //! @note available in Python bindings as writeTextV2 //! @note added in 2.15 - void writeText( const QString &layer, const QString &text, const QgsPointV2 &pt, double size, double angle, const QColor &color ) /PyName=writeTextV2/; + void writeText( const QString &layer, const QString &text, const QgsPoint &pt, double size, double angle, const QColor &color ) /PyName=writeTextV2/; //! Write mtext (MTEXT) //! @note available in Python bindings as writeMTextV2 //! @note added in 2.15 - void writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor &color ); + void writeMText( const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, const QColor &color ); //! Calculates a scaling factor to convert from map units to a specified symbol unit. static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits ); diff --git a/python/core/geometry/qgsabstractgeometry.sip b/python/core/geometry/qgsabstractgeometry.sip index e8fe368a022..2dfb53db511 100644 --- a/python/core/geometry/qgsabstractgeometry.sip +++ b/python/core/geometry/qgsabstractgeometry.sip @@ -10,9 +10,9 @@ -typedef QList< QgsPointV2 > QgsPointSequence; -typedef QList< QList< QgsPointV2 > > QgsRingSequence; -typedef QList< QList< QList< QgsPointV2 > > > QgsCoordinateSequence; +typedef QList< QgsPoint > QgsPointSequence; +typedef QList< QList< QgsPoint > > QgsRingSequence; +typedef QList< QList< QList< QgsPoint > > > QgsCoordinateSequence; class QgsAbstractGeometry { @@ -26,8 +26,8 @@ class QgsAbstractGeometry %End %ConvertToSubClassCode - if ( dynamic_cast( sipCpp ) != NULL ) - sipType = sipType_QgsPointV2; + if ( dynamic_cast( sipCpp ) != NULL ) + sipType = sipType_QgsPoint; else if ( dynamic_cast( sipCpp ) != NULL ) sipType = sipType_QgsLineString; else if ( dynamic_cast( sipCpp ) != NULL ) @@ -242,7 +242,7 @@ class QgsAbstractGeometry \param p destination QPainter %End - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex /Out/ ) const = 0; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const = 0; %Docstring Returns next vertex id and coordinates \param id initial value should be the starting vertex id. The next vertex id will be stored @@ -265,13 +265,13 @@ class QgsAbstractGeometry :rtype: int %End - virtual QgsPointV2 vertexAt( QgsVertexId id ) const = 0; + virtual QgsPoint vertexAt( QgsVertexId id ) const = 0; %Docstring Returns the point corresponding to a specified vertex id - :rtype: QgsPointV2 + :rtype: QgsPoint %End - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const = 0; %Docstring @@ -287,7 +287,7 @@ class QgsAbstractGeometry %End - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) = 0; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) = 0; %Docstring Inserts a vertex into the geometry \param position vertex id for position of inserted vertex @@ -298,7 +298,7 @@ class QgsAbstractGeometry :rtype: bool %End - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) = 0; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) = 0; %Docstring Moves a vertex within the geometry \param position vertex id for vertex to move @@ -343,10 +343,10 @@ class QgsAbstractGeometry :rtype: float %End - virtual QgsPointV2 centroid() const; + virtual QgsPoint centroid() const; %Docstring Returns the centroid of the geometry - :rtype: QgsPointV2 + :rtype: QgsPoint %End virtual bool isEmpty() const; diff --git a/python/core/geometry/qgsbox3d.sip b/python/core/geometry/qgsbox3d.sip index 9b3f6aaa5c4..4d48feabb38 100644 --- a/python/core/geometry/qgsbox3d.sip +++ b/python/core/geometry/qgsbox3d.sip @@ -31,7 +31,7 @@ class QgsBox3d Constructor for QgsBox3D which accepts the ranges of x/y/z coordinates. %End - QgsBox3d( const QgsPointV2 &p1, const QgsPointV2 &p2 ); + QgsBox3d( const QgsPoint &p1, const QgsPoint &p2 ); %Docstring Constructs a QgsBox3D from two points representing opposite corners of the box. The box is normalized after construction. @@ -187,7 +187,7 @@ class QgsBox3d :rtype: bool %End - bool contains( const QgsPointV2 &point ) const; + bool contains( const QgsPoint &point ) const; %Docstring Returns true when box contains a ``point``. diff --git a/python/core/geometry/qgscircle.sip b/python/core/geometry/qgscircle.sip index 298cc930a65..29dbf3dd767 100644 --- a/python/core/geometry/qgscircle.sip +++ b/python/core/geometry/qgscircle.sip @@ -29,7 +29,7 @@ class QgsCircle : QgsEllipse public: QgsCircle(); - QgsCircle( const QgsPointV2 ¢er, double radius, double azimuth = 0 ); + QgsCircle( const QgsPoint ¢er, double radius, double azimuth = 0 ); %Docstring Constructs a circle by defining all the members. \param center The center of the circle. @@ -37,7 +37,7 @@ class QgsCircle : QgsEllipse \param azimuth Angle in degrees started from the North to the first quadrant. %End - static QgsCircle from2Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsCircle from2Points( const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Constructs a circle by 2 points on the circle. The center point can have z and m values which are the result from the midpoint operation between ``pt1`` and ``pt2``. @@ -48,7 +48,7 @@ class QgsCircle : QgsEllipse :rtype: QgsCircle %End - static QgsCircle from3Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double epsilon = 1E-8 ); + static QgsCircle from3Points( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon = 1E-8 ); %Docstring Constructs a circle by 3 points on the circle. Z and m values are dropped for the center point. @@ -61,7 +61,7 @@ class QgsCircle : QgsEllipse :rtype: QgsCircle %End - static QgsCircle fromCenterDiameter( const QgsPointV2 ¢er, double diameter, double azimuth = 0 ); + static QgsCircle fromCenterDiameter( const QgsPoint ¢er, double diameter, double azimuth = 0 ); %Docstring Constructs a circle by a center point and a diameter. The center point keeps z and m values from ``center``. @@ -72,7 +72,7 @@ class QgsCircle : QgsEllipse %End - static QgsCircle fromCenterPoint( const QgsPointV2 ¢er, const QgsPointV2 &pt1 ); + static QgsCircle fromCenterPoint( const QgsPoint ¢er, const QgsPoint &pt1 ); %Docstring Constructs a circle by a center point and another point. The center point keeps z and m values from ``center``. @@ -84,9 +84,9 @@ class QgsCircle : QgsEllipse %End - static QgsCircle from3Tangents( const QgsPointV2 &pt1_tg1, const QgsPointV2 &pt2_tg1, - const QgsPointV2 &pt1_tg2, const QgsPointV2 &pt2_tg2, - const QgsPointV2 &pt1_tg3, const QgsPointV2 &pt2_tg3, double epsilon = 1E-8 ); + static QgsCircle from3Tangents( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, + const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, + const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon = 1E-8 ); %Docstring Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle). Z and m values are dropped for the center point. @@ -101,7 +101,7 @@ class QgsCircle : QgsEllipse :rtype: QgsCircle %End - static QgsCircle fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsCircle fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Constructs a circle by an extent (aka bounding box / QgsRectangle). The center point can have z and m values which are the result from the midpoint operation between ``pt1`` and ``pt2``. @@ -143,13 +143,13 @@ Returns the radius of the circle Set the radius of the circle %End - QVector northQuadrant() const /Factory/; + QVector northQuadrant() const /Factory/; %Docstring The four quadrants of the ellipse. They are oriented and started from North. :return: quadrants defined by four points. .. seealso:: quadrant() - :rtype: list of QgsPointV2 + :rtype: list of QgsPoint %End QgsCircularString *toCircularString( bool oriented = false ) const; diff --git a/python/core/geometry/qgscircularstring.sip b/python/core/geometry/qgscircularstring.sip index 86f7187ef92..c62402cd726 100644 --- a/python/core/geometry/qgscircularstring.sip +++ b/python/core/geometry/qgscircularstring.sip @@ -51,10 +51,10 @@ class QgsCircularString: QgsCurve virtual int numPoints() const; - QgsPointV2 pointN( int i ) const; + QgsPoint pointN( int i ) const; %Docstring Returns the point at index i within the circular string. - :rtype: QgsPointV2 + :rtype: QgsPoint %End virtual void points( QgsPointSequence &pts /Out/ ) const; @@ -66,8 +66,8 @@ class QgsCircularString: QgsCurve %End virtual double length() const; - virtual QgsPointV2 startPoint() const; - virtual QgsPointV2 endPoint() const; + virtual QgsPoint startPoint() const; + virtual QgsPoint endPoint() const; virtual QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/; %Docstring @@ -90,15 +90,15 @@ class QgsCircularString: QgsCurve virtual void drawAsPolygon( QPainter &p ) const; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); virtual bool deleteVertex( QgsVertexId position ); - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const; - virtual bool pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const; + virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const; virtual void sumUpArea( double &sum /Out/ ) const; diff --git a/python/core/geometry/qgscompoundcurve.sip b/python/core/geometry/qgscompoundcurve.sip index fdcdf3dd989..902acfb005e 100644 --- a/python/core/geometry/qgscompoundcurve.sip +++ b/python/core/geometry/qgscompoundcurve.sip @@ -47,8 +47,8 @@ class QgsCompoundCurve: QgsCurve virtual double length() const; - virtual QgsPointV2 startPoint() const; - virtual QgsPointV2 endPoint() const; + virtual QgsPoint startPoint() const; + virtual QgsPoint endPoint() const; virtual void points( QgsPointSequence &pts /Out/ ) const; virtual int numPoints() const; virtual bool isEmpty() const; @@ -86,7 +86,7 @@ class QgsCompoundCurve: QgsCurve \param i index of curve to remove %End - void addVertex( const QgsPointV2 &pt ); + void addVertex( const QgsPoint &pt ); %Docstring Adds a vertex to the end of the geometry. %End @@ -102,15 +102,15 @@ class QgsCompoundCurve: QgsCurve virtual void drawAsPolygon( QPainter &p ) const; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); virtual bool deleteVertex( QgsVertexId position ); - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const; - virtual bool pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const; + virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const; virtual void sumUpArea( double &sum /Out/ ) const; diff --git a/python/core/geometry/qgscurve.sip b/python/core/geometry/qgscurve.sip index 14104ca6126..c220a84d7f8 100644 --- a/python/core/geometry/qgscurve.sip +++ b/python/core/geometry/qgscurve.sip @@ -31,18 +31,18 @@ class QgsCurve: QgsAbstractGeometry virtual QgsCurve *clone() const = 0 /Factory/; - virtual QgsPointV2 startPoint() const = 0; + virtual QgsPoint startPoint() const = 0; %Docstring Returns the starting point of the curve. .. seealso:: endPoint - :rtype: QgsPointV2 + :rtype: QgsPoint %End - virtual QgsPointV2 endPoint() const = 0; + virtual QgsPoint endPoint() const = 0; %Docstring Returns the end point of the curve. .. seealso:: startPoint - :rtype: QgsPointV2 + :rtype: QgsPoint %End virtual bool isClosed() const; @@ -94,9 +94,9 @@ class QgsCurve: QgsAbstractGeometry %End virtual QgsCoordinateSequence coordinateSequence() const; - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex /Out/ ) const; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const; - virtual bool pointAt( int node, QgsPointV2 &point /Out/, QgsVertexId::VertexType &type /Out/ ) const = 0; + virtual bool pointAt( int node, QgsPoint &point /Out/, QgsVertexId::VertexType &type /Out/ ) const = 0; %Docstring Returns the point and vertex id of a point within the curve. \param node node number, where the first node is 0 @@ -127,7 +127,7 @@ class QgsCurve: QgsAbstractGeometry virtual int vertexCount( int part = 0, int ring = 0 ) const; virtual int ringCount( int part = 0 ) const; virtual int partCount() const; - virtual QgsPointV2 vertexAt( QgsVertexId id ) const; + virtual QgsPoint vertexAt( QgsVertexId id ) const; virtual QgsRectangle boundingBox() const; diff --git a/python/core/geometry/qgscurvepolygon.sip b/python/core/geometry/qgscurvepolygon.sip index bbb71d93c2d..60ec60426cf 100644 --- a/python/core/geometry/qgscurvepolygon.sip +++ b/python/core/geometry/qgscurvepolygon.sip @@ -116,19 +116,19 @@ Adds an interior ring to the geometry (takes ownership) virtual void transform( const QTransform &t ); - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); virtual bool deleteVertex( QgsVertexId position ); virtual QgsCoordinateSequence coordinateSequence() const; virtual int nCoordinates() const; virtual bool isEmpty() const; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const; - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex /Out/ ) const; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const; virtual bool hasCurvedSegments() const; @@ -155,7 +155,7 @@ Adds an interior ring to the geometry (takes ownership) virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const; virtual int ringCount( int /*part*/ = 0 ) const; virtual int partCount() const; - virtual QgsPointV2 vertexAt( QgsVertexId id ) const; + virtual QgsPoint vertexAt( QgsVertexId id ) const; virtual bool addZValue( double zValue = 0 ); virtual bool addMValue( double mValue = 0 ); diff --git a/python/core/geometry/qgsellipse.sip b/python/core/geometry/qgsellipse.sip index 8650e03db78..ee5a593c61b 100644 --- a/python/core/geometry/qgsellipse.sip +++ b/python/core/geometry/qgsellipse.sip @@ -27,7 +27,7 @@ class QgsEllipse public: QgsEllipse(); - QgsEllipse( const QgsPointV2 ¢er, const double semiMajorAxis, const double semiMinorAxis, const double azimuth = 90 ); + QgsEllipse( const QgsPoint ¢er, const double semiMajorAxis, const double semiMinorAxis, const double azimuth = 90 ); %Docstring Constructs an ellipse by defining all the members. \param center The center of the ellipse. @@ -36,7 +36,7 @@ class QgsEllipse \param azimuth Angle in degrees started from the North to the first quadrant. %End - static QgsEllipse fromFoci( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3 ); + static QgsEllipse fromFoci( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3 ); %Docstring Constructs an ellipse by foci (``pt1`` and ``pt2``) and a point ``pt3``. The center point can have z and m values which are the result from the midpoint operation between ``pt1`` and ``pt2``. @@ -48,7 +48,7 @@ class QgsEllipse :rtype: QgsEllipse %End - static QgsEllipse fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsEllipse fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Constructs an ellipse by an extent (aka bounding box / QgsRectangle). The center point can have z and m values which are the result from the midpoint operation between ``pt1`` and ``pt2``. @@ -59,7 +59,7 @@ class QgsEllipse :rtype: QgsEllipse %End - static QgsEllipse fromCenterPoint( const QgsPointV2 &ptc, const QgsPointV2 &pt1 ); + static QgsEllipse fromCenterPoint( const QgsPoint &ptc, const QgsPoint &pt1 ); %Docstring Constructs an ellipse by a center point and a another point. The center point keeps z and m values from ``ptc``. @@ -70,7 +70,7 @@ class QgsEllipse :rtype: QgsEllipse %End - static QgsEllipse fromCenter2Points( const QgsPointV2 &ptc, const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsEllipse fromCenter2Points( const QgsPoint &ptc, const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Constructs an ellipse by a central point and two other points. The center point keeps z and m values from ``ptc``. @@ -91,12 +91,12 @@ An ellipse is empty if axes are equal to 0 :rtype: bool %End - QgsPointV2 center() const; + QgsPoint center() const; %Docstring Returns the center point. .. seealso:: setCenter() .. seealso:: rcenter() - :rtype: QgsPointV2 + :rtype: QgsPoint %End double semiMajorAxis() const; @@ -121,7 +121,7 @@ An ellipse is empty if axes are equal to 0 %End - void setCenter( const QgsPointV2 ¢er ); + void setCenter( const QgsPoint ¢er ); %Docstring Sets the center point. .. seealso:: center() @@ -155,13 +155,13 @@ An ellipse is empty if axes are equal to 0 :rtype: float %End - virtual QVector foci() const; + virtual QVector foci() const; %Docstring Two foci of the ellipse. The axes are oriented by the azimuth and are on the semi-major axis. .. seealso:: fromFoci() .. seealso:: focusDistance() :return: the two foci. - :rtype: list of QgsPointV2 + :rtype: list of QgsPoint %End virtual double eccentricity() const; @@ -181,12 +181,12 @@ The circumference of the ellipse using first approximation of Ramanujan. :rtype: float %End - virtual QVector quadrant() const; + virtual QVector quadrant() const; %Docstring The four quadrants of the ellipse. They are oriented and started always from semi-major axis. :return: quadrants defined by four points. - :rtype: list of QgsPointV2 + :rtype: list of QgsPoint %End virtual QgsPointSequence points( unsigned int segments = 36 ) const; diff --git a/python/core/geometry/qgsgeometry.sip b/python/core/geometry/qgsgeometry.sip index 7ed7a6a09de..cf1af95d20a 100644 --- a/python/core/geometry/qgsgeometry.sip +++ b/python/core/geometry/qgsgeometry.sip @@ -15,15 +15,15 @@ -typedef QVector QgsPolyline; +typedef QVector QgsPolyline; -typedef QVector> QgsPolygon; +typedef QVector> QgsPolygon; -typedef QVector QgsMultiPoint; +typedef QVector QgsMultiPoint; -typedef QVector> QgsMultiPolyline; +typedef QVector> QgsMultiPolyline; -typedef QVector>> QgsMultiPolygon; +typedef QVector>> QgsMultiPolygon; @@ -95,9 +95,9 @@ Copy constructor will prompt a deep copy of the object Creates a new geometry from a WKT string :rtype: QgsGeometry %End - static QgsGeometry fromPoint( const QgsPoint &point ); + static QgsGeometry fromPoint( const QgsPointXY &point ); %Docstring -Creates a new geometry from a QgsPoint object +Creates a new geometry from a QgsPointXY object :rtype: QgsGeometry %End static QgsGeometry fromMultiPoint( const QgsMultiPoint &multipoint ); @@ -224,9 +224,9 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: float %End - QgsPoint closestVertex( const QgsPoint &point, int &atVertex /Out/, int &beforeVertex /Out/, int &afterVertex /Out/, double &sqrDist /Out/ ) const; + QgsPointXY closestVertex( const QgsPointXY &point, int &atVertex /Out/, int &beforeVertex /Out/, int &afterVertex /Out/, double &sqrDist /Out/ ) const; %Docstring - :rtype: QgsPoint + :rtype: QgsPointXY %End double distanceToVertex( int vertex ) const; @@ -277,7 +277,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: bool %End - bool insertVertex( const QgsPointV2 &point, int beforeVertex ); + bool insertVertex( const QgsPoint &point, int beforeVertex ); %Docstring Insert a new vertex before the given vertex index, ring and item (first number is index 0) @@ -302,7 +302,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: bool %End - bool moveVertex( const QgsPointV2 &p, int atVertex ); + bool moveVertex( const QgsPoint &p, int atVertex ); %Docstring Moves the vertex at the given position number and item (first number is index 0) @@ -326,15 +326,15 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: bool %End - QgsPoint vertexAt( int atVertex ) const; + QgsPointXY vertexAt( int atVertex ) const; %Docstring Returns coordinates of a vertex. \param atVertex index of the vertex - :return: Coordinates of the vertex or QgsPoint(0,0) on error - :rtype: QgsPoint + :return: Coordinates of the vertex or QgsPointXY(0,0) on error + :rtype: QgsPointXY %End - double sqrDistToVertexAt( QgsPoint &point /In/, int atVertex ) const; + double sqrDistToVertexAt( QgsPointXY &point /In/, int atVertex ) const; %Docstring Returns the squared cartesian distance between the given point to the given vertex index (vertex at the given position number, @@ -358,7 +358,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: QgsGeometry %End - double closestVertexWithContext( const QgsPoint &point, int &atVertex /Out/ ) const; + double closestVertexWithContext( const QgsPointXY &point, int &atVertex /Out/ ) const; %Docstring Searches for the closest vertex in this geometry to the given point. \param point Specifiest the point for search @@ -367,7 +367,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: float %End - double closestSegmentWithContext( const QgsPoint &point, QgsPoint &minDistPoint /Out/, int &afterVertex /Out/ ) const; + double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint /Out/, int &afterVertex /Out/ ) const; %Docstring Searches for the closest segment of geometry to the given point \param point Specifies the point for search @@ -380,7 +380,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: float %End - int addRing( const QList &ring ); + int addRing( const QList &ring ); %Docstring Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. :return: 0 in case of success (ring added), 1 problem with geometry type, 2 ring not closed, @@ -396,7 +396,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: int %End - int addPart( const QList &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) /PyName=addPoints/; + int addPart( const QList &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) /PyName=addPoints/; %Docstring Adds a new part to a the geometry. \param points points describing part to add @@ -470,7 +470,7 @@ not disjoint with existing polygons of the feature :rtype: int %End - int rotate( double rotation, const QgsPoint ¢er ); + int rotate( double rotation, const QgsPointXY ¢er ); %Docstring Rotate this geometry around the Z axis .. versionadded:: 2.8 @@ -480,15 +480,15 @@ not disjoint with existing polygons of the feature :rtype: int %End - int splitGeometry( const QList &splitLine, + int splitGeometry( const QList &splitLine, QList &newGeometries /Out/, bool topological, - QList &topologyTestPoints /Out/ ); + QList &topologyTestPoints /Out/ ); %Docstring :rtype: int %End - int reshapeGeometry( const QList &reshapeWithLine ); + int reshapeGeometry( const QList &reshapeWithLine ); %Docstring Replaces a part of this geometry with another line :return: 0 in case of success @@ -554,7 +554,7 @@ Test for intersection with a geometry (uses GEOS) :rtype: bool %End - bool contains( const QgsPoint *p ) const; + bool contains( const QgsPointXY *p ) const; %Docstring Test for containment of a point (uses GEOS) :rtype: bool @@ -916,11 +916,11 @@ Returns an extruded version of this geometry. %End - QgsPoint asPoint() const; + QgsPointXY asPoint() const; %Docstring Return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0,0] - :rtype: QgsPoint + :rtype: QgsPointXY %End QgsPolyline asPolyline() const; @@ -1062,14 +1062,14 @@ Ring 0 is outer ring and can't be deleted. public: Error(); explicit Error( const QString &m ); - Error( const QString &m, const QgsPoint &p ); + Error( const QString &m, const QgsPointXY &p ); QString what(); %Docstring :rtype: str %End - QgsPoint where(); + QgsPointXY where(); %Docstring - :rtype: QgsPoint + :rtype: QgsPointXY %End bool hasWhere(); %Docstring @@ -1231,19 +1231,19 @@ Ring 0 is outer ring and can't be deleted. if ( o0 && o1 ) { // compare polyline - polyline - if ( sipCanConvertToType( o0, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( o1, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a0, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a1, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) ) + if ( sipCanConvertToType( o0, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( o1, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) ) { QgsPolyline *p0; QgsPolyline *p1; - p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); - p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); + p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); + p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); if ( sipIsErr ) { - sipReleaseType( p0, sipType_QVector_0100QgsPoint, state0 ); - sipReleaseType( p1, sipType_QVector_0100QgsPoint, state1 ); + sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 ); + sipReleaseType( p1, sipType_QVector_0100QgsPointXY, state1 ); } else { @@ -1258,19 +1258,19 @@ Ring 0 is outer ring and can't be deleted. if ( oo0 && oo1 ) { // compare polygon - polygon - if ( sipCanConvertToType( oo0, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( oo1, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) ) + if ( sipCanConvertToType( oo0, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( oo1, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) ) { QgsPolygon *p0; QgsPolygon *p1; - p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); - p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); + p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); + p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); if ( sipIsErr ) { - sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPoint, state0 ); - sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPoint, state1 ); + sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPointXY, state0 ); + sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPointXY, state1 ); } else { @@ -1285,19 +1285,19 @@ Ring 0 is outer ring and can't be deleted. if ( ooo0 && ooo1 ) { // compare multipolygon - multipolygon - if ( sipCanConvertToType( ooo0, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( ooo1, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) ) + if ( sipCanConvertToType( ooo0, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( ooo1, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) ) { QgsMultiPolygon *p0; QgsMultiPolygon *p1; - p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); - p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); + p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); + p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); if ( sipIsErr ) { - sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, state0 ); - sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, state1 ); + sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state0 ); + sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state1 ); } else { @@ -1335,17 +1335,17 @@ Ring 0 is outer ring and can't be deleted. :rtype: QgsGeometryEngine %End - static void convertPointList( const QList &input, QgsPointSequence &output ); + static void convertPointList( const QList &input, QgsPointSequence &output ); %Docstring - Upgrades a point list from QgsPoint to QgsPointV2 - \param input list of QgsPoint objects to be upgraded + Upgrades a point list from QgsPointXY to QgsPointV2 + \param input list of QgsPointXY objects to be upgraded \param output destination for list of points converted to QgsPointV2 %End - static void convertPointList( const QgsPointSequence &input, QList &output ); + static void convertPointList( const QgsPointSequence &input, QList &output ); %Docstring - Downgrades a point list from QgsPointV2 to QgsPoint - \param input list of QgsPointV2 objects to be downgraded + Downgrades a point list from QgsPoint to QgsPoint + \param input list of QgsPoint objects to be downgraded \param output destination for list of points converted to QgsPoint %End diff --git a/python/core/geometry/qgsgeometrycollection.sip b/python/core/geometry/qgsgeometrycollection.sip index 7fe122ca1ad..ed5ce06e0dc 100644 --- a/python/core/geometry/qgsgeometrycollection.sip +++ b/python/core/geometry/qgsgeometrycollection.sip @@ -96,14 +96,14 @@ Adds a geometry and takes ownership. Returns true in case of success. virtual QgsCoordinateSequence coordinateSequence() const; virtual int nCoordinates() const; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const; - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex /Out/ ) const; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); virtual bool deleteVertex( QgsVertexId position ); virtual double length() const; @@ -134,7 +134,7 @@ Adds a geometry and takes ownership. Returns true in case of success. virtual int vertexCount( int part = 0, int ring = 0 ) const; virtual int ringCount( int part = 0 ) const; virtual int partCount() const; - virtual QgsPointV2 vertexAt( QgsVertexId id ) const; + virtual QgsPoint vertexAt( QgsVertexId id ) const; virtual bool addZValue( double zValue = 0 ); virtual bool addMValue( double mValue = 0 ); diff --git a/python/core/geometry/qgsgeometryengine.sip b/python/core/geometry/qgsgeometryengine.sip index 045eefec1ef..ef1770facd2 100644 --- a/python/core/geometry/qgsgeometryengine.sip +++ b/python/core/geometry/qgsgeometryengine.sip @@ -66,11 +66,11 @@ class QgsGeometryEngine %Docstring :rtype: QgsAbstractGeometry %End - virtual bool centroid( QgsPointV2 &pt, QString *errorMsg = 0 ) const = 0; + virtual bool centroid( QgsPoint &pt, QString *errorMsg = 0 ) const = 0; %Docstring :rtype: bool %End - virtual bool pointOnSurface( QgsPointV2 &pt, QString *errorMsg = 0 ) const = 0; + virtual bool pointOnSurface( QgsPoint &pt, QString *errorMsg = 0 ) const = 0; %Docstring :rtype: bool %End diff --git a/python/core/geometry/qgsgeometryutils.sip b/python/core/geometry/qgsgeometryutils.sip index 5336e5e7718..763e8f2b4cf 100644 --- a/python/core/geometry/qgsgeometryutils.sip +++ b/python/core/geometry/qgsgeometryutils.sip @@ -30,11 +30,11 @@ class QgsGeometryUtils :rtype: list of QgsLineString %End - static QgsPointV2 closestVertex( const QgsAbstractGeometry &geom, const QgsPointV2 &pt, QgsVertexId &id /Out/ ); + static QgsPoint closestVertex( const QgsAbstractGeometry &geom, const QgsPoint &pt, QgsVertexId &id /Out/ ); %Docstring Returns the closest vertex to a geometry for a specified point. On error null point will be returned and "id" argument will be invalid. - :rtype: QgsPointV2 + :rtype: QgsPoint %End static double distanceToVertex( const QgsAbstractGeometry &geom, QgsVertexId id ); @@ -71,7 +71,7 @@ class QgsGeometryUtils Returns vertices adjacent to a specified vertex within a geometry. %End - static double sqrDistance2D( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static double sqrDistance2D( const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Returns the squared 2D distance between two points. :rtype: float @@ -83,7 +83,7 @@ class QgsGeometryUtils :rtype: float %End - static bool lineIntersection( const QgsPointV2 &p1, QgsVector v, const QgsPointV2 &q1, QgsVector w, QgsPointV2 &inter /Out/ ); + static bool lineIntersection( const QgsPoint &p1, QgsVector v, const QgsPoint &q1, QgsVector w, QgsPoint &inter /Out/ ); %Docstring Compute the intersection between two lines \param p1 Point on the first line @@ -95,7 +95,7 @@ class QgsGeometryUtils :rtype: bool %End - static bool segmentIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &q1, const QgsPointV2 &q2, QgsPointV2 &inter /Out/, double tolerance ); + static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &inter /Out/, double tolerance ); %Docstring Compute the intersection between two segments \param p1 First segment start point @@ -108,14 +108,14 @@ class QgsGeometryUtils :rtype: bool %End - static QgsPointV2 projPointOnSegment( const QgsPointV2 &p, const QgsPointV2 &s1, const QgsPointV2 &s2 ); + static QgsPoint projPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ); %Docstring Project the point on a segment \param p The point \param s1 The segment start point \param s2 The segment end point :return: The projection of the point on the segment - :rtype: QgsPointV2 + :rtype: QgsPoint %End @@ -126,10 +126,10 @@ Returns < 0 if point(x/y) is left of the line x1,y1 -> x2,y2 :rtype: float %End - static QgsPointV2 pointOnLineWithDistance( const QgsPointV2 &startPoint, const QgsPointV2 &directionPoint, double distance ); + static QgsPoint pointOnLineWithDistance( const QgsPoint &startPoint, const QgsPoint &directionPoint, double distance ); %Docstring Returns a point a specified distance toward a second point. - :rtype: QgsPointV2 + :rtype: QgsPoint %End static double ccwAngle( double dy, double dx ); @@ -138,7 +138,7 @@ Returns the counter clockwise angle between a line with components dx, dy and th :rtype: float %End - static void circleCenterRadius( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double &radius /Out/, + static void circleCenterRadius( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double &radius /Out/, double ¢erX /Out/, double ¢erY /Out/ ); %Docstring Returns radius and center of the circle through pt1, pt2, pt3 @@ -175,20 +175,20 @@ Calculates angle of a circular string part defined by pt1, pt2, pt3 :rtype: float %End - static bool segmentMidPoint( const QgsPointV2 &p1, const QgsPointV2 &p2, QgsPointV2 &result /Out/, double radius, const QgsPointV2 &mousePos ); + static bool segmentMidPoint( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &result /Out/, double radius, const QgsPoint &mousePos ); %Docstring Calculates midpoint on circle passing through p1 and p2, closest to given coordinate :rtype: bool %End - static double circleTangentDirection( const QgsPointV2 &tangentPoint, const QgsPointV2 &cp1, const QgsPointV2 &cp2, const QgsPointV2 &cp3 ); + static double circleTangentDirection( const QgsPoint &tangentPoint, const QgsPoint &cp1, const QgsPoint &cp2, const QgsPoint &cp3 ); %Docstring Calculates the direction angle of a circle tangent (clockwise from north in radians) :rtype: float %End - static void segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3, - QList &points /Out/, double tolerance = M_PI_2 / 90, + static void segmentizeArc( const QgsPoint &p1, const QgsPointV2 &p2, const QgsPoint &p3, + QList &points /Out/, double tolerance = M_PI_2 / 90, QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle, bool hasZ = false, bool hasM = false ); %Docstring @@ -197,7 +197,7 @@ Calculates the direction angle of a circle tangent (clockwise from north in radi :rtype: QgsPointSequence %End - static int segmentSide( const QgsPointV2 &pt1, const QgsPointV2 &pt3, const QgsPointV2 &pt2 ); + static int segmentSide( const QgsPoint &pt1, const QgsPoint &pt3, const QgsPoint &pt2 ); %Docstring For line defined by points pt1 and pt3, find out on which side of the line is point pt3. Returns -1 if pt3 on the left side, 1 if pt3 is on the right side or 0 if pt3 lies on the line. @@ -281,7 +281,7 @@ Angle between two linear segments - static QgsPointV2 midpoint( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsPoint midpoint( const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Returns a middle point between points pt1 and pt2. Z value is computed if one of this point have Z. @@ -291,21 +291,21 @@ Angle between two linear segments :return: New point at middle between points pt1 and pt2. * Example: \code{.py} - p = QgsPointV2( 4, 6 ) # 2D point - pr = midpoint ( p, QgsPointV2( 2, 2 ) ) + p = QgsPoint( 4, 6 ) # 2D point + pr = midpoint ( p, QgsPoint( 2, 2 ) ) # pr is a 2D point: 'Point (3 4)' - pr = midpoint ( p, QgsPointV2( QgsWkbTypes.PointZ, 2, 2, 2 ) ) + pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZ, 2, 2, 2 ) ) # pr is a 3D point: 'PointZ (3 4 1)' - pr = midpoint ( p, QgsPointV2( QgsWkbTypes.PointM, 2, 2, 0, 2 ) ) + pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointM, 2, 2, 0, 2 ) ) # pr is a 3D point: 'PointM (3 4 1)' - pr = midpoint ( p, QgsPointV2( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) ) + pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) ) # pr is a 3D point: 'PointZM (3 4 1 1)' \endcode .. versionadded:: 3.0 - :rtype: QgsPointV2 + :rtype: QgsPoint %End - static double gradient( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static double gradient( const QgsPoint &pt1, const QgsPoint &pt2 ); %Docstring Return the gradient of a line defined by points ``pt1`` and ``pt2``. \param pt1 first point. @@ -315,7 +315,7 @@ Angle between two linear segments :rtype: float %End - static void coefficients( const QgsPointV2 &pt1, const QgsPointV2 &pt2, + static void coefficients( const QgsPoint &pt1, const QgsPoint &pt2, double &a /Out/, double &b /Out/, double &c /Out/ ); %Docstring Return the coefficients (a, b, c for equation "ax + by + c = 0") of a line defined by points ``pt1`` and ``pt2``. @@ -327,7 +327,7 @@ Angle between two linear segments .. versionadded:: 3.0 %End - static QgsLineString perpendicularSegment( const QgsPointV2 &p, const QgsPointV2 &s1, const QgsPointV2 &s2 ); + static QgsLineString perpendicularSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ); %Docstring Create a perpendicular line segment from p to segment [s1, s2] \param p The point diff --git a/python/core/geometry/qgslinestring.sip b/python/core/geometry/qgslinestring.sip index 5737f93d446..47d5a0cad68 100644 --- a/python/core/geometry/qgslinestring.sip +++ b/python/core/geometry/qgslinestring.sip @@ -38,7 +38,7 @@ class QgsLineString: QgsCurve .. versionadded:: 3.0 %End - QgsLineString( const QList &points ); + QgsLineString( const QList &points ); %Docstring Construct a linestring from list of points. This constructor is more efficient then calling setPoints() @@ -51,11 +51,11 @@ class QgsLineString: QgsCurve virtual bool operator!=( const QgsCurve &other ) const; - QgsPointV2 pointN( int i ) const; + QgsPoint pointN( int i ) const; %Docstring Returns the specified point from inside the line string. \param i index of point, starting at 0 for the first point - :rtype: QgsPointV2 + :rtype: QgsPoint %End virtual double xAt( int index ) const; @@ -132,7 +132,7 @@ class QgsLineString: QgsCurve \param line line to append. Ownership is not transferred. %End - void addVertex( const QgsPointV2 &pt ); + void addVertex( const QgsPoint &pt ); %Docstring Adds a new vertex to the end of the line string. \param pt vertex to add @@ -182,8 +182,8 @@ Closes the line string by appending the first point to the end of the line, if i virtual double length() const; - virtual QgsPointV2 startPoint() const; - virtual QgsPointV2 endPoint() const; + virtual QgsPoint startPoint() const; + virtual QgsPoint endPoint() const; virtual QgsLineString *curveToLine( double tolerance = M_PI_2 / 90, SegmentationToleranceType toleranceType = MaximumAngle ) const /Factory/; %Docstring @@ -213,19 +213,19 @@ Closes the line string by appending the first point to the end of the line, if i virtual void drawAsPolygon( QPainter &p ) const; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); virtual bool deleteVertex( QgsVertexId position ); virtual QgsLineString *reversed() const /Factory/; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const; - virtual bool pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const; + virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const; - virtual QgsPointV2 centroid() const; + virtual QgsPoint centroid() const; virtual void sumUpArea( double &sum /Out/ ) const; diff --git a/python/core/geometry/qgspointv2.sip b/python/core/geometry/qgspointv2.sip index 9353a8c659f..7f0f00b12fa 100644 --- a/python/core/geometry/qgspointv2.sip +++ b/python/core/geometry/qgspointv2.sip @@ -10,7 +10,7 @@ -class QgsPointV2: QgsAbstractGeometry +class QgsPoint: QgsAbstractGeometry { %Docstring Point geometry type, with support for z-dimension and m-values. @@ -22,24 +22,24 @@ class QgsPointV2: QgsAbstractGeometry %End public: - QgsPointV2( double x = 0.0, double y = 0.0 ); + QgsPoint( double x = 0.0, double y = 0.0 ); %Docstring Construct a 2 dimensional point with an initial x and y coordinate. \param x x-coordinate of point \param y y-coordinate of point %End - explicit QgsPointV2( const QgsPoint &p ); + explicit QgsPoint( const QgsPointXY &p ); %Docstring - Construct a QgsPointV2 from a QgsPoint object + Construct a QgsPoint from a QgsPointXY object %End - explicit QgsPointV2( QPointF p ); + explicit QgsPoint( QPointF p ); %Docstring - Construct a QgsPointV2 from a QPointF + Construct a QgsPoint from a QPointF %End - QgsPointV2( QgsWkbTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 ); + QgsPoint( QgsWkbTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 ); %Docstring Construct a point with a specified type (e.g., PointZ, PointM) and initial x, y, z, and m values. \param type point type @@ -57,12 +57,12 @@ class QgsPointV2: QgsAbstractGeometry } else { - sipCpp = new sipQgsPointV2( a0, a1, a2, a3, a4 ); + sipCpp = new sipQgsPoint( a0, a1, a2, a3, a4 ); } %End - bool operator==( const QgsPointV2 &pt ) const; - bool operator!=( const QgsPointV2 &pt ) const; + bool operator==( const QgsPoint &pt ) const; + bool operator!=( const QgsPoint &pt ) const; %Docstring :rtype: bool %End @@ -156,7 +156,7 @@ class QgsPointV2: QgsAbstractGeometry :rtype: float %End - double distance( const QgsPointV2 &other ) const; + double distance( const QgsPoint &other ) const; %Docstring Returns the 2D distance between this point and another point. In certain cases it may be more appropriate to call the faster distanceSquared() method, e.g., @@ -175,7 +175,7 @@ class QgsPointV2: QgsAbstractGeometry :rtype: float %End - double distanceSquared( const QgsPointV2 &other ) const; + double distanceSquared( const QgsPoint &other ) const; %Docstring Returns the squared distance between this point another point. Calling this is faster than calling distance(), and may be useful in use cases such as comparing @@ -195,7 +195,7 @@ class QgsPointV2: QgsAbstractGeometry :rtype: float %End - double distance3D( const QgsPointV2 &other ) const; + double distance3D( const QgsPoint &other ) const; %Docstring Returns the 3D distance between this point and another point. In certain cases it may be more appropriate to call the faster distanceSquared() method, e.g., @@ -214,7 +214,7 @@ class QgsPointV2: QgsAbstractGeometry :rtype: float %End - double distanceSquared3D( const QgsPointV2 &other ) const; + double distanceSquared3D( const QgsPoint &other ) const; %Docstring Returns the 3D squared distance between this point another point. Calling this is faster than calling distance(), and may be useful in use cases such as comparing @@ -224,14 +224,14 @@ class QgsPointV2: QgsAbstractGeometry :rtype: float %End - double azimuth( const QgsPointV2 &other ) const; + double azimuth( const QgsPoint &other ) const; %Docstring Calculates azimuth between this point and other one (clockwise in degree, starting from north) .. versionadded:: 3.0 :rtype: float %End - double inclination( const QgsPointV2 &other ) const; + double inclination( const QgsPoint &other ) const; %Docstring Calculates inclination between this point and other one (starting from zenith = 0 to nadir = 180. Horizon = 90) Returns 90.0 if the distance between this point and other one is equal to 0 (same point). @@ -239,7 +239,7 @@ class QgsPointV2: QgsAbstractGeometry :rtype: float %End - QgsPointV2 project( double distance, double azimuth, double inclination = 90.0 ) const; + QgsPoint project( double distance, double azimuth, double inclination = 90.0 ) const; %Docstring Returns a new point which correspond to this point projected by a specified distance with specified angles (azimuth and inclination). @@ -251,14 +251,14 @@ class QgsPointV2: QgsAbstractGeometry inclination is 90. A 3D point is always returned if a 3D point is projected. Example: \code{.py} - p = QgsPointV2( 1, 2 ) # 2D point + p = QgsPoint( 1, 2 ) # 2D point pr = p.project ( 1, 0 ) # pr is a 2D point: 'Point (1 3)' pr = p.project ( 1, 0, 90 ) # pr is a 2D point: 'Point (1 3)' pr = p.project (1, 0, 0 ) # pr is a 3D point: 'PointZ (1 2 1)' - p = QgsPointV2( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point + p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point pr = p.project ( 1, 0 ) # pr is a 3D point: 'PointZ (1 3 2)' pr = p.project ( 1, 0, 90 ) @@ -267,49 +267,49 @@ class QgsPointV2: QgsAbstractGeometry # pr is a 3D point: 'PointZ (1 2 3)' \endcode .. versionadded:: 3.0 - :rtype: QgsPointV2 + :rtype: QgsPoint %End - QgsVector operator-( const QgsPointV2 &p ) const; + QgsVector operator-( const QgsPoint &p ) const; %Docstring Calculates the vector obtained by subtracting a point from this point. .. versionadded:: 3.0 :rtype: QgsVector %End - QgsPointV2 &operator+=( QgsVector v ); + QgsPoint &operator+=( QgsVector v ); %Docstring Adds a vector to this point in place. .. versionadded:: 3.0 - :rtype: QgsPointV2 + :rtype: QgsPoint %End - QgsPointV2 &operator-=( QgsVector v ); + QgsPoint &operator-=( QgsVector v ); %Docstring Subtracts a vector from this point in place. .. versionadded:: 3.0 - :rtype: QgsPointV2 + :rtype: QgsPoint %End - QgsPointV2 operator+( QgsVector v ) const; + QgsPoint operator+( QgsVector v ) const; %Docstring Adds a vector to this point. .. versionadded:: 3.0 - :rtype: QgsPointV2 + :rtype: QgsPoint %End - QgsPointV2 operator-( QgsVector v ) const; + QgsPoint operator-( QgsVector v ) const; %Docstring Subtracts a vector from this point. .. versionadded:: 3.0 - :rtype: QgsPointV2 + :rtype: QgsPoint %End virtual bool isEmpty() const; virtual QgsRectangle boundingBox() const; virtual QString geometryType() const; virtual int dimension() const; - virtual QgsPointV2 *clone() const /Factory/; + virtual QgsPoint *clone() const /Factory/; virtual void clear(); virtual bool fromWkb( QgsConstWkbPtr &wkb ); @@ -334,14 +334,14 @@ class QgsPointV2: QgsAbstractGeometry virtual int nCoordinates() const; virtual QgsAbstractGeometry *boundary() const /Factory/; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ); virtual bool deleteVertex( QgsVertexId position ); - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt /Out/, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const; - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex /Out/ ) const; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const; virtual double vertexAngle( QgsVertexId vertex ) const; @@ -355,7 +355,7 @@ class QgsPointV2: QgsAbstractGeometry virtual int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const; virtual int ringCount( int /*part*/ = 0 ) const; virtual int partCount() const; - virtual QgsPointV2 vertexAt( QgsVertexId /*id*/ ) const; + virtual QgsPoint vertexAt( QgsVertexId /*id*/ ) const; virtual bool addZValue( double zValue = 0 ); virtual bool addMValue( double mValue = 0 ); diff --git a/python/core/geometry/qgsrectangle.sip b/python/core/geometry/qgsrectangle.sip index 0f38f1b286e..33eced50326 100644 --- a/python/core/geometry/qgsrectangle.sip +++ b/python/core/geometry/qgsrectangle.sip @@ -29,7 +29,7 @@ class QgsRectangle %Docstring Constructor %End - QgsRectangle( const QgsPoint &p1, const QgsPoint &p2 ); + QgsRectangle( const QgsPointXY &p1, const QgsPointXY &p2 ); %Docstring Construct a rectangle from two points. The rectangle is normalized after construction. %End @@ -42,7 +42,7 @@ Construct a rectangle from a QRectF. The rectangle is normalized after construct Copy constructor %End - void set( const QgsPoint &p1, const QgsPoint &p2 ); + void set( const QgsPointXY &p1, const QgsPointXY &p2 ); %Docstring Sets the rectangle from two QgsPoints. The rectangle is normalised after construction. @@ -143,13 +143,13 @@ Copy constructor :rtype: float %End - QgsPoint center() const; + QgsPointXY center() const; %Docstring Returns the center point of the rectangle. - :rtype: QgsPoint + :rtype: QgsPointXY %End - void scale( double scaleFactor, const QgsPoint *c = 0 ); + void scale( double scaleFactor, const QgsPointXY *c = 0 ); %Docstring Scale the rectangle around its center point. %End @@ -164,7 +164,7 @@ Copy constructor Grows the rectangle by the specified amount. %End - void include( const QgsPoint &p ); + void include( const QgsPointXY &p ); %Docstring Updates the rectangle to include the specified point. %End @@ -194,7 +194,7 @@ Copy constructor :rtype: bool %End - bool contains( const QgsPoint &p ) const; + bool contains( const QgsPointXY &p ) const; %Docstring Return true when rectangle contains a point. :rtype: bool diff --git a/python/core/geometry/qgsregularpolygon.sip b/python/core/geometry/qgsregularpolygon.sip index b147aebd344..e5a9cac14b3 100644 --- a/python/core/geometry/qgsregularpolygon.sip +++ b/python/core/geometry/qgsregularpolygon.sip @@ -35,7 +35,7 @@ class QgsRegularPolygon QgsRegularPolygon(); - QgsRegularPolygon( const QgsPointV2 ¢er, const double radius, const double azimuth, const int numberSides, const ConstructionOption circle ); + QgsRegularPolygon( const QgsPoint ¢er, const double radius, const double azimuth, const int numberSides, const ConstructionOption circle ); %Docstring Constructs a regular polygon by ``center`` and parameters for the first vertex. An empty regular polygon is returned if ``numberSides`` < 3 or ``ConstructionOption`` isn't valid. \param center The center of the regular polygon. @@ -45,7 +45,7 @@ class QgsRegularPolygon .. seealso:: ConstructionOption %End - QgsRegularPolygon( const QgsPointV2 ¢er, const QgsPointV2 &pt1, const int numberSides, const ConstructionOption circle ); + QgsRegularPolygon( const QgsPoint ¢er, const QgsPoint &pt1, const int numberSides, const ConstructionOption circle ); %Docstring Constructs a regular polygon by ``center`` and another point. \param center The center of the regular polygon. @@ -54,7 +54,7 @@ class QgsRegularPolygon \param circle Option to create the polygon inscribed in circle (the radius is the distance between the center and vertices) or circumscribed about circle (the radius is the distance from the center to the midpoints of the sides). %End - QgsRegularPolygon( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const int numberSides ); + QgsRegularPolygon( const QgsPoint &pt1, const QgsPoint &pt2, const int numberSides ); %Docstring Constructs a regular polygon by two points of the first side. \param pt1 The first vertex of the first side, also first vertex of the regular polygon. @@ -71,11 +71,11 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3 :rtype: bool %End - QgsPointV2 center() const; + QgsPoint center() const; %Docstring Returns the center point of the regular polygon. .. seealso:: setCenter() - :rtype: QgsPointV2 + :rtype: QgsPoint %End double radius() const; @@ -87,11 +87,11 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3 :rtype: float %End - QgsPointV2 firstVertex() const; + QgsPoint firstVertex() const; %Docstring Returns the first vertex (corner) of the regular polygon. .. seealso:: setFirstVertex() - :rtype: QgsPointV2 + :rtype: QgsPoint %End double apothem() const; @@ -109,7 +109,7 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3 :rtype: int %End - void setCenter( const QgsPointV2 ¢er ); + void setCenter( const QgsPoint ¢er ); %Docstring Sets the center point. Radius is unchanged. The first vertex is reprojected from the new center. @@ -123,7 +123,7 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3 .. seealso:: radius() %End - void setFirstVertex( const QgsPointV2 &firstVertex ); + void setFirstVertex( const QgsPoint &firstVertex ); %Docstring Sets the first vertex. Radius is unchanged. The center is reprojected from the new first vertex. diff --git a/python/core/geometry/qgstriangle.sip b/python/core/geometry/qgstriangle.sip index 033c90d6ef8..e3b72bd08a6 100644 --- a/python/core/geometry/qgstriangle.sip +++ b/python/core/geometry/qgstriangle.sip @@ -22,7 +22,7 @@ class QgsTriangle : QgsPolygonV2 public: QgsTriangle(); - QgsTriangle( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3 ); + QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ); %Docstring Construct a QgsTriangle from three QgsPointV2. An empty triangle is returned if there are identical points or if the points are collinear. @@ -31,7 +31,7 @@ class QgsTriangle : QgsPolygonV2 \param p3 third point %End - explicit QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ); + explicit QgsTriangle( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3 ); %Docstring Construct a QgsTriangle from three QgsPoint. An empty triangle is returned if there are identical points or if the points are collinear. @@ -84,13 +84,13 @@ Inherited method not used. You cannot add an interior ring into a triangle. Inherited method not used. You cannot delete or insert a vertex directly. Returns always false. :rtype: bool %End - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ); %Docstring Inherited method not used. You cannot delete or insert a vertex directly. Returns always false. :rtype: bool %End - virtual bool moveVertex( QgsVertexId vId, const QgsPointV2 &newPos ); + virtual bool moveVertex( QgsVertexId vId, const QgsPoint &newPos ); virtual void setExteriorRing( QgsCurve *ring /Transfer/ ); @@ -98,12 +98,12 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return virtual QgsAbstractGeometry *boundary() const /Factory/; - QgsPointV2 vertexAt( int atVertex ) const; + QgsPoint vertexAt( int atVertex ) const; %Docstring Returns coordinates of a vertex. \param atVertex index of the vertex - :return: Coordinates of the vertex or QgsPointV2(0,0) on error (``atVertex`` < 0 or > 3). - :rtype: QgsPointV2 + :return: Coordinates of the vertex or QgsPoint(0,0) on error (``atVertex`` < 0 or > 3). + :rtype: QgsPoint %End QVector lengths() const; @@ -112,7 +112,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: Lengths of triangle ABC where [AB] is at 0, [BC] is at 1, [CA] is at 2 * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.lengths() # [5.0, 5.0, 7.0710678118654755] \endcode @@ -125,7 +125,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: Angles in radians of triangle ABC where angle BAC is at 0, angle ABC is at 1, angle BCA is at 2 * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) [math.degrees(i) for i in tri.angles()] # [45.0, 90.0, 45.0] \endcode @@ -139,7 +139,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: True or False * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.lengths() # [5.0, 5.0, 7.0710678118654755] tri.isIsocele() @@ -156,7 +156,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: True or False * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 10, 10 ), QgsPointV2( 16, 10 ), QgsPointV2( 13, 15.1962 ) ) + tri = QgsTriangle( QgsPoint( 10, 10 ), QgsPoint( 16, 10 ), QgsPoint( 13, 15.1962 ) ) tri.lengths() # [6.0, 6.0000412031918575, 6.0000412031918575] tri.isEquilateral() @@ -173,7 +173,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: True or False * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) [math.degrees(i) for i in tri.angles()] # [45.0, 90.0, 45.0] tri.isRight() @@ -191,7 +191,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: True or False * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 7.2825, 4.2368 ), QgsPointV2( 13.0058, 3.3218 ), QgsPointV2( 9.2145, 6.5242 ) ) + tri = QgsTriangle( QgsPoint( 7.2825, 4.2368 ), QgsPoint( 13.0058, 3.3218 ), QgsPoint( 9.2145, 6.5242 ) ) tri.lengths() # [5.795980321740233, 4.962793714229921, 2.994131386562721] tri.isScalene() @@ -207,7 +207,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: Three altitudes from this triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) [alt.asWkt() for alt in tri.altitudes()] # ['LineString (0 0, 0 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 5)'] \endcode @@ -220,7 +220,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: Three medians from this triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) [med.asWkt() for med in tri.medians()] # ['LineString (0 0, 2.5 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 2.5)'] \endcode @@ -234,7 +234,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: Three angle bisector from this triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) [bis.asWkt() for bis in tri.bisectors()] # ['LineString (0 0, 2.07106781186547462 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 2.92893218813452538)'] \endcode @@ -247,38 +247,38 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: The medial from this triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.medial().asWkt() # 'Triangle ((0 2.5, 2.5 5, 2.5 2.5, 0 2.5))' \endcode :rtype: QgsTriangle %End - QgsPointV2 orthocenter( double lengthTolerance = 0.0001 ) const; + QgsPoint orthocenter( double lengthTolerance = 0.0001 ) const; %Docstring An orthocenter is the point of intersection of the altitudes of a triangle. \param lengthTolerance The tolerance to use :return: The orthocenter of the triangle. * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.orthocenter().asWkt() # 'Point (0 5)' \endcode - :rtype: QgsPointV2 + :rtype: QgsPoint %End - QgsPointV2 circumscribedCenter( ) const; + QgsPoint circumscribedCenter( ) const; %Docstring Center of the circumscribed circle of the triangle. :return: The center of the circumscribed circle of the triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.circumscribedCenter().asWkt() # 'Point (2.5 2.5)' \endcode - :rtype: QgsPointV2 + :rtype: QgsPoint %End double circumscribedRadius( ) const; @@ -287,7 +287,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: The radius of the circumscribed circle of the triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.circumscribedRadius() # 3.5355339059327378 \endcode @@ -300,24 +300,24 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return @return The circumbscribed of the triangle with a QgsCircle. Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.circumscribedCircle() # QgsCircle(Point (2.5 2.5), 3.5355339059327378, 0) \endcode :rtype: QgsCircle %End - QgsPointV2 inscribedCenter( ) const; + QgsPoint inscribedCenter( ) const; %Docstring Center of the inscribed circle of the triangle. :return: The center of the inscribed circle of the triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.inscribedCenter().asWkt() # 'Point (1.46446609406726225 3.53553390593273775)' \endcode - :rtype: QgsPointV2 + :rtype: QgsPoint %End double inscribedRadius( ) const; @@ -326,7 +326,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return :return: The radius of the inscribed circle of the triangle * Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.inscribedRadius() # 1.4644660940672622 \endcode @@ -339,7 +339,7 @@ Inherited method not used. You cannot delete or insert a vertex directly. Return @return The inscribed of the triangle with a QgsCircle. Example: \code{.py} - tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) tri.inscribedCircle() # QgsCircle(Point (1.46446609406726225 3.53553390593273775), 1.4644660940672622, 0) \endcode diff --git a/python/core/processing/qgsprocessingalgorithm.sip b/python/core/processing/qgsprocessingalgorithm.sip index 5e7896d1ca6..b0a8450f718 100644 --- a/python/core/processing/qgsprocessingalgorithm.sip +++ b/python/core/processing/qgsprocessingalgorithm.sip @@ -239,10 +239,10 @@ class QgsProcessingAlgorithm :rtype: QgsRectangle %End - QgsPoint parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const; + QgsPointXY parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const; %Docstring Evaluates the parameter with matching ``name`` to a point. - :rtype: QgsPoint + :rtype: QgsPointXY %End QString parameterAsFile( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const; diff --git a/python/core/processing/qgsprocessingparameters.sip b/python/core/processing/qgsprocessingparameters.sip index 6ca6f51c4ae..1454fa9ff39 100644 --- a/python/core/processing/qgsprocessingparameters.sip +++ b/python/core/processing/qgsprocessingparameters.sip @@ -249,10 +249,10 @@ class QgsProcessingParameters :rtype: QgsRectangle %End - static QgsPoint parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ); + static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ); %Docstring Evaluates the parameter with matching ``name`` to a point. - :rtype: QgsPoint + :rtype: QgsPointXY %End static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ); diff --git a/python/core/qgsbearingutils.sip b/python/core/qgsbearingutils.sip index 540c5396099..58987a8b8ee 100644 --- a/python/core/qgsbearingutils.sip +++ b/python/core/qgsbearingutils.sip @@ -23,7 +23,7 @@ class QgsBearingUtils public: static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, - const QgsPoint &point ); + const QgsPointXY &point ); %Docstring Returns the direction to true north from a specified point and for a specified coordinate reference system. The returned value is in degrees clockwise from diff --git a/python/core/qgscoordinatetransform.sip b/python/core/qgscoordinatetransform.sip index aff2aeae904..93c4849e752 100644 --- a/python/core/qgscoordinatetransform.sip +++ b/python/core/qgscoordinatetransform.sip @@ -106,7 +106,7 @@ Default constructor, creates an invalid QgsCoordinateTransform. :rtype: QgsCoordinateReferenceSystem %End - QgsPoint transform( const QgsPoint &point, TransformDirection direction = ForwardTransform ) const; + QgsPointXY transform( const QgsPointXY &point, TransformDirection direction = ForwardTransform ) const; %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, @@ -114,10 +114,10 @@ Default constructor, creates an invalid QgsCoordinateTransform. \param point point to transform \param direction transform direction (defaults to ForwardTransform) :return: transformed point - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const; + QgsPointXY transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const; %Docstring Transform the point specified by x,y from the source CRS to the destination CRS. If the direction is ForwardTransform then coordinates are transformed from source to destination, @@ -126,7 +126,7 @@ Default constructor, creates an invalid QgsCoordinateTransform. \param y y coordinate of point to transform \param direction transform direction (defaults to ForwardTransform) :return: transformed point - :rtype: QgsPoint + :rtype: QgsPointXY %End QgsRectangle transformBoundingBox( const QgsRectangle &rectangle, TransformDirection direction = ForwardTransform, const bool handle180Crossover = false ) const; diff --git a/python/core/qgsdistancearea.sip b/python/core/qgsdistancearea.sip index 8e1ca91075e..e61f9d0a133 100644 --- a/python/core/qgsdistancearea.sip +++ b/python/core/qgsdistancearea.sip @@ -160,7 +160,7 @@ Constructor :rtype: float %End - double measureLine( const QList &points ) const; + double measureLine( const QList &points ) const; %Docstring Measures the length of a line with multiple segments. \param points list of points in line @@ -169,7 +169,7 @@ Constructor :rtype: float %End - double measureLine( const QgsPoint &p1, const QgsPoint &p2 ) const; + double measureLine( const QgsPointXY &p1, const QgsPointXY &p2 ) const; %Docstring Measures the distance between two points. \param p1 start of line @@ -179,7 +179,7 @@ Constructor :rtype: float %End - double measureLineProjected( const QgsPoint &p1, double distance = 1, double azimuth = M_PI / 2, QgsPoint *projectedPoint /Out/ = 0 ) const; + double measureLineProjected( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI / 2, QgsPointXY *projectedPoint /Out/ = 0 ) const; %Docstring Calculates the distance from one point with distance in meters and azimuth (direction) When the sourceCrs() is geographic, computeSpheroidProject() will be called @@ -213,13 +213,13 @@ Constructor :rtype: QgsUnitTypes.AreaUnit %End - double measurePolygon( const QList &points ) const; + double measurePolygon( const QList &points ) const; %Docstring Measures the area of the polygon described by a set of points. :rtype: float %End - double bearing( const QgsPoint &p1, const QgsPoint &p2 ) const; + double bearing( const QgsPointXY &p1, const QgsPointXY &p2 ) const; %Docstring Computes the bearing (in radians) between two points. :rtype: float @@ -279,7 +279,7 @@ Constructor :rtype: float %End - QgsPoint computeSpheroidProject( const QgsPoint &p1, double distance = 1, double azimuth = M_PI / 2 ) const; + QgsPointXY computeSpheroidProject( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI / 2 ) const; %Docstring Given a location, an azimuth and a distance, computes the location of the projected point. Based on Vincenty's formula @@ -295,7 +295,7 @@ Constructor \param distance - distance in meters. \param azimuth - azimuth in radians, clockwise from North :return: p2 - location of projected point as longitude/latitude. - :rtype: QgsPoint + :rtype: QgsPointXY %End }; diff --git a/python/core/qgsmapsettings.sip b/python/core/qgsmapsettings.sip index 72f5e73975b..6d9ed64335a 100644 --- a/python/core/qgsmapsettings.sip +++ b/python/core/qgsmapsettings.sip @@ -297,11 +297,11 @@ Return the calculated scale of the map :rtype: QgsRectangle %End - QgsPoint layerToMapCoordinates( const QgsMapLayer *layer, QgsPoint point ) const; + QgsPointXY layerToMapCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const; %Docstring transform point coordinates from layer's CRS to output CRS :return: the transformed point - :rtype: QgsPoint + :rtype: QgsPointXY %End QgsRectangle layerToMapCoordinates( const QgsMapLayer *layer, QgsRectangle rect ) const; @@ -312,11 +312,11 @@ Return the calculated scale of the map :rtype: QgsRectangle %End - QgsPoint mapToLayerCoordinates( const QgsMapLayer *layer, QgsPoint point ) const; + QgsPointXY mapToLayerCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const; %Docstring transform point coordinates from output CRS to layer's CRS :return: the transformed point - :rtype: QgsPoint + :rtype: QgsPointXY %End QgsRectangle mapToLayerCoordinates( const QgsMapLayer *layer, QgsRectangle rect ) const; diff --git a/python/core/qgsmaptopixel.sip b/python/core/qgsmaptopixel.sip index ac625572f69..7d9d65d0dbf 100644 --- a/python/core/qgsmaptopixel.sip +++ b/python/core/qgsmaptopixel.sip @@ -58,24 +58,24 @@ class QgsMapToPixel Use setParameters to fill %End - QgsPoint transform( const QgsPoint &p ) const; + QgsPointXY transform( const QgsPointXY &p ) const; %Docstring Transform the point from map (world) coordinates to device coordinates \param p Point to transform - :return: QgsPoint in device coordinates - :rtype: QgsPoint + :return: QgsPointXY in device coordinates + :rtype: QgsPointXY %End - void transform( QgsPoint *p ) const; + void transform( QgsPointXY *p ) const; - QgsPoint transform( qreal x, qreal y ) const; + QgsPointXY transform( qreal x, qreal y ) const; %Docstring Transform the point specified by x,y from map (world) coordinates to device coordinates \param x x cordinate o point to transform \param y y coordinate of point to transform - :return: QgsPoint in device coordinates - :rtype: QgsPoint + :return: QgsPointXY in device coordinates + :rtype: QgsPointXY %End void transformInPlace( double &x, double &y ) const; @@ -87,28 +87,28 @@ class QgsMapToPixel - QgsPoint toMapCoordinates( int x, int y ) const; + QgsPointXY toMapCoordinates( int x, int y ) const; %Docstring - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint toMapCoordinatesF( double x, double y ) const; + QgsPointXY toMapCoordinatesF( double x, double y ) const; %Docstring Transform device coordinates to map (world) coordinates - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint toMapCoordinates( QPoint p ) const; + QgsPointXY toMapCoordinates( QPoint p ) const; %Docstring Transform device coordinates to map (world) coordinates \param p Point to be converted to map cooordinates - :return: QgsPoint in map coorndiates - :rtype: QgsPoint + :return: QgsPointXY in map coorndiates + :rtype: QgsPointXY %End - QgsPoint toMapPoint( double x, double y ) const; + QgsPointXY toMapPoint( double x, double y ) const; %Docstring - :rtype: QgsPoint + :rtype: QgsPointXY %End void setMapUnitsPerPixel( double mapUnitsPerPixel ); diff --git a/python/core/qgspallabeling.sip b/python/core/qgspallabeling.sip index e1dbd91347c..90393f6d108 100644 --- a/python/core/qgspallabeling.sip +++ b/python/core/qgspallabeling.sip @@ -19,11 +19,11 @@ class QgsLabelPosition #include "qgspallabeling.h" %End public: - QgsLabelPosition( int id, double r, const QVector< QgsPoint > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString() ); + QgsLabelPosition( int id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString() ); QgsLabelPosition(); int featureId; double rotation; - QVector< QgsPoint > cornerPoints; + QVector< QgsPointXY > cornerPoints; QgsRectangle labelRect; double width; double height; @@ -467,8 +467,8 @@ Z-Index of label, where labels with a higher z-index are rendered on top of labe const QgsMapToPixel *xform; QgsCoordinateTransform ct; - QgsPoint ptZero; - QgsPoint ptOne; + QgsPointXY ptZero; + QgsPointXY ptOne; QgsGeometry extentGeom; int mFeaturesToLabel; // total features that will probably be labeled, may be less (figured before PAL) int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels) @@ -507,7 +507,7 @@ class QgsLabelingResults ~QgsLabelingResults(); - QList labelsAtPosition( const QgsPoint &p ) const; + QList labelsAtPosition( const QgsPointXY &p ) const; %Docstring return infos about labels at a given (map) position :rtype: list of QgsLabelPosition diff --git a/python/core/qgspoint.sip b/python/core/qgspoint.sip index 096337a0a6c..5cce895a9d2 100644 --- a/python/core/qgspoint.sip +++ b/python/core/qgspoint.sip @@ -12,7 +12,7 @@ -class QgsPoint +class QgsPointXY { %Docstring A class to represent a point. @@ -23,35 +23,35 @@ class QgsPoint #include "qgspoint.h" %End public: - QgsPoint(); + QgsPointXY(); - QgsPoint( const QgsPoint &p ); + QgsPointXY( const QgsPointXY &p ); %Docstring Create a point from another point %End - QgsPoint( double x, double y ); + QgsPointXY( double x, double y ); %Docstring Create a point from x,y coordinates \param x x coordinate \param y y coordinate %End - QgsPoint( QPointF point ); + QgsPointXY( QPointF point ); %Docstring Create a point from a QPointF \param point QPointF source .. versionadded:: 2.7 %End - QgsPoint( QPoint point ); + QgsPointXY( QPoint point ); %Docstring Create a point from a QPoint \param point QPoint source .. versionadded:: 2.7 %End - QgsPoint( const QgsPointV2 &point ); + QgsPointXY( const QgsPoint &point ); %Docstring Create a new point. Z and M values will be dropped. @@ -59,7 +59,7 @@ Create a point from another point .. versionadded:: 3.0 %End - ~QgsPoint(); + ~QgsPointXY(); void setX( double x ); %Docstring @@ -154,7 +154,7 @@ As above but with precision for string representation of a point :rtype: float %End - double sqrDist( const QgsPoint &other ) const; + double sqrDist( const QgsPointXY &other ) const; %Docstring Returns the squared distance between this point another point. .. seealso:: distance() @@ -171,7 +171,7 @@ As above but with precision for string representation of a point :rtype: float %End - double distance( const QgsPoint &other ) const; + double distance( const QgsPointXY &other ) const; %Docstring Returns the distance between this point and another point. \param other other point @@ -180,29 +180,29 @@ As above but with precision for string representation of a point :rtype: float %End - double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint &minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; + double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPointXY &minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; %Docstring Returns the minimum distance between this point and a segment :rtype: float %End - double azimuth( const QgsPoint &other ) const; + double azimuth( const QgsPointXY &other ) const; %Docstring Calculates azimuth between this point and other one (clockwise in degree, starting from north) :rtype: float %End - QgsPoint project( double distance, double bearing ) const; + QgsPointXY project( double distance, double bearing ) const; %Docstring Returns a new point which corresponds to this point projected by a specified distance in a specified bearing. \param distance distance to project \param bearing angle to project in, clockwise in degrees starting from north .. versionadded:: 2.16 - :rtype: QgsPoint + :rtype: QgsPointXY %End - bool compare( const QgsPoint &other, double epsilon = 4 * DBL_EPSILON ) const; + bool compare( const QgsPointXY &other, double epsilon = 4 * DBL_EPSILON ) const; %Docstring Compares this point with another point with a fuzzy tolerance \param other point to compare with @@ -212,9 +212,9 @@ Calculates azimuth between this point and other one (clockwise in degree, starti :rtype: bool %End - bool operator==( const QgsPoint &other ); + bool operator==( const QgsPointXY &other ); - bool operator!=( const QgsPoint &other ) const; + bool operator!=( const QgsPointXY &other ) const; %Docstring Inequality operator :rtype: bool @@ -226,58 +226,58 @@ Multiply x and y by the given value %End - QgsVector operator-( const QgsPoint &p ) const; + QgsVector operator-( const QgsPointXY &p ) const; %Docstring Calculates the vector obtained by subtracting a point from this point :rtype: QgsVector %End - QgsPoint &operator+=( QgsVector v ); + QgsPointXY &operator+=( QgsVector v ); %Docstring Adds a vector to this point in place - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint &operator-=( QgsVector v ); + QgsPointXY &operator-=( QgsVector v ); %Docstring Subtracts a vector from this point in place - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint operator+( QgsVector v ) const; + QgsPointXY operator+( QgsVector v ) const; %Docstring Adds a vector to this point - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint operator-( QgsVector v ) const; + QgsPointXY operator-( QgsVector v ) const; %Docstring Subtracts a vector from this point - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint operator*( double scalar ) const; + QgsPointXY operator*( double scalar ) const; %Docstring Multiplies the coordinates in this point by a scalar quantity - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint operator/( double scalar ) const; + QgsPointXY operator/( double scalar ) const; %Docstring Divides the coordinates in this point by a scalar quantity - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint &operator*=( double scalar ); + QgsPointXY &operator*=( double scalar ); %Docstring Multiplies the coordinates in this point by a scalar quantity in place - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint &operator/=( double scalar ); + QgsPointXY &operator/=( double scalar ); %Docstring Divides the coordinates in this point by a scalar quantity in place - :rtype: QgsPoint + :rtype: QgsPointXY %End SIP_PYOBJECT __repr__(); diff --git a/python/core/qgspointlocator.sip b/python/core/qgspointlocator.sip index 2f2cccd26eb..eedceb5c22a 100644 --- a/python/core/qgspointlocator.sip +++ b/python/core/qgspointlocator.sip @@ -94,7 +94,7 @@ Indicate whether the data have been already indexed construct invalid match %End - Match( QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPoint &pt, int vertexIndex = 0, QgsPoint *edgePoints = 0 ); + Match( QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPointXY &pt, int vertexIndex = 0, QgsPointXY *edgePoints = 0 ); QgsPointLocator::Type type() const; %Docstring @@ -124,10 +124,10 @@ units depending on what class returns it (geom.cache: layer units, map canvas sn :rtype: float %End - QgsPoint point() const; + QgsPointXY point() const; %Docstring coords depending on what class returns it (geom.cache: layer coords, map canvas snapper: dest coords) - :rtype: QgsPoint + :rtype: QgsPointXY %End int vertexIndex() const; @@ -149,7 +149,7 @@ for vertex / edge match (first vertex of the edge) :rtype: QgsFeatureId %End - void edgePoints( QgsPoint &pt1 /Out/, QgsPoint &pt2 /Out/ ) const; + void edgePoints( QgsPointXY &pt1 /Out/, QgsPointXY &pt2 /Out/ ) const; %Docstring Only for a valid edge match - obtain endpoints of the edge %End @@ -171,12 +171,12 @@ Only for a valid edge match - obtain endpoints of the edge }; - Match nearestVertex( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 ); + Match nearestVertex( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 ); %Docstring Optional filter may discard unwanted matches. :rtype: Match %End - Match nearestEdge( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 ); + Match nearestEdge( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 ); %Docstring Optional filter may discard unwanted matches. :rtype: Match @@ -186,14 +186,14 @@ Optional filter may discard unwanted matches. Optional filter may discard unwanted matches. :rtype: MatchList %End - MatchList edgesInRect( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 ); + MatchList edgesInRect( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 ); %Docstring Override of edgesInRect that construct rectangle from a center point and tolerance :rtype: MatchList %End - MatchList pointInPolygon( const QgsPoint &point ); + MatchList pointInPolygon( const QgsPointXY &point ); %Docstring find out if the point is in any polygons :rtype: MatchList diff --git a/python/core/qgspropertytransformer.sip b/python/core/qgspropertytransformer.sip index 64e827a701f..d30fccdb691 100644 --- a/python/core/qgspropertytransformer.sip +++ b/python/core/qgspropertytransformer.sip @@ -42,7 +42,7 @@ class QgsCurveTransform between 0 and 1 unchanged. I.e. y == x. %End - QgsCurveTransform( const QList< QgsPoint > &controlPoints ); + QgsCurveTransform( const QList< QgsPointXY > &controlPoints ); %Docstring Constructs a QgsCurveTransform using a specified list of ``controlPoints``. Behavior is undefined if duplicate x values exist in the control points @@ -57,14 +57,14 @@ class QgsCurveTransform %End - QList< QgsPoint > controlPoints() const; + QList< QgsPointXY > controlPoints() const; %Docstring Returns a list of the control points for the transform. .. seealso:: setControlPoints() - :rtype: list of QgsPoint + :rtype: list of QgsPointXY %End - void setControlPoints( const QList< QgsPoint > &points ); + void setControlPoints( const QList< QgsPointXY > &points ); %Docstring Sets the list of control points for the transform. Any existing points are removed. diff --git a/python/core/qgssnappingutils.sip b/python/core/qgssnappingutils.sip index 8389ae272b5..f22fc4d3e8c 100644 --- a/python/core/qgssnappingutils.sip +++ b/python/core/qgssnappingutils.sip @@ -49,7 +49,7 @@ Get a point locator for the given layer. If such locator does not exist, it will Snap to map according to the current configuration (mode). Optional filter allows discarding unwanted matches. :rtype: QgsPointLocator.Match %End - QgsPointLocator::Match snapToMap( const QgsPoint &pointMap, QgsPointLocator::MatchFilter *filter = 0 ); + QgsPointLocator::Match snapToMap( const QgsPointXY &pointMap, QgsPointLocator::MatchFilter *filter = 0 ); %Docstring :rtype: QgsPointLocator.Match %End diff --git a/python/core/qgsspatialindex.sip b/python/core/qgsspatialindex.sip index ea1fad3ef9e..5ad31d747ff 100644 --- a/python/core/qgsspatialindex.sip +++ b/python/core/qgsspatialindex.sip @@ -76,7 +76,7 @@ Returns features that intersect the specified rectangle :rtype: list of QgsFeatureId %End - QList nearestNeighbor( const QgsPoint &point, int neighbors ) const; + QList nearestNeighbor( const QgsPointXY &point, int neighbors ) const; %Docstring Returns nearest neighbors (their count is specified by second parameter) :rtype: list of QgsFeatureId diff --git a/python/core/qgstracer.sip b/python/core/qgstracer.sip index 51885952c77..26f1129cd07 100644 --- a/python/core/qgstracer.sip +++ b/python/core/qgstracer.sip @@ -95,13 +95,13 @@ Whether the internal data structures have been initialized ErrNoPath, }; - QVector findShortestPath( const QgsPoint &p1, const QgsPoint &p2, PathError *error /Out/ = 0 ); + QVector findShortestPath( const QgsPointXY &p1, const QgsPointXY &p2, PathError *error /Out/ = 0 ); %Docstring :return: array of points - trace of linestrings of other features (empty array one error) - :rtype: list of QgsPoint + :rtype: list of QgsPointXY %End - bool isPointSnapped( const QgsPoint &pt ); + bool isPointSnapped( const QgsPointXY &pt ); %Docstring Find out whether the point is snapped to a vertex or edge (i.e. it can be used for tracing start/stop) :rtype: bool diff --git a/python/core/qgsvectorlayer.sip b/python/core/qgsvectorlayer.sip index 803a57c9c7b..88b5116ca32 100644 --- a/python/core/qgsvectorlayer.sip +++ b/python/core/qgsvectorlayer.sip @@ -949,7 +949,7 @@ changeGeometry() instead. :rtype: bool %End - bool insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex ); + bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex ); %Docstring Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature @@ -965,7 +965,7 @@ changeGeometry() instead. :rtype: bool %End - bool moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) /PyName=moveVertexV2/; + bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) /PyName=moveVertexV2/; %Docstring Moves the vertex at the given position number, ring and item (first number is index 0), and feature @@ -992,7 +992,7 @@ changeGeometry() instead. :rtype: bool %End - int addRing( const QList &ring, QgsFeatureId *featureId = 0 ); + int addRing( const QList &ring, QgsFeatureId *featureId = 0 ); %Docstring :rtype: int %End @@ -1002,7 +1002,7 @@ changeGeometry() instead. :rtype: int %End - int addPart( const QList &ring ); + int addPart( const QList &ring ); %Docstring :rtype: int %End @@ -1030,12 +1030,12 @@ changeGeometry() instead. :rtype: int %End - int splitParts( const QList &splitLine, bool topologicalEditing = false ); + int splitParts( const QList &splitLine, bool topologicalEditing = false ); %Docstring :rtype: int %End - int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); %Docstring :rtype: int %End @@ -1051,7 +1051,7 @@ changeGeometry() instead. :rtype: int %End - int addTopologicalPoints( const QgsPoint &p ); + int addTopologicalPoints( const QgsPointXY &p ); %Docstring Adds a vertex to segments which intersect point p but don't already have a vertex there. If a feature already has a vertex at position p, diff --git a/python/core/qgsvectorlayereditutils.sip b/python/core/qgsvectorlayereditutils.sip index d2e0da48c20..52bd16521cb 100644 --- a/python/core/qgsvectorlayereditutils.sip +++ b/python/core/qgsvectorlayereditutils.sip @@ -27,7 +27,7 @@ class QgsVectorLayerEditUtils :rtype: bool %End - bool insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex ); + bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex ); %Docstring Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0), and feature @@ -43,7 +43,7 @@ class QgsVectorLayerEditUtils :rtype: bool %End - bool moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) /PyName=moveVertexV2/; + bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) /PyName=moveVertexV2/; %Docstring Moves the vertex at the given position number, ring and item (first number is index 0), and feature @@ -63,7 +63,7 @@ class QgsVectorLayerEditUtils :rtype: QgsVectorLayer.EditResult %End - int addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 ); + int addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 ); %Docstring :rtype: int %End @@ -73,7 +73,7 @@ class QgsVectorLayerEditUtils :rtype: int %End - int addPart( const QList &ring, QgsFeatureId featureId ); + int addPart( const QList &ring, QgsFeatureId featureId ); %Docstring :rtype: int %End @@ -98,12 +98,12 @@ class QgsVectorLayerEditUtils :rtype: int %End - int splitParts( const QList &splitLine, bool topologicalEditing = false ); + int splitParts( const QList &splitLine, bool topologicalEditing = false ); %Docstring :rtype: int %End - int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); %Docstring :rtype: int %End @@ -119,7 +119,7 @@ class QgsVectorLayerEditUtils :rtype: int %End - int addTopologicalPoints( const QgsPoint &p ); + int addTopologicalPoints( const QgsPointXY &p ); %Docstring Adds a vertex to segments which intersect point p but don't already have a vertex there. If a feature already has a vertex at position p, @@ -132,7 +132,7 @@ class QgsVectorLayerEditUtils protected: - int boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const; + int boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const; %Docstring Little helper function that gives bounding box from a list of points. :return: 0 in case of success * diff --git a/python/core/raster/qgsrasterdataprovider.sip b/python/core/raster/qgsrasterdataprovider.sip index 237c6f1cd3c..8629765160a 100644 --- a/python/core/raster/qgsrasterdataprovider.sip +++ b/python/core/raster/qgsrasterdataprovider.sip @@ -234,7 +234,7 @@ Get list of user no data value ranges :rtype: str %End - virtual QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ); + virtual QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ); %Docstring :rtype: QgsRasterIdentifyResult %End diff --git a/python/core/raster/qgsrasterviewport.sip b/python/core/raster/qgsrasterviewport.sip index e4fb8d1771e..49e3bca0683 100644 --- a/python/core/raster/qgsrasterviewport.sip +++ b/python/core/raster/qgsrasterviewport.sip @@ -6,10 +6,10 @@ struct QgsRasterViewPort %End /** \brief Coordinate (in output device coordinate system) of top left corner * of the part of the raster that is to be rendered.*/ - QgsPoint mTopLeftPoint; + QgsPointXY mTopLeftPoint; /** \brief Coordinate (in output device coordinate system) of bottom right corner * of the part of the raster that is to be rendered.*/ - QgsPoint mBottomRightPoint; + QgsPointXY mBottomRightPoint; /** \brief Width, number of columns to be rendered */ int mWidth; diff --git a/python/core/symbology-ng/qgsrenderer.sip b/python/core/symbology-ng/qgsrenderer.sip index 7e5cd0012da..07bbb910165 100644 --- a/python/core/symbology-ng/qgsrenderer.sip +++ b/python/core/symbology-ng/qgsrenderer.sip @@ -357,7 +357,7 @@ class QgsFeatureRenderer * Creates a point in screen coordinates from a wkb string in map * coordinates */ - static QPointF _getPoint( QgsRenderContext &context, const QgsPointV2 &point ); + static QPointF _getPoint( QgsRenderContext &context, const QgsPoint &point ); /** * Clones generic renderer data to another renderer. diff --git a/python/core/symbology-ng/qgssymbol.sip b/python/core/symbology-ng/qgssymbol.sip index 86717d1633a..7ab5c74fa7b 100644 --- a/python/core/symbology-ng/qgssymbol.sip +++ b/python/core/symbology-ng/qgssymbol.sip @@ -241,9 +241,9 @@ class QgsSymbol QgsSymbol( SymbolType type, const QgsSymbolLayerList &layers /Transfer/ ); /** - * Creates a point in screen coordinates from a QgsPointV2 in map coordinates + * Creates a point in screen coordinates from a QgsPoint in map coordinates */ - static QPointF _getPoint( QgsRenderContext &context, const QgsPointV2 &point ); + static QPointF _getPoint( QgsRenderContext &context, const QgsPoint &point ); /** * Creates a line string in screen coordinates from a QgsCurve in map diff --git a/python/gui/qgsadvanceddigitizingdockwidget.sip b/python/gui/qgsadvanceddigitizingdockwidget.sip index ca1e65b9db3..daac0e69b90 100644 --- a/python/gui/qgsadvanceddigitizingdockwidget.sip +++ b/python/gui/qgsadvanceddigitizingdockwidget.sip @@ -158,7 +158,7 @@ class QgsAdvancedDigitizingDockWidget : QgsDockWidget }; - static bool lineCircleIntersection( const QgsPoint ¢er, const double radius, const QList &segment, QgsPoint &intersection ); + static bool lineCircleIntersection( const QgsPointXY ¢er, const double radius, const QList &segment, QgsPointXY &intersection ); %Docstring .. note:: @@ -280,28 +280,28 @@ Constraint on a common angle :rtype: bool %End - QgsPoint currentPoint( bool *exists = 0 ) const; + QgsPointXY currentPoint( bool *exists = 0 ) const; %Docstring The last point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both "normal" points and intermediate points (construction mode). - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint previousPoint( bool *exists = 0 ) const; + QgsPointXY previousPoint( bool *exists = 0 ) const; %Docstring The previous point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both "normal" points and intermediate points (construction mode). - :rtype: QgsPoint + :rtype: QgsPointXY %End - QgsPoint penultimatePoint( bool *exists = 0 ) const; + QgsPointXY penultimatePoint( bool *exists = 0 ) const; %Docstring The penultimate point. Helper for the CAD point list. The CAD point list is the list of points currently digitized. It contains both "normal" points and intermediate points (construction mode). - :rtype: QgsPoint + :rtype: QgsPointXY %End int pointsCount() const; @@ -316,10 +316,10 @@ Constraint on a common angle :rtype: bool %End - QList snappedSegment() const; + QList snappedSegment() const; %Docstring Snapped to a segment - :rtype: list of QgsPoint + :rtype: list of QgsPointXY %End QAction *enableAction(); @@ -355,7 +355,7 @@ return the action used to enable/disable the tools Remove any previously emitted warnings (if any) %End - void pointChanged( const QgsPoint &point ); + void pointChanged( const QgsPointXY &point ); %Docstring Sometimes a constraint may change the current point out of a mouse event. This happens normally when a constraint is toggled. diff --git a/python/gui/qgsgeometryrubberband.sip b/python/gui/qgsgeometryrubberband.sip index 1a0300dc14b..50c51dcdf5b 100644 --- a/python/gui/qgsgeometryrubberband.sip +++ b/python/gui/qgsgeometryrubberband.sip @@ -49,7 +49,7 @@ Sets geometry (takes ownership). Geometry is expected to be in map coordinates Returns a pointer to the geometry :rtype: QgsAbstractGeometry %End - void moveVertex( QgsVertexId id, const QgsPointV2 &newPos ); + void moveVertex( QgsVertexId id, const QgsPoint &newPos ); %Docstring Moves vertex to new position (in map coordinates) %End diff --git a/python/gui/qgsmapcanvas.sip b/python/gui/qgsmapcanvas.sip index bff415abc0e..268c29f7efb 100644 --- a/python/gui/qgsmapcanvas.sip +++ b/python/gui/qgsmapcanvas.sip @@ -180,15 +180,15 @@ Set the extent of the map canvas .. versionadded:: 2.8 %End - void setCenter( const QgsPoint ¢er ); + void setCenter( const QgsPointXY ¢er ); %Docstring .. versionadded:: 2.8 %End - QgsPoint center() const; + QgsPointXY center() const; %Docstring .. versionadded:: 2.8 - :rtype: QgsPoint + :rtype: QgsPointXY %End void zoomToFullExtent(); @@ -408,7 +408,7 @@ set wheel zoom factor (should be greater than 1) Zoom to a specific scale %End - void zoomByFactor( double scaleFactor, const QgsPoint *center = 0 ); + void zoomByFactor( double scaleFactor, const QgsPointXY *center = 0 ); %Docstring If point is given, re-center on it %End @@ -669,7 +669,7 @@ Zoom out with fixed factor signals: - void xyCoordinates( const QgsPoint &p ); + void xyCoordinates( const QgsPointXY &p ); %Docstring Emits current mouse position .. note:: diff --git a/python/gui/qgsmapcanvasitem.sip b/python/gui/qgsmapcanvasitem.sip index d5db6768dc4..8a73028df57 100644 --- a/python/gui/qgsmapcanvasitem.sip +++ b/python/gui/qgsmapcanvasitem.sip @@ -71,13 +71,13 @@ returns canvas item rectangle in map units sets canvas item rectangle in map units %End - QgsPoint toMapCoordinates( QPoint point ) const; + QgsPointXY toMapCoordinates( QPoint point ) const; %Docstring transformation from screen coordinates to map coordinates - :rtype: QgsPoint + :rtype: QgsPointXY %End - QPointF toCanvasCoordinates( const QgsPoint &point ) const; + QPointF toCanvasCoordinates( const QgsPointXY &point ) const; %Docstring transformation from map coordinates to screen coordinates :rtype: QPointF diff --git a/python/gui/qgsmapmouseevent.sip b/python/gui/qgsmapmouseevent.sip index ca6e0ee0fd0..45c9cf334c0 100644 --- a/python/gui/qgsmapmouseevent.sip +++ b/python/gui/qgsmapmouseevent.sip @@ -59,16 +59,16 @@ class QgsMapMouseEvent : QMouseEvent \param modifiers Keyboard modifiers %End - QgsPoint snapPoint( SnappingMode snappingMode ); + QgsPointXY snapPoint( SnappingMode snappingMode ); %Docstring snapPoint will snap the points using the map canvas snapping utils configuration .. note:: if snapping did not succeeded, the map point will be reset to its original position - :rtype: QgsPoint + :rtype: QgsPointXY %End - QList snapSegment( SnappingMode snappingMode, bool *snapped = 0, bool allLayers = false ) const; + QList snapSegment( SnappingMode snappingMode, bool *snapped = 0, bool allLayers = false ) const; %Docstring Returns the first snapped segment. If the cached snapped match is a segment, it will simply return it. Otherwise it will try to snap a segment according to the event's snapping mode. In this case the cache @@ -76,7 +76,7 @@ class QgsMapMouseEvent : QMouseEvent \param snappingMode Specify if the default project settings or all layers should be used for snapping \param snapped if given, determines if a segment has been snapped \param allLayers if true, override snapping mode - :rtype: list of QgsPoint + :rtype: list of QgsPointXY %End bool isSnapped() const; @@ -88,11 +88,11 @@ class QgsMapMouseEvent : QMouseEvent :rtype: bool %End - QgsPoint mapPoint() const; + QgsPointXY mapPoint() const; %Docstring mapPoint returns the point in coordinates :return: the point in map coordinates, after snapping if requested in the event. - :rtype: QgsPoint + :rtype: QgsPointXY %End QgsPointLocator::Match mapPointMatch() const; @@ -103,7 +103,7 @@ class QgsMapMouseEvent : QMouseEvent :rtype: QgsPointLocator.Match %End - void setMapPoint( const QgsPoint &point ); + void setMapPoint( const QgsPointXY &point ); %Docstring Set the (snapped) point this event points to in map coordinates. The point in pixel coordinates will be calculated accordingly. @@ -111,12 +111,12 @@ class QgsMapMouseEvent : QMouseEvent \param point The point in map coordinates %End - QgsPoint originalMapPoint() const; + QgsPointXY originalMapPoint() const; %Docstring Returns the original, unmodified map point of the mouse cursor. :return: The cursor position in map coordinates. - :rtype: QgsPoint + :rtype: QgsPointXY %End QPoint pixelPoint() const; diff --git a/python/gui/qgsmaptip.sip b/python/gui/qgsmaptip.sip index bc1f02d05d2..a8dd2b15430 100644 --- a/python/gui/qgsmaptip.sip +++ b/python/gui/qgsmaptip.sip @@ -26,7 +26,7 @@ class QgsMapTip: QWidget * @param mpMapCanvas a map canvas on which the tip is drawn */ void showMapTip( QgsMapLayer * thepLayer, - QgsPoint & mapPosition, + QgsPointXY & mapPosition, QPoint & pixelPosition, QgsMapCanvas *mpMapCanvas ); /** Clear the current maptip if it exists diff --git a/python/gui/qgsmaptool.sip b/python/gui/qgsmaptool.sip index 6857a8c2e89..89d2f4bae14 100644 --- a/python/gui/qgsmaptool.sip +++ b/python/gui/qgsmaptool.sip @@ -141,26 +141,26 @@ class QgsMapTool : QObject QgsMapTool( QgsMapCanvas *canvas /TransferThis/ ); //! transformation from screen coordinates to map coordinates - QgsPoint toMapCoordinates( QPoint point ); + QgsPointXY toMapCoordinates( QPoint point ); //! transformation from screen coordinates to layer's coordinates - QgsPoint toLayerCoordinates( const QgsMapLayer *layer, QPoint point ); + QgsPointXY toLayerCoordinates( const QgsMapLayer *layer, QPoint point ); //! transformation from map coordinates to layer's coordinates - QgsPoint toLayerCoordinates( const QgsMapLayer *layer, const QgsPoint &point ); + QgsPointXY toLayerCoordinates( const QgsMapLayer *layer, const QgsPointXY &point ); //!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used) - QgsPoint toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ); + QgsPointXY toMapCoordinates( const QgsMapLayer *layer, const QgsPointXY &point ); //!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used) //! @note available in python bindings as toMapCoordinatesV2 - QgsPointV2 toMapCoordinates( const QgsMapLayer *layer, const QgsPointV2 &point ) /PyName=toMapCoordinatesV2/; + QgsPoint toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ) /PyName=toMapCoordinatesV2/; //! trnasformation of the rect from map coordinates to layer's coordinates QgsRectangle toLayerCoordinates( const QgsMapLayer *layer, const QgsRectangle &rect ); //! transformation from map coordinates to screen coordinates - QPoint toCanvasCoordinates( const QgsPoint &point ); + QPoint toCanvasCoordinates( const QgsPointXY &point ); }; diff --git a/python/gui/qgsmaptoolcapture.sip b/python/gui/qgsmaptoolcapture.sip index df51067b51d..ad9b6803d32 100644 --- a/python/gui/qgsmaptoolcapture.sip +++ b/python/gui/qgsmaptoolcapture.sip @@ -76,7 +76,7 @@ class QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * 1 if the current layer is null or not a vector layer * 2 if the transformation failed */ - int nextPoint( const QgsPointV2 &mapPoint, QgsPointV2 &layerPoint ); + int nextPoint( const QgsPoint &mapPoint, QgsPoint &layerPoint ); /** Converts a point to map coordinates and layer coordinates * @param p the input point @@ -87,26 +87,26 @@ class QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * 1 if the current layer is null or not a vector layer * 2 if the transformation failed */ - int nextPoint( QPoint p, QgsPointV2 &layerPoint, QgsPointV2 &mapPoint ); + int nextPoint( QPoint p, QgsPoint &layerPoint, QgsPoint &mapPoint ); /** Fetches the original point from the source layer if it has the same * CRS as the current layer. * @return 0 in case of success, 1 if not applicable (CRS mismatch), 2 in case of failure * @note added in 2.14 */ - int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPointV2 &layerPoint ); + int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint ); /** Adds a point to the rubber band (in map coordinates) and to the capture list (in layer coordinates) * @return 0 in case of success, 1 if current layer is not a vector layer, 2 if coordinate transformation failed */ - int addVertex( const QgsPoint &point ); + int addVertex( const QgsPointXY &point ); /** Variant to supply more information in the case of snapping * @param mapPoint The vertex to add in map coordinates * @param match Data about the snapping match. Can be an invalid match, if point not snapped. * @note added in 2.14 */ - int addVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match &match ); + int addVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match &match ); /** Removes the last vertex from mRubberBand and mCaptureList*/ void undo(); @@ -139,14 +139,14 @@ class QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * List of digitized points * @return List of points */ - QList points(); + QList points(); /** * Set the points on which to work * * @param pointList A list of points */ - void setPoints( const QList &pointList ); + void setPoints( const QList &pointList ); /** * Close an open polygon diff --git a/python/gui/qgsmaptooledit.sip b/python/gui/qgsmaptooledit.sip index cd308cb46a8..6f30b32d86e 100644 --- a/python/gui/qgsmaptooledit.sip +++ b/python/gui/qgsmaptooledit.sip @@ -51,7 +51,7 @@ class QgsMapToolEdit: QgsMapTool * @param geom list of points (in layer coordinate system) * @return 0 in case of success */ - int addTopologicalPoints( const QList &geom ); + int addTopologicalPoints( const QList &geom ); /** Display a timed message bar noting the active layer is not vector. */ void notifyNotVectorLayer(); diff --git a/python/gui/qgsmaptoolemitpoint.sip b/python/gui/qgsmaptoolemitpoint.sip index 9c053756a2c..c5be895f524 100644 --- a/python/gui/qgsmaptoolemitpoint.sip +++ b/python/gui/qgsmaptoolemitpoint.sip @@ -22,5 +22,5 @@ class QgsMapToolEmitPoint : QgsMapTool signals: //! signal emitted on canvas click - void canvasClicked( const QgsPoint &point, Qt::MouseButton button ); + void canvasClicked( const QgsPointXY &point, Qt::MouseButton button ); }; diff --git a/python/gui/qgsmaptoolidentify.sip b/python/gui/qgsmaptoolidentify.sip index 395c5e8a9c8..246abd17af9 100644 --- a/python/gui/qgsmaptoolidentify.sip +++ b/python/gui/qgsmaptoolidentify.sip @@ -105,10 +105,10 @@ class QgsMapToolIdentify : QgsMapTool QList identify( int x, int y, IdentifyMode mode, const QList &layerList, LayerType layerType = AllLayers ); /** Call the right method depending on layer type */ - bool identifyLayer( QList *results, QgsMapLayer *layer, const QgsPoint &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, LayerType layerType = AllLayers ); + bool identifyLayer( QList *results, QgsMapLayer *layer, const QgsPointXY &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, LayerType layerType = AllLayers ); - bool identifyRasterLayer( QList *results, QgsRasterLayer *layer, QgsPoint point, const QgsRectangle &viewExtent, double mapUnitsPerPixel ); - bool identifyVectorLayer( QList *results, QgsVectorLayer *layer, const QgsPoint &point ); + bool identifyRasterLayer( QList *results, QgsRasterLayer *layer, QgsPointXY point, const QgsRectangle &viewExtent, double mapUnitsPerPixel ); + bool identifyVectorLayer( QList *results, QgsVectorLayer *layer, const QgsPointXY &point ); private: diff --git a/python/gui/qgsrubberband.sip b/python/gui/qgsrubberband.sip index fa369678ef4..c23fb22b59f 100644 --- a/python/gui/qgsrubberband.sip +++ b/python/gui/qgsrubberband.sip @@ -53,7 +53,7 @@ class QgsRubberBand: QgsMapCanvasItem void reset( QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry ); - void addPoint( const QgsPoint &p, bool doUpdate = true, int geometryIndex = 0 ); + void addPoint( const QgsPointXY &p, bool doUpdate = true, int geometryIndex = 0 ); void closePoints( bool doUpdate = true, int geometryIndex = 0 ); @@ -61,9 +61,9 @@ class QgsRubberBand: QgsMapCanvasItem void removeLastPoint( int geometryIndex = 0, bool doUpdate = true ); - void movePoint( const QgsPoint &p, int geometryIndex = 0 ); + void movePoint( const QgsPointXY &p, int geometryIndex = 0 ); - void movePoint( int index, const QgsPoint &p, int geometryIndex = 0 ); + void movePoint( int index, const QgsPointXY &p, int geometryIndex = 0 ); int partSize( int geometryIndex ) const; @@ -79,7 +79,7 @@ class QgsRubberBand: QgsMapCanvasItem int numberOfVertices() const; - const QgsPoint *getPoint( int i, int j = 0 ) const; + const QgsPointXY *getPoint( int i, int j = 0 ) const; QgsGeometry asGeometry() const; diff --git a/python/gui/qgsvertexmarker.sip b/python/gui/qgsvertexmarker.sip index 229ff2735fc..e16da6981a6 100644 --- a/python/gui/qgsvertexmarker.sip +++ b/python/gui/qgsvertexmarker.sip @@ -31,7 +31,7 @@ class QgsVertexMarker : QgsMapCanvasItem QgsVertexMarker( QgsMapCanvas *mapCanvas /TransferThis/ ); - void setCenter( const QgsPoint &point ); + void setCenter( const QgsPointXY &point ); void setIconType( int iconType ); diff --git a/python/plugins/MetaSearch/dialogs/maindialog.py b/python/plugins/MetaSearch/dialogs/maindialog.py index 1b81387d58b..585dba54cc5 100644 --- a/python/plugins/MetaSearch/dialogs/maindialog.py +++ b/python/plugins/MetaSearch/dialogs/maindialog.py @@ -43,7 +43,7 @@ from qgis.PyQt.QtWidgets import (QApplication, QDialog, QComboBox, from qgis.PyQt.QtGui import QColor, QCursor from qgis.core import (QgsApplication, QgsCoordinateReferenceSystem, - QgsCoordinateTransform, QgsGeometry, QgsPoint, + QgsCoordinateTransform, QgsGeometry, QgsPointXY, QgsProviderRegistry, QgsSettings) from qgis.gui import QgsRubberBand @@ -407,10 +407,10 @@ class MetaSearchDialog(QDialog, BASE_CLASS): src = QgsCoordinateReferenceSystem(crsid) dest = QgsCoordinateReferenceSystem(4326) xform = QgsCoordinateTransform(src, dest) - minxy = xform.transform(QgsPoint(extent.xMinimum(), - extent.yMinimum())) - maxxy = xform.transform(QgsPoint(extent.xMaximum(), - extent.yMaximum())) + minxy = xform.transform(QgsPointXY(extent.xMinimum(), + extent.yMinimum())) + maxxy = xform.transform(QgsPointXY(extent.xMaximum(), + extent.yMaximum())) minx, miny = minxy maxx, maxy = maxxy else: # 4326 @@ -980,7 +980,7 @@ def _get_field_value(field): def bbox_to_polygon(bbox): - """converts OWSLib bbox object to list of QgsPoint objects""" + """converts OWSLib bbox object to list of QgsPointXY objects""" if all([bbox.minx is not None, bbox.maxx is not None, diff --git a/python/plugins/processing/algs/qgis/Delaunay.py b/python/plugins/processing/algs/qgis/Delaunay.py index 54c6e1c043e..f8afef65eaf 100644 --- a/python/plugins/processing/algs/qgis/Delaunay.py +++ b/python/plugins/processing/algs/qgis/Delaunay.py @@ -35,7 +35,7 @@ from qgis.core import (QgsField, QgsFeatureRequest, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes, QgsProcessingUtils, QgsFields) @@ -134,9 +134,9 @@ class Delaunay(GeoAlgorithm): inFeat = next(layer.getFeatures(request)) geom = QgsGeometry(inFeat.geometry()) if geom.isMultipart(): - point = QgsPoint(geom.asMultiPoint()[n]) + point = QgsPointXY(geom.asMultiPoint()[n]) else: - point = QgsPoint(geom.asPoint()) + point = QgsPointXY(geom.asPoint()) polygon.append(point) if step <= 3: attrs.append(ids[index]) diff --git a/python/plugins/processing/algs/qgis/ExtentFromLayer.py b/python/plugins/processing/algs/qgis/ExtentFromLayer.py index e6ba56778ea..ea78dee6f36 100644 --- a/python/plugins/processing/algs/qgis/ExtentFromLayer.py +++ b/python/plugins/processing/algs/qgis/ExtentFromLayer.py @@ -31,7 +31,7 @@ from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant from qgis.core import (QgsField, - QgsPoint, + QgsPointXY, QgsGeometry, QgsFeature, QgsWkbTypes, @@ -115,8 +115,8 @@ class ExtentFromLayer(GeoAlgorithm): area = width * height perim = 2 * width + 2 * height - rect = [QgsPoint(minx, miny), QgsPoint(minx, maxy), QgsPoint(maxx, - maxy), QgsPoint(maxx, miny), QgsPoint(minx, miny)] + rect = [QgsPointXY(minx, miny), QgsPointXY(minx, maxy), QgsPointXY(maxx, + maxy), QgsPointXY(maxx, miny), QgsPointXY(minx, miny)] geometry = QgsGeometry().fromPolygon([rect]) feat = QgsFeature() feat.setGeometry(geometry) @@ -151,8 +151,8 @@ class ExtentFromLayer(GeoAlgorithm): cnty = miny + height / 2.0 area = width * height perim = 2 * width + 2 * height - rect = [QgsPoint(minx, miny), QgsPoint(minx, maxy), QgsPoint(maxx, - maxy), QgsPoint(maxx, miny), QgsPoint(minx, miny)] + rect = [QgsPointXY(minx, miny), QgsPointXY(minx, maxy), QgsPointXY(maxx, + maxy), QgsPointXY(maxx, miny), QgsPointXY(minx, miny)] geometry = QgsGeometry().fromPolygon([rect]) feat.setGeometry(geometry) diff --git a/python/plugins/processing/algs/qgis/GridLine.py b/python/plugins/processing/algs/qgis/GridLine.py index 5cd9f14a61e..2b5b56017f6 100644 --- a/python/plugins/processing/algs/qgis/GridLine.py +++ b/python/plugins/processing/algs/qgis/GridLine.py @@ -35,7 +35,7 @@ from qgis.core import (QgsRectangle, QgsField, QgsFeature, QgsGeometry, - QgsPointV2, + QgsPoint, QgsLineString, QgsWkbTypes, QgsFields) @@ -150,8 +150,8 @@ class GridLine(GeoAlgorithm): count_update = count_max * 0.10 y = bbox.yMaximum() while y >= bbox.yMinimum(): - pt1 = QgsPointV2(bbox.xMinimum(), y) - pt2 = QgsPointV2(bbox.xMaximum(), y) + pt1 = QgsPoint(bbox.xMinimum(), y) + pt2 = QgsPoint(bbox.xMaximum(), y) line = QgsLineString() line.setPoints([pt1, pt2]) feat.setGeometry(QgsGeometry(line)) @@ -177,8 +177,8 @@ class GridLine(GeoAlgorithm): count_update = count_max * 0.10 x = bbox.xMinimum() while x <= bbox.xMaximum(): - pt1 = QgsPointV2(x, bbox.yMaximum()) - pt2 = QgsPointV2(x, bbox.yMinimum()) + pt1 = QgsPoint(x, bbox.yMaximum()) + pt2 = QgsPoint(x, bbox.yMinimum()) line = QgsLineString() line.setPoints([pt1, pt2]) feat.setGeometry(QgsGeometry(line)) diff --git a/python/plugins/processing/algs/qgis/GridPolygon.py b/python/plugins/processing/algs/qgis/GridPolygon.py index 5d0c895672d..7e761c14276 100644 --- a/python/plugins/processing/algs/qgis/GridPolygon.py +++ b/python/plugins/processing/algs/qgis/GridPolygon.py @@ -35,7 +35,7 @@ from qgis.core import (QgsRectangle, QgsField, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes, QgsFields) @@ -173,11 +173,11 @@ class GridPolygon(GeoAlgorithm): y2 = y1 - vSpacing polyline = [] - polyline.append(QgsPoint(x1, y1)) - polyline.append(QgsPoint(x2, y1)) - polyline.append(QgsPoint(x2, y2)) - polyline.append(QgsPoint(x1, y2)) - polyline.append(QgsPoint(x1, y1)) + polyline.append(QgsPointXY(x1, y1)) + polyline.append(QgsPointXY(x2, y1)) + polyline.append(QgsPointXY(x2, y2)) + polyline.append(QgsPointXY(x1, y2)) + polyline.append(QgsPointXY(x1, y1)) ft.setGeometry(QgsGeometry.fromPolygon([polyline])) ft.setAttributes([x1, y1, x2, y2, id]) @@ -225,11 +225,11 @@ class GridPolygon(GeoAlgorithm): y3 = y - (((row * 2) + 3) * halfVSpacing) polyline = [] - polyline.append(QgsPoint(x1, y2)) - polyline.append(QgsPoint(x2, y1)) - polyline.append(QgsPoint(x3, y2)) - polyline.append(QgsPoint(x2, y3)) - polyline.append(QgsPoint(x1, y2)) + polyline.append(QgsPointXY(x1, y2)) + polyline.append(QgsPointXY(x2, y1)) + polyline.append(QgsPointXY(x3, y2)) + polyline.append(QgsPointXY(x2, y3)) + polyline.append(QgsPointXY(x1, y2)) ft.setGeometry(QgsGeometry.fromPolygon([polyline])) ft.setAttributes([x1, y1, x3, y3, id]) @@ -287,13 +287,13 @@ class GridPolygon(GeoAlgorithm): y3 = originY + (row * vOverlay) - (((row * 2) + 3) * halfVSpacing) # lo polyline = [] - polyline.append(QgsPoint(x1, y2)) - polyline.append(QgsPoint(x2, y1)) - polyline.append(QgsPoint(x3, y1)) - polyline.append(QgsPoint(x4, y2)) - polyline.append(QgsPoint(x3, y3)) - polyline.append(QgsPoint(x2, y3)) - polyline.append(QgsPoint(x1, y2)) + polyline.append(QgsPointXY(x1, y2)) + polyline.append(QgsPointXY(x2, y1)) + polyline.append(QgsPointXY(x3, y1)) + polyline.append(QgsPointXY(x4, y2)) + polyline.append(QgsPointXY(x3, y3)) + polyline.append(QgsPointXY(x2, y3)) + polyline.append(QgsPointXY(x1, y2)) ft.setGeometry(QgsGeometry.fromPolygon([polyline])) ft.setAttributes([x1, y1, x4, y3, id]) diff --git a/python/plugins/processing/algs/qgis/Gridify.py b/python/plugins/processing/algs/qgis/Gridify.py index fea247a6b4b..97e8e7f2868 100644 --- a/python/plugins/processing/algs/qgis/Gridify.py +++ b/python/plugins/processing/algs/qgis/Gridify.py @@ -27,7 +27,7 @@ __revision__ = '$Format:%H$' from qgis.core import (QgsGeometry, QgsFeature, - QgsPoint, + QgsPointXY, QgsWkbTypes, QgsApplication, QgsMessageLog, @@ -156,8 +156,8 @@ class Gridify(GeoAlgorithm): def _gridify(self, points, hSpacing, vSpacing): nPoints = [] for p in points: - nPoints.append(QgsPoint(round(p.x() / hSpacing, 0) * hSpacing, - round(p.y() / vSpacing, 0) * vSpacing)) + nPoints.append(QgsPointXY(round(p.x() / hSpacing, 0) * hSpacing, + round(p.y() / vSpacing, 0) * vSpacing)) i = 0 # Delete overlapping points diff --git a/python/plugins/processing/algs/qgis/HubLines.py b/python/plugins/processing/algs/qgis/HubLines.py index f2f7e903de6..bb2dd52c379 100644 --- a/python/plugins/processing/algs/qgis/HubLines.py +++ b/python/plugins/processing/algs/qgis/HubLines.py @@ -28,7 +28,7 @@ __revision__ = '$Format:%H$' from qgis.core import (QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes, QgsApplication, QgsProcessingUtils) @@ -109,7 +109,7 @@ class HubLines(GeoAlgorithm): f = QgsFeature() f.setAttributes(spokepoint.attributes()) f.setGeometry(QgsGeometry.fromPolyline( - [QgsPoint(spokeX, spokeY), QgsPoint(hubX, hubY)])) + [QgsPointXY(spokeX, spokeY), QgsPointXY(hubX, hubY)])) writer.addFeature(f) break diff --git a/python/plugins/processing/algs/qgis/MeanCoords.py b/python/plugins/processing/algs/qgis/MeanCoords.py index c67b36a695b..f908e4afd2a 100644 --- a/python/plugins/processing/algs/qgis/MeanCoords.py +++ b/python/plugins/processing/algs/qgis/MeanCoords.py @@ -31,7 +31,7 @@ import os from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant -from qgis.core import QgsField, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes, QgsProcessingUtils, QgsFields +from qgis.core import QgsField, QgsFeature, QgsGeometry, QgsPointXY, QgsWkbTypes, QgsProcessingUtils, QgsFields from processing.core.GeoAlgorithm import GeoAlgorithm from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException @@ -138,7 +138,7 @@ class MeanCoords(GeoAlgorithm): outFeat = QgsFeature() cx = values[0] / values[2] cy = values[1] / values[2] - meanPoint = QgsPoint(cx, cy) + meanPoint = QgsPointXY(cx, cy) outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint)) outFeat.setAttributes([cx, cy, clazz]) diff --git a/python/plugins/processing/algs/qgis/PointsDisplacement.py b/python/plugins/processing/algs/qgis/PointsDisplacement.py index 10894d18eb2..3e15301c02e 100644 --- a/python/plugins/processing/algs/qgis/PointsDisplacement.py +++ b/python/plugins/processing/algs/qgis/PointsDisplacement.py @@ -31,7 +31,7 @@ from qgis.core import (QgsApplication, QgsFeatureRequest, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsProcessingUtils) from processing.tools import dataobjects from processing.core.GeoAlgorithm import GeoAlgorithm @@ -123,7 +123,7 @@ class PointsDisplacement(GeoAlgorithm): dx = radius * sinusCurrentAngle dy = radius * cosinusCurrentAngle - new_point = QgsPoint(old_point.x() + dx, old_point.y() + dy) + new_point = QgsPointXY(old_point.x() + dx, old_point.y() + dy) out_feature = QgsFeature() out_feature.setGeometry(QgsGeometry.fromPoint(new_point)) out_feature.setAttributes(f.attributes()) diff --git a/python/plugins/processing/algs/qgis/PointsFromLines.py b/python/plugins/processing/algs/qgis/PointsFromLines.py index f7febc51a7e..70faf719893 100644 --- a/python/plugins/processing/algs/qgis/PointsFromLines.py +++ b/python/plugins/processing/algs/qgis/PointsFromLines.py @@ -34,7 +34,7 @@ from qgis.core import (QgsApplication, QgsFields, QgsField, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes, QgsProcessingUtils) from processing.tools import raster, dataobjects @@ -190,7 +190,7 @@ class PointsFromLines(GeoAlgorithm): def createPoint(self, pX, pY, geoTransform, writer, feature): (x, y) = raster.pixelToMap(pX, pY, geoTransform) - feature.setGeometry(QgsGeometry.fromPoint(QgsPoint(x, y))) + feature.setGeometry(QgsGeometry.fromPoint(QgsPointXY(x, y))) feature['id'] = self.fid feature['line_id'] = self.lineId feature['point_id'] = self.pointId diff --git a/python/plugins/processing/algs/qgis/PointsFromPolygons.py b/python/plugins/processing/algs/qgis/PointsFromPolygons.py index e217dca307a..25d7aa13b4c 100644 --- a/python/plugins/processing/algs/qgis/PointsFromPolygons.py +++ b/python/plugins/processing/algs/qgis/PointsFromPolygons.py @@ -34,7 +34,7 @@ from qgis.core import (QgsApplication, QgsFeature, QgsGeometry, QgsWkbTypes, - QgsPointV2, + QgsPoint, QgsProcessingUtils) from qgis.PyQt.QtCore import QVariant from processing.core.GeoAlgorithm import GeoAlgorithm @@ -118,7 +118,7 @@ class PointsFromPolygons(GeoAlgorithm): for row in range(startRow, endRow + 1): for col in range(startColumn, endColumn + 1): (x, y) = raster.pixelToMap(row, col, geoTransform) - point = QgsPointV2() + point = QgsPoint() point.setX(x) point.setY(y) diff --git a/python/plugins/processing/algs/qgis/PointsLayerFromTable.py b/python/plugins/processing/algs/qgis/PointsLayerFromTable.py index 638e282d492..2fd46c8871b 100644 --- a/python/plugins/processing/algs/qgis/PointsLayerFromTable.py +++ b/python/plugins/processing/algs/qgis/PointsLayerFromTable.py @@ -27,7 +27,7 @@ __revision__ = '$Format:%H$' from qgis.core import (QgsApplication, QgsWkbTypes, - QgsPointV2, + QgsPoint, QgsCoordinateReferenceSystem, QgsGeometry, QgsProcessingUtils) @@ -120,7 +120,7 @@ class PointsLayerFromTable(GeoAlgorithm): x = float(attrs[x_field_index]) y = float(attrs[y_field_index]) - point = QgsPointV2(x, y) + point = QgsPoint(x, y) if z_field_index is not None: try: diff --git a/python/plugins/processing/algs/qgis/RandomPointsAlongLines.py b/python/plugins/processing/algs/qgis/RandomPointsAlongLines.py index 7a10ce2cf5e..0cf5510fb35 100644 --- a/python/plugins/processing/algs/qgis/RandomPointsAlongLines.py +++ b/python/plugins/processing/algs/qgis/RandomPointsAlongLines.py @@ -38,7 +38,7 @@ from qgis.core import (QgsApplication, QgsDistanceArea, QgsFeatureRequest, QgsFeature, - QgsPoint, + QgsPointXY, QgsMessageLog, QgsProcessingUtils) @@ -133,7 +133,7 @@ class RandomPointsAlongLines(GeoAlgorithm): ry = (startPoint.y() + d * endPoint.y()) / (1 + d) # generate random point - pnt = QgsPoint(rx, ry) + pnt = QgsPointXY(rx, ry) geom = QgsGeometry.fromPoint(pnt) if vector.checkMinDistance(pnt, index, minDistance, points): f = QgsFeature(nPoints) diff --git a/python/plugins/processing/algs/qgis/RandomPointsExtent.py b/python/plugins/processing/algs/qgis/RandomPointsExtent.py index e6bc5bd03f9..9abb6e05e21 100644 --- a/python/plugins/processing/algs/qgis/RandomPointsExtent.py +++ b/python/plugins/processing/algs/qgis/RandomPointsExtent.py @@ -32,7 +32,7 @@ import random from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant from qgis.core import (QgsGeometry, QgsRectangle, QgsFeature, QgsFields, QgsWkbTypes, - QgsField, QgsSpatialIndex, QgsPoint, + QgsField, QgsSpatialIndex, QgsPointXY, QgsCoordinateReferenceSystem, QgsMessageLog, QgsProcessingUtils) @@ -112,7 +112,7 @@ class RandomPointsExtent(GeoAlgorithm): rx = xMin + (xMax - xMin) * random.random() ry = yMin + (yMax - yMin) * random.random() - pnt = QgsPoint(rx, ry) + pnt = QgsPointXY(rx, ry) geom = QgsGeometry.fromPoint(pnt) if geom.within(extent) and \ vector.checkMinDistance(pnt, index, minDistance, points): diff --git a/python/plugins/processing/algs/qgis/RandomPointsLayer.py b/python/plugins/processing/algs/qgis/RandomPointsLayer.py index 05564ab8810..e905b7ee781 100644 --- a/python/plugins/processing/algs/qgis/RandomPointsLayer.py +++ b/python/plugins/processing/algs/qgis/RandomPointsLayer.py @@ -31,7 +31,7 @@ import random from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant from qgis.core import (QgsGeometry, QgsFields, QgsField, QgsSpatialIndex, QgsWkbTypes, - QgsPoint, QgsFeature, QgsFeatureRequest, + QgsPointXY, QgsFeature, QgsFeatureRequest, QgsMessageLog, QgsProcessingUtils) @@ -98,7 +98,7 @@ class RandomPointsLayer(GeoAlgorithm): rx = bbox.xMinimum() + bbox.width() * random.random() ry = bbox.yMinimum() + bbox.height() * random.random() - pnt = QgsPoint(rx, ry) + pnt = QgsPointXY(rx, ry) geom = QgsGeometry.fromPoint(pnt) ids = idxLayer.intersects(geom.buffer(5, 5).boundingBox()) if len(ids) > 0 and \ diff --git a/python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py b/python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py index 5b70888f35b..d7b11d24f85 100644 --- a/python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py +++ b/python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py @@ -31,7 +31,7 @@ import random from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant from qgis.core import (QgsFields, QgsField, QgsDistanceArea, QgsGeometry, QgsWkbTypes, - QgsSpatialIndex, QgsPoint, QgsFeature, + QgsSpatialIndex, QgsPointXY, QgsFeature, QgsMessageLog, QgsProcessingUtils) @@ -119,7 +119,7 @@ class RandomPointsPolygonsFixed(GeoAlgorithm): rx = bbox.xMinimum() + bbox.width() * random.random() ry = bbox.yMinimum() + bbox.height() * random.random() - pnt = QgsPoint(rx, ry) + pnt = QgsPointXY(rx, ry) geom = QgsGeometry.fromPoint(pnt) if geom.within(fGeom) and \ vector.checkMinDistance(pnt, index, minDistance, points): diff --git a/python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py b/python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py index 49015a447da..4764901c59c 100644 --- a/python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py +++ b/python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py @@ -30,7 +30,7 @@ import random from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant -from qgis.core import (QgsFields, QgsField, QgsFeature, QgsPoint, QgsWkbTypes, +from qgis.core import (QgsFields, QgsField, QgsFeature, QgsPointXY, QgsWkbTypes, QgsGeometry, QgsSpatialIndex, QgsDistanceArea, QgsMessageLog, QgsProcessingUtils) @@ -120,7 +120,7 @@ class RandomPointsPolygonsVariable(GeoAlgorithm): rx = bbox.xMinimum() + bbox.width() * random.random() ry = bbox.yMinimum() + bbox.height() * random.random() - pnt = QgsPoint(rx, ry) + pnt = QgsPointXY(rx, ry) geom = QgsGeometry.fromPoint(pnt) if geom.within(fGeom) and \ vector.checkMinDistance(pnt, index, minDistance, points): diff --git a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py index 441768066ff..77701d47152 100644 --- a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py +++ b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py @@ -31,7 +31,7 @@ import math from qgis.core import (QgsApplication, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes, QgsProcessingUtils) @@ -127,8 +127,8 @@ class RectanglesOvalsDiamondsFixed(GeoAlgorithm): x = point.x() y = point.y() points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)] - polygon = [[QgsPoint(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, - -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] + polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, + -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -139,7 +139,7 @@ class RectanglesOvalsDiamondsFixed(GeoAlgorithm): x = point.x() y = point.y() points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)] - polygon = [[QgsPoint(i[0] + x, i[1] + y) for i in points]] + polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -158,8 +158,8 @@ class RectanglesOvalsDiamondsFixed(GeoAlgorithm): x = point.x() y = point.y() points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)] - polygon = [[QgsPoint(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, - -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] + polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, + -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -170,7 +170,7 @@ class RectanglesOvalsDiamondsFixed(GeoAlgorithm): x = point.x() y = point.y() points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)] - polygon = [[QgsPoint(i[0] + x, i[1] + y) for i in points]] + polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -191,8 +191,8 @@ class RectanglesOvalsDiamondsFixed(GeoAlgorithm): points = [] for t in [(2 * math.pi) / segments * i for i in range(segments)]: points.append((xOffset * math.cos(t), yOffset * math.sin(t))) - polygon = [[QgsPoint(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, - -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] + polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, + -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -205,7 +205,7 @@ class RectanglesOvalsDiamondsFixed(GeoAlgorithm): points = [] for t in [(2 * math.pi) / segments * i for i in range(segments)]: points.append((xOffset * math.cos(t), yOffset * math.sin(t))) - polygon = [[QgsPoint(i[0] + x, i[1] + y) for i in points]] + polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) diff --git a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py index 3a54d32b6c9..a934942c3de 100644 --- a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py +++ b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py @@ -32,7 +32,7 @@ from qgis.core import (QgsApplication, QgsWkbTypes, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsMessageLog, QgsProcessingUtils) @@ -146,8 +146,8 @@ class RectanglesOvalsDiamondsVariable(GeoAlgorithm): x = point.x() y = point.y() points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)] - polygon = [[QgsPoint(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, - -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] + polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, + -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -170,7 +170,7 @@ class RectanglesOvalsDiamondsVariable(GeoAlgorithm): x = point.x() y = point.y() points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)] - polygon = [[QgsPoint(i[0] + x, i[1] + y) for i in points]] + polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -199,8 +199,8 @@ class RectanglesOvalsDiamondsVariable(GeoAlgorithm): x = point.x() y = point.y() points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)] - polygon = [[QgsPoint(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, - -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] + polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, + -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -223,7 +223,7 @@ class RectanglesOvalsDiamondsVariable(GeoAlgorithm): x = point.x() y = point.y() points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)] - polygon = [[QgsPoint(i[0] + x, i[1] + y) for i in points]] + polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -254,8 +254,8 @@ class RectanglesOvalsDiamondsVariable(GeoAlgorithm): points = [] for t in [(2 * math.pi) / segments * i for i in range(segments)]: points.append((xOffset * math.cos(t), yOffset * math.sin(t))) - polygon = [[QgsPoint(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, - -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] + polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, + -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) @@ -280,7 +280,7 @@ class RectanglesOvalsDiamondsVariable(GeoAlgorithm): points = [] for t in [(2 * math.pi) / segments * i for i in range(segments)]: points.append((xOffset * math.cos(t), yOffset * math.sin(t))) - polygon = [[QgsPoint(i[0] + x, i[1] + y) for i in points]] + polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] ft.setGeometry(QgsGeometry.fromPolygon(polygon)) ft.setAttributes(feat.attributes()) diff --git a/python/plugins/processing/algs/qgis/RegularPoints.py b/python/plugins/processing/algs/qgis/RegularPoints.py index 116231d0fa4..7e66a877d6d 100644 --- a/python/plugins/processing/algs/qgis/RegularPoints.py +++ b/python/plugins/processing/algs/qgis/RegularPoints.py @@ -33,7 +33,7 @@ from math import sqrt from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtCore import QVariant from qgis.core import (QgsRectangle, QgsFields, QgsField, QgsFeature, QgsWkbTypes, - QgsGeometry, QgsPoint, QgsCoordinateReferenceSystem) + QgsGeometry, QgsPointXY, QgsCoordinateReferenceSystem) from processing.core.GeoAlgorithm import GeoAlgorithm from processing.core.parameters import ParameterExtent @@ -127,11 +127,11 @@ class RegularPoints(GeoAlgorithm): x = extent.xMinimum() + inset while x <= extent.xMaximum(): if randomize: - geom = QgsGeometry().fromPoint(QgsPoint( + geom = QgsGeometry().fromPoint(QgsPointXY( uniform(x - (pSpacing / 2.0), x + (pSpacing / 2.0)), uniform(y - (pSpacing / 2.0), y + (pSpacing / 2.0)))) else: - geom = QgsGeometry().fromPoint(QgsPoint(x, y)) + geom = QgsGeometry().fromPoint(QgsPointXY(x, y)) if extent_engine.intersects(geom.geometry()): f.setAttribute('id', count) diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py index f656f4129c9..0f5cd75c4aa 100644 --- a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py +++ b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py @@ -35,7 +35,7 @@ from qgis.core import (QgsWkbTypes, QgsUnitTypes, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsField, QgsFields, QgsProcessingUtils) @@ -174,7 +174,7 @@ class ServiceAreaFromPoint(GeoAlgorithm): tolerance = self.getParameterValue(self.TOLERANCE) tmp = startPoint.split(',') - startPoint = QgsPoint(float(tmp[0]), float(tmp[1])) + startPoint = QgsPointXY(float(tmp[0]), float(tmp[1])) directionField = -1 if directionFieldName is not None: diff --git a/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py b/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py index 94bc8ff3c48..e0d91511f16 100644 --- a/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py +++ b/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py @@ -35,7 +35,7 @@ from qgis.core import (QgsWkbTypes, QgsUnitTypes, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsFields, QgsField, QgsFeatureRequest, @@ -183,7 +183,7 @@ class ShortestPathLayerToPoint(GeoAlgorithm): self.OUTPUT_LAYER).getVectorWriter(fields, QgsWkbTypes.LineString, layer.crs(), context) tmp = endPoint.split(',') - endPoint = QgsPoint(float(tmp[0]), float(tmp[1])) + endPoint = QgsPointXY(float(tmp[0]), float(tmp[1])) directionField = -1 if directionFieldName is not None: diff --git a/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py b/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py index ee6a46cdbea..49cace2fce2 100644 --- a/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py +++ b/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py @@ -31,7 +31,7 @@ from collections import OrderedDict from qgis.PyQt.QtCore import QVariant from qgis.PyQt.QtGui import QIcon -from qgis.core import (QgsWkbTypes, QgsUnitTypes, QgsFeature, QgsGeometry, QgsPoint, QgsFields, QgsField, QgsFeatureRequest, +from qgis.core import (QgsWkbTypes, QgsUnitTypes, QgsFeature, QgsGeometry, QgsPointXY, QgsFields, QgsField, QgsFeatureRequest, QgsMessageLog, QgsProcessingUtils) from qgis.analysis import (QgsVectorLayerDirector, @@ -176,7 +176,7 @@ class ShortestPathPointToLayer(GeoAlgorithm): self.OUTPUT_LAYER).getVectorWriter(fields, QgsWkbTypes.LineString, layer.crs(), context) tmp = startPoint.split(',') - startPoint = QgsPoint(float(tmp[0]), float(tmp[1])) + startPoint = QgsPointXY(float(tmp[0]), float(tmp[1])) directionField = -1 if directionFieldName is not None: diff --git a/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py b/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py index 51d8a14c8c1..a42799e6f1b 100644 --- a/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py +++ b/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py @@ -35,7 +35,7 @@ from qgis.core import (QgsWkbTypes, QgsUnitTypes, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsFields, QgsField, QgsProcessingUtils) @@ -183,9 +183,9 @@ class ShortestPathPointToPoint(GeoAlgorithm): self.OUTPUT_LAYER).getVectorWriter(fields, QgsWkbTypes.LineString, layer.crs(), context) tmp = startPoint.split(',') - startPoint = QgsPoint(float(tmp[0]), float(tmp[1])) + startPoint = QgsPointXY(float(tmp[0]), float(tmp[1])) tmp = endPoint.split(',') - endPoint = QgsPoint(float(tmp[0]), float(tmp[1])) + endPoint = QgsPointXY(float(tmp[0]), float(tmp[1])) directionField = -1 if directionFieldName is not None: diff --git a/python/plugins/processing/algs/qgis/TopoColors.py b/python/plugins/processing/algs/qgis/TopoColors.py index 16ae9cd6a67..fbea91df571 100755 --- a/python/plugins/processing/algs/qgis/TopoColors.py +++ b/python/plugins/processing/algs/qgis/TopoColors.py @@ -35,7 +35,7 @@ from qgis.core import (QgsApplication, QgsField, QgsGeometry, QgsSpatialIndex, - QgsPointV2, + QgsPoint, NULL, QgsProcessingUtils) @@ -234,7 +234,7 @@ class ColoringAlgorithm: color_areas[feature_color] += features[feature_id].geometry().area() elif balance == 2: min_distances = {c: sys.float_info.max for c in available_colors} - this_feature_centroid = QgsPointV2(features[feature_id].geometry().centroid().geometry()) + this_feature_centroid = QgsPoint(features[feature_id].geometry().centroid().geometry()) # find features for all available colors other_features = {f_id: c for (f_id, c) in feature_colors.items() if c in available_colors} @@ -243,7 +243,7 @@ class ColoringAlgorithm: # feature with each assigned color for other_feature_id, c in other_features.items(): other_geometry = features[other_feature_id].geometry() - other_centroid = QgsPointV2(other_geometry.centroid().geometry()) + other_centroid = QgsPoint(other_geometry.centroid().geometry()) distance = this_feature_centroid.distanceSquared(other_centroid) if distance < min_distances[c]: diff --git a/python/plugins/processing/algs/qgis/VectorGridLines.py b/python/plugins/processing/algs/qgis/VectorGridLines.py index a0b06e0ff13..14d0af40f3e 100644 --- a/python/plugins/processing/algs/qgis/VectorGridLines.py +++ b/python/plugins/processing/algs/qgis/VectorGridLines.py @@ -37,7 +37,7 @@ from qgis.core import (QgsProcessingAlgorithm, QgsField, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes) from qgis.utils import iface @@ -111,8 +111,8 @@ class VectorGridLines(GeoAlgorithm): count_update = count_max * 0.10 y = bbox.yMaximum() while y >= bbox.yMinimum(): - pt1 = QgsPoint(bbox.xMinimum(), y) - pt2 = QgsPoint(bbox.xMaximum(), y) + pt1 = QgsPointXY(bbox.xMinimum(), y) + pt2 = QgsPointXY(bbox.xMaximum(), y) line = [pt1, pt2] feat.setGeometry(geom.fromPolyline(line)) feat.setAttribute(0, idVar) @@ -131,8 +131,8 @@ class VectorGridLines(GeoAlgorithm): count_update = count_max * 0.10 x = bbox.xMinimum() while x <= bbox.xMaximum(): - pt1 = QgsPoint(x, bbox.yMaximum()) - pt2 = QgsPoint(x, bbox.yMinimum()) + pt1 = QgsPointXY(x, bbox.yMaximum()) + pt2 = QgsPointXY(x, bbox.yMinimum()) line = [pt1, pt2] feat.setGeometry(geom.fromPolyline(line)) feat.setAttribute(0, idVar) diff --git a/python/plugins/processing/algs/qgis/VectorGridPolygons.py b/python/plugins/processing/algs/qgis/VectorGridPolygons.py index 80fb66e7426..2bf753f4910 100644 --- a/python/plugins/processing/algs/qgis/VectorGridPolygons.py +++ b/python/plugins/processing/algs/qgis/VectorGridPolygons.py @@ -37,7 +37,7 @@ from qgis.core import (QgsProcessingAlgorithm, QgsField, QgsFeature, QgsGeometry, - QgsPoint, + QgsPointXY, QgsWkbTypes) from qgis.utils import iface @@ -117,11 +117,11 @@ class VectorGridPolygons(GeoAlgorithm): while y >= bbox.yMinimum(): x = bbox.xMinimum() while x <= bbox.xMaximum(): - pt1 = QgsPoint(x, y) - pt2 = QgsPoint(x + xSpace, y) - pt3 = QgsPoint(x + xSpace, y - ySpace) - pt4 = QgsPoint(x, y - ySpace) - pt5 = QgsPoint(x, y) + pt1 = QgsPointXY(x, y) + pt2 = QgsPointXY(x + xSpace, y) + pt3 = QgsPointXY(x + xSpace, y - ySpace) + pt4 = QgsPointXY(x, y - ySpace) + pt5 = QgsPointXY(x, y) polygon = [[pt1, pt2, pt3, pt4, pt5]] feat.setGeometry(geom.fromPolygon(polygon)) feat.setAttribute(0, idVar) diff --git a/python/plugins/processing/algs/qgis/VoronoiPolygons.py b/python/plugins/processing/algs/qgis/VoronoiPolygons.py index 99c85847260..c4e7442ed4f 100644 --- a/python/plugins/processing/algs/qgis/VoronoiPolygons.py +++ b/python/plugins/processing/algs/qgis/VoronoiPolygons.py @@ -30,7 +30,7 @@ import os from qgis.PyQt.QtGui import QIcon -from qgis.core import QgsFeatureRequest, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes, QgsProcessingUtils +from qgis.core import QgsFeatureRequest, QgsFeature, QgsGeometry, QgsPointXY, QgsWkbTypes, QgsProcessingUtils from processing.core.GeoAlgorithm import GeoAlgorithm from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException @@ -242,10 +242,10 @@ class VoronoiPolygons(GeoAlgorithm): exY, ) if x1 or x2 or y1 or y2: - lines.append(QgsPoint(x1 + extent.xMinimum(), - y1 + extent.yMinimum())) - lines.append(QgsPoint(x2 + extent.xMinimum(), - y2 + extent.yMinimum())) + lines.append(QgsPointXY(x1 + extent.xMinimum(), + y1 + extent.yMinimum())) + lines.append(QgsPointXY(x2 + extent.xMinimum(), + y2 + extent.yMinimum())) if 0 - exX in (x1, x2): hasXMin = True if 0 - exY in (y1, y2): @@ -256,16 +256,16 @@ class VoronoiPolygons(GeoAlgorithm): hasXMax = True if hasXMin: if hasYMax: - lines.append(QgsPoint(extent.xMinimum() - exX, - height + extent.yMinimum() + exY)) + lines.append(QgsPointXY(extent.xMinimum() - exX, + height + extent.yMinimum() + exY)) if hasYMin: - lines.append(QgsPoint(extent.xMinimum() - exX, - extent.yMinimum() - exY)) + lines.append(QgsPointXY(extent.xMinimum() - exX, + extent.yMinimum() - exY)) if hasXMax: if hasYMax: - lines.append(QgsPoint(width + extent.xMinimum() + exX, - height + extent.yMinimum() + exY)) + lines.append(QgsPointXY(width + extent.xMinimum() + exX, + height + extent.yMinimum() + exY)) if hasYMin: - lines.append(QgsPoint(width + extent.xMinimum() + exX, - extent.yMinimum() - exY)) + lines.append(QgsPointXY(width + extent.xMinimum() + exX, + extent.yMinimum() - exY)) return lines diff --git a/python/plugins/processing/gui/RectangleMapTool.py b/python/plugins/processing/gui/RectangleMapTool.py index d7a86b5efca..b2d20ab6835 100644 --- a/python/plugins/processing/gui/RectangleMapTool.py +++ b/python/plugins/processing/gui/RectangleMapTool.py @@ -27,7 +27,7 @@ __revision__ = '$Format:%H$' from qgis.PyQt.QtCore import pyqtSignal from qgis.PyQt.QtGui import QColor -from qgis.core import QgsPoint, QgsRectangle, QgsWkbTypes +from qgis.core import QgsPointXY, QgsRectangle, QgsWkbTypes from qgis.gui import QgsMapTool, QgsMapToolEmitPoint, QgsRubberBand @@ -75,10 +75,10 @@ class RectangleMapTool(QgsMapToolEmitPoint): if startPoint.x() == endPoint.x() or startPoint.y() == endPoint.y(): return - point1 = QgsPoint(startPoint.x(), startPoint.y()) - point2 = QgsPoint(startPoint.x(), endPoint.y()) - point3 = QgsPoint(endPoint.x(), endPoint.y()) - point4 = QgsPoint(endPoint.x(), startPoint.y()) + point1 = QgsPointXY(startPoint.x(), startPoint.y()) + point2 = QgsPointXY(startPoint.x(), endPoint.y()) + point3 = QgsPointXY(endPoint.x(), endPoint.y()) + point4 = QgsPointXY(endPoint.x(), startPoint.y()) self.rubberBand.addPoint(point1, False) self.rubberBand.addPoint(point2, False) @@ -103,8 +103,8 @@ class RectangleMapTool(QgsMapToolEmitPoint): if rect is None: self.reset() else: - self.startPoint = QgsPoint(rect.xMaximum(), rect.yMaximum()) - self.endPoint = QgsPoint(rect.xMinimum(), rect.yMinimum()) + self.startPoint = QgsPointXY(rect.xMaximum(), rect.yMaximum()) + self.endPoint = QgsPointXY(rect.xMinimum(), rect.yMinimum()) self.showRect(self.startPoint, self.endPoint) return True diff --git a/python/qsci_apis/PyQGIS-1.7.api b/python/qsci_apis/PyQGIS-1.7.api index 267b68cbd73..6b406611402 100644 --- a/python/qsci_apis/PyQGIS-1.7.api +++ b/python/qsci_apis/PyQGIS-1.7.api @@ -722,7 +722,7 @@ qgis.core.QgsCoordinateTransform.setSourceCrs?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.setDestCRS?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.sourceCrs?4() -> QgsCoordinateReferenceSystem qgis.core.QgsCoordinateTransform.destCRS?4() -> QgsCoordinateReferenceSystem -qgis.core.QgsCoordinateTransform.transform?4(QgsPoint, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint +qgis.core.QgsCoordinateTransform.transform?4(QgsPointXY, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transform?4(float, float, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transformBoundingBox?4(QgsRectangle, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsRectangle qgis.core.QgsCoordinateTransform.transformInPlace?4(QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> (float, float, float) @@ -811,9 +811,9 @@ qgis.core.QgsDistanceArea.ellipsoidInverseFlattening?4() -> float qgis.core.QgsDistanceArea.measure?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measurePerimeter?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measureLine?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.measureLine?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.measureLine?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.measurePolygon?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.bearing?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.bearing?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.textUnit?4(float, int, QGis.UnitType, bool, bool keepBaseUnit=False) -> QString qgis.core.QgsFeature?1(int id=0, QString typeName="") qgis.core.QgsFeature.__init__?1(self, int id=0, QString typeName="") @@ -877,20 +877,20 @@ qgis.core.QgsGeometry.isGeosEmpty?4() -> bool qgis.core.QgsGeometry.area?4() -> float qgis.core.QgsGeometry.length?4() -> float qgis.core.QgsGeometry.distance?4(QgsGeometry) -> float -qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPoint, int, int, int, float) +qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPointXY, int, int, int, float) qgis.core.QgsGeometry.adjacentVertices?4(int) -> (int, int) qgis.core.QgsGeometry.insertVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.moveVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.deleteVertex?4(int) -> bool qgis.core.QgsGeometry.vertexAt?4(int) -> QgsPoint -qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPoint, int) -> float +qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPointXY, int) -> float qgis.core.QgsGeometry.closestVertexWithContext?4(QgsPoint) -> (float, int) -qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPoint, int) +qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPointXY, int) qgis.core.QgsGeometry.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.addIsland?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.translate?4(float, float) -> int qgis.core.QgsGeometry.transform?4(QgsCoordinateTransform) -> int -qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPoint, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) +qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPointXY, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) qgis.core.QgsGeometry.reshapeGeometry?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.makeDifference?4(QgsGeometry) -> int qgis.core.QgsGeometry.boundingBox?4() -> QgsRectangle @@ -1190,8 +1190,8 @@ qgis.core.QgsLabelPosition.layerID?7 qgis.core.QgsLabelPosition.rotation?7 qgis.core.QgsLabelPosition.upsideDown?7 qgis.core.QgsLabelPosition.width?7 -qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, bool) -qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, bool) +qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, bool) +qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, bool) qgis.core.QgsLabelPosition?1() qgis.core.QgsLabelPosition.__init__?1(self) qgis.core.QgsLabelPosition?1(QgsLabelPosition) @@ -1703,11 +1703,11 @@ qgis.core.QgsRasterViewPort?1(QgsRasterViewPort) qgis.core.QgsRasterViewPort.__init__?1(self, QgsRasterViewPort) qgis.core.QgsRectangle?1(float xmin=0, float ymin=0, float xmax=0, float ymax=0) qgis.core.QgsRectangle.__init__?1(self, float xmin=0, float ymin=0, float xmax=0, float ymax=0) -qgis.core.QgsRectangle?1(QgsPoint, QgsPoint) -qgis.core.QgsRectangle.__init__?1(self, QgsPoint, QgsPoint) +qgis.core.QgsRectangle?1(QgsPointXY, QgsPoint) +qgis.core.QgsRectangle.__init__?1(self, QgsPointXY, QgsPoint) qgis.core.QgsRectangle?1(QgsRectangle) qgis.core.QgsRectangle.__init__?1(self, QgsRectangle) -qgis.core.QgsRectangle.set?4(QgsPoint, QgsPoint) +qgis.core.QgsRectangle.set?4(QgsPointXY, QgsPoint) qgis.core.QgsRectangle.set?4(float, float, float, float) qgis.core.QgsRectangle.setXMinimum?4(float) qgis.core.QgsRectangle.setXMaximum?4(float) @@ -1722,8 +1722,8 @@ qgis.core.QgsRectangle.normalize?4() qgis.core.QgsRectangle.width?4() -> float qgis.core.QgsRectangle.height?4() -> float qgis.core.QgsRectangle.center?4() -> QgsPoint -qgis.core.QgsRectangle.scale?4(float, QgsPoint c=None) -qgis.core.QgsRectangle.expand?4(float, QgsPoint c=None) +qgis.core.QgsRectangle.scale?4(float, QgsPointXY c=None) +qgis.core.QgsRectangle.expand?4(float, QgsPointXY c=None) qgis.core.QgsRectangle.intersect?4(QgsRectangle) -> QgsRectangle qgis.core.QgsRectangle.intersects?4(QgsRectangle) -> bool qgis.core.QgsRectangle.contains?4(QgsRectangle) -> bool @@ -1940,7 +1940,7 @@ qgis.core.QgsSpatialIndex.__init__?1(self, QgsSpatialIndex) qgis.core.QgsSpatialIndex.insertFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.deleteFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.intersects?4(QgsRectangle) -> list-of-int -qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPoint, int) -> list-of-int +qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPointXY, int) -> list-of-int qgis.core.QgsCoordinateReferenceSystem.CrsType?10 qgis.core.QgsCoordinateReferenceSystem.InternalCrsId?10 qgis.core.QgsCoordinateReferenceSystem.PostgisCrsId?10 @@ -2253,7 +2253,7 @@ qgis.core.QgsVectorLayer.deleteSelectedFeatures?4() -> bool qgis.core.QgsVectorLayer.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.addIsland?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.translateFeature?4(int, float, float) -> int -qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPoint, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int qgis.core.QgsVectorLayer.removePolygonIntersections?4(QgsGeometry) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsGeometry) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsPoint) -> int @@ -2263,8 +2263,8 @@ qgis.core.QgsVectorLayer.hasLabelsEnabled?4() -> bool qgis.core.QgsVectorLayer.isEditable?4() -> bool qgis.core.QgsVectorLayer.isReadOnly?4() -> bool qgis.core.QgsVectorLayer.isModified?4() -> bool -qgis.core.QgsVectorLayer.snapPoint?4(QgsPoint, float) -> bool -qgis.core.QgsVectorLayer.snapWithContext?4(QgsPoint, float, QgsSnapper.SnappingType) -> (int, unknown-type) +qgis.core.QgsVectorLayer.snapPoint?4(QgsPointXY, float) -> bool +qgis.core.QgsVectorLayer.snapWithContext?4(QgsPointXY, float, QgsSnapper.SnappingType) -> (int, unknown-type) qgis.core.QgsVectorLayer.reload?4() qgis.core.QgsVectorLayer.draw?4(QgsRenderContext) -> bool qgis.core.QgsVectorLayer.drawLabels?4(QgsRenderContext) @@ -3219,14 +3219,14 @@ qgis.gui.QgsMapCanvasSnapper?1() qgis.gui.QgsMapCanvasSnapper.__init__?1(self) qgis.gui.QgsMapCanvasSnapper?1(QgsMapCanvasSnapper) qgis.gui.QgsMapCanvasSnapper.__init__?1(self, QgsMapCanvasSnapper) -qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) -qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) qgis.gui.QgsMapCanvasSnapper.setMapCanvas?4(QgsMapCanvas) qgis.gui.QgsMapTip?1() qgis.gui.QgsMapTip.__init__?1(self) qgis.gui.QgsMapTip?1(QgsMapTip) qgis.gui.QgsMapTip.__init__?1(self, QgsMapTip) -qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPoint, QPoint, QgsMapCanvas) +qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPointXY, QPoint, QgsMapCanvas) qgis.gui.QgsMapTip.clear?4(QgsMapCanvas) qgis.gui.QgsMapTool?1(QgsMapCanvas) qgis.gui.QgsMapTool.__init__?1(self, QgsMapCanvas) @@ -3255,7 +3255,7 @@ qgis.gui.QgsMapToolEmitPoint.__init__?1(self, QgsMapCanvas) qgis.gui.QgsMapToolEmitPoint.canvasMoveEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasPressEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasReleaseEvent?4(QMouseEvent) -qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPoint, Qt.MouseButton) +qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPointXY, Qt.MouseButton) qgis.gui.QgsMapToolPan?1(QgsMapCanvas) qgis.gui.QgsMapToolPan.__init__?1(self, QgsMapCanvas) qgis.gui.QgsMapToolPan.canvasMoveEvent?4(QMouseEvent) @@ -3340,10 +3340,10 @@ qgis.gui.QgsRubberBand.__init__?1(self, QgsMapCanvas, bool isPolygon=False) qgis.gui.QgsRubberBand.setColor?4(QColor) qgis.gui.QgsRubberBand.setWidth?4(int) qgis.gui.QgsRubberBand.reset?4(bool isPolygon=False) -qgis.gui.QgsRubberBand.addPoint?4(QgsPoint, bool update=True, int geometryIndex=0) +qgis.gui.QgsRubberBand.addPoint?4(QgsPointXY, bool update=True, int geometryIndex=0) qgis.gui.QgsRubberBand.removeLastPoint?4(int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(QgsPoint, int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(int, QgsPoint, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(QgsPointXY, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(int, QgsPointXY, int geometryIndex=0) qgis.gui.QgsRubberBand.setToGeometry?4(QgsGeometry, QgsVectorLayer) qgis.gui.QgsRubberBand.addGeometry?4(QgsGeometry, QgsVectorLayer) qgis.gui.QgsRubberBand.setToCanvasRectangle?4(QRect) diff --git a/python/qsci_apis/PyQGIS-1.8.api b/python/qsci_apis/PyQGIS-1.8.api index dc3223ad3d2..55da40fc52d 100644 --- a/python/qsci_apis/PyQGIS-1.8.api +++ b/python/qsci_apis/PyQGIS-1.8.api @@ -766,7 +766,7 @@ qgis.core.QgsCoordinateTransform.setSourceCrs?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.setDestCRS?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.sourceCrs?4() -> QgsCoordinateReferenceSystem qgis.core.QgsCoordinateTransform.destCRS?4() -> QgsCoordinateReferenceSystem -qgis.core.QgsCoordinateTransform.transform?4(QgsPoint, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint +qgis.core.QgsCoordinateTransform.transform?4(QgsPointXY, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transform?4(float, float, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transformBoundingBox?4(QgsRectangle, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsRectangle qgis.core.QgsCoordinateTransform.transformInPlace?4(QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> (float, float, float) @@ -855,9 +855,9 @@ qgis.core.QgsDistanceArea.ellipsoidInverseFlattening?4() -> float qgis.core.QgsDistanceArea.measure?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measurePerimeter?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measureLine?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.measureLine?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.measureLine?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.measurePolygon?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.bearing?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.bearing?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.textUnit?4(float, int, QGis.UnitType, bool, bool keepBaseUnit=False) -> QString qgis.core.QgsExpression.BinaryOperator?10 qgis.core.QgsExpression.boOr?10 @@ -1091,21 +1091,21 @@ qgis.core.QgsGeometry.isGeosEmpty?4() -> bool qgis.core.QgsGeometry.area?4() -> float qgis.core.QgsGeometry.length?4() -> float qgis.core.QgsGeometry.distance?4(QgsGeometry) -> float -qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPoint, int, int, int, float) +qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPointXY, int, int, int, float) qgis.core.QgsGeometry.adjacentVertices?4(int) -> (int, int) qgis.core.QgsGeometry.insertVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.moveVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.deleteVertex?4(int) -> bool qgis.core.QgsGeometry.vertexAt?4(int) -> QgsPoint -qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPoint, int) -> float +qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPointXY, int) -> float qgis.core.QgsGeometry.closestVertexWithContext?4(QgsPoint) -> (float, int) -qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPoint, int) +qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPointXY, int) qgis.core.QgsGeometry.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.addPart?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.addIsland?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.translate?4(float, float) -> int qgis.core.QgsGeometry.transform?4(QgsCoordinateTransform) -> int -qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPoint, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) +qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPointXY, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) qgis.core.QgsGeometry.reshapeGeometry?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.makeDifference?4(QgsGeometry) -> int qgis.core.QgsGeometry.boundingBox?4() -> QgsRectangle @@ -1414,8 +1414,8 @@ qgis.core.QgsLabelPosition.layerID?7 qgis.core.QgsLabelPosition.rotation?7 qgis.core.QgsLabelPosition.upsideDown?7 qgis.core.QgsLabelPosition.width?7 -qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, bool) -qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, bool) +qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, bool) +qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, bool) qgis.core.QgsLabelPosition?1() qgis.core.QgsLabelPosition.__init__?1(self) qgis.core.QgsLabelPosition?1(QgsLabelPosition) @@ -1933,11 +1933,11 @@ qgis.core.QgsRasterViewPort?1(QgsRasterViewPort) qgis.core.QgsRasterViewPort.__init__?1(self, QgsRasterViewPort) qgis.core.QgsRectangle?1(float xmin=0, float ymin=0, float xmax=0, float ymax=0) qgis.core.QgsRectangle.__init__?1(self, float xmin=0, float ymin=0, float xmax=0, float ymax=0) -qgis.core.QgsRectangle?1(QgsPoint, QgsPoint) -qgis.core.QgsRectangle.__init__?1(self, QgsPoint, QgsPoint) +qgis.core.QgsRectangle?1(QgsPointXY, QgsPoint) +qgis.core.QgsRectangle.__init__?1(self, QgsPointXY, QgsPoint) qgis.core.QgsRectangle?1(QgsRectangle) qgis.core.QgsRectangle.__init__?1(self, QgsRectangle) -qgis.core.QgsRectangle.set?4(QgsPoint, QgsPoint) +qgis.core.QgsRectangle.set?4(QgsPointXY, QgsPoint) qgis.core.QgsRectangle.set?4(float, float, float, float) qgis.core.QgsRectangle.setXMinimum?4(float) qgis.core.QgsRectangle.setXMaximum?4(float) @@ -1952,8 +1952,8 @@ qgis.core.QgsRectangle.normalize?4() qgis.core.QgsRectangle.width?4() -> float qgis.core.QgsRectangle.height?4() -> float qgis.core.QgsRectangle.center?4() -> QgsPoint -qgis.core.QgsRectangle.scale?4(float, QgsPoint c=None) -qgis.core.QgsRectangle.expand?4(float, QgsPoint c=None) +qgis.core.QgsRectangle.scale?4(float, QgsPointXY c=None) +qgis.core.QgsRectangle.expand?4(float, QgsPointXY c=None) qgis.core.QgsRectangle.intersect?4(QgsRectangle) -> QgsRectangle qgis.core.QgsRectangle.intersects?4(QgsRectangle) -> bool qgis.core.QgsRectangle.contains?4(QgsRectangle) -> bool @@ -2190,7 +2190,7 @@ qgis.core.QgsSpatialIndex.__init__?1(self, QgsSpatialIndex) qgis.core.QgsSpatialIndex.insertFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.deleteFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.intersects?4(QgsRectangle) -> unknown-type -qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPoint, int) -> unknown-type +qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPointXY, int) -> unknown-type qgis.core.QgsCoordinateReferenceSystem.CrsType?10 qgis.core.QgsCoordinateReferenceSystem.InternalCrsId?10 qgis.core.QgsCoordinateReferenceSystem.PostgisCrsId?10 @@ -2582,7 +2582,7 @@ qgis.core.QgsVectorLayer.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.addPart?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.addIsland?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.translateFeature?4(int, float, float) -> int -qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPoint, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int qgis.core.QgsVectorLayer.removePolygonIntersections?4(QgsGeometry) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsGeometry) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsPoint) -> int @@ -2592,8 +2592,8 @@ qgis.core.QgsVectorLayer.hasLabelsEnabled?4() -> bool qgis.core.QgsVectorLayer.isEditable?4() -> bool qgis.core.QgsVectorLayer.isReadOnly?4() -> bool qgis.core.QgsVectorLayer.isModified?4() -> bool -qgis.core.QgsVectorLayer.snapPoint?4(QgsPoint, float) -> bool -qgis.core.QgsVectorLayer.snapWithContext?4(QgsPoint, float, QgsSnapper.SnappingType) -> (int, unknown-type) +qgis.core.QgsVectorLayer.snapPoint?4(QgsPointXY, float) -> bool +qgis.core.QgsVectorLayer.snapWithContext?4(QgsPointXY, float, QgsSnapper.SnappingType) -> (int, unknown-type) qgis.core.QgsVectorLayer.reload?4() qgis.core.QgsVectorLayer.draw?4(QgsRenderContext) -> bool qgis.core.QgsVectorLayer.drawLabels?4(QgsRenderContext) @@ -3676,14 +3676,14 @@ qgis.gui.QgsMapCanvasSnapper?1() qgis.gui.QgsMapCanvasSnapper.__init__?1(self) qgis.gui.QgsMapCanvasSnapper?1(QgsMapCanvasSnapper) qgis.gui.QgsMapCanvasSnapper.__init__?1(self, QgsMapCanvasSnapper) -qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) -qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) qgis.gui.QgsMapCanvasSnapper.setMapCanvas?4(QgsMapCanvas) qgis.gui.QgsMapTip?1() qgis.gui.QgsMapTip.__init__?1(self) qgis.gui.QgsMapTip?1(QgsMapTip) qgis.gui.QgsMapTip.__init__?1(self, QgsMapTip) -qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPoint, QPoint, QgsMapCanvas) +qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPointXY, QPoint, QgsMapCanvas) qgis.gui.QgsMapTip.clear?4(QgsMapCanvas) qgis.gui.QgsMapTool?1(QgsMapCanvas) qgis.gui.QgsMapTool.__init__?1(self, QgsMapCanvas) @@ -3712,7 +3712,7 @@ qgis.gui.QgsMapToolEmitPoint.__init__?1(self, QgsMapCanvas) qgis.gui.QgsMapToolEmitPoint.canvasMoveEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasPressEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasReleaseEvent?4(QMouseEvent) -qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPoint, Qt.MouseButton) +qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPointXY, Qt.MouseButton) qgis.gui.QgsMapToolPan?1(QgsMapCanvas) qgis.gui.QgsMapToolPan.__init__?1(self, QgsMapCanvas) qgis.gui.QgsMapToolPan.canvasMoveEvent?4(QMouseEvent) @@ -3796,10 +3796,10 @@ qgis.gui.QgsRubberBand.__init__?1(self, QgsMapCanvas, bool isPolygon=False) qgis.gui.QgsRubberBand.setColor?4(QColor) qgis.gui.QgsRubberBand.setWidth?4(int) qgis.gui.QgsRubberBand.reset?4(bool isPolygon=False) -qgis.gui.QgsRubberBand.addPoint?4(QgsPoint, bool update=True, int geometryIndex=0) +qgis.gui.QgsRubberBand.addPoint?4(QgsPointXY, bool update=True, int geometryIndex=0) qgis.gui.QgsRubberBand.removeLastPoint?4(int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(QgsPoint, int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(int, QgsPoint, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(QgsPointXY, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(int, QgsPointXY, int geometryIndex=0) qgis.gui.QgsRubberBand.setToGeometry?4(QgsGeometry, QgsVectorLayer) qgis.gui.QgsRubberBand.addGeometry?4(QgsGeometry, QgsVectorLayer) qgis.gui.QgsRubberBand.setToCanvasRectangle?4(QRect) @@ -3939,13 +3939,13 @@ qgis.networkanalysis.QgsGraphBuilderInterface.coordinateTransformationEnabled?4( qgis.networkanalysis.QgsGraphBuilderInterface.topologyTolerance?4() -> float qgis.networkanalysis.QgsGraphBuilderInterface.distanceArea?4() -> QgsDistanceArea qgis.networkanalysis.QgsGraphBuilderInterface.addVertex?4(int, QgsPoint) -qgis.networkanalysis.QgsGraphBuilderInterface.addArc?4(int, QgsPoint, int, QgsPoint, list-of-QVariant) +qgis.networkanalysis.QgsGraphBuilderInterface.addArc?4(int, QgsPointXY, int, QgsPointXY, list-of-QVariant) qgis.networkanalysis.QgsGraphBuilder?1(QgsCoordinateReferenceSystem, bool otfEnabled=True, float topologyTolerance=0, QString ellipsoidID="WGS84") qgis.networkanalysis.QgsGraphBuilder.__init__?1(self, QgsCoordinateReferenceSystem, bool otfEnabled=True, float topologyTolerance=0, QString ellipsoidID="WGS84") qgis.networkanalysis.QgsGraphBuilder?1(QgsGraphBuilder) qgis.networkanalysis.QgsGraphBuilder.__init__?1(self, QgsGraphBuilder) qgis.networkanalysis.QgsGraphBuilder.addVertex?4(int, QgsPoint) -qgis.networkanalysis.QgsGraphBuilder.addArc?4(int, QgsPoint, int, QgsPoint, list-of-QVariant) +qgis.networkanalysis.QgsGraphBuilder.addArc?4(int, QgsPointXY, int, QgsPointXY, list-of-QVariant) qgis.networkanalysis.QgsGraphBuilder.graph?4() -> QgsGraph qgis.networkanalysis.QgsGraphDirector?1() qgis.networkanalysis.QgsGraphDirector.__init__?1(self) diff --git a/python/qsci_apis/PyQGIS-2.0.api b/python/qsci_apis/PyQGIS-2.0.api index a4d78c2da9e..2e1a9049777 100644 --- a/python/qsci_apis/PyQGIS-2.0.api +++ b/python/qsci_apis/PyQGIS-2.0.api @@ -479,7 +479,7 @@ qgis.core.QgsCoordinateTransform.setSourceCrs?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.setDestCRS?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.sourceCrs?4() -> QgsCoordinateReferenceSystem qgis.core.QgsCoordinateTransform.destCRS?4() -> QgsCoordinateReferenceSystem -qgis.core.QgsCoordinateTransform.transform?4(QgsPoint, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint +qgis.core.QgsCoordinateTransform.transform?4(QgsPointXY, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transform?4(float, float, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transformBoundingBox?4(QgsRectangle, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsRectangle qgis.core.QgsCoordinateTransform.transformInPlace?4(QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> (float, float, float) @@ -745,9 +745,9 @@ qgis.core.QgsDistanceArea.ellipsoidInverseFlattening?4() -> float qgis.core.QgsDistanceArea.measure?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measurePerimeter?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measureLine?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.measureLine?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.measureLine?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.measurePolygon?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.bearing?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.bearing?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.textUnit?4(float, int, QGis.UnitType, bool, bool keepBaseUnit=False) -> QString qgis.core.QgsDistanceArea.convertMeasurement?4(float, QGis.UnitType, QGis.UnitType, bool) -> (float, QGis.UnitType) qgis.core.QgsErrorMessage.Format?10 @@ -1135,20 +1135,20 @@ qgis.core.QgsGeometry.isGeosEmpty?4() -> bool qgis.core.QgsGeometry.area?4() -> float qgis.core.QgsGeometry.length?4() -> float qgis.core.QgsGeometry.distance?4(QgsGeometry) -> float -qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPoint, int, int, int, float) +qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPointXY, int, int, int, float) qgis.core.QgsGeometry.adjacentVertices?4(int) -> (int, int) qgis.core.QgsGeometry.insertVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.moveVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.deleteVertex?4(int) -> bool qgis.core.QgsGeometry.vertexAt?4(int) -> QgsPoint -qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPoint, int) -> float +qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPointXY, int) -> float qgis.core.QgsGeometry.closestVertexWithContext?4(QgsPoint) -> (float, int) -qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPoint, int) +qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPointXY, int) qgis.core.QgsGeometry.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.addPart?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.translate?4(float, float) -> int qgis.core.QgsGeometry.transform?4(QgsCoordinateTransform) -> int -qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPoint, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) +qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPointXY, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) qgis.core.QgsGeometry.reshapeGeometry?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.makeDifference?4(QgsGeometry) -> int qgis.core.QgsGeometry.boundingBox?4() -> QgsRectangle @@ -1517,8 +1517,8 @@ qgis.core.QgsLabelPosition.layerID?7 qgis.core.QgsLabelPosition.rotation?7 qgis.core.QgsLabelPosition.upsideDown?7 qgis.core.QgsLabelPosition.width?7 -qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) -qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) +qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) +qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) qgis.core.QgsLabelPosition?1() qgis.core.QgsLabelPosition.__init__?1(self) qgis.core.QgsLabelPosition?1(QgsLabelPosition) @@ -2106,7 +2106,7 @@ qgis.core.QgsPoint.sqrDist?4(QgsPoint) -> float qgis.core.QgsPoint.sqrDistToSegment?4(float, float, float, float, float epsilon=DEFAULT_SEGMENT_EPSILON) -> (float, QgsPoint) qgis.core.QgsPoint.azimuth?4(QgsPoint) -> float qgis.core.QgsPoint.multiply?4(float) -qgis.core.QgsPoint.onSegment?4(QgsPoint, QgsPoint) -> int +qgis.core.QgsPoint.onSegment?4(QgsPointXY, QgsPoint) -> int qgis.core.QgsProject.instance?4() -> QgsProject qgis.core.QgsProject.title?4(QString) qgis.core.QgsProject.title?4() -> QString @@ -2274,13 +2274,13 @@ qgis.core.QgsPythonRunner.runCommand?4(QString, QString messageOnError=QString() qgis.core.QgsPythonRunner.evalCommand?4(QString, QString) -> bool qgis.core.QgsRectangle?1(float xmin=0, float ymin=0, float xmax=0, float ymax=0) qgis.core.QgsRectangle.__init__?1(self, float xmin=0, float ymin=0, float xmax=0, float ymax=0) -qgis.core.QgsRectangle?1(QgsPoint, QgsPoint) -qgis.core.QgsRectangle.__init__?1(self, QgsPoint, QgsPoint) +qgis.core.QgsRectangle?1(QgsPointXY, QgsPoint) +qgis.core.QgsRectangle.__init__?1(self, QgsPointXY, QgsPoint) qgis.core.QgsRectangle?1(QRectF) qgis.core.QgsRectangle.__init__?1(self, QRectF) qgis.core.QgsRectangle?1(QgsRectangle) qgis.core.QgsRectangle.__init__?1(self, QgsRectangle) -qgis.core.QgsRectangle.set?4(QgsPoint, QgsPoint) +qgis.core.QgsRectangle.set?4(QgsPointXY, QgsPoint) qgis.core.QgsRectangle.set?4(float, float, float, float) qgis.core.QgsRectangle.setXMinimum?4(float) qgis.core.QgsRectangle.setXMaximum?4(float) @@ -2295,7 +2295,7 @@ qgis.core.QgsRectangle.normalize?4() qgis.core.QgsRectangle.width?4() -> float qgis.core.QgsRectangle.height?4() -> float qgis.core.QgsRectangle.center?4() -> QgsPoint -qgis.core.QgsRectangle.scale?4(float, QgsPoint c=None) +qgis.core.QgsRectangle.scale?4(float, QgsPointXY c=None) qgis.core.QgsRectangle.intersect?4(QgsRectangle) -> QgsRectangle qgis.core.QgsRectangle.intersects?4(QgsRectangle) -> bool qgis.core.QgsRectangle.contains?4(QgsRectangle) -> bool @@ -2404,7 +2404,7 @@ qgis.core.QgsSnapper?1(QgsMapRenderer) qgis.core.QgsSnapper.__init__?1(self, QgsMapRenderer) qgis.core.QgsSnapper?1(QgsSnapper) qgis.core.QgsSnapper.__init__?1(self, QgsSnapper) -qgis.core.QgsSnapper.snapPoint?4(QPoint, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.core.QgsSnapper.snapPoint?4(QPoint, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) qgis.core.QgsSnapper.setSnapLayers?4(list-of-QgsSnapper.SnapLayer) qgis.core.QgsSnapper.setSnapMode?4(QgsSnapper.SnappingMode) qgis.core.QgsSnapper.SnapLayer.mLayer?7 @@ -2422,7 +2422,7 @@ qgis.core.QgsSpatialIndex.__init__?1(self, QgsSpatialIndex) qgis.core.QgsSpatialIndex.insertFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.deleteFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.intersects?4(QgsRectangle) -> unknown-type -qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPoint, int) -> unknown-type +qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPointXY, int) -> unknown-type qgis.core.QgsTolerance.UnitType?10 qgis.core.QgsTolerance.MapUnits?10 qgis.core.QgsTolerance.Pixels?10 @@ -2648,7 +2648,7 @@ qgis.core.QgsVectorLayer.deleteSelectedFeatures?4() -> bool qgis.core.QgsVectorLayer.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.addPart?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.translateFeature?4(int, float, float) -> int -qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPoint, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int qgis.core.QgsVectorLayer.removePolygonIntersections?4(QgsGeometry, unknown-type ignoreFeatures=QgsFeatureIds()) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsGeometry) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsPoint) -> int @@ -2658,8 +2658,8 @@ qgis.core.QgsVectorLayer.hasLabelsEnabled?4() -> bool qgis.core.QgsVectorLayer.isEditable?4() -> bool qgis.core.QgsVectorLayer.isReadOnly?4() -> bool qgis.core.QgsVectorLayer.isModified?4() -> bool -qgis.core.QgsVectorLayer.snapPoint?4(QgsPoint, float) -> bool -qgis.core.QgsVectorLayer.snapWithContext?4(QgsPoint, float, QgsSnapper.SnappingType) -> (int, unknown-type) +qgis.core.QgsVectorLayer.snapPoint?4(QgsPointXY, float) -> bool +qgis.core.QgsVectorLayer.snapWithContext?4(QgsPointXY, float, QgsSnapper.SnappingType) -> (int, unknown-type) qgis.core.QgsVectorLayer.reload?4() qgis.core.QgsVectorLayer.draw?4(QgsRenderContext) -> bool qgis.core.QgsVectorLayer.drawLabels?4(QgsRenderContext) @@ -2948,9 +2948,9 @@ qgis.core.QgsVectorLayerEditUtils.insertVertex?4(float, float, int, int) -> bool qgis.core.QgsVectorLayerEditUtils.moveVertex?4(float, float, int, int) -> bool qgis.core.QgsVectorLayerEditUtils.deleteVertex?4(int, int) -> bool qgis.core.QgsVectorLayerEditUtils.addRing?4(list-of-QgsPoint) -> int -qgis.core.QgsVectorLayerEditUtils.addPart?4(list-of-QgsPoint, int) -> int +qgis.core.QgsVectorLayerEditUtils.addPart?4(list-of-QgsPointXY, int) -> int qgis.core.QgsVectorLayerEditUtils.translateFeature?4(int, float, float) -> int -qgis.core.QgsVectorLayerEditUtils.splitFeatures?4(list-of-QgsPoint, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayerEditUtils.splitFeatures?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int qgis.core.QgsVectorLayerEditUtils.addTopologicalPoints?4(QgsGeometry) -> int qgis.core.QgsVectorLayerEditUtils.addTopologicalPoints?4(QgsPoint) -> int qgis.core.QgsVectorLayerEditUtils.insertSegmentVerticesForSnap?4(list-of-QgsSnappingResult) -> int @@ -4470,7 +4470,7 @@ qgis.core.QgsRasterDataProvider.buildPyramids?4(list-of-QgsRasterPyramid, QStrin qgis.core.QgsRasterDataProvider.buildPyramidList?4(list-of-int overviewList=QList<int>()) -> list-of-QgsRasterPyramid qgis.core.QgsRasterDataProvider.hasPyramids?4() -> bool qgis.core.QgsRasterDataProvider.metadata?4() -> QString -qgis.core.QgsRasterDataProvider.identify?4(QgsPoint, QgsRaster.IdentifyFormat, QgsRectangle theExtent=QgsRectangle(), int theWidth=0, int theHeight=0) -> QgsRasterIdentifyResult +qgis.core.QgsRasterDataProvider.identify?4(QgsPointXY, QgsRaster.IdentifyFormat, QgsRectangle theExtent=QgsRectangle(), int theWidth=0, int theHeight=0) -> QgsRasterIdentifyResult qgis.core.QgsRasterDataProvider.lastErrorTitle?4() -> QString qgis.core.QgsRasterDataProvider.lastError?4() -> QString qgis.core.QgsRasterDataProvider.lastErrorFormat?4() -> QString @@ -7015,8 +7015,8 @@ qgis.gui.QgsMapCanvasSnapper?1() qgis.gui.QgsMapCanvasSnapper.__init__?1(self) qgis.gui.QgsMapCanvasSnapper?1(QgsMapCanvasSnapper) qgis.gui.QgsMapCanvasSnapper.__init__?1(self, QgsMapCanvasSnapper) -qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) -qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) qgis.gui.QgsMapCanvasSnapper.setMapCanvas?4(QgsMapCanvas) qgis.gui.QgsMapOverviewCanvas?1(QWidget parent=None, QgsMapCanvas mapCanvas=None) qgis.gui.QgsMapOverviewCanvas.__init__?1(self, QWidget parent=None, QgsMapCanvas mapCanvas=None) @@ -7039,7 +7039,7 @@ qgis.gui.QgsMapTip?1() qgis.gui.QgsMapTip.__init__?1(self) qgis.gui.QgsMapTip?1(QgsMapTip) qgis.gui.QgsMapTip.__init__?1(self, QgsMapTip) -qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPoint, QPoint, QgsMapCanvas) +qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPointXY, QPoint, QgsMapCanvas) qgis.gui.QgsMapTip.clear?4(QgsMapCanvas) qgis.gui.QgsMapTool?1(QgsMapCanvas) qgis.gui.QgsMapTool.__init__?1(self, QgsMapCanvas) @@ -7072,7 +7072,7 @@ qgis.gui.QgsMapToolEmitPoint.__init__?1(self, QgsMapCanvas) qgis.gui.QgsMapToolEmitPoint.canvasMoveEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasPressEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasReleaseEvent?4(QMouseEvent) -qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPoint, Qt.MouseButton) +qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPointXY, Qt.MouseButton) qgis.gui.QgsMapToolIdentify.LayerType?10 qgis.gui.QgsMapToolIdentify.AllLayers?10 qgis.gui.QgsMapToolIdentify.VectorLayer?10 @@ -7394,11 +7394,11 @@ qgis.gui.QgsRubberBand.setLineStyle?4(Qt.PenStyle) qgis.gui.QgsRubberBand.setBrushStyle?4(Qt.BrushStyle) qgis.gui.QgsRubberBand.reset?4(QGis.GeometryType geometryType=QGis.Line) qgis.gui.QgsRubberBand.reset?4(bool) -qgis.gui.QgsRubberBand.addPoint?4(QgsPoint, bool update=True, int geometryIndex=0) +qgis.gui.QgsRubberBand.addPoint?4(QgsPointXY, bool update=True, int geometryIndex=0) qgis.gui.QgsRubberBand.removePoint?4(int index=0, bool doUpdate=True, int geometryIndex=0) qgis.gui.QgsRubberBand.removeLastPoint?4(int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(QgsPoint, int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(int, QgsPoint, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(QgsPointXY, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(int, QgsPointXY, int geometryIndex=0) qgis.gui.QgsRubberBand.setToGeometry?4(QgsGeometry, QgsVectorLayer) qgis.gui.QgsRubberBand.setToCanvasRectangle?4(QRect) qgis.gui.QgsRubberBand.addGeometry?4(QgsGeometry, QgsVectorLayer) @@ -8668,13 +8668,13 @@ qgis.networkanalysis.QgsGraphBuilderInterface.coordinateTransformationEnabled?4( qgis.networkanalysis.QgsGraphBuilderInterface.topologyTolerance?4() -> float qgis.networkanalysis.QgsGraphBuilderInterface.distanceArea?4() -> QgsDistanceArea qgis.networkanalysis.QgsGraphBuilderInterface.addVertex?4(int, QgsPoint) -qgis.networkanalysis.QgsGraphBuilderInterface.addArc?4(int, QgsPoint, int, QgsPoint, list-of-QVariant) +qgis.networkanalysis.QgsGraphBuilderInterface.addArc?4(int, QgsPointXY, int, QgsPointXY, list-of-QVariant) qgis.networkanalysis.QgsGraphBuilder?1(QgsCoordinateReferenceSystem, bool otfEnabled=True, float topologyTolerance=0, QString ellipsoidID="WGS84") qgis.networkanalysis.QgsGraphBuilder.__init__?1(self, QgsCoordinateReferenceSystem, bool otfEnabled=True, float topologyTolerance=0, QString ellipsoidID="WGS84") qgis.networkanalysis.QgsGraphBuilder?1(QgsGraphBuilder) qgis.networkanalysis.QgsGraphBuilder.__init__?1(self, QgsGraphBuilder) qgis.networkanalysis.QgsGraphBuilder.addVertex?4(int, QgsPoint) -qgis.networkanalysis.QgsGraphBuilder.addArc?4(int, QgsPoint, int, QgsPoint, list-of-QVariant) +qgis.networkanalysis.QgsGraphBuilder.addArc?4(int, QgsPointXY, int, QgsPointXY, list-of-QVariant) qgis.networkanalysis.QgsGraphBuilder.graph?4() -> QgsGraph qgis.networkanalysis.QgsGraphDirector?1() qgis.networkanalysis.QgsGraphDirector.__init__?1(self) diff --git a/python/qsci_apis/PyQGIS-2.2.api b/python/qsci_apis/PyQGIS-2.2.api index eb7867ae320..b61e02eb08c 100644 --- a/python/qsci_apis/PyQGIS-2.2.api +++ b/python/qsci_apis/PyQGIS-2.2.api @@ -498,7 +498,7 @@ qgis.core.QgsCoordinateTransform.setSourceCrs?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.setDestCRS?4(QgsCoordinateReferenceSystem) qgis.core.QgsCoordinateTransform.sourceCrs?4() -> QgsCoordinateReferenceSystem qgis.core.QgsCoordinateTransform.destCRS?4() -> QgsCoordinateReferenceSystem -qgis.core.QgsCoordinateTransform.transform?4(QgsPoint, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint +qgis.core.QgsCoordinateTransform.transform?4(QgsPointXY, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transform?4(float, float, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsPoint qgis.core.QgsCoordinateTransform.transformBoundingBox?4(QgsRectangle, QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> QgsRectangle qgis.core.QgsCoordinateTransform.transformInPlace?4(QgsCoordinateTransform.TransformDirection direction=QgsCoordinateTransform.ForwardTransform) -> (float, float, float) @@ -775,9 +775,9 @@ qgis.core.QgsDistanceArea.ellipsoidInverseFlattening?4() -> float qgis.core.QgsDistanceArea.measure?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measurePerimeter?4(QgsGeometry) -> float qgis.core.QgsDistanceArea.measureLine?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.measureLine?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.measureLine?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.measurePolygon?4(list-of-QgsPoint) -> float -qgis.core.QgsDistanceArea.bearing?4(QgsPoint, QgsPoint) -> float +qgis.core.QgsDistanceArea.bearing?4(QgsPointXY, QgsPoint) -> float qgis.core.QgsDistanceArea.textUnit?4(float, int, QGis.UnitType, bool, bool keepBaseUnit=False) -> QString qgis.core.QgsDistanceArea.convertMeasurement?4(float, QGis.UnitType, QGis.UnitType, bool) -> (float, QGis.UnitType) qgis.core.QgsErrorMessage.Format?10 @@ -1188,21 +1188,21 @@ qgis.core.QgsGeometry.isGeosEmpty?4() -> bool qgis.core.QgsGeometry.area?4() -> float qgis.core.QgsGeometry.length?4() -> float qgis.core.QgsGeometry.distance?4(QgsGeometry) -> float -qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPoint, int, int, int, float) +qgis.core.QgsGeometry.closestVertex?4(QgsPoint) -> (QgsPointXY, int, int, int, float) qgis.core.QgsGeometry.adjacentVertices?4(int) -> (int, int) qgis.core.QgsGeometry.insertVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.moveVertex?4(float, float, int) -> bool qgis.core.QgsGeometry.deleteVertex?4(int) -> bool qgis.core.QgsGeometry.vertexAt?4(int) -> QgsPoint -qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPoint, int) -> float +qgis.core.QgsGeometry.sqrDistToVertexAt?4(QgsPointXY, int) -> float qgis.core.QgsGeometry.closestVertexWithContext?4(QgsPoint) -> (float, int) -qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPoint, int) +qgis.core.QgsGeometry.closestSegmentWithContext?4(QgsPoint) -> (float, QgsPointXY, int) qgis.core.QgsGeometry.addRing?4(list-of-QgsPoint) -> int -qgis.core.QgsGeometry.addPart?4(list-of-QgsPoint, QGis.GeometryType geomType=QGis.UnknownGeometry) -> int +qgis.core.QgsGeometry.addPart?4(list-of-QgsPointXY, QGis.GeometryType geomType=QGis.UnknownGeometry) -> int qgis.core.QgsGeometry.addPartGeometry?4(QgsGeometry) -> int qgis.core.QgsGeometry.translate?4(float, float) -> int qgis.core.QgsGeometry.transform?4(QgsCoordinateTransform) -> int -qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPoint, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) +qgis.core.QgsGeometry.splitGeometry?4(list-of-QgsPointXY, bool) -> (int, list-of-QgsGeometry, list-of-QgsPoint) qgis.core.QgsGeometry.reshapeGeometry?4(list-of-QgsPoint) -> int qgis.core.QgsGeometry.makeDifference?4(QgsGeometry) -> int qgis.core.QgsGeometry.boundingBox?4() -> QgsRectangle @@ -1593,8 +1593,8 @@ qgis.core.QgsLabelPosition.layerID?7 qgis.core.QgsLabelPosition.rotation?7 qgis.core.QgsLabelPosition.upsideDown?7 qgis.core.QgsLabelPosition.width?7 -qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) -qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPoint, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) +qgis.core.QgsLabelPosition?1(int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) +qgis.core.QgsLabelPosition.__init__?1(self, int, float, list-of-QgsPointXY, QgsRectangle, float, float, QString, QString, QFont, bool, bool diagram=False, bool pinned=False) qgis.core.QgsLabelPosition?1() qgis.core.QgsLabelPosition.__init__?1(self) qgis.core.QgsLabelPosition?1(QgsLabelPosition) @@ -2207,7 +2207,7 @@ qgis.core.QgsPoint.sqrDist?4(QgsPoint) -> float qgis.core.QgsPoint.sqrDistToSegment?4(float, float, float, float, float epsilon=DEFAULT_SEGMENT_EPSILON) -> (float, QgsPoint) qgis.core.QgsPoint.azimuth?4(QgsPoint) -> float qgis.core.QgsPoint.multiply?4(float) -qgis.core.QgsPoint.onSegment?4(QgsPoint, QgsPoint) -> int +qgis.core.QgsPoint.onSegment?4(QgsPointXY, QgsPoint) -> int qgis.core.QgsProject.instance?4() -> QgsProject qgis.core.QgsProject.title?4(QString) qgis.core.QgsProject.title?4() -> QString @@ -2376,13 +2376,13 @@ qgis.core.QgsPythonRunner.runCommand?4(QString, QString messageOnError=QString() qgis.core.QgsPythonRunner.evalCommand?4(QString, QString) -> bool qgis.core.QgsRectangle?1(float xmin=0, float ymin=0, float xmax=0, float ymax=0) qgis.core.QgsRectangle.__init__?1(self, float xmin=0, float ymin=0, float xmax=0, float ymax=0) -qgis.core.QgsRectangle?1(QgsPoint, QgsPoint) -qgis.core.QgsRectangle.__init__?1(self, QgsPoint, QgsPoint) +qgis.core.QgsRectangle?1(QgsPointXY, QgsPoint) +qgis.core.QgsRectangle.__init__?1(self, QgsPointXY, QgsPoint) qgis.core.QgsRectangle?1(QRectF) qgis.core.QgsRectangle.__init__?1(self, QRectF) qgis.core.QgsRectangle?1(QgsRectangle) qgis.core.QgsRectangle.__init__?1(self, QgsRectangle) -qgis.core.QgsRectangle.set?4(QgsPoint, QgsPoint) +qgis.core.QgsRectangle.set?4(QgsPointXY, QgsPoint) qgis.core.QgsRectangle.set?4(float, float, float, float) qgis.core.QgsRectangle.setXMinimum?4(float) qgis.core.QgsRectangle.setXMaximum?4(float) @@ -2397,7 +2397,7 @@ qgis.core.QgsRectangle.normalize?4() qgis.core.QgsRectangle.width?4() -> float qgis.core.QgsRectangle.height?4() -> float qgis.core.QgsRectangle.center?4() -> QgsPoint -qgis.core.QgsRectangle.scale?4(float, QgsPoint c=None) +qgis.core.QgsRectangle.scale?4(float, QgsPointXY c=None) qgis.core.QgsRectangle.scale?4(float, float, float) qgis.core.QgsRectangle.buffer?4(float) -> QgsRectangle qgis.core.QgsRectangle.intersect?4(QgsRectangle) -> QgsRectangle @@ -2563,7 +2563,7 @@ qgis.core.QgsSnapper?1(QgsMapRenderer) qgis.core.QgsSnapper.__init__?1(self, QgsMapRenderer) qgis.core.QgsSnapper?1(QgsSnapper) qgis.core.QgsSnapper.__init__?1(self, QgsSnapper) -qgis.core.QgsSnapper.snapPoint?4(QPoint, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.core.QgsSnapper.snapPoint?4(QPoint, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) qgis.core.QgsSnapper.setSnapLayers?4(list-of-QgsSnapper.SnapLayer) qgis.core.QgsSnapper.setSnapMode?4(QgsSnapper.SnappingMode) qgis.core.QgsSnapper.SnapLayer.mLayer?7 @@ -2581,7 +2581,7 @@ qgis.core.QgsSpatialIndex.__init__?1(self, QgsSpatialIndex) qgis.core.QgsSpatialIndex.insertFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.deleteFeature?4(QgsFeature) -> bool qgis.core.QgsSpatialIndex.intersects?4(QgsRectangle) -> unknown-type -qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPoint, int) -> unknown-type +qgis.core.QgsSpatialIndex.nearestNeighbor?4(QgsPointXY, int) -> unknown-type qgis.core.QgsTolerance.UnitType?10 qgis.core.QgsTolerance.MapUnits?10 qgis.core.QgsTolerance.Pixels?10 @@ -2884,8 +2884,8 @@ qgis.core.QgsVectorLayer.deleteSelectedFeatures?4() -> bool qgis.core.QgsVectorLayer.addRing?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.addPart?4(list-of-QgsPoint) -> int qgis.core.QgsVectorLayer.translateFeature?4(int, float, float) -> int -qgis.core.QgsVectorLayer.splitParts?4(list-of-QgsPoint, bool topologicalEditing=False) -> int -qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPoint, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayer.splitParts?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayer.splitFeatures?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int qgis.core.QgsVectorLayer.removePolygonIntersections?4(QgsGeometry, unknown-type ignoreFeatures=QgsFeatureIds()) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsGeometry) -> int qgis.core.QgsVectorLayer.addTopologicalPoints?4(QgsPoint) -> int @@ -2895,8 +2895,8 @@ qgis.core.QgsVectorLayer.hasLabelsEnabled?4() -> bool qgis.core.QgsVectorLayer.isEditable?4() -> bool qgis.core.QgsVectorLayer.isReadOnly?4() -> bool qgis.core.QgsVectorLayer.isModified?4() -> bool -qgis.core.QgsVectorLayer.snapPoint?4(QgsPoint, float) -> bool -qgis.core.QgsVectorLayer.snapWithContext?4(QgsPoint, float, QgsSnapper.SnappingType) -> (int, unknown-type) +qgis.core.QgsVectorLayer.snapPoint?4(QgsPointXY, float) -> bool +qgis.core.QgsVectorLayer.snapWithContext?4(QgsPointXY, float, QgsSnapper.SnappingType) -> (int, unknown-type) qgis.core.QgsVectorLayer.reload?4() qgis.core.QgsVectorLayer.draw?4(QgsRenderContext) -> bool qgis.core.QgsVectorLayer.drawLabels?4(QgsRenderContext) @@ -3281,10 +3281,10 @@ qgis.core.QgsVectorLayerEditUtils.insertVertex?4(float, float, int, int) -> bool qgis.core.QgsVectorLayerEditUtils.moveVertex?4(float, float, int, int) -> bool qgis.core.QgsVectorLayerEditUtils.deleteVertex?4(int, int) -> bool qgis.core.QgsVectorLayerEditUtils.addRing?4(list-of-QgsPoint) -> int -qgis.core.QgsVectorLayerEditUtils.addPart?4(list-of-QgsPoint, int) -> int +qgis.core.QgsVectorLayerEditUtils.addPart?4(list-of-QgsPointXY, int) -> int qgis.core.QgsVectorLayerEditUtils.translateFeature?4(int, float, float) -> int -qgis.core.QgsVectorLayerEditUtils.splitParts?4(list-of-QgsPoint, bool topologicalEditing=False) -> int -qgis.core.QgsVectorLayerEditUtils.splitFeatures?4(list-of-QgsPoint, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayerEditUtils.splitParts?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int +qgis.core.QgsVectorLayerEditUtils.splitFeatures?4(list-of-QgsPointXY, bool topologicalEditing=False) -> int qgis.core.QgsVectorLayerEditUtils.addTopologicalPoints?4(QgsGeometry) -> int qgis.core.QgsVectorLayerEditUtils.addTopologicalPoints?4(QgsPoint) -> int qgis.core.QgsVectorLayerEditUtils.insertSegmentVerticesForSnap?4(list-of-QgsSnappingResult) -> int @@ -4935,7 +4935,7 @@ qgis.core.QgsRasterDataProvider.buildPyramids?4(list-of-QgsRasterPyramid, QStrin qgis.core.QgsRasterDataProvider.buildPyramidList?4(list-of-int overviewList=QList<int>()) -> list-of-QgsRasterPyramid qgis.core.QgsRasterDataProvider.hasPyramids?4() -> bool qgis.core.QgsRasterDataProvider.metadata?4() -> QString -qgis.core.QgsRasterDataProvider.identify?4(QgsPoint, QgsRaster.IdentifyFormat, QgsRectangle theExtent=QgsRectangle(), int theWidth=0, int theHeight=0) -> QgsRasterIdentifyResult +qgis.core.QgsRasterDataProvider.identify?4(QgsPointXY, QgsRaster.IdentifyFormat, QgsRectangle theExtent=QgsRectangle(), int theWidth=0, int theHeight=0) -> QgsRasterIdentifyResult qgis.core.QgsRasterDataProvider.lastErrorTitle?4() -> QString qgis.core.QgsRasterDataProvider.lastError?4() -> QString qgis.core.QgsRasterDataProvider.lastErrorFormat?4() -> QString @@ -6955,12 +6955,12 @@ qgis.core.QgsDxfExport.writeGroupCode?4(int) qgis.core.QgsDxfExport.writeInt?4(int) qgis.core.QgsDxfExport.writeDouble?4(float) qgis.core.QgsDxfExport.writeString?4(QString) -qgis.core.QgsDxfExport.writePolyline?4(list-of-QgsPoint, QString, QString, int, float width=-1, bool polygon=False) -qgis.core.QgsDxfExport.writeSolid?4(QString, int, QgsPoint, QgsPoint, QgsPoint, QgsPoint) -qgis.core.QgsDxfExport.writeLine?4(QgsPoint, QgsPoint, QString, QString, int, float width=-1) +qgis.core.QgsDxfExport.writePolyline?4(list-of-QgsPointXY, QString, QString, int, float width=-1, bool polygon=False) +qgis.core.QgsDxfExport.writeSolid?4(QString, int, QgsPointXY, QgsPointXY, QgsPointXY, QgsPoint) +qgis.core.QgsDxfExport.writeLine?4(QgsPointXY, QgsPointXY, QString, QString, int, float width=-1) qgis.core.QgsDxfExport.writePoint?4(QString, int, QgsPoint) -qgis.core.QgsDxfExport.writeCircle?4(QString, int, QgsPoint, float) -qgis.core.QgsDxfExport.writeText?4(QString, QString, QgsPoint, float, float, int) +qgis.core.QgsDxfExport.writeCircle?4(QString, int, QgsPointXY, float) +qgis.core.QgsDxfExport.writeText?4(QString, QString, QgsPointXY, float, float, int) qgis.core.QgsDxfExport.mapUnitScaleFactor?4(float, QgsSymbolV2.OutputUnit, QGis.UnitType) -> float qgis.core.QgsDxfExport.dxfLayerName?4(QString) -> QString qgis.gui.QgsBlendModeComboBox?1(QWidget parent=None) @@ -7731,8 +7731,8 @@ qgis.gui.QgsMapCanvasSnapper?1() qgis.gui.QgsMapCanvasSnapper.__init__?1(self) qgis.gui.QgsMapCanvasSnapper?1(QgsMapCanvasSnapper) qgis.gui.QgsMapCanvasSnapper.__init__?1(self, QgsMapCanvasSnapper) -qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) -qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPoint excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToCurrentLayer?4(QPoint, QgsSnapper.SnappingType, float snappingTol=-1, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) +qgis.gui.QgsMapCanvasSnapper.snapToBackgroundLayers?4(QPoint, list-of-QgsPointXY excludePoints=QList<QgsPoint>()) -> (int, list-of-QgsSnappingResult) qgis.gui.QgsMapCanvasSnapper.setMapCanvas?4(QgsMapCanvas) qgis.gui.QgsMapLayerAction?1(QString, QObject) qgis.gui.QgsMapLayerAction.__init__?1(self, QString, QObject) @@ -7775,7 +7775,7 @@ qgis.gui.QgsMapTip?1() qgis.gui.QgsMapTip.__init__?1(self) qgis.gui.QgsMapTip?1(QgsMapTip) qgis.gui.QgsMapTip.__init__?1(self, QgsMapTip) -qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPoint, QPoint, QgsMapCanvas) +qgis.gui.QgsMapTip.showMapTip?4(QgsMapLayer, QgsPointXY, QPoint, QgsMapCanvas) qgis.gui.QgsMapTip.clear?4(QgsMapCanvas) qgis.gui.QgsMapTool?1(QgsMapCanvas) qgis.gui.QgsMapTool.__init__?1(self, QgsMapCanvas) @@ -7808,7 +7808,7 @@ qgis.gui.QgsMapToolEmitPoint.__init__?1(self, QgsMapCanvas) qgis.gui.QgsMapToolEmitPoint.canvasMoveEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasPressEvent?4(QMouseEvent) qgis.gui.QgsMapToolEmitPoint.canvasReleaseEvent?4(QMouseEvent) -qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPoint, Qt.MouseButton) +qgis.gui.QgsMapToolEmitPoint.canvasClicked?4(QgsPointXY, Qt.MouseButton) qgis.gui.QgsMapToolIdentify.LayerType?10 qgis.gui.QgsMapToolIdentify.AllLayers?10 qgis.gui.QgsMapToolIdentify.VectorLayer?10 @@ -8135,11 +8135,11 @@ qgis.gui.QgsRubberBand.setLineStyle?4(Qt.PenStyle) qgis.gui.QgsRubberBand.setBrushStyle?4(Qt.BrushStyle) qgis.gui.QgsRubberBand.reset?4(QGis.GeometryType geometryType=QGis.Line) qgis.gui.QgsRubberBand.reset?4(bool) -qgis.gui.QgsRubberBand.addPoint?4(QgsPoint, bool doUpdate=True, int geometryIndex=0) +qgis.gui.QgsRubberBand.addPoint?4(QgsPointXY, bool doUpdate=True, int geometryIndex=0) qgis.gui.QgsRubberBand.removePoint?4(int index=0, bool doUpdate=True, int geometryIndex=0) qgis.gui.QgsRubberBand.removeLastPoint?4(int geometryIndex=0, bool doUpdate=True) -qgis.gui.QgsRubberBand.movePoint?4(QgsPoint, int geometryIndex=0) -qgis.gui.QgsRubberBand.movePoint?4(int, QgsPoint, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(QgsPointXY, int geometryIndex=0) +qgis.gui.QgsRubberBand.movePoint?4(int, QgsPointXY, int geometryIndex=0) qgis.gui.QgsRubberBand.partSize?4(int) -> int qgis.gui.QgsRubberBand.setToGeometry?4(QgsGeometry, QgsVectorLayer) qgis.gui.QgsRubberBand.setToCanvasRectangle?4(QRect) @@ -9536,13 +9536,13 @@ qgis.networkanalysis.QgsGraphBuilderInterface.coordinateTransformationEnabled?4( qgis.networkanalysis.QgsGraphBuilderInterface.topologyTolerance?4() -> float qgis.networkanalysis.QgsGraphBuilderInterface.distanceArea?4() -> QgsDistanceArea qgis.networkanalysis.QgsGraphBuilderInterface.addVertex?4(int, QgsPoint) -qgis.networkanalysis.QgsGraphBuilderInterface.addArc?4(int, QgsPoint, int, QgsPoint, list-of-QVariant) +qgis.networkanalysis.QgsGraphBuilderInterface.addArc?4(int, QgsPointXY, int, QgsPointXY, list-of-QVariant) qgis.networkanalysis.QgsGraphBuilder?1(QgsCoordinateReferenceSystem, bool otfEnabled=True, float topologyTolerance=0, QString ellipsoidID="WGS84") qgis.networkanalysis.QgsGraphBuilder.__init__?1(self, QgsCoordinateReferenceSystem, bool otfEnabled=True, float topologyTolerance=0, QString ellipsoidID="WGS84") qgis.networkanalysis.QgsGraphBuilder?1(QgsGraphBuilder) qgis.networkanalysis.QgsGraphBuilder.__init__?1(self, QgsGraphBuilder) qgis.networkanalysis.QgsGraphBuilder.addVertex?4(int, QgsPoint) -qgis.networkanalysis.QgsGraphBuilder.addArc?4(int, QgsPoint, int, QgsPoint, list-of-QVariant) +qgis.networkanalysis.QgsGraphBuilder.addArc?4(int, QgsPointXY, int, QgsPointXY, list-of-QVariant) qgis.networkanalysis.QgsGraphBuilder.graph?4() -> QgsGraph qgis.networkanalysis.QgsGraphDirector?1() qgis.networkanalysis.QgsGraphDirector.__init__?1(self) diff --git a/src/analysis/interpolation/DualEdgeTriangulation.cc b/src/analysis/interpolation/DualEdgeTriangulation.cc index c8d31bcbd55..4c8ac1f76af 100644 --- a/src/analysis/interpolation/DualEdgeTriangulation.cc +++ b/src/analysis/interpolation/DualEdgeTriangulation.cc @@ -3136,8 +3136,8 @@ bool DualEdgeTriangulation::saveAsShapefile( const QString &fileName ) const Point3D *p1 = mPointVector[currentEdge->getPoint()]; Point3D *p2 = mPointVector[mHalfEdge[currentEdge->getDual()]->getPoint()]; QgsPolyline lineGeom; - lineGeom.push_back( QgsPoint( p1->getX(), p1->getY() ) ); - lineGeom.push_back( QgsPoint( p2->getX(), p2->getY() ) ); + lineGeom.push_back( QgsPointXY( p1->getX(), p1->getY() ) ); + lineGeom.push_back( QgsPointXY( p2->getX(), p2->getY() ) ); edgeLineFeature.setGeometry( QgsGeometry::fromPolyline( lineGeom ) ); edgeLineFeature.initAttributes( 1 ); diff --git a/src/analysis/interpolation/qgstininterpolator.cpp b/src/analysis/interpolation/qgstininterpolator.cpp index 5ae04eb131d..cd08818a212 100644 --- a/src/analysis/interpolation/qgstininterpolator.cpp +++ b/src/analysis/interpolation/qgstininterpolator.cpp @@ -198,7 +198,7 @@ int QgsTINInterpolator::insertData( QgsFeature *f, bool zCoord, int attr, InputT } } - //parse WKB. It is ugly, but we cannot use the methods with QgsPoint because they don't contain z-values for 25D types + //parse WKB. It is ugly, but we cannot use the methods with QgsPointXY because they don't contain z-values for 25D types bool hasZValue = false; double x, y, z; QByteArray wkb( g.exportToWkb() ); diff --git a/src/analysis/network/qgsgraph.cpp b/src/analysis/network/qgsgraph.cpp index f3b6e3bf488..07b072d22db 100644 --- a/src/analysis/network/qgsgraph.cpp +++ b/src/analysis/network/qgsgraph.cpp @@ -24,7 +24,7 @@ QgsGraph::QgsGraph() { } -int QgsGraph::addVertex( const QgsPoint &pt ) +int QgsGraph::addVertex( const QgsPointXY &pt ) { mGraphVertexes.append( QgsGraphVertex( pt ) ); return mGraphVertexes.size() - 1; @@ -66,7 +66,7 @@ int QgsGraph::edgeCount() const return mGraphEdges.size(); } -int QgsGraph::findVertex( const QgsPoint &pt ) const +int QgsGraph::findVertex( const QgsPointXY &pt ) const { int i = 0; for ( i = 0; i < mGraphVertexes.size(); ++i ) @@ -106,7 +106,7 @@ int QgsGraphEdge::outVertex() const return mOut; } -QgsGraphVertex::QgsGraphVertex( const QgsPoint &point ) +QgsGraphVertex::QgsGraphVertex( const QgsPointXY &point ) : mCoordinate( point ) { @@ -122,7 +122,7 @@ QgsGraphEdgeIds QgsGraphVertex::inEdges() const return mInEdges; } -QgsPoint QgsGraphVertex::point() const +QgsPointXY QgsGraphVertex::point() const { return mCoordinate; } diff --git a/src/analysis/network/qgsgraph.h b/src/analysis/network/qgsgraph.h index 9b30312471f..871e5e6b649 100644 --- a/src/analysis/network/qgsgraph.h +++ b/src/analysis/network/qgsgraph.h @@ -97,7 +97,7 @@ class ANALYSIS_EXPORT QgsGraphVertex * This constructor initializes QgsGraphVertex object and associates a vertex with a point */ - QgsGraphVertex( const QgsPoint &point ); + QgsGraphVertex( const QgsPointXY &point ); /** * Returns outgoing edges ids @@ -112,10 +112,10 @@ class ANALYSIS_EXPORT QgsGraphVertex /** * Returns point associated with graph vertex */ - QgsPoint point() const; + QgsPointXY point() const; private: - QgsPoint mCoordinate; + QgsPointXY mCoordinate; QgsGraphEdgeIds mOutEdges; QgsGraphEdgeIds mInEdges; @@ -138,7 +138,7 @@ class ANALYSIS_EXPORT QgsGraph /** * Add a vertex to the graph */ - int addVertex( const QgsPoint &pt ); + int addVertex( const QgsPointXY &pt ); /** * Add an edge to the graph @@ -169,7 +169,7 @@ class ANALYSIS_EXPORT QgsGraph * Find vertex by associated point * \returns vertex index */ - int findVertex( const QgsPoint &pt ) const; + int findVertex( const QgsPointXY &pt ) const; private: QVector mGraphVertexes; diff --git a/src/analysis/network/qgsgraphbuilder.cpp b/src/analysis/network/qgsgraphbuilder.cpp index d699ded57f0..250388fe715 100644 --- a/src/analysis/network/qgsgraphbuilder.cpp +++ b/src/analysis/network/qgsgraphbuilder.cpp @@ -35,12 +35,12 @@ QgsGraphBuilder::~QgsGraphBuilder() delete mGraph; } -void QgsGraphBuilder::addVertex( int, const QgsPoint &pt ) +void QgsGraphBuilder::addVertex( int, const QgsPointXY &pt ) { mGraph->addVertex( pt ); } -void QgsGraphBuilder::addEdge( int pt1id, const QgsPoint &, int pt2id, const QgsPoint &, const QVector< QVariant > &prop ) +void QgsGraphBuilder::addEdge( int pt1id, const QgsPointXY &, int pt2id, const QgsPointXY &, const QVector< QVariant > &prop ) { mGraph->addEdge( pt1id, pt2id, prop ); } diff --git a/src/analysis/network/qgsgraphbuilder.h b/src/analysis/network/qgsgraphbuilder.h index 94a104f6a43..bc0fc85b12b 100644 --- a/src/analysis/network/qgsgraphbuilder.h +++ b/src/analysis/network/qgsgraphbuilder.h @@ -47,9 +47,9 @@ class ANALYSIS_EXPORT QgsGraphBuilder : public QgsGraphBuilderInterface /* * MANDATORY BUILDER PROPERTY DECLARATION */ - virtual void addVertex( int id, const QgsPoint &pt ) override; + virtual void addVertex( int id, const QgsPointXY &pt ) override; - virtual void addEdge( int pt1id, const QgsPoint &pt1, int pt2id, const QgsPoint &pt2, const QVector< QVariant > &prop ) override; + virtual void addEdge( int pt1id, const QgsPointXY &pt1, int pt2id, const QgsPointXY &pt2, const QVector< QVariant > &prop ) override; /** * Returns generated QgsGraph diff --git a/src/analysis/network/qgsgraphbuilderinterface.h b/src/analysis/network/qgsgraphbuilderinterface.h index 274303be466..45580da5905 100644 --- a/src/analysis/network/qgsgraphbuilderinterface.h +++ b/src/analysis/network/qgsgraphbuilderinterface.h @@ -99,7 +99,7 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface * \param pt vertex coordinates * \note id and pt are redundant. You can use pt or id to identify the vertex */ - virtual void addVertex( int id, const QgsPoint &pt ) + virtual void addVertex( int id, const QgsPointXY &pt ) { Q_UNUSED( id ); Q_UNUSED( pt ); @@ -114,7 +114,7 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface * \param strategies optimization strategies * \note pt1id, pt1 and pt2id, pt2 is a redundant interface. You can use vertex coordinates or their identificators. */ - virtual void addEdge( int pt1id, const QgsPoint &pt1, int pt2id, const QgsPoint &pt2, const QVector< QVariant > &strategies ) + virtual void addEdge( int pt1id, const QgsPointXY &pt1, int pt2id, const QgsPointXY &pt2, const QVector< QVariant > &strategies ) { Q_UNUSED( pt1id ); Q_UNUSED( pt1 ); diff --git a/src/analysis/network/qgsgraphdirector.h b/src/analysis/network/qgsgraphdirector.h index 10e628cd219..0c0055dbbf5 100644 --- a/src/analysis/network/qgsgraphdirector.h +++ b/src/analysis/network/qgsgraphdirector.h @@ -69,11 +69,11 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject * \param builder the graph builder * \param additionalPoints list of points that should be snapped to the graph * \param snappedPoints list of snapped points - * \note if snappedPoints[i] == QgsPoint(0.0,0.0) then snapping failed. + * \note if snappedPoints[i] == QgsPointXY(0.0,0.0) then snapping failed. */ virtual void makeGraph( QgsGraphBuilderInterface *builder, - const QVector< QgsPoint > &additionalPoints, - QVector< QgsPoint > &snappedPoints SIP_OUT ) const + const QVector< QgsPointXY > &additionalPoints, + QVector< QgsPointXY > &snappedPoints SIP_OUT ) const { Q_UNUSED( builder ); Q_UNUSED( additionalPoints ); diff --git a/src/analysis/network/qgsvectorlayerdirector.cpp b/src/analysis/network/qgsvectorlayerdirector.cpp index 214ff9492c5..afe4c9b0d14 100644 --- a/src/analysis/network/qgsvectorlayerdirector.cpp +++ b/src/analysis/network/qgsvectorlayerdirector.cpp @@ -42,7 +42,7 @@ class QgsPointCompare : mTolerance( tolerance ) { } - bool operator()( const QgsPoint &p1, const QgsPoint &p2 ) const + bool operator()( const QgsPointXY &p1, const QgsPointXY &p2 ) const { if ( mTolerance <= 0 ) return p1.x() == p2.x() ? p1.y() < p2.y() : p1.x() < p2.x(); @@ -88,10 +88,10 @@ template RandIter my_bin struct TiePointInfo { - QgsPoint mTiedPoint; + QgsPointXY mTiedPoint; double mLength; - QgsPoint mFirstPoint; - QgsPoint mLastPoint; + QgsPointXY mFirstPoint; + QgsPointXY mLastPoint; }; bool TiePointInfoCompare( const TiePointInfo &a, const TiePointInfo &b ) @@ -123,8 +123,8 @@ QString QgsVectorLayerDirector::name() const return QStringLiteral( "Vector line" ); } -void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QVector< QgsPoint > &additionalPoints, - QVector< QgsPoint > &snappedPoints ) const +void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QVector< QgsPointXY > &additionalPoints, + QVector< QgsPointXY > &snappedPoints ) const { QgsVectorLayer *vl = mVectorLayer; @@ -145,7 +145,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const ct.setDestinationCrs( vl->crs() ); } - snappedPoints = QVector< QgsPoint >( additionalPoints.size(), QgsPoint( 0.0, 0.0 ) ); + snappedPoints = QVector< QgsPointXY >( additionalPoints.size(), QgsPointXY( 0.0, 0.0 ) ); TiePointInfo tmpInfo; tmpInfo.mLength = std::numeric_limits::infinity(); @@ -154,7 +154,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QVector< TiePointInfo >::iterator pointLengthIt; //Graph's points; - QVector< QgsPoint > points; + QVector< QgsPointXY > points; QgsFeatureIterator fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QgsAttributeList() ) ); @@ -172,7 +172,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QgsMultiPolyline::iterator mplIt; for ( mplIt = mpl.begin(); mplIt != mpl.end(); ++mplIt ) { - QgsPoint pt1, pt2; + QgsPointXY pt1, pt2; bool isFirstPoint = true; QgsPolyline::iterator pointIt; for ( pointIt = mplIt->begin(); pointIt != mplIt->end(); ++pointIt ) @@ -220,7 +220,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const int i = 0; for ( i = 0; i < snappedPoints.size(); ++i ) { - if ( snappedPoints[ i ] != QgsPoint( 0.0, 0.0 ) ) + if ( snappedPoints[ i ] != QgsPointXY( 0.0, 0.0 ) ) { points.push_back( snappedPoints [ i ] ); } @@ -229,7 +229,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QgsPointCompare pointCompare( builder->topologyTolerance() ); std::sort( points.begin(), points.end(), pointCompare ); - QVector< QgsPoint >::iterator tmp = std::unique( points.begin(), points.end() ); + QVector< QgsPointXY >::iterator tmp = std::unique( points.begin(), points.end() ); points.resize( tmp - points.begin() ); for ( i = 0; i < points.size(); ++i ) @@ -306,7 +306,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const QgsMultiPolyline::iterator mplIt; for ( mplIt = mpl.begin(); mplIt != mpl.end(); ++mplIt ) { - QgsPoint pt1, pt2; + QgsPointXY pt1, pt2; bool isFirstPoint = true; QgsPolyline::iterator pointIt; @@ -316,7 +316,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const if ( !isFirstPoint ) { - QMap< double, QgsPoint > pointsOnArc; + QMap< double, QgsPointXY > pointsOnArc; pointsOnArc[ 0.0 ] = pt1; pointsOnArc[ pt1.sqrDist( pt2 )] = pt2; @@ -345,9 +345,9 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const } } - QMap< double, QgsPoint >::iterator pointsIt; - QgsPoint pt1; - QgsPoint pt2; + QMap< double, QgsPointXY >::iterator pointsIt; + QgsPointXY pt1; + QgsPointXY pt2; int pt1idx = -1, pt2idx = -1; bool isFirstPoint = true; for ( pointsIt = pointsOnArc.begin(); pointsIt != pointsOnArc.end(); ++pointsIt ) @@ -389,4 +389,4 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const } emit buildProgress( ++step, featureCount ); } // while( vl->nextFeature(feature) ) -} // makeGraph( QgsGraphBuilderInterface *builder, const QVector< QgsPoint >& additionalPoints, QVector< QgsPoint >& tiedPoint ) +} // makeGraph( QgsGraphBuilderInterface *builder, const QVector< QgsPointXY >& additionalPoints, QVector< QgsPointXY >& tiedPoint ) diff --git a/src/analysis/network/qgsvectorlayerdirector.h b/src/analysis/network/qgsvectorlayerdirector.h index 69701f80a4a..f257fb40439 100644 --- a/src/analysis/network/qgsvectorlayerdirector.h +++ b/src/analysis/network/qgsvectorlayerdirector.h @@ -73,8 +73,8 @@ class ANALYSIS_EXPORT QgsVectorLayerDirector : public QgsGraphDirector * MANDATORY DIRECTOR PROPERTY DECLARATION */ void makeGraph( QgsGraphBuilderInterface *builder, - const QVector< QgsPoint > &additionalPoints, - QVector< QgsPoint> &snappedPoints SIP_OUT ) const override; + const QVector< QgsPointXY > &additionalPoints, + QVector< QgsPointXY> &snappedPoints SIP_OUT ) const override; QString name() const override; diff --git a/src/analysis/openstreetmap/qgsosmbase.h b/src/analysis/openstreetmap/qgsosmbase.h index 3e11ca721b4..fef70b2ce2c 100644 --- a/src/analysis/openstreetmap/qgsosmbase.h +++ b/src/analysis/openstreetmap/qgsosmbase.h @@ -72,15 +72,15 @@ class ANALYSIS_EXPORT QgsOSMNode : public QgsOSMElement { public: QgsOSMNode() : mPoint() {} - QgsOSMNode( QgsOSMId id, const QgsPoint &point ) + QgsOSMNode( QgsOSMId id, const QgsPointXY &point ) : QgsOSMElement( QgsOSMElementID::Node, id ) , mPoint( point ) {} - QgsPoint point() const { return mPoint; } + QgsPointXY point() const { return mPoint; } private: - QgsPoint mPoint; + QgsPointXY mPoint; }; diff --git a/src/analysis/openstreetmap/qgsosmdatabase.cpp b/src/analysis/openstreetmap/qgsosmdatabase.cpp index 2c4928f8e8f..26fa97ce35d 100644 --- a/src/analysis/openstreetmap/qgsosmdatabase.cpp +++ b/src/analysis/openstreetmap/qgsosmdatabase.cpp @@ -150,7 +150,7 @@ QgsOSMNode QgsOSMDatabase::node( QgsOSMId id ) const double lon = sqlite3_column_double( mStmtNode, 0 ); double lat = sqlite3_column_double( mStmtNode, 1 ); - QgsOSMNode node( id, QgsPoint( lon, lat ) ); + QgsOSMNode node( id, QgsPointXY( lon, lat ) ); sqlite3_reset( mStmtNode ); return node; @@ -244,7 +244,7 @@ QgsPolyline QgsOSMDatabase::wayPoints( QgsOSMId id ) const return QgsPolyline(); // missing some nodes double lon = sqlite3_column_double( mStmtWayNodePoints, 0 ); double lat = sqlite3_column_double( mStmtWayNodePoints, 1 ); - points.append( QgsPoint( lon, lat ) ); + points.append( QgsPointXY( lon, lat ) ); } sqlite3_reset( mStmtWayNodePoints ); @@ -577,7 +577,7 @@ QgsOSMNode QgsOSMNodeIterator::next() double lon = sqlite3_column_double( mStmt, 1 ); double lat = sqlite3_column_double( mStmt, 2 ); - return QgsOSMNode( id, QgsPoint( lon, lat ) ); + return QgsOSMNode( id, QgsPointXY( lon, lat ) ); } void QgsOSMNodeIterator::close() diff --git a/src/analysis/raster/qgskde.cpp b/src/analysis/raster/qgskde.cpp index 53ea4e73542..f2005c5aaeb 100644 --- a/src/analysis/raster/qgskde.cpp +++ b/src/analysis/raster/qgskde.cpp @@ -119,7 +119,7 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::addFeature( const QgsMultiPoint multiPoints; if ( !featureGeometry.isMultipart() ) { - QgsPoint p = featureGeometry.asPoint(); + QgsPointXY p = featureGeometry.asPoint(); // avoiding any empty points or out of extent points if ( !mBounds.contains( p ) ) return Success; diff --git a/src/analysis/vector/qgsgeometryanalyzer.cpp b/src/analysis/vector/qgsgeometryanalyzer.cpp index 96cd44e4ca5..7093f463949 100644 --- a/src/analysis/vector/qgsgeometryanalyzer.cpp +++ b/src/analysis/vector/qgsgeometryanalyzer.cpp @@ -337,7 +337,7 @@ QList QgsGeometryAnalyzer::simpleMeasure( QgsGeometry &mpGeometry ) double perim; if ( mpGeometry.wkbType() == QgsWkbTypes::Point ) { - QgsPoint pt = mpGeometry.asPoint(); + QgsPointXY pt = mpGeometry.asPoint(); list.append( pt.x() ); list.append( pt.y() ); } @@ -1079,7 +1079,7 @@ QgsGeometry QgsGeometryAnalyzer::createOffsetGeometry( const QgsGeometry &geom, } else if ( geom.type() == QgsWkbTypes::PointGeometry ) { - QgsPoint p = ( *inputGeomIt ).asPoint(); + QgsPointXY p = ( *inputGeomIt ).asPoint(); p = createPointOffset( p.x(), p.y(), offset, lineGeom ); GEOSCoordSequence *ptSeq = GEOSCoordSeq_create_r( geosctxt, 1, 2 ); GEOSCoordSeq_setX_r( geosctxt, ptSeq, 0, p.x() ); @@ -1120,16 +1120,16 @@ QgsGeometry QgsGeometryAnalyzer::createOffsetGeometry( const QgsGeometry &geom, return outGeometry; } -QgsPoint QgsGeometryAnalyzer::createPointOffset( double x, double y, double dist, const QgsGeometry &lineGeom ) const +QgsPointXY QgsGeometryAnalyzer::createPointOffset( double x, double y, double dist, const QgsGeometry &lineGeom ) const { - QgsPoint p( x, y ); - QgsPoint minDistPoint; + QgsPointXY p( x, y ); + QgsPointXY minDistPoint; int afterVertexNr; lineGeom.closestSegmentWithContext( p, minDistPoint, afterVertexNr ); int beforeVertexNr = afterVertexNr - 1; - QgsPoint beforeVertex = lineGeom.vertexAt( beforeVertexNr ); - QgsPoint afterVertex = lineGeom.vertexAt( afterVertexNr ); + QgsPointXY beforeVertex = lineGeom.vertexAt( beforeVertexNr ); + QgsPointXY afterVertex = lineGeom.vertexAt( afterVertexNr ); //get normal vector double dx = afterVertex.x() - beforeVertex.x(); @@ -1142,7 +1142,7 @@ QgsPoint QgsGeometryAnalyzer::createPointOffset( double x, double y, double dist double debugLength = sqrt( normalX * normalX + normalY * normalY ); //control //#spellok Q_UNUSED( debugLength ); - return QgsPoint( x - normalX, y - normalY ); //negative values -> left side, positive values -> right side //#spellok + return QgsPointXY( x - normalX, y - normalY ); //negative values -> left side, positive values -> right side //#spellok } QgsGeometry QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry &lineGeom ) @@ -1243,7 +1243,7 @@ QgsConstWkbPtr QgsGeometryAnalyzer::locateBetweenWkbString( QgsConstWkbPtr wkbPt if ( i > 0 ) { - QgsPoint pt1, pt2; + QgsPointXY pt1, pt2; bool secondPointClipped; //true if second point is != segment endpoint bool measureInSegment = clipSegmentByRange( prevx, prevy, prevz, x, y, z, fromMeasure, toMeasure, pt1, pt2, secondPointClipped ); if ( measureInSegment ) @@ -1289,7 +1289,7 @@ QgsConstWkbPtr QgsGeometryAnalyzer::locateAlongWkbString( QgsConstWkbPtr wkbPtr, if ( i > 0 ) { - QgsPoint pt1, pt2; + QgsPointXY pt1, pt2; bool pt1Ok, pt2Ok; locateAlongSegment( prevx, prevy, prevz, x, y, z, measure, pt1Ok, pt1, pt2Ok, pt2 ); if ( pt1Ok ) @@ -1309,8 +1309,8 @@ QgsConstWkbPtr QgsGeometryAnalyzer::locateAlongWkbString( QgsConstWkbPtr wkbPtr, return wkbPtr; } -bool QgsGeometryAnalyzer::clipSegmentByRange( double x1, double y1, double m1, double x2, double y2, double m2, double range1, double range2, QgsPoint &pt1, - QgsPoint &pt2, bool &secondPointClipped ) +bool QgsGeometryAnalyzer::clipSegmentByRange( double x1, double y1, double m1, double x2, double y2, double m2, double range1, double range2, QgsPointXY &pt1, + QgsPointXY &pt2, bool &secondPointClipped ) { bool reversed = m1 > m2; double tmp; @@ -1402,7 +1402,7 @@ bool QgsGeometryAnalyzer::clipSegmentByRange( double x1, double y1, double m1, d if ( reversed ) //switch p1 and p2 { - QgsPoint tmpPt = pt1; + QgsPointXY tmpPt = pt1; pt1 = pt2; pt2 = tmpPt; } @@ -1410,7 +1410,7 @@ bool QgsGeometryAnalyzer::clipSegmentByRange( double x1, double y1, double m1, d return true; } -void QgsGeometryAnalyzer::locateAlongSegment( double x1, double y1, double m1, double x2, double y2, double m2, double measure, bool &pt1Ok, QgsPoint &pt1, bool &pt2Ok, QgsPoint &pt2 ) +void QgsGeometryAnalyzer::locateAlongSegment( double x1, double y1, double m1, double x2, double y2, double m2, double measure, bool &pt1Ok, QgsPointXY &pt1, bool &pt2Ok, QgsPointXY &pt2 ) { bool reversed = false; pt1Ok = false; diff --git a/src/analysis/vector/qgsgeometryanalyzer.h b/src/analysis/vector/qgsgeometryanalyzer.h index cf5098552d0..e45663a7034 100644 --- a/src/analysis/vector/qgsgeometryanalyzer.h +++ b/src/analysis/vector/qgsgeometryanalyzer.h @@ -152,10 +152,10 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer \param lineGeom the line geometry to which the feature is referenced \param offset the offset value in layer unit. Negative values mean offset towards left, positive values offset to the right side*/ QgsGeometry createOffsetGeometry( const QgsGeometry &geom, const QgsGeometry &lineGeom, double offset ); - QgsPoint createPointOffset( double x, double y, double dist, const QgsGeometry &lineGeom ) const; + QgsPointXY createPointOffset( double x, double y, double dist, const QgsGeometry &lineGeom ) const; QgsConstWkbPtr locateBetweenWkbString( QgsConstWkbPtr ptr, QgsMultiPolyline &result, double fromMeasure, double toMeasure ); QgsConstWkbPtr locateAlongWkbString( QgsConstWkbPtr ptr, QgsMultiPoint &result, double measure ); - static bool clipSegmentByRange( double x1, double y1, double m1, double x2, double y2, double m2, double range1, double range2, QgsPoint &pt1, QgsPoint &pt2, bool &secondPointClipped ); - static void locateAlongSegment( double x1, double y1, double m1, double x2, double y2, double m2, double measure, bool &pt1Ok, QgsPoint &pt1, bool &pt2Ok, QgsPoint &pt2 ); + static bool clipSegmentByRange( double x1, double y1, double m1, double x2, double y2, double m2, double range1, double range2, QgsPointXY &pt1, QgsPointXY &pt2, bool &secondPointClipped ); + static void locateAlongSegment( double x1, double y1, double m1, double x2, double y2, double m2, double measure, bool &pt1Ok, QgsPointXY &pt1, bool &pt2Ok, QgsPointXY &pt2 ); }; #endif //QGSVECTORANALYZER diff --git a/src/analysis/vector/qgsgeometrysnapper.cpp b/src/analysis/vector/qgsgeometrysnapper.cpp index eef0be7c901..4b8a47d83d7 100644 --- a/src/analysis/vector/qgsgeometrysnapper.cpp +++ b/src/analysis/vector/qgsgeometrysnapper.cpp @@ -34,7 +34,7 @@ QgsSnapIndex::PointSnapItem::PointSnapItem( const QgsSnapIndex::CoordIdx *_idx, , idx( _idx ) {} -QgsPointV2 QgsSnapIndex::PointSnapItem::getSnapPoint( const QgsPointV2 &/*p*/ ) const +QgsPoint QgsSnapIndex::PointSnapItem::getSnapPoint( const QgsPoint &/*p*/ ) const { return idx->point(); } @@ -45,14 +45,14 @@ QgsSnapIndex::SegmentSnapItem::SegmentSnapItem( const QgsSnapIndex::CoordIdx *_i , idxTo( _idxTo ) {} -QgsPointV2 QgsSnapIndex::SegmentSnapItem::getSnapPoint( const QgsPointV2 &p ) const +QgsPoint QgsSnapIndex::SegmentSnapItem::getSnapPoint( const QgsPoint &p ) const { return QgsGeometryUtils::projPointOnSegment( p, idxFrom->point(), idxTo->point() ); } -bool QgsSnapIndex::SegmentSnapItem::getIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, QgsPointV2 &inter ) const +bool QgsSnapIndex::SegmentSnapItem::getIntersection( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &inter ) const { - const QgsPointV2 &q1 = idxFrom->point(), & q2 = idxTo->point(); + const QgsPoint &q1 = idxFrom->point(), & q2 = idxTo->point(); QgsVector v( p2.x() - p1.x(), p2.y() - p1.y() ); QgsVector w( q2.x() - q1.x(), q2.y() - q1.y() ); double vl = v.length(); @@ -74,7 +74,7 @@ bool QgsSnapIndex::SegmentSnapItem::getIntersection( const QgsPointV2 &p1, const double dy = q1.y() - p1.y(); double k = ( dy * w.x() - dx * w.y() ) / d; - inter = QgsPointV2( p1.x() + v.x() * k, p1.y() + v.y() * k ); + inter = QgsPoint( p1.x() + v.x() * k, p1.y() + v.y() * k ); double lambdav = QgsVector( inter.x() - p1.x(), inter.y() - p1.y() ) * v; if ( lambdav < 0. + 1E-8 || lambdav > vl - 1E-8 ) @@ -87,10 +87,10 @@ bool QgsSnapIndex::SegmentSnapItem::getIntersection( const QgsPointV2 &p1, const return true; } -bool QgsSnapIndex::SegmentSnapItem::getProjection( const QgsPointV2 &p, QgsPointV2 &pProj ) +bool QgsSnapIndex::SegmentSnapItem::getProjection( const QgsPoint &p, QgsPoint &pProj ) { - const QgsPointV2 &s1 = idxFrom->point(); - const QgsPointV2 &s2 = idxTo->point(); + const QgsPoint &s1 = idxFrom->point(); + const QgsPoint &s2 = idxTo->point(); double nx = s2.y() - s1.y(); double ny = -( s2.x() - s1.x() ); double t = ( p.x() * ny - p.y() * nx - s1.x() * ny + s1.y() * nx ) / ( ( s2.x() - s1.x() ) * ny - ( s2.y() - s1.y() ) * nx ); @@ -98,7 +98,7 @@ bool QgsSnapIndex::SegmentSnapItem::getProjection( const QgsPointV2 &p, QgsPoint { return false; } - pProj = QgsPointV2( s1.x() + ( s2.x() - s1.x() ) * t, s1.y() + ( s2.y() - s1.y() ) * t ); + pProj = QgsPoint( s1.x() + ( s2.x() - s1.x() ) * t, s1.y() + ( s2.y() - s1.y() ) * t ); return true; } @@ -249,7 +249,7 @@ QList QgsSnapIndex::GridRow::getSnapItems( int colStar /////////////////////////////////////////////////////////////////////////////// -QgsSnapIndex::QgsSnapIndex( const QgsPointV2 &origin, double cellSize ) +QgsSnapIndex::QgsSnapIndex( const QgsPoint &origin, double cellSize ) : mOrigin( origin ) , mCellSize( cellSize ) , mRowsStartIdx( 0 ) @@ -301,7 +301,7 @@ QgsSnapIndex::Cell &QgsSnapIndex::getCreateCell( int col, int row ) void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint ) { - QgsPointV2 p = idx->point(); + QgsPoint p = idx->point(); int col = qFloor( ( p.x() - mOrigin.x() ) / mCellSize ); int row = qFloor( ( p.y() - mOrigin.y() ) / mCellSize ); getCreateCell( col, row ).append( new PointSnapItem( idx, isEndPoint ) ); @@ -309,8 +309,8 @@ void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint ) void QgsSnapIndex::addSegment( const CoordIdx *idxFrom, const CoordIdx *idxTo ) { - QgsPointV2 pFrom = idxFrom->point(); - QgsPointV2 pTo = idxTo->point(); + QgsPoint pFrom = idxFrom->point(); + QgsPoint pTo = idxTo->point(); // Raytrace along the grid, get touched cells float x0 = ( pFrom.x() - mOrigin.x() ) / mCellSize; float y0 = ( pFrom.y() - mOrigin.y() ) / mCellSize; @@ -355,11 +355,11 @@ void QgsSnapIndex::addGeometry( const QgsAbstractGeometry *geom ) } -QgsPointV2 QgsSnapIndex::getClosestSnapToPoint( const QgsPointV2 &p, const QgsPointV2 &q ) +QgsPoint QgsSnapIndex::getClosestSnapToPoint( const QgsPoint &p, const QgsPoint &q ) { // Look for intersections on segment from the target point to the point opposite to the point reference point // p2 = p1 + 2 * (q - p1) - QgsPointV2 p2( 2 * q.x() - p.x(), 2 * q.y() - p.y() ); + QgsPoint p2( 2 * q.x() - p.x(), 2 * q.y() - p.y() ); // Raytrace along the grid, get touched cells float x0 = ( p.x() - mOrigin.x() ) / mCellSize; @@ -369,7 +369,7 @@ QgsPointV2 QgsSnapIndex::getClosestSnapToPoint( const QgsPointV2 &p, const QgsPo Raytracer rt( x0, y0, x1, y1 ); double dMin = std::numeric_limits::max(); - QgsPointV2 pMin = p; + QgsPoint pMin = p; for ( ; rt.isValid(); rt.next() ) { const Cell *cell = getCell( rt.curCol(), rt.curRow() ); @@ -381,7 +381,7 @@ QgsPointV2 QgsSnapIndex::getClosestSnapToPoint( const QgsPointV2 &p, const QgsPo { if ( item->type == SnapSegment ) { - QgsPointV2 inter; + QgsPoint inter; if ( static_cast( item )->getIntersection( p, p2, inter ) ) { double dist = QgsGeometryUtils::sqrDistance2D( q, inter ); @@ -398,7 +398,7 @@ QgsPointV2 QgsSnapIndex::getClosestSnapToPoint( const QgsPointV2 &p, const QgsPo return pMin; } -QgsSnapIndex::SnapItem *QgsSnapIndex::getSnapItem( const QgsPointV2 &pos, double tol, QgsSnapIndex::PointSnapItem **pSnapPoint, QgsSnapIndex::SegmentSnapItem **pSnapSegment, bool endPointOnly ) const +QgsSnapIndex::SnapItem *QgsSnapIndex::getSnapItem( const QgsPoint &pos, double tol, QgsSnapIndex::PointSnapItem **pSnapPoint, QgsSnapIndex::SegmentSnapItem **pSnapSegment, bool endPointOnly ) const { int colStart = qFloor( ( pos.x() - tol - mOrigin.x() ) / mCellSize ); int rowStart = qFloor( ( pos.y() - tol - mOrigin.y() ) / mCellSize ); @@ -432,7 +432,7 @@ QgsSnapIndex::SnapItem *QgsSnapIndex::getSnapItem( const QgsPointV2 &pos, double } else if ( item->type == SnapSegment && !endPointOnly ) { - QgsPointV2 pProj; + QgsPoint pProj; if ( !static_cast( item )->getProjection( pos, pProj ) ) { continue; @@ -513,8 +513,8 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl ( mode == EndPointPreferClosest || mode == EndPointPreferNodes || mode == EndPointToEndPoint ) ) return geometry; - QgsPointV2 center = dynamic_cast< const QgsPointV2 * >( geometry.geometry() ) ? *static_cast< const QgsPointV2 * >( geometry.geometry() ) : - QgsPointV2( geometry.geometry()->boundingBox().center() ); + QgsPoint center = dynamic_cast< const QgsPoint * >( geometry.geometry() ) ? *static_cast< const QgsPoint * >( geometry.geometry() ) : + QgsPoint( geometry.geometry()->boundingBox().center() ); QgsSnapIndex refSnapIndex( center, 10 * snapTolerance ); Q_FOREACH ( const QgsGeometry &geom, referenceGeometries ) @@ -548,7 +548,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl QgsSnapIndex::PointSnapItem *snapPoint = nullptr; QgsSnapIndex::SegmentSnapItem *snapSegment = nullptr; QgsVertexId vidx( iPart, iRing, iVert ); - QgsPointV2 p = subjGeom->vertexAt( vidx ); + QgsPoint p = subjGeom->vertexAt( vidx ); if ( !refSnapIndex.getSnapItem( p, snapTolerance, &snapPoint, &snapSegment, mode == EndPointToEndPoint ) ) { subjPointFlags[iPart][iRing].append( Unsnapped ); @@ -578,7 +578,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl case PreferClosest: case EndPointPreferClosest: { - QgsPointV2 nodeSnap, segmentSnap; + QgsPoint nodeSnap, segmentSnap; double distanceNode = DBL_MAX; double distanceSegment = DBL_MAX; if ( snapPoint ) @@ -610,7 +610,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl } //nothing more to do for points - if ( dynamic_cast< const QgsPointV2 * >( subjGeom ) ) + if ( dynamic_cast< const QgsPoint * >( subjGeom ) ) return QgsGeometry( subjGeom ); //or for end point snapping if ( mode == EndPointPreferClosest || mode == EndPointPreferNodes || mode == EndPointToEndPoint ) @@ -636,7 +636,7 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl QgsSnapIndex::PointSnapItem *snapPoint = nullptr; QgsSnapIndex::SegmentSnapItem *snapSegment = nullptr; - QgsPointV2 point = refGeom.geometry()->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); + QgsPoint point = refGeom.geometry()->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); if ( subjSnapIndex->getSnapItem( point, snapTolerance, &snapPoint, &snapSegment ) ) { // Snap to segment, unless a subject point was already snapped to the reference point @@ -647,8 +647,8 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl else if ( snapSegment ) { // Look if there is a closer reference segment, if so, ignore this point - QgsPointV2 pProj = snapSegment->getSnapPoint( point ); - QgsPointV2 closest = refSnapIndex.getClosestSnapToPoint( point, pProj ); + QgsPoint pProj = snapSegment->getSnapPoint( point ); + QgsPoint closest = refSnapIndex.getClosestSnapToPoint( point, pProj ); if ( QgsGeometryUtils::sqrDistance2D( pProj, point ) > QgsGeometryUtils::sqrDistance2D( pProj, closest ) ) { continue; @@ -685,9 +685,9 @@ QgsGeometry QgsGeometrySnapper::snapGeometry( const QgsGeometry &geometry, doubl { int iPrev = ( iVert - 1 + nVerts ) % nVerts; int iNext = ( iVert + 1 ) % nVerts; - QgsPointV2 pMid = subjGeom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); - QgsPointV2 pPrev = subjGeom->vertexAt( QgsVertexId( iPart, iRing, iPrev ) ); - QgsPointV2 pNext = subjGeom->vertexAt( QgsVertexId( iPart, iRing, iNext ) ); + QgsPoint pMid = subjGeom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); + QgsPoint pPrev = subjGeom->vertexAt( QgsVertexId( iPart, iRing, iPrev ) ); + QgsPoint pNext = subjGeom->vertexAt( QgsVertexId( iPart, iRing, iNext ) ); if ( subjPointFlags[iPart][iRing][iVert] == SnappedToRefSegment && subjPointFlags[iPart][iRing][iPrev] != Unsnapped && @@ -720,8 +720,8 @@ int QgsGeometrySnapper::polyLineSize( const QgsAbstractGeometry *geom, int iPart if ( dynamic_cast< const QgsSurface * >( geom ) ) { - QgsPointV2 front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); - QgsPointV2 back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) ); + QgsPoint front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); + QgsPoint back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) ); if ( front == back ) return nVerts - 1; } diff --git a/src/analysis/vector/qgsgeometrysnapper.h b/src/analysis/vector/qgsgeometrysnapper.h index f0e70afe108..199345ec296 100644 --- a/src/analysis/vector/qgsgeometrysnapper.h +++ b/src/analysis/vector/qgsgeometrysnapper.h @@ -169,7 +169,7 @@ class QgsSnapIndex : geom( _geom ) , vidx( _vidx ) {} - QgsPointV2 point() const { return geom->vertexAt( vidx ); } + QgsPoint point() const { return geom->vertexAt( vidx ); } const QgsAbstractGeometry *geom = nullptr; QgsVertexId vidx; @@ -182,7 +182,7 @@ class QgsSnapIndex public: virtual ~SnapItem() = default; SnapType type; - virtual QgsPointV2 getSnapPoint( const QgsPointV2 &p ) const = 0; + virtual QgsPoint getSnapPoint( const QgsPoint &p ) const = 0; protected: explicit SnapItem( SnapType _type ) : type( _type ) {} @@ -192,7 +192,7 @@ class QgsSnapIndex { public: explicit PointSnapItem( const CoordIdx *_idx, bool isEndPoint ); - QgsPointV2 getSnapPoint( const QgsPointV2 &/*p*/ ) const override; + QgsPoint getSnapPoint( const QgsPoint &/*p*/ ) const override; const CoordIdx *idx = nullptr; }; @@ -200,22 +200,22 @@ class QgsSnapIndex { public: SegmentSnapItem( const CoordIdx *_idxFrom, const CoordIdx *_idxTo ); - QgsPointV2 getSnapPoint( const QgsPointV2 &p ) const override; - bool getIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, QgsPointV2 &inter ) const; - bool getProjection( const QgsPointV2 &p, QgsPointV2 &pProj ); + QgsPoint getSnapPoint( const QgsPoint &p ) const override; + bool getIntersection( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &inter ) const; + bool getProjection( const QgsPoint &p, QgsPoint &pProj ); const CoordIdx *idxFrom = nullptr; const CoordIdx *idxTo = nullptr; }; - QgsSnapIndex( const QgsPointV2 &origin, double cellSize ); + QgsSnapIndex( const QgsPoint &origin, double cellSize ); ~QgsSnapIndex(); void addGeometry( const QgsAbstractGeometry *geom ); - QgsPointV2 getClosestSnapToPoint( const QgsPointV2 &p, const QgsPointV2 &q ); - SnapItem *getSnapItem( const QgsPointV2 &pos, double tol, PointSnapItem **pSnapPoint = nullptr, SegmentSnapItem **pSnapSegment = nullptr, bool endPointOnly = false ) const; + QgsPoint getClosestSnapToPoint( const QgsPoint &p, const QgsPoint &q ); + SnapItem *getSnapItem( const QgsPoint &pos, double tol, PointSnapItem **pSnapPoint = nullptr, SegmentSnapItem **pSnapSegment = nullptr, bool endPointOnly = false ) const; private: typedef QList Cell; - typedef QPair Segment; + typedef QPair Segment; class GridRow { @@ -231,7 +231,7 @@ class QgsSnapIndex int mColStartIdx; }; - QgsPointV2 mOrigin; + QgsPoint mOrigin; double mCellSize; QList mCoordIdxs; diff --git a/src/analysis/vector/qgspointsample.cpp b/src/analysis/vector/qgspointsample.cpp index 7ffee6aaf48..528ecbca227 100644 --- a/src/analysis/vector/qgspointsample.cpp +++ b/src/analysis/vector/qgspointsample.cpp @@ -105,7 +105,7 @@ void QgsPointSample::addSamplePoints( QgsFeature &inputFeature, QgsVectorFileWri } QgsSpatialIndex sIndex; //to check minimum distance - QMap< QgsFeatureId, QgsPoint > pointMapForFeature; + QMap< QgsFeatureId, QgsPointXY > pointMapForFeature; int nIterations = 0; int maxIterations = nPoints * 200; @@ -118,7 +118,7 @@ void QgsPointSample::addSamplePoints( QgsFeature &inputFeature, QgsVectorFileWri { randX = ( ( double )mt_rand() / MD_RAND_MAX ) * geomRect.width() + geomRect.xMinimum(); randY = ( ( double )mt_rand() / MD_RAND_MAX ) * geomRect.height() + geomRect.yMinimum(); - QgsPoint randPoint( randX, randY ); + QgsPointXY randPoint( randX, randY ); QgsGeometry ptGeom = QgsGeometry::fromPoint( randPoint ); if ( ptGeom.within( geom ) && checkMinDistance( randPoint, sIndex, minDistance, pointMapForFeature ) ) { @@ -138,7 +138,7 @@ void QgsPointSample::addSamplePoints( QgsFeature &inputFeature, QgsVectorFileWri } } -bool QgsPointSample::checkMinDistance( QgsPoint &pt, QgsSpatialIndex &index, double minDistance, QMap< QgsFeatureId, QgsPoint > &pointMap ) +bool QgsPointSample::checkMinDistance( QgsPointXY &pt, QgsSpatialIndex &index, double minDistance, QMap< QgsFeatureId, QgsPointXY > &pointMap ) { if ( minDistance <= 0 ) { @@ -151,13 +151,13 @@ bool QgsPointSample::checkMinDistance( QgsPoint &pt, QgsSpatialIndex &index, dou return true; } - QMap< QgsFeatureId, QgsPoint >::const_iterator it = pointMap.find( neighborList[0] ); + QMap< QgsFeatureId, QgsPointXY >::const_iterator it = pointMap.find( neighborList[0] ); if ( it == pointMap.constEnd() ) //should not happen { return true; } - QgsPoint neighborPt = it.value(); + QgsPointXY neighborPt = it.value(); if ( neighborPt.sqrDist( pt ) < ( minDistance * minDistance ) ) { return false; diff --git a/src/analysis/vector/qgspointsample.h b/src/analysis/vector/qgspointsample.h index 209022b8701..098838c9f3e 100644 --- a/src/analysis/vector/qgspointsample.h +++ b/src/analysis/vector/qgspointsample.h @@ -20,7 +20,7 @@ #include "qgis_analysis.h" class QgsFeature; -class QgsPoint; +class QgsPointXY; class QgsSpatialIndex; class QgsVectorFileWriter; class QgsVectorLayer; @@ -41,7 +41,7 @@ class ANALYSIS_EXPORT QgsPointSample QgsPointSample(); //default constructor is forbidden void addSamplePoints( QgsFeature &inputFeature, QgsVectorFileWriter &writer, int nPoints, double minDistance ); - bool checkMinDistance( QgsPoint &pt, QgsSpatialIndex &index, double minDistance, QMap< QgsFeatureId, QgsPoint > &pointMap ); + bool checkMinDistance( QgsPointXY &pt, QgsSpatialIndex &index, double minDistance, QMap< QgsFeatureId, QgsPointXY > &pointMap ); //! Layer id of input polygon/multipolygon layer QgsVectorLayer *mInputLayer = nullptr; diff --git a/src/analysis/vector/qgstransectsample.cpp b/src/analysis/vector/qgstransectsample.cpp index ecadd3c016f..83e544e91a8 100644 --- a/src/analysis/vector/qgstransectsample.cpp +++ b/src/analysis/vector/qgstransectsample.cpp @@ -223,8 +223,8 @@ int QgsTransectSample::createSample( QProgressDialog *pd ) { continue; } - QgsPoint sampleQgsPoint = samplePoint.asPoint(); - QgsPoint latLongSamplePoint = toLatLongTransform.transform( sampleQgsPoint ); + QgsPointXY sampleQgsPointXY = samplePoint.asPoint(); + QgsPointXY latLongSamplePoint = toLatLongTransform.transform( sampleQgsPointXY ); QgsFeature samplePointFeature( outputPointFields ); samplePointFeature.setGeometry( samplePoint ); @@ -236,21 +236,21 @@ int QgsTransectSample::createSample( QProgressDialog *pd ) samplePointFeature.setAttribute( QStringLiteral( "start_long" ), latLongSamplePoint.x() ); //find closest point on clipped buffer line - QgsPoint minDistPoint; + QgsPointXY minDistPoint; int afterVertex; - if ( bufferLineClipped->closestSegmentWithContext( sampleQgsPoint, minDistPoint, afterVertex ) < 0 ) + if ( bufferLineClipped->closestSegmentWithContext( sampleQgsPointXY, minDistPoint, afterVertex ) < 0 ) { continue; } //bearing between sample point and min dist point (transect direction) - double bearing = distanceArea.bearing( sampleQgsPoint, minDistPoint ) / M_PI * 180.0; + double bearing = distanceArea.bearing( sampleQgsPointXY, minDistPoint ) / M_PI * 180.0; - QgsPoint ptFarAway( sampleQgsPoint.x() + ( minDistPoint.x() - sampleQgsPoint.x() ) * 1000000, - sampleQgsPoint.y() + ( minDistPoint.y() - sampleQgsPoint.y() ) * 1000000 ); + QgsPointXY ptFarAway( sampleQgsPointXY.x() + ( minDistPoint.x() - sampleQgsPointXY.x() ) * 1000000, + sampleQgsPointXY.y() + ( minDistPoint.y() - sampleQgsPointXY.y() ) * 1000000 ); QgsPolyline lineFarAway; - lineFarAway << sampleQgsPoint << ptFarAway; + lineFarAway << sampleQgsPointXY << ptFarAway; QgsGeometry lineFarAwayGeom = QgsGeometry::fromPolyline( lineFarAway ); QgsGeometry lineClipStratum = lineFarAwayGeom.intersection( strataGeom ); if ( lineClipStratum.isNull() ) @@ -258,7 +258,7 @@ int QgsTransectSample::createSample( QProgressDialog *pd ) continue; } - //cancel if distance between sample point and line is too large (line does not start at point + //cancel if distance between sample point and line is too large (line does not start at point) if ( lineClipStratum.distance( samplePoint ) > 0.000001 ) { continue; @@ -268,7 +268,7 @@ int QgsTransectSample::createSample( QProgressDialog *pd ) if ( lineClipStratum.wkbType() == QgsWkbTypes::MultiLineString || lineClipStratum.wkbType() == QgsWkbTypes::MultiLineString25D ) { - QgsGeometry singleLine = closestMultilineElement( sampleQgsPoint, lineClipStratum ); + QgsGeometry singleLine = closestMultilineElement( sampleQgsPointXY, lineClipStratum ); if ( !singleLine.isNull() ) { lineClipStratum = singleLine; @@ -372,7 +372,7 @@ bool QgsTransectSample::otherTransectWithinDistance( const QgsGeometry &geom, do if ( idMapIt != lineFeatureMap.constEnd() ) { double dist = 0; - QgsPoint pt1, pt2; + QgsPointXY pt1, pt2; closestSegmentPoints( geom, idMapIt.value(), dist, pt1, pt2 ); dist = da.measureLine( pt1, pt2 ); //convert degrees to meters if necessary @@ -386,7 +386,7 @@ bool QgsTransectSample::otherTransectWithinDistance( const QgsGeometry &geom, do return false; } -bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGeometry &g2, double &dist, QgsPoint &pt1, QgsPoint &pt2 ) +bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGeometry &g2, double &dist, QgsPointXY &pt1, QgsPointXY &pt2 ) { QgsWkbTypes::Type t1 = g1.wkbType(); if ( t1 != QgsWkbTypes::LineString && t1 != QgsWkbTypes::LineString25D ) @@ -408,10 +408,10 @@ bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGe return false; } - QgsPoint p11 = pl1.at( 0 ); - QgsPoint p12 = pl1.at( 1 ); - QgsPoint p21 = pl2.at( 0 ); - QgsPoint p22 = pl2.at( 1 ); + QgsPointXY p11 = pl1.at( 0 ); + QgsPointXY p12 = pl1.at( 1 ); + QgsPointXY p21 = pl2.at( 0 ); + QgsPointXY p22 = pl2.at( 1 ); double p1x = p11.x(); double p1y = p11.y(); @@ -429,13 +429,13 @@ bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGe { //lines are parallel //project all points on the other segment and take the one with the smallest distance - QgsPoint minDistPoint1; + QgsPointXY minDistPoint1; double d1 = p11.sqrDistToSegment( p21.x(), p21.y(), p22.x(), p22.y(), minDistPoint1 ); - QgsPoint minDistPoint2; + QgsPointXY minDistPoint2; double d2 = p12.sqrDistToSegment( p21.x(), p21.y(), p22.x(), p22.y(), minDistPoint2 ); - QgsPoint minDistPoint3; + QgsPointXY minDistPoint3; double d3 = p21.sqrDistToSegment( p11.x(), p11.y(), p12.x(), p12.y(), minDistPoint3 ); - QgsPoint minDistPoint4; + QgsPointXY minDistPoint4; double d4 = p22.sqrDistToSegment( p11.x(), p11.y(), p12.x(), p12.y(), minDistPoint4 ); if ( d1 <= d2 && d1 <= d3 && d1 <= d4 ) @@ -516,7 +516,7 @@ bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGe return true; } -QgsGeometry QgsTransectSample::closestMultilineElement( const QgsPoint &pt, const QgsGeometry &multiLine ) +QgsGeometry QgsTransectSample::closestMultilineElement( const QgsPointXY &pt, const QgsGeometry &multiLine ) { if ( !multiLine || ( multiLine.wkbType() != QgsWkbTypes::MultiLineString && multiLine.wkbType() != QgsWkbTypes::MultiLineString25D ) ) diff --git a/src/analysis/vector/qgstransectsample.h b/src/analysis/vector/qgstransectsample.h index 3ab663383ff..2eacc7f9f2a 100644 --- a/src/analysis/vector/qgstransectsample.h +++ b/src/analysis/vector/qgstransectsample.h @@ -24,7 +24,7 @@ class QgsDistanceArea; class QgsGeometry; class QgsSpatialIndex; class QgsVectorLayer; -class QgsPoint; +class QgsPointXY; class QProgressDialog; /** \ingroup analysis @@ -83,9 +83,9 @@ class ANALYSIS_EXPORT QgsTransectSample \param pt1 out: closest point on first geometry \param pt2 out: closest point on secont geometry \returns true in case of success*/ - static bool closestSegmentPoints( const QgsGeometry &g1, const QgsGeometry &g2, double &dist, QgsPoint &pt1, QgsPoint &pt2 ); + static bool closestSegmentPoints( const QgsGeometry &g1, const QgsGeometry &g2, double &dist, QgsPointXY &pt1, QgsPointXY &pt2 ); //! Returns a copy of the multiline element closest to a point (caller takes ownership) - static QgsGeometry closestMultilineElement( const QgsPoint &pt, const QgsGeometry &multiLine ); + static QgsGeometry closestMultilineElement( const QgsPointXY &pt, const QgsGeometry &multiLine ); /** Returns clipped buffer line. Iteratively applies reduced tolerances if the result is not a single line \param stratumGeom stratum polygon diff --git a/src/app/dwg/qgsdwgimporter.cpp b/src/app/dwg/qgsdwgimporter.cpp index b6b0ab7137b..7f401199173 100644 --- a/src/app/dwg/qgsdwgimporter.cpp +++ b/src/app/dwg/qgsdwgimporter.cpp @@ -1229,7 +1229,7 @@ void QgsDwgImporter::addBlock( const DRW_Block &data ) SETSTRING( name ); SETINTEGER( flags ); - QgsPointV2 p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); + QgsPoint p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); if ( !createFeature( layer, f, p ) ) { @@ -1291,7 +1291,7 @@ void QgsDwgImporter::addPoint( const DRW_Point &data ) setPoint( dfn, f, "ext", data.extPoint ); - QgsPointV2 p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); + QgsPoint p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); if ( !createFeature( layer, f, p ) ) { LOG( QObject::tr( "Could not add %2 [%1]" ) @@ -1341,9 +1341,9 @@ void QgsDwgImporter::addArc( const DRW_Arc &data ) QgsCircularString c; c.setPoints( QgsPointSequence() - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x + cos( a0 ) * data.mRadius, data.basePoint.y + sin( a0 ) * data.mRadius ) - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x + cos( a1 ) * data.mRadius, data.basePoint.y + sin( a1 ) * data.mRadius ) - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x + cos( a2 ) * data.mRadius, data.basePoint.y + sin( a2 ) * data.mRadius ) + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a0 ) * data.mRadius, data.basePoint.y + sin( a0 ) * data.mRadius ) + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a1 ) * data.mRadius, data.basePoint.y + sin( a1 ) * data.mRadius ) + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a2 ) * data.mRadius, data.basePoint.y + sin( a2 ) * data.mRadius ) ); if ( !createFeature( layer, f, c ) ) @@ -1372,9 +1372,9 @@ void QgsDwgImporter::addCircle( const DRW_Circle &data ) QgsCircularString c; c.setPoints( QgsPointSequence() - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x - data.mRadius, data.basePoint.y, data.basePoint.z ) - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x + data.mRadius, data.basePoint.y, data.basePoint.z ) - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x - data.mRadius, data.basePoint.y, data.basePoint.z ) + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x - data.mRadius, data.basePoint.y, data.basePoint.z ) + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + data.mRadius, data.basePoint.y, data.basePoint.z ) + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x - data.mRadius, data.basePoint.y, data.basePoint.z ) ); if ( !createFeature( layer, f, c ) ) @@ -1412,7 +1412,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun Q_ASSERT( data.vertlist[i0] != nullptr ); QgsDebugMsgLevel( QString( "%1: %2,%3 bulge:%4" ).arg( i ).arg( data.vertlist[i0]->x ).arg( data.vertlist[i0]->y ).arg( data.vertlist[i0]->bulge ), 5 ); - QgsPointV2 p( QgsWkbTypes::PointZ, data.vertlist[i0]->x, data.vertlist[i0]->y, data.elevation ); + QgsPoint p( QgsWkbTypes::PointZ, data.vertlist[i0]->x, data.vertlist[i0]->y, data.elevation ); s << p; bool hasBulge( data.vertlist[i0]->bulge != 0.0 ); @@ -1448,10 +1448,10 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun double r = c / 2.0 / sin( a ); double h = r * ( 1 - cos( a ) ); - s << QgsPointV2( QgsWkbTypes::PointZ, - data.vertlist[i0]->x + 0.5 * dx + h * dy / c, - data.vertlist[i0]->y + 0.5 * dy - h * dx / c, - data.elevation ); + s << QgsPoint( QgsWkbTypes::PointZ, + data.vertlist[i0]->x + 0.5 * dx + h * dy / c, + data.vertlist[i0]->y + 0.5 * dy - h * dx / c, + data.elevation ); } } @@ -1479,8 +1479,8 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data ) int i0 = i % vertexnum; int i1 = ( i + 1 ) % vertexnum; - QgsPointV2 p0( QgsWkbTypes::PointZ, data.vertlist[i0]->x, data.vertlist[i0]->y, data.elevation ); - QgsPointV2 p1( QgsWkbTypes::PointZ, data.vertlist[i1]->x, data.vertlist[i1]->y, data.elevation ); + QgsPoint p0( QgsWkbTypes::PointZ, data.vertlist[i0]->x, data.vertlist[i0]->y, data.elevation ); + QgsPoint p1( QgsWkbTypes::PointZ, data.vertlist[i1]->x, data.vertlist[i1]->y, data.elevation ); double staWidth = data.vertlist[i0]->stawidth == 0.0 ? data.width : data.vertlist[i0]->stawidth; double endWidth = data.vertlist[i0]->endwidth == 0.0 ? data.width : data.vertlist[i0]->endwidth; bool hasBulge( data.vertlist[i0]->bulge != 0.0 ); @@ -1559,10 +1559,10 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data ) double r = c / 2.0 / sin( a ); double h = r * ( 1 - cos( a ) ); - s << QgsPointV2( QgsWkbTypes::PointZ, - p0.x() + 0.5 * dx + h * dy / c, - p0.y() + 0.5 * dy - h * dx / c, - data.elevation ); + s << QgsPoint( QgsWkbTypes::PointZ, + p0.x() + 0.5 * dx + h * dy / c, + p0.y() + 0.5 * dy - h * dx / c, + data.elevation ); } s << p1; @@ -1582,8 +1582,8 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data ) setPoint( dfn, f, "ext", data.extPoint ); - QgsPoint ps( p0.x(), p0.y() ); - QgsPoint pe( p1.x(), p1.y() ); + QgsPointXY ps( p0.x(), p0.y() ); + QgsPointXY pe( p1.x(), p1.y() ); QgsVector v( ( pe - ps ).perpVector().normalized() ); QgsVector vs( v * 0.5 * staWidth ); QgsVector ve( v * 0.5 * endWidth ); @@ -1591,11 +1591,11 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data ) QgsPolygonV2 poly; QgsLineString *ls = new QgsLineString(); ls->setPoints( QgsPointSequence() - << QgsPointV2( ps + vs ) - << QgsPointV2( pe + ve ) - << QgsPointV2( pe - ve ) - << QgsPointV2( ps - vs ) - << QgsPointV2( ps + vs ) + << QgsPoint( ps + vs ) + << QgsPoint( pe + ve ) + << QgsPoint( pe - ve ) + << QgsPoint( ps - vs ) + << QgsPoint( ps + vs ) ); ls->addZValue( data.elevation ); poly.setExteriorRing( ls ); @@ -1678,8 +1678,8 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data ) int i0 = i % vertexnum; int i1 = ( i + 1 ) % vertexnum; - QgsPointV2 p0( QgsWkbTypes::PointZ, data.vertlist[i0]->basePoint.x, data.vertlist[i0]->basePoint.y, data.vertlist[i0]->basePoint.z ); - QgsPointV2 p1( QgsWkbTypes::PointZ, data.vertlist[i1]->basePoint.x, data.vertlist[i1]->basePoint.y, data.vertlist[i1]->basePoint.z ); + QgsPoint p0( QgsWkbTypes::PointZ, data.vertlist[i0]->basePoint.x, data.vertlist[i0]->basePoint.y, data.vertlist[i0]->basePoint.z ); + QgsPoint p1( QgsWkbTypes::PointZ, data.vertlist[i1]->basePoint.x, data.vertlist[i1]->basePoint.y, data.vertlist[i1]->basePoint.z ); double staWidth = data.vertlist[i0]->endwidth == 0.0 ? data.defendwidth : data.vertlist[i0]->stawidth; double endWidth = data.vertlist[i0]->stawidth == 0.0 ? data.defstawidth : data.vertlist[i0]->endwidth; bool hasBulge( data.vertlist[i0]->bulge != 0.0 ); @@ -1761,10 +1761,10 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data ) double r = c / 2.0 / sin( a ); double h = r * ( 1 - cos( a ) ); - s << QgsPointV2( QgsWkbTypes::PointZ, - p0.x() + 0.5 * dx + h * dy / c, - p0.y() + 0.5 * dy - h * dx / c, - p0.z() + 0.5 * dz ); + s << QgsPoint( QgsWkbTypes::PointZ, + p0.x() + 0.5 * dx + h * dy / c, + p0.y() + 0.5 * dy - h * dx / c, + p0.z() + 0.5 * dz ); } s << p1; @@ -1784,8 +1784,8 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data ) setPoint( dfn, f, "ext", data.extPoint ); - QgsPoint ps( p0.x(), p0.y() ); - QgsPoint pe( p1.x(), p1.y() ); + QgsPointXY ps( p0.x(), p0.y() ); + QgsPointXY pe( p1.x(), p1.y() ); QgsVector v( ( pe - ps ).perpVector().normalized() ); QgsVector vs( v * 0.5 * staWidth ); QgsVector ve( v * 0.5 * endWidth ); @@ -1793,15 +1793,15 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data ) QgsPolygonV2 poly; QgsLineString *ls = new QgsLineString(); QgsPointSequence s; - s << QgsPointV2( ps + vs ); + s << QgsPoint( ps + vs ); s.last().addZValue( p0.z() ); - s << QgsPointV2( pe + ve ); + s << QgsPoint( pe + ve ); s.last().addZValue( p1.z() ); - s << QgsPointV2( pe - ve ); + s << QgsPoint( pe - ve ); s.last().addZValue( p1.z() ); - s << QgsPointV2( ps - vs ); + s << QgsPoint( ps - vs ); s.last().addZValue( p0.z() ); - s << QgsPointV2( ps + vs ); + s << QgsPoint( ps + vs ); s.last().addZValue( p0.z() ); ls->setPoints( s ); poly.setExteriorRing( ls ); @@ -1967,7 +1967,7 @@ static void rbspline( const DRW_Spline &data, size_t npts, size_t k, int p1, const std::vector &b, const std::vector &h, - std::vector &p ) + std::vector &p ) { int nplusc = npts + k; @@ -1997,7 +1997,7 @@ static void rbsplinu( const DRW_Spline &data, size_t npts, size_t k, int p1, const std::vector &b, const std::vector &h, - std::vector &p ) + std::vector &p ) { size_t const nplusc = npts + k; @@ -2070,7 +2070,7 @@ void QgsDwgImporter::addSpline( const DRW_Spline *data ) size_t p1 = mSplineSegs * npts; std::vector h( npts + 1, 1. ); - std::vector p( p1, QgsPoint( 0., 0. ) ); + std::vector p( p1, QgsPointXY( 0., 0. ) ); if ( data->flags & 1 ) { @@ -2093,7 +2093,7 @@ void QgsDwgImporter::addSpline( const DRW_Spline *data ) QgsLineString l; QgsPointSequence ps; for ( size_t i = 0; i < p.size(); ++i ) - ps << QgsPointV2( p[i] ); + ps << QgsPoint( p[i] ); l.setPoints( ps ); if ( !createFeature( layer, f, l ) ) @@ -2136,7 +2136,7 @@ void QgsDwgImporter::addInsert( const DRW_Insert &data ) SETDOUBLE( colspace ); SETDOUBLE( rowspace ); - QgsPointV2 p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); + QgsPoint p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); if ( !createFeature( layer, f, p ) ) { @@ -2180,10 +2180,10 @@ void QgsDwgImporter::addSolid( const DRW_Solid &data ) // pt1 pt2 // pt3 pt4 QgsPointSequence s; - s << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); - s << QgsPointV2( QgsWkbTypes::PointZ, data.secPoint.x, data.secPoint.y, data.basePoint.z ); - s << QgsPointV2( QgsWkbTypes::PointZ, data.fourthPoint.x, data.fourthPoint.y, data.basePoint.z ); - s << QgsPointV2( QgsWkbTypes::PointZ, data.thirdPoint.x, data.thirdPoint.y, data.basePoint.z ); + s << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); + s << QgsPoint( QgsWkbTypes::PointZ, data.secPoint.x, data.secPoint.y, data.basePoint.z ); + s << QgsPoint( QgsWkbTypes::PointZ, data.fourthPoint.x, data.fourthPoint.y, data.basePoint.z ); + s << QgsPoint( QgsWkbTypes::PointZ, data.thirdPoint.x, data.thirdPoint.y, data.basePoint.z ); s << s[0]; QgsLineString *ls = new QgsLineString(); @@ -2224,7 +2224,7 @@ void QgsDwgImporter::addMText( const DRW_MText &data ) setPoint( dfn, f, "ext", data.extPoint ); - QgsPointV2 p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); + QgsPoint p( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ); if ( !createFeature( layer, f, p ) ) { @@ -2260,10 +2260,10 @@ void QgsDwgImporter::addText( const DRW_Text &data ) setPoint( dfn, f, "ext", data.extPoint ); - QgsPointV2 p( QgsWkbTypes::PointZ, - ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.x : data.basePoint.x, - ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.y : data.basePoint.y, - ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.z : data.basePoint.z ); + QgsPoint p( QgsWkbTypes::PointZ, + ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.x : data.basePoint.x, + ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.y : data.basePoint.y, + ( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.z : data.basePoint.z ); if ( !createFeature( layer, f, p ) ) { @@ -2375,8 +2375,8 @@ void QgsDwgImporter::addHatch( const DRW_Hatch *pdata ) { QgsLineString *ls = new QgsLineString(); ls->setPoints( QgsPointSequence() - << QgsPointV2( QgsWkbTypes::PointZ, l->basePoint.x, l->basePoint.y, l->basePoint.z ) - << QgsPointV2( QgsWkbTypes::PointZ, l->secPoint.x, l->secPoint.y, l->secPoint.z ) ); + << QgsPoint( QgsWkbTypes::PointZ, l->basePoint.x, l->basePoint.y, l->basePoint.z ) + << QgsPoint( QgsWkbTypes::PointZ, l->secPoint.x, l->secPoint.y, l->secPoint.z ) ); // QgsDebugMsg( QString( "add line string:%1" ).arg( ls->asWkt() ) ); cc->addCurve( ls ); } @@ -2425,8 +2425,8 @@ void QgsDwgImporter::addLine( const DRW_Line &data ) QgsLineString l; l.setPoints( QgsPointSequence() - << QgsPointV2( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ) - << QgsPointV2( QgsWkbTypes::PointZ, data.secPoint.x, data.secPoint.y, data.secPoint.z ) ); + << QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x, data.basePoint.y, data.basePoint.z ) + << QgsPoint( QgsWkbTypes::PointZ, data.secPoint.x, data.secPoint.y, data.secPoint.z ) ); if ( !createFeature( layer, f, l ) ) { @@ -2582,7 +2582,7 @@ bool QgsDwgImporter::expandInserts( QString &error ) continue; } - QgsPoint p( g.asPoint() ); + QgsPointXY p( g.asPoint() ); QString name = QString::fromUtf8( OGR_F_GetFieldAsString( insert, nameIdx ) ); double xscale = OGR_F_GetFieldAsDouble( insert, xscaleIdx ); diff --git a/src/app/gps/qgsgpsinformationwidget.cpp b/src/app/gps/qgsgpsinformationwidget.cpp index f201fbb0814..83be01491b3 100644 --- a/src/app/gps/qgsgpsinformationwidget.cpp +++ b/src/app/gps/qgsgpsinformationwidget.cpp @@ -69,7 +69,7 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas *thepCanvas, QWid mpLastLayer = nullptr; - mLastGpsPosition = QgsPoint( 0.0, 0.0 ); + mLastGpsPosition = QgsPointXY( 0.0, 0.0 ); mpMapMarker = nullptr; mpRubberBand = nullptr; @@ -390,7 +390,7 @@ void QgsGPSInformationWidget::connectGps() mTxtSatellitesUsed->clear(); mTxtStatus->clear(); - mLastGpsPosition = QgsPoint( 0.0, 0.0 ); + mLastGpsPosition = QgsPointXY( 0.0, 0.0 ); QString port; @@ -626,10 +626,10 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation &in validFlag = info.longitude >= -180.0 && info.longitude <= 180.0 && info.latitude >= -90.0 && info.latitude <= 90.0; } - QgsPoint myNewCenter; + QgsPointXY myNewCenter; if ( validFlag ) { - myNewCenter = QgsPoint( info.longitude, info.latitude ); + myNewCenter = QgsPointXY( info.longitude, info.latitude ); } else { @@ -674,7 +674,7 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation &in QgsCoordinateReferenceSystem mypSRS = mpCanvas->mapSettings().destinationCrs(); QgsCoordinateTransform myTransform( mWgs84CRS, mypSRS ); // use existing WGS84 CRS - QgsPoint myPoint = myTransform.transform( myNewCenter ); + QgsPointXY myPoint = myTransform.transform( myNewCenter ); //keep the extent the same just center the map canvas in the display so our feature is in the middle QgsRectangle myRect( myPoint, myPoint ); // empty rect can be used to set new extent that is centered on the point used to construct the rect @@ -743,7 +743,7 @@ void QgsGPSInformationWidget::addVertex() // we store the rubber band points in map canvas CRS so transform to map crs // potential problem with transform errors and wrong coordinates if map CRS is changed after points are stored - SLM // should catch map CRS change and transform the points - QgsPoint myPoint; + QgsPointXY myPoint; if ( mpCanvas ) { QgsCoordinateTransform t( mWgs84CRS, mpCanvas->mapSettings().destinationCrs() ); @@ -798,7 +798,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() QgsFeature *f = new QgsFeature( 0 ); QgsCoordinateTransform t( mWgs84CRS, vlayer->crs() ); - QgsPoint myPoint = t.transform( mLastGpsPosition ); + QgsPointXY myPoint = t.transform( mLastGpsPosition ); double x = myPoint.x(); double y = myPoint.y(); @@ -848,12 +848,12 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() QgsWkbPtr wkbPtr( buf, size ); wkbPtr << ( char ) QgsApplication::endian() << QgsWkbTypes::LineString << mCaptureList.size(); - for ( QList::const_iterator it = mCaptureList.constBegin(); it != mCaptureList.constEnd(); ++it ) + for ( QList::const_iterator it = mCaptureList.constBegin(); it != mCaptureList.constEnd(); ++it ) { - QgsPoint savePoint = *it; + QgsPointXY savePoint = *it; // transform the gps point into the layer crs QgsCoordinateTransform t( mWgs84CRS, vlayer->crs() ); - QgsPoint myPoint = t.transform( savePoint ); + QgsPointXY myPoint = t.transform( savePoint ); wkbPtr << myPoint.x() << myPoint.y(); } @@ -870,18 +870,18 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() QgsWkbPtr wkbPtr( buf, size ); wkbPtr << ( char ) QgsApplication::endian() << QgsWkbTypes::Polygon << 1 << mCaptureList.size() + 1; - QList::iterator it; + QList::iterator it; for ( it = mCaptureList.begin(); it != mCaptureList.end(); ++it ) { - QgsPoint savePoint = *it; + QgsPointXY savePoint = *it; // transform the gps point into the layer crs QgsCoordinateTransform t( mWgs84CRS, vlayer->crs() ); - QgsPoint myPoint = t.transform( savePoint ); + QgsPointXY myPoint = t.transform( savePoint ); wkbPtr << myPoint.x() << myPoint.y(); } // close the polygon it = mCaptureList.begin(); - QgsPoint savePoint = *it; + QgsPointXY savePoint = *it; wkbPtr << savePoint.x() << savePoint.y(); diff --git a/src/app/gps/qgsgpsinformationwidget.h b/src/app/gps/qgsgpsinformationwidget.h index a249dc65dbd..c88c4e48deb 100644 --- a/src/app/gps/qgsgpsinformationwidget.h +++ b/src/app/gps/qgsgpsinformationwidget.h @@ -97,8 +97,8 @@ class QgsGPSInformationWidget: public QWidget, private Ui::QgsGPSInformationWidg QgsCoordinateReferenceSystem mWgs84CRS; // not used QPointF gpsToPixelPosition( const QgsPoint& point ); QgsRubberBand *mpRubberBand = nullptr; - QgsPoint mLastGpsPosition; - QList mCaptureList; + QgsPointXY mLastGpsPosition; + QList mCaptureList; FixStatus mLastFixStatus; QString mDateTimeFormat; // user specified format string in registry (no UI presented) QgsVectorLayer *mpLastLayer = nullptr; diff --git a/src/app/gps/qgsgpsmarker.cpp b/src/app/gps/qgsgpsmarker.cpp index a1fbd968970..a5c5218e84d 100644 --- a/src/app/gps/qgsgpsmarker.cpp +++ b/src/app/gps/qgsgpsmarker.cpp @@ -37,7 +37,7 @@ void QgsGpsMarker::setSize( int size ) mSize = size; } -void QgsGpsMarker::setCenter( const QgsPoint &point ) +void QgsGpsMarker::setCenter( const QgsPointXY &point ) { //transform to map crs if ( mMapCanvas ) diff --git a/src/app/gps/qgsgpsmarker.h b/src/app/gps/qgsgpsmarker.h index dbe069d038c..62af811b226 100644 --- a/src/app/gps/qgsgpsmarker.h +++ b/src/app/gps/qgsgpsmarker.h @@ -31,7 +31,7 @@ class QgsGpsMarker : public QgsMapCanvasItem public: explicit QgsGpsMarker( QgsMapCanvas *mapCanvas ); - void setCenter( const QgsPoint &point ); + void setCenter( const QgsPointXY &point ); void paint( QPainter *p ) override; @@ -44,7 +44,7 @@ class QgsGpsMarker : public QgsMapCanvasItem protected: //! coordinates of the point in the center - QgsPoint mCenter; + QgsPointXY mCenter; //! Size of the marker - e.g. 8 will draw it as 8x8 int mSize; diff --git a/src/app/nodetool/qgsnodeeditor.cpp b/src/app/nodetool/qgsnodeeditor.cpp index ff39e3977c3..7242c072e2a 100644 --- a/src/app/nodetool/qgsnodeeditor.cpp +++ b/src/app/nodetool/qgsnodeeditor.cpp @@ -216,8 +216,8 @@ bool QgsNodeEditorModel::setData( const QModelIndex &index, const QVariant &valu double x3 = mSelectedFeature->vertexMap().at( index.row() + 1 )->point().x(); double y3 = mSelectedFeature->vertexMap().at( index.row() + 1 )->point().y(); - QgsPointV2 result; - if ( QgsGeometryUtils::segmentMidPoint( QgsPointV2( x1, y1 ), QgsPointV2( x3, y3 ), result, r, QgsPointV2( x2, y2 ) ) ) + QgsPoint result; + if ( QgsGeometryUtils::segmentMidPoint( QgsPoint( x1, y1 ), QgsPoint( x3, y3 ), result, r, QgsPoint( x2, y2 ) ) ) { x = result.x(); y = result.y(); @@ -225,7 +225,7 @@ bool QgsNodeEditorModel::setData( const QModelIndex &index, const QVariant &valu } double z = ( index.column() == mZCol ? value.toDouble() : mSelectedFeature->vertexMap().at( index.row() )->point().z() ); double m = ( index.column() == mMCol ? value.toDouble() : mSelectedFeature->vertexMap().at( index.row() )->point().m() ); - QgsPointV2 p( QgsWkbTypes::PointZM, x, y, z, m ); + QgsPoint p( QgsWkbTypes::PointZM, x, y, z, m ); mLayer->beginEditCommand( QObject::tr( "Moved vertices" ) ); mLayer->moveVertex( p, mSelectedFeature->featureId(), index.row() ); @@ -260,9 +260,9 @@ bool QgsNodeEditorModel::calcR( int row, double &r, double &minRadius ) const if ( !curvePoint ) return false; - const QgsPointV2 &p1 = mSelectedFeature->vertexMap().at( row - 1 )->point(); - const QgsPointV2 &p2 = mSelectedFeature->vertexMap().at( row )->point(); - const QgsPointV2 &p3 = mSelectedFeature->vertexMap().at( row + 1 )->point(); + const QgsPoint &p1 = mSelectedFeature->vertexMap().at( row - 1 )->point(); + const QgsPoint &p2 = mSelectedFeature->vertexMap().at( row )->point(); + const QgsPoint &p3 = mSelectedFeature->vertexMap().at( row + 1 )->point(); double cx, cy; QgsGeometryUtils::circleCenterRadius( p1, p2, p3, r, cx, cy ); @@ -365,10 +365,10 @@ void QgsNodeEditor::zoomToNode( int idx ) { double x = mSelectedFeature->vertexMap().at( idx )->point().x(); double y = mSelectedFeature->vertexMap().at( idx )->point().y(); - QgsPoint newCenter( x, y ); + QgsPointXY newCenter( x, y ); QgsCoordinateTransform t( mLayer->crs(), mCanvas->mapSettings().destinationCrs() ); - QgsPoint tCenter = t.transform( newCenter ); + QgsPointXY tCenter = t.transform( newCenter ); QPolygonF ext = mCanvas->mapSettings().visiblePolygon(); //close polygon diff --git a/src/app/nodetool/qgsnodetool.cpp b/src/app/nodetool/qgsnodetool.cpp index 767cf675918..69669a77890 100644 --- a/src/app/nodetool/qgsnodetool.cpp +++ b/src/app/nodetool/qgsnodetool.cpp @@ -127,7 +127,7 @@ static QgsGeometry geometryToMultiPoint( const QgsGeometry &geom ) for ( int i = 0; i < g->partCount(); ++i ) for ( int j = 0; j < g->ringCount( i ); ++j ) for ( int k = 0; k < g->vertexCount( i, j ); ++k ) - multiPoint->addGeometry( new QgsPointV2( g->vertexAt( QgsVertexId( i, j, k ) ) ) ); + multiPoint->addGeometry( new QgsPoint( g->vertexAt( QgsVertexId( i, j, k ) ) ) ); return outputGeom; } @@ -177,7 +177,7 @@ class MatchCollectingFilter : public QgsPointLocator::MatchFilter // result... the locator API needs a new method verticesInRect() QgsGeometry matchGeom = nodetool->cachedGeometry( match.layer(), match.featureId() ); QgsVertexId vid; - QgsPointV2 pt; + QgsPoint pt; while ( matchGeom.geometry()->nextVertex( vid, pt ) ) { int vindex = matchGeom.vertexNrFromVertexId( vid ); @@ -267,12 +267,12 @@ void QgsNodeTool::deactivate() QgsMapToolAdvancedDigitizing::deactivate(); } -void QgsNodeTool::addDragBand( const QgsPoint &v1, const QgsPoint &v2 ) +void QgsNodeTool::addDragBand( const QgsPointXY &v1, const QgsPointXY &v2 ) { addDragStraightBand( nullptr, v1, v2, false, true, v2 ); } -void QgsNodeTool::addDragStraightBand( QgsVectorLayer *layer, QgsPoint v0, QgsPoint v1, bool moving0, bool moving1, const QgsPoint &mapPoint ) +void QgsNodeTool::addDragStraightBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, bool moving0, bool moving1, const QgsPointXY &mapPoint ) { // if layer is not null, the input coordinates are coming in the layer's CRS rather than map CRS if ( layer ) @@ -296,7 +296,7 @@ void QgsNodeTool::addDragStraightBand( QgsVectorLayer *layer, QgsPoint v0, QgsPo mDragStraightBands << b; } -void QgsNodeTool::addDragCircularBand( QgsVectorLayer *layer, QgsPoint v0, QgsPoint v1, QgsPoint v2, bool moving0, bool moving1, bool moving2, const QgsPoint &mapPoint ) +void QgsNodeTool::addDragCircularBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, QgsPointXY v2, bool moving0, bool moving1, bool moving2, const QgsPointXY &mapPoint ) { // if layer is not null, the input coordinates are coming in the layer's CRS rather than map CRS if ( layer ) @@ -412,8 +412,8 @@ void QgsNodeTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) else if ( mSelectionRect ) { // only handling of selection rect being dragged - QgsPoint pt0 = toMapCoordinates( *mSelectionRectStartPos ); - QgsPoint pt1 = toMapCoordinates( e->pos() ); + QgsPointXY pt0 = toMapCoordinates( *mSelectionRectStartPos ); + QgsPointXY pt1 = toMapCoordinates( e->pos() ); QgsRectangle map_rect( pt0, pt1 ); QList nodes; @@ -432,7 +432,7 @@ void QgsNodeTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) QgsGeometry g = f.geometry(); for ( int i = 0; i < g.geometry()->nCoordinates(); ++i ) { - QgsPoint pt = g.vertexAt( i ); + QgsPointXY pt = g.vertexAt( i ); if ( layerRect.contains( pt ) ) nodes << Vertex( vlayer, f.id(), i ); } @@ -476,7 +476,7 @@ void QgsNodeTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) // into CAD dock widget in order to make it behave as we need if ( !mOverrideCadPoints.isEmpty() ) { - Q_FOREACH ( const QgsPoint &pt, mOverrideCadPoints ) + Q_FOREACH ( const QgsPointXY &pt, mOverrideCadPoints ) { QMouseEvent mouseEvent( QEvent::MouseButtonRelease, toCanvasCoordinates( pt ), @@ -534,7 +534,7 @@ void QgsNodeTool::mouseMoveDraggingVertex( QgsMapMouseEvent *e ) moveDragBands( e->mapPoint() ); } -void QgsNodeTool::moveDragBands( const QgsPoint &mapPoint ) +void QgsNodeTool::moveDragBands( const QgsPointXY &mapPoint ) { for ( int i = 0; i < mDragStraightBands.count(); ++i ) { @@ -568,7 +568,7 @@ void QgsNodeTool::mouseMoveDraggingEdge( QgsMapMouseEvent *e ) mSnapMarker->setVisible( false ); mEdgeCenterMarker->setVisible( false ); - QgsPoint mapPoint = toMapCoordinates( e->pos() ); // do not use e.mapPoint() as it may be snapped + QgsPointXY mapPoint = toMapCoordinates( e->pos() ); // do not use e.mapPoint() as it may be snapped moveDragBands( mapPoint ); } @@ -596,7 +596,7 @@ void QgsNodeTool::removeTemporaryRubberBands() QgsPointLocator::Match QgsNodeTool::snapToEditableLayer( QgsMapMouseEvent *e ) { - QgsPoint mapPoint = toMapCoordinates( e->pos() ); + QgsPointXY mapPoint = toMapCoordinates( e->pos() ); double tol = QgsTolerance::vertexSearchRadius( canvas()->mapSettings() ); QgsSnappingConfig config( QgsProject::instance() ); @@ -637,7 +637,7 @@ QgsPointLocator::Match QgsNodeTool::snapToEditableLayer( QgsMapMouseEvent *e ) return m; } -bool QgsNodeTool::isNearEndpointMarker( const QgsPoint &mapPoint ) +bool QgsNodeTool::isNearEndpointMarker( const QgsPointXY &mapPoint ) { if ( !mEndpointMarkerCenter ) return false; @@ -646,8 +646,8 @@ bool QgsNodeTool::isNearEndpointMarker( const QgsPoint &mapPoint ) double tol = QgsTolerance::vertexSearchRadius( canvas()->mapSettings() ); QgsGeometry geom = cachedGeometryForVertex( *mMouseAtEndpoint ); - QgsPoint vertexPointV2 = geom.vertexAt( mMouseAtEndpoint->vertexId ); - QgsPoint vertexPoint = QgsPoint( vertexPointV2.x(), vertexPointV2.y() ); + QgsPointXY vertexPointV2 = geom.vertexAt( mMouseAtEndpoint->vertexId ); + QgsPointXY vertexPoint = QgsPointXY( vertexPointV2.x(), vertexPointV2.y() ); double distVertex = sqrt( vertexPoint.sqrDist( mapPoint ) ); return distMarker < tol && distMarker < distVertex; @@ -663,12 +663,12 @@ bool QgsNodeTool::isMatchAtEndpoint( const QgsPointLocator::Match &match ) return isEndpointAtVertexIndex( geom, match.vertexIndex() ); } -QgsPoint QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match &match ) +QgsPointXY QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match &match ) { QgsGeometry geom = cachedGeometry( match.layer(), match.featureId() ); - QgsPoint pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, match.vertexIndex() ) ); - QgsPoint pt1 = geom.vertexAt( match.vertexIndex() ); + QgsPointXY pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, match.vertexIndex() ) ); + QgsPointXY pt1 = geom.vertexAt( match.vertexIndex() ); pt0 = toMapCoordinates( match.layer(), pt0 ); pt1 = toMapCoordinates( match.layer(), pt1 ); @@ -679,7 +679,7 @@ QgsPoint QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match &m double angle = atan2( dy, dx ); // to the top: angle=0, to the right: angle=90, to the left: angle=-90 double x = pt1.x() + cos( angle ) * dist; double y = pt1.y() + sin( angle ) * dist; - return QgsPoint( x, y ); + return QgsPointXY( x, y ); } void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e ) @@ -688,7 +688,7 @@ void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e ) { // check if we are still at the endpoint, i.e. whether to keep showing // the endpoint indicator - or go back to snapping to editable layers - QgsPoint mapPoint = toMapCoordinates( e->pos() ); + QgsPointXY mapPoint = toMapCoordinates( e->pos() ); if ( isNearEndpointMarker( mapPoint ) ) { mEndpointMarker->setColor( Qt::red ); @@ -721,7 +721,7 @@ void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e ) if ( isMatchAtEndpoint( m ) ) { mMouseAtEndpoint.reset( new Vertex( m.layer(), m.featureId(), m.vertexIndex() ) ); - mEndpointMarkerCenter.reset( new QgsPoint( positionForEndpointMarker( m ) ) ); + mEndpointMarkerCenter.reset( new QgsPointXY( positionForEndpointMarker( m ) ) ); mEndpointMarker->setCenter( *mEndpointMarkerCenter ); mEndpointMarker->setColor( Qt::gray ); mEndpointMarker->setVisible( true ); @@ -745,10 +745,10 @@ void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e ) // possibility to create new node here - or to move the edge if ( m.type() == QgsPointLocator::Edge ) { - QgsPoint mapPoint = toMapCoordinates( e->pos() ); + QgsPointXY mapPoint = toMapCoordinates( e->pos() ); bool isCircularEdge = false; - QgsPoint p0, p1; + QgsPointXY p0, p1; m.edgePoints( p0, p1 ); QgsGeometry geom = cachedGeometry( m.layer(), m.featureId() ); @@ -756,22 +756,22 @@ void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e ) { // circular edge at the first vertex isCircularEdge = true; - QgsPoint pX = toMapCoordinates( m.layer(), geom.vertexAt( m.vertexIndex() - 1 ) ); + QgsPointXY pX = toMapCoordinates( m.layer(), geom.vertexAt( m.vertexIndex() - 1 ) ); QgsPointSequence points; - QgsGeometryUtils::segmentizeArc( QgsPointV2( pX ), QgsPointV2( p0 ), QgsPointV2( p1 ), points ); + QgsGeometryUtils::segmentizeArc( QgsPoint( pX ), QgsPoint( p0 ), QgsPoint( p1 ), points ); mEdgeBand->reset(); - Q_FOREACH ( const QgsPointV2 &pt, points ) + Q_FOREACH ( const QgsPoint &pt, points ) mEdgeBand->addPoint( pt ); } else if ( isCircularVertex( geom, m.vertexIndex() + 1 ) ) { // circular edge at the second vertex isCircularEdge = true; - QgsPoint pX = toMapCoordinates( m.layer(), geom.vertexAt( m.vertexIndex() + 2 ) ); + QgsPointXY pX = toMapCoordinates( m.layer(), geom.vertexAt( m.vertexIndex() + 2 ) ); QgsPointSequence points; - QgsGeometryUtils::segmentizeArc( QgsPointV2( p0 ), QgsPointV2( p1 ), QgsPointV2( pX ), points ); + QgsGeometryUtils::segmentizeArc( QgsPoint( p0 ), QgsPoint( p1 ), QgsPoint( pX ), points ); mEdgeBand->reset(); - Q_FOREACH ( const QgsPointV2 &pt, points ) + Q_FOREACH ( const QgsPoint &pt, points ) mEdgeBand->addPoint( pt ); } else @@ -782,7 +782,7 @@ void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e ) mEdgeBand->setToGeometry( QgsGeometry::fromPolyline( points ), nullptr ); } - QgsPoint edgeCenter; + QgsPointXY edgeCenter; bool isNearCenter = matchEdgeCenterTest( m, mapPoint, &edgeCenter ); mEdgeCenterMarker->setCenter( edgeCenter ); mEdgeCenterMarker->setColor( isNearCenter ? Qt::red : Qt::gray ); @@ -982,7 +982,7 @@ void QgsNodeTool::deleteNodeEditorSelection() void QgsNodeTool::startDragging( QgsMapMouseEvent *e ) { - QgsPoint mapPoint = toMapCoordinates( e->pos() ); + QgsPointXY mapPoint = toMapCoordinates( e->pos() ); if ( isNearEndpointMarker( mapPoint ) ) { startDraggingAddVertexAtEndpoint( mapPoint ); @@ -1013,7 +1013,7 @@ void QgsNodeTool::startDragging( QgsMapMouseEvent *e ) } } -void QgsNodeTool::startDraggingMoveVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match &m ) +void QgsNodeTool::startDraggingMoveVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match &m ) { Q_ASSERT( m.hasVertex() ); @@ -1027,15 +1027,15 @@ void QgsNodeTool::startDraggingMoveVertex( const QgsPoint &mapPoint, const QgsPo setHighlightedNodesVisible( false ); // hide any extra highlight of vertices until we are done with moving - QgsPoint origDraggingVertexPoint = geom.vertexAt( mDraggingVertex->vertexId ); + QgsPointXY origDraggingVertexPoint = geom.vertexAt( mDraggingVertex->vertexId ); // if there are other highlighted nodes, they should be dragged as well with their offset Q_FOREACH ( const Vertex &v, mSelectedNodes ) { if ( v != *mDraggingVertex ) { - QgsPoint origPointV = cachedGeometryForVertex( v ).vertexAt( v.vertexId ); - QgsPoint origPointLayer = origDraggingVertexPoint; + QgsPointXY origPointV = cachedGeometryForVertex( v ).vertexAt( v.vertexId ); + QgsPointXY origPointLayer = origDraggingVertexPoint; if ( v.layer->crs() != mDraggingVertex->layer->crs() ) // reproject if necessary origPointLayer = toLayerCoordinates( v.layer, toMapCoordinates( m.layer(), origDraggingVertexPoint ) ); QgsVector offset = origPointV - origPointLayer; @@ -1079,12 +1079,12 @@ void QgsNodeTool::startDraggingMoveVertex( const QgsPoint &mapPoint, const QgsPo Q_FOREACH ( const Vertex &v, mDraggingExtraVertices ) movingVertices << v; - QgsPoint dragVertexMapPoint = m.point(); + QgsPointXY dragVertexMapPoint = m.point(); buildDragBandsForVertices( movingVertices, dragVertexMapPoint ); } -void QgsNodeTool::buildDragBandsForVertices( const QSet &movingVertices, const QgsPoint &dragVertexMapPoint ) +void QgsNodeTool::buildDragBandsForVertices( const QSet &movingVertices, const QgsPointXY &dragVertexMapPoint ) { QSet verticesInStraightBands; // always the vertex with lower index @@ -1096,7 +1096,7 @@ void QgsNodeTool::buildDragBandsForVertices( const QSet &movingVertices, { int v0idx, v1idx; QgsGeometry geom = cachedGeometry( v.layer, v.fid ); - QgsPoint pt = geom.vertexAt( v.vertexId ); + QgsPointXY pt = geom.vertexAt( v.vertexId ); geom.adjacentVertices( v.vertexId, v0idx, v1idx ); @@ -1198,7 +1198,7 @@ void QgsNodeTool::buildDragBandsForVertices( const QSet &movingVertices, // this is a standalone point - we need to use a marker for it // to give some feedback to the user - QgsPoint ptMapPoint = toMapCoordinates( v.layer, pt ); + QgsPointXY ptMapPoint = toMapCoordinates( v.layer, pt ); QgsVertexMarker *marker = new QgsVertexMarker( mCanvas ); marker->setIconType( QgsVertexMarker::ICON_X ); marker->setColor( Qt::red ); @@ -1211,7 +1211,7 @@ void QgsNodeTool::buildDragBandsForVertices( const QSet &movingVertices, } } -QList QgsNodeTool::layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPoint &mapPoint ) +QList QgsNodeTool::layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPointXY &mapPoint ) { MatchCollectingFilter myfilter( this ); QgsPointLocator *loc = canvas()->snappingUtils()->locatorForLayer( layer ); @@ -1234,11 +1234,11 @@ void QgsNodeTool::startDraggingAddVertex( const QgsPointLocator::Match &m ) QgsGeometry geom = cachedGeometry( m.layer(), m.featureId() ); // TODO: handles rings correctly? - QgsPoint v0 = geom.vertexAt( m.vertexIndex() ); - QgsPoint v1 = geom.vertexAt( m.vertexIndex() + 1 ); + QgsPointXY v0 = geom.vertexAt( m.vertexIndex() ); + QgsPointXY v1 = geom.vertexAt( m.vertexIndex() + 1 ); - QgsPoint map_v0 = toMapCoordinates( m.layer(), v0 ); - QgsPoint map_v1 = toMapCoordinates( m.layer(), v1 ); + QgsPointXY map_v0 = toMapCoordinates( m.layer(), v0 ); + QgsPointXY map_v1 = toMapCoordinates( m.layer(), v1 ); if ( v0.x() != 0 || v0.y() != 0 ) addDragBand( map_v0, m.point() ); @@ -1249,7 +1249,7 @@ void QgsNodeTool::startDraggingAddVertex( const QgsPointLocator::Match &m ) mOverrideCadPoints << m.point() << m.point(); } -void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPoint &mapPoint ) +void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint ) { Q_ASSERT( mMouseAtEndpoint ); @@ -1262,19 +1262,19 @@ void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPoint &mapPoint ) mDraggingExtraVerticesOffset.clear(); QgsGeometry geom = cachedGeometry( mMouseAtEndpoint->layer, mMouseAtEndpoint->fid ); - QgsPoint v0 = geom.vertexAt( mMouseAtEndpoint->vertexId ); - QgsPoint map_v0 = toMapCoordinates( mMouseAtEndpoint->layer, v0 ); + QgsPointXY v0 = geom.vertexAt( mMouseAtEndpoint->vertexId ); + QgsPointXY map_v0 = toMapCoordinates( mMouseAtEndpoint->layer, v0 ); addDragBand( map_v0, mapPoint ); // setup CAD dock previous points to endpoint and the previous point - QgsPoint pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, mMouseAtEndpoint->vertexId ) ); - QgsPoint pt1 = geom.vertexAt( mMouseAtEndpoint->vertexId ); + QgsPointXY pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, mMouseAtEndpoint->vertexId ) ); + QgsPointXY pt1 = geom.vertexAt( mMouseAtEndpoint->vertexId ); mOverrideCadPoints.clear(); mOverrideCadPoints << pt0 << pt1; } -void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPoint &mapPoint ) +void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint ) { Q_ASSERT( m.hasEdge() ); @@ -1303,7 +1303,7 @@ void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsP buildDragBandsForVertices( movingVertices, mapPoint ); - QgsPoint layerPoint = toLayerCoordinates( m.layer(), mapPoint ); + QgsPointXY layerPoint = toLayerCoordinates( m.layer(), mapPoint ); Q_FOREACH ( const Vertex &v, movingVertices ) { @@ -1335,7 +1335,7 @@ void QgsNodeTool::stopDragging() setHighlightedNodesVisible( true ); // highlight can be shown again } -QgsPoint QgsNodeTool::matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPoint &mapPoint, const QgsPointLocator::Match *match ) +QgsPointXY QgsNodeTool::matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPointXY &mapPoint, const QgsPointLocator::Match *match ) { // try to use point coordinates in the original CRS if it is the same if ( match && match->hasVertex() && match->layer() && match->layer()->crs() == destLayer->crs() ) @@ -1350,7 +1350,7 @@ QgsPoint QgsNodeTool::matchToLayerPoint( const QgsVectorLayer *destLayer, const return toLayerCoordinates( destLayer, mapPoint ); } -void QgsNodeTool::moveEdge( const QgsPoint &mapPoint ) +void QgsNodeTool::moveEdge( const QgsPointXY &mapPoint ) { stopDragging(); @@ -1360,7 +1360,7 @@ void QgsNodeTool::moveEdge( const QgsPoint &mapPoint ) applyEditsToLayers( edits ); } -void QgsNodeTool::moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match *mapPointMatch ) +void QgsNodeTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match *mapPointMatch ) { // deactivate advanced digitizing setMode( CaptureNone ); @@ -1373,7 +1373,7 @@ void QgsNodeTool::moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::M QgsGeometry geom = cachedGeometryForVertex( *mDraggingVertex ); stopDragging(); - QgsPoint layerPoint = matchToLayerPoint( dragLayer, mapPoint, mapPointMatch ); + QgsPointXY layerPoint = matchToLayerPoint( dragLayer, mapPoint, mapPointMatch ); QgsVertexId vid; if ( !geom.vertexIdFromVertexNr( dragVertexId, vid ) ) @@ -1390,7 +1390,7 @@ void QgsNodeTool::moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::M if ( addingAtEndpoint && vid.vertex != 0 ) // appending? vid.vertex++; - if ( !geomTmp->insertVertex( vid, QgsPointV2( layerPoint ) ) ) + if ( !geomTmp->insertVertex( vid, QgsPoint( layerPoint ) ) ) { QgsDebugMsg( "append vertex failed!" ); return; @@ -1398,7 +1398,7 @@ void QgsNodeTool::moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::M } else { - if ( !geomTmp->moveVertex( vid, QgsPointV2( layerPoint ) ) ) + if ( !geomTmp->moveVertex( vid, QgsPoint( layerPoint ) ) ) { QgsDebugMsg( "move vertex failed!" ); return; @@ -1433,7 +1433,7 @@ void QgsNodeTool::moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::M } -void QgsNodeTool::addExtraVerticesToEdits( QgsNodeTool::NodeEdits &edits, const QgsPoint &mapPoint, QgsVectorLayer *dragLayer, const QgsPoint &layerPoint ) +void QgsNodeTool::addExtraVerticesToEdits( QgsNodeTool::NodeEdits &edits, const QgsPointXY &mapPoint, QgsVectorLayer *dragLayer, const QgsPointXY &layerPoint ) { Q_ASSERT( mDraggingExtraVertices.count() == mDraggingExtraVerticesOffset.count() ); // add moved vertices from other layers @@ -1449,7 +1449,7 @@ void QgsNodeTool::addExtraVerticesToEdits( QgsNodeTool::NodeEdits &edits, const else topoGeom = QgsGeometry( cachedGeometryForVertex( topo ) ); - QgsPoint point; + QgsPointXY point; if ( dragLayer && topo.layer->crs() == dragLayer->crs() ) point = layerPoint; // this point may come from exact match so it may be more precise else @@ -1516,8 +1516,8 @@ void QgsNodeTool::deleteVertex() QSet topoVerticesToDelete; Q_FOREACH ( const Vertex &vertexToDelete, toDelete ) { - QgsPoint layerPt = cachedGeometryForVertex( vertexToDelete ).vertexAt( vertexToDelete.vertexId ); - QgsPoint mapPt = toMapCoordinates( vertexToDelete.layer, layerPt ); + QgsPointXY layerPt = cachedGeometryForVertex( vertexToDelete ).vertexAt( vertexToDelete.vertexId ); + QgsPointXY mapPt = toMapCoordinates( vertexToDelete.layer, layerPt ); Q_FOREACH ( const QgsPointLocator::Match &otherMatch, layerVerticesSnappedToPoint( vertexToDelete.layer, mapPt ) ) { Vertex otherVertex( otherMatch.layer(), otherMatch.featureId(), otherMatch.vertexIndex() ); @@ -1630,10 +1630,10 @@ void QgsNodeTool::deleteVertex() int vertexId = vertex.vertexId; // if next vertex is not available, use the previous one - if ( geom.vertexAt( vertexId ) == QgsPoint() ) + if ( geom.vertexAt( vertexId ) == QgsPointXY() ) vertexId -= 1; - if ( geom.vertexAt( vertexId ) != QgsPoint() ) + if ( geom.vertexAt( vertexId ) != QgsPointXY() ) { QList nodes_new; nodes_new << Vertex( vertex.layer, vertex.fid, vertexId ); @@ -1690,8 +1690,8 @@ void QgsNodeTool::highlightAdjacentVertex( double offset ) else newVertexId = node.vertexId + offset; - QgsPoint pt = geom.vertexAt( newVertexId ); - if ( pt != QgsPoint() ) + QgsPointXY pt = geom.vertexAt( newVertexId ); + if ( pt != QgsPointXY() ) node = Vertex( node.layer, node.fid, newVertexId ); setHighlightedNodes( QList() << node ); zoomToNode( node ); // make sure the node is visible @@ -1721,9 +1721,9 @@ void QgsNodeTool::stopSelectionRect() mSelectionRect.reset(); } -bool QgsNodeTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPoint &mapPoint, QgsPoint *edgeCenterPtr ) +bool QgsNodeTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint, QgsPointXY *edgeCenterPtr ) { - QgsPoint p0, p1; + QgsPointXY p0, p1; m.edgePoints( p0, p1 ); QgsGeometry geom = cachedGeometry( m.layer(), m.featureId() ); @@ -1743,7 +1743,7 @@ bool QgsNodeTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const Qg p1 = polyline[1]; } - QgsPoint edgeCenter( ( p0.x() + p1.x() ) / 2, ( p0.y() + p1.y() ) / 2 ); + QgsPointXY edgeCenter( ( p0.x() + p1.x() ) / 2, ( p0.y() + p1.y() ) / 2 ); if ( edgeCenterPtr ) *edgeCenterPtr = edgeCenter; @@ -1753,16 +1753,16 @@ bool QgsNodeTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const Qg return isNearCenter; } -void QgsNodeTool::CircularBand::updateRubberBand( const QgsPoint &mapPoint ) +void QgsNodeTool::CircularBand::updateRubberBand( const QgsPointXY &mapPoint ) { QgsPointSequence points; - QgsPoint v0 = moving0 ? mapPoint + offset0 : p0; - QgsPoint v1 = moving1 ? mapPoint + offset1 : p1; - QgsPoint v2 = moving2 ? mapPoint + offset2 : p2; - QgsGeometryUtils::segmentizeArc( QgsPointV2( v0 ), QgsPointV2( v1 ), QgsPointV2( v2 ), points ); + QgsPointXY v0 = moving0 ? mapPoint + offset0 : p0; + QgsPointXY v1 = moving1 ? mapPoint + offset1 : p1; + QgsPointXY v2 = moving2 ? mapPoint + offset2 : p2; + QgsGeometryUtils::segmentizeArc( QgsPoint( v0 ), QgsPoint( v1 ), QgsPoint( v2 ), points ); // it would be useful to have QgsRubberBand::setPoints() call band->reset(); - Q_FOREACH ( const QgsPointV2 &p, points ) + Q_FOREACH ( const QgsPoint &p, points ) band->addPoint( p ); } @@ -1878,8 +1878,8 @@ void QgsNodeTool::validateGeometry( QgsVectorLayer *layer, QgsFeatureId featureI void QgsNodeTool::zoomToNode( const Vertex &node ) { - QgsPoint newCenter = cachedGeometryForVertex( node ).vertexAt( node.vertexId ); - QgsPoint mapPoint = mCanvas->mapSettings().layerToMapCoordinates( node.layer, newCenter ); + QgsPointXY newCenter = cachedGeometryForVertex( node ).vertexAt( node.vertexId ); + QgsPointXY mapPoint = mCanvas->mapSettings().layerToMapCoordinates( node.layer, newCenter ); QPolygonF ext = mCanvas->mapSettings().visiblePolygon(); if ( !ext.containsPoint( mapPoint.toQPointF(), Qt::OddEvenFill ) ) { diff --git a/src/app/nodetool/qgsnodetool.h b/src/app/nodetool/qgsnodetool.h index 753abe0d89a..9808572008a 100644 --- a/src/app/nodetool/qgsnodetool.h +++ b/src/app/nodetool/qgsnodetool.h @@ -96,15 +96,15 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing private: - void buildDragBandsForVertices( const QSet &movingVertices, const QgsPoint &dragVertexMapPoint ); + void buildDragBandsForVertices( const QSet &movingVertices, const QgsPointXY &dragVertexMapPoint ); - void addDragBand( const QgsPoint &v1, const QgsPoint &v2 ); + void addDragBand( const QgsPointXY &v1, const QgsPointXY &v2 ); - void addDragStraightBand( QgsVectorLayer *layer, QgsPoint v0, QgsPoint v1, bool moving0, bool moving1, const QgsPoint &mapPoint ); + void addDragStraightBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, bool moving0, bool moving1, const QgsPointXY &mapPoint ); - void addDragCircularBand( QgsVectorLayer *layer, QgsPoint v0, QgsPoint v1, QgsPoint v2, bool moving0, bool moving1, bool moving2, const QgsPoint &mapPoint ); + void addDragCircularBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, QgsPointXY v2, bool moving0, bool moving1, bool moving2, const QgsPointXY &mapPoint ); - void moveDragBands( const QgsPoint &mapPoint ); + void moveDragBands( const QgsPointXY &mapPoint ); void clearDragBands(); @@ -121,11 +121,11 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing QgsPointLocator::Match snapToEditableLayer( QgsMapMouseEvent *e ); //! check whether we are still close to the mEndpointMarker - bool isNearEndpointMarker( const QgsPoint &mapPoint ); + bool isNearEndpointMarker( const QgsPointXY &mapPoint ); bool isMatchAtEndpoint( const QgsPointLocator::Match &match ); - QgsPoint positionForEndpointMarker( const QgsPointLocator::Match &match ); + QgsPointXY positionForEndpointMarker( const QgsPointLocator::Match &match ); void mouseMoveNotDragging( QgsMapMouseEvent *e ); @@ -133,31 +133,31 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing void startDragging( QgsMapMouseEvent *e ); - void startDraggingMoveVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match &m ); + void startDraggingMoveVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match &m ); //! Get list of matches of all vertices of a layer exactly snapped to a map point - QList layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPoint &mapPoint ); + QList layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPointXY &mapPoint ); void startDraggingAddVertex( const QgsPointLocator::Match &m ); - void startDraggingAddVertexAtEndpoint( const QgsPoint &mapPoint ); + void startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint ); - void startDraggingEdge( const QgsPointLocator::Match &m, const QgsPoint &mapPoint ); + void startDraggingEdge( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint ); void stopDragging(); - QgsPoint matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPoint &mapPoint, const QgsPointLocator::Match *match ); + QgsPointXY matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPointXY &mapPoint, const QgsPointLocator::Match *match ); //! Finish moving of an edge - void moveEdge( const QgsPoint &mapPoint ); + void moveEdge( const QgsPointXY &mapPoint ); - void moveVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match *mapPointMatch ); + void moveVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match *mapPointMatch ); void deleteVertex(); typedef QHash > NodeEdits; - void addExtraVerticesToEdits( NodeEdits &edits, const QgsPoint &mapPoint, QgsVectorLayer *dragLayer = nullptr, const QgsPoint &layerPoint = QgsPoint() ); + void addExtraVerticesToEdits( NodeEdits &edits, const QgsPointXY &mapPoint, QgsVectorLayer *dragLayer = nullptr, const QgsPointXY &layerPoint = QgsPointXY() ); void applyEditsToLayers( NodeEdits &edits ); @@ -180,7 +180,7 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing //! Using a given edge match and original map point, find out //! center of the edge and whether we are close enough to the center - bool matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPoint &mapPoint, QgsPoint *edgeCenterPtr = nullptr ); + bool matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint, QgsPointXY *edgeCenterPtr = nullptr ); void cleanupNodeEditor(); @@ -233,7 +233,7 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing struct StraightBand { QgsRubberBand *band = nullptr; //!< Pointer to the actual rubber band - QgsPoint p0, p1; //!< What are the original positions of points (in map units) + QgsPointXY p0, p1; //!< What are the original positions of points (in map units) bool moving0, moving1; //!< Which points of the band are moving with mouse cursor QgsVector offset0, offset1; //!< If the point is moving, what is the offset from the mouse cursor }; @@ -242,12 +242,12 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing struct CircularBand { QgsRubberBand *band = nullptr; //!< Pointer to the actual rubber band - QgsPoint p0, p1, p2; //!< What are the original positions of points (in map units) + QgsPointXY p0, p1, p2; //!< What are the original positions of points (in map units) bool moving0, moving1, moving2; //!< Which points of the band are moving with mouse cursor QgsVector offset0, offset1, offset2; //!< If the point is moving, what is the offset from the mouse cursor //! update geometry of the rubber band band on the current mouse cursor position (in map units) - void updateRubberBand( const QgsPoint &mapPoint ); + void updateRubberBand( const QgsPointXY &mapPoint ); }; //! list of active straight line rubber bands @@ -289,8 +289,8 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing //! Vertex instance or None std::unique_ptr mMouseAtEndpoint; - //! QgsPoint or None (can't get center from QgsVertexMarker) - std::unique_ptr mEndpointMarkerCenter; + //! QgsPointXY or None (can't get center from QgsVertexMarker) + std::unique_ptr mEndpointMarkerCenter; //! marker shown near the end of a curve to suggest that the user //! may add a new vertex at the end of the curve QgsVertexMarker *mEndpointMarker = nullptr; @@ -302,7 +302,7 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing //! List of two points that will be forced into CAD dock with fake mouse events //! to allow correct functioning of node tool with CAD dock. //! (CAD dock does various assumptions that work with simple capture tools, but not with node tool) - QList mOverrideCadPoints; + QList mOverrideCadPoints; //! When double-clicking to add a new vertex, this member keeps the snap //! match from "press" event used to be used in following "release" event diff --git a/src/app/nodetool/qgsselectedfeature.cpp b/src/app/nodetool/qgsselectedfeature.cpp index 5362c32b9cb..7e410f1ad56 100644 --- a/src/app/nodetool/qgsselectedfeature.cpp +++ b/src/app/nodetool/qgsselectedfeature.cpp @@ -280,7 +280,7 @@ void QgsSelectedFeature::createVertexMap() } QgsVertexId vertexId; - QgsPointV2 pt; + QgsPoint pt; while ( geom->nextVertex( vertexId, pt ) ) { mVertexMap.append( new QgsVertexEntry( mCanvas, mVlayer, pt, vertexId, tr( "ring %1, vertex %2" ).arg( vertexId.ring ).arg( vertexId.vertex ) ) ); diff --git a/src/app/nodetool/qgsvertexentry.cpp b/src/app/nodetool/qgsvertexentry.cpp index ca401232f81..3966ac901c7 100644 --- a/src/app/nodetool/qgsvertexentry.cpp +++ b/src/app/nodetool/qgsvertexentry.cpp @@ -15,7 +15,7 @@ #include "nodetool/qgsvertexentry.h" -QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, const QgsPointV2 &p, QgsVertexId vertexId, const QString &tooltip, QgsVertexMarker::IconType type, int penWidth ) +QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, const QgsPoint &p, QgsVertexId vertexId, const QString &tooltip, QgsVertexMarker::IconType type, int penWidth ) : mSelected( false ) , mPoint( p ) , mVertexId( vertexId ) @@ -36,7 +36,7 @@ QgsVertexEntry::~QgsVertexEntry() void QgsVertexEntry::placeMarker() { - QgsPoint pm = mCanvas->mapSettings().layerToMapCoordinates( mLayer, pointV1() ); + QgsPointXY pm = mCanvas->mapSettings().layerToMapCoordinates( mLayer, pointV1() ); if ( mCanvas->extent().contains( pm ) ) { diff --git a/src/app/nodetool/qgsvertexentry.h b/src/app/nodetool/qgsvertexentry.h index c1f6c93a557..fbca427fd27 100644 --- a/src/app/nodetool/qgsvertexentry.h +++ b/src/app/nodetool/qgsvertexentry.h @@ -24,7 +24,7 @@ class QgsVertexEntry { bool mSelected; - QgsPointV2 mPoint; + QgsPoint mPoint; QgsVertexId mVertexId; int mPenWidth; QString mToolTip; @@ -36,7 +36,7 @@ class QgsVertexEntry public: QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, - const QgsPointV2 &p, + const QgsPoint &p, QgsVertexId vertexId, const QString &tooltip = QString::null, QgsVertexMarker::IconType type = QgsVertexMarker::ICON_BOX, @@ -46,8 +46,8 @@ class QgsVertexEntry QgsVertexEntry( const QgsVertexEntry &rh ) = delete; QgsVertexEntry &operator=( const QgsVertexEntry &rh ) = delete; - const QgsPointV2 &point() const { return mPoint; } - QgsPoint pointV1() const { return QgsPoint( mPoint.x(), mPoint.y() ); } + const QgsPoint &point() const { return mPoint; } + QgsPointXY pointV1() const { return QgsPointXY( mPoint.x(), mPoint.y() ); } QgsVertexId vertexId() const { return mVertexId; } bool isSelected() const { return mSelected; } diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 8621ff22fc7..304778daee4 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -8711,7 +8711,7 @@ void QgisApp::layerSubsetString() delete qb; } -void QgisApp::saveLastMousePosition( const QgsPoint &p ) +void QgisApp::saveLastMousePosition( const QgsPointXY &p ) { if ( mMapTipsVisible ) { @@ -9101,8 +9101,8 @@ void QgisApp::legendLayerZoomNative() // get length of central canvas pixel width in source raster crs QgsRectangle e = mMapCanvas->extent(); QSize s = mMapCanvas->mapSettings().outputSize(); - QgsPoint p1( e.center().x(), e.center().y() ); - QgsPoint p2( e.center().x() + e.width() / s.width(), e.center().y() + e.height() / s.height() ); + QgsPointXY p1( e.center().x(), e.center().y() ); + QgsPointXY p2( e.center().x() + e.width() / s.width(), e.center().y() + e.height() / s.height() ); QgsCoordinateTransform ct( mMapCanvas->mapSettings().destinationCrs(), layer->crs() ); p1 = ct.transform( p1 ); p2 = ct.transform( p2 ); diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index 71eefb0629e..1e5755e75dd 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -73,7 +73,7 @@ class QgsMapToolIdentifyAction; class QgsPluginLayer; class QgsPluginLayer; class QgsPluginManager; -class QgsPoint; +class QgsPointXY; class QgsProviderRegistry; class QgsPythonUtils; class QgsRasterLayer; @@ -886,7 +886,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow //! toggles whether the current selected layer is in overview or not void isInOverview(); //! Store the position for map tool tip - void saveLastMousePosition( const QgsPoint & ); + void saveLastMousePosition( const QgsPointXY & ); //! Slot to show current map scale; void showScale( double scale ); //! Slot to handle user rotation input; @@ -1875,7 +1875,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow QTimer *mpMapTipsTimer = nullptr; //! Point of last mouse position in map coordinates (used with MapTips) - QgsPoint mLastMapPosition; + QgsPointXY mLastMapPosition; //! Maptip object QgsMapTip *mpMaptip = nullptr; diff --git a/src/app/qgsdecorationgrid.cpp b/src/app/qgsdecorationgrid.cpp index a46282ce1b4..ef619aa9003 100644 --- a/src/app/qgsdecorationgrid.cpp +++ b/src/app/qgsdecorationgrid.cpp @@ -594,7 +594,7 @@ int QgsDecorationGrid::xGridLines( const QgsMapSettings &mapSettings, QList< QPa QPointF p1 = lineEast.pointAt( t ); QLineF line( p0, p1 ); clipByRect( line, canvasPoly ); - line = QLineF( m2p.transform( QgsPoint( line.pointAt( 0 ) ) ).toQPointF(), m2p.transform( QgsPoint( line.pointAt( 1 ) ) ).toQPointF() ); + line = QLineF( m2p.transform( QgsPointXY( line.pointAt( 0 ) ) ).toQPointF(), m2p.transform( QgsPointXY( line.pointAt( 1 ) ) ).toQPointF() ); lines.push_back( qMakePair( p0.y(), line ) ); dist += mGridIntervalY; } @@ -639,7 +639,7 @@ int QgsDecorationGrid::yGridLines( const QgsMapSettings &mapSettings, QList< QPa QPointF p1( lineSouth.pointAt( t ) ); QLineF line( p0, p1 ); clipByRect( line, canvasPoly ); - line = QLineF( m2p.transform( QgsPoint( line.pointAt( 0 ) ) ).toQPointF(), m2p.transform( QgsPoint( line.pointAt( 1 ) ) ).toQPointF() ); + line = QLineF( m2p.transform( QgsPointXY( line.pointAt( 0 ) ) ).toQPointF(), m2p.transform( QgsPointXY( line.pointAt( 1 ) ) ).toQPointF() ); lines.push_back( qMakePair( p0.x(), line ) ); dist += mGridIntervalX; } diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 79eddc78001..93778223794 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -1645,7 +1645,7 @@ void QgsIdentifyResultsDialog::zoomToFeature() if ( rect.isEmpty() ) { - QgsPoint c = rect.center(); + QgsPointXY c = rect.center(); rect = mCanvas->extent(); rect.scale( 0.5, &c ); } diff --git a/src/app/qgsmapcanvasdockwidget.cpp b/src/app/qgsmapcanvasdockwidget.cpp index 07e62323e46..2314652823f 100644 --- a/src/app/qgsmapcanvasdockwidget.cpp +++ b/src/app/qgsmapcanvasdockwidget.cpp @@ -402,7 +402,7 @@ void QgsMapCanvasDockWidget::settingsMenuAboutToShow() whileBlocking( mActionShowAnnotations )->setChecked( mMapCanvas->annotationsVisible() ); } -void QgsMapCanvasDockWidget::syncMarker( const QgsPoint &p ) +void QgsMapCanvasDockWidget::syncMarker( const QgsPointXY &p ) { if ( !mXyMarker->isVisible() ) return; @@ -410,7 +410,7 @@ void QgsMapCanvasDockWidget::syncMarker( const QgsPoint &p ) // reproject point QgsCoordinateTransform ct( mMainCanvas->mapSettings().destinationCrs(), mMapCanvas->mapSettings().destinationCrs() ); - QgsPoint t = p; + QgsPointXY t = p; try { t = ct.transform( p ); diff --git a/src/app/qgsmapcanvasdockwidget.h b/src/app/qgsmapcanvasdockwidget.h index 239f7684569..eaba859ec99 100644 --- a/src/app/qgsmapcanvasdockwidget.h +++ b/src/app/qgsmapcanvasdockwidget.h @@ -145,7 +145,7 @@ class APP_EXPORT QgsMapCanvasDockWidget : public QgsDockWidget, private Ui::QgsM void mapCrsChanged(); void menuAboutToShow(); void settingsMenuAboutToShow(); - void syncMarker( const QgsPoint &p ); + void syncMarker( const QgsPointXY &p ); void mapScaleChanged(); void updateExtentRect(); void showLabels( bool show ); diff --git a/src/app/qgsmaptooladdcircularstring.cpp b/src/app/qgsmaptooladdcircularstring.cpp index 53dc8464acf..ef28bff66d1 100644 --- a/src/app/qgsmaptooladdcircularstring.cpp +++ b/src/app/qgsmaptooladdcircularstring.cpp @@ -152,9 +152,9 @@ void QgsMapToolAddCircularString::activate() if ( curve ) { //mParentTool->captureCurve() is in layer coordinates, but we need map coordinates - QgsPointV2 endPointLayerCoord = curve->endPoint(); - QgsPoint mapPoint = toMapCoordinates( mCanvas->currentLayer(), QgsPoint( endPointLayerCoord.x(), endPointLayerCoord.y() ) ); - mPoints.append( QgsPointV2( mapPoint ) ); + QgsPoint endPointLayerCoord = curve->endPoint(); + QgsPointXY mapPoint = toMapCoordinates( mCanvas->currentLayer(), QgsPointXY( endPointLayerCoord.x(), endPointLayerCoord.y() ) ); + mPoints.append( QgsPoint( mapPoint ) ); if ( !mTempRubberBand ) { mTempRubberBand = createGeometryRubberBand( ( mode() == CapturePolygon ) ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry, true ); @@ -162,7 +162,7 @@ void QgsMapToolAddCircularString::activate() } QgsCircularString *c = new QgsCircularString(); QgsPointSequence rubberBandPoints = mPoints; - rubberBandPoints.append( QgsPointV2( mapPoint ) ); + rubberBandPoints.append( QgsPoint( mapPoint ) ); c->setPoints( rubberBandPoints ); mTempRubberBand->setGeometry( c ); } @@ -188,13 +188,13 @@ void QgsMapToolAddCircularString::createCenterPointRubberBand() if ( rubberBandGeom ) { QgsVertexId idx( 0, 0, 2 ); - QgsPointV2 pt = rubberBandGeom->vertexAt( idx ); + QgsPoint pt = rubberBandGeom->vertexAt( idx ); updateCenterPointRubberBand( pt ); } } } -void QgsMapToolAddCircularString::updateCenterPointRubberBand( const QgsPointV2 &pt ) +void QgsMapToolAddCircularString::updateCenterPointRubberBand( const QgsPoint &pt ) { if ( !mShowCenterPointRubberBand || !mCenterPointRubberBand || mPoints.size() < 2 ) { @@ -214,7 +214,7 @@ void QgsMapToolAddCircularString::updateCenterPointRubberBand( const QgsPointV2 csPoints.append( pt ); cs->setPoints( csPoints ); - QgsPointV2 center; + QgsPoint center; double radius; QgsGeometryUtils::circleCenterRadius( csPoints.at( 0 ), csPoints.at( 1 ), csPoints.at( 2 ), radius, center.rx(), center.ry() ); diff --git a/src/app/qgsmaptooladdcircularstring.h b/src/app/qgsmaptooladdcircularstring.h index 2e7d04ae8cb..89f8bedd13b 100644 --- a/src/app/qgsmaptooladdcircularstring.h +++ b/src/app/qgsmaptooladdcircularstring.h @@ -56,7 +56,7 @@ class QgsMapToolAddCircularString: public QgsMapToolCapture QgsGeometryRubberBand *mCenterPointRubberBand = nullptr; void createCenterPointRubberBand(); - void updateCenterPointRubberBand( const QgsPointV2 &pt ); + void updateCenterPointRubberBand( const QgsPoint &pt ); void removeCenterPointRubberBand(); }; diff --git a/src/app/qgsmaptooladdfeature.cpp b/src/app/qgsmaptooladdfeature.cpp index 29c098fcc1d..a729f58bccb 100644 --- a/src/app/qgsmaptooladdfeature.cpp +++ b/src/app/qgsmaptooladdfeature.cpp @@ -109,15 +109,15 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) - QgsPoint savePoint; //point in layer coordinates + QgsPointXY savePoint; //point in layer coordinates try { - QgsPointV2 fetchPoint; + QgsPoint fetchPoint; int res; res = fetchLayerPoint( e->mapPointMatch(), fetchPoint ); if ( res == 0 ) { - savePoint = QgsPoint( fetchPoint.x(), fetchPoint.y() ); + savePoint = QgsPointXY( fetchPoint.x(), fetchPoint.y() ); } else { @@ -146,7 +146,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) } else if ( layerWKBType == QgsWkbTypes::Point25D ) { - g = QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) ); + g = QgsGeometry( new QgsPoint( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) ); } else if ( layerWKBType == QgsWkbTypes::MultiPoint ) { @@ -155,7 +155,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) else if ( layerWKBType == QgsWkbTypes::MultiPoint25D ) { QgsMultiPointV2 *mp = new QgsMultiPointV2(); - mp->addGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) ); + mp->addGeometry( new QgsPoint( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) ); g = QgsGeometry( mp ); } else diff --git a/src/app/qgsmaptooladdpart.cpp b/src/app/qgsmaptooladdpart.cpp index 355ae17bb98..9b0daa371bd 100644 --- a/src/app/qgsmaptooladdpart.cpp +++ b/src/app/qgsmaptooladdpart.cpp @@ -80,10 +80,10 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { case CapturePoint: { - QgsPointV2 layerPoint; - QgsPoint mapPoint = e->mapPoint(); + QgsPoint layerPoint; + QgsPointXY mapPoint = e->mapPoint(); - if ( nextPoint( QgsPointV2( mapPoint ), layerPoint ) != 0 ) + if ( nextPoint( QgsPoint( mapPoint ), layerPoint ) != 0 ) { QgsDebugMsg( "nextPoint failed" ); return; diff --git a/src/app/qgsmaptoolannotation.cpp b/src/app/qgsmaptoolannotation.cpp index 091bbaebe67..5ccb4b7f538 100644 --- a/src/app/qgsmaptoolannotation.cpp +++ b/src/app/qgsmaptoolannotation.cpp @@ -121,7 +121,7 @@ void QgsMapToolAnnotation::canvasPressEvent( QgsMapMouseEvent *e ) QgsAnnotation *annotation = createItem(); if ( annotation ) { - QgsPoint mapPos = transformCanvasToAnnotation( toMapCoordinates( e->pos() ), annotation ); + QgsPointXY mapPos = transformCanvasToAnnotation( toMapCoordinates( e->pos() ), annotation ); annotation->setMapPosition( mapPos ); annotation->setMapPositionCrs( mCanvas->mapSettings().destinationCrs() ); annotation->setRelativePosition( QPointF( e->posF().x() / mCanvas->width(), @@ -182,7 +182,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent *e ) { if ( mCurrentMoveAction == QgsMapCanvasAnnotationItem::MoveMapPosition ) { - QgsPoint mapPos = transformCanvasToAnnotation( e->snapPoint( QgsMapMouseEvent::SnapProjectConfig ), annotation ); + QgsPointXY mapPos = transformCanvasToAnnotation( e->snapPoint( QgsMapMouseEvent::SnapProjectConfig ), annotation ); annotation->setMapPosition( mapPos ); annotation->setRelativePosition( QPointF( e->posF().x() / mCanvas->width(), e->posF().y() / mCanvas->height() ) ); @@ -200,7 +200,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent *e ) } else { - QgsPoint mapPos = transformCanvasToAnnotation( toMapCoordinates( newCanvasPos.toPoint() ), annotation ); + QgsPointXY mapPos = transformCanvasToAnnotation( toMapCoordinates( newCanvasPos.toPoint() ), annotation ); annotation->setMapPosition( mapPos ); annotation->setRelativePosition( QPointF( newCanvasPos.x() / mCanvas->width(), newCanvasPos.y() / mCanvas->height() ) ); @@ -359,7 +359,7 @@ void QgsMapToolAnnotation::toggleTextItemVisibilities() } } -QgsPoint QgsMapToolAnnotation::transformCanvasToAnnotation( QgsPoint p, QgsAnnotation *annotation ) const +QgsPointXY QgsMapToolAnnotation::transformCanvasToAnnotation( QgsPointXY p, QgsAnnotation *annotation ) const { if ( annotation->mapPositionCrs() != mCanvas->mapSettings().destinationCrs() ) { diff --git a/src/app/qgsmaptoolannotation.h b/src/app/qgsmaptoolannotation.h index 6cb1a846022..605a585ac0a 100644 --- a/src/app/qgsmaptoolannotation.h +++ b/src/app/qgsmaptoolannotation.h @@ -57,7 +57,7 @@ class APP_EXPORT QgsMapToolAnnotation: public QgsMapTool //! Switches visibility states of text items void toggleTextItemVisibilities(); - QgsPoint transformCanvasToAnnotation( QgsPoint p, QgsAnnotation *annotation ) const; + QgsPointXY transformCanvasToAnnotation( QgsPointXY p, QgsAnnotation *annotation ) const; QgsMapCanvasAnnotationItem::MouseMoveAction mCurrentMoveAction = QgsMapCanvasAnnotationItem::NoAction; QPointF mLastMousePosition = QPointF( 0, 0 ); diff --git a/src/app/qgsmaptoolcircularstringcurvepoint.cpp b/src/app/qgsmaptoolcircularstringcurvepoint.cpp index 46ae13ec948..d4312d6ee69 100644 --- a/src/app/qgsmaptoolcircularstringcurvepoint.cpp +++ b/src/app/qgsmaptoolcircularstringcurvepoint.cpp @@ -33,7 +33,7 @@ QgsMapToolCircularStringCurvePoint::~QgsMapToolCircularStringCurvePoint() void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { - QgsPointV2 mapPoint( e->mapPoint() ); + QgsPoint mapPoint( e->mapPoint() ); if ( e->button() == Qt::LeftButton ) { @@ -85,7 +85,7 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent void QgsMapToolCircularStringCurvePoint::cadCanvasMoveEvent( QgsMapMouseEvent *e ) { - QgsPointV2 mapPoint( e->mapPoint() ); + QgsPoint mapPoint( e->mapPoint() ); QgsVertexId idx( 0, 0, 1 + ( mPoints.size() + 1 ) % 2 ); if ( mTempRubberBand ) { diff --git a/src/app/qgsmaptoolcircularstringradius.cpp b/src/app/qgsmaptoolcircularstringradius.cpp index 022af7bc564..618404e5a3f 100644 --- a/src/app/qgsmaptoolcircularstringradius.cpp +++ b/src/app/qgsmaptoolcircularstringradius.cpp @@ -28,7 +28,7 @@ QgsMapToolCircularStringRadius::QgsMapToolCircularStringRadius( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode ) : QgsMapToolAddCircularString( parentTool, canvas, mode ) - , mTemporaryEndPoint( QgsPointV2() ) + , mTemporaryEndPoint( QgsPoint() ) , mRadius( 0.0 ) , mRadiusSpinBox( nullptr ) { @@ -48,7 +48,7 @@ void QgsMapToolCircularStringRadius::deactivate() void QgsMapToolCircularStringRadius::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { - QgsPointV2 mapPoint( e->mapPoint() ); + QgsPoint mapPoint( e->mapPoint() ); if ( e->button() == Qt::LeftButton ) { @@ -66,8 +66,8 @@ void QgsMapToolCircularStringRadius::cadCanvasReleaseEvent( QgsMapMouseEvent *e double minRadius = sqrt( QgsGeometryUtils::sqrDistance2D( mPoints.last(), mTemporaryEndPoint ) ) / 2.0; mRadius = minRadius + minRadius / 10.0; - QgsPointV2 result; - if ( QgsGeometryUtils::segmentMidPoint( mPoints.last(), mTemporaryEndPoint, result, mRadius, QgsPointV2( mapPoint.x(), mapPoint.y() ) ) ) + QgsPoint result; + if ( QgsGeometryUtils::segmentMidPoint( mPoints.last(), mTemporaryEndPoint, result, mRadius, QgsPoint( mapPoint.x(), mapPoint.y() ) ) ) { mPoints.append( result ); createRadiusSpinBox(); @@ -121,15 +121,15 @@ void QgsMapToolCircularStringRadius::recalculateRubberBand() } } -void QgsMapToolCircularStringRadius::recalculateTempRubberBand( const QgsPoint &mousePosition ) +void QgsMapToolCircularStringRadius::recalculateTempRubberBand( const QgsPointXY &mousePosition ) { QgsPointSequence rubberBandPoints; if ( !( mPoints.size() % 2 ) ) { //recalculate midpoint on circle segment - QgsPointV2 midPoint; + QgsPoint midPoint; if ( !QgsGeometryUtils::segmentMidPoint( mPoints.at( mPoints.size() - 2 ), mTemporaryEndPoint, midPoint, mRadius, - QgsPointV2( mousePosition ) ) ) + QgsPoint( mousePosition ) ) ) { return; } @@ -141,7 +141,7 @@ void QgsMapToolCircularStringRadius::recalculateTempRubberBand( const QgsPoint & else { rubberBandPoints.append( mPoints.last() ); - rubberBandPoints.append( QgsPointV2( mousePosition ) ); + rubberBandPoints.append( QgsPoint( mousePosition ) ); } QgsCircularString *cString = new QgsCircularString(); cString->setPoints( rubberBandPoints ); diff --git a/src/app/qgsmaptoolcircularstringradius.h b/src/app/qgsmaptoolcircularstringradius.h index bd43a609a5e..0073eced80b 100644 --- a/src/app/qgsmaptoolcircularstringradius.h +++ b/src/app/qgsmaptoolcircularstringradius.h @@ -37,14 +37,14 @@ class QgsMapToolCircularStringRadius: public QgsMapToolAddCircularString void updateRadiusFromSpinBox( double radius ); private: - QgsPointV2 mTemporaryEndPoint; + QgsPoint mTemporaryEndPoint; double mRadius; QDoubleSpinBox *mRadiusSpinBox = nullptr; //! recalculate the rubberband void recalculateRubberBand(); //! recalculate the temporary rubberband using the given mouse position - void recalculateTempRubberBand( const QgsPoint &mousePosition ); + void recalculateTempRubberBand( const QgsPointXY &mousePosition ); //! (re-)create the spin box to enter the radius void createRadiusSpinBox(); //! delete the spin box to enter the radius, if it exists diff --git a/src/app/qgsmaptooldeletepart.cpp b/src/app/qgsmaptooldeletepart.cpp index 5ebb454af65..b59c50d9318 100644 --- a/src/app/qgsmaptooldeletepart.cpp +++ b/src/app/qgsmaptooldeletepart.cpp @@ -163,7 +163,7 @@ QgsGeometry QgsMapToolDeletePart::partUnderPoint( QPoint point, QgsFeatureId &fi } case QgsWkbTypes::PolygonGeometry: { - QgsPoint layerCoords = toLayerCoordinates( vlayer, point ); + QgsPointXY layerCoords = toLayerCoordinates( vlayer, point ); double searchRadius = QgsTolerance::vertexSearchRadius( mCanvas->currentLayer(), mCanvas->mapSettings() ); QgsRectangle selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius, layerCoords.x() + searchRadius, layerCoords.y() + searchRadius ); diff --git a/src/app/qgsmaptooldeletering.cpp b/src/app/qgsmaptooldeletering.cpp index 303c8d8dac0..e446348d6e3 100644 --- a/src/app/qgsmaptooldeletering.cpp +++ b/src/app/qgsmaptooldeletering.cpp @@ -79,7 +79,7 @@ void QgsMapToolDeleteRing::canvasPressEvent( QgsMapMouseEvent *e ) return; } - QgsPoint p = toLayerCoordinates( vlayer, e->pos() ); + QgsPointXY p = toLayerCoordinates( vlayer, e->pos() ); QgsGeometry ringGeom = ringUnderPoint( p, mPressedFid, mPressedPartNum, mPressedRingNum ); @@ -118,7 +118,7 @@ void QgsMapToolDeleteRing::canvasReleaseEvent( QgsMapMouseEvent *e ) } } -QgsGeometry QgsMapToolDeleteRing::ringUnderPoint( const QgsPoint &p, QgsFeatureId &fid, int &partNum, int &ringNum ) +QgsGeometry QgsMapToolDeleteRing::ringUnderPoint( const QgsPointXY &p, QgsFeatureId &fid, int &partNum, int &ringNum ) { //There is no clean way to find if we are inside the ring of a feature, //so we iterate over all the features visible in the canvas diff --git a/src/app/qgsmaptooldeletering.h b/src/app/qgsmaptooldeletering.h index e45550fd7ec..22ca46e68e6 100644 --- a/src/app/qgsmaptooldeletering.h +++ b/src/app/qgsmaptooldeletering.h @@ -54,7 +54,7 @@ class APP_EXPORT QgsMapToolDeleteRing : public QgsMapToolEdit /** Return the geometry of the ring under the point p and sets fid to the feature id, * partNum to the part number in the feature and ringNum to the ring number in the part */ - QgsGeometry ringUnderPoint( const QgsPoint &p, QgsFeatureId &fid, int &partNum, int &ringNum ); + QgsGeometry ringUnderPoint( const QgsPointXY &p, QgsFeatureId &fid, int &partNum, int &ringNum ); /* Rubberband that shows the ring being deleted*/ QgsRubberBand *mRubberBand = nullptr; diff --git a/src/app/qgsmaptoolfeatureaction.cpp b/src/app/qgsmaptoolfeatureaction.cpp index c57ca08e648..67bebb5470a 100644 --- a/src/app/qgsmaptoolfeatureaction.cpp +++ b/src/app/qgsmaptoolfeatureaction.cpp @@ -99,7 +99,7 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y ) if ( !layer ) return false; - QgsPoint point = mCanvas->getCoordinateTransform()->toMapCoordinates( x, y ); + QgsPointXY point = mCanvas->getCoordinateTransform()->toMapCoordinates( x, y ); QgsRectangle r; diff --git a/src/app/qgsmaptoolfillring.cpp b/src/app/qgsmaptoolfillring.cpp index 365124d9882..024f33c5c50 100644 --- a/src/app/qgsmaptoolfillring.cpp +++ b/src/app/qgsmaptoolfillring.cpp @@ -80,7 +80,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) closePolygon(); vlayer->beginEditCommand( tr( "Ring added and filled" ) ); - QList< QgsPoint > pointList = points(); + QList< QgsPointXY > pointList = points(); QgsFeatureId modifiedFid; int addRingReturnCode = vlayer->addRing( pointList, &modifiedFid ); @@ -126,7 +126,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) yMin = std::numeric_limits::max(); yMax = -std::numeric_limits::max(); - Q_FOREACH ( const QgsPoint &point, pointList ) + Q_FOREACH ( const QgsPointXY &point, pointList ) { xMin = qMin( xMin, point.x() ); xMax = qMax( xMax, point.x() ); diff --git a/src/app/qgsmaptoollabel.cpp b/src/app/qgsmaptoollabel.cpp index a4d6acd39ab..0889bdcb305 100644 --- a/src/app/qgsmaptoollabel.cpp +++ b/src/app/qgsmaptoollabel.cpp @@ -45,7 +45,7 @@ QgsMapToolLabel::~QgsMapToolLabel() bool QgsMapToolLabel::labelAtPosition( QMouseEvent *e, QgsLabelPosition &p ) { - QgsPoint pt = toMapCoordinates( e->pos() ); + QgsPointXY pt = toMapCoordinates( e->pos() ); const QgsLabelingResults *labelingResults = mCanvas->labelingResults(); if ( labelingResults ) { @@ -69,11 +69,11 @@ void QgsMapToolLabel::createRubberBands() //label rubber band QgsRectangle rect = mCurrentLabel.pos.labelRect; mLabelRubberBand = new QgsRubberBand( mCanvas, QgsWkbTypes::LineGeometry ); - mLabelRubberBand->addPoint( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); - mLabelRubberBand->addPoint( QgsPoint( rect.xMinimum(), rect.yMaximum() ) ); - mLabelRubberBand->addPoint( QgsPoint( rect.xMaximum(), rect.yMaximum() ) ); - mLabelRubberBand->addPoint( QgsPoint( rect.xMaximum(), rect.yMinimum() ) ); - mLabelRubberBand->addPoint( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); + mLabelRubberBand->addPoint( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); + mLabelRubberBand->addPoint( QgsPointXY( rect.xMinimum(), rect.yMaximum() ) ); + mLabelRubberBand->addPoint( QgsPointXY( rect.xMaximum(), rect.yMaximum() ) ); + mLabelRubberBand->addPoint( QgsPointXY( rect.xMaximum(), rect.yMinimum() ) ); + mLabelRubberBand->addPoint( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); mLabelRubberBand->setColor( QColor( 0, 255, 0, 65 ) ); mLabelRubberBand->setWidth( 3 ); mLabelRubberBand->show(); @@ -101,7 +101,7 @@ void QgsMapToolLabel::createRubberBands() } //fixpoint rubber band - QgsPoint fixPoint; + QgsPointXY fixPoint; if ( currentLabelRotationPoint( fixPoint, false, false ) ) { if ( mCanvas ) @@ -296,9 +296,9 @@ bool QgsMapToolLabel::currentLabelPreserveRotation() return true; // default, so there is no accidental data loss } -bool QgsMapToolLabel::currentLabelRotationPoint( QgsPoint &pos, bool ignoreUpsideDown, bool rotatingUnpinned ) +bool QgsMapToolLabel::currentLabelRotationPoint( QgsPointXY &pos, bool ignoreUpsideDown, bool rotatingUnpinned ) { - QVector cornerPoints = mCurrentLabel.pos.cornerPoints; + QVector cornerPoints = mCurrentLabel.pos.cornerPoints; if ( cornerPoints.size() < 4 ) { return false; @@ -337,9 +337,9 @@ bool QgsMapToolLabel::currentLabelRotationPoint( QgsPoint &pos, bool ignoreUpsid // NOTE: this assumes the label corner points comprise a rectangle and that the // CRS supports equidistant measurements to accurately determine hypotenuse - QgsPoint cp_0 = cornerPoints.at( 0 ); - QgsPoint cp_1 = cornerPoints.at( 1 ); - QgsPoint cp_3 = cornerPoints.at( 3 ); + QgsPointXY cp_0 = cornerPoints.at( 0 ); + QgsPointXY cp_1 = cornerPoints.at( 1 ); + QgsPointXY cp_3 = cornerPoints.at( 3 ); // QgsDebugMsg( QString( "cp_0: x=%1, y=%2" ).arg( cp_0.x() ).arg( cp_0.y() ) ); // QgsDebugMsg( QString( "cp_1: x=%1, y=%2" ).arg( cp_1.x() ).arg( cp_1.y() ) ); // QgsDebugMsg( QString( "cp_3: x=%1, y=%2" ).arg( cp_3.x() ).arg( cp_3.y() ) ); diff --git a/src/app/qgsmaptoollabel.h b/src/app/qgsmaptoollabel.h index 82733eaec53..9d20b3fcaca 100644 --- a/src/app/qgsmaptoollabel.h +++ b/src/app/qgsmaptoollabel.h @@ -95,7 +95,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool /** Finds out rotation point of current label position \param ignoreUpsideDown treat label as right-side-up \returns true in case of success*/ - bool currentLabelRotationPoint( QgsPoint &pos, bool ignoreUpsideDown = false, bool rotatingUnpinned = false ); + bool currentLabelRotationPoint( QgsPointXY &pos, bool ignoreUpsideDown = false, bool rotatingUnpinned = false ); //! Creates label / feature / fixpoint rubber bands for the current label position void createRubberBands(); diff --git a/src/app/qgsmaptoolmeasureangle.cpp b/src/app/qgsmaptoolmeasureangle.cpp index 97159a02ae6..f115a972c52 100644 --- a/src/app/qgsmaptoolmeasureangle.cpp +++ b/src/app/qgsmaptoolmeasureangle.cpp @@ -50,7 +50,7 @@ void QgsMapToolMeasureAngle::canvasMoveEvent( QgsMapMouseEvent *e ) return; } - QgsPoint point = snapPoint( e->pos() ); + QgsPointXY point = snapPoint( e->pos() ); mRubberBand->movePoint( point ); if ( mAnglePoints.size() == 2 ) { @@ -104,7 +104,7 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QgsMapMouseEvent *e ) if ( mAnglePoints.size() < 3 ) { - QgsPoint newPoint = snapPoint( e->pos() ); + QgsPointXY newPoint = snapPoint( e->pos() ); mAnglePoints.push_back( newPoint ); mRubberBand->addPoint( newPoint ); } @@ -143,7 +143,7 @@ void QgsMapToolMeasureAngle::createRubberBand() mRubberBand->setWidth( 3 ); } -QgsPoint QgsMapToolMeasureAngle::snapPoint( QPoint p ) +QgsPointXY QgsMapToolMeasureAngle::snapPoint( QPoint p ) { QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToMap( p ); return m.isValid() ? m.point() : mCanvas->getCoordinateTransform()->toMapCoordinates( p ); diff --git a/src/app/qgsmaptoolmeasureangle.h b/src/app/qgsmaptoolmeasureangle.h index dc8e778abbe..6c14294c48e 100644 --- a/src/app/qgsmaptoolmeasureangle.h +++ b/src/app/qgsmaptoolmeasureangle.h @@ -48,14 +48,14 @@ class APP_EXPORT QgsMapToolMeasureAngle: public QgsMapTool private: //! Points defining the angle (three for measuring) - QList mAnglePoints; + QList mAnglePoints; QgsRubberBand *mRubberBand = nullptr; QgsDisplayAngle *mResultDisplay = nullptr; //! Creates a new rubber band and deletes the old one void createRubberBand(); //! Snaps point to background layers - QgsPoint snapPoint( QPoint p ); + QgsPointXY snapPoint( QPoint p ); //! Tool for measuring QgsDistanceArea mDa; diff --git a/src/app/qgsmaptoolmovefeature.cpp b/src/app/qgsmaptoolmovefeature.cpp index 696e421487b..b9a8b693d30 100644 --- a/src/app/qgsmaptoolmovefeature.cpp +++ b/src/app/qgsmaptoolmovefeature.cpp @@ -57,7 +57,7 @@ void QgsMapToolMoveFeature::cadCanvasMoveEvent( QgsMapMouseEvent *e ) { if ( mRubberBand ) { - QgsPoint pointCanvasCoords = e->mapPoint(); + QgsPointXY pointCanvasCoords = e->mapPoint(); double offsetX = pointCanvasCoords.x() - mStartPointMapCoords.x(); double offsetY = pointCanvasCoords.y() - mStartPointMapCoords.y(); mRubberBand->setTranslationOffset( offsetX, offsetY ); @@ -82,7 +82,7 @@ void QgsMapToolMoveFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) { //find first geometry under mouse cursor and store iterator to it - QgsPoint layerCoords = toLayerCoordinates( vlayer, e->pos() ); + QgsPointXY layerCoords = toLayerCoordinates( vlayer, e->pos() ); double searchRadius = QgsTolerance::vertexSearchRadius( mCanvas->currentLayer(), mCanvas->mapSettings() ); QgsRectangle selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius, layerCoords.x() + searchRadius, layerCoords.y() + searchRadius ); @@ -159,8 +159,8 @@ void QgsMapToolMoveFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) return; } - QgsPoint startPointLayerCoords = toLayerCoordinates( ( QgsMapLayer * )vlayer, mStartPointMapCoords ); - QgsPoint stopPointLayerCoords = toLayerCoordinates( ( QgsMapLayer * )vlayer, e->mapPoint() ); + QgsPointXY startPointLayerCoords = toLayerCoordinates( ( QgsMapLayer * )vlayer, mStartPointMapCoords ); + QgsPointXY stopPointLayerCoords = toLayerCoordinates( ( QgsMapLayer * )vlayer, e->mapPoint() ); double dx = stopPointLayerCoords.x() - startPointLayerCoords.x(); double dy = stopPointLayerCoords.y() - startPointLayerCoords.y(); diff --git a/src/app/qgsmaptoolmovefeature.h b/src/app/qgsmaptoolmovefeature.h index 388fba123ac..d33b5b4acaf 100644 --- a/src/app/qgsmaptoolmovefeature.h +++ b/src/app/qgsmaptoolmovefeature.h @@ -42,7 +42,7 @@ class APP_EXPORT QgsMapToolMoveFeature: public QgsMapToolAdvancedDigitizing private: //! Start point of the move in map coordinates - QgsPoint mStartPointMapCoords; + QgsPointXY mStartPointMapCoords; //! Rubberband that shows the feature being moved QgsRubberBand *mRubberBand = nullptr; diff --git a/src/app/qgsmaptoolmovelabel.cpp b/src/app/qgsmaptoolmovelabel.cpp index 38a2c09bce7..3e571bd456e 100644 --- a/src/app/qgsmaptoolmovelabel.cpp +++ b/src/app/qgsmaptoolmovelabel.cpp @@ -57,7 +57,7 @@ void QgsMapToolMoveLabel::canvasPressEvent( QgsMapMouseEvent *e ) diagramMoveable( vlayer, xCol, yCol ) ) { mStartPointMapCoords = toMapCoordinates( e->pos() ); - QgsPoint referencePoint; + QgsPointXY referencePoint; if ( !currentLabelRotationPoint( referencePoint, !currentLabelPreserveRotation(), false ) ) { referencePoint.setX( mCurrentLabel.pos.labelRect.xMinimum() ); @@ -73,7 +73,7 @@ void QgsMapToolMoveLabel::canvasMoveEvent( QgsMapMouseEvent *e ) { if ( mLabelRubberBand ) { - QgsPoint pointCanvasCoords = toMapCoordinates( e->pos() ); + QgsPointXY pointCanvasCoords = toMapCoordinates( e->pos() ); double offsetX = pointCanvasCoords.x() - mStartPointMapCoords.x(); double offsetY = pointCanvasCoords.y() - mStartPointMapCoords.y(); mLabelRubberBand->setTranslationOffset( offsetX, offsetY ); @@ -100,7 +100,7 @@ void QgsMapToolMoveLabel::canvasReleaseEvent( QgsMapMouseEvent *e ) return; } - QgsPoint releaseCoords = toMapCoordinates( e->pos() ); + QgsPointXY releaseCoords = toMapCoordinates( e->pos() ); double xdiff = releaseCoords.x() - mStartPointMapCoords.x(); double ydiff = releaseCoords.y() - mStartPointMapCoords.y(); @@ -124,7 +124,7 @@ void QgsMapToolMoveLabel::canvasReleaseEvent( QgsMapMouseEvent *e ) { //transform to map crs first, because xdiff,ydiff are in map coordinates const QgsMapSettings &ms = mCanvas->mapSettings(); - QgsPoint transformedPoint = ms.layerToMapCoordinates( vlayer, QgsPoint( xPosOrig, yPosOrig ) ); + QgsPointXY transformedPoint = ms.layerToMapCoordinates( vlayer, QgsPointXY( xPosOrig, yPosOrig ) ); xPosOrig = transformedPoint.x(); yPosOrig = transformedPoint.y(); xPosNew = xPosOrig + xdiff; @@ -135,7 +135,7 @@ void QgsMapToolMoveLabel::canvasReleaseEvent( QgsMapMouseEvent *e ) if ( mCanvas ) { const QgsMapSettings &s = mCanvas->mapSettings(); - QgsPoint transformedPoint = s.mapToLayerCoordinates( vlayer, QgsPoint( xPosNew, yPosNew ) ); + QgsPointXY transformedPoint = s.mapToLayerCoordinates( vlayer, QgsPointXY( xPosNew, yPosNew ) ); xPosNew = transformedPoint.x(); yPosNew = transformedPoint.y(); } diff --git a/src/app/qgsmaptoolmovelabel.h b/src/app/qgsmaptoolmovelabel.h index 9cc0245e49b..abbea8506f1 100644 --- a/src/app/qgsmaptoolmovelabel.h +++ b/src/app/qgsmaptoolmovelabel.h @@ -39,7 +39,7 @@ class APP_EXPORT QgsMapToolMoveLabel: public QgsMapToolLabel protected: //! Start point of the move in map coordinates - QgsPoint mStartPointMapCoords; + QgsPointXY mStartPointMapCoords; double mClickOffsetX; double mClickOffsetY; diff --git a/src/app/qgsmaptooloffsetcurve.cpp b/src/app/qgsmaptooloffsetcurve.cpp index 87ebfa93cc3..3b1e3a59bbc 100644 --- a/src/app/qgsmaptooloffsetcurve.cpp +++ b/src/app/qgsmaptooloffsetcurve.cpp @@ -219,7 +219,7 @@ void QgsMapToolOffsetCurve::canvasMoveEvent( QgsMapMouseEvent *e ) mGeometryModified = true; //get offset from current position rectangular to feature - QgsPoint layerCoords = toLayerCoordinates( layer, e->pos() ); + QgsPointXY layerCoords = toLayerCoordinates( layer, e->pos() ); //snap cursor to background layers QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToMap( e->pos() ); @@ -236,7 +236,7 @@ void QgsMapToolOffsetCurve::canvasMoveEvent( QgsMapMouseEvent *e ) } } - QgsPoint minDistPoint; + QgsPointXY minDistPoint; int beforeVertex; double leftOf; double offset = sqrt( mOriginalGeometry.closestSegmentWithContext( layerCoords, minDistPoint, beforeVertex, &leftOf ) ); diff --git a/src/app/qgsmaptooloffsetpointsymbol.cpp b/src/app/qgsmaptooloffsetpointsymbol.cpp index 2b28e098575..f7dc48bb37b 100644 --- a/src/app/qgsmaptooloffsetpointsymbol.cpp +++ b/src/app/qgsmaptooloffsetpointsymbol.cpp @@ -73,7 +73,7 @@ void QgsMapToolOffsetPointSymbol::canvasPressEvent( QgsMapMouseEvent *e ) QgsMapToolPointSymbol::canvasPressEvent( e ); } -void QgsMapToolOffsetPointSymbol::canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPoint &snappedPoint ) +void QgsMapToolOffsetPointSymbol::canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPointXY &snappedPoint ) { Q_UNUSED( e ); mClickedFeature = feature; @@ -178,7 +178,7 @@ void QgsMapToolOffsetPointSymbol::createPreviewItem( QgsMarkerSymbol *markerSymb mOffsetItem->setSymbol( markerSymbol->clone() ); } -QMap QgsMapToolOffsetPointSymbol::calculateNewOffsetAttributes( const QgsPoint &startPoint, const QgsPoint &endPoint ) const +QMap QgsMapToolOffsetPointSymbol::calculateNewOffsetAttributes( const QgsPointXY &startPoint, const QgsPointXY &endPoint ) const { QMap newAttrValues; Q_FOREACH ( QgsSymbolLayer *layer, mMarkerSymbol->symbolLayers() ) @@ -202,7 +202,7 @@ QMap QgsMapToolOffsetPointSymbol::calculateNewOffsetAttributes( c return newAttrValues; } -void QgsMapToolOffsetPointSymbol::updateOffsetPreviewItem( const QgsPoint &startPoint, const QgsPoint &endPoint ) +void QgsMapToolOffsetPointSymbol::updateOffsetPreviewItem( const QgsPointXY &startPoint, const QgsPointXY &endPoint ) { if ( !mOffsetItem ) return; @@ -219,7 +219,7 @@ void QgsMapToolOffsetPointSymbol::updateOffsetPreviewItem( const QgsPoint &start mOffsetItem->updateSize(); } -QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPoint &startPoint, const QgsPoint &endPoint, QgsUnitTypes::RenderUnit unit ) const +QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPointXY &startPoint, const QgsPointXY &endPoint, QgsUnitTypes::RenderUnit unit ) const { double dx = endPoint.x() - startPoint.x(); double dy = -( endPoint.y() - startPoint.y() ); diff --git a/src/app/qgsmaptooloffsetpointsymbol.h b/src/app/qgsmaptooloffsetpointsymbol.h index c5478a560e5..8d1b9de15ac 100644 --- a/src/app/qgsmaptooloffsetpointsymbol.h +++ b/src/app/qgsmaptooloffsetpointsymbol.h @@ -47,7 +47,7 @@ class APP_EXPORT QgsMapToolOffsetPointSymbol: public QgsMapToolPointSymbol protected: - virtual void canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPoint &snappedPoint ) override; + virtual void canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPointXY &snappedPoint ) override; virtual bool checkSymbolCompatibility( QgsMarkerSymbol *markerSymbol, QgsRenderContext &context ) override; virtual void noCompatibleSymbols() override; @@ -66,7 +66,7 @@ class APP_EXPORT QgsMapToolOffsetPointSymbol: public QgsMapToolPointSymbol QgsFeature mClickedFeature; //! Point in map units where click originated - QgsPoint mClickedPoint; + QgsPointXY mClickedPoint; //! Stores the symbol rotation so that offset can be adjusted to account for rotation double mSymbolRotation; @@ -76,16 +76,16 @@ class APP_EXPORT QgsMapToolOffsetPointSymbol: public QgsMapToolPointSymbol //! Calculates the new values for offset attributes, respecting the symbol's offset units //! \note start and end point are in map units - QMap< int, QVariant > calculateNewOffsetAttributes( const QgsPoint &startPoint, const QgsPoint &endPoint ) const; + QMap< int, QVariant > calculateNewOffsetAttributes( const QgsPointXY &startPoint, const QgsPointXY &endPoint ) const; /** Updates the preview item to reflect a new offset. * \note start and end points are in map units */ - void updateOffsetPreviewItem( const QgsPoint &startPoint, const QgsPoint &endPoint ); + void updateOffsetPreviewItem( const QgsPointXY &startPoint, const QgsPointXY &endPoint ); //! Calculates the required offset from the start to end points, in the specified unit //! \note start and end points are in map units - QPointF calculateOffset( const QgsPoint &startPoint, const QgsPoint &endPoint, QgsUnitTypes::RenderUnit unit ) const; + QPointF calculateOffset( const QgsPointXY &startPoint, const QgsPointXY &endPoint, QgsUnitTypes::RenderUnit unit ) const; //! Adjusts the calculated offset to account for the symbol's rotation QPointF rotatedOffset( QPointF offset, double angle ) const; diff --git a/src/app/qgsmaptoolpinlabels.cpp b/src/app/qgsmaptoolpinlabels.cpp index 97a4591c9fe..8d721b75226 100644 --- a/src/app/qgsmaptoolpinlabels.cpp +++ b/src/app/qgsmaptoolpinlabels.cpp @@ -142,11 +142,11 @@ void QgsMapToolPinLabels::highlightLabel( const QgsLabelPosition &labelpos, { QgsRectangle rect = labelpos.labelRect; QgsRubberBand *rb = new QgsRubberBand( mCanvas, QgsWkbTypes::PolygonGeometry ); - rb->addPoint( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); - rb->addPoint( QgsPoint( rect.xMinimum(), rect.yMaximum() ) ); - rb->addPoint( QgsPoint( rect.xMaximum(), rect.yMaximum() ) ); - rb->addPoint( QgsPoint( rect.xMaximum(), rect.yMinimum() ) ); - rb->addPoint( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); + rb->addPoint( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); + rb->addPoint( QgsPointXY( rect.xMinimum(), rect.yMaximum() ) ); + rb->addPoint( QgsPointXY( rect.xMaximum(), rect.yMaximum() ) ); + rb->addPoint( QgsPointXY( rect.xMaximum(), rect.yMinimum() ) ); + rb->addPoint( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); rb->setColor( color ); rb->setWidth( 0 ); rb->show(); @@ -349,9 +349,9 @@ bool QgsMapToolPinLabels::pinUnpinCurrentLabel( bool pin ) if ( pin ) { -// QgsPoint labelpoint = labelpos.cornerPoints.at( 0 ); +// QgsPointXY labelpoint = labelpos.cornerPoints.at( 0 ); - QgsPoint referencePoint; + QgsPointXY referencePoint; if ( !currentLabelRotationPoint( referencePoint, !preserveRot, false ) ) { referencePoint.setX( labelpos.labelRect.xMinimum() ); @@ -363,7 +363,7 @@ bool QgsMapToolPinLabels::pinUnpinCurrentLabel( bool pin ) double labelR = labelpos.rotation * 180 / M_PI; // transform back to layer crs - QgsPoint transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint ); + QgsPointXY transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint ); labelX = transformedPoint.x(); labelY = transformedPoint.y(); @@ -449,12 +449,12 @@ bool QgsMapToolPinLabels::pinUnpinCurrentDiagram( bool pin ) if ( pin ) { - QgsPoint referencePoint = mCurrentLabel.pos.labelRect.center(); + QgsPointXY referencePoint = mCurrentLabel.pos.labelRect.center(); double labelX = referencePoint.x(); double labelY = referencePoint.y(); // transform back to layer crs - QgsPoint transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint ); + QgsPointXY transformedPoint = mCanvas->mapSettings().mapToLayerCoordinates( vlayer, referencePoint ); labelX = transformedPoint.x(); labelY = transformedPoint.y(); diff --git a/src/app/qgsmaptoolpointsymbol.h b/src/app/qgsmaptoolpointsymbol.h index 245a1660e12..7221ac23b98 100644 --- a/src/app/qgsmaptoolpointsymbol.h +++ b/src/app/qgsmaptoolpointsymbol.h @@ -46,7 +46,7 @@ class APP_EXPORT QgsMapToolPointSymbol: public QgsMapToolEdit //! Screen coordinate of the snapped feature QPoint mSnappedPoint; - virtual void canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPoint &snappedPoint ) = 0; + virtual void canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPointXY &snappedPoint ) = 0; virtual bool checkSymbolCompatibility( QgsMarkerSymbol *markerSymbol, QgsRenderContext &context ) = 0; diff --git a/src/app/qgsmaptoolreshape.cpp b/src/app/qgsmaptoolreshape.cpp index 56ac7089746..3600cb63784 100644 --- a/src/app/qgsmaptoolreshape.cpp +++ b/src/app/qgsmaptoolreshape.cpp @@ -77,7 +77,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) stopCapturing(); return; } - QgsPoint firstPoint = points().at( 0 ); + QgsPointXY firstPoint = points().at( 0 ); QgsRectangle bbox( firstPoint.x(), firstPoint.y(), firstPoint.x(), firstPoint.y() ); for ( int i = 1; i < size(); ++i ) { diff --git a/src/app/qgsmaptoolrotatefeature.cpp b/src/app/qgsmaptoolrotatefeature.cpp index f044ba552ad..4d62c571dca 100644 --- a/src/app/qgsmaptoolrotatefeature.cpp +++ b/src/app/qgsmaptoolrotatefeature.cpp @@ -220,7 +220,7 @@ void QgsMapToolRotateFeature::canvasReleaseEvent( QgsMapMouseEvent *e ) return; } - QgsPoint layerCoords = toLayerCoordinates( vlayer, e->pos() ); + QgsPointXY layerCoords = toLayerCoordinates( vlayer, e->pos() ); double searchRadius = QgsTolerance::vertexSearchRadius( mCanvas->currentLayer(), mCanvas->mapSettings() ); QgsRectangle selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius, layerCoords.x() + searchRadius, layerCoords.y() + searchRadius ); @@ -350,7 +350,7 @@ void QgsMapToolRotateFeature::applyRotation( double rotation ) //calculations for affine transformation double angle = -1 * mRotation * ( PI / 180 ); - QgsPoint anchorPoint = toLayerCoordinates( vlayer, mStartPointMapCoords ); + QgsPointXY anchorPoint = toLayerCoordinates( vlayer, mStartPointMapCoords ); double a = cos( angle ); double b = -1 * sin( angle ); double c = anchorPoint.x() - cos( angle ) * anchorPoint.x() + sin( angle ) * anchorPoint.y(); @@ -378,8 +378,8 @@ void QgsMapToolRotateFeature::applyRotation( double rotation ) QgsGeometry geom = feat.geometry(); i = start; - QgsPoint vertex = geom.vertexAt( i ); - while ( vertex != QgsPoint( 0, 0 ) ) + QgsPointXY vertex = geom.vertexAt( i ); + while ( vertex != QgsPointXY( 0, 0 ) ) { double newX = a * vertex.x() + b * vertex.y() + c; double newY = d * vertex.x() + ee * vertex.y() + f; @@ -394,7 +394,7 @@ void QgsMapToolRotateFeature::applyRotation( double rotation ) double anchorX = a * anchorPoint.x() + b * anchorPoint.y() + c; double anchorY = d * anchorPoint.x() + ee * anchorPoint.y() + f; - mAnchorPoint->setCenter( QgsPoint( anchorX, anchorY ) ); + mAnchorPoint->setCenter( QgsPointXY( anchorX, anchorY ) ); deleteRotationWidget(); deleteRubberband(); diff --git a/src/app/qgsmaptoolrotatefeature.h b/src/app/qgsmaptoolrotatefeature.h index cd393b62527..9c276965129 100644 --- a/src/app/qgsmaptoolrotatefeature.h +++ b/src/app/qgsmaptoolrotatefeature.h @@ -86,14 +86,14 @@ class APP_EXPORT QgsMapToolRotateFeature: public QgsMapToolEdit private: - QgsGeometry rotateGeometry( QgsGeometry geom, QgsPoint point, double angle ); - QgsPoint rotatePoint( QgsPoint point, double angle ); + QgsGeometry rotateGeometry( QgsGeometry geom, QgsPointXY point, double angle ); + QgsPointXY rotatePoint( QgsPointXY point, double angle ); void deleteRubberband(); void createRotationWidget(); void deleteRotationWidget(); //! Start point of the move in map coordinates - QgsPoint mStartPointMapCoords; + QgsPointXY mStartPointMapCoords; QPointF mInitialPos; //! Rubberband that shows the feature being moved diff --git a/src/app/qgsmaptoolrotatelabel.cpp b/src/app/qgsmaptoolrotatelabel.cpp index 40ba029abef..bfff15d98aa 100644 --- a/src/app/qgsmaptoolrotatelabel.cpp +++ b/src/app/qgsmaptoolrotatelabel.cpp @@ -103,7 +103,7 @@ void QgsMapToolRotateLabel::canvasMoveEvent( QgsMapMouseEvent *e ) { if ( mLabelRubberBand ) { - QgsPoint currentPoint = toMapCoordinates( e->pos() ); + QgsPointXY currentPoint = toMapCoordinates( e->pos() ); double azimuth = azimuthToCCW( mRotationPoint.azimuth( currentPoint ) ); double azimuthDiff = azimuth - mCurrentMouseAzimuth; azimuthDiff = azimuthDiff > 180 ? azimuthDiff - 360 : azimuthDiff; @@ -189,7 +189,7 @@ double QgsMapToolRotateLabel::azimuthToCCW( double a ) QgsRubberBand *QgsMapToolRotateLabel::createRotationPreviewBox() { delete mRotationPreviewBox; - QVector< QgsPoint > boxPoints = mCurrentLabel.pos.cornerPoints; + QVector< QgsPointXY > boxPoints = mCurrentLabel.pos.cornerPoints; if ( boxPoints.size() < 1 ) { return nullptr; @@ -210,7 +210,7 @@ void QgsMapToolRotateLabel::setRotationPreviewBox( double rotation ) } mRotationPreviewBox->reset(); - QVector< QgsPoint > boxPoints = mCurrentLabel.pos.cornerPoints; + QVector< QgsPointXY > boxPoints = mCurrentLabel.pos.cornerPoints; if ( boxPoints.size() < 1 ) { return; @@ -224,7 +224,7 @@ void QgsMapToolRotateLabel::setRotationPreviewBox( double rotation ) mRotationPreviewBox->show(); } -QgsPoint QgsMapToolRotateLabel::rotatePointCounterClockwise( const QgsPoint &input, const QgsPoint ¢erPoint, double degrees ) +QgsPointXY QgsMapToolRotateLabel::rotatePointCounterClockwise( const QgsPointXY &input, const QgsPointXY ¢erPoint, double degrees ) { double rad = degrees / 180 * M_PI; double v1x = input.x() - centerPoint.x(); @@ -233,5 +233,5 @@ QgsPoint QgsMapToolRotateLabel::rotatePointCounterClockwise( const QgsPoint &inp double v2x = cos( rad ) * v1x - sin( rad ) * v1y; double v2y = sin( rad ) * v1x + cos( rad ) * v1y; - return QgsPoint( centerPoint.x() + v2x, centerPoint.y() + v2y ); + return QgsPointXY( centerPoint.x() + v2x, centerPoint.y() + v2y ); } diff --git a/src/app/qgsmaptoolrotatelabel.h b/src/app/qgsmaptoolrotatelabel.h index fe1f1ea4839..91b299a10c8 100644 --- a/src/app/qgsmaptoolrotatelabel.h +++ b/src/app/qgsmaptoolrotatelabel.h @@ -44,12 +44,12 @@ class APP_EXPORT QgsMapToolRotateLabel: public QgsMapToolLabel void setRotationPreviewBox( double rotation ); //! Rotates input point counterclockwise around centerPoint - QgsPoint rotatePointCounterClockwise( const QgsPoint &input, const QgsPoint ¢erPoint, double degrees ); + QgsPointXY rotatePointCounterClockwise( const QgsPointXY &input, const QgsPointXY ¢erPoint, double degrees ); double mStartRotation; //rotation value prior to start rotating double mCurrentRotation; double mCurrentMouseAzimuth; - QgsPoint mRotationPoint; + QgsPointXY mRotationPoint; QgsPointRotationItem *mRotationItem = nullptr; QgsRubberBand *mRotationPreviewBox = nullptr; diff --git a/src/app/qgsmaptoolrotatepointsymbols.cpp b/src/app/qgsmaptoolrotatepointsymbols.cpp index d1fcf29486b..a5207975043 100644 --- a/src/app/qgsmaptoolrotatepointsymbols.cpp +++ b/src/app/qgsmaptoolrotatepointsymbols.cpp @@ -73,7 +73,7 @@ void QgsMapToolRotatePointSymbols::canvasPressEvent( QgsMapMouseEvent *e ) QgsMapToolPointSymbol::canvasPressEvent( e ); } -void QgsMapToolRotatePointSymbols::canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPoint &snappedPoint ) +void QgsMapToolRotatePointSymbols::canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPointXY &snappedPoint ) { //find out initial arrow direction QVariant attrVal = feature.attribute( mCurrentRotationAttributes.toList().at( 0 ) ); diff --git a/src/app/qgsmaptoolrotatepointsymbols.h b/src/app/qgsmaptoolrotatepointsymbols.h index 257a5eeb092..2e2b0c9f882 100644 --- a/src/app/qgsmaptoolrotatepointsymbols.h +++ b/src/app/qgsmaptoolrotatepointsymbols.h @@ -46,7 +46,7 @@ class APP_EXPORT QgsMapToolRotatePointSymbols: public QgsMapToolPointSymbol protected: - virtual void canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPoint &snappedPoint ) override; + virtual void canvasPressOnFeature( QgsMapMouseEvent *e, const QgsFeature &feature, const QgsPointXY &snappedPoint ) override; virtual bool checkSymbolCompatibility( QgsMarkerSymbol *markerSymbol, QgsRenderContext &context ) override; virtual void noCompatibleSymbols() override; diff --git a/src/app/qgsmaptoolselectradius.cpp b/src/app/qgsmaptoolselectradius.cpp index ef5de6854cd..84ea673a5d8 100644 --- a/src/app/qgsmaptoolselectradius.cpp +++ b/src/app/qgsmaptoolselectradius.cpp @@ -69,7 +69,7 @@ void QgsMapToolSelectRadius::canvasMoveEvent( QgsMapMouseEvent *e ) } mDragging = true; } - QgsPoint radiusEdge = toMapCoordinates( e->pos() ); + QgsPointXY radiusEdge = toMapCoordinates( e->pos() ); setRadiusRubberBand( radiusEdge ); } @@ -88,7 +88,7 @@ void QgsMapToolSelectRadius::canvasReleaseEvent( QgsMapMouseEvent *e ) mRubberBand->setStrokeColor( mStrokeColor ); } mRadiusCenter = toMapCoordinates( e->pos() ); - QgsPoint radiusEdge = toMapCoordinates( QPoint( e->pos().x() + 1, e->pos().y() + 1 ) ); + QgsPointXY radiusEdge = toMapCoordinates( QPoint( e->pos().x() + 1, e->pos().y() + 1 ) ); setRadiusRubberBand( radiusEdge ); } QgsGeometry radiusGeometry = mRubberBand->asGeometry(); @@ -100,15 +100,15 @@ void QgsMapToolSelectRadius::canvasReleaseEvent( QgsMapMouseEvent *e ) } -void QgsMapToolSelectRadius::setRadiusRubberBand( QgsPoint &radiusEdge ) +void QgsMapToolSelectRadius::setRadiusRubberBand( QgsPointXY &radiusEdge ) { double r = sqrt( mRadiusCenter.sqrDist( radiusEdge ) ); mRubberBand->reset( QgsWkbTypes::PolygonGeometry ); for ( int i = 0; i <= RADIUS_SEGMENTS; ++i ) { double theta = i * ( 2.0 * M_PI / RADIUS_SEGMENTS ); - QgsPoint radiusPoint( mRadiusCenter.x() + r * cos( theta ), - mRadiusCenter.y() + r * sin( theta ) ); + QgsPointXY radiusPoint( mRadiusCenter.x() + r * cos( theta ), + mRadiusCenter.y() + r * sin( theta ) ); mRubberBand->addPoint( radiusPoint, false ); } mRubberBand->closePoints( true ); diff --git a/src/app/qgsmaptoolselectradius.h b/src/app/qgsmaptoolselectradius.h index c2df5d53512..462189beb07 100644 --- a/src/app/qgsmaptoolselectradius.h +++ b/src/app/qgsmaptoolselectradius.h @@ -46,13 +46,13 @@ class APP_EXPORT QgsMapToolSelectRadius : public QgsMapTool //! sets the rubber band to a circle approximated using 40 segments. // The radius center point is defined in the canvasPressEvent event. - void setRadiusRubberBand( QgsPoint &radiusEdge ); + void setRadiusRubberBand( QgsPointXY &radiusEdge ); //! used for storing all of the maps point for the polygon QgsRubberBand *mRubberBand = nullptr; //! Center point for the radius - QgsPoint mRadiusCenter; + QgsPointXY mRadiusCenter; bool mDragging; diff --git a/src/app/qgsmaptoolselectutils.cpp b/src/app/qgsmaptoolselectutils.cpp index 87efa738bc0..d1d5bf13b35 100644 --- a/src/app/qgsmaptoolselectutils.cpp +++ b/src/app/qgsmaptoolselectutils.cpp @@ -49,10 +49,10 @@ QgsVectorLayer *QgsMapToolSelectUtils::getCurrentVectorLayer( QgsMapCanvas *canv void QgsMapToolSelectUtils::setRubberBand( QgsMapCanvas *canvas, QRect &selectRect, QgsRubberBand *rubberBand ) { const QgsMapToPixel *transform = canvas->getCoordinateTransform(); - QgsPoint ll = transform->toMapCoordinates( selectRect.left(), selectRect.bottom() ); - QgsPoint lr = transform->toMapCoordinates( selectRect.right(), selectRect.bottom() ); - QgsPoint ul = transform->toMapCoordinates( selectRect.left(), selectRect.top() ); - QgsPoint ur = transform->toMapCoordinates( selectRect.right(), selectRect.top() ); + QgsPointXY ll = transform->toMapCoordinates( selectRect.left(), selectRect.bottom() ); + QgsPointXY lr = transform->toMapCoordinates( selectRect.right(), selectRect.bottom() ); + QgsPointXY ul = transform->toMapCoordinates( selectRect.left(), selectRect.top() ); + QgsPointXY ur = transform->toMapCoordinates( selectRect.right(), selectRect.top() ); if ( rubberBand ) { diff --git a/src/app/qgsmaptoolsimplify.cpp b/src/app/qgsmaptoolsimplify.cpp index f1afa636ae8..919ac104409 100644 --- a/src/app/qgsmaptoolsimplify.cpp +++ b/src/app/qgsmaptoolsimplify.cpp @@ -293,7 +293,7 @@ void QgsMapToolSimplify::canvasReleaseEvent( QgsMapMouseEvent *e ) void QgsMapToolSimplify::selectOneFeature( QPoint canvasPoint ) { QgsVectorLayer *vlayer = currentVectorLayer(); - QgsPoint layerCoords = toLayerCoordinates( vlayer, canvasPoint ); + QgsPointXY layerCoords = toLayerCoordinates( vlayer, canvasPoint ); double r = QgsTolerance::vertexSearchRadius( vlayer, mCanvas->mapSettings() ); QgsRectangle selectRect = QgsRectangle( layerCoords.x() - r, layerCoords.y() - r, layerCoords.x() + r, layerCoords.y() + r ); @@ -324,8 +324,8 @@ void QgsMapToolSimplify::selectOneFeature( QPoint canvasPoint ) void QgsMapToolSimplify::selectFeaturesInRect() { QgsVectorLayer *vlayer = currentVectorLayer(); - QgsPoint pt1 = toMapCoordinates( mSelectionRect.topLeft() ); - QgsPoint pt2 = toMapCoordinates( mSelectionRect.bottomRight() ); + QgsPointXY pt1 = toMapCoordinates( mSelectionRect.topLeft() ); + QgsPointXY pt2 = toMapCoordinates( mSelectionRect.bottomRight() ); QgsRectangle rect = toLayerCoordinates( vlayer, QgsRectangle( pt1, pt2 ) ); QgsFeature f; diff --git a/src/app/qgsmeasuredialog.cpp b/src/app/qgsmeasuredialog.cpp index 209a436c4d4..0605aad881f 100644 --- a/src/app/qgsmeasuredialog.cpp +++ b/src/app/qgsmeasuredialog.cpp @@ -140,7 +140,7 @@ void QgsMeasureDialog::restart() } -void QgsMeasureDialog::mouseMove( const QgsPoint &point ) +void QgsMeasureDialog::mouseMove( const QgsPointXY &point ) { mLastMousePoint = point; // show current distance/area while moving the point @@ -148,14 +148,14 @@ void QgsMeasureDialog::mouseMove( const QgsPoint &point ) // and adding moving point at the end if ( mMeasureArea && mTool->points().size() >= 2 ) { - QList tmpPoints = mTool->points(); + QList tmpPoints = mTool->points(); tmpPoints.append( point ); double area = mDa.measurePolygon( tmpPoints ); editTotal->setText( formatArea( area ) ); } else if ( !mMeasureArea && mTool->points().size() >= 1 ) { - QgsPoint p1( mTool->points().last() ), p2( point ); + QgsPointXY p1( mTool->points().last() ), p2( point ); double d = mDa.measureLine( p1, p2 ); editTotal->setText( formatDistance( mTotal + d ) ); @@ -203,7 +203,7 @@ void QgsMeasureDialog::removeLastPoint() { if ( numPoints > 1 ) { - QList tmpPoints = mTool->points(); + QList tmpPoints = mTool->points(); tmpPoints.append( mLastMousePoint ); double area = mDa.measurePolygon( tmpPoints ); editTotal->setText( formatArea( area ) ); @@ -223,7 +223,7 @@ void QgsMeasureDialog::removeLastPoint() if ( !mTool->done() ) { // need to add the distance for the temporary mouse cursor point - QgsPoint p1( mTool->points().last() ); + QgsPointXY p1( mTool->points().last() ); double d = mDa.measureLine( p1, mLastMousePoint ); d = convertLength( d, mDistanceUnits ); @@ -475,10 +475,10 @@ void QgsMeasureDialog::updateUi() } else { - QList::const_iterator it; + QList::const_iterator it; bool b = true; // first point - QgsPoint p1, p2; + QgsPointXY p1, p2; mTotal = 0; for ( it = mTool->points().constBegin(); it != mTool->points().constEnd(); ++it ) { diff --git a/src/app/qgsmeasuredialog.h b/src/app/qgsmeasuredialog.h index 2cfc01b90a5..ffb3e35a37e 100644 --- a/src/app/qgsmeasuredialog.h +++ b/src/app/qgsmeasuredialog.h @@ -46,7 +46,7 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase void addPoint(); //! Mose move - void mouseMove( const QgsPoint &point ); + void mouseMove( const QgsPointXY &point ); //! Remove last point void removeLastPoint(); @@ -117,7 +117,7 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase //! pointer to measure tool which owns this dialog QgsMeasureTool *mTool = nullptr; - QgsPoint mLastMousePoint; + QgsPointXY mLastMousePoint; friend class TestQgsMeasureTool; }; diff --git a/src/app/qgsmeasuretool.cpp b/src/app/qgsmeasuretool.cpp index 9956ad8b2bb..e933a5e8faf 100644 --- a/src/app/qgsmeasuretool.cpp +++ b/src/app/qgsmeasuretool.cpp @@ -45,7 +45,7 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas *canvas, bool measureArea ) mDone = true; // Append point we will move - mPoints.append( QgsPoint( 0, 0 ) ); + mPoints.append( QgsPointXY( 0, 0 ) ); mDestinationCrs = canvas->mapSettings().destinationCrs(); mDialog = new QgsMeasureDialog( this ); @@ -63,7 +63,7 @@ QgsMeasureTool::~QgsMeasureTool() } -QList QgsMeasureTool::points() +QList QgsMeasureTool::points() { return mPoints; } @@ -130,18 +130,18 @@ void QgsMeasureTool::updateSettings() // Reproject the points to the new destination CoordinateReferenceSystem if ( mRubberBand->size() > 0 && mDestinationCrs != mCanvas->mapSettings().destinationCrs() && mCanvas->mapSettings().destinationCrs().isValid() ) { - QList points = mPoints; + QList points = mPoints; bool lastDone = mDone; mDialog->restart(); mDone = lastDone; QgsCoordinateTransform ct( mDestinationCrs, mCanvas->mapSettings().destinationCrs() ); - Q_FOREACH ( const QgsPoint &previousPoint, points ) + Q_FOREACH ( const QgsPointXY &previousPoint, points ) { try { - QgsPoint point = ct.transform( previousPoint ); + QgsPointXY point = ct.transform( previousPoint ); mPoints.append( point ); mRubberBand->addPoint( point, false ); @@ -185,7 +185,7 @@ void QgsMeasureTool::canvasMoveEvent( QgsMapMouseEvent *e ) { if ( ! mDone ) { - QgsPoint point = snapPoint( e->pos() ); + QgsPointXY point = snapPoint( e->pos() ); mRubberBand->movePoint( point ); mDialog->mouseMove( point ); @@ -195,7 +195,7 @@ void QgsMeasureTool::canvasMoveEvent( QgsMapMouseEvent *e ) void QgsMeasureTool::canvasReleaseEvent( QgsMapMouseEvent *e ) { - QgsPoint point = snapPoint( e->pos() ); + QgsPointXY point = snapPoint( e->pos() ); if ( mDone ) // if we have stopped measuring any mouse click restart measuring { @@ -261,7 +261,7 @@ void QgsMeasureTool::keyPressEvent( QKeyEvent *e ) } -void QgsMeasureTool::addPoint( const QgsPoint &point ) +void QgsMeasureTool::addPoint( const QgsPointXY &point ) { QgsDebugMsg( "point=" + point.toString() ); @@ -271,7 +271,7 @@ void QgsMeasureTool::addPoint( const QgsPoint &point ) return; } - QgsPoint pnt( point ); + QgsPointXY pnt( point ); // Append point that we will be moving. mPoints.append( pnt ); @@ -284,7 +284,7 @@ void QgsMeasureTool::addPoint( const QgsPoint &point ) } -QgsPoint QgsMeasureTool::snapPoint( QPoint p ) +QgsPointXY QgsMeasureTool::snapPoint( QPoint p ) { QgsPointLocator::Match m = mCanvas->snappingUtils()->snapToMap( p ); return m.isValid() ? m.point() : mCanvas->getCoordinateTransform()->toMapCoordinates( p ); diff --git a/src/app/qgsmeasuretool.h b/src/app/qgsmeasuretool.h index 7aba8beb6d2..7cd9d3095ac 100644 --- a/src/app/qgsmeasuretool.h +++ b/src/app/qgsmeasuretool.h @@ -49,10 +49,10 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool void restart(); //! Add new point - void addPoint( const QgsPoint &point ); + void addPoint( const QgsPointXY &point ); //! Returns reference to array of the points - QList points(); + QList points(); // Inherited from QgsMapTool @@ -79,7 +79,7 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool protected: - QList mPoints; + QList mPoints; QgsMeasureDialog *mDialog = nullptr; @@ -104,7 +104,7 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool //! Returns the snapped (map) coordinate //\param p (pixel) coordinate - QgsPoint snapPoint( QPoint p ); + QgsPointXY snapPoint( QPoint p ); //! Removes the last vertex from mRubberBand void undo(); diff --git a/src/app/qgspointmarkeritem.cpp b/src/app/qgspointmarkeritem.cpp index 5bb4cd9f215..f4847cbea0f 100644 --- a/src/app/qgspointmarkeritem.cpp +++ b/src/app/qgspointmarkeritem.cpp @@ -82,7 +82,7 @@ void QgsPointMarkerItem::paint( QPainter *painter ) } } -void QgsPointMarkerItem::setPointLocation( const QgsPoint &p ) +void QgsPointMarkerItem::setPointLocation( const QgsPointXY &p ) { mLocation = toCanvasCoordinates( p ); } diff --git a/src/app/qgspointmarkeritem.h b/src/app/qgspointmarkeritem.h index f08ffcea5c3..66612dcac8c 100644 --- a/src/app/qgspointmarkeritem.h +++ b/src/app/qgspointmarkeritem.h @@ -42,7 +42,7 @@ class APP_EXPORT QgsPointMarkerItem: public QgsMapCanvasItem /** Sets the center point of the marker symbol (in map coordinates) * \param p center point */ - void setPointLocation( const QgsPoint &p ); + void setPointLocation( const QgsPointXY &p ); /** Sets the marker symbol to use for rendering the point. Note - you may need to call * updateSize() after setting the symbol. diff --git a/src/app/qgspointrotationitem.cpp b/src/app/qgspointrotationitem.cpp index 56151665d32..d82435f882d 100644 --- a/src/app/qgspointrotationitem.cpp +++ b/src/app/qgspointrotationitem.cpp @@ -72,7 +72,7 @@ void QgsPointRotationItem::paint( QPainter *painter ) painter->drawText( mPixmap.width(), mPixmap.height() / 2.0 + fm.height() / 2.0, QString::number( mRotation ) ); } -void QgsPointRotationItem::setPointLocation( const QgsPoint &p ) +void QgsPointRotationItem::setPointLocation( const QgsPointXY &p ) { QPointF transformedPoint = toCanvasCoordinates( p ); setPos( transformedPoint.x() - mPixmap.width() / 2.0, transformedPoint.y() - mPixmap.height() / 2.0 ); diff --git a/src/app/qgspointrotationitem.h b/src/app/qgspointrotationitem.h index 5030174d0dc..37120cfbcc8 100644 --- a/src/app/qgspointrotationitem.h +++ b/src/app/qgspointrotationitem.h @@ -38,7 +38,7 @@ class APP_EXPORT QgsPointRotationItem: public QgsMapCanvasItem void paint( QPainter *painter ) override; //! Sets the center point of the rotation symbol (in map coordinates) - void setPointLocation( const QgsPoint &p ); + void setPointLocation( const QgsPointXY &p ); /** Sets the rotation of the symbol and displays the new rotation number. Units are degrees, starting from north direction, clockwise direction*/ diff --git a/src/app/qgsrasterlayerproperties.cpp b/src/app/qgsrasterlayerproperties.cpp index 4153a7c551b..456f049e3d8 100644 --- a/src/app/qgsrasterlayerproperties.cpp +++ b/src/app/qgsrasterlayerproperties.cpp @@ -1546,7 +1546,7 @@ void QgsRasterLayerProperties::on_pbnRemoveSelectedRow_clicked() } } -void QgsRasterLayerProperties::pixelSelected( const QgsPoint &canvasPoint ) +void QgsRasterLayerProperties::pixelSelected( const QgsPointXY &canvasPoint ) { QgsRasterRenderer *renderer = mRendererWidget->renderer(); if ( !renderer ) @@ -1564,7 +1564,7 @@ void QgsRasterLayerProperties::pixelSelected( const QgsPoint &canvasPoint ) mMapCanvas->unsetMapTool( mPixelSelectorTool ); const QgsMapSettings &ms = mMapCanvas->mapSettings(); - QgsPoint myPoint = ms.mapToLayerCoordinates( mRasterLayer, canvasPoint ); + QgsPointXY myPoint = ms.mapToLayerCoordinates( mRasterLayer, canvasPoint ); QgsRectangle myExtent = ms.mapToLayerCoordinates( mRasterLayer, mMapCanvas->extent() ); double mapUnitsPerPixel = mMapCanvas->mapUnitsPerPixel(); diff --git a/src/app/qgsrasterlayerproperties.h b/src/app/qgsrasterlayerproperties.h index 3a1ed7b4965..88901d5ec39 100644 --- a/src/app/qgsrasterlayerproperties.h +++ b/src/app/qgsrasterlayerproperties.h @@ -26,7 +26,7 @@ #include "qgsmaplayerstylemanager.h" #include "qgis_app.h" -class QgsPoint; +class QgsPointXY; class QgsMapLayer; class QgsMapCanvas; class QgsRasterLayer; @@ -83,7 +83,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private //! \brief slot executed when the reset null value to file default icon is selected //void on_btnResetNull_clicked(); - void pixelSelected( const QgsPoint & ); + void pixelSelected( const QgsPointXY & ); private slots: void on_mRenderTypeComboBox_currentIndexChanged( int index ); diff --git a/src/app/qgsstatusbarcoordinateswidget.cpp b/src/app/qgsstatusbarcoordinateswidget.cpp index a4894bf3e5e..317e6ef9ca2 100644 --- a/src/app/qgsstatusbarcoordinateswidget.cpp +++ b/src/app/qgsstatusbarcoordinateswidget.cpp @@ -164,7 +164,7 @@ void QgsStatusBarCoordinatesWidget::validateCoordinates() if ( !xOk || !yOk ) return; - mMapCanvas->setCenter( QgsPoint( x, y ) ); + mMapCanvas->setCenter( QgsPointXY( x, y ) ); mMapCanvas->refresh(); } @@ -218,7 +218,7 @@ void QgsStatusBarCoordinatesWidget::refreshMapCanvas() mMapCanvas->refreshAllLayers(); } -void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPoint &p ) +void QgsStatusBarCoordinatesWidget::showMouseCoordinates( const QgsPointXY &p ) { if ( !mMapCanvas || mToggleExtentsViewButton->isChecked() ) { diff --git a/src/app/qgsstatusbarcoordinateswidget.h b/src/app/qgsstatusbarcoordinateswidget.h index c48326ef8b9..988087d922c 100644 --- a/src/app/qgsstatusbarcoordinateswidget.h +++ b/src/app/qgsstatusbarcoordinateswidget.h @@ -25,7 +25,7 @@ class QToolButton; class QValidator; class QgsMapCanvas; -class QgsPoint; +class QgsPointXY; #include #include "qgis_app.h" @@ -54,7 +54,7 @@ class APP_EXPORT QgsStatusBarCoordinatesWidget : public QWidget void coordinatesChanged(); private slots: - void showMouseCoordinates( const QgsPoint &p ); + void showMouseCoordinates( const QgsPointXY &p ); void extentsViewToggled( bool flag ); void validateCoordinates(); void dizzy(); diff --git a/src/core/annotations/qgsannotation.cpp b/src/core/annotations/qgsannotation.cpp index dec8265a84a..86cf4150965 100644 --- a/src/core/annotations/qgsannotation.cpp +++ b/src/core/annotations/qgsannotation.cpp @@ -55,7 +55,7 @@ void QgsAnnotation::setHasFixedMapPosition( bool fixed ) emit moved(); } -void QgsAnnotation::setMapPosition( const QgsPoint &position ) +void QgsAnnotation::setMapPosition( const QgsPointXY &position ) { mMapPosition = position; emit moved(); @@ -177,13 +177,13 @@ void QgsAnnotation::updateBalloon() double minEdgeDist = DBL_MAX; int minEdgeIndex = -1; QLineF minEdge; - QgsPoint minEdgePoint; - QgsPoint origin( 0, 0 ); + QgsPointXY minEdgePoint; + QgsPointXY origin( 0, 0 ); for ( int i = 0; i < 4; ++i ) { QLineF currentSegment = segmentList.at( i ); - QgsPoint currentMinDistPoint; + QgsPointXY currentMinDistPoint; double currentMinDist = origin.sqrDistToSegment( currentSegment.x1(), currentSegment.y1(), currentSegment.x2(), currentSegment.y2(), currentMinDistPoint ); if ( currentMinDist < minEdgeDist ) { @@ -368,7 +368,7 @@ void QgsAnnotation::_readXml( const QDomElement &annotationElem, const QgsReadWr mRelativePosition = QPointF(); else mRelativePosition = pos; - QgsPoint mapPos; + QgsPointXY mapPos; mapPos.setX( annotationElem.attribute( QStringLiteral( "mapPosX" ), QStringLiteral( "0" ) ).toDouble() ); mapPos.setY( annotationElem.attribute( QStringLiteral( "mapPosY" ), QStringLiteral( "0" ) ).toDouble() ); mMapPosition = mapPos; diff --git a/src/core/annotations/qgsannotation.h b/src/core/annotations/qgsannotation.h index fb38a8c4b10..78cfa135e20 100644 --- a/src/core/annotations/qgsannotation.h +++ b/src/core/annotations/qgsannotation.h @@ -63,7 +63,7 @@ class CORE_EXPORT QgsAnnotation : public QObject Q_OBJECT Q_PROPERTY( bool visible READ isVisible WRITE setVisible ) Q_PROPERTY( bool hasFixedMapPosition READ hasFixedMapPosition WRITE setHasFixedMapPosition ) - Q_PROPERTY( QgsPoint mapPosition READ mapPosition WRITE setMapPosition ) + Q_PROPERTY( QgsPointXY mapPosition READ mapPosition WRITE setMapPosition ) Q_PROPERTY( QSizeF frameSize READ frameSize WRITE setFrameSize ) public: @@ -115,14 +115,14 @@ class CORE_EXPORT QgsAnnotation : public QObject * \see hasFixedMapPosition() * \see mapPositionCrs() */ - QgsPoint mapPosition() const { return mMapPosition; } + QgsPointXY mapPosition() const { return mMapPosition; } /** * Sets the map position of the annotation, if it is attached to a fixed map * position. * \see mapPosition() */ - void setMapPosition( const QgsPoint &position ); + void setMapPosition( const QgsPointXY &position ); /** * Returns the CRS of the map position, or an invalid CRS if the annotation does @@ -346,7 +346,7 @@ class CORE_EXPORT QgsAnnotation : public QObject bool mHasFixedMapPosition = true; //! Map position (for fixed position items) - QgsPoint mMapPosition; + QgsPointXY mMapPosition; //! CRS of the map position QgsCoordinateReferenceSystem mMapPositionCrs; diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index 0fe16794bee..4f0f37ac9dd 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -1644,7 +1644,7 @@ void QgsComposerMap::mapPolygon( const QgsRectangle &extent, QPolygonF &poly ) c } //there is rotation - QgsPoint rotationPoint( ( extent.xMaximum() + extent.xMinimum() ) / 2.0, ( extent.yMaximum() + extent.yMinimum() ) / 2.0 ); + QgsPointXY rotationPoint( ( extent.xMaximum() + extent.xMinimum() ) / 2.0, ( extent.yMaximum() + extent.yMinimum() ) / 2.0 ); double dx, dy; //x-, y- shift from rotation point to corner point //top left point @@ -1803,11 +1803,11 @@ QPointF QgsComposerMap::mapToItemCoords( QPointF mapCoords ) const } QgsRectangle tExtent = transformedExtent(); - QgsPoint rotationPoint( ( tExtent.xMaximum() + tExtent.xMinimum() ) / 2.0, ( tExtent.yMaximum() + tExtent.yMinimum() ) / 2.0 ); + QgsPointXY rotationPoint( ( tExtent.xMaximum() + tExtent.xMinimum() ) / 2.0, ( tExtent.yMaximum() + tExtent.yMinimum() ) / 2.0 ); double dx = mapCoords.x() - rotationPoint.x(); double dy = mapCoords.y() - rotationPoint.y(); QgsComposerUtils::rotate( -mEvaluatedMapRotation, dx, dy ); - QgsPoint backRotatedCoords( rotationPoint.x() + dx, rotationPoint.y() + dy ); + QgsPointXY backRotatedCoords( rotationPoint.x() + dx, rotationPoint.y() + dy ); QgsRectangle unrotatedExtent = transformedExtent(); double xItem = rect().width() * ( backRotatedCoords.x() - unrotatedExtent.xMinimum() ) / unrotatedExtent.width(); diff --git a/src/core/composer/qgscomposermapgrid.cpp b/src/core/composer/qgscomposermapgrid.cpp index 1532ccb3108..def86563534 100644 --- a/src/core/composer/qgscomposermapgrid.cpp +++ b/src/core/composer/qgscomposermapgrid.cpp @@ -501,7 +501,7 @@ void QgsComposerMapGrid::drawGridCrsTransform( QgsRenderContext &context, double double maxX = mComposerMap->rect().width(); double maxY = mComposerMap->rect().height(); - QList< QgsPoint >::const_iterator intersectionIt = mTransformedIntersections.constBegin(); + QList< QgsPointXY >::const_iterator intersectionIt = mTransformedIntersections.constBegin(); for ( ; intersectionIt != mTransformedIntersections.constEnd(); ++intersectionIt ) { double x = intersectionIt->x(); @@ -570,7 +570,7 @@ void QgsComposerMapGrid::calculateCrsTransformLines() QgsPolyline yLine; for ( int i = 0; i < ( *yGridIt ).second.size(); ++i ) { - yLine.append( QgsPoint( ( *yGridIt ).second.at( i ).x(), ( *yGridIt ).second.at( i ).y() ) ); + yLine.append( QgsPointXY( ( *yGridIt ).second.at( i ).x(), ( *yGridIt ).second.at( i ).y() ) ); } yLines << QgsGeometry::fromPolyline( yLine ); } @@ -581,7 +581,7 @@ void QgsComposerMapGrid::calculateCrsTransformLines() QgsPolyline xLine; for ( int i = 0; i < ( *xGridIt ).second.size(); ++i ) { - xLine.append( QgsPoint( ( *xGridIt ).second.at( i ).x(), ( *xGridIt ).second.at( i ).y() ) ); + xLine.append( QgsPointXY( ( *xGridIt ).second.at( i ).x(), ( *xGridIt ).second.at( i ).y() ) ); } xLines << QgsGeometry::fromPolyline( xLine ); } @@ -601,8 +601,8 @@ void QgsComposerMapGrid::calculateCrsTransformLines() //go through all intersections and draw grid markers/crosses int i = 0; - QgsPoint vertex = intersects.vertexAt( i ); - while ( vertex != QgsPoint( 0, 0 ) ) + QgsPointXY vertex = intersects.vertexAt( i ); + while ( vertex != QgsPointXY( 0, 0 ) ) { mTransformedIntersections << vertex; i = i + 1; @@ -1484,7 +1484,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr return mGridAnnotationExpression->evaluate( &expressionContext ).toString(); } - QgsPoint p; + QgsPointXY p; p.setX( coord == QgsComposerMapGrid::Longitude ? value : 0 ); p.setY( coord == QgsComposerMapGrid::Longitude ? 0 : value ); @@ -1740,7 +1740,7 @@ int QgsComposerMapGrid::xGridLinesCrsTransform( const QgsRectangle &bbox, const try { - QgsPoint mapPoint = t.transform( currentX, currentLevel ); //transform back to map crs + QgsPointXY mapPoint = t.transform( currentX, currentLevel ); //transform back to map crs gridLine.append( mComposerMap->mapToItemCoords( QPointF( mapPoint.x(), mapPoint.y() ) ) ); //transform back to composer coords } catch ( QgsCsException &cse ) @@ -1815,7 +1815,7 @@ int QgsComposerMapGrid::yGridLinesCrsTransform( const QgsRectangle &bbox, const try { //transform back to map crs - QgsPoint mapPoint = t.transform( currentLevel, currentY ); + QgsPointXY mapPoint = t.transform( currentLevel, currentY ); //transform back to composer coords gridLine.append( mComposerMap->mapToItemCoords( QPointF( mapPoint.x(), mapPoint.y() ) ) ); } @@ -2351,8 +2351,8 @@ int QgsComposerMapGrid::crsGridParams( QgsRectangle &crsRect, QgsCoordinateTrans if ( mCRS.isGeographic() ) { //handle crossing the 180 degree longitude line - QgsPoint lowerLeft( mapBoundingRect.xMinimum(), mapBoundingRect.yMinimum() ); - QgsPoint upperRight( mapBoundingRect.xMaximum(), mapBoundingRect.yMaximum() ); + QgsPointXY lowerLeft( mapBoundingRect.xMinimum(), mapBoundingRect.yMinimum() ); + QgsPointXY upperRight( mapBoundingRect.xMaximum(), mapBoundingRect.yMaximum() ); lowerLeft = tr.transform( lowerLeft.x(), lowerLeft.y() ); upperRight = tr.transform( upperRight.x(), upperRight.y() ); diff --git a/src/core/composer/qgscomposermapgrid.h b/src/core/composer/qgscomposermapgrid.h index dc0fd647603..0730786250e 100644 --- a/src/core/composer/qgscomposermapgrid.h +++ b/src/core/composer/qgscomposermapgrid.h @@ -931,7 +931,7 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem QList< QPair< double, QPolygonF > > mTransformedXLines; QList< QPair< double, QPolygonF > > mTransformedYLines; - QList< QgsPoint > mTransformedIntersections; + QList< QgsPointXY > mTransformedIntersections; QRectF mPrevPaintRect; QPolygonF mPrevMapPolygon; diff --git a/src/core/composer/qgscomposermapoverview.cpp b/src/core/composer/qgscomposermapoverview.cpp index 123d6a05108..24ef029fd1c 100644 --- a/src/core/composer/qgscomposermapoverview.cpp +++ b/src/core/composer/qgscomposermapoverview.cpp @@ -307,7 +307,7 @@ void QgsComposerMapOverview::overviewExtentChanged() } QgsRectangle otherExtent = *overviewFrameMap->currentMapExtent(); - QgsPoint center = otherExtent.center(); + QgsPointXY center = otherExtent.center(); QgsRectangle movedExtent( center.x() - extent.width() / 2, center.y() - extent.height() / 2, center.x() - extent.width() / 2 + extent.width(), diff --git a/src/core/composer/qgscomposerpicture.cpp b/src/core/composer/qgscomposerpicture.cpp index c9ded32479f..abe96c4e7b4 100644 --- a/src/core/composer/qgscomposerpicture.cpp +++ b/src/core/composer/qgscomposerpicture.cpp @@ -421,7 +421,7 @@ void QgsComposerPicture::updateMapRotation() case TrueNorth: { - QgsPoint center = mRotationMap->currentMapExtent()->center(); + QgsPointXY center = mRotationMap->currentMapExtent()->center(); QgsCoordinateReferenceSystem crs = mRotationMap->crs(); try diff --git a/src/core/composer/qgscomposerscalebar.cpp b/src/core/composer/qgscomposerscalebar.cpp index e8af9bad8fd..15fa2795e4c 100644 --- a/src/core/composer/qgscomposerscalebar.cpp +++ b/src/core/composer/qgscomposerscalebar.cpp @@ -340,8 +340,8 @@ double QgsComposerScaleBar::mapWidth() const da.setEllipsoid( mComposition->project()->ellipsoid() ); QgsUnitTypes::DistanceUnit units = da.lengthUnits(); - double measure = da.measureLine( QgsPoint( composerMapRect.xMinimum(), composerMapRect.yMinimum() ), - QgsPoint( composerMapRect.xMaximum(), composerMapRect.yMinimum() ) ); + double measure = da.measureLine( QgsPointXY( composerMapRect.xMinimum(), composerMapRect.yMinimum() ), + QgsPointXY( composerMapRect.xMaximum(), composerMapRect.yMinimum() ) ); measure /= QgsUnitTypes::fromUnitToUnitFactor( mSettings.units(), units ); return measure; } diff --git a/src/core/dxf/qgsdxfexport.cpp b/src/core/dxf/qgsdxfexport.cpp index f776304892a..57f129a019a 100644 --- a/src/core/dxf/qgsdxfexport.cpp +++ b/src/core/dxf/qgsdxfexport.cpp @@ -439,7 +439,7 @@ void QgsDxfExport::writeGroup( int code, const QString &s ) writeString( s ); } -void QgsDxfExport::writeGroup( int code, const QgsPointV2 &p ) +void QgsDxfExport::writeGroup( int code, const QgsPoint &p ) { writeGroup( code + 10, p.x() ); writeGroup( code + 20, p.y() ); @@ -573,11 +573,11 @@ void QgsDxfExport::writeHeader( const QString &codepage ) // EXTMIN writeGroup( 9, QStringLiteral( "$EXTMIN" ) ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ, mExtent.xMinimum(), mExtent.yMinimum() ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ, mExtent.xMinimum(), mExtent.yMinimum() ) ); // EXTMAX writeGroup( 9, QStringLiteral( "$EXTMAX" ) ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ, mExtent.xMaximum(), mExtent.yMaximum() ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ, mExtent.xMaximum(), mExtent.yMaximum() ) ); // Global linetype scale writeGroup( 9, QStringLiteral( "$LTSCALE" ) ); @@ -727,14 +727,14 @@ void QgsDxfExport::writeTables() writeGroup( 100, QStringLiteral( "AcDbViewportTableRecord" ) ); writeGroup( 2, QStringLiteral( "*ACTIVE" ) ); writeGroup( 70, 0 ); // flags - writeGroup( 0, QgsPointV2( 0.0, 0.0 ) ); // lower left - writeGroup( 1, QgsPointV2( 1.0, 1.0 ) ); // upper right - writeGroup( 2, QgsPointV2( 0.0, 0.0 ) ); // view center point - writeGroup( 3, QgsPointV2( 0.0, 0.0 ) ); // snap base point - writeGroup( 4, QgsPointV2( 1.0, 1.0 ) ); // snap spacing - writeGroup( 5, QgsPointV2( 1.0, 1.0 ) ); // grid spacing - writeGroup( 6, QgsPointV2( QgsWkbTypes::PointZ, 0.0, 0.0, 1.0 ) ); // view direction from target point - writeGroup( 7, QgsPointV2( mExtent.center() ) ); // view target point + writeGroup( 0, QgsPoint( 0.0, 0.0 ) ); // lower left + writeGroup( 1, QgsPoint( 1.0, 1.0 ) ); // upper right + writeGroup( 2, QgsPoint( 0.0, 0.0 ) ); // view center point + writeGroup( 3, QgsPoint( 0.0, 0.0 ) ); // snap base point + writeGroup( 4, QgsPoint( 1.0, 1.0 ) ); // snap spacing + writeGroup( 5, QgsPoint( 1.0, 1.0 ) ); // grid spacing + writeGroup( 6, QgsPoint( QgsWkbTypes::PointZ, 0.0, 0.0, 1.0 ) ); // view direction from target point + writeGroup( 7, QgsPoint( mExtent.center() ) ); // view target point writeGroup( 40, mExtent.height() ); // view height writeGroup( 41, mExtent.width() / mExtent.height() ); // view aspect ratio writeGroup( 42, 50.0 ); // lens length @@ -752,9 +752,9 @@ void QgsDxfExport::writeTables() writeGroup( 78, 0 ); // snap isopair writeGroup( 281, 0 ); // render mode (0 = 2D optimized) writeGroup( 65, 1 ); // value of UCSVP for this viewport - writeGroup( 100, QgsPointV2( QgsWkbTypes::PointZ ) ); // UCS origin - writeGroup( 101, QgsPointV2( QgsWkbTypes::PointZ, 1.0 ) ); // UCS x axis - writeGroup( 102, QgsPointV2( QgsWkbTypes::PointZ, 0.0, 1.0 ) ); // UCS y axis + writeGroup( 100, QgsPoint( QgsWkbTypes::PointZ ) ); // UCS origin + writeGroup( 101, QgsPoint( QgsWkbTypes::PointZ, 1.0 ) ); // UCS x axis + writeGroup( 102, QgsPoint( QgsWkbTypes::PointZ, 0.0, 1.0 ) ); // UCS y axis writeGroup( 79, 0 ); // Orthographic type of UCS (0 = UCS is not orthographic) writeGroup( 146, 0.0 ); // Elevation @@ -870,7 +870,7 @@ void QgsDxfExport::writeBlocks() writeGroup( 100, QStringLiteral( "AcDbBlockBegin" ) ); writeGroup( 2, block ); writeGroup( 70, 0 ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ ) ); writeGroup( 3, block ); writeGroup( 1, QLatin1String( "" ) ); writeGroup( 0, QStringLiteral( "ENDBLK" ) ); @@ -923,7 +923,7 @@ void QgsDxfExport::writeBlocks() // todo: consider anchor point // double size = ml->size(); // size *= mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ ) ); writeGroup( 3, block ); writeGroup( 1, QLatin1String( "" ) ); @@ -3392,7 +3392,7 @@ void QgsDxfExport::endSection() writeGroup( 0, QStringLiteral( "ENDSEC" ) ); } -void QgsDxfExport::writePoint( const QgsPointV2 &pt, const QString &layer, const QColor &color, QgsSymbolRenderContext &ctx, const QgsSymbolLayer *symbolLayer, const QgsSymbol *symbol, double angle ) +void QgsDxfExport::writePoint( const QgsPoint &pt, const QString &layer, const QColor &color, QgsSymbolRenderContext &ctx, const QgsSymbolLayer *symbolLayer, const QgsSymbol *symbol, double angle ) { #if 0 // debug: draw rectangle for debugging @@ -3404,10 +3404,10 @@ void QgsDxfExport::writePoint( const QgsPointV2 &pt, const QString &layer, const writeGroup( 0, "SOLID" ); writeGroup( 8, layer ); writeGroup( 62, 1 ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ, pt.x() - halfSize, pt.y() - halfSize ) ); - writeGroup( 1, QgsPointV2( QgsWkbTypes::PointZ, pt.x() + halfSize, pt.y() - halfSize ) ); - writeGroup( 2, QgsPointV2( QgsWkbTypes::PointZ, pt.x() - halfSize, pt.y() + halfSize ) ); - writeGroup( 3, QgsPointV2( QgsWkbTypes::PointZ, pt.x() + halfSize, pt.y() + halfSize ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ, pt.x() - halfSize, pt.y() - halfSize ) ); + writeGroup( 1, QgsPoint( QgsWkbTypes::PointZ, pt.x() + halfSize, pt.y() - halfSize ) ); + writeGroup( 2, QgsPoint( QgsWkbTypes::PointZ, pt.x() - halfSize, pt.y() + halfSize ) ); + writeGroup( 3, QgsPoint( QgsWkbTypes::PointZ, pt.x() + halfSize, pt.y() + halfSize ) ); } #endif // 0 @@ -3485,7 +3485,7 @@ void QgsDxfExport::writePolyline( const QgsPointSequence &line, const QString &l writeGroup( 6, lineStyleName ); writeGroup( color ); writeGroup( 100, QStringLiteral( "AcDb3dPolyline" ) ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ ) ); writeGroup( 70, 8 ); for ( int i = 0; i < n; i++ ) @@ -3521,8 +3521,8 @@ void QgsDxfExport::writePolygon( const QgsRingSequence &polygon, const QString & writeGroup( color ); // Color writeGroup( 100, QStringLiteral( "AcDbHatch" ) ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) ); // Elevation point (in OCS) - writeGroup( 200, QgsPointV2( QgsWkbTypes::PointZ, 0.0, 0.0, 1.0 ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ ) ); // Elevation point (in OCS) + writeGroup( 200, QgsPoint( QgsWkbTypes::PointZ, 0.0, 0.0, 1.0 ) ); writeGroup( 2, hatchPattern ); // Hatch pattern name writeGroup( 70, hatchPattern == QLatin1String( "SOLID" ) ); // Solid fill flag (solid fill = 1; pattern fill = 0) @@ -3550,12 +3550,12 @@ void QgsDxfExport::writePolygon( const QgsRingSequence &polygon, const QString & writeGroup( 98, 0 ); // Number of seed points } -void QgsDxfExport::writeLine( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width ) +void QgsDxfExport::writeLine( const QgsPoint &pt1, const QgsPoint &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width ) { writePolyline( QgsPointSequence() << pt1 << pt2, layer, lineStyleName, color, width ); } -void QgsDxfExport::writePoint( const QString &layer, const QColor &color, const QgsPointV2 &pt ) +void QgsDxfExport::writePoint( const QString &layer, const QColor &color, const QgsPoint &pt ) { writeGroup( 0, QStringLiteral( "POINT" ) ); writeHandle(); @@ -3566,7 +3566,7 @@ void QgsDxfExport::writePoint( const QString &layer, const QColor &color, const writeGroup( 0, pt ); } -void QgsDxfExport::writeFilledCircle( const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius ) +void QgsDxfExport::writeFilledCircle( const QString &layer, const QColor &color, const QgsPoint &pt, double radius ) { writeGroup( 0, QStringLiteral( "HATCH" ) ); // Entity type writeHandle(); @@ -3576,8 +3576,8 @@ void QgsDxfExport::writeFilledCircle( const QString &layer, const QColor &color, writeGroup( color ); // Color (0 by block, 256 by layer) writeGroup( 100, QStringLiteral( "AcDbHatch" ) ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) ); // Elevation point (in OCS) - writeGroup( 200, QgsPointV2( QgsWkbTypes::PointZ, 0.0, 0.0, 1.0 ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::PointZ ) ); // Elevation point (in OCS) + writeGroup( 200, QgsPoint( QgsWkbTypes::PointZ, 0.0, 0.0, 1.0 ) ); writeGroup( 2, QStringLiteral( "SOLID" ) ); // Hatch pattern name writeGroup( 70, 1 ); // Solid fill flag (solid fill = 1; pattern fill = 0) @@ -3590,10 +3590,10 @@ void QgsDxfExport::writeFilledCircle( const QString &layer, const QColor &color, writeGroup( 73, 1 ); // Is closed flag writeGroup( 93, 2 ); // Number of polyline vertices - writeGroup( 0, QgsPointV2( QgsWkbTypes::Point, pt.x() - radius, pt.y() ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::Point, pt.x() - radius, pt.y() ) ); writeGroup( 42, 1.0 ); - writeGroup( 0, QgsPointV2( QgsWkbTypes::Point, pt.x() + radius, pt.y() ) ); + writeGroup( 0, QgsPoint( QgsWkbTypes::Point, pt.x() + radius, pt.y() ) ); writeGroup( 42, 1.0 ); writeGroup( 97, 0 ); // Number of source boundary objects @@ -3603,7 +3603,7 @@ void QgsDxfExport::writeFilledCircle( const QString &layer, const QColor &color, writeGroup( 98, 0 ); // Number of seed points } -void QgsDxfExport::writeCircle( const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius, const QString &lineStyleName, double width ) +void QgsDxfExport::writeCircle( const QString &layer, const QColor &color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width ) { writeGroup( 0, QStringLiteral( "LWPOLYLINE" ) ); writeHandle(); @@ -3619,13 +3619,13 @@ void QgsDxfExport::writeCircle( const QString &layer, const QColor &color, const writeGroup( 70, 1 ); writeGroup( 43, width ); - writeGroup( 0, QgsPointV2( pt.x() - radius, pt.y() ) ); + writeGroup( 0, QgsPoint( pt.x() - radius, pt.y() ) ); writeGroup( 42, 1.0 ); - writeGroup( 0, QgsPointV2( pt.x() + radius, pt.y() ) ); + writeGroup( 0, QgsPoint( pt.x() + radius, pt.y() ) ); writeGroup( 42, 1.0 ); } -void QgsDxfExport::writeText( const QString &layer, const QString &text, const QgsPointV2 &pt, double size, double angle, const QColor &color ) +void QgsDxfExport::writeText( const QString &layer, const QString &text, const QgsPoint &pt, double size, double angle, const QColor &color ) { writeGroup( 0, QStringLiteral( "TEXT" ) ); writeHandle(); @@ -3640,7 +3640,7 @@ void QgsDxfExport::writeText( const QString &layer, const QString &text, const Q writeGroup( 7, QStringLiteral( "STANDARD" ) ); // so far only support for standard font } -void QgsDxfExport::writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor &color ) +void QgsDxfExport::writeMText( const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, const QColor &color ) { if ( !mTextStream.codec()->canEncode( text ) ) { @@ -4423,7 +4423,7 @@ void QgsDxfExport::drawLabel( const QString &layerId, QgsRenderContext &context, .arg( tmpLyr.format().font().bold() ? 1 : 0 ) .arg( label->getHeight() / ( 1 + txt.count( QStringLiteral( "\\P" ) ) ) * 0.75 ) ); - writeMText( dxfLayer, txt, QgsPointV2( label->getX(), label->getY() ), label->getWidth(), label->getAlpha() * 180.0 / M_PI, tmpLyr.format().color() ); + writeMText( dxfLayer, txt, QgsPoint( label->getX(), label->getY() ), label->getWidth(), label->getAlpha() * 180.0 / M_PI, tmpLyr.format().color() ); } diff --git a/src/core/dxf/qgsdxfexport.h b/src/core/dxf/qgsdxfexport.h index b969b6ce97d..79fcec6558a 100644 --- a/src/core/dxf/qgsdxfexport.h +++ b/src/core/dxf/qgsdxfexport.h @@ -30,7 +30,7 @@ #include class QgsMapLayer; -class QgsPoint; +class QgsPointXY; class QgsSymbolLayer; class QIODevice; class QgsPalLayerSettings; @@ -204,7 +204,7 @@ class CORE_EXPORT QgsDxfExport * \note available in Python bindings as writeGroupPointV2 * \since QGIS 2.15 */ - void writeGroup( int code, const QgsPointV2 &p ) SIP_PYNAME( writeGroupPointV2 ); + void writeGroup( int code, const QgsPoint &p ) SIP_PYNAME( writeGroupPointV2 ); /** * Write a group code with color value @@ -273,32 +273,32 @@ class CORE_EXPORT QgsDxfExport //! Write line (as a polyline) //! \since QGIS 2.15 - void writeLine( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width = -1 ); + void writeLine( const QgsPoint &pt1, const QgsPoint &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width = -1 ); //! Write point //! \note available in Python bindings as writePointV2 //! \since QGIS 2.15 - void writePoint( const QString &layer, const QColor &color, const QgsPointV2 &pt ) SIP_PYNAME( writePointV2 ); + void writePoint( const QString &layer, const QColor &color, const QgsPoint &pt ) SIP_PYNAME( writePointV2 ); //! Write filled circle (as hatch) //! \note available in Python bindings as writePointV2 //! \since QGIS 2.15 - void writeFilledCircle( const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius ) SIP_PYNAME( writeFillCircleV2 ); + void writeFilledCircle( const QString &layer, const QColor &color, const QgsPoint &pt, double radius ) SIP_PYNAME( writeFillCircleV2 ); //! Write circle (as polyline) //! \note available in Python bindings as writeCircleV2 //! \since QGIS 2.15 - void writeCircle( const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius, const QString &lineStyleName, double width ) SIP_PYNAME( writeCircleV2 ); + void writeCircle( const QString &layer, const QColor &color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width ) SIP_PYNAME( writeCircleV2 ); //! Write text (TEXT) //! \note available in Python bindings as writeTextV2 //! \since QGIS 2.15 - void writeText( const QString &layer, const QString &text, const QgsPointV2 &pt, double size, double angle, const QColor &color ) SIP_PYNAME( writeTextV2 ); + void writeText( const QString &layer, const QString &text, const QgsPoint &pt, double size, double angle, const QColor &color ) SIP_PYNAME( writeTextV2 ); //! Write mtext (MTEXT) //! \note available in Python bindings as writeMTextV2 //! \since QGIS 2.15 - void writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor &color ); + void writeMText( const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, const QColor &color ); //! Calculates a scaling factor to convert from map units to a specified symbol unit. static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits ); @@ -360,7 +360,7 @@ class CORE_EXPORT QgsDxfExport void startSection(); void endSection(); - void writePoint( const QgsPointV2 &pt, const QString &layer, const QColor &color, QgsSymbolRenderContext &ctx, const QgsSymbolLayer *symbolLayer, const QgsSymbol *symbol, double angle ); + void writePoint( const QgsPoint &pt, const QString &layer, const QColor &color, QgsSymbolRenderContext &ctx, const QgsSymbolLayer *symbolLayer, const QgsSymbol *symbol, double angle ); void writeDefaultLinetypes(); void writeSymbolLayerLinetype( const QgsSymbolLayer *symbolLayer ); void writeLinetype( const QString &styleName, const QVector &pattern, QgsUnitTypes::RenderUnit u ); diff --git a/src/core/dxf/qgsdxfpaintengine.cpp b/src/core/dxf/qgsdxfpaintengine.cpp index f362aa9432c..3123231ca7d 100644 --- a/src/core/dxf/qgsdxfpaintengine.cpp +++ b/src/core/dxf/qgsdxfpaintengine.cpp @@ -198,13 +198,13 @@ void QgsDxfPaintEngine::drawLines( const QLineF *lines, int lineCount ) } } -QgsPointV2 QgsDxfPaintEngine::toDxfCoordinates( QPointF pt ) const +QgsPoint QgsDxfPaintEngine::toDxfCoordinates( QPointF pt ) const { if ( !mPaintDevice || !mDxf ) - return QgsPointV2( pt.x(), pt.y() ); + return QgsPoint( pt.x(), pt.y() ); QPointF dxfPt = mPaintDevice->dxfCoordinates( mTransform.map( pt ) ) + mShift; - return QgsPointV2( dxfPt.x(), dxfPt.y() ); + return QgsPoint( dxfPt.x(), dxfPt.y() ); } diff --git a/src/core/dxf/qgsdxfpaintengine.h b/src/core/dxf/qgsdxfpaintengine.h index df1c80d411a..71444863540 100644 --- a/src/core/dxf/qgsdxfpaintengine.h +++ b/src/core/dxf/qgsdxfpaintengine.h @@ -67,7 +67,7 @@ class CORE_EXPORT QgsDxfPaintEngine: public QPaintEngine QPolygonF mCurrentPolygon; QList mCurrentCurve; - QgsPointV2 toDxfCoordinates( QPointF pt ) const; + QgsPoint toDxfCoordinates( QPointF pt ) const; double currentWidth() const; void moveTo( double dx, double dy ); diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index 075424e7236..3748b6c3843 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -1587,7 +1587,7 @@ static QVariant fcnGeomZ( const QVariantList &values, const QgsExpressionContext //if single point, return the point's z coordinate if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() ) { - QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( geom.geometry() ); + QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() ); if ( point ) return point->z(); } @@ -1604,7 +1604,7 @@ static QVariant fcnGeomM( const QVariantList &values, const QgsExpressionContext //if single point, return the point's m value if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() ) { - QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( geom.geometry() ); + QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() ); if ( point ) return point->m(); } @@ -1629,8 +1629,8 @@ static QVariant fcnPointN( const QVariantList &values, const QgsExpressionContex return QVariant(); } - QgsPointV2 point = geom.geometry()->vertexAt( vId ); - return QVariant::fromValue( QgsGeometry( new QgsPointV2( point ) ) ); + QgsPoint point = geom.geometry()->vertexAt( vId ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( point ) ) ); } static QVariant fcnStartPoint( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) @@ -1646,8 +1646,8 @@ static QVariant fcnStartPoint( const QVariantList &values, const QgsExpressionCo return QVariant(); } - QgsPointV2 point = geom.geometry()->vertexAt( vId ); - return QVariant::fromValue( QgsGeometry( new QgsPointV2( point ) ) ); + QgsPoint point = geom.geometry()->vertexAt( vId ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( point ) ) ); } static QVariant fcnEndPoint( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) @@ -1663,8 +1663,8 @@ static QVariant fcnEndPoint( const QVariantList &values, const QgsExpressionCont return QVariant(); } - QgsPointV2 point = geom.geometry()->vertexAt( vId ); - return QVariant::fromValue( QgsGeometry( new QgsPointV2( point ) ) ); + QgsPoint point = geom.geometry()->vertexAt( vId ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( point ) ) ); } static QVariant fcnNodesToPoints( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) @@ -1869,11 +1869,11 @@ static QVariant fcnMakePoint( const QVariantList &values, const QgsExpressionCon switch ( values.count() ) { case 2: - return QVariant::fromValue( QgsGeometry( new QgsPointV2( x, y ) ) ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( x, y ) ) ); case 3: - return QVariant::fromValue( QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZ, x, y, z ) ) ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( QgsWkbTypes::PointZ, x, y, z ) ) ); case 4: - return QVariant::fromValue( QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZM, x, y, z, m ) ) ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( QgsWkbTypes::PointZM, x, y, z, m ) ) ); } return QVariant(); //avoid warning } @@ -1883,7 +1883,7 @@ static QVariant fcnMakePointM( const QVariantList &values, const QgsExpressionCo double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); double y = QgsExpressionUtils::getDoubleValue( values.at( 1 ), parent ); double m = QgsExpressionUtils::getDoubleValue( values.at( 2 ), parent ); - return QVariant::fromValue( QgsGeometry( new QgsPointV2( QgsWkbTypes::PointM, x, y, 0.0, m ) ) ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( QgsWkbTypes::PointM, x, y, 0.0, m ) ) ); } static QVariant fcnMakeLine( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) @@ -1905,7 +1905,7 @@ static QVariant fcnMakeLine( const QVariantList &values, const QgsExpressionCont if ( geom.type() != QgsWkbTypes::PointGeometry || geom.isMultipart() ) continue; - QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( geom.geometry() ); + QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() ); if ( !point ) continue; @@ -1960,7 +1960,7 @@ static QVariant fcnMakeTriangle( const QVariantList &values, const QgsExpression if ( geom.type() != QgsWkbTypes::PointGeometry || geom.isMultipart() ) return QVariant(); - QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( geom.geometry() ); + QgsPoint *point = dynamic_cast< QgsPoint * >( geom.geometry() ); if ( !point ) return QVariant(); @@ -1989,7 +1989,7 @@ static QVariant fcnMakeCircle( const QVariantList &values, const QgsExpressionCo parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) ); return QVariant(); } - QgsPointV2 *point = static_cast< QgsPointV2 * >( geom.geometry() ); + QgsPoint *point = static_cast< QgsPoint * >( geom.geometry() ); QgsCircle circ( *point, radius ); return QVariant::fromValue( QgsGeometry( circ.toPolygon( segment ) ) ); } @@ -2012,7 +2012,7 @@ static QVariant fcnMakeEllipse( const QVariantList &values, const QgsExpressionC parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) ); return QVariant(); } - QgsPointV2 *point = static_cast< QgsPointV2 * >( geom.geometry() ); + QgsPoint *point = static_cast< QgsPoint * >( geom.geometry() ); QgsEllipse elp( *point, majorAxis, minorAxis, azimuth ); return QVariant::fromValue( QgsGeometry( elp.toPolygon( segment ) ) ); } @@ -2047,8 +2047,8 @@ static QVariant fcnMakeRegularPolygon( const QVariantList &values, const QgsExpr parent->setEvalErrorString( QObject::tr( "Option can be 0 (inscribed) or 1 (circumscribed)" ) ); return QVariant(); } - QgsPointV2 *center = static_cast< QgsPointV2 * >( pt1.geometry() ); - QgsPointV2 *corner = static_cast< QgsPointV2 * >( pt2.geometry() ); + QgsPoint *center = static_cast< QgsPoint * >( pt1.geometry() ); + QgsPoint *corner = static_cast< QgsPoint * >( pt2.geometry() ); QgsRegularPolygon rp = QgsRegularPolygon( *center, *corner, nbEdges, option ); @@ -2074,7 +2074,7 @@ static QVariant pointAt( const QVariantList &values, const QgsExpressionContext return QVariant(); } - QgsPoint p = g.vertexAt( idx ); + QgsPointXY p = g.vertexAt( idx ); return QVariant( QPointF( p.x(), p.y() ) ); } @@ -2589,8 +2589,8 @@ static QVariant fcnAzimuth( const QVariantList &values, const QgsExpressionConte QgsGeometry fGeom1 = QgsExpressionUtils::getGeometry( values.at( 0 ), parent ); QgsGeometry fGeom2 = QgsExpressionUtils::getGeometry( values.at( 1 ), parent ); - const QgsPointV2 *pt1 = dynamic_cast( fGeom1.geometry() ); - const QgsPointV2 *pt2 = dynamic_cast( fGeom2.geometry() ); + const QgsPoint *pt1 = dynamic_cast( fGeom1.geometry() ); + const QgsPoint *pt2 = dynamic_cast( fGeom2.geometry() ); if ( !pt1 || !pt2 ) { @@ -2661,10 +2661,10 @@ static QVariant fcnProject( const QVariantList &values, const QgsExpressionConte double azimuth = QgsExpressionUtils::getDoubleValue( values.at( 2 ), parent ); double inclination = QgsExpressionUtils::getDoubleValue( values.at( 3 ), parent ); - const QgsPointV2 *p = static_cast( geom.geometry() ); - QgsPointV2 newPoint = p->project( distance, 180.0 * azimuth / M_PI, 180.0 * inclination / M_PI ); + const QgsPoint *p = static_cast( geom.geometry() ); + QgsPoint newPoint = p->project( distance, 180.0 * azimuth / M_PI, 180.0 * inclination / M_PI ); - return QVariant::fromValue( QgsGeometry( new QgsPointV2( newPoint ) ) ); + return QVariant::fromValue( QgsGeometry( new QgsPoint( newPoint ) ) ); } static QVariant fcnInclination( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) @@ -2672,8 +2672,8 @@ static QVariant fcnInclination( const QVariantList &values, const QgsExpressionC QgsGeometry fGeom1 = QgsExpressionUtils::getGeometry( values.at( 0 ), parent ); QgsGeometry fGeom2 = QgsExpressionUtils::getGeometry( values.at( 1 ), parent ); - const QgsPointV2 *pt1 = dynamic_cast( fGeom1.geometry() ); - const QgsPointV2 *pt2 = dynamic_cast( fGeom2.geometry() ); + const QgsPoint *pt1 = dynamic_cast( fGeom1.geometry() ); + const QgsPoint *pt2 = dynamic_cast( fGeom2.geometry() ); if ( ( fGeom1.type() != QgsWkbTypes::PointGeometry ) || ( fGeom2.type() != QgsWkbTypes::PointGeometry ) || !pt1 || !pt2 ) diff --git a/src/core/geometry/qgsabstractgeometry.cpp b/src/core/geometry/qgsabstractgeometry.cpp index a5847dd158e..b768a52455f 100644 --- a/src/core/geometry/qgsabstractgeometry.cpp +++ b/src/core/geometry/qgsabstractgeometry.cpp @@ -103,7 +103,7 @@ QgsRectangle QgsAbstractGeometry::calculateBoundingBox() const double ymax = -std::numeric_limits::max(); QgsVertexId id; - QgsPointV2 vertex; + QgsPoint vertex; double x, y; while ( nextVertex( id, vertex ) ) { @@ -166,7 +166,7 @@ QString QgsAbstractGeometry::wktTypeStr() const return wkt; } -QgsPointV2 QgsAbstractGeometry::centroid() const +QgsPoint QgsAbstractGeometry::centroid() const { // http://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon // Pick the first ring of first part for the moment @@ -180,7 +180,7 @@ QgsPointV2 QgsAbstractGeometry::centroid() const double A = 0.; double Cx = 0.; double Cy = 0.; - QgsPointV2 v0 = vertexAt( QgsVertexId( 0, 0, 0 ) ); + QgsPoint v0 = vertexAt( QgsVertexId( 0, 0, 0 ) ); int i = 0, j = 1; if ( vertexAt( QgsVertexId( 0, 0, 0 ) ) != vertexAt( QgsVertexId( 0, 0, n - 1 ) ) ) { @@ -189,8 +189,8 @@ QgsPointV2 QgsAbstractGeometry::centroid() const } for ( ; j < n; i = j++ ) { - QgsPointV2 vi = vertexAt( QgsVertexId( 0, 0, i ) ); - QgsPointV2 vj = vertexAt( QgsVertexId( 0, 0, j ) ); + QgsPoint vi = vertexAt( QgsVertexId( 0, 0, i ) ); + QgsPoint vj = vertexAt( QgsVertexId( 0, 0, j ) ); vi.rx() -= v0.x(); vi.ry() -= v0.y(); vj.rx() -= v0.x(); @@ -206,15 +206,15 @@ QgsPointV2 QgsAbstractGeometry::centroid() const Cx = Cy = 0.; for ( int i = 0; i < n - 1; ++i ) { - QgsPointV2 vi = vertexAt( QgsVertexId( 0, 0, i ) ); + QgsPoint vi = vertexAt( QgsVertexId( 0, 0, i ) ); Cx += vi.x(); Cy += vi.y(); } - return QgsPointV2( Cx / ( n - 1 ), Cy / ( n - 1 ) ); + return QgsPoint( Cx / ( n - 1 ), Cy / ( n - 1 ) ); } else { - return QgsPointV2( v0.x() + Cx / ( 3. * A ), v0.y() + Cy / ( 3. * A ) ); + return QgsPoint( v0.x() + Cx / ( 3. * A ), v0.y() + Cy / ( 3. * A ) ); } } @@ -252,7 +252,7 @@ bool QgsAbstractGeometry::convertTo( QgsWkbTypes::Type type ) bool QgsAbstractGeometry::isEmpty() const { QgsVertexId vId; - QgsPointV2 vertex; + QgsPoint vertex; return !nextVertex( vId, vertex ); } diff --git a/src/core/geometry/qgsabstractgeometry.h b/src/core/geometry/qgsabstractgeometry.h index 4e181016afd..591ce65594d 100644 --- a/src/core/geometry/qgsabstractgeometry.h +++ b/src/core/geometry/qgsabstractgeometry.h @@ -28,19 +28,19 @@ class QgsMapToPixel; class QgsCurve; class QgsMultiCurve; class QgsMultiPointV2; -class QgsPointV2; +class QgsPoint; struct QgsVertexId; class QPainter; class QDomDocument; class QDomElement; -typedef QList< QgsPointV2 > QgsPointSequence; +typedef QList< QgsPoint > QgsPointSequence; #ifndef SIP_RUN typedef QList< QgsPointSequence > QgsRingSequence; typedef QList< QgsRingSequence > QgsCoordinateSequence; #else -typedef QList< QList< QgsPointV2 > > QgsRingSequence; -typedef QList< QList< QList< QgsPointV2 > > > QgsCoordinateSequence; +typedef QList< QList< QgsPoint > > QgsRingSequence; +typedef QList< QList< QList< QgsPoint > > > QgsCoordinateSequence; #endif /** \ingroup core @@ -53,8 +53,8 @@ class CORE_EXPORT QgsAbstractGeometry #ifdef SIP_RUN SIP_CONVERT_TO_SUBCLASS_CODE - if ( dynamic_cast( sipCpp ) != NULL ) - sipType = sipType_QgsPointV2; + if ( dynamic_cast( sipCpp ) != NULL ) + sipType = sipType_QgsPoint; else if ( dynamic_cast( sipCpp ) != NULL ) sipType = sipType_QgsLineString; else if ( dynamic_cast( sipCpp ) != NULL ) @@ -246,7 +246,7 @@ class CORE_EXPORT QgsAbstractGeometry * \param vertex container for found node * \returns false if at end */ - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex SIP_OUT ) const = 0; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const = 0; /** Retrieves the sequence of geometries, rings and nodes. * \returns coordinate sequence @@ -259,7 +259,7 @@ class CORE_EXPORT QgsAbstractGeometry /** Returns the point corresponding to a specified vertex id */ - virtual QgsPointV2 vertexAt( QgsVertexId id ) const = 0; + virtual QgsPoint vertexAt( QgsVertexId id ) const = 0; /** Searches for the closest segment of the geometry to a given point. * \param pt specifies the point to find closest segment to @@ -270,7 +270,7 @@ class CORE_EXPORT QgsAbstractGeometry * \param epsilon epsilon for segment snapping * \returns squared distance to closest segment or negative value on error */ - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const = 0; @@ -283,7 +283,7 @@ class CORE_EXPORT QgsAbstractGeometry * \see moveVertex * \see deleteVertex */ - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) = 0; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) = 0; /** Moves a vertex within the geometry * \param position vertex id for vertex to move @@ -292,7 +292,7 @@ class CORE_EXPORT QgsAbstractGeometry * \see insertVertex * \see deleteVertex */ - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) = 0; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) = 0; /** Deletes a vertex within the geometry * \param position vertex id for vertex to delete @@ -321,7 +321,7 @@ class CORE_EXPORT QgsAbstractGeometry virtual double area() const; //! Returns the centroid of the geometry - virtual QgsPointV2 centroid() const; + virtual QgsPoint centroid() const; /** Returns true if the geometry is empty */ diff --git a/src/core/geometry/qgsbox3d.cpp b/src/core/geometry/qgsbox3d.cpp index c76ae279423..0446cc23c4b 100644 --- a/src/core/geometry/qgsbox3d.cpp +++ b/src/core/geometry/qgsbox3d.cpp @@ -24,7 +24,7 @@ QgsBox3d::QgsBox3d( double xmin, double ymin, double zmin, double xmax, double y , mZmax( zmax ) {} -QgsBox3d::QgsBox3d( const QgsPointV2 &p1, const QgsPointV2 &p2 ) +QgsBox3d::QgsBox3d( const QgsPoint &p1, const QgsPoint &p2 ) : mBounds2d( p1.x(), p1.y(), p2.x(), p2.y() ) , mZmin( qMin( p1.z(), p2.z() ) ) , mZmax( qMax( p1.z(), p2.z() ) ) @@ -106,9 +106,9 @@ bool QgsBox3d::contains( const QgsBox3d &other ) const return ( other.mZmin >= mZmin && other.mZmax <= mZmax ); } -bool QgsBox3d::contains( const QgsPointV2 &p ) const +bool QgsBox3d::contains( const QgsPoint &p ) const { - if ( !mBounds2d.contains( QgsPoint( p.x(), p.y() ) ) ) + if ( !mBounds2d.contains( QgsPointXY( p.x(), p.y() ) ) ) return false; if ( p.is3D() ) diff --git a/src/core/geometry/qgsbox3d.h b/src/core/geometry/qgsbox3d.h index 4ca5d6604e5..8cbf6dfffeb 100644 --- a/src/core/geometry/qgsbox3d.h +++ b/src/core/geometry/qgsbox3d.h @@ -44,7 +44,7 @@ class CORE_EXPORT QgsBox3d * Constructs a QgsBox3D from two points representing opposite corners of the box. * The box is normalized after construction. */ - QgsBox3d( const QgsPointV2 &p1, const QgsPointV2 &p2 ); + QgsBox3d( const QgsPoint &p1, const QgsPoint &p2 ); /** * Sets the minimum \a x value. @@ -188,7 +188,7 @@ class CORE_EXPORT QgsBox3d * If the point is a 2D point (no z-coordinate), then the containment test * will be performed on the x/y extent of the box only. */ - bool contains( const QgsPointV2 &point ) const; + bool contains( const QgsPoint &point ) const; /** * Converts the box to a 2D rectangle. diff --git a/src/core/geometry/qgscircle.cpp b/src/core/geometry/qgscircle.cpp index a7caec2db0f..54cdb451350 100644 --- a/src/core/geometry/qgscircle.cpp +++ b/src/core/geometry/qgscircle.cpp @@ -23,27 +23,27 @@ #include QgsCircle::QgsCircle() : - QgsEllipse( QgsPointV2(), 0.0, 0.0, 0.0 ) + QgsEllipse( QgsPoint(), 0.0, 0.0, 0.0 ) { } -QgsCircle::QgsCircle( const QgsPointV2 ¢er, double radius, double azimuth ) : +QgsCircle::QgsCircle( const QgsPoint ¢er, double radius, double azimuth ) : QgsEllipse( center, radius, radius, azimuth ) { } -QgsCircle QgsCircle::from2Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +QgsCircle QgsCircle::from2Points( const QgsPoint &pt1, const QgsPoint &pt2 ) { - QgsPointV2 center = QgsGeometryUtils::midpoint( pt1, pt2 ); + QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 ); double azimuth = QgsGeometryUtils::lineAngle( pt1.x(), pt1.y(), pt2.x(), pt2.y() ) * 180.0 / M_PI; double radius = pt1.distance( pt2 ); return QgsCircle( center, radius, azimuth ); } -static bool isPerpendicular( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double epsilon ) +static bool isPerpendicular( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon ) { // check the given point are perpendicular to x or y axis @@ -78,9 +78,9 @@ static bool isPerpendicular( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const } -QgsCircle QgsCircle::from3Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double epsilon ) +QgsCircle QgsCircle::from3Points( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon ) { - QgsPointV2 p1, p2, p3; + QgsPoint p1, p2, p3; if ( !isPerpendicular( pt1, pt2, pt3, epsilon ) ) { @@ -122,7 +122,7 @@ QgsCircle QgsCircle::from3Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2, { return QgsCircle(); } - QgsPointV2 center = QgsPointV2(); + QgsPoint center = QgsPoint(); double radius = -0.0; // Paul Bourke's algorithm double yDelta_a = p2.y() - p1.y(); @@ -168,20 +168,20 @@ QgsCircle QgsCircle::from3Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2, return QgsCircle( center, radius ); } -QgsCircle QgsCircle::fromCenterDiameter( const QgsPointV2 ¢er, double diameter, double azimuth ) +QgsCircle QgsCircle::fromCenterDiameter( const QgsPoint ¢er, double diameter, double azimuth ) { return QgsCircle( center, diameter / 2.0, azimuth ); } -QgsCircle QgsCircle::fromCenterPoint( const QgsPointV2 ¢er, const QgsPointV2 &pt1 ) +QgsCircle QgsCircle::fromCenterPoint( const QgsPoint ¢er, const QgsPoint &pt1 ) { double azimuth = QgsGeometryUtils::lineAngle( center.x(), center.y(), pt1.x(), pt1.y() ) * 180.0 / M_PI; return QgsCircle( center, center.distance( pt1 ), azimuth ); } -QgsCircle QgsCircle::from3Tangents( const QgsPointV2 &pt1_tg1, const QgsPointV2 &pt2_tg1, const QgsPointV2 &pt1_tg2, const QgsPointV2 &pt2_tg2, const QgsPointV2 &pt1_tg3, const QgsPointV2 &pt2_tg3, double epsilon ) +QgsCircle QgsCircle::from3Tangents( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon ) { - QgsPointV2 p1, p2, p3; + QgsPoint p1, p2, p3; QgsGeometryUtils::segmentIntersection( pt1_tg1, pt2_tg1, pt1_tg2, pt2_tg2, p1, epsilon ); QgsGeometryUtils::segmentIntersection( pt1_tg1, pt2_tg1, pt1_tg3, pt2_tg3, p2, epsilon ); QgsGeometryUtils::segmentIntersection( pt1_tg2, pt2_tg2, pt1_tg3, pt2_tg3, p3, epsilon ); @@ -189,7 +189,7 @@ QgsCircle QgsCircle::from3Tangents( const QgsPointV2 &pt1_tg1, const QgsPointV2 return QgsTriangle( p1, p2, p3 ).inscribedCircle(); } -QgsCircle QgsCircle::fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +QgsCircle QgsCircle::fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 ) { double delta_x = qAbs( pt1.x() - pt2.x() ); double delta_y = qAbs( pt1.x() - pt2.y() ); @@ -211,13 +211,13 @@ double QgsCircle::perimeter() const return 2.0 * M_PI * mSemiMajorAxis; } -QVector QgsCircle::northQuadrant() const +QVector QgsCircle::northQuadrant() const { - QVector quad; - quad.append( QgsPointV2( mCenter.x(), mCenter.y() + mSemiMajorAxis ) ); - quad.append( QgsPointV2( mCenter.x() + mSemiMajorAxis, mCenter.y() ) ); - quad.append( QgsPointV2( mCenter.x(), mCenter.y() - mSemiMajorAxis ) ); - quad.append( QgsPointV2( mCenter.x() - mSemiMajorAxis, mCenter.y() ) ); + QVector quad; + quad.append( QgsPoint( mCenter.x(), mCenter.y() + mSemiMajorAxis ) ); + quad.append( QgsPoint( mCenter.x() + mSemiMajorAxis, mCenter.y() ) ); + quad.append( QgsPoint( mCenter.x(), mCenter.y() - mSemiMajorAxis ) ); + quad.append( QgsPoint( mCenter.x() - mSemiMajorAxis, mCenter.y() ) ); return quad; } @@ -226,7 +226,7 @@ QgsCircularString *QgsCircle::toCircularString( bool oriented ) const { std::unique_ptr circString( new QgsCircularString() ); QgsPointSequence points; - QVector quad; + QVector quad; if ( oriented ) { quad = quadrant(); @@ -236,7 +236,7 @@ QgsCircularString *QgsCircle::toCircularString( bool oriented ) const quad = northQuadrant(); } quad.append( quad.at( 0 ) ); - for ( QVector::const_iterator it = quad.constBegin(); it != quad.constEnd(); ++it ) + for ( QVector::const_iterator it = quad.constBegin(); it != quad.constEnd(); ++it ) { points.append( *it ); } diff --git a/src/core/geometry/qgscircle.h b/src/core/geometry/qgscircle.h index 244719861df..1f8ec2dadef 100644 --- a/src/core/geometry/qgscircle.h +++ b/src/core/geometry/qgscircle.h @@ -48,7 +48,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param radius The radius of the circle. * \param azimuth Angle in degrees started from the North to the first quadrant. */ - QgsCircle( const QgsPointV2 ¢er, double radius, double azimuth = 0 ); + QgsCircle( const QgsPoint ¢er, double radius, double azimuth = 0 ); /** * Constructs a circle by 2 points on the circle. @@ -58,7 +58,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param pt1 First point. * \param pt2 Second point. */ - static QgsCircle from2Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsCircle from2Points( const QgsPoint &pt1, const QgsPoint &pt2 ); /** * Constructs a circle by 3 points on the circle. @@ -70,7 +70,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param pt3 Third point. * \param epsilon Value used to compare point. */ - static QgsCircle from3Points( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double epsilon = 1E-8 ); + static QgsCircle from3Points( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon = 1E-8 ); /** * Constructs a circle by a center point and a diameter. @@ -79,7 +79,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param diameter Diameter of the circle. * \param azimuth Azimuth of the circle. */ - static QgsCircle fromCenterDiameter( const QgsPointV2 ¢er, double diameter, double azimuth = 0 ); + static QgsCircle fromCenterDiameter( const QgsPoint ¢er, double diameter, double azimuth = 0 ); /** @@ -90,7 +90,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param center Center point. * \param pt1 A point on the circle. */ - static QgsCircle fromCenterPoint( const QgsPointV2 ¢er, const QgsPointV2 &pt1 ); + static QgsCircle fromCenterPoint( const QgsPoint ¢er, const QgsPoint &pt1 ); /** @@ -105,9 +105,9 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param pt2_tg3 Second point of the third tangent. * \param epsilon Value used to compare point. */ - static QgsCircle from3Tangents( const QgsPointV2 &pt1_tg1, const QgsPointV2 &pt2_tg1, - const QgsPointV2 &pt1_tg2, const QgsPointV2 &pt2_tg2, - const QgsPointV2 &pt1_tg3, const QgsPointV2 &pt2_tg3, double epsilon = 1E-8 ); + static QgsCircle from3Tangents( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, + const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, + const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon = 1E-8 ); /** * Constructs a circle by an extent (aka bounding box / QgsRectangle). @@ -117,7 +117,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \param pt1 First corner. * \param pt2 Second corner. */ - static QgsCircle fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsCircle fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 ); double area() const override; double perimeter() const override; @@ -161,7 +161,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse * \return quadrants defined by four points. * \see quadrant() */ - QVector northQuadrant() const SIP_FACTORY; + QVector northQuadrant() const SIP_FACTORY; /** Returns a circular string from the circle. * \param oriented If oriented is true the start point is from azimuth instead from north. diff --git a/src/core/geometry/qgscircularstring.cpp b/src/core/geometry/qgscircularstring.cpp index c8898eca554..1a5a866e3aa 100644 --- a/src/core/geometry/qgscircularstring.cpp +++ b/src/core/geometry/qgscircularstring.cpp @@ -68,11 +68,11 @@ QgsRectangle QgsCircularString::calculateBoundingBox() const { if ( i == 0 ) { - bbox = segmentBoundingBox( QgsPointV2( mX[i], mY[i] ), QgsPointV2( mX[i + 1], mY[i + 1] ), QgsPointV2( mX[i + 2], mY[i + 2] ) ); + bbox = segmentBoundingBox( QgsPoint( mX[i], mY[i] ), QgsPoint( mX[i + 1], mY[i + 1] ), QgsPoint( mX[i + 2], mY[i + 2] ) ); } else { - QgsRectangle segmentBox = segmentBoundingBox( QgsPointV2( mX[i], mY[i] ), QgsPointV2( mX[i + 1], mY[i + 1] ), QgsPointV2( mX[i + 2], mY[i + 2] ) ); + QgsRectangle segmentBox = segmentBoundingBox( QgsPoint( mX[i], mY[i] ), QgsPoint( mX[i + 1], mY[i + 1] ), QgsPoint( mX[i + 2], mY[i + 2] ) ); bbox.combineExtentWith( segmentBox ); } } @@ -88,7 +88,7 @@ QgsRectangle QgsCircularString::calculateBoundingBox() const return bbox; } -QgsRectangle QgsCircularString::segmentBoundingBox( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3 ) +QgsRectangle QgsCircularString::segmentBoundingBox( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3 ) { double centerX, centerY, radius; QgsGeometryUtils::circleCenterRadius( pt1, pt2, pt3, radius, centerX, centerY ); @@ -126,10 +126,10 @@ QgsPointSequence QgsCircularString::compassPointsOnSegment( double p1Angle, doub { QgsPointSequence pointList; - QgsPointV2 nPoint( centerX, centerY + radius ); - QgsPointV2 ePoint( centerX + radius, centerY ); - QgsPointV2 sPoint( centerX, centerY - radius ); - QgsPointV2 wPoint( centerX - radius, centerY ); + QgsPoint nPoint( centerX, centerY + radius ); + QgsPoint ePoint( centerX + radius, centerY ); + QgsPoint sPoint( centerX, centerY - radius ); + QgsPoint wPoint( centerX - radius, centerY ); if ( p3Angle >= p1Angle ) { @@ -329,20 +329,20 @@ double QgsCircularString::length() const return length; } -QgsPointV2 QgsCircularString::startPoint() const +QgsPoint QgsCircularString::startPoint() const { if ( numPoints() < 1 ) { - return QgsPointV2(); + return QgsPoint(); } return pointN( 0 ); } -QgsPointV2 QgsCircularString::endPoint() const +QgsPoint QgsCircularString::endPoint() const { if ( numPoints() < 1 ) { - return QgsPointV2(); + return QgsPoint(); } return pointN( numPoints() - 1 ); } @@ -367,11 +367,11 @@ int QgsCircularString::numPoints() const return qMin( mX.size(), mY.size() ); } -QgsPointV2 QgsCircularString::pointN( int i ) const +QgsPoint QgsCircularString::pointN( int i ) const { if ( qMin( mX.size(), mY.size() ) <= i ) { - return QgsPointV2(); + return QgsPoint(); } double x = mX.at( i ); @@ -401,7 +401,7 @@ QgsPointV2 QgsCircularString::pointN( int i ) const { t = QgsWkbTypes::PointM; } - return QgsPointV2( t, x, y, z, m ); + return QgsPoint( t, x, y, z, m ); } double QgsCircularString::xAt( int index ) const @@ -445,7 +445,7 @@ void QgsCircularString::setPoints( const QgsPointSequence &points ) } //get wkb type from first point - const QgsPointV2 &firstPt = points.at( 0 ); + const QgsPoint &firstPt = points.at( 0 ); bool hasZ = firstPt.is3D(); bool hasM = firstPt.isMeasure(); @@ -553,7 +553,7 @@ void QgsCircularString::addToPainterPath( QPainterPath &path ) const for ( int i = 0; i < ( nPoints - 2 ) ; i += 2 ) { QgsPointSequence pt; - QgsGeometryUtils::segmentizeArc( QgsPointV2( mX[i], mY[i] ), QgsPointV2( mX[i + 1], mY[i + 1] ), QgsPointV2( mX[i + 2], mY[i + 2] ), pt ); + QgsGeometryUtils::segmentizeArc( QgsPoint( mX[i], mY[i] ), QgsPoint( mX[i + 1], mY[i + 1] ), QgsPoint( mX[i + 2], mY[i + 2] ), pt ); for ( int j = 1; j < pt.size(); ++j ) { path.lineTo( pt.at( j ).x(), pt.at( j ).y() ); @@ -571,7 +571,7 @@ void QgsCircularString::addToPainterPath( QPainterPath &path ) const void QgsCircularString::arcTo( QPainterPath &path, QPointF pt1, QPointF pt2, QPointF pt3 ) { double centerX, centerY, radius; - QgsGeometryUtils::circleCenterRadius( QgsPointV2( pt1.x(), pt1.y() ), QgsPointV2( pt2.x(), pt2.y() ), QgsPointV2( pt3.x(), pt3.y() ), + QgsGeometryUtils::circleCenterRadius( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), radius, centerX, centerY ); double p1Angle = QgsGeometryUtils::ccwAngle( pt1.y() - centerY, pt1.x() - centerX ); @@ -586,7 +586,7 @@ void QgsCircularString::drawAsPolygon( QPainter &p ) const draw( p ); } -bool QgsCircularString::insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) +bool QgsCircularString::insertVertex( QgsVertexId position, const QgsPoint &vertex ) { if ( position.vertex > mX.size() || position.vertex < 1 ) { @@ -617,7 +617,7 @@ bool QgsCircularString::insertVertex( QgsVertexId position, const QgsPointV2 &ve return true; } -bool QgsCircularString::moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) +bool QgsCircularString::moveVertex( QgsVertexId position, const QgsPoint &newPos ) { if ( position.vertex < 0 || position.vertex >= mX.size() ) { @@ -682,11 +682,11 @@ void QgsCircularString::deleteVertex( int i ) clearCache(); } -double QgsCircularString::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const +double QgsCircularString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const { Q_UNUSED( epsilon ); double minDist = std::numeric_limits::max(); - QgsPointV2 minDistSegmentPoint; + QgsPoint minDistSegmentPoint; QgsVertexId minDistVertexAfter; bool minDistLeftOf = false; @@ -722,7 +722,7 @@ double QgsCircularString::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segm return minDist; } -bool QgsCircularString::pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const +bool QgsCircularString::pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const { if ( node >= numPoints() ) { @@ -739,9 +739,9 @@ void QgsCircularString::sumUpArea( double &sum ) const for ( int i = 0; i < maxIndex; i += 2 ) { - QgsPointV2 p1( mX[i], mY[i] ); - QgsPointV2 p2( mX[i + 1], mY[i + 1] ); - QgsPointV2 p3( mX[i + 2], mY[i + 2] ); + QgsPoint p1( mX[i], mY[i] ); + QgsPoint p2( mX[i + 1], mY[i + 1] ); + QgsPoint p3( mX[i + 2], mY[i + 2] ); //segment is a full circle, p2 is the center point if ( p1 == p3 ) @@ -760,7 +760,7 @@ void QgsCircularString::sumUpArea( double &sum ) const double radius, centerX, centerY; QgsGeometryUtils::circleCenterRadius( p1, p2, p3, radius, centerX, centerY ); - double d = sqrt( QgsGeometryUtils::sqrDistance2D( QgsPointV2( centerX, centerY ), QgsPointV2( midPointX, midPointY ) ) ); + double d = sqrt( QgsGeometryUtils::sqrDistance2D( QgsPoint( centerX, centerY ), QgsPoint( midPointX, midPointY ) ) ); double r2 = radius * radius; if ( d > radius ) @@ -795,12 +795,12 @@ void QgsCircularString::sumUpArea( double &sum ) const } double QgsCircularString::closestPointOnArc( double x1, double y1, double x2, double y2, double x3, double y3, - const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) + const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) { double radius, centerX, centerY; - QgsPointV2 pt1( x1, y1 ); - QgsPointV2 pt2( x2, y2 ); - QgsPointV2 pt3( x3, y3 ); + QgsPoint pt1( x1, y1 ); + QgsPoint pt2( x2, y2 ); + QgsPoint pt3( x3, y3 ); QgsGeometryUtils::circleCenterRadius( pt1, pt2, pt3, radius, centerX, centerY ); double angle = QgsGeometryUtils::ccwAngle( pt.y() - centerY, pt.x() - centerX ); @@ -813,7 +813,7 @@ double QgsCircularString::closestPointOnArc( double x1, double y1, double x2, do if ( QgsGeometryUtils::angleOnCircle( angle, angle1, angle2, angle3 ) ) { //get point on line center -> pt with distance radius - segmentPt = QgsGeometryUtils::pointOnLineWithDistance( QgsPointV2( centerX, centerY ), pt, radius ); + segmentPt = QgsGeometryUtils::pointOnLineWithDistance( QgsPoint( centerX, centerY ), pt, radius ); //vertexAfter vertexAfter.vertex = QgsGeometryUtils::circleAngleBetween( angle, angle1, angle2, clockwise ) ? 1 : 2; @@ -853,12 +853,12 @@ void QgsCircularString::insertVertexBetween( int after, int before, int pointOnC double yOnCircle = mY.at( pointOnCircle ); double radius, centerX, centerY; - QgsGeometryUtils::circleCenterRadius( QgsPointV2( xAfter, yAfter ), QgsPointV2( xBefore, yBefore ), QgsPointV2( xOnCircle, yOnCircle ), radius, centerX, centerY ); + QgsGeometryUtils::circleCenterRadius( QgsPoint( xAfter, yAfter ), QgsPoint( xBefore, yBefore ), QgsPoint( xOnCircle, yOnCircle ), radius, centerX, centerY ); double x = ( xAfter + xBefore ) / 2.0; double y = ( yAfter + yBefore ) / 2.0; - QgsPointV2 newVertex = QgsGeometryUtils::pointOnLineWithDistance( QgsPointV2( centerX, centerY ), QgsPointV2( x, y ), radius ); + QgsPoint newVertex = QgsGeometryUtils::pointOnLineWithDistance( QgsPoint( centerX, centerY ), QgsPoint( x, y ), radius ); mX.insert( before, newVertex.x() ); mY.insert( before, newVertex.y() ); @@ -883,16 +883,16 @@ double QgsCircularString::vertexAngle( QgsVertexId vId ) const { if ( vId.vertex >= 1 && vId.vertex < numPoints() - 1 ) { - return QgsGeometryUtils::circleTangentDirection( QgsPointV2( mX[vertex], mY[vertex] ), QgsPointV2( mX[before], mY[before] ), - QgsPointV2( mX[vertex], mY[vertex] ), QgsPointV2( mX[after], mY[after] ) ); + return QgsGeometryUtils::circleTangentDirection( QgsPoint( mX[vertex], mY[vertex] ), QgsPoint( mX[before], mY[before] ), + QgsPoint( mX[vertex], mY[vertex] ), QgsPoint( mX[after], mY[after] ) ); } } else //a point vertex { if ( vId.vertex == 0 ) { - return QgsGeometryUtils::circleTangentDirection( QgsPointV2( mX[0], mY[0] ), QgsPointV2( mX[0], mY[0] ), - QgsPointV2( mX[1], mY[1] ), QgsPointV2( mX[2], mY[2] ) ); + return QgsGeometryUtils::circleTangentDirection( QgsPoint( mX[0], mY[0] ), QgsPoint( mX[0], mY[0] ), + QgsPoint( mX[1], mY[1] ), QgsPoint( mX[2], mY[2] ) ); } if ( vId.vertex >= numPoints() - 1 ) { @@ -903,8 +903,8 @@ double QgsCircularString::vertexAngle( QgsVertexId vId ) const int a = numPoints() - 3; int b = numPoints() - 2; int c = numPoints() - 1; - return QgsGeometryUtils::circleTangentDirection( QgsPointV2( mX[c], mY[c] ), QgsPointV2( mX[a], mY[a] ), - QgsPointV2( mX[b], mY[b] ), QgsPointV2( mX[c], mY[c] ) ); + return QgsGeometryUtils::circleTangentDirection( QgsPoint( mX[c], mY[c] ), QgsPoint( mX[a], mY[a] ), + QgsPoint( mX[b], mY[b] ), QgsPoint( mX[c], mY[c] ) ); } else { @@ -916,12 +916,12 @@ double QgsCircularString::vertexAngle( QgsVertexId vId ) const int vertex1 = vId.vertex - 2; int vertex2 = vId.vertex - 1; int vertex3 = vId.vertex; - double angle1 = QgsGeometryUtils::circleTangentDirection( QgsPointV2( mX[vertex3], mY[vertex3] ), - QgsPointV2( mX[vertex1], mY[vertex1] ), QgsPointV2( mX[vertex2], mY[vertex2] ), QgsPointV2( mX[vertex3], mY[vertex3] ) ); + double angle1 = QgsGeometryUtils::circleTangentDirection( QgsPoint( mX[vertex3], mY[vertex3] ), + QgsPoint( mX[vertex1], mY[vertex1] ), QgsPoint( mX[vertex2], mY[vertex2] ), QgsPoint( mX[vertex3], mY[vertex3] ) ); int vertex4 = vId.vertex + 1; int vertex5 = vId.vertex + 2; - double angle2 = QgsGeometryUtils::circleTangentDirection( QgsPointV2( mX[vertex3], mY[vertex3] ), - QgsPointV2( mX[vertex3], mY[vertex3] ), QgsPointV2( mX[vertex4], mY[vertex4] ), QgsPointV2( mX[vertex5], mY[vertex5] ) ); + double angle2 = QgsGeometryUtils::circleTangentDirection( QgsPoint( mX[vertex3], mY[vertex3] ), + QgsPoint( mX[vertex3], mY[vertex3] ), QgsPoint( mX[vertex4], mY[vertex4] ), QgsPoint( mX[vertex5], mY[vertex5] ) ); return QgsGeometryUtils::averageAngle( angle1, angle2 ); } } diff --git a/src/core/geometry/qgscircularstring.h b/src/core/geometry/qgscircularstring.h index 6e482f13388..8ee72c0f0f7 100644 --- a/src/core/geometry/qgscircularstring.h +++ b/src/core/geometry/qgscircularstring.h @@ -57,7 +57,7 @@ class CORE_EXPORT QgsCircularString: public QgsCurve /** Returns the point at index i within the circular string. */ - QgsPointV2 pointN( int i ) const; + QgsPoint pointN( int i ) const; void points( QgsPointSequence &pts SIP_OUT ) const override; @@ -66,8 +66,8 @@ class CORE_EXPORT QgsCircularString: public QgsCurve void setPoints( const QgsPointSequence &points ); virtual double length() const override; - virtual QgsPointV2 startPoint() const override; - virtual QgsPointV2 endPoint() const override; + virtual QgsPoint startPoint() const override; + virtual QgsPoint endPoint() const override; /** Returns a new line string geometry corresponding to a segmentized approximation * of the curve. @@ -83,15 +83,15 @@ class CORE_EXPORT QgsCircularString: public QgsCurve void drawAsPolygon( QPainter &p ) const override; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override; - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) override; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override; virtual bool deleteVertex( QgsVertexId position ) override; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override; - bool pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const override; + bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override; void sumUpArea( double &sum SIP_OUT ) const override; bool hasCurvedSegments() const override { return true; } @@ -123,10 +123,10 @@ class CORE_EXPORT QgsCircularString: public QgsCurve static void arcTo( QPainterPath &path, QPointF pt1, QPointF pt2, QPointF pt3 ); //bounding box of a single segment - static QgsRectangle segmentBoundingBox( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3 ); + static QgsRectangle segmentBoundingBox( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3 ); static QgsPointSequence compassPointsOnSegment( double p1Angle, double p2Angle, double p3Angle, double centerX, double centerY, double radius ); static double closestPointOnArc( double x1, double y1, double x2, double y2, double x3, double y3, - const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ); + const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ); void insertVertexBetween( int after, int before, int pointOnCircle ); void deleteVertex( int i ); diff --git a/src/core/geometry/qgscompoundcurve.cpp b/src/core/geometry/qgscompoundcurve.cpp index 36d5dfa381b..e46906ab9ff 100644 --- a/src/core/geometry/qgscompoundcurve.cpp +++ b/src/core/geometry/qgscompoundcurve.cpp @@ -280,20 +280,20 @@ double QgsCompoundCurve::length() const return length; } -QgsPointV2 QgsCompoundCurve::startPoint() const +QgsPoint QgsCompoundCurve::startPoint() const { if ( mCurves.size() < 1 ) { - return QgsPointV2(); + return QgsPoint(); } return mCurves.at( 0 )->startPoint(); } -QgsPointV2 QgsCompoundCurve::endPoint() const +QgsPoint QgsCompoundCurve::endPoint() const { if ( mCurves.size() < 1 ) { - return QgsPointV2(); + return QgsPoint(); } return mCurves.at( mCurves.size() - 1 )->endPoint(); } @@ -404,7 +404,7 @@ void QgsCompoundCurve::removeCurve( int i ) clearCache(); } -void QgsCompoundCurve::addVertex( const QgsPointV2 &pt ) +void QgsCompoundCurve::addVertex( const QgsPoint &pt ) { if ( mWkbType == QgsWkbTypes::Unknown ) { @@ -486,7 +486,7 @@ void QgsCompoundCurve::drawAsPolygon( QPainter &p ) const p.drawPath( pp ); } -bool QgsCompoundCurve::insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) +bool QgsCompoundCurve::insertVertex( QgsVertexId position, const QgsPoint &vertex ) { QList< QPair > curveIds = curveVertexId( position ); if ( curveIds.size() < 1 ) @@ -507,7 +507,7 @@ bool QgsCompoundCurve::insertVertex( QgsVertexId position, const QgsPointV2 &ver return success; } -bool QgsCompoundCurve::moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) +bool QgsCompoundCurve::moveVertex( QgsVertexId position, const QgsPoint &newPos ) { QList< QPair > curveIds = curveVertexId( position ); QList< QPair >::const_iterator idIt = curveIds.constBegin(); @@ -544,13 +544,13 @@ bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) Q_ASSERT( curveIds.at( 1 ).first == curveIds.at( 0 ).first + 1 ); Q_ASSERT( curveIds.at( 0 ).second.vertex == mCurves.at( curveIds.at( 0 ).first )->numPoints() - 1 ); Q_ASSERT( curveIds.at( 1 ).second.vertex == 0 ); - QgsPointV2 startPoint = mCurves.at( curveIds.at( 0 ).first ) ->startPoint(); - QgsPointV2 endPoint = mCurves.at( curveIds.at( 1 ).first ) ->endPoint(); + QgsPoint startPoint = mCurves.at( curveIds.at( 0 ).first ) ->startPoint(); + QgsPoint endPoint = mCurves.at( curveIds.at( 1 ).first ) ->endPoint(); if ( QgsWkbTypes::flatType( mCurves.at( curveIds.at( 0 ).first )->wkbType() ) == QgsWkbTypes::LineString && QgsWkbTypes::flatType( mCurves.at( curveIds.at( 1 ).first )->wkbType() ) == QgsWkbTypes::CircularString && mCurves.at( curveIds.at( 1 ).first )->numPoints() > 3 ) { - QgsPointV2 intermediatePoint; + QgsPoint intermediatePoint; QgsVertexId::VertexType type; mCurves.at( curveIds.at( 1 ).first ) ->pointAt( 2, intermediatePoint, type ); mCurves.at( curveIds.at( 0 ).first )->moveVertex( @@ -565,7 +565,7 @@ bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) mCurves.at( curveIds.at( 0 ).first )->numPoints() > 0 && QgsWkbTypes::flatType( mCurves.at( curveIds.at( 1 ).first )->wkbType() ) == QgsWkbTypes::LineString ) { - QgsPointV2 intermediatePoint = mCurves.at( curveIds.at( 0 ).first ) ->endPoint(); + QgsPoint intermediatePoint = mCurves.at( curveIds.at( 0 ).first ) ->endPoint(); mCurves.at( curveIds.at( 1 ).first )->moveVertex( QgsVertexId( 0, 0, 0 ), intermediatePoint ); } else if ( !mCurves.at( curveIds.at( 1 ).first )->deleteVertex( curveIds.at( 1 ).second ) ) @@ -598,8 +598,8 @@ bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) } else { - QgsPointV2 endPointOfFirst = mCurves.at( curveIds.at( 0 ).first ) ->endPoint(); - QgsPointV2 startPointOfSecond = mCurves.at( curveIds.at( 1 ).first ) ->startPoint(); + QgsPoint endPointOfFirst = mCurves.at( curveIds.at( 0 ).first ) ->endPoint(); + QgsPoint startPointOfSecond = mCurves.at( curveIds.at( 1 ).first ) ->startPoint(); if ( endPointOfFirst != startPointOfSecond ) { QgsLineString *line = new QgsLineString(); @@ -647,12 +647,12 @@ QList< QPair > QgsCompoundCurve::curveVertexId( QgsVertexId id return curveIds; } -double QgsCompoundCurve::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const +double QgsCompoundCurve::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const { return QgsGeometryUtils::closestSegmentFromComponents( mCurves, QgsGeometryUtils::Vertex, pt, segmentPt, vertexAfter, leftOf, epsilon ); } -bool QgsCompoundCurve::pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const +bool QgsCompoundCurve::pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const { int currentVertexId = 0; for ( int j = 0; j < mCurves.size(); ++j ) diff --git a/src/core/geometry/qgscompoundcurve.h b/src/core/geometry/qgscompoundcurve.h index cdea432e5e8..9133bed64f7 100644 --- a/src/core/geometry/qgscompoundcurve.h +++ b/src/core/geometry/qgscompoundcurve.h @@ -54,8 +54,8 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve //curve interface virtual double length() const override; - virtual QgsPointV2 startPoint() const override; - virtual QgsPointV2 endPoint() const override; + virtual QgsPoint startPoint() const override; + virtual QgsPoint endPoint() const override; virtual void points( QgsPointSequence &pts SIP_OUT ) const override; virtual int numPoints() const override; bool isEmpty() const override; @@ -85,7 +85,7 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve /** Adds a vertex to the end of the geometry. */ - void addVertex( const QgsPointV2 &pt ); + void addVertex( const QgsPoint &pt ); void draw( QPainter &p ) const override; void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform, @@ -94,15 +94,15 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve void addToPainterPath( QPainterPath &path ) const override; void drawAsPolygon( QPainter &p ) const override; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override; - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) override; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override; virtual bool deleteVertex( QgsVertexId position ) override; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override; - bool pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const override; + bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override; void sumUpArea( double &sum SIP_OUT ) const override; diff --git a/src/core/geometry/qgscurve.cpp b/src/core/geometry/qgscurve.cpp index 53c2d517189..d436311cffc 100644 --- a/src/core/geometry/qgscurve.cpp +++ b/src/core/geometry/qgscurve.cpp @@ -29,8 +29,8 @@ bool QgsCurve::isClosed() const return false; //don't consider M-coordinates when testing closedness - QgsPointV2 start = startPoint(); - QgsPointV2 end = endPoint(); + QgsPoint start = startPoint(); + QgsPoint end = endPoint(); return ( qgsDoubleNear( start.x(), end.x(), 1E-8 ) && qgsDoubleNear( start.y(), end.y(), 1E-8 ) && qgsDoubleNear( start.z(), end.z(), 1E-8 ) ); @@ -53,7 +53,7 @@ QgsCoordinateSequence QgsCurve::coordinateSequence() const return mCoordinateSequence; } -bool QgsCurve::nextVertex( QgsVertexId &id, QgsPointV2 &vertex ) const +bool QgsCurve::nextVertex( QgsVertexId &id, QgsPoint &vertex ) const { if ( id.vertex < 0 ) { @@ -87,8 +87,8 @@ QgsAbstractGeometry *QgsCurve::boundary() const return nullptr; QgsMultiPointV2 *multiPoint = new QgsMultiPointV2(); - multiPoint->addGeometry( new QgsPointV2( startPoint() ) ); - multiPoint->addGeometry( new QgsPointV2( endPoint() ) ); + multiPoint->addGeometry( new QgsPoint( startPoint() ) ); + multiPoint->addGeometry( new QgsPoint( endPoint() ) ); return multiPoint; } @@ -115,9 +115,9 @@ int QgsCurve::partCount() const return numPoints() > 0 ? 1 : 0; } -QgsPointV2 QgsCurve::vertexAt( QgsVertexId id ) const +QgsPoint QgsCurve::vertexAt( QgsVertexId id ) const { - QgsPointV2 v; + QgsPoint v; QgsVertexId::VertexType type; pointAt( id.vertex, v, type ); return v; diff --git a/src/core/geometry/qgscurve.h b/src/core/geometry/qgscurve.h index 4337e493269..796f657183c 100644 --- a/src/core/geometry/qgscurve.h +++ b/src/core/geometry/qgscurve.h @@ -44,12 +44,12 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry /** Returns the starting point of the curve. * \see endPoint */ - virtual QgsPointV2 startPoint() const = 0; + virtual QgsPoint startPoint() const = 0; /** Returns the end point of the curve. * \see startPoint */ - virtual QgsPointV2 endPoint() const = 0; + virtual QgsPoint endPoint() const = 0; /** Returns true if the curve is closed. */ @@ -87,7 +87,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry virtual void sumUpArea( double &sum SIP_OUT ) const = 0; virtual QgsCoordinateSequence coordinateSequence() const override; - virtual bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex SIP_OUT ) const override; + virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override; /** Returns the point and vertex id of a point within the curve. * \param node node number, where the first node is 0 @@ -95,7 +95,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry * \param type will be set to the vertex type of the node * \returns true if node exists within the curve */ - virtual bool pointAt( int node, QgsPointV2 &point SIP_OUT, QgsVertexId::VertexType &type SIP_OUT ) const = 0; + virtual bool pointAt( int node, QgsPoint &point SIP_OUT, QgsVertexId::VertexType &type SIP_OUT ) const = 0; /** Returns a reversed copy of the curve, where the direction of the curve has been flipped. * \since QGIS 2.14 @@ -112,7 +112,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry virtual int vertexCount( int part = 0, int ring = 0 ) const override; virtual int ringCount( int part = 0 ) const override; virtual int partCount() const override; - virtual QgsPointV2 vertexAt( QgsVertexId id ) const override; + virtual QgsPoint vertexAt( QgsVertexId id ) const override; virtual QgsRectangle boundingBox() const override; diff --git a/src/core/geometry/qgscurvepolygon.cpp b/src/core/geometry/qgscurvepolygon.cpp index 5f04c24c04c..5b34ac8a9ee 100644 --- a/src/core/geometry/qgscurvepolygon.cpp +++ b/src/core/geometry/qgscurvepolygon.cpp @@ -675,7 +675,7 @@ bool QgsCurvePolygon::isEmpty() const return mExteriorRing->isEmpty(); } -double QgsCurvePolygon::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const +double QgsCurvePolygon::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const { if ( !mExteriorRing ) { @@ -687,7 +687,7 @@ double QgsCurvePolygon::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmen return QgsGeometryUtils::closestSegmentFromComponents( segmentList, QgsGeometryUtils::Ring, pt, segmentPt, vertexAfter, leftOf, epsilon ); } -bool QgsCurvePolygon::nextVertex( QgsVertexId &vId, QgsPointV2 &vertex ) const +bool QgsCurvePolygon::nextVertex( QgsVertexId &vId, QgsPoint &vertex ) const { if ( !mExteriorRing || vId.ring >= 1 + mInteriorRings.size() ) { @@ -723,7 +723,7 @@ bool QgsCurvePolygon::nextVertex( QgsVertexId &vId, QgsPointV2 &vertex ) const } } -bool QgsCurvePolygon::insertVertex( QgsVertexId vId, const QgsPointV2 &vertex ) +bool QgsCurvePolygon::insertVertex( QgsVertexId vId, const QgsPoint &vertex ) { if ( !mExteriorRing || vId.ring < 0 || vId.ring >= 1 + mInteriorRings.size() ) { @@ -749,7 +749,7 @@ bool QgsCurvePolygon::insertVertex( QgsVertexId vId, const QgsPointV2 &vertex ) return true; } -bool QgsCurvePolygon::moveVertex( QgsVertexId vId, const QgsPointV2 &newPos ) +bool QgsCurvePolygon::moveVertex( QgsVertexId vId, const QgsPoint &newPos ) { if ( !mExteriorRing || vId.ring < 0 || vId.ring >= 1 + mInteriorRings.size() ) { @@ -855,7 +855,7 @@ int QgsCurvePolygon::vertexCount( int /*part*/, int ring ) const return ring == 0 ? mExteriorRing->vertexCount() : mInteriorRings[ring - 1]->vertexCount(); } -QgsPointV2 QgsCurvePolygon::vertexAt( QgsVertexId id ) const +QgsPoint QgsCurvePolygon::vertexAt( QgsVertexId id ) const { return id.ring == 0 ? mExteriorRing->vertexAt( id ) : mInteriorRings[id.ring - 1]->vertexAt( id ); } diff --git a/src/core/geometry/qgscurvepolygon.h b/src/core/geometry/qgscurvepolygon.h index 55af3c14254..36d184e94a3 100644 --- a/src/core/geometry/qgscurvepolygon.h +++ b/src/core/geometry/qgscurvepolygon.h @@ -104,18 +104,18 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface bool transformZ = false ) override; void transform( const QTransform &t ) override; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override; - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) override; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override; virtual bool deleteVertex( QgsVertexId position ) override; virtual QgsCoordinateSequence coordinateSequence() const override; virtual int nCoordinates() const override; bool isEmpty() const override; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override; - bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex SIP_OUT ) const override; + bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override; bool hasCurvedSegments() const override; @@ -133,7 +133,7 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const override; virtual int ringCount( int /*part*/ = 0 ) const override { return ( nullptr != mExteriorRing ) + mInteriorRings.size(); } virtual int partCount() const override { return ringCount() > 0 ? 1 : 0; } - virtual QgsPointV2 vertexAt( QgsVertexId id ) const override; + virtual QgsPoint vertexAt( QgsVertexId id ) const override; virtual bool addZValue( double zValue = 0 ) override; virtual bool addMValue( double mValue = 0 ) override; diff --git a/src/core/geometry/qgsellipse.cpp b/src/core/geometry/qgsellipse.cpp index a499242749a..5f1fcc30b4c 100644 --- a/src/core/geometry/qgsellipse.cpp +++ b/src/core/geometry/qgsellipse.cpp @@ -36,7 +36,7 @@ void QgsEllipse::normalizeAxis() } QgsEllipse::QgsEllipse() - : mCenter( QgsPointV2() ) + : mCenter( QgsPoint() ) , mSemiMajorAxis( 0.0 ) , mSemiMinorAxis( 0.0 ) , mAzimuth( 90.0 ) @@ -44,7 +44,7 @@ QgsEllipse::QgsEllipse() } -QgsEllipse::QgsEllipse( const QgsPointV2 ¢er, const double axis_a, const double axis_b, const double azimuth ) +QgsEllipse::QgsEllipse( const QgsPoint ¢er, const double axis_a, const double axis_b, const double azimuth ) : mCenter( center ) , mSemiMajorAxis( axis_a ) , mSemiMinorAxis( axis_b ) @@ -53,7 +53,7 @@ QgsEllipse::QgsEllipse( const QgsPointV2 ¢er, const double axis_a, const dou normalizeAxis(); } -QgsEllipse QgsEllipse::fromFoci( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3 ) +QgsEllipse QgsEllipse::fromFoci( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3 ) { double dist_p1p2 = pt1.distance( pt2 ); double dist_p1p3 = pt1.distance( pt3 ); @@ -61,7 +61,7 @@ QgsEllipse QgsEllipse::fromFoci( const QgsPointV2 &pt1, const QgsPointV2 &pt2, c double dist = dist_p1p3 + dist_p2p3; double azimuth = 180.0 / M_PI * QgsGeometryUtils::lineAngle( pt1.x(), pt1.y(), pt2.x(), pt2.y() ); - QgsPointV2 center = QgsGeometryUtils::midpoint( pt1, pt2 ); + QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 ); double axis_a = dist / 2.0; double axis_b = sqrt( pow( axis_a, 2.0 ) - pow( dist_p1p2 / 2.0, 2.0 ) ); @@ -69,9 +69,9 @@ QgsEllipse QgsEllipse::fromFoci( const QgsPointV2 &pt1, const QgsPointV2 &pt2, c return QgsEllipse( center, axis_a, axis_b, azimuth ); } -QgsEllipse QgsEllipse::fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +QgsEllipse QgsEllipse::fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 ) { - QgsPointV2 center = QgsGeometryUtils::midpoint( pt1, pt2 ); + QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 ); double axis_a = qAbs( pt2.x() - pt1.x() ) / 2.0; double axis_b = qAbs( pt2.y() - pt1.y() ) / 2.0; double azimuth = 90.0; @@ -79,7 +79,7 @@ QgsEllipse QgsEllipse::fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 return QgsEllipse( center, axis_a, axis_b, azimuth ); } -QgsEllipse QgsEllipse::fromCenterPoint( const QgsPointV2 ¢er, const QgsPointV2 &pt1 ) +QgsEllipse QgsEllipse::fromCenterPoint( const QgsPoint ¢er, const QgsPoint &pt1 ) { double axis_a = qAbs( pt1.x() - center.x() ); double axis_b = qAbs( pt1.y() - center.y() ); @@ -88,13 +88,13 @@ QgsEllipse QgsEllipse::fromCenterPoint( const QgsPointV2 ¢er, const QgsPoint return QgsEllipse( center, axis_a, axis_b, azimuth ); } -QgsEllipse QgsEllipse::fromCenter2Points( const QgsPointV2 ¢er, const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +QgsEllipse QgsEllipse::fromCenter2Points( const QgsPoint ¢er, const QgsPoint &pt1, const QgsPoint &pt2 ) { double azimuth = 180.0 / M_PI * QgsGeometryUtils::lineAngle( center.x(), center.y(), pt1.x(), pt1.y() ); double axis_a = center.distance( pt1 ); double length = pt2.distance( QgsGeometryUtils::projPointOnSegment( pt2, center, pt1 ) ); - QgsPointV2 pp = center.project( length, 90 + azimuth ); + QgsPoint pp = center.project( length, 90 + azimuth ); double axis_b = center.distance( pp ); return QgsEllipse( center, axis_a, axis_b, azimuth ); @@ -142,9 +142,9 @@ double QgsEllipse::focusDistance() const return sqrt( mSemiMajorAxis * mSemiMajorAxis - mSemiMinorAxis * mSemiMinorAxis ); } -QVector QgsEllipse::foci() const +QVector QgsEllipse::foci() const { - QVector f; + QVector f; double dist_focus = focusDistance(); f.append( mCenter.project( dist_focus, mAzimuth ) ); f.append( mCenter.project( -dist_focus, mAzimuth ) ); @@ -173,9 +173,9 @@ double QgsEllipse::perimeter() const return M_PI * ( 3 * ( a + b ) - sqrt( 10 * a * b + 3 * ( a * a + b * b ) ) ); } -QVector QgsEllipse::quadrant() const +QVector QgsEllipse::quadrant() const { - QVector quad; + QVector quad; quad.append( mCenter.project( mSemiMajorAxis, mAzimuth ) ); quad.append( mCenter.project( mSemiMinorAxis, mAzimuth + 90 ) ); quad.append( mCenter.project( -mSemiMajorAxis, mAzimuth ) ); @@ -213,7 +213,7 @@ QgsPointSequence QgsEllipse::points( unsigned int segments ) const double y = mCenter.y() + mSemiMajorAxis * cos( *it ) * sin( azimuth ) + mSemiMinorAxis * sin( *it ) * cos( azimuth ); - pts.push_back( QgsPointV2( pType, x, y, z, m ) ); + pts.push_back( QgsPoint( pType, x, y, z, m ) ); } return pts; @@ -265,8 +265,8 @@ QgsRectangle QgsEllipse::boundingBox() const double halfHeight = sqrt( ux * ux + uy * uy ); double halfWidth = sqrt( vx * vx + vy * vy ); - QgsPoint p1( mCenter.x() - halfWidth, mCenter.y() - halfHeight ); - QgsPoint p2( mCenter.x() + halfWidth, mCenter.y() + halfHeight ); + QgsPointXY p1( mCenter.x() - halfWidth, mCenter.y() - halfHeight ); + QgsPointXY p2( mCenter.x() + halfWidth, mCenter.y() + halfHeight ); return QgsRectangle( p1, p2 ); } @@ -294,12 +294,12 @@ QgsPolygonV2 *QgsEllipse::orientedBoundingBox() const return ombb.release(); } - QVector q = quadrant(); + QVector q = quadrant(); - QgsPointV2 p1 = q.at( 0 ).project( mSemiMinorAxis, mAzimuth - 90 ); - QgsPointV2 p2 = q.at( 0 ).project( mSemiMinorAxis, mAzimuth + 90 ); - QgsPointV2 p3 = q.at( 2 ).project( mSemiMinorAxis, mAzimuth + 90 ); - QgsPointV2 p4 = q.at( 2 ).project( mSemiMinorAxis, mAzimuth - 90 ); + QgsPoint p1 = q.at( 0 ).project( mSemiMinorAxis, mAzimuth - 90 ); + QgsPoint p2 = q.at( 0 ).project( mSemiMinorAxis, mAzimuth + 90 ); + QgsPoint p3 = q.at( 2 ).project( mSemiMinorAxis, mAzimuth + 90 ); + QgsPoint p4 = q.at( 2 ).project( mSemiMinorAxis, mAzimuth - 90 ); QgsLineString *ext = new QgsLineString(); ext->setPoints( QgsPointSequence() << p1 << p2 << p3 << p4 ); diff --git a/src/core/geometry/qgsellipse.h b/src/core/geometry/qgsellipse.h index 315dcae8728..c80d5d11750 100644 --- a/src/core/geometry/qgsellipse.h +++ b/src/core/geometry/qgsellipse.h @@ -47,7 +47,7 @@ class CORE_EXPORT QgsEllipse * \param semiMinorAxis Semi-minor axis of the ellipse. * \param azimuth Angle in degrees started from the North to the first quadrant. */ - QgsEllipse( const QgsPointV2 ¢er, const double semiMajorAxis, const double semiMinorAxis, const double azimuth = 90 ); + QgsEllipse( const QgsPoint ¢er, const double semiMajorAxis, const double semiMinorAxis, const double azimuth = 90 ); /** * Constructs an ellipse by foci (\a pt1 and \a pt2) and a point \a pt3. @@ -58,7 +58,7 @@ class CORE_EXPORT QgsEllipse * \param pt2 Second focus. * \param pt3 A point to calculate the axes. */ - static QgsEllipse fromFoci( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3 ); + static QgsEllipse fromFoci( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3 ); /** * Constructs an ellipse by an extent (aka bounding box / QgsRectangle). @@ -68,7 +68,7 @@ class CORE_EXPORT QgsEllipse * \param pt1 First corner. * \param pt2 Second corner. */ - static QgsEllipse fromExtent( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsEllipse fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 ); /** * Constructs an ellipse by a center point and a another point. @@ -78,7 +78,7 @@ class CORE_EXPORT QgsEllipse * \param ptc Center point. * \param pt1 First point. */ - static QgsEllipse fromCenterPoint( const QgsPointV2 &ptc, const QgsPointV2 &pt1 ); + static QgsEllipse fromCenterPoint( const QgsPoint &ptc, const QgsPoint &pt1 ); /** * Constructs an ellipse by a central point and two other points. @@ -89,7 +89,7 @@ class CORE_EXPORT QgsEllipse * \param pt1 First point. * \param pt2 Second point. */ - static QgsEllipse fromCenter2Points( const QgsPointV2 &ptc, const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsEllipse fromCenter2Points( const QgsPoint &ptc, const QgsPoint &pt1, const QgsPoint &pt2 ); virtual bool operator ==( const QgsEllipse &elp ) const; virtual bool operator !=( const QgsEllipse &elp ) const; @@ -101,7 +101,7 @@ class CORE_EXPORT QgsEllipse * \see setCenter() * \see rcenter() */ - QgsPointV2 center() const {return mCenter; } + QgsPoint center() const {return mCenter; } /** Returns the semi-major axis. * \see setSemiMajorAxis() @@ -124,13 +124,13 @@ class CORE_EXPORT QgsEllipse * \see setCenter() * \note not available in Python bindings */ - QgsPointV2 &rcenter() SIP_SKIP { return mCenter; } + QgsPoint &rcenter() SIP_SKIP { return mCenter; } /** Sets the center point. * \see center() * \see rcenter() */ - void setCenter( const QgsPointV2 ¢er ) {mCenter = center; } + void setCenter( const QgsPoint ¢er ) {mCenter = center; } /** Sets the semi-major axis. * \see semiMajorAxis() @@ -159,7 +159,7 @@ class CORE_EXPORT QgsEllipse * \see focusDistance() * \return the two foci. */ - virtual QVector foci() const; + virtual QVector foci() const; /** The eccentricity of the ellipse. * nan is returned if the ellipse is empty. @@ -174,7 +174,7 @@ class CORE_EXPORT QgsEllipse * They are oriented and started always from semi-major axis. * \return quadrants defined by four points. */ - virtual QVector quadrant() const; + virtual QVector quadrant() const; /** Returns a list of points with segmentation from \a segments. * \param segments Number of segments used to segment geometry. @@ -207,7 +207,7 @@ class CORE_EXPORT QgsEllipse virtual QString toString( int pointPrecision = 17, int axisPrecision = 17, int azimuthPrecision = 2 ) const; protected: - QgsPointV2 mCenter; + QgsPoint mCenter; double mSemiMajorAxis; double mSemiMinorAxis; double mAzimuth; diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index acf41d1cbe8..14fdbc69980 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -141,7 +141,7 @@ QgsGeometry QgsGeometry::fromWkt( const QString &wkt ) return QgsGeometry( geom ); } -QgsGeometry QgsGeometry::fromPoint( const QgsPoint &point ) +QgsGeometry QgsGeometry::fromPoint( const QgsPointXY &point ) { QgsAbstractGeometry *geom = QgsGeometryFactory::fromPoint( point ); if ( geom ) @@ -204,11 +204,11 @@ QgsGeometry QgsGeometry::fromMultiPolygon( const QgsMultiPolygon &multipoly ) QgsGeometry QgsGeometry::fromRect( const QgsRectangle &rect ) { QgsPolyline ring; - ring.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); - ring.append( QgsPoint( rect.xMaximum(), rect.yMinimum() ) ); - ring.append( QgsPoint( rect.xMaximum(), rect.yMaximum() ) ); - ring.append( QgsPoint( rect.xMinimum(), rect.yMaximum() ) ); - ring.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); + ring.append( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); + ring.append( QgsPointXY( rect.xMaximum(), rect.yMinimum() ) ); + ring.append( QgsPointXY( rect.xMaximum(), rect.yMaximum() ) ); + ring.append( QgsPointXY( rect.xMinimum(), rect.yMaximum() ) ); + ring.append( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); QgsPolygon polygon; polygon.append( ring ); @@ -321,28 +321,28 @@ void QgsGeometry::fromGeos( GEOSGeometry *geos ) GEOSGeom_destroy_r( QgsGeos::getGEOSHandler(), geos ); } -QgsPoint QgsGeometry::closestVertex( const QgsPoint &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist ) const +QgsPointXY QgsGeometry::closestVertex( const QgsPointXY &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist ) const { if ( !d->geometry ) { sqrDist = -1; - return QgsPoint( 0, 0 ); + return QgsPointXY( 0, 0 ); } - QgsPointV2 pt( point.x(), point.y() ); + QgsPoint pt( point.x(), point.y() ); QgsVertexId id; - QgsPointV2 vp = QgsGeometryUtils::closestVertex( *( d->geometry ), pt, id ); + QgsPoint vp = QgsGeometryUtils::closestVertex( *( d->geometry ), pt, id ); if ( !id.isValid() ) { sqrDist = -1; - return QgsPoint( 0, 0 ); + return QgsPointXY( 0, 0 ); } sqrDist = QgsGeometryUtils::sqrDistance2D( pt, vp ); atVertex = vertexNrFromVertexId( id ); adjacentVertices( atVertex, beforeVertex, afterVertex ); - return QgsPoint( vp.x(), vp.y() ); + return QgsPointXY( vp.x(), vp.y() ); } double QgsGeometry::distanceToVertex( int vertex ) const @@ -379,23 +379,23 @@ double QgsGeometry::angleAtVertex( int vertex ) const QgsGeometryUtils::adjacentVertices( *d->geometry, v2, v1, v3 ); if ( v1.isValid() && v3.isValid() ) { - QgsPointV2 p1 = d->geometry->vertexAt( v1 ); - QgsPointV2 p2 = d->geometry->vertexAt( v2 ); - QgsPointV2 p3 = d->geometry->vertexAt( v3 ); + QgsPoint p1 = d->geometry->vertexAt( v1 ); + QgsPoint p2 = d->geometry->vertexAt( v2 ); + QgsPoint p3 = d->geometry->vertexAt( v3 ); double angle1 = QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); double angle2 = QgsGeometryUtils::lineAngle( p2.x(), p2.y(), p3.x(), p3.y() ); return QgsGeometryUtils::averageAngle( angle1, angle2 ); } else if ( v3.isValid() ) { - QgsPointV2 p1 = d->geometry->vertexAt( v2 ); - QgsPointV2 p2 = d->geometry->vertexAt( v3 ); + QgsPoint p1 = d->geometry->vertexAt( v2 ); + QgsPoint p2 = d->geometry->vertexAt( v3 ); return QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); } else if ( v1.isValid() ) { - QgsPointV2 p1 = d->geometry->vertexAt( v1 ); - QgsPointV2 p2 = d->geometry->vertexAt( v2 ); + QgsPoint p1 = d->geometry->vertexAt( v1 ); + QgsPoint p2 = d->geometry->vertexAt( v2 ); return QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); } return 0.0; @@ -437,10 +437,10 @@ bool QgsGeometry::moveVertex( double x, double y, int atVertex ) detach( true ); - return d->geometry->moveVertex( id, QgsPointV2( x, y ) ); + return d->geometry->moveVertex( id, QgsPoint( x, y ) ); } -bool QgsGeometry::moveVertex( const QgsPointV2 &p, int atVertex ) +bool QgsGeometry::moveVertex( const QgsPoint &p, int atVertex ) { if ( !d->geometry ) { @@ -505,7 +505,7 @@ bool QgsGeometry::insertVertex( double x, double y, int beforeVertex ) { detach( true ); //insert geometry instead of point - return static_cast< QgsGeometryCollection * >( d->geometry )->insertGeometry( new QgsPointV2( x, y ), beforeVertex ); + return static_cast< QgsGeometryCollection * >( d->geometry )->insertGeometry( new QgsPoint( x, y ), beforeVertex ); } QgsVertexId id; @@ -516,10 +516,10 @@ bool QgsGeometry::insertVertex( double x, double y, int beforeVertex ) detach( true ); - return d->geometry->insertVertex( id, QgsPointV2( x, y ) ); + return d->geometry->insertVertex( id, QgsPoint( x, y ) ); } -bool QgsGeometry::insertVertex( const QgsPointV2 &point, int beforeVertex ) +bool QgsGeometry::insertVertex( const QgsPoint &point, int beforeVertex ) { if ( !d->geometry ) { @@ -531,7 +531,7 @@ bool QgsGeometry::insertVertex( const QgsPointV2 &point, int beforeVertex ) { detach( true ); //insert geometry instead of point - return static_cast< QgsGeometryCollection * >( d->geometry )->insertGeometry( new QgsPointV2( point ), beforeVertex ); + return static_cast< QgsGeometryCollection * >( d->geometry )->insertGeometry( new QgsPoint( point ), beforeVertex ); } QgsVertexId id; @@ -545,27 +545,27 @@ bool QgsGeometry::insertVertex( const QgsPointV2 &point, int beforeVertex ) return d->geometry->insertVertex( id, point ); } -QgsPoint QgsGeometry::vertexAt( int atVertex ) const +QgsPointXY QgsGeometry::vertexAt( int atVertex ) const { if ( !d->geometry ) { - return QgsPoint( 0, 0 ); + return QgsPointXY( 0, 0 ); } QgsVertexId vId; ( void )vertexIdFromVertexNr( atVertex, vId ); if ( vId.vertex < 0 ) { - return QgsPoint( 0, 0 ); + return QgsPointXY( 0, 0 ); } - QgsPointV2 pt = d->geometry->vertexAt( vId ); - return QgsPoint( pt.x(), pt.y() ); + QgsPoint pt = d->geometry->vertexAt( vId ); + return QgsPointXY( pt.x(), pt.y() ); } -double QgsGeometry::sqrDistToVertexAt( QgsPoint &point, int atVertex ) const +double QgsGeometry::sqrDistToVertexAt( QgsPointXY &point, int atVertex ) const { - QgsPoint vertexPoint = vertexAt( atVertex ); - return QgsGeometryUtils::sqrDistance2D( QgsPointV2( vertexPoint.x(), vertexPoint.y() ), QgsPointV2( point.x(), point.y() ) ); + QgsPointXY vertexPoint = vertexAt( atVertex ); + return QgsGeometryUtils::sqrDistance2D( QgsPoint( vertexPoint.x(), vertexPoint.y() ), QgsPoint( point.x(), point.y() ) ); } QgsGeometry QgsGeometry::nearestPoint( const QgsGeometry &other ) const @@ -580,7 +580,7 @@ QgsGeometry QgsGeometry::shortestLine( const QgsGeometry &other ) const return geos.shortestLine( other ); } -double QgsGeometry::closestVertexWithContext( const QgsPoint &point, int &atVertex ) const +double QgsGeometry::closestVertexWithContext( const QgsPointXY &point, int &atVertex ) const { if ( !d->geometry ) { @@ -588,8 +588,8 @@ double QgsGeometry::closestVertexWithContext( const QgsPoint &point, int &atVert } QgsVertexId vId; - QgsPointV2 pt( point.x(), point.y() ); - QgsPointV2 closestPoint = QgsGeometryUtils::closestVertex( *( d->geometry ), pt, vId ); + QgsPoint pt( point.x(), point.y() ); + QgsPoint closestPoint = QgsGeometryUtils::closestVertex( *( d->geometry ), pt, vId ); if ( !vId.isValid() ) return -1; atVertex = vertexNrFromVertexId( vId ); @@ -597,8 +597,8 @@ double QgsGeometry::closestVertexWithContext( const QgsPoint &point, int &atVert } double QgsGeometry::closestSegmentWithContext( - const QgsPoint &point, - QgsPoint &minDistPoint, + const QgsPointXY &point, + QgsPointXY &minDistPoint, int &afterVertex, double *leftOf, double epsilon ) const @@ -608,11 +608,11 @@ double QgsGeometry::closestSegmentWithContext( return -1; } - QgsPointV2 segmentPt; + QgsPoint segmentPt; QgsVertexId vertexAfter; bool leftOfBool; - double sqrDist = d->geometry->closestSegment( QgsPointV2( point.x(), point.y() ), segmentPt, vertexAfter, &leftOfBool, epsilon ); + double sqrDist = d->geometry->closestSegment( QgsPoint( point.x(), point.y() ), segmentPt, vertexAfter, &leftOfBool, epsilon ); if ( sqrDist < 0 ) return -1; @@ -626,7 +626,7 @@ double QgsGeometry::closestSegmentWithContext( return sqrDist; } -int QgsGeometry::addRing( const QList &ring ) +int QgsGeometry::addRing( const QList &ring ) { detach( true ); @@ -647,7 +647,7 @@ int QgsGeometry::addRing( QgsCurve *ring ) return QgsGeometryEditUtils::addRing( d->geometry, ring ); } -int QgsGeometry::addPart( const QList &points, QgsWkbTypes::GeometryType geomType ) +int QgsGeometry::addPart( const QList &points, QgsWkbTypes::GeometryType geomType ) { QgsPointSequence l; convertPointList( points, l ); @@ -659,7 +659,7 @@ int QgsGeometry::addPart( const QgsPointSequence &points, QgsWkbTypes::GeometryT QgsAbstractGeometry *partGeom = nullptr; if ( points.size() == 1 ) { - partGeom = new QgsPointV2( points[0] ); + partGeom = new QgsPoint( points[0] ); } else if ( points.size() > 1 ) { @@ -770,7 +770,7 @@ int QgsGeometry::translate( double dx, double dy ) return 0; } -int QgsGeometry::rotate( double rotation, const QgsPoint ¢er ) +int QgsGeometry::rotate( double rotation, const QgsPointXY ¢er ) { if ( !d->geometry ) { @@ -786,7 +786,7 @@ int QgsGeometry::rotate( double rotation, const QgsPoint ¢er ) return 0; } -int QgsGeometry::splitGeometry( const QList &splitLine, QList &newGeometries, bool topological, QList &topologyTestPoints ) +int QgsGeometry::splitGeometry( const QList &splitLine, QList &newGeometries, bool topological, QList &topologyTestPoints ) { if ( !d->geometry ) { @@ -816,7 +816,7 @@ int QgsGeometry::splitGeometry( const QList &splitLine, QList &reshapeWithLine ) +int QgsGeometry::reshapeGeometry( const QList &reshapeWithLine ) { if ( !d->geometry ) { @@ -903,9 +903,9 @@ QgsGeometry QgsGeometry::orientedMinimumBoundingBox( double &area, double &angle return QgsGeometry(); QgsVertexId vertexId; - QgsPointV2 pt0; - QgsPointV2 pt1; - QgsPointV2 pt2; + QgsPoint pt0; + QgsPoint pt1; + QgsPoint pt2; // get first point hull.geometry()->nextVertex( vertexId, pt0 ); pt1 = pt0; @@ -937,7 +937,7 @@ QgsGeometry QgsGeometry::orientedMinimumBoundingBox( double &area, double &angle } QgsGeometry minBounds = QgsGeometry::fromRect( minRect ); - minBounds.rotate( angle, QgsPoint( pt0.x(), pt0.y() ) ); + minBounds.rotate( angle, QgsPointXY( pt0.x(), pt0.y() ) ); // constrain angle to 0 - 180 if ( angle > 180.0 ) @@ -970,14 +970,14 @@ bool QgsGeometry::intersects( const QgsGeometry &geometry ) const return geos.intersects( *geometry.d->geometry ); } -bool QgsGeometry::contains( const QgsPoint *p ) const +bool QgsGeometry::contains( const QgsPointXY *p ) const { if ( !d->geometry || !p ) { return false; } - QgsPointV2 pt( p->x(), p->y() ); + QgsPoint pt( p->x(), p->y() ); QgsGeos geos( d->geometry ); return geos.contains( pt ); } @@ -1143,19 +1143,19 @@ bool QgsGeometry::convertToSingleType() return true; } -QgsPoint QgsGeometry::asPoint() const +QgsPointXY QgsGeometry::asPoint() const { if ( !d->geometry || QgsWkbTypes::flatType( d->geometry->wkbType() ) != QgsWkbTypes::Point ) { - return QgsPoint(); + return QgsPointXY(); } - QgsPointV2 *pt = dynamic_cast( d->geometry ); + QgsPoint *pt = dynamic_cast( d->geometry ); if ( !pt ) { - return QgsPoint(); + return QgsPointXY(); } - return QgsPoint( pt->x(), pt->y() ); + return QgsPointXY( pt->x(), pt->y() ); } QgsPolyline QgsGeometry::asPolyline() const @@ -1257,7 +1257,7 @@ QgsMultiPoint QgsGeometry::asMultiPoint() const QgsMultiPoint multiPoint( nPoints ); for ( int i = 0; i < nPoints; ++i ) { - const QgsPointV2 *pt = static_cast( mp->geometryN( i ) ); + const QgsPoint *pt = static_cast( mp->geometryN( i ) ); multiPoint[i].setX( pt->x() ); multiPoint[i].setY( pt->y() ); } @@ -1587,7 +1587,7 @@ QgsGeometry QgsGeometry::centroid() const } QgsGeos geos( d->geometry ); - QgsPointV2 centroid; + QgsPoint centroid; bool ok = geos.centroid( centroid ); if ( !ok ) { @@ -1604,7 +1604,7 @@ QgsGeometry QgsGeometry::pointOnSurface() const } QgsGeos geos( d->geometry ); - QgsPointV2 pt; + QgsPoint pt; bool ok = geos.pointOnSurface( pt ); if ( !ok ) { @@ -1692,7 +1692,7 @@ double QgsGeometry::lineLocatePoint( const QgsGeometry &point ) const } QgsGeos geos( d->geometry ); - return geos.lineLocatePoint( *( static_cast< QgsPointV2 * >( point.d->geometry ) ) ); + return geos.lineLocatePoint( *( static_cast< QgsPoint * >( point.d->geometry ) ) ); } double QgsGeometry::interpolateAngle( double distance ) const @@ -1721,30 +1721,30 @@ double QgsGeometry::interpolateAngle( double distance ) const QgsGeometryUtils::adjacentVertices( *segmentized.geometry(), v2, v1, v3 ); if ( v1.isValid() && v3.isValid() ) { - QgsPointV2 p1 = segmentized.geometry()->vertexAt( v1 ); - QgsPointV2 p2 = segmentized.geometry()->vertexAt( v2 ); - QgsPointV2 p3 = segmentized.geometry()->vertexAt( v3 ); + QgsPoint p1 = segmentized.geometry()->vertexAt( v1 ); + QgsPoint p2 = segmentized.geometry()->vertexAt( v2 ); + QgsPoint p3 = segmentized.geometry()->vertexAt( v3 ); double angle1 = QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); double angle2 = QgsGeometryUtils::lineAngle( p2.x(), p2.y(), p3.x(), p3.y() ); return QgsGeometryUtils::averageAngle( angle1, angle2 ); } else if ( v3.isValid() ) { - QgsPointV2 p1 = segmentized.geometry()->vertexAt( v2 ); - QgsPointV2 p2 = segmentized.geometry()->vertexAt( v3 ); + QgsPoint p1 = segmentized.geometry()->vertexAt( v2 ); + QgsPoint p2 = segmentized.geometry()->vertexAt( v3 ); return QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); } else { - QgsPointV2 p1 = segmentized.geometry()->vertexAt( v1 ); - QgsPointV2 p2 = segmentized.geometry()->vertexAt( v2 ); + QgsPoint p1 = segmentized.geometry()->vertexAt( v1 ); + QgsPoint p2 = segmentized.geometry()->vertexAt( v2 ); return QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); } } else { - QgsPointV2 p1 = segmentized.geometry()->vertexAt( previous ); - QgsPointV2 p2 = segmentized.geometry()->vertexAt( next ); + QgsPoint p1 = segmentized.geometry()->vertexAt( previous ); + QgsPoint p2 = segmentized.geometry()->vertexAt( next ); return QgsGeometryUtils::lineAngle( p1.x(), p1.y(), p2.x(), p2.y() ); } } @@ -1870,7 +1870,7 @@ QList QgsGeometry::asGeometryCollection() const QPointF QgsGeometry::asQPointF() const { - QgsPoint point = asPoint(); + QgsPointXY point = asPoint(); return point.toQPointF(); } @@ -2174,7 +2174,7 @@ static bool vertexIndexInfo( const QgsAbstractGeometry *g, int vertexIndex, int return true; } } - else if ( dynamic_cast( g ) ) + else if ( dynamic_cast( g ) ) { if ( vertexIndex == 0 ) { @@ -2215,7 +2215,7 @@ bool QgsGeometry::vertexIdFromVertexNr( int nr, QgsVertexId &id ) const if ( const QgsCurve *curve = dynamic_cast( g ) ) { - QgsPointV2 p; + QgsPoint p; res = curve->pointAt( id.vertex, p, id.type ); if ( !res ) return false; @@ -2253,23 +2253,23 @@ int QgsGeometry::vertexNrFromVertexId( QgsVertexId id ) const return -1; } -void QgsGeometry::convertPointList( const QList &input, QgsPointSequence &output ) +void QgsGeometry::convertPointList( const QList &input, QgsPointSequence &output ) { output.clear(); - QList::const_iterator it = input.constBegin(); + QList::const_iterator it = input.constBegin(); for ( ; it != input.constEnd(); ++it ) { - output.append( QgsPointV2( it->x(), it->y() ) ); + output.append( QgsPoint( it->x(), it->y() ) ); } } -void QgsGeometry::convertPointList( const QgsPointSequence &input, QList &output ) +void QgsGeometry::convertPointList( const QgsPointSequence &input, QList &output ) { output.clear(); QgsPointSequence::const_iterator it = input.constBegin(); for ( ; it != input.constEnd(); ++it ) { - output.append( QgsPoint( it->x(), it->y() ) ); + output.append( QgsPointXY( it->x(), it->y() ) ); } } @@ -2285,7 +2285,7 @@ void QgsGeometry::convertToPolyline( const QgsPointSequence &input, QgsPolyline for ( int i = 0; i < input.size(); ++i ) { - const QgsPointV2 &pt = input.at( i ); + const QgsPoint &pt = input.at( i ); output[i].setX( pt.x() ); output[i].setY( pt.y() ); } @@ -2314,7 +2314,7 @@ GEOSContextHandle_t QgsGeometry::getGEOSHandler() QgsGeometry QgsGeometry::fromQPointF( QPointF point ) { - return QgsGeometry( new QgsPointV2( point.x(), point.y() ) ); + return QgsGeometry( new QgsPoint( point.x(), point.y() ) ); } QgsGeometry QgsGeometry::fromQPolygonF( const QPolygonF &polygon ) @@ -2342,7 +2342,7 @@ QgsPolyline QgsGeometry::createPolylineFromQPolygonF( const QPolygonF &polygon ) QPolygonF::const_iterator it = polygon.constBegin(); for ( ; it != polygon.constEnd(); ++it ) { - result.append( QgsPoint( *it ) ); + result.append( QgsPointXY( *it ) ); } return result; } @@ -2445,11 +2445,11 @@ QgsGeometry QgsGeometry::smooth( const unsigned int iterations, const double off } } -inline QgsPointV2 interpolatePointOnLine( const QgsPointV2 &p1, const QgsPointV2 &p2, const double offset ) +inline QgsPoint interpolatePointOnLine( const QgsPoint &p1, const QgsPoint &p2, const double offset ) { double deltaX = p2.x() - p1.x(); double deltaY = p2.y() - p1.y(); - return QgsPointV2( p1.x() + deltaX * offset, p1.y() + deltaY * offset ); + return QgsPoint( p1.x() + deltaX * offset, p1.y() + deltaY * offset ); } QgsLineString *smoothCurve( const QgsLineString &line, const unsigned int iterations, @@ -2465,9 +2465,9 @@ QgsLineString *smoothCurve( const QgsLineString &line, const unsigned int iterat bool skipLast = false; if ( isRing ) { - QgsPointV2 p1 = result->pointN( result->numPoints() - 2 ); - QgsPointV2 p2 = result->pointN( 0 ); - QgsPointV2 p3 = result->pointN( 1 ); + QgsPoint p1 = result->pointN( result->numPoints() - 2 ); + QgsPoint p2 = result->pointN( 0 ); + QgsPoint p3 = result->pointN( 1 ); double angle = QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ); angle = qAbs( M_PI - angle ); @@ -2475,25 +2475,25 @@ QgsLineString *smoothCurve( const QgsLineString &line, const unsigned int iterat } for ( int i = 0; i < result->numPoints() - 1; i++ ) { - QgsPointV2 p1 = result->pointN( i ); - QgsPointV2 p2 = result->pointN( i + 1 ); + QgsPoint p1 = result->pointN( i ); + QgsPoint p2 = result->pointN( i + 1 ); double angle = M_PI; if ( i == 0 && isRing ) { - QgsPointV2 p3 = result->pointN( result->numPoints() - 2 ); + QgsPoint p3 = result->pointN( result->numPoints() - 2 ); angle = QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ); } else if ( i < result->numPoints() - 2 ) { - QgsPointV2 p3 = result->pointN( i + 2 ); + QgsPoint p3 = result->pointN( i + 2 ); angle = QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ); } else if ( i == result->numPoints() - 2 && isRing ) { - QgsPointV2 p3 = result->pointN( 1 ); + QgsPoint p3 = result->pointN( 1 ); angle = QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ); } diff --git a/src/core/geometry/qgsgeometry.h b/src/core/geometry/qgsgeometry.h index 23f8510ab2b..5a55823e9d8 100644 --- a/src/core/geometry/qgsgeometry.h +++ b/src/core/geometry/qgsgeometry.h @@ -48,34 +48,34 @@ class QgsPolygonV2; class QgsLineString; //! Polyline is represented as a vector of points -typedef QVector QgsPolyline; +typedef QVector QgsPolyline; //! Polygon: first item of the list is outer ring, inner rings (if any) start from second item #ifndef SIP_RUN typedef QVector QgsPolygon; #else -typedef QVector> QgsPolygon; +typedef QVector> QgsPolygon; #endif //! A collection of QgsPoints that share a common collection of attributes #ifndef SIP_RUN -typedef QVector QgsMultiPoint; +typedef QVector QgsMultiPoint; #else -typedef QVector QgsMultiPoint; +typedef QVector QgsMultiPoint; #endif //! A collection of QgsPolylines that share a common collection of attributes #ifndef SIP_RUN typedef QVector QgsMultiPolyline; #else -typedef QVector> QgsMultiPolyline; +typedef QVector> QgsMultiPolyline; #endif //! A collection of QgsPolygons that share a common collection of attributes #ifndef SIP_RUN typedef QVector QgsMultiPolygon; #else -typedef QVector>> QgsMultiPolygon; +typedef QVector>> QgsMultiPolygon; #endif class QgsRectangle; @@ -138,8 +138,8 @@ class CORE_EXPORT QgsGeometry //! Creates a new geometry from a WKT string static QgsGeometry fromWkt( const QString &wkt ); - //! Creates a new geometry from a QgsPoint object - static QgsGeometry fromPoint( const QgsPoint &point ); + //! Creates a new geometry from a QgsPointXY object + static QgsGeometry fromPoint( const QgsPointXY &point ); //! Creates a new geometry from a QgsMultiPoint object static QgsGeometry fromMultiPoint( const QgsMultiPoint &multipoint ); //! Creates a new geometry from a QgsPolyline object @@ -253,7 +253,7 @@ class CORE_EXPORT QgsGeometry * \returns closest point in geometry. If not found (empty geometry), returns null point nad sqrDist is negative. */ //TODO QGIS 3.0 - rename beforeVertex to previousVertex, afterVertex to nextVertex - QgsPoint closestVertex( const QgsPoint &point, int &atVertex SIP_OUT, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT, double &sqrDist SIP_OUT ) const; + QgsPointXY closestVertex( const QgsPointXY &point, int &atVertex SIP_OUT, int &beforeVertex SIP_OUT, int &afterVertex SIP_OUT, double &sqrDist SIP_OUT ) const; /** * Returns the distance along this geometry from its first vertex to the specified vertex. @@ -310,7 +310,7 @@ class CORE_EXPORT QgsGeometry * these error conditions. (Or maybe we add another method to this * object to help make the distinction?) */ - bool insertVertex( const QgsPointV2 &point, int beforeVertex ); + bool insertVertex( const QgsPoint &point, int beforeVertex ); /** Moves the vertex at the given position number * and item (first number is index 0) @@ -326,7 +326,7 @@ class CORE_EXPORT QgsGeometry * Returns false if atVertex does not correspond to a valid vertex * on this geometry */ - bool moveVertex( const QgsPointV2 &p, int atVertex ); + bool moveVertex( const QgsPoint &p, int atVertex ); /** Deletes the vertex at the given position number and item * (first number is index 0) @@ -343,16 +343,16 @@ class CORE_EXPORT QgsGeometry /** * Returns coordinates of a vertex. * \param atVertex index of the vertex - * \returns Coordinates of the vertex or QgsPoint(0,0) on error + * \returns Coordinates of the vertex or QgsPointXY(0,0) on error */ - QgsPoint vertexAt( int atVertex ) const; + QgsPointXY vertexAt( int atVertex ) const; /** * Returns the squared cartesian distance between the given point * to the given vertex index (vertex at the given position number, * ring and item (first number is index 0)) */ - double sqrDistToVertexAt( QgsPoint &point SIP_IN, int atVertex ) const; + double sqrDistToVertexAt( QgsPointXY &point SIP_IN, int atVertex ) const; /** Returns the nearest point on this geometry to another geometry. * \since QGIS 2.14 @@ -372,7 +372,7 @@ class CORE_EXPORT QgsGeometry * \param atVertex Receives index of the closest vertex * \returns The squared cartesian distance is also returned in sqrDist, negative number on error */ - double closestVertexWithContext( const QgsPoint &point, int &atVertex SIP_OUT ) const; + double closestVertexWithContext( const QgsPointXY &point, int &atVertex SIP_OUT ) const; /** * Searches for the closest segment of geometry to the given point @@ -385,15 +385,15 @@ class CORE_EXPORT QgsGeometry * \returns The squared cartesian distance is also returned in sqrDist, negative number on error */ #ifndef SIP_RUN - double closestSegmentWithContext( const QgsPoint &point, QgsPoint &minDistPoint, int &afterVertex, double *leftOf = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; + double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint, int &afterVertex, double *leftOf = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; #else - double closestSegmentWithContext( const QgsPoint &point, QgsPoint &minDistPoint SIP_OUT, int &afterVertex SIP_OUT ) const; + double closestSegmentWithContext( const QgsPointXY &point, QgsPointXY &minDistPoint SIP_OUT, int &afterVertex SIP_OUT ) const; #endif /** Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. \returns 0 in case of success (ring added), 1 problem with geometry type, 2 ring not closed, 3 ring is not valid geometry, 4 ring not disjoint with existing rings, 5 no polygon found which contained the ring*/ - int addRing( const QList &ring ); + int addRing( const QList &ring ); // TODO QGIS 3.0 returns an enum instead of a magic constant /** Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. @@ -408,7 +408,7 @@ class CORE_EXPORT QgsGeometry * \returns 0 in case of success, 1 if not a multipolygon, 2 if ring is not a valid geometry, 3 if new polygon ring * not disjoint with existing polygons of the feature */ - int addPart( const QList &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPoints ); + int addPart( const QList &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPoints ); // TODO QGIS 3.0 returns an enum instead of a magic constant /** Adds a new part to a the geometry. @@ -473,7 +473,7 @@ class CORE_EXPORT QgsGeometry \param rotation clockwise rotation in degrees \param center rotation center \returns 0 in case of success*/ - int rotate( double rotation, const QgsPoint ¢er ); + int rotate( double rotation, const QgsPointXY ¢er ); /** Splits this geometry according to a given line. \param splitLine the line that splits the geometry @@ -482,16 +482,16 @@ class CORE_EXPORT QgsGeometry \param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset \returns 0 in case of success, 1 if geometry has not been split, error else*/ // TODO QGIS 3.0 returns an enum instead of a magic constant - int splitGeometry( const QList &splitLine, + int splitGeometry( const QList &splitLine, QList &newGeometries SIP_OUT, bool topological, - QList &topologyTestPoints SIP_OUT ); + QList &topologyTestPoints SIP_OUT ); /** Replaces a part of this geometry with another line * \returns 0 in case of success * \since QGIS 1.3 */ - int reshapeGeometry( const QList &reshapeWithLine ); + int reshapeGeometry( const QList &reshapeWithLine ); /** Changes this geometry such that it does not intersect the other geometry * \param other geometry that should not be intersect @@ -539,7 +539,7 @@ class CORE_EXPORT QgsGeometry bool intersects( const QgsGeometry &geometry ) const; //! Test for containment of a point (uses GEOS) - bool contains( const QgsPoint *p ) const; + bool contains( const QgsPointXY *p ) const; /** Test for if geometry is contained in another (uses GEOS) * \since QGIS 1.5 */ @@ -820,7 +820,7 @@ class CORE_EXPORT QgsGeometry /** Return contents of the geometry as a point * if wkbType is WKBPoint, otherwise returns [0,0] */ - QgsPoint asPoint() const; + QgsPointXY asPoint() const; /** Return contents of the geometry as a polyline * if wkbType is WKBLineString, otherwise an empty list @@ -924,7 +924,7 @@ class CORE_EXPORT QgsGeometry class CORE_EXPORT Error { QString message; - QgsPoint location; + QgsPointXY location; bool hasLocation; public: @@ -936,13 +936,13 @@ class CORE_EXPORT QgsGeometry : message( m ) , hasLocation( false ) {} - Error( const QString &m, const QgsPoint &p ) + Error( const QString &m, const QgsPointXY &p ) : message( m ) , location( p ) , hasLocation( true ) {} QString what() { return message; } - QgsPoint where() { return location; } + QgsPointXY where() { return location; } bool hasWhere() { return hasLocation; } }; @@ -1121,19 +1121,19 @@ class CORE_EXPORT QgsGeometry if ( o0 && o1 ) { // compare polyline - polyline - if ( sipCanConvertToType( o0, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( o1, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a0, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a1, sipType_QVector_0100QgsPoint, SIP_NOT_NONE ) ) + if ( sipCanConvertToType( o0, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( o1, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) ) { QgsPolyline *p0; QgsPolyline *p1; - p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); - p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); + p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); + p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); if ( sipIsErr ) { - sipReleaseType( p0, sipType_QVector_0100QgsPoint, state0 ); - sipReleaseType( p1, sipType_QVector_0100QgsPoint, state1 ); + sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 ); + sipReleaseType( p1, sipType_QVector_0100QgsPointXY, state1 ); } else { @@ -1148,19 +1148,19 @@ class CORE_EXPORT QgsGeometry if ( oo0 && oo1 ) { // compare polygon - polygon - if ( sipCanConvertToType( oo0, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( oo1, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) ) + if ( sipCanConvertToType( oo0, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( oo1, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) ) { QgsPolygon *p0; QgsPolygon *p1; - p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); - p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); + p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); + p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); if ( sipIsErr ) { - sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPoint, state0 ); - sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPoint, state1 ); + sipReleaseType( p0, sipType_QVector_0600QVector_0100QgsPointXY, state0 ); + sipReleaseType( p1, sipType_QVector_0600QVector_0100QgsPointXY, state1 ); } else { @@ -1175,19 +1175,19 @@ class CORE_EXPORT QgsGeometry if ( ooo0 && ooo1 ) { // compare multipolygon - multipolygon - if ( sipCanConvertToType( ooo0, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( ooo1, sipType_QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) && - sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, SIP_NOT_NONE ) ) + if ( sipCanConvertToType( ooo0, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( ooo1, sipType_QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) && + sipCanConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, SIP_NOT_NONE ) ) { QgsMultiPolygon *p0; QgsMultiPolygon *p1; - p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); - p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); + p0 = reinterpret_cast( sipConvertToType( a0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) ); + p1 = reinterpret_cast( sipConvertToType( a1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) ); if ( sipIsErr ) { - sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, state0 ); - sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPoint, state1 ); + sipReleaseType( p0, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state0 ); + sipReleaseType( p1, sipType_QVector_0600QVector_0600QVector_0100QgsPointXY, state1 ); } else { @@ -1222,17 +1222,17 @@ class CORE_EXPORT QgsGeometry */ static QgsGeometryEngine *createGeometryEngine( const QgsAbstractGeometry *geometry ) SIP_FACTORY; - /** Upgrades a point list from QgsPoint to QgsPointV2 - * \param input list of QgsPoint objects to be upgraded + /** Upgrades a point list from QgsPointXY to QgsPointV2 + * \param input list of QgsPointXY objects to be upgraded * \param output destination for list of points converted to QgsPointV2 */ - static void convertPointList( const QList &input, QgsPointSequence &output ); + static void convertPointList( const QList &input, QgsPointSequence &output ); - /** Downgrades a point list from QgsPointV2 to QgsPoint - * \param input list of QgsPointV2 objects to be downgraded + /** Downgrades a point list from QgsPoint to QgsPoint + * \param input list of QgsPoint objects to be downgraded * \param output destination for list of points converted to QgsPoint */ - static void convertPointList( const QgsPointSequence &input, QList &output ); + static void convertPointList( const QgsPointSequence &input, QList &output ); //! Allows direct construction of QVariants from geometry. operator QVariant() const diff --git a/src/core/geometry/qgsgeometrycollection.cpp b/src/core/geometry/qgsgeometrycollection.cpp index dc978af43fd..6b76cf1aa8b 100644 --- a/src/core/geometry/qgsgeometrycollection.cpp +++ b/src/core/geometry/qgsgeometrycollection.cpp @@ -239,7 +239,7 @@ bool QgsGeometryCollection::fromWkb( QgsConstWkbPtr &wkbPtr ) bool QgsGeometryCollection::fromWkt( const QString &wkt ) { - return fromCollectionWkt( wkt, QList() << new QgsPointV2 << new QgsLineString << new QgsPolygonV2 + return fromCollectionWkt( wkt, QList() << new QgsPoint << new QgsLineString << new QgsPolygonV2 << new QgsCircularString << new QgsCompoundCurve << new QgsCurvePolygon << new QgsMultiPointV2 << new QgsMultiLineString @@ -401,12 +401,12 @@ int QgsGeometryCollection::nCoordinates() const return count; } -double QgsGeometryCollection::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const +double QgsGeometryCollection::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const { return QgsGeometryUtils::closestSegmentFromComponents( mGeometries, QgsGeometryUtils::Part, pt, segmentPt, vertexAfter, leftOf, epsilon ); } -bool QgsGeometryCollection::nextVertex( QgsVertexId &id, QgsPointV2 &vertex ) const +bool QgsGeometryCollection::nextVertex( QgsVertexId &id, QgsPoint &vertex ) const { if ( id.part < 0 ) { @@ -434,7 +434,7 @@ bool QgsGeometryCollection::nextVertex( QgsVertexId &id, QgsPointV2 &vertex ) co return mGeometries.at( id.part )->nextVertex( id, vertex ); } -bool QgsGeometryCollection::insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) +bool QgsGeometryCollection::insertVertex( QgsVertexId position, const QgsPoint &vertex ) { if ( position.part >= mGeometries.size() ) { @@ -449,7 +449,7 @@ bool QgsGeometryCollection::insertVertex( QgsVertexId position, const QgsPointV2 return success; } -bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) +bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &newPos ) { if ( position.part >= mGeometries.size() ) { diff --git a/src/core/geometry/qgsgeometrycollection.h b/src/core/geometry/qgsgeometrycollection.h index a039e7bfa4d..0f709b9bb56 100644 --- a/src/core/geometry/qgsgeometrycollection.h +++ b/src/core/geometry/qgsgeometrycollection.h @@ -98,14 +98,14 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry virtual QgsCoordinateSequence coordinateSequence() const override; virtual int nCoordinates() const override; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override; - bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex SIP_OUT ) const override; + bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override; //low-level editing - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override; - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) override; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override; virtual bool deleteVertex( QgsVertexId position ) override; virtual double length() const override; @@ -128,7 +128,7 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry virtual int vertexCount( int part = 0, int ring = 0 ) const override; virtual int ringCount( int part = 0 ) const override; virtual int partCount() const override { return mGeometries.size(); } - virtual QgsPointV2 vertexAt( QgsVertexId id ) const override { return mGeometries[id.part]->vertexAt( id ); } + virtual QgsPoint vertexAt( QgsVertexId id ) const override { return mGeometries[id.part]->vertexAt( id ); } virtual bool addZValue( double zValue = 0 ) override; virtual bool addMValue( double mValue = 0 ) override; diff --git a/src/core/geometry/qgsgeometryengine.h b/src/core/geometry/qgsgeometryengine.h index 708f8fc1749..f88948b0780 100644 --- a/src/core/geometry/qgsgeometryengine.h +++ b/src/core/geometry/qgsgeometryengine.h @@ -46,8 +46,8 @@ class CORE_EXPORT QgsGeometryEngine virtual QgsAbstractGeometry *simplify( double tolerance, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY; virtual QgsAbstractGeometry *interpolate( double distance, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY; virtual QgsAbstractGeometry *envelope( QString *errorMsg = nullptr ) const = 0 SIP_FACTORY; - virtual bool centroid( QgsPointV2 &pt, QString *errorMsg = nullptr ) const = 0; - virtual bool pointOnSurface( QgsPointV2 &pt, QString *errorMsg = nullptr ) const = 0; + virtual bool centroid( QgsPoint &pt, QString *errorMsg = nullptr ) const = 0; + virtual bool pointOnSurface( QgsPoint &pt, QString *errorMsg = nullptr ) const = 0; virtual QgsAbstractGeometry *convexHull( QString *errorMsg = nullptr ) const = 0 SIP_FACTORY; virtual double distance( const QgsAbstractGeometry &geom, QString *errorMsg = nullptr ) const = 0; virtual bool intersects( const QgsAbstractGeometry &geom, QString *errorMsg = nullptr ) const = 0; diff --git a/src/core/geometry/qgsgeometryfactory.cpp b/src/core/geometry/qgsgeometryfactory.cpp index d539bacc781..0ed58f923fe 100644 --- a/src/core/geometry/qgsgeometryfactory.cpp +++ b/src/core/geometry/qgsgeometryfactory.cpp @@ -77,7 +77,7 @@ QgsAbstractGeometry *QgsGeometryFactory::geomFromWkt( const QString &text ) QgsAbstractGeometry *geom = nullptr; if ( trimmed.startsWith( QLatin1String( "Point" ), Qt::CaseInsensitive ) ) { - geom = new QgsPointV2(); + geom = new QgsPoint(); } else if ( trimmed.startsWith( QLatin1String( "LineString" ), Qt::CaseInsensitive ) ) { @@ -135,9 +135,9 @@ QgsAbstractGeometry *QgsGeometryFactory::geomFromWkt( const QString &text ) return geom; } -QgsAbstractGeometry *QgsGeometryFactory::fromPoint( const QgsPoint &point ) +QgsAbstractGeometry *QgsGeometryFactory::fromPoint( const QgsPointXY &point ) { - return new QgsPointV2( point.x(), point.y() ); + return new QgsPoint( point.x(), point.y() ); } QgsAbstractGeometry *QgsGeometryFactory::fromMultiPoint( const QgsMultiPoint &multipoint ) @@ -146,7 +146,7 @@ QgsAbstractGeometry *QgsGeometryFactory::fromMultiPoint( const QgsMultiPoint &mu QgsMultiPoint::const_iterator ptIt = multipoint.constBegin(); for ( ; ptIt != multipoint.constEnd(); ++ptIt ) { - QgsPointV2 *pt = new QgsPointV2( ptIt->x(), ptIt->y() ); + QgsPoint *pt = new QgsPoint( ptIt->x(), ptIt->y() ); mp->addGeometry( pt ); } return mp; @@ -203,11 +203,11 @@ QgsAbstractGeometry *QgsGeometryFactory::fromMultiPolygon( const QgsMultiPolygon QgsAbstractGeometry *QgsGeometryFactory::fromRect( const QgsRectangle &rect ) { QgsPolyline ring; - ring.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); - ring.append( QgsPoint( rect.xMaximum(), rect.yMinimum() ) ); - ring.append( QgsPoint( rect.xMaximum(), rect.yMaximum() ) ); - ring.append( QgsPoint( rect.xMinimum(), rect.yMaximum() ) ); - ring.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); + ring.append( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); + ring.append( QgsPointXY( rect.xMaximum(), rect.yMinimum() ) ); + ring.append( QgsPointXY( rect.xMaximum(), rect.yMaximum() ) ); + ring.append( QgsPointXY( rect.xMinimum(), rect.yMaximum() ) ); + ring.append( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); QgsPolygon polygon; polygon.append( ring ); @@ -237,7 +237,7 @@ QgsAbstractGeometry *QgsGeometryFactory::geomFromWkbType( QgsWkbTypes::Type t ) switch ( type ) { case QgsWkbTypes::Point: - return new QgsPointV2(); + return new QgsPoint(); case QgsWkbTypes::LineString: return new QgsLineString(); case QgsWkbTypes::CircularString: diff --git a/src/core/geometry/qgsgeometryfactory.h b/src/core/geometry/qgsgeometryfactory.h index 1430fd90a80..33783d38ac5 100644 --- a/src/core/geometry/qgsgeometryfactory.h +++ b/src/core/geometry/qgsgeometryfactory.h @@ -28,9 +28,9 @@ class QgsRectangle; //compatibility with old classes #include "qgspoint.h" -typedef QVector QgsPolyline; +typedef QVector QgsPolyline; typedef QVector QgsPolygon; -typedef QVector QgsMultiPoint; +typedef QVector QgsMultiPoint; typedef QVector QgsMultiPolyline; typedef QVector QgsMultiPolygon; @@ -54,7 +54,7 @@ class CORE_EXPORT QgsGeometryFactory static QgsAbstractGeometry *geomFromWkt( const QString &text ); //! Construct geometry from a point - static QgsAbstractGeometry *fromPoint( const QgsPoint &point ); + static QgsAbstractGeometry *fromPoint( const QgsPointXY &point ); //! Construct geometry from a multipoint static QgsAbstractGeometry *fromMultiPoint( const QgsMultiPoint &multipoint ); //! Construct geometry from a polyline diff --git a/src/core/geometry/qgsgeometrymakevalid.cpp b/src/core/geometry/qgsgeometrymakevalid.cpp index 68710a6b7b2..98a0df2b06c 100644 --- a/src/core/geometry/qgsgeometrymakevalid.cpp +++ b/src/core/geometry/qgsgeometrymakevalid.cpp @@ -389,7 +389,7 @@ static bool ring_make_geos_friendly( QgsCurve &ring ) // close the ring if not already closed (2d only) - QgsPointV2 p1 = linestring.startPoint(), p2 = linestring.endPoint(); + QgsPoint p1 = linestring.startPoint(), p2 = linestring.endPoint(); if ( p1.x() != p2.x() || p1.y() != p2.y() ) linestring.addVertex( p1 ); diff --git a/src/core/geometry/qgsgeometryutils.cpp b/src/core/geometry/qgsgeometryutils.cpp index 7942c03da54..28b601cee3e 100644 --- a/src/core/geometry/qgsgeometryutils.cpp +++ b/src/core/geometry/qgsgeometryutils.cpp @@ -62,15 +62,15 @@ QList QgsGeometryUtils::extractLineStrings( const QgsAbstractGe return linestrings; } -QgsPointV2 QgsGeometryUtils::closestVertex( const QgsAbstractGeometry &geom, const QgsPointV2 &pt, QgsVertexId &id ) +QgsPoint QgsGeometryUtils::closestVertex( const QgsAbstractGeometry &geom, const QgsPoint &pt, QgsVertexId &id ) { double minDist = std::numeric_limits::max(); double currentDist = 0; - QgsPointV2 minDistPoint; + QgsPoint minDistPoint; id = QgsVertexId(); // set as invalid QgsVertexId vertexId; - QgsPointV2 vertex; + QgsPoint vertex; while ( geom.nextVertex( vertexId, vertex ) ) { currentDist = QgsGeometryUtils::sqrDistance2D( pt, vertex ); @@ -97,8 +97,8 @@ double QgsGeometryUtils::distanceToVertex( const QgsAbstractGeometry &geom, QgsV { double currentDist = 0; QgsVertexId vertexId; - QgsPointV2 vertex; - QgsPointV2 previousVertex; + QgsPoint vertex; + QgsPoint previousVertex; bool first = true; while ( geom.nextVertex( vertexId, vertex ) ) @@ -128,8 +128,8 @@ bool QgsGeometryUtils::verticesAtDistance( const QgsAbstractGeometry &geometry, previousVertex = QgsVertexId(); nextVertex = QgsVertexId(); - QgsPointV2 point; - QgsPointV2 previousPoint; + QgsPoint point; + QgsPoint previousPoint; if ( qgsDoubleNear( distance, 0.0 ) ) { @@ -243,7 +243,7 @@ void QgsGeometryUtils::adjacentVertices( const QgsAbstractGeometry &geom, QgsVer } } -double QgsGeometryUtils::sqrDistance2D( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +double QgsGeometryUtils::sqrDistance2D( const QgsPoint &pt1, const QgsPoint &pt2 ) { return ( pt1.x() - pt2.x() ) * ( pt1.x() - pt2.x() ) + ( pt1.y() - pt2.y() ) * ( pt1.y() - pt2.y() ); } @@ -287,7 +287,7 @@ double QgsGeometryUtils::sqrDistToLine( double ptX, double ptY, double x1, doubl return dist; } -bool QgsGeometryUtils::lineIntersection( const QgsPointV2 &p1, QgsVector v, const QgsPointV2 &q1, QgsVector w, QgsPointV2 &inter ) +bool QgsGeometryUtils::lineIntersection( const QgsPoint &p1, QgsVector v, const QgsPoint &q1, QgsVector w, QgsPoint &inter ) { double d = v.y() * w.x() - v.x() * w.y(); @@ -298,12 +298,12 @@ bool QgsGeometryUtils::lineIntersection( const QgsPointV2 &p1, QgsVector v, cons double dy = q1.y() - p1.y(); double k = ( dy * w.x() - dx * w.y() ) / d; - inter = QgsPointV2( p1.x() + v.x() * k, p1.y() + v.y() * k ); + inter = QgsPoint( p1.x() + v.x() * k, p1.y() + v.y() * k ); return true; } -bool QgsGeometryUtils::segmentIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &q1, const QgsPointV2 &q2, QgsPointV2 &inter, double tolerance ) +bool QgsGeometryUtils::segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &inter, double tolerance ) { QgsVector v( p2.x() - p1.x(), p2.y() - p1.y() ); QgsVector w( q2.x() - q1.x(), q2.y() - q1.y() ); @@ -341,8 +341,8 @@ QList QgsGeometryUtils::getSelfIntersections // Check every pair of segments for intersections for ( int i = 0, j = 1; j < n; i = j++ ) { - QgsPointV2 pi = geom->vertexAt( QgsVertexId( part, ring, i ) ); - QgsPointV2 pj = geom->vertexAt( QgsVertexId( part, ring, j ) ); + QgsPoint pi = geom->vertexAt( QgsVertexId( part, ring, i ) ); + QgsPoint pj = geom->vertexAt( QgsVertexId( part, ring, j ) ); if ( QgsGeometryUtils::sqrDistance2D( pi, pj ) < tolerance * tolerance ) continue; // Don't test neighboring edges @@ -350,10 +350,10 @@ QList QgsGeometryUtils::getSelfIntersections int end = i == 0 && isClosed ? n - 1 : n; for ( int k = start, l = start + 1; l < end; k = l++ ) { - QgsPointV2 pk = geom->vertexAt( QgsVertexId( part, ring, k ) ); - QgsPointV2 pl = geom->vertexAt( QgsVertexId( part, ring, l ) ); + QgsPoint pk = geom->vertexAt( QgsVertexId( part, ring, k ) ); + QgsPoint pl = geom->vertexAt( QgsVertexId( part, ring, l ) ); - QgsPointV2 inter; + QgsPoint inter; if ( !QgsGeometryUtils::segmentIntersection( pi, pj, pk, pl, inter, tolerance ) ) continue; SelfIntersection s; @@ -379,7 +379,7 @@ double QgsGeometryUtils::leftOfLine( double x, double y, double x1, double y1, d return f1 * f2 - f3 * f4; } -QgsPointV2 QgsGeometryUtils::pointOnLineWithDistance( const QgsPointV2 &startPoint, const QgsPointV2 &directionPoint, double distance ) +QgsPoint QgsGeometryUtils::pointOnLineWithDistance( const QgsPoint &startPoint, const QgsPoint &directionPoint, double distance ) { double dx = directionPoint.x() - startPoint.x(); double dy = directionPoint.y() - startPoint.y(); @@ -391,7 +391,7 @@ QgsPointV2 QgsGeometryUtils::pointOnLineWithDistance( const QgsPointV2 &startPoi } double scaleFactor = distance / length; - return QgsPointV2( startPoint.x() + dx * scaleFactor, startPoint.y() + dy * scaleFactor ); + return QgsPoint( startPoint.x() + dx * scaleFactor, startPoint.y() + dy * scaleFactor ); } double QgsGeometryUtils::ccwAngle( double dy, double dx ) @@ -408,7 +408,7 @@ double QgsGeometryUtils::ccwAngle( double dy, double dx ) return angle; } -void QgsGeometryUtils::circleCenterRadius( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double &radius, double ¢erX, double ¢erY ) +void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double &radius, double ¢erX, double ¢erY ) { double dx21, dy21, dx31, dy31, h21, h31, d; @@ -493,7 +493,7 @@ bool QgsGeometryUtils::angleOnCircle( double angle, double angle1, double angle2 double QgsGeometryUtils::circleLength( double x1, double y1, double x2, double y2, double x3, double y3 ) { double centerX, centerY, radius; - circleCenterRadius( QgsPointV2( x1, y1 ), QgsPointV2( x2, y2 ), QgsPointV2( x3, y3 ), radius, centerX, centerY ); + circleCenterRadius( QgsPoint( x1, y1 ), QgsPoint( x2, y2 ), QgsPoint( x3, y3 ), radius, centerX, centerY ); double length = M_PI / 180.0 * radius * sweepAngle( centerX, centerY, x1, y1, x2, y2, x3, y3 ); if ( length < 0 ) { @@ -532,9 +532,9 @@ double QgsGeometryUtils::sweepAngle( double centerX, double centerY, double x1, } } -bool QgsGeometryUtils::segmentMidPoint( const QgsPointV2 &p1, const QgsPointV2 &p2, QgsPointV2 &result, double radius, const QgsPointV2 &mousePos ) +bool QgsGeometryUtils::segmentMidPoint( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &result, double radius, const QgsPoint &mousePos ) { - QgsPointV2 midPoint( ( p1.x() + p2.x() ) / 2.0, ( p1.y() + p2.y() ) / 2.0 ); + QgsPoint midPoint( ( p1.x() + p2.x() ) / 2.0, ( p1.y() + p2.y() ) / 2.0 ); double midDist = sqrt( sqrDistance2D( p1, midPoint ) ); if ( radius < midDist ) { @@ -547,11 +547,11 @@ bool QgsGeometryUtils::segmentMidPoint( const QgsPointV2 &p1, const QgsPointV2 & double midDy = midPoint.y() - p1.y(); //get the four possible midpoints - QVector possibleMidPoints; - possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() - midDy, midPoint.y() + midDx ), dist ) ); - possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() - midDy, midPoint.y() + midDx ), 2 * radius - dist ) ); - possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() + midDy, midPoint.y() - midDx ), dist ) ); - possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPointV2( midPoint.x() + midDy, midPoint.y() - midDx ), 2 * radius - dist ) ); + QVector possibleMidPoints; + possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPoint( midPoint.x() - midDy, midPoint.y() + midDx ), dist ) ); + possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPoint( midPoint.x() - midDy, midPoint.y() + midDx ), 2 * radius - dist ) ); + possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPoint( midPoint.x() + midDy, midPoint.y() - midDx ), dist ) ); + possibleMidPoints.append( pointOnLineWithDistance( midPoint, QgsPoint( midPoint.x() + midDy, midPoint.y() - midDx ), 2 * radius - dist ) ); //take the closest one double minDist = std::numeric_limits::max(); @@ -575,8 +575,8 @@ bool QgsGeometryUtils::segmentMidPoint( const QgsPointV2 &p1, const QgsPointV2 & return true; } -double QgsGeometryUtils::circleTangentDirection( const QgsPointV2 &tangentPoint, const QgsPointV2 &cp1, - const QgsPointV2 &cp2, const QgsPointV2 &cp3 ) +double QgsGeometryUtils::circleTangentDirection( const QgsPoint &tangentPoint, const QgsPoint &cp1, + const QgsPoint &cp2, const QgsPoint &cp3 ) { //calculate circle midpoint double mX, mY, radius; @@ -595,7 +595,7 @@ double QgsGeometryUtils::circleTangentDirection( const QgsPointV2 &tangentPoint, } } -void QgsGeometryUtils::segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3, QgsPointSequence &points, double tolerance, QgsAbstractGeometry::SegmentationToleranceType toleranceType, bool hasZ, bool hasM ) +void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, QgsPointSequence &points, double tolerance, QgsAbstractGeometry::SegmentationToleranceType toleranceType, bool hasZ, bool hasM ) { bool clockwise = false; int segSide = segmentSide( p1, p3, p2 ); @@ -604,9 +604,9 @@ void QgsGeometryUtils::segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2 clockwise = true; } - QgsPointV2 circlePoint1 = clockwise ? p3 : p1; - QgsPointV2 circlePoint2 = p2; - QgsPointV2 circlePoint3 = clockwise ? p1 : p3 ; + QgsPoint circlePoint1 = clockwise ? p3 : p1; + QgsPoint circlePoint2 = p2; + QgsPoint circlePoint3 = clockwise ? p1 : p3 ; //adapted code from postgis double radius = 0; @@ -644,7 +644,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2 double z = 0; double m = 0; - QList stringPoints; + QList stringPoints; stringPoints.insert( clockwise ? 0 : stringPoints.size(), circlePoint1 ); if ( circlePoint2 != circlePoint3 && circlePoint1 != circlePoint2 ) //draw straight line segment if two points have the same position { @@ -674,7 +674,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2 if ( !hasZ && !hasM ) { - stringPoints.insert( clockwise ? 0 : stringPoints.size(), QgsPointV2( x, y ) ); + stringPoints.insert( clockwise ? 0 : stringPoints.size(), QgsPoint( x, y ) ); continue; } @@ -687,14 +687,14 @@ void QgsGeometryUtils::segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2 m = interpolateArcValue( angle, a1, a2, a3, circlePoint1.m(), circlePoint2.m(), circlePoint3.m() ); } - stringPoints.insert( clockwise ? 0 : stringPoints.size(), QgsPointV2( pointWkbType, x, y, z, m ) ); + stringPoints.insert( clockwise ? 0 : stringPoints.size(), QgsPoint( pointWkbType, x, y, z, m ) ); } } stringPoints.insert( clockwise ? 0 : stringPoints.size(), circlePoint3 ); points.append( stringPoints ); } -int QgsGeometryUtils::segmentSide( const QgsPointV2 &pt1, const QgsPointV2 &pt3, const QgsPointV2 &pt2 ) +int QgsGeometryUtils::segmentSide( const QgsPoint &pt1, const QgsPoint &pt3, const QgsPoint &pt2 ) { double side = ( ( pt2.x() - pt1.x() ) * ( pt3.y() - pt1.y() ) - ( pt3.x() - pt1.x() ) * ( pt2.y() - pt1.y() ) ); if ( side == 0.0 ) @@ -797,7 +797,7 @@ QgsPointSequence QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateLi t = QgsWkbTypes::Point; } - points.append( QgsPointV2( t, x, y, z, m ) ); + points.append( QgsPoint( t, x, y, z, m ) ); } return points; @@ -806,7 +806,7 @@ QgsPointSequence QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateLi void QgsGeometryUtils::pointsToWKB( QgsWkbPtr &wkb, const QgsPointSequence &points, bool is3D, bool isMeasure ) { wkb << static_cast( points.size() ); - Q_FOREACH ( const QgsPointV2 &point, points ) + Q_FOREACH ( const QgsPoint &point, points ) { wkb << point.x() << point.y(); if ( is3D ) @@ -823,7 +823,7 @@ void QgsGeometryUtils::pointsToWKB( QgsWkbPtr &wkb, const QgsPointSequence &poin QString QgsGeometryUtils::pointsToWKT( const QgsPointSequence &points, int precision, bool is3D, bool isMeasure ) { QString wkt = QStringLiteral( "(" ); - Q_FOREACH ( const QgsPointV2 &p, points ) + Q_FOREACH ( const QgsPoint &p, points ) { wkt += qgsDoubleToString( p.x(), precision ); wkt += ' ' + qgsDoubleToString( p.y(), precision ); @@ -845,7 +845,7 @@ QDomElement QgsGeometryUtils::pointsToGML2( const QgsPointSequence &points, QDom QString strCoordinates; - Q_FOREACH ( const QgsPointV2 &p, points ) + Q_FOREACH ( const QgsPoint &p, points ) strCoordinates += qgsDoubleToString( p.x(), precision ) + ',' + qgsDoubleToString( p.y(), precision ) + ' '; if ( strCoordinates.endsWith( ' ' ) ) @@ -861,7 +861,7 @@ QDomElement QgsGeometryUtils::pointsToGML3( const QgsPointSequence &points, QDom elemPosList.setAttribute( QStringLiteral( "srsDimension" ), is3D ? 3 : 2 ); QString strCoordinates; - Q_FOREACH ( const QgsPointV2 &p, points ) + Q_FOREACH ( const QgsPoint &p, points ) { strCoordinates += qgsDoubleToString( p.x(), precision ) + ' ' + qgsDoubleToString( p.y(), precision ) + ' '; if ( is3D ) @@ -877,7 +877,7 @@ QDomElement QgsGeometryUtils::pointsToGML3( const QgsPointSequence &points, QDom QString QgsGeometryUtils::pointsToJSON( const QgsPointSequence &points, int precision ) { QString json = QStringLiteral( "[ " ); - Q_FOREACH ( const QgsPointV2 &p, points ) + Q_FOREACH ( const QgsPoint &p, points ) { json += '[' + qgsDoubleToString( p.x(), precision ) + ", " + qgsDoubleToString( p.y(), precision ) + "], "; } @@ -950,7 +950,7 @@ QStringList QgsGeometryUtils::wktGetChildBlocks( const QString &wkt, const QStri return blocks; } -QgsPointV2 QgsGeometryUtils::midpoint( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +QgsPoint QgsGeometryUtils::midpoint( const QgsPoint &pt1, const QgsPoint &pt2 ) { QgsWkbTypes::Type pType( QgsWkbTypes::Point ); @@ -972,10 +972,10 @@ QgsPointV2 QgsGeometryUtils::midpoint( const QgsPointV2 &pt1, const QgsPointV2 & m = ( pt1.m() + pt2.m() ) / 2.0; } - return QgsPointV2( pType, x, y, z, m ); + return QgsPoint( pType, x, y, z, m ); } -double QgsGeometryUtils::gradient( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ) +double QgsGeometryUtils::gradient( const QgsPoint &pt1, const QgsPoint &pt2 ) { double delta_x = pt2.x() - pt1.x(); double delta_y = pt2.y() - pt1.y(); @@ -987,7 +987,7 @@ double QgsGeometryUtils::gradient( const QgsPointV2 &pt1, const QgsPointV2 &pt2 return delta_y / delta_x; } -void QgsGeometryUtils::coefficients( const QgsPointV2 &pt1, const QgsPointV2 &pt2, double &a, double &b, double &c ) +void QgsGeometryUtils::coefficients( const QgsPoint &pt1, const QgsPoint &pt2, double &a, double &b, double &c ) { if ( qgsDoubleNear( pt1.x(), pt2.x() ) ) { @@ -1010,10 +1010,10 @@ void QgsGeometryUtils::coefficients( const QgsPointV2 &pt1, const QgsPointV2 &pt } -QgsLineString QgsGeometryUtils::perpendicularSegment( const QgsPointV2 &p, const QgsPointV2 &s1, const QgsPointV2 &s2 ) +QgsLineString QgsGeometryUtils::perpendicularSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ) { QgsLineString line; - QgsPointV2 p2; + QgsPoint p2; if ( ( p == s1 ) || ( p == s2 ) ) { @@ -1025,11 +1025,11 @@ QgsLineString QgsGeometryUtils::perpendicularSegment( const QgsPointV2 &p, const if ( qgsDoubleNear( a, 0 ) ) { - p2 = QgsPointV2( p.x(), s1.y() ); + p2 = QgsPoint( p.x(), s1.y() ); } else if ( qgsDoubleNear( b, 0 ) ) { - p2 = QgsPointV2( s1.x(), p.y() ); + p2 = QgsPoint( s1.x(), p.y() ); } else { @@ -1039,7 +1039,7 @@ QgsLineString QgsGeometryUtils::perpendicularSegment( const QgsPointV2 &p, const double H = p.y() - y; double dx = m * H / d2; double dy = m * dx; - p2 = QgsPointV2( p.x() + dx, y + dy ); + p2 = QgsPoint( p.x() + dx, y + dy ); } line.addVertex( p ); diff --git a/src/core/geometry/qgsgeometryutils.h b/src/core/geometry/qgsgeometryutils.h index a1a9219781d..1201b629f1c 100644 --- a/src/core/geometry/qgsgeometryutils.h +++ b/src/core/geometry/qgsgeometryutils.h @@ -42,7 +42,7 @@ class CORE_EXPORT QgsGeometryUtils /** Returns the closest vertex to a geometry for a specified point. * On error null point will be returned and "id" argument will be invalid. */ - static QgsPointV2 closestVertex( const QgsAbstractGeometry &geom, const QgsPointV2 &pt, QgsVertexId &id SIP_OUT ); + static QgsPoint closestVertex( const QgsAbstractGeometry &geom, const QgsPoint &pt, QgsVertexId &id SIP_OUT ); /** Returns the distance along a geometry from its first vertex to the specified vertex. * \param geom geometry @@ -73,7 +73,7 @@ class CORE_EXPORT QgsGeometryUtils /** Returns the squared 2D distance between two points. */ - static double sqrDistance2D( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static double sqrDistance2D( const QgsPoint &pt1, const QgsPoint &pt2 ); /** Returns the squared distance between a point and a line. */ @@ -88,7 +88,7 @@ class CORE_EXPORT QgsGeometryUtils * \param inter Output parameter, the intersection point * \returns Whether the lines intersect */ - static bool lineIntersection( const QgsPointV2 &p1, QgsVector v, const QgsPointV2 &q1, QgsVector w, QgsPointV2 &inter SIP_OUT ); + static bool lineIntersection( const QgsPoint &p1, QgsVector v, const QgsPoint &q1, QgsVector w, QgsPoint &inter SIP_OUT ); /** * \brief Compute the intersection between two segments @@ -100,7 +100,7 @@ class CORE_EXPORT QgsGeometryUtils * \param tolerance The tolerance to use * \returns Whether the segments intersect */ - static bool segmentIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &q1, const QgsPointV2 &q2, QgsPointV2 &inter SIP_OUT, double tolerance ); + static bool segmentIntersection( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &inter SIP_OUT, double tolerance ); /** * \brief Project the point on a segment @@ -109,12 +109,12 @@ class CORE_EXPORT QgsGeometryUtils * \param s2 The segment end point * \returns The projection of the point on the segment */ - static QgsPointV2 projPointOnSegment( const QgsPointV2 &p, const QgsPointV2 &s1, const QgsPointV2 &s2 ) + static QgsPoint projPointOnSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ) { double nx = s2.y() - s1.y(); double ny = -( s2.x() - s1.x() ); double t = ( p.x() * ny - p.y() * nx - s1.x() * ny + s1.y() * nx ) / ( ( s2.x() - s1.x() ) * ny - ( s2.y() - s1.y() ) * nx ); - return t < 0. ? s1 : t > 1. ? s2 : QgsPointV2( s1.x() + ( s2.x() - s1.x() ) * t, s1.y() + ( s2.y() - s1.y() ) * t ); + return t < 0. ? s1 : t > 1. ? s2 : QgsPoint( s1.x() + ( s2.x() - s1.x() ) * t, s1.y() + ( s2.y() - s1.y() ) * t ); } //! \note not available in Python bindings @@ -122,7 +122,7 @@ class CORE_EXPORT QgsGeometryUtils { int segment1; int segment2; - QgsPointV2 point; + QgsPoint point; }; /** @@ -142,13 +142,13 @@ class CORE_EXPORT QgsGeometryUtils /** Returns a point a specified distance toward a second point. */ - static QgsPointV2 pointOnLineWithDistance( const QgsPointV2 &startPoint, const QgsPointV2 &directionPoint, double distance ); + static QgsPoint pointOnLineWithDistance( const QgsPoint &startPoint, const QgsPoint &directionPoint, double distance ); //! Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0 static double ccwAngle( double dy, double dx ); //! Returns radius and center of the circle through pt1, pt2, pt3 - static void circleCenterRadius( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QgsPointV2 &pt3, double &radius SIP_OUT, + static void circleCenterRadius( const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double &radius SIP_OUT, double ¢erX SIP_OUT, double ¢erY SIP_OUT ); //! Returns true if circle is ordered clockwise @@ -169,16 +169,16 @@ class CORE_EXPORT QgsGeometryUtils static double sweepAngle( double centerX, double centerY, double x1, double y1, double x2, double y2, double x3, double y3 ); //! Calculates midpoint on circle passing through p1 and p2, closest to given coordinate - static bool segmentMidPoint( const QgsPointV2 &p1, const QgsPointV2 &p2, QgsPointV2 &result SIP_OUT, double radius, const QgsPointV2 &mousePos ); + static bool segmentMidPoint( const QgsPoint &p1, const QgsPoint &p2, QgsPoint &result SIP_OUT, double radius, const QgsPoint &mousePos ); //! Calculates the direction angle of a circle tangent (clockwise from north in radians) - static double circleTangentDirection( const QgsPointV2 &tangentPoint, const QgsPointV2 &cp1, const QgsPointV2 &cp2, const QgsPointV2 &cp3 ); + static double circleTangentDirection( const QgsPoint &tangentPoint, const QgsPoint &cp1, const QgsPoint &cp2, const QgsPoint &cp3 ); /** Convert circular arc defined by p1, p2, p3 (p1/p3 being start resp. end point, p2 lies on the arc) into a sequence of points. * \since 3.0 */ - static void segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3, - QgsPointSequence SIP_PYALTERNATIVETYPE( QList ) &points SIP_OUT, double tolerance = M_PI_2 / 90, + static void segmentizeArc( const QgsPoint &p1, const QgsPointV2 &p2, const QgsPoint &p3, + QgsPointSequence SIP_PYALTERNATIVETYPE( QList ) &points SIP_OUT, double tolerance = M_PI_2 / 90, QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle, bool hasZ = false, bool hasM = false ); @@ -186,7 +186,7 @@ class CORE_EXPORT QgsGeometryUtils * Returns -1 if pt3 on the left side, 1 if pt3 is on the right side or 0 if pt3 lies on the line. * \since 3.0 */ - static int segmentSide( const QgsPointV2 &pt1, const QgsPointV2 &pt3, const QgsPointV2 &pt2 ); + static int segmentSide( const QgsPoint &pt1, const QgsPoint &pt3, const QgsPoint &pt2 ); /** Interpolate a value at given angle on circular arc given values (zm1, zm2, zm3) at three different angles (a1, a2, a3). * \since 3.0 @@ -299,19 +299,19 @@ class CORE_EXPORT QgsGeometryUtils * \returns New point at middle between points pt1 and pt2. * * Example: * \code{.py} - * p = QgsPointV2( 4, 6 ) # 2D point - * pr = midpoint ( p, QgsPointV2( 2, 2 ) ) + * p = QgsPoint( 4, 6 ) # 2D point + * pr = midpoint ( p, QgsPoint( 2, 2 ) ) * # pr is a 2D point: 'Point (3 4)' - * pr = midpoint ( p, QgsPointV2( QgsWkbTypes.PointZ, 2, 2, 2 ) ) + * pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZ, 2, 2, 2 ) ) * # pr is a 3D point: 'PointZ (3 4 1)' - * pr = midpoint ( p, QgsPointV2( QgsWkbTypes.PointM, 2, 2, 0, 2 ) ) + * pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointM, 2, 2, 0, 2 ) ) * # pr is a 3D point: 'PointM (3 4 1)' - * pr = midpoint ( p, QgsPointV2( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) ) + * pr = midpoint ( p, QgsPoint( QgsWkbTypes.PointZM, 2, 2, 2, 2 ) ) * # pr is a 3D point: 'PointZM (3 4 1 1)' * \endcode * \since QGIS 3.0 */ - static QgsPointV2 midpoint( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static QgsPoint midpoint( const QgsPoint &pt1, const QgsPoint &pt2 ); /** Return the gradient of a line defined by points \a pt1 and \a pt2. * \param pt1 first point. @@ -319,7 +319,7 @@ class CORE_EXPORT QgsGeometryUtils * \returns The gradient of this linear entity, or infinity if vertical * \since QGIS 3.0 */ - static double gradient( const QgsPointV2 &pt1, const QgsPointV2 &pt2 ); + static double gradient( const QgsPoint &pt1, const QgsPoint &pt2 ); /** Return the coefficients (a, b, c for equation "ax + by + c = 0") of a line defined by points \a pt1 and \a pt2. * \param pt1 first point. @@ -329,7 +329,7 @@ class CORE_EXPORT QgsGeometryUtils * \param c Output parameter, c coefficient of the equation. * \since QGIS 3.0 */ - static void coefficients( const QgsPointV2 &pt1, const QgsPointV2 &pt2, + static void coefficients( const QgsPoint &pt1, const QgsPoint &pt2, double &a SIP_OUT, double &b SIP_OUT, double &c SIP_OUT ); /** @@ -339,7 +339,7 @@ class CORE_EXPORT QgsGeometryUtils * \param s2 The segment end point * \returns A line (segment) from p to perpendicular point on segment [s1, s2] */ - static QgsLineString perpendicularSegment( const QgsPointV2 &p, const QgsPointV2 &s1, const QgsPointV2 &s2 ); + static QgsLineString perpendicularSegment( const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2 ); //! \note not available in Python bindings enum ComponentType SIP_SKIP @@ -350,7 +350,7 @@ class CORE_EXPORT QgsGeometryUtils }; //! \note not available in Python bindings - template static double closestSegmentFromComponents( T &container, ComponentType ctype, const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) SIP_SKIP + template static double closestSegmentFromComponents( T &container, ComponentType ctype, const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) SIP_SKIP { double minDist = std::numeric_limits::max(); double minDistSegmentX = 0.0, minDistSegmentY = 0.0; diff --git a/src/core/geometry/qgsgeos.cpp b/src/core/geometry/qgsgeos.cpp index d1c8ceb4433..601b25d1ca1 100644 --- a/src/core/geometry/qgsgeos.cpp +++ b/src/core/geometry/qgsgeos.cpp @@ -506,7 +506,7 @@ int QgsGeos::topologicalTestPointsSplit( const GEOSGeometry *splitLine, QgsPoint { if ( GEOSCoordSeq_getY_r( geosinit.ctxt, lineSequence, i, &y ) != 0 ) { - testPoints.push_back( QgsPointV2( x, y ) ); + testPoints.push_back( QgsPoint( x, y ) ); } } } @@ -545,7 +545,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const QgsAbstractGeometry *splitGeom = fromGeos( GEOSsplitPoint ); - QgsPointV2 *splitPoint = dynamic_cast( splitGeom ); + QgsPoint *splitPoint = dynamic_cast( splitGeom ); if ( !splitPoint ) { delete splitGeom; @@ -566,7 +566,7 @@ GEOSGeometry *QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) const int nVertices = line->numPoints(); for ( int j = 1; j < ( nVertices - 1 ); ++j ) { - QgsPointV2 currentPoint = line->pointN( j ); + QgsPoint currentPoint = line->pointN( j ); newLine.addVertex( currentPoint ); if ( currentPoint == *splitPoint ) { @@ -1038,11 +1038,11 @@ int QgsGeos::numberOfGeometries( GEOSGeometry *g ) return GEOSGetNumGeometries_r( geosinit.ctxt, g ); } -QgsPointV2 QgsGeos::coordSeqPoint( const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM ) +QgsPoint QgsGeos::coordSeqPoint( const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM ) { if ( !cs ) { - return QgsPointV2(); + return QgsPoint(); } double x, y; @@ -1072,7 +1072,7 @@ QgsPointV2 QgsGeos::coordSeqPoint( const GEOSCoordSequence *cs, int i, bool hasZ { t = QgsWkbTypes::PointM; } - return QgsPointV2( t, x, y, z, m ); + return QgsPoint( t, x, y, z, m ); } GEOSGeometry *QgsGeos::asGeos( const QgsAbstractGeometry *geom, double precision ) @@ -1130,7 +1130,7 @@ GEOSGeometry *QgsGeos::asGeos( const QgsAbstractGeometry *geom, double precision switch ( QgsWkbTypes::geometryType( geom->wkbType() ) ) { case QgsWkbTypes::PointGeometry: - return createGeosPoint( static_cast( geom ), coordDims, precision ); + return createGeosPoint( static_cast( geom ), coordDims, precision ); break; case QgsWkbTypes::LineGeometry: @@ -1358,7 +1358,7 @@ QgsAbstractGeometry *QgsGeos::interpolate( double distance, QString *errorMsg ) return fromGeos( geos.get() ); } -bool QgsGeos::centroid( QgsPointV2 &pt, QString *errorMsg ) const +bool QgsGeos::centroid( QgsPoint &pt, QString *errorMsg ) const { if ( !mGeos ) { @@ -1400,7 +1400,7 @@ QgsAbstractGeometry *QgsGeos::envelope( QString *errorMsg ) const return fromGeos( geos.get() ); } -bool QgsGeos::pointOnSurface( QgsPointV2 &pt, QString *errorMsg ) const +bool QgsGeos::pointOnSurface( QgsPoint &pt, QString *errorMsg ) const { if ( !mGeos ) { @@ -1597,7 +1597,7 @@ GEOSCoordSequence *QgsGeos::createCoordinateSequence( const QgsCurve *curve, dou GEOSGeometry *QgsGeos::createGeosPoint( const QgsAbstractGeometry *point, int coordDims, double precision ) { - const QgsPointV2 *pt = dynamic_cast( point ); + const QgsPoint *pt = dynamic_cast( point ); if ( !pt ) return nullptr; @@ -1908,7 +1908,7 @@ QgsGeometry QgsGeos::closestPoint( const QgsGeometry &other, QString *errorMsg ) return QgsGeometry(); } - return QgsGeometry( new QgsPointV2( nx, ny ) ); + return QgsGeometry( new QgsPoint( nx, ny ) ); } QgsGeometry QgsGeos::shortestLine( const QgsGeometry &other, QString *errorMsg ) const @@ -1949,12 +1949,12 @@ QgsGeometry QgsGeos::shortestLine( const QgsGeometry &other, QString *errorMsg ) } QgsLineString *line = new QgsLineString(); - line->addVertex( QgsPointV2( nx1, ny1 ) ); - line->addVertex( QgsPointV2( nx2, ny2 ) ); + line->addVertex( QgsPoint( nx1, ny1 ) ); + line->addVertex( QgsPoint( nx2, ny2 ) ); return QgsGeometry( line ); } -double QgsGeos::lineLocatePoint( const QgsPointV2 &point, QString *errorMsg ) const +double QgsGeos::lineLocatePoint( const QgsPoint &point, QString *errorMsg ) const { if ( !mGeos ) { @@ -2103,7 +2103,7 @@ static bool _linestringEndpoints( const GEOSGeometry *linestring, double &x1, do //! Merge two linestrings if they meet at the given intersection point, return new geometry or null on error. -static GEOSGeometry *_mergeLinestrings( const GEOSGeometry *line1, const GEOSGeometry *line2, const QgsPoint &intersectionPoint ) +static GEOSGeometry *_mergeLinestrings( const GEOSGeometry *line1, const GEOSGeometry *line2, const QgsPointXY &intersectionPoint ) { double x1, y1, x2, y2; if ( !_linestringEndpoints( line1, x1, y1, x2, y2 ) ) @@ -2143,7 +2143,7 @@ GEOSGeometry *QgsGeos::reshapeLine( const GEOSGeometry *line, const GEOSGeometry bool atLeastTwoIntersections = false; bool oneIntersection = false; - QgsPoint oneIntersectionPoint; + QgsPointXY oneIntersectionPoint; try { @@ -2161,7 +2161,7 @@ GEOSGeometry *QgsGeos::reshapeLine( const GEOSGeometry *line, const GEOSGeometry GEOSCoordSeq_getX_r( geosinit.ctxt, intersectionCoordSeq, 0, &xi ); GEOSCoordSeq_getY_r( geosinit.ctxt, intersectionCoordSeq, 0, &yi ); oneIntersection = true; - oneIntersectionPoint = QgsPoint( xi, yi ); + oneIntersectionPoint = QgsPointXY( xi, yi ); } GEOSGeom_destroy_r( geosinit.ctxt, intersectGeom ); } diff --git a/src/core/geometry/qgsgeos.h b/src/core/geometry/qgsgeos.h index 4c23c2addca..40d9fb08f63 100644 --- a/src/core/geometry/qgsgeos.h +++ b/src/core/geometry/qgsgeos.h @@ -53,8 +53,8 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine QgsAbstractGeometry *simplify( double tolerance, QString *errorMsg = nullptr ) const override; QgsAbstractGeometry *interpolate( double distance, QString *errorMsg = nullptr ) const override; QgsAbstractGeometry *envelope( QString *errorMsg = nullptr ) const override; - bool centroid( QgsPointV2 &pt, QString *errorMsg = nullptr ) const override; - bool pointOnSurface( QgsPointV2 &pt, QString *errorMsg = nullptr ) const override; + bool centroid( QgsPoint &pt, QString *errorMsg = nullptr ) const override; + bool pointOnSurface( QgsPoint &pt, QString *errorMsg = nullptr ) const override; QgsAbstractGeometry *convexHull( QString *errorMsg = nullptr ) const override; double distance( const QgsAbstractGeometry &geom, QString *errorMsg = nullptr ) const override; bool intersects( const QgsAbstractGeometry &geom, QString *errorMsg = nullptr ) const override; @@ -139,7 +139,7 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine * \note only valid for linestring geometries * \returns distance along line, or -1 on error */ - double lineLocatePoint( const QgsPointV2 &point, QString *errorMsg = nullptr ) const; + double lineLocatePoint( const QgsPoint &point, QString *errorMsg = nullptr ) const; /** * Creates a GeometryCollection geometry containing possible polygons formed from the constituent @@ -186,7 +186,7 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine static QgsAbstractGeometry *fromGeos( const GEOSGeometry *geos ); static QgsPolygonV2 *fromGeosPolygon( const GEOSGeometry *geos ); static GEOSGeometry *asGeos( const QgsAbstractGeometry *geom, double precision = 0 ); - static QgsPointV2 coordSeqPoint( const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM ); + static QgsPoint coordSeqPoint( const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM ); static GEOSContextHandle_t getGEOSHandler(); diff --git a/src/core/geometry/qgsinternalgeometryengine.cpp b/src/core/geometry/qgsinternalgeometryengine.cpp index 73ee2fdd8fc..524b395bf32 100644 --- a/src/core/geometry/qgsinternalgeometryengine.cpp +++ b/src/core/geometry/qgsinternalgeometryengine.cpp @@ -187,7 +187,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision, double cellSize = qMin( bounds.width(), bounds.height() ); if ( qgsDoubleNear( cellSize, 0.0 ) ) - return QgsGeometry( new QgsPointV2( bounds.xMinimum(), bounds.yMinimum() ) ); + return QgsGeometry( new QgsPoint( bounds.xMinimum(), bounds.yMinimum() ) ); double h = cellSize / 2.0; std::priority_queue< Cell *, std::vector, GreaterThanByMax > cellQueue; @@ -241,7 +241,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision, if ( distanceFromBoundary ) *distanceFromBoundary = bestCell->d; - return QgsGeometry( new QgsPointV2( bestCell->x, bestCell->y ) ); + return QgsGeometry( new QgsPoint( bestCell->x, bestCell->y ) ); } @@ -253,7 +253,7 @@ bool dotProductWithinAngleTolerance( double dotProduct, double lowerThreshold, d return lowerThreshold > qAbs( dotProduct ) || qAbs( dotProduct ) > upperThreshold; } -double normalizedDotProduct( const QgsPointV2 &a, const QgsPointV2 &b, const QgsPointV2 &c ) +double normalizedDotProduct( const QgsPoint &a, const QgsPoint &b, const QgsPoint &c ) { QgsVector p = a - b; QgsVector q = c - b; @@ -272,9 +272,9 @@ double squareness( QgsLineString *ring, double lowerThreshold, double upperThres bool isClosed = ring->isClosed(); int numPoints = ring->numPoints(); - QgsPointV2 a; - QgsPointV2 b; - QgsPointV2 c; + QgsPoint a; + QgsPoint b; + QgsPoint c; for ( int i = 0; i < numPoints; ++i ) { @@ -310,7 +310,7 @@ double squareness( QgsLineString *ring, double lowerThreshold, double upperThres return sum; } -QgsVector calcMotion( const QgsPointV2 &a, const QgsPointV2 &b, const QgsPointV2 &c, +QgsVector calcMotion( const QgsPoint &a, const QgsPoint &b, const QgsPoint &c, double lowerThreshold, double upperThreshold ) { QgsVector p = a - b; @@ -356,9 +356,9 @@ QgsLineString *doOrthogonalize( QgsLineString *ring, int iterations, double tole motions.reserve( numPoints ); // first loop through an calculate all motions - QgsPointV2 a; - QgsPointV2 b; - QgsPointV2 c; + QgsPoint a; + QgsPoint b; + QgsPoint c; for ( int i = 0; i < numPoints; ++i ) { if ( isClosed && i == numPoints - 1 ) diff --git a/src/core/geometry/qgslinestring.cpp b/src/core/geometry/qgslinestring.cpp index be6bd1d5ec2..94b00d32b9b 100644 --- a/src/core/geometry/qgslinestring.cpp +++ b/src/core/geometry/qgslinestring.cpp @@ -86,12 +86,12 @@ QgsLineString::QgsLineString( const QVector &x, const QVector &y } } -QgsLineString::QgsLineString( const QList &points ) +QgsLineString::QgsLineString( const QList &points ) { mWkbType = QgsWkbTypes::LineString; mX.reserve( points.size() ); mY.reserve( points.size() ); - Q_FOREACH ( const QgsPoint &p, points ) + Q_FOREACH ( const QgsPointXY &p, points ) { mX << p.x(); mY << p.y(); @@ -298,20 +298,20 @@ double QgsLineString::length() const return length; } -QgsPointV2 QgsLineString::startPoint() const +QgsPoint QgsLineString::startPoint() const { if ( numPoints() < 1 ) { - return QgsPointV2(); + return QgsPoint(); } return pointN( 0 ); } -QgsPointV2 QgsLineString::endPoint() const +QgsPoint QgsLineString::endPoint() const { if ( numPoints() < 1 ) { - return QgsPointV2(); + return QgsPoint(); } return pointN( numPoints() - 1 ); } @@ -334,11 +334,11 @@ int QgsLineString::numPoints() const return mX.size(); } -QgsPointV2 QgsLineString::pointN( int i ) const +QgsPoint QgsLineString::pointN( int i ) const { if ( i < 0 || i >= mX.size() ) { - return QgsPointV2(); + return QgsPoint(); } double x = mX.at( i ); @@ -374,7 +374,7 @@ QgsPointV2 QgsLineString::pointN( int i ) const { t = QgsWkbTypes::PointM; } - return QgsPointV2( t, x, y, z, m ); + return QgsPoint( t, x, y, z, m ); } /*************************************************************************** @@ -468,7 +468,7 @@ void QgsLineString::setPoints( const QgsPointSequence &points ) } //get wkb type from first point - const QgsPointV2 &firstPt = points.at( 0 ); + const QgsPoint &firstPt = points.at( 0 ); bool hasZ = firstPt.is3D(); bool hasM = firstPt.isMeasure(); @@ -708,7 +708,7 @@ void QgsLineString::transform( const QTransform &t ) * See details in QEP #17 ****************************************************************************/ -bool QgsLineString::insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) +bool QgsLineString::insertVertex( QgsVertexId position, const QgsPoint &vertex ) { if ( position.vertex < 0 || position.vertex > mX.size() ) { @@ -734,7 +734,7 @@ bool QgsLineString::insertVertex( QgsVertexId position, const QgsPointV2 &vertex return true; } -bool QgsLineString::moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) +bool QgsLineString::moveVertex( QgsVertexId position, const QgsPoint &newPos ) { if ( position.vertex < 0 || position.vertex >= mX.size() ) { @@ -787,7 +787,7 @@ bool QgsLineString::deleteVertex( QgsVertexId position ) * See details in QEP #17 ****************************************************************************/ -void QgsLineString::addVertex( const QgsPointV2 &pt ) +void QgsLineString::addVertex( const QgsPoint &pt ) { if ( mWkbType == QgsWkbTypes::Unknown || mX.isEmpty() ) { @@ -807,7 +807,7 @@ void QgsLineString::addVertex( const QgsPointV2 &pt ) clearCache(); //set bounding box invalid } -double QgsLineString::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const +double QgsLineString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const { double sqrDist = std::numeric_limits::max(); double testDist = 0; @@ -849,7 +849,7 @@ double QgsLineString::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentP * See details in QEP #17 ****************************************************************************/ -bool QgsLineString::pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const +bool QgsLineString::pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const { if ( node < 0 || node >= numPoints() ) { @@ -860,14 +860,14 @@ bool QgsLineString::pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexTyp return true; } -QgsPointV2 QgsLineString::centroid() const +QgsPoint QgsLineString::centroid() const { if ( mX.isEmpty() ) - return QgsPointV2(); + return QgsPoint(); int numPoints = mX.count(); if ( numPoints == 1 ) - return QgsPointV2( mX.at( 0 ), mY.at( 0 ) ); + return QgsPoint( mX.at( 0 ), mY.at( 0 ) ); double totalLineLength = 0.0; double prevX = mX.at( 0 ); @@ -892,9 +892,9 @@ QgsPointV2 QgsLineString::centroid() const } if ( qgsDoubleNear( totalLineLength, 0.0 ) ) - return QgsPointV2( mX.at( 0 ), mY.at( 0 ) ); + return QgsPoint( mX.at( 0 ), mY.at( 0 ) ); else - return QgsPointV2( sumX / totalLineLength, sumY / totalLineLength ); + return QgsPoint( sumX / totalLineLength, sumY / totalLineLength ); } diff --git a/src/core/geometry/qgslinestring.h b/src/core/geometry/qgslinestring.h index c134ddedcbd..95231d5b90c 100644 --- a/src/core/geometry/qgslinestring.h +++ b/src/core/geometry/qgslinestring.h @@ -60,7 +60,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve * or repeatedly calling addVertex() * \since QGIS 3.0 */ - QgsLineString( const QList &points ); + QgsLineString( const QList &points ); bool operator==( const QgsCurve &other ) const override; bool operator!=( const QgsCurve &other ) const override; @@ -68,7 +68,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve /** Returns the specified point from inside the line string. * \param i index of point, starting at 0 for the first point */ - QgsPointV2 pointN( int i ) const; + QgsPoint pointN( int i ) const; double xAt( int index ) const override; double yAt( int index ) const override; @@ -135,7 +135,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve /** Adds a new vertex to the end of the line string. * \param pt vertex to add */ - void addVertex( const QgsPointV2 &pt ); + void addVertex( const QgsPoint &pt ); //! Closes the line string by appending the first point to the end of the line, if it is not already closed. void close(); @@ -171,8 +171,8 @@ class CORE_EXPORT QgsLineString: public QgsCurve //curve interface virtual double length() const override; - virtual QgsPointV2 startPoint() const override; - virtual QgsPointV2 endPoint() const override; + virtual QgsPoint startPoint() const override; + virtual QgsPoint endPoint() const override; /** Returns a new line string geometry corresponding to a segmentized approximation * of the curve. @@ -193,18 +193,18 @@ class CORE_EXPORT QgsLineString: public QgsCurve void addToPainterPath( QPainterPath &path ) const override; void drawAsPolygon( QPainter &p ) const override; - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override; - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) override; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override; + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override; virtual bool deleteVertex( QgsVertexId position ) override; virtual QgsLineString *reversed() const override SIP_FACTORY; - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override; - bool pointAt( int node, QgsPointV2 &point, QgsVertexId::VertexType &type ) const override; + bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override; - virtual QgsPointV2 centroid() const override; + virtual QgsPoint centroid() const override; void sumUpArea( double &sum SIP_OUT ) const override; double vertexAngle( QgsVertexId vertex ) const override; diff --git a/src/core/geometry/qgsmulticurve.cpp b/src/core/geometry/qgsmulticurve.cpp index ff82882f373..4eb19ea1229 100644 --- a/src/core/geometry/qgsmulticurve.cpp +++ b/src/core/geometry/qgsmulticurve.cpp @@ -136,8 +136,8 @@ QgsAbstractGeometry *QgsMultiCurve::boundary() const { if ( !curve->isClosed() ) { - multiPoint->addGeometry( new QgsPointV2( curve->startPoint() ) ); - multiPoint->addGeometry( new QgsPointV2( curve->endPoint() ) ); + multiPoint->addGeometry( new QgsPoint( curve->startPoint() ) ); + multiPoint->addGeometry( new QgsPoint( curve->endPoint() ) ); } } } diff --git a/src/core/geometry/qgsmultipoint.cpp b/src/core/geometry/qgsmultipoint.cpp index 6037f3bb83c..fad3f67bd96 100644 --- a/src/core/geometry/qgsmultipoint.cpp +++ b/src/core/geometry/qgsmultipoint.cpp @@ -42,7 +42,7 @@ bool QgsMultiPointV2::fromWkt( const QString &wkt ) collectionWkt.replace( '(', QLatin1String( "((" ) ).replace( ')', QLatin1String( "))" ) ).replace( ',', QLatin1String( "),(" ) ); } - return fromCollectionWkt( collectionWkt, QList() << new QgsPointV2, QStringLiteral( "Point" ) ); + return fromCollectionWkt( collectionWkt, QList() << new QgsPoint, QStringLiteral( "Point" ) ); } QDomElement QgsMultiPointV2::asGML2( QDomDocument &doc, int precision, const QString &ns ) const @@ -50,7 +50,7 @@ QDomElement QgsMultiPointV2::asGML2( QDomDocument &doc, int precision, const QSt QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) ); Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries ) { - if ( dynamic_cast( geom ) ) + if ( dynamic_cast( geom ) ) { QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral( "pointMember" ) ); elemPointMember.appendChild( geom->asGML2( doc, precision, ns ) ); @@ -66,7 +66,7 @@ QDomElement QgsMultiPointV2::asGML3( QDomDocument &doc, int precision, const QSt QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) ); Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries ) { - if ( dynamic_cast( geom ) ) + if ( dynamic_cast( geom ) ) { QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral( "pointMember" ) ); elemPointMember.appendChild( geom->asGML3( doc, precision, ns ) ); @@ -84,9 +84,9 @@ QString QgsMultiPointV2::asJSON( int precision ) const QgsPointSequence pts; Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries ) { - if ( dynamic_cast( geom ) ) + if ( dynamic_cast( geom ) ) { - const QgsPointV2 *point = static_cast( geom ); + const QgsPoint *point = static_cast( geom ); pts << *point; } } @@ -97,7 +97,7 @@ QString QgsMultiPointV2::asJSON( int precision ) const bool QgsMultiPointV2::addGeometry( QgsAbstractGeometry *g ) { - if ( !dynamic_cast( g ) ) + if ( !dynamic_cast( g ) ) { delete g; return false; diff --git a/src/core/geometry/qgspointv2.cpp b/src/core/geometry/qgspointv2.cpp index 21e591de055..fe8a1011cbb 100644 --- a/src/core/geometry/qgspointv2.cpp +++ b/src/core/geometry/qgspointv2.cpp @@ -31,7 +31,7 @@ * See details in QEP #17 ****************************************************************************/ -QgsPointV2::QgsPointV2( double x, double y ) +QgsPoint::QgsPoint( double x, double y ) : QgsAbstractGeometry() , mX( x ) , mY( y ) @@ -41,7 +41,7 @@ QgsPointV2::QgsPointV2( double x, double y ) mWkbType = QgsWkbTypes::Point; } -QgsPointV2::QgsPointV2( const QgsPoint &p ) +QgsPoint::QgsPoint( const QgsPointXY &p ) : QgsAbstractGeometry() , mX( p.x() ) , mY( p.y() ) @@ -51,7 +51,7 @@ QgsPointV2::QgsPointV2( const QgsPoint &p ) mWkbType = QgsWkbTypes::Point; } -QgsPointV2::QgsPointV2( QPointF p ) +QgsPoint::QgsPoint( QPointF p ) : QgsAbstractGeometry() , mX( p.x() ) , mY( p.y() ) @@ -61,7 +61,7 @@ QgsPointV2::QgsPointV2( QPointF p ) mWkbType = QgsWkbTypes::Point; } -QgsPointV2::QgsPointV2( QgsWkbTypes::Type type, double x, double y, double z, double m ) +QgsPoint::QgsPoint( QgsWkbTypes::Type type, double x, double y, double z, double m ) : mX( x ) , mY( y ) , mZ( z ) @@ -78,7 +78,7 @@ QgsPointV2::QgsPointV2( QgsWkbTypes::Type type, double x, double y, double z, do * See details in QEP #17 ****************************************************************************/ -bool QgsPointV2::operator==( const QgsPointV2 &pt ) const +bool QgsPoint::operator==( const QgsPoint &pt ) const { return ( pt.wkbType() == wkbType() && qgsDoubleNear( pt.x(), mX, 1E-8 ) && @@ -87,17 +87,17 @@ bool QgsPointV2::operator==( const QgsPointV2 &pt ) const qgsDoubleNear( pt.m(), mM, 1E-8 ) ); } -bool QgsPointV2::operator!=( const QgsPointV2 &pt ) const +bool QgsPoint::operator!=( const QgsPoint &pt ) const { return !operator==( pt ); } -QgsPointV2 *QgsPointV2::clone() const +QgsPoint *QgsPoint::clone() const { - return new QgsPointV2( *this ); + return new QgsPoint( *this ); } -bool QgsPointV2::fromWkb( QgsConstWkbPtr &wkbPtr ) +bool QgsPoint::fromWkb( QgsConstWkbPtr &wkbPtr ) { QgsWkbTypes::Type type = wkbPtr.readHeader(); if ( QgsWkbTypes::flatType( type ) != QgsWkbTypes::Point ) @@ -125,7 +125,7 @@ bool QgsPointV2::fromWkb( QgsConstWkbPtr &wkbPtr ) * See details in QEP #17 ****************************************************************************/ -bool QgsPointV2::fromWkt( const QString &wkt ) +bool QgsPoint::fromWkt( const QString &wkt ) { clear(); @@ -173,7 +173,7 @@ bool QgsPointV2::fromWkt( const QString &wkt ) * See details in QEP #17 ****************************************************************************/ -QByteArray QgsPointV2::asWkb() const +QByteArray QgsPoint::asWkb() const { int binarySize = sizeof( char ) + sizeof( quint32 ); binarySize += ( 2 + is3D() + isMeasure() ) * sizeof( double ); @@ -195,7 +195,7 @@ QByteArray QgsPointV2::asWkb() const return wkbArray; } -QString QgsPointV2::asWkt( int precision ) const +QString QgsPoint::asWkt( int precision ) const { QString wkt = wktTypeStr() + " ("; wkt += qgsDoubleToString( mX, precision ) + ' ' + qgsDoubleToString( mY, precision ); @@ -207,7 +207,7 @@ QString QgsPointV2::asWkt( int precision ) const return wkt; } -QDomElement QgsPointV2::asGML2( QDomDocument &doc, int precision, const QString &ns ) const +QDomElement QgsPoint::asGML2( QDomDocument &doc, int precision, const QString &ns ) const { QDomElement elemPoint = doc.createElementNS( ns, QStringLiteral( "Point" ) ); QDomElement elemCoordinates = doc.createElementNS( ns, QStringLiteral( "coordinates" ) ); @@ -217,7 +217,7 @@ QDomElement QgsPointV2::asGML2( QDomDocument &doc, int precision, const QString return elemPoint; } -QDomElement QgsPointV2::asGML3( QDomDocument &doc, int precision, const QString &ns ) const +QDomElement QgsPoint::asGML3( QDomDocument &doc, int precision, const QString &ns ) const { QDomElement elemPoint = doc.createElementNS( ns, QStringLiteral( "Point" ) ); QDomElement elemPosList = doc.createElementNS( ns, QStringLiteral( "pos" ) ); @@ -237,25 +237,25 @@ QDomElement QgsPointV2::asGML3( QDomDocument &doc, int precision, const QString * See details in QEP #17 ****************************************************************************/ -QString QgsPointV2::asJSON( int precision ) const +QString QgsPoint::asJSON( int precision ) const { return "{\"type\": \"Point\", \"coordinates\": [" + qgsDoubleToString( mX, precision ) + ", " + qgsDoubleToString( mY, precision ) + "]}"; } -void QgsPointV2::draw( QPainter &p ) const +void QgsPoint::draw( QPainter &p ) const { p.drawRect( mX - 2, mY - 2, 4, 4 ); } -void QgsPointV2::clear() +void QgsPoint::clear() { mX = mY = mZ = mM = 0.; clearCache(); } -void QgsPointV2::transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d, bool transformZ ) +void QgsPoint::transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d, bool transformZ ) { clearCache(); if ( transformZ ) @@ -269,17 +269,17 @@ void QgsPointV2::transform( const QgsCoordinateTransform &ct, QgsCoordinateTrans } } -QgsCoordinateSequence QgsPointV2::coordinateSequence() const +QgsCoordinateSequence QgsPoint::coordinateSequence() const { QgsCoordinateSequence cs; cs.append( QgsRingSequence() ); - cs.back().append( QgsPointSequence() << QgsPointV2( *this ) ); + cs.back().append( QgsPointSequence() << QgsPoint( *this ) ); return cs; } -QgsAbstractGeometry *QgsPointV2::boundary() const +QgsAbstractGeometry *QgsPoint::boundary() const { return nullptr; } @@ -290,7 +290,7 @@ QgsAbstractGeometry *QgsPointV2::boundary() const * See details in QEP #17 ****************************************************************************/ -bool QgsPointV2::moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) +bool QgsPoint::moveVertex( QgsVertexId position, const QgsPoint &newPos ) { Q_UNUSED( position ); clearCache(); @@ -307,7 +307,7 @@ bool QgsPointV2::moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) return true; } -double QgsPointV2::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const +double QgsPoint::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const { Q_UNUSED( pt ); Q_UNUSED( segmentPt ); @@ -317,7 +317,7 @@ double QgsPointV2::closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt, return -1; // no segments - return error } -bool QgsPointV2::nextVertex( QgsVertexId &id, QgsPointV2 &vertex ) const +bool QgsPoint::nextVertex( QgsVertexId &id, QgsPoint &vertex ) const { if ( id.vertex < 0 ) { @@ -345,7 +345,7 @@ bool QgsPointV2::nextVertex( QgsVertexId &id, QgsPointV2 &vertex ) const * See details in QEP #17 ****************************************************************************/ -bool QgsPointV2::addZValue( double zValue ) +bool QgsPoint::addZValue( double zValue ) { if ( QgsWkbTypes::hasZ( mWkbType ) ) return false; @@ -356,7 +356,7 @@ bool QgsPointV2::addZValue( double zValue ) return true; } -bool QgsPointV2::addMValue( double mValue ) +bool QgsPoint::addMValue( double mValue ) { if ( QgsWkbTypes::hasM( mWkbType ) ) return false; @@ -367,7 +367,7 @@ bool QgsPointV2::addMValue( double mValue ) return true; } -void QgsPointV2::transform( const QTransform &t ) +void QgsPoint::transform( const QTransform &t ) { clearCache(); qreal x, y; @@ -377,7 +377,7 @@ void QgsPointV2::transform( const QTransform &t ) } -bool QgsPointV2::dropZValue() +bool QgsPoint::dropZValue() { if ( !is3D() ) return false; @@ -388,7 +388,7 @@ bool QgsPointV2::dropZValue() return true; } -bool QgsPointV2::dropMValue() +bool QgsPoint::dropMValue() { if ( !isMeasure() ) return false; @@ -399,7 +399,7 @@ bool QgsPointV2::dropMValue() return true; } -bool QgsPointV2::convertTo( QgsWkbTypes::Type type ) +bool QgsPoint::convertTo( QgsWkbTypes::Type type ) { if ( type == mWkbType ) return true; @@ -433,59 +433,59 @@ bool QgsPointV2::convertTo( QgsWkbTypes::Type type ) } -QPointF QgsPointV2::toQPointF() const +QPointF QgsPoint::toQPointF() const { return QPointF( mX, mY ); } -double QgsPointV2::distance( double x, double y ) const +double QgsPoint::distance( double x, double y ) const { return sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) ); } -double QgsPointV2::distance( const QgsPointV2 &other ) const +double QgsPoint::distance( const QgsPoint &other ) const { return sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) ); } -double QgsPointV2::distanceSquared( double x, double y ) const +double QgsPoint::distanceSquared( double x, double y ) const { return ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ); } -double QgsPointV2::distanceSquared( const QgsPointV2 &other ) const +double QgsPoint::distanceSquared( const QgsPoint &other ) const { return ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) ; } -double QgsPointV2::distance3D( double x, double y, double z ) const +double QgsPoint::distance3D( double x, double y, double z ) const { return sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) + ( mZ - z ) * ( mZ - z ) ); } -double QgsPointV2::distance3D( const QgsPointV2 &other ) const +double QgsPoint::distance3D( const QgsPoint &other ) const { return sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) + ( mZ - other.z() ) * ( mZ - other.z() ) ); } -double QgsPointV2::distanceSquared3D( double x, double y, double z ) const +double QgsPoint::distanceSquared3D( double x, double y, double z ) const { return ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) + ( mZ - z ) * ( mZ - z ); } -double QgsPointV2::distanceSquared3D( const QgsPointV2 &other ) const +double QgsPoint::distanceSquared3D( const QgsPoint &other ) const { return ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) + ( mZ - other.z() ) * ( mZ - other.z() ); } -double QgsPointV2::azimuth( const QgsPointV2 &other ) const +double QgsPoint::azimuth( const QgsPoint &other ) const { double dx = other.x() - mX; double dy = other.y() - mY; return ( atan2( dx, dy ) * 180.0 / M_PI ); } -double QgsPointV2::inclination( const QgsPointV2 &other ) const +double QgsPoint::inclination( const QgsPoint &other ) const { double distance = distance3D( other ); if ( qgsDoubleNear( distance, 0.0 ) ) @@ -497,7 +497,7 @@ double QgsPointV2::inclination( const QgsPointV2 &other ) const return ( acos( dz / distance ) * 180.0 / M_PI ); } -QgsPointV2 QgsPointV2::project( double distance, double azimuth, double inclination ) const +QgsPoint QgsPoint::project( double distance, double azimuth, double inclination ) const { QgsWkbTypes::Type pType( QgsWkbTypes::Point ); @@ -525,5 +525,5 @@ QgsPointV2 QgsPointV2::project( double distance, double azimuth, double inclinat pType = QgsWkbTypes::addM( pType ); } - return QgsPointV2( pType, mX + dx, mY + dy, mZ + dz, mM ); + return QgsPoint( pType, mX + dx, mY + dy, mZ + dz, mM ); } diff --git a/src/core/geometry/qgspointv2.h b/src/core/geometry/qgspointv2.h index 14ca7ff6d9c..59d4931a71d 100644 --- a/src/core/geometry/qgspointv2.h +++ b/src/core/geometry/qgspointv2.h @@ -34,7 +34,7 @@ * \brief Point geometry type, with support for z-dimension and m-values. * \since QGIS 2.10 */ -class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry +class CORE_EXPORT QgsPoint: public QgsAbstractGeometry { Q_GADGET @@ -49,15 +49,15 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * \param x x-coordinate of point * \param y y-coordinate of point */ - QgsPointV2( double x = 0.0, double y = 0.0 ); + QgsPoint( double x = 0.0, double y = 0.0 ); - /** Construct a QgsPointV2 from a QgsPoint object + /** Construct a QgsPoint from a QgsPointXY object */ - explicit QgsPointV2( const QgsPoint &p ); + explicit QgsPoint( const QgsPointXY &p ); - /** Construct a QgsPointV2 from a QPointF + /** Construct a QgsPoint from a QPointF */ - explicit QgsPointV2( QPointF p ); + explicit QgsPoint( QPointF p ); /** Construct a point with a specified type (e.g., PointZ, PointM) and initial x, y, z, and m values. * \param type point type @@ -66,7 +66,7 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * \param z z-coordinate of point, for PointZ or PointZM types * \param m m-value of point, for PointM or PointZM types */ - QgsPointV2( QgsWkbTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 ); + QgsPoint( QgsWkbTypes::Type type, double x = 0.0, double y = 0.0, double z = 0.0, double m = 0.0 ); #ifdef SIP_RUN % MethodCode if ( QgsWkbTypes::flatType( a0 ) != QgsWkbTypes::Point ) @@ -77,13 +77,13 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry } else { - sipCpp = new sipQgsPointV2( a0, a1, a2, a3, a4 ); + sipCpp = new sipQgsPoint( a0, a1, a2, a3, a4 ); } % End #endif - bool operator==( const QgsPointV2 &pt ) const; - bool operator!=( const QgsPointV2 &pt ) const; + bool operator==( const QgsPoint &pt ) const; + bool operator!=( const QgsPoint &pt ) const; /** Returns the point's x-coordinate. * \see setX() @@ -189,7 +189,7 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * when comparing distances. * \since QGIS 3.0 */ - double distance( const QgsPointV2 &other ) const; + double distance( const QgsPoint &other ) const; /** * Returns the squared distance between this point a specified x, y coordinate. Calling @@ -207,7 +207,7 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * \see distance() * \since QGIS 3.0 */ - double distanceSquared( const QgsPointV2 &other ) const; + double distanceSquared( const QgsPoint &other ) const; /** * Returns the 3D distance between this point and a specified x, y, z coordinate. In certain @@ -224,7 +224,7 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * when comparing distances. * \since QGIS 3.0 */ - double distance3D( const QgsPointV2 &other ) const; + double distance3D( const QgsPoint &other ) const; /** * Returns the 3D squared distance between this point a specified x, y, z coordinate. Calling @@ -242,20 +242,20 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * \see distance() * \since QGIS 3.0 */ - double distanceSquared3D( const QgsPointV2 &other ) const; + double distanceSquared3D( const QgsPoint &other ) const; /** * Calculates azimuth between this point and other one (clockwise in degree, starting from north) * \since QGIS 3.0 */ - double azimuth( const QgsPointV2 &other ) const; + double azimuth( const QgsPoint &other ) const; /** * Calculates inclination between this point and other one (starting from zenith = 0 to nadir = 180. Horizon = 90) * Returns 90.0 if the distance between this point and other one is equal to 0 (same point). * \since QGIS 3.0 */ - double inclination( const QgsPointV2 &other ) const; + double inclination( const QgsPoint &other ) const; /** Returns a new point which correspond to this point projected by a specified distance * with specified angles (azimuth and inclination). @@ -267,14 +267,14 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * inclination is 90. A 3D point is always returned if a 3D point is projected. * Example: * \code{.py} - * p = QgsPointV2( 1, 2 ) # 2D point + * p = QgsPoint( 1, 2 ) # 2D point * pr = p.project ( 1, 0 ) * # pr is a 2D point: 'Point (1 3)' * pr = p.project ( 1, 0, 90 ) * # pr is a 2D point: 'Point (1 3)' * pr = p.project (1, 0, 0 ) * # pr is a 3D point: 'PointZ (1 2 1)' - * p = QgsPointV2( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point + * p = QgsPoint( QgsWkbTypes.PointZ, 1, 2, 2 ) # 3D point * pr = p.project ( 1, 0 ) * # pr is a 3D point: 'PointZ (1 3 2)' * pr = p.project ( 1, 0, 90 ) @@ -284,44 +284,44 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry * \endcode * \since QGIS 3.0 */ - QgsPointV2 project( double distance, double azimuth, double inclination = 90.0 ) const; + QgsPoint project( double distance, double azimuth, double inclination = 90.0 ) const; /** * Calculates the vector obtained by subtracting a point from this point. * \since QGIS 3.0 */ - QgsVector operator-( const QgsPointV2 &p ) const { return QgsVector( mX - p.mX, mY - p.mY ); } + QgsVector operator-( const QgsPoint &p ) const { return QgsVector( mX - p.mX, mY - p.mY ); } /** * Adds a vector to this point in place. * \since QGIS 3.0 */ - QgsPointV2 &operator+=( QgsVector v ) { mX += v.x(); mY += v.y(); return *this; } + QgsPoint &operator+=( QgsVector v ) { mX += v.x(); mY += v.y(); return *this; } /** * Subtracts a vector from this point in place. * \since QGIS 3.0 */ - QgsPointV2 &operator-=( QgsVector v ) { mX -= v.x(); mY -= v.y(); return *this; } + QgsPoint &operator-=( QgsVector v ) { mX -= v.x(); mY -= v.y(); return *this; } /** * Adds a vector to this point. * \since QGIS 3.0 */ - QgsPointV2 operator+( QgsVector v ) const { QgsPointV2 r = *this; r.rx() += v.x(); r.ry() += v.y(); return r; } + QgsPoint operator+( QgsVector v ) const { QgsPoint r = *this; r.rx() += v.x(); r.ry() += v.y(); return r; } /** * Subtracts a vector from this point. * \since QGIS 3.0 */ - QgsPointV2 operator-( QgsVector v ) const { QgsPointV2 r = *this; r.rx() -= v.x(); r.ry() -= v.y(); return r; } + QgsPoint operator-( QgsVector v ) const { QgsPoint r = *this; r.rx() -= v.x(); r.ry() -= v.y(); return r; } //implementation of inherited methods bool isEmpty() const override { return false; } virtual QgsRectangle boundingBox() const override { return QgsRectangle( mX, mY, mX, mY ); } virtual QString geometryType() const override { return QStringLiteral( "Point" ); } virtual int dimension() const override { return 0; } - virtual QgsPointV2 *clone() const override SIP_FACTORY; + virtual QgsPoint *clone() const override SIP_FACTORY; void clear() override; virtual bool fromWkb( QgsConstWkbPtr &wkb ) override; virtual bool fromWkt( const QString &wkt ) override; @@ -339,14 +339,14 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry virtual QgsAbstractGeometry *boundary() const override SIP_FACTORY; //low-level editing - virtual bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override { Q_UNUSED( position ); Q_UNUSED( vertex ); return false; } - virtual bool moveVertex( QgsVertexId position, const QgsPointV2 &newPos ) override; + virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override { Q_UNUSED( position ); Q_UNUSED( vertex ); return false; } + virtual bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override; virtual bool deleteVertex( QgsVertexId position ) override { Q_UNUSED( position ); return false; } - virtual double closestSegment( const QgsPointV2 &pt, QgsPointV2 &segmentPt SIP_OUT, + virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override; - bool nextVertex( QgsVertexId &id, QgsPointV2 &vertex SIP_OUT ) const override; + bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override; /** Angle undefined. Always returns 0.0 \param vertex the vertex id @@ -356,7 +356,7 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry virtual int vertexCount( int /*part*/ = 0, int /*ring*/ = 0 ) const override { return 1; } virtual int ringCount( int /*part*/ = 0 ) const override { return 1; } virtual int partCount() const override { return 1; } - virtual QgsPointV2 vertexAt( QgsVertexId /*id*/ ) const override { return *this; } + virtual QgsPoint vertexAt( QgsVertexId /*id*/ ) const override { return *this; } virtual bool addZValue( double zValue = 0 ) override; virtual bool addMValue( double mValue = 0 ) override; diff --git a/src/core/geometry/qgsrectangle.cpp b/src/core/geometry/qgsrectangle.cpp index 6278fe50eb7..ad439f1c28d 100644 --- a/src/core/geometry/qgsrectangle.cpp +++ b/src/core/geometry/qgsrectangle.cpp @@ -39,7 +39,7 @@ QgsRectangle::QgsRectangle( double xMin, double yMin, double xMax, double yMax ) normalize(); } -QgsRectangle::QgsRectangle( const QgsPoint &p1, const QgsPoint &p2 ) +QgsRectangle::QgsRectangle( const QgsPointXY &p1, const QgsPointXY &p2 ) { set( p1, p2 ); } @@ -60,7 +60,7 @@ QgsRectangle::QgsRectangle( const QgsRectangle &r ) mYmax = r.yMaximum(); } -void QgsRectangle::set( const QgsPoint &p1, const QgsPoint &p2 ) +void QgsRectangle::set( const QgsPointXY &p1, const QgsPointXY &p2 ) { mXmin = p1.x(); mXmax = p2.x(); @@ -101,7 +101,7 @@ void QgsRectangle::setMinimal() mYmax = -std::numeric_limits::max(); } -void QgsRectangle::scale( double scaleFactor, const QgsPoint *cp ) +void QgsRectangle::scale( double scaleFactor, const QgsPointXY *cp ) { // scale from the center double centerX, centerY; @@ -136,7 +136,7 @@ void QgsRectangle::grow( double delta ) mYmax += delta; } -void QgsRectangle::include( const QgsPoint &p ) +void QgsRectangle::include( const QgsPointXY &p ) { if ( p.x() < xMinimum() ) setXMinimum( p.x() ); @@ -187,7 +187,7 @@ bool QgsRectangle::contains( const QgsRectangle &rect ) const return ( rect.mXmin >= mXmin && rect.mXmax <= mXmax && rect.mYmin >= mYmin && rect.mYmax <= mYmax ); } -bool QgsRectangle::contains( const QgsPoint &p ) const +bool QgsRectangle::contains( const QgsPointXY &p ) const { return mXmin <= p.x() && p.x() <= mXmax && mYmin <= p.y() && p.y() <= mYmax; diff --git a/src/core/geometry/qgsrectangle.h b/src/core/geometry/qgsrectangle.h index 6099f39c524..b35ed582555 100644 --- a/src/core/geometry/qgsrectangle.h +++ b/src/core/geometry/qgsrectangle.h @@ -41,7 +41,7 @@ class CORE_EXPORT QgsRectangle //! Constructor QgsRectangle( double xMin = 0, double yMin = 0, double xMax = 0, double yMax = 0 ); //! Construct a rectangle from two points. The rectangle is normalized after construction. - QgsRectangle( const QgsPoint &p1, const QgsPoint &p2 ); + QgsRectangle( const QgsPointXY &p1, const QgsPointXY &p2 ); //! Construct a rectangle from a QRectF. The rectangle is normalized after construction. QgsRectangle( const QRectF &qRectF ); //! Copy constructor @@ -51,7 +51,7 @@ class CORE_EXPORT QgsRectangle * Sets the rectangle from two QgsPoints. The rectangle is * normalised after construction. */ - void set( const QgsPoint &p1, const QgsPoint &p2 ); + void set( const QgsPointXY &p1, const QgsPointXY &p2 ); /** * Sets the rectangle from four points. The rectangle is @@ -143,12 +143,12 @@ class CORE_EXPORT QgsRectangle /** * Returns the center point of the rectangle. */ - QgsPoint center() const { return QgsPoint( mXmin + width() / 2, mYmin + height() / 2 ); } + QgsPointXY center() const { return QgsPointXY( mXmin + width() / 2, mYmin + height() / 2 ); } /** * Scale the rectangle around its center point. */ - void scale( double scaleFactor, const QgsPoint *c = nullptr ); + void scale( double scaleFactor, const QgsPointXY *c = nullptr ); /** * Scale the rectangle around its center point. @@ -163,7 +163,7 @@ class CORE_EXPORT QgsRectangle /** * Updates the rectangle to include the specified point. */ - void include( const QgsPoint &p ); + void include( const QgsPointXY &p ); /** * Get rectangle enlarged by buffer. @@ -189,7 +189,7 @@ class CORE_EXPORT QgsRectangle /** * Return true when rectangle contains a point. */ - bool contains( const QgsPoint &p ) const; + bool contains( const QgsPointXY &p ) const; /** * Expand the rectangle so that covers both the original rectangle and the given rectangle. diff --git a/src/core/geometry/qgsregularpolygon.cpp b/src/core/geometry/qgsregularpolygon.cpp index 25bc040c3d1..a0b8394c6bb 100644 --- a/src/core/geometry/qgsregularpolygon.cpp +++ b/src/core/geometry/qgsregularpolygon.cpp @@ -21,8 +21,8 @@ #include QgsRegularPolygon::QgsRegularPolygon() - : mCenter( QgsPointV2() ) - , mFirstVertex( QgsPointV2() ) + : mCenter( QgsPoint() ) + , mFirstVertex( QgsPoint() ) , mNumberSides( 0 ) , mRadius( 0.0 ) { @@ -30,9 +30,9 @@ QgsRegularPolygon::QgsRegularPolygon() } -QgsRegularPolygon::QgsRegularPolygon( const QgsPointV2 ¢er, const double radius, const double azimuth, const int numSides, const ConstructionOption circle ) +QgsRegularPolygon::QgsRegularPolygon( const QgsPoint ¢er, const double radius, const double azimuth, const int numSides, const ConstructionOption circle ) : mCenter( center ) - , mFirstVertex( QgsPointV2() ) + , mFirstVertex( QgsPoint() ) , mNumberSides( 0 ) , mRadius( 0.0 ) { @@ -64,9 +64,9 @@ QgsRegularPolygon::QgsRegularPolygon( const QgsPointV2 ¢er, const double rad } -QgsRegularPolygon::QgsRegularPolygon( const QgsPointV2 ¢er, const QgsPointV2 &pt1, const int numSides, const ConstructionOption circle ) +QgsRegularPolygon::QgsRegularPolygon( const QgsPoint ¢er, const QgsPoint &pt1, const int numSides, const ConstructionOption circle ) : mCenter( center ) - , mFirstVertex( QgsPointV2() ) + , mFirstVertex( QgsPoint() ) , mNumberSides( 0 ) , mRadius( 0.0 ) { @@ -98,9 +98,9 @@ QgsRegularPolygon::QgsRegularPolygon( const QgsPointV2 ¢er, const QgsPointV2 } -QgsRegularPolygon::QgsRegularPolygon( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const int numSides ) - : mCenter( QgsPointV2() ) - , mFirstVertex( QgsPointV2() ) +QgsRegularPolygon::QgsRegularPolygon( const QgsPoint &pt1, const QgsPoint &pt2, const int numSides ) + : mCenter( QgsPoint() ) + , mFirstVertex( QgsPoint() ) , mNumberSides( 0 ) , mRadius( 0.0 ) { @@ -109,7 +109,7 @@ QgsRegularPolygon::QgsRegularPolygon( const QgsPointV2 &pt1, const QgsPointV2 &p mNumberSides = numSides; double azimuth = pt1.azimuth( pt2 ); - QgsPointV2 pm = QgsGeometryUtils::midpoint( pt1, pt2 ); + QgsPoint pm = QgsGeometryUtils::midpoint( pt1, pt2 ); double length = pt1.distance( pm ); double angle = ( 180 - ( 360 / numSides ) ) / 2.0; @@ -142,7 +142,7 @@ bool QgsRegularPolygon::isEmpty() const ); } -void QgsRegularPolygon::setCenter( const QgsPointV2 ¢er ) +void QgsRegularPolygon::setCenter( const QgsPoint ¢er ) { double azimuth = mCenter.azimuth( mFirstVertex ); // TODO: double inclination = mCenter.inclination(mFirstVertex); @@ -158,7 +158,7 @@ void QgsRegularPolygon::setRadius( const double radius ) mFirstVertex = mCenter.project( mRadius, azimuth ); } -void QgsRegularPolygon::setFirstVertex( const QgsPointV2 &firstVertex ) +void QgsRegularPolygon::setFirstVertex( const QgsPoint &firstVertex ) { double azimuth = mCenter.azimuth( mFirstVertex ); // TODO: double inclination = mCenter.inclination(firstVertex); diff --git a/src/core/geometry/qgsregularpolygon.h b/src/core/geometry/qgsregularpolygon.h index 96332b8832c..a6185d842bc 100644 --- a/src/core/geometry/qgsregularpolygon.h +++ b/src/core/geometry/qgsregularpolygon.h @@ -60,7 +60,7 @@ class CORE_EXPORT QgsRegularPolygon * \param numberSides Number of sides of the regular polygon. * \param circle Option to create the polygon. \see ConstructionOption */ - QgsRegularPolygon( const QgsPointV2 ¢er, const double radius, const double azimuth, const int numberSides, const ConstructionOption circle ); + QgsRegularPolygon( const QgsPoint ¢er, const double radius, const double azimuth, const int numberSides, const ConstructionOption circle ); /** Constructs a regular polygon by \a center and another point. * \param center The center of the regular polygon. @@ -68,14 +68,14 @@ class CORE_EXPORT QgsRegularPolygon * \param numberSides Number of sides of the regular polygon. * \param circle Option to create the polygon inscribed in circle (the radius is the distance between the center and vertices) or circumscribed about circle (the radius is the distance from the center to the midpoints of the sides). */ - QgsRegularPolygon( const QgsPointV2 ¢er, const QgsPointV2 &pt1, const int numberSides, const ConstructionOption circle ); + QgsRegularPolygon( const QgsPoint ¢er, const QgsPoint &pt1, const int numberSides, const ConstructionOption circle ); /** Constructs a regular polygon by two points of the first side. * \param pt1 The first vertex of the first side, also first vertex of the regular polygon. * \param pt2 The second vertex of the first side. * \param numberSides Number of sides of the regular polygon. */ - QgsRegularPolygon( const QgsPointV2 &pt1, const QgsPointV2 &pt2, const int numberSides ); + QgsRegularPolygon( const QgsPoint &pt1, const QgsPoint &pt2, const int numberSides ); bool operator ==( const QgsRegularPolygon &rp ) const; bool operator !=( const QgsRegularPolygon &rp ) const; @@ -86,7 +86,7 @@ class CORE_EXPORT QgsRegularPolygon /** Returns the center point of the regular polygon. * \see setCenter() */ - QgsPointV2 center() const { return mCenter; } + QgsPoint center() const { return mCenter; } /** Returns the radius. * This is also the radius of the circumscribing circle. @@ -98,7 +98,7 @@ class CORE_EXPORT QgsRegularPolygon /** Returns the first vertex (corner) of the regular polygon. * \see setFirstVertex() */ - QgsPointV2 firstVertex() const { return mFirstVertex; } + QgsPoint firstVertex() const { return mFirstVertex; } /** Returns the apothem of the regular polygon. * The apothem is the radius of the inscribed circle. @@ -115,7 +115,7 @@ class CORE_EXPORT QgsRegularPolygon * Radius is unchanged. The first vertex is reprojected from the new center. * \see center() */ - void setCenter( const QgsPointV2 ¢er ); + void setCenter( const QgsPoint ¢er ); /** Sets the radius. * Center is unchanged. The first vertex is reprojected from the center with the new radius. @@ -127,7 +127,7 @@ class CORE_EXPORT QgsRegularPolygon * Radius is unchanged. The center is reprojected from the new first vertex. * \see firstVertex() */ - void setFirstVertex( const QgsPointV2 &firstVertex ); + void setFirstVertex( const QgsPoint &firstVertex ); /** Sets the number of sides. * If numberSides < 3, the number of sides is unchanged. @@ -195,8 +195,8 @@ class CORE_EXPORT QgsRegularPolygon double length( ) const; private: - QgsPointV2 mCenter; - QgsPointV2 mFirstVertex; + QgsPoint mCenter; + QgsPoint mFirstVertex; unsigned int mNumberSides; double mRadius; diff --git a/src/core/geometry/qgstriangle.cpp b/src/core/geometry/qgstriangle.cpp index 795878aa019..bb390874106 100644 --- a/src/core/geometry/qgstriangle.cpp +++ b/src/core/geometry/qgstriangle.cpp @@ -28,7 +28,7 @@ QgsTriangle::QgsTriangle() mWkbType = QgsWkbTypes::Triangle; } -QgsTriangle::QgsTriangle( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3 ) +QgsTriangle::QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) { mWkbType = QgsWkbTypes::Triangle; @@ -45,13 +45,13 @@ QgsTriangle::QgsTriangle( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsP } -QgsTriangle::QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) +QgsTriangle::QgsTriangle( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3 ) : QgsPolygonV2() { mWkbType = QgsWkbTypes::Triangle; - QgsPointV2 pt1( p1 ); - QgsPointV2 pt2( p2 ); - QgsPointV2 pt3( p3 ); + QgsPoint pt1( p1 ); + QgsPoint pt2( p2 ); + QgsPoint pt3( p3 ); if ( !validateGeom( pt1, pt2, pt3 ) ) { @@ -69,9 +69,9 @@ QgsTriangle::QgsTriangle( const QPointF p1, const QPointF p2, const QPointF p3 ) : QgsPolygonV2() { mWkbType = QgsWkbTypes::Triangle; - QgsPointV2 pt1( p1 ); - QgsPointV2 pt2( p2 ); - QgsPointV2 pt3( p3 ); + QgsPoint pt1( p1 ); + QgsPoint pt2( p2 ); + QgsPoint pt3( p3 ); if ( !validateGeom( pt1, pt2, pt3 ) ) { @@ -250,14 +250,14 @@ bool QgsTriangle::deleteVertex( QgsVertexId position ) return false; } -bool QgsTriangle::insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) +bool QgsTriangle::insertVertex( QgsVertexId position, const QgsPoint &vertex ) { Q_UNUSED( position ); Q_UNUSED( vertex ); return false; } #include -bool QgsTriangle::moveVertex( QgsVertexId vId, const QgsPointV2 &newPos ) +bool QgsTriangle::moveVertex( QgsVertexId vId, const QgsPoint &newPos ) { if ( !mExteriorRing || vId.part != 0 || vId.ring != 0 || vId.vertex < 0 || vId.vertex > 4 ) { @@ -269,9 +269,9 @@ bool QgsTriangle::moveVertex( QgsVertexId vId, const QgsPointV2 &newPos ) vId.vertex = 0; } - QgsPointV2 p1( vId.vertex == 0 ? newPos : vertexAt( 0 ) ); - QgsPointV2 p2( vId.vertex == 1 ? newPos : vertexAt( 1 ) ); - QgsPointV2 p3( vId.vertex == 2 ? newPos : vertexAt( 2 ) ); + QgsPoint p1( vId.vertex == 0 ? newPos : vertexAt( 0 ) ); + QgsPoint p2( vId.vertex == 1 ? newPos : vertexAt( 1 ) ); + QgsPoint p3( vId.vertex == 2 ? newPos : vertexAt( 2 ) ); if ( !validateGeom( p1, p2, p3 ) ) { @@ -354,7 +354,7 @@ QgsAbstractGeometry *QgsTriangle::boundary() const return mExteriorRing->clone(); } -QgsPointV2 QgsTriangle::vertexAt( int atVertex ) const +QgsPoint QgsTriangle::vertexAt( int atVertex ) const { QgsVertexId id( 0, 0, atVertex ); return mExteriorRing->vertexAt( id ); @@ -464,8 +464,8 @@ QVector QgsTriangle::bisectors( double lengthTolerance ) const QgsLineString bis1; QgsLineString bis2; QgsLineString bis3; - QgsPointV2 incenter = inscribedCenter(); - QgsPointV2 out; + QgsPoint incenter = inscribedCenter(); + QgsPoint out; QgsGeometryUtils::segmentIntersection( vertexAt( 0 ), incenter, vertexAt( 1 ), vertexAt( 2 ), out, lengthTolerance ); bis1.setPoints( QgsPointSequence() << vertexAt( 0 ) << out ); @@ -485,27 +485,27 @@ QVector QgsTriangle::bisectors( double lengthTolerance ) const QgsTriangle QgsTriangle::medial() const { - QgsPointV2 p1, p2, p3; + QgsPoint p1, p2, p3; p1 = QgsGeometryUtils::midpoint( vertexAt( 0 ), vertexAt( 1 ) ); p2 = QgsGeometryUtils::midpoint( vertexAt( 1 ), vertexAt( 2 ) ); p3 = QgsGeometryUtils::midpoint( vertexAt( 2 ), vertexAt( 0 ) ); return QgsTriangle( p1, p2, p3 ); } -QgsPointV2 QgsTriangle::orthocenter( double lengthTolerance ) const +QgsPoint QgsTriangle::orthocenter( double lengthTolerance ) const { QVector alt = altitudes(); - QgsPointV2 ortho; + QgsPoint ortho; QgsGeometryUtils::segmentIntersection( alt.at( 0 ).pointN( 0 ), alt.at( 0 ).pointN( 1 ), alt.at( 1 ).pointN( 0 ), alt.at( 1 ).pointN( 1 ), ortho, lengthTolerance ); return ortho; } -QgsPointV2 QgsTriangle::circumscribedCenter() const +QgsPoint QgsTriangle::circumscribedCenter() const { double r, x, y; QgsGeometryUtils::circleCenterRadius( vertexAt( 0 ), vertexAt( 1 ), vertexAt( 2 ), r, x, y ); - return QgsPointV2( x, y ); + return QgsPoint( x, y ); } double QgsTriangle::circumscribedRadius() const @@ -520,7 +520,7 @@ QgsCircle QgsTriangle::circumscribedCircle() const return QgsCircle( circumscribedCenter(), circumscribedRadius() ); } -QgsPointV2 QgsTriangle::inscribedCenter() const +QgsPoint QgsTriangle::inscribedCenter() const { QVector l = lengths(); @@ -531,7 +531,7 @@ QgsPointV2 QgsTriangle::inscribedCenter() const l.at( 1 ) * vertexAt( 0 ).y() + l.at( 2 ) * vertexAt( 1 ).y() ) / perimeter(); - return QgsPointV2( x, y ); + return QgsPoint( x, y ); } double QgsTriangle::inscribedRadius() const @@ -539,7 +539,7 @@ double QgsTriangle::inscribedRadius() const return ( 2.0 * area() / perimeter() ); } -bool QgsTriangle::validateGeom( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3 ) +bool QgsTriangle::validateGeom( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) { if ( ( ( p1 == p2 ) || ( p1 == p3 ) || ( p2 == p3 ) ) || qgsDoubleNear( QgsGeometryUtils::leftOfLine( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ), 0.0 ) ) { diff --git a/src/core/geometry/qgstriangle.h b/src/core/geometry/qgstriangle.h index 6c21c29e512..c401926b265 100644 --- a/src/core/geometry/qgstriangle.h +++ b/src/core/geometry/qgstriangle.h @@ -40,7 +40,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \param p2 second point * \param p3 third point */ - QgsTriangle( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3 ); + QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ); /** Construct a QgsTriangle from three QgsPoint. * An empty triangle is returned if there are identical points or if the points are collinear. @@ -48,7 +48,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \param p2 second point * \param p3 third point */ - explicit QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ); + explicit QgsTriangle( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3 ); /** Construct a QgsTriangle from three QPointF. * An empty triangle is returned if there are identical points or if the points are collinear. @@ -88,8 +88,8 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 //! Inherited method not used. You cannot delete or insert a vertex directly. Returns always false. bool deleteVertex( QgsVertexId position ) override; //! Inherited method not used. You cannot delete or insert a vertex directly. Returns always false. - bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ) override; - bool moveVertex( QgsVertexId vId, const QgsPointV2 &newPos ) override; + bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override; + bool moveVertex( QgsVertexId vId, const QgsPoint &newPos ) override; virtual void setExteriorRing( QgsCurve *ring SIP_TRANSFER ) override; @@ -100,16 +100,16 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 /** * Returns coordinates of a vertex. * \param atVertex index of the vertex - * \returns Coordinates of the vertex or QgsPointV2(0,0) on error (\a atVertex < 0 or > 3). + * \returns Coordinates of the vertex or QgsPoint(0,0) on error (\a atVertex < 0 or > 3). */ - QgsPointV2 vertexAt( int atVertex ) const; + QgsPoint vertexAt( int atVertex ) const; /** * Returns the three lengths of the triangle. * \returns Lengths of triangle ABC where [AB] is at 0, [BC] is at 1, [CA] is at 2 * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.lengths() * # [5.0, 5.0, 7.0710678118654755] * \endcode @@ -121,7 +121,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns Angles in radians of triangle ABC where angle BAC is at 0, angle ABC is at 1, angle BCA is at 2 * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * [math.degrees(i) for i in tri.angles()] * # [45.0, 90.0, 45.0] * \endcode @@ -134,7 +134,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns True or False * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.lengths() * # [5.0, 5.0, 7.0710678118654755] * tri.isIsocele() @@ -150,7 +150,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns True or False * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 10, 10 ), QgsPointV2( 16, 10 ), QgsPointV2( 13, 15.1962 ) ) + * tri = QgsTriangle( QgsPoint( 10, 10 ), QgsPoint( 16, 10 ), QgsPoint( 13, 15.1962 ) ) * tri.lengths() * # [6.0, 6.0000412031918575, 6.0000412031918575] * tri.isEquilateral() @@ -166,7 +166,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns True or False * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * [math.degrees(i) for i in tri.angles()] * # [45.0, 90.0, 45.0] * tri.isRight() @@ -183,7 +183,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns True or False * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 7.2825, 4.2368 ), QgsPointV2( 13.0058, 3.3218 ), QgsPointV2( 9.2145, 6.5242 ) ) + * tri = QgsTriangle( QgsPoint( 7.2825, 4.2368 ), QgsPoint( 13.0058, 3.3218 ), QgsPoint( 9.2145, 6.5242 ) ) * tri.lengths() * # [5.795980321740233, 4.962793714229921, 2.994131386562721] * tri.isScalene() @@ -198,7 +198,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns Three altitudes from this triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * [alt.asWkt() for alt in tri.altitudes()] * # ['LineString (0 0, 0 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 5)'] * \endcode @@ -210,7 +210,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns Three medians from this triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * [med.asWkt() for med in tri.medians()] * # ['LineString (0 0, 2.5 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 2.5)'] * \endcode @@ -223,7 +223,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns Three angle bisector from this triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * [bis.asWkt() for bis in tri.bisectors()] * # ['LineString (0 0, 2.07106781186547462 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 2.92893218813452538)'] * \endcode @@ -235,7 +235,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns The medial from this triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.medial().asWkt() * # 'Triangle ((0 2.5, 2.5 5, 2.5 2.5, 0 2.5))' * \endcode @@ -248,31 +248,31 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns The orthocenter of the triangle. * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.orthocenter().asWkt() * # 'Point (0 5)' * \endcode */ - QgsPointV2 orthocenter( double lengthTolerance = 0.0001 ) const; + QgsPoint orthocenter( double lengthTolerance = 0.0001 ) const; /** * Center of the circumscribed circle of the triangle. * \returns The center of the circumscribed circle of the triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.circumscribedCenter().asWkt() * # 'Point (2.5 2.5)' * \endcode */ - QgsPointV2 circumscribedCenter( ) const; + QgsPoint circumscribedCenter( ) const; /** * Radius of the circumscribed circle of the triangle. * \returns The radius of the circumscribed circle of the triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.circumscribedRadius() * # 3.5355339059327378 * \endcode @@ -284,7 +284,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * @return The circumbscribed of the triangle with a QgsCircle. * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.circumscribedCircle() * # QgsCircle(Point (2.5 2.5), 3.5355339059327378, 0) * \endcode @@ -296,19 +296,19 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns The center of the inscribed circle of the triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.inscribedCenter().asWkt() * # 'Point (1.46446609406726225 3.53553390593273775)' * \endcode */ - QgsPointV2 inscribedCenter( ) const; + QgsPoint inscribedCenter( ) const; /** * Radius of the inscribed circle of the triangle. * \returns The radius of the inscribed circle of the triangle * * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.inscribedRadius() * # 1.4644660940672622 * \endcode @@ -320,7 +320,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * @return The inscribed of the triangle with a QgsCircle. * Example: * \code{.py} - * tri = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ) + * tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ) * tri.inscribedCircle() * # QgsCircle(Point (1.46446609406726225 3.53553390593273775), 1.4644660940672622, 0) * \endcode @@ -337,7 +337,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygonV2 * \returns True if the points can create a triangle, otherwise false. * \note not available in Python bindings */ - bool validateGeom( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3 ) SIP_SKIP; + bool validateGeom( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) SIP_SKIP; }; #endif // QGSTRIANGLE_H diff --git a/src/core/processing/qgsprocessingalgorithm.cpp b/src/core/processing/qgsprocessingalgorithm.cpp index d02b9745acd..a1d8c33bcf5 100644 --- a/src/core/processing/qgsprocessingalgorithm.cpp +++ b/src/core/processing/qgsprocessingalgorithm.cpp @@ -147,7 +147,7 @@ QgsRectangle QgsProcessingAlgorithm::parameterAsExtent( const QVariantMap ¶m return QgsProcessingParameters::parameterAsExtent( parameterDefinition( name ), parameters, name, context ); } -QgsPoint QgsProcessingAlgorithm::parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const +QgsPointXY QgsProcessingAlgorithm::parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const { return QgsProcessingParameters::parameterAsPoint( parameterDefinition( name ), parameters, name, context ); } diff --git a/src/core/processing/qgsprocessingalgorithm.h b/src/core/processing/qgsprocessingalgorithm.h index 7283d8925b3..7f9d5614bb4 100644 --- a/src/core/processing/qgsprocessingalgorithm.h +++ b/src/core/processing/qgsprocessingalgorithm.h @@ -242,7 +242,7 @@ class CORE_EXPORT QgsProcessingAlgorithm /** * Evaluates the parameter with matching \a name to a point. */ - QgsPoint parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const; + QgsPointXY parameterAsPoint( const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) const; /** * Evaluates the parameter with matching \a name to a file/folder name. diff --git a/src/core/processing/qgsprocessingparameters.cpp b/src/core/processing/qgsprocessingparameters.cpp index 0b19baecf34..6ca98197c25 100644 --- a/src/core/processing/qgsprocessingparameters.cpp +++ b/src/core/processing/qgsprocessingparameters.cpp @@ -270,14 +270,14 @@ QgsRectangle QgsProcessingParameters::parameterAsExtent( const QgsProcessingPara return QgsRectangle(); } -QgsPoint QgsProcessingParameters::parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) +QgsPointXY QgsProcessingParameters::parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) { QString pointText = parameterAsString( definition, parameters, name, context ); if ( pointText.isEmpty() ) pointText = definition->defaultValue().toString(); if ( pointText.isEmpty() ) - return QgsPoint(); + return QgsPointXY(); QStringList parts = pointText.split( ',' ); if ( parts.count() == 2 ) @@ -287,10 +287,10 @@ QgsPoint QgsProcessingParameters::parameterAsPoint( const QgsProcessingParameter bool yOk = false; double y = parts.at( 1 ).toDouble( &yOk ); if ( xOk && yOk ) - return QgsPoint( x, y ); + return QgsPointXY( x, y ); } - return QgsPoint(); + return QgsPointXY(); } QString QgsProcessingParameters::parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ) diff --git a/src/core/processing/qgsprocessingparameters.h b/src/core/processing/qgsprocessingparameters.h index 16d5a3f7313..62b828dbafd 100644 --- a/src/core/processing/qgsprocessingparameters.h +++ b/src/core/processing/qgsprocessingparameters.h @@ -262,7 +262,7 @@ class CORE_EXPORT QgsProcessingParameters /** * Evaluates the parameter with matching \a name to a point. */ - static QgsPoint parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ); + static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QString &name, QgsProcessingContext &context ); /** * Evaluates the parameter with matching \a name to a file/folder name. diff --git a/src/core/qgsbearingutils.cpp b/src/core/qgsbearingutils.cpp index 0ba94138af3..21302d47760 100644 --- a/src/core/qgsbearingutils.cpp +++ b/src/core/qgsbearingutils.cpp @@ -21,7 +21,7 @@ #include "qgscoordinatetransform.h" #include "qgsexception.h" -double QgsBearingUtils::bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, const QgsPoint &point ) +double QgsBearingUtils::bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, const QgsPointXY &point ) { // step 1 - transform point into WGS84 geographic crs QgsCoordinateTransform transform( crs, QgsCoordinateReferenceSystem::fromEpsgId( 4326 ) ); @@ -35,14 +35,14 @@ double QgsBearingUtils::bearingTrueNorth( const QgsCoordinateReferenceSystem &cr if ( transform.isShortCircuited() ) return 0.0; - QgsPoint p1 = transform.transform( point ); + QgsPointXY p1 = transform.transform( point ); // shift point a tiny bit north - QgsPoint p2 = p1; + QgsPointXY p2 = p1; p2.setY( p2.y() + 0.000001 ); //transform back - QgsPoint p3 = transform.transform( p2, QgsCoordinateTransform::ReverseTransform ); + QgsPointXY p3 = transform.transform( p2, QgsCoordinateTransform::ReverseTransform ); // find bearing from point to p3 return point.azimuth( p3 ); diff --git a/src/core/qgsbearingutils.h b/src/core/qgsbearingutils.h index ccc6cdc1210..d1e07c42f36 100644 --- a/src/core/qgsbearingutils.h +++ b/src/core/qgsbearingutils.h @@ -19,7 +19,7 @@ #define QGSBEARINGUTILS_H class QgsCoordinateReferenceSystem; -class QgsPoint; +class QgsPointXY; #include "qgis_core.h" @@ -39,7 +39,7 @@ class CORE_EXPORT QgsBearingUtils * vertical. An exception will be thrown if the bearing could not be calculated. */ static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, - const QgsPoint &point ); + const QgsPointXY &point ); }; diff --git a/src/core/qgsclipper.h b/src/core/qgsclipper.h index 159f18f147f..679f9c304c5 100644 --- a/src/core/qgsclipper.h +++ b/src/core/qgsclipper.h @@ -129,9 +129,9 @@ class CORE_EXPORT QgsClipper // Calculates the intersection point between a line defined by a // (x1, y1), and (x2, y2) and the given boundary - static QgsPoint intersect( const double x1, const double y1, - const double x2, const double y2, - Boundary b ); + static QgsPointXY intersect( const double x1, const double y1, + const double x2, const double y2, + Boundary b ); static QPointF intersectRect( QPointF pt1, QPointF pt2, @@ -255,7 +255,7 @@ inline void QgsClipper::trimFeatureToBoundary( // store both ends of the new edge if ( !( i2 == 0 && shapeOpen ) ) { - QgsPoint p = intersect( inX[i1], inY[i1], inX[i2], inY[i2], b ); + QgsPointXY p = intersect( inX[i1], inY[i1], inX[i2], inY[i2], b ); outX.push_back( p.x() ); outY.push_back( p.y() ); } @@ -271,7 +271,7 @@ inline void QgsClipper::trimFeatureToBoundary( { if ( !( i2 == 0 && shapeOpen ) ) { - QgsPoint p = intersect( inX[i1], inY[i1], inX[i2], inY[i2], b ); + QgsPointXY p = intersect( inX[i1], inY[i1], inX[i2], inY[i2], b ); outX.push_back( p.x() ); outY.push_back( p.y() ); } @@ -363,9 +363,9 @@ inline bool QgsClipper::inside( QPointF pt, Boundary b, double val ) // returns the intersection of the line defined by the given points // and the given boundary. -inline QgsPoint QgsClipper::intersect( const double x1, const double y1, - const double x2, const double y2, - Boundary b ) +inline QgsPointXY QgsClipper::intersect( const double x1, const double y1, + const double x2, const double y2, + Boundary b ) { // This function assumes that the two given points (x1, y1), and // (x2, y2) cross the given boundary. Making this assumption allows @@ -393,7 +393,7 @@ inline QgsPoint QgsClipper::intersect( const double x1, const double y1, break; } - QgsPoint p; + QgsPointXY p; if ( qAbs( r_d ) > SMALL_NUM && qAbs( r_n ) > SMALL_NUM ) { diff --git a/src/core/qgscoordinatetransform.cpp b/src/core/qgscoordinatetransform.cpp index f7d7f387ae8..4880f71e3f7 100644 --- a/src/core/qgscoordinatetransform.cpp +++ b/src/core/qgscoordinatetransform.cpp @@ -86,7 +86,7 @@ QgsCoordinateReferenceSystem QgsCoordinateTransform::destinationCrs() const return d->mDestCRS; } -QgsPoint QgsCoordinateTransform::transform( const QgsPoint &point, TransformDirection direction ) const +QgsPointXY QgsCoordinateTransform::transform( const QgsPointXY &point, TransformDirection direction ) const { if ( !d->mIsValid || d->mShortCircuit ) return point; @@ -106,15 +106,15 @@ QgsPoint QgsCoordinateTransform::transform( const QgsPoint &point, TransformDire throw; } - return QgsPoint( x, y ); + return QgsPointXY( x, y ); } -QgsPoint QgsCoordinateTransform::transform( const double theX, const double theY = 0.0, TransformDirection direction ) const +QgsPointXY QgsCoordinateTransform::transform( const double theX, const double theY = 0.0, TransformDirection direction ) const { try { - return transform( QgsPoint( theX, theY ), direction ); + return transform( QgsPointXY( theX, theY ), direction ); } catch ( const QgsCsException & ) { @@ -343,7 +343,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r if ( rect.isEmpty() ) { - QgsPoint p = transform( rect.xMinimum(), rect.yMinimum(), direction ); + QgsPointXY p = transform( rect.xMinimum(), rect.yMinimum(), direction ); return QgsRectangle( p, p ); } diff --git a/src/core/qgscoordinatetransform.h b/src/core/qgscoordinatetransform.h index 138658da7db..719663c4e9d 100644 --- a/src/core/qgscoordinatetransform.h +++ b/src/core/qgscoordinatetransform.h @@ -24,7 +24,7 @@ #include "qgscoordinatereferencesystem.h" class QgsCoordinateTransformPrivate; -class QgsPoint; +class QgsPointXY; class QgsRectangle; class QPolygonF; @@ -120,7 +120,7 @@ class CORE_EXPORT QgsCoordinateTransform * \param direction transform direction (defaults to ForwardTransform) * \returns transformed point */ - QgsPoint transform( const QgsPoint &point, TransformDirection direction = ForwardTransform ) const; + QgsPointXY transform( const QgsPointXY &point, TransformDirection direction = ForwardTransform ) const; /** Transform the point specified by x,y from the source CRS to the destination CRS. * If the direction is ForwardTransform then coordinates are transformed from source to destination, @@ -130,7 +130,7 @@ class CORE_EXPORT QgsCoordinateTransform * \param direction transform direction (defaults to ForwardTransform) * \returns transformed point */ - QgsPoint transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const; + QgsPointXY transform( const double x, const double y, TransformDirection direction = ForwardTransform ) const; /** Transforms a rectangle from the source CRS to the destination CRS. * If the direction is ForwardTransform then coordinates are transformed from source to destination, diff --git a/src/core/qgscoordinateutils.cpp b/src/core/qgscoordinateutils.cpp index 477e1d62ae6..4728c97076c 100644 --- a/src/core/qgscoordinateutils.cpp +++ b/src/core/qgscoordinateutils.cpp @@ -62,11 +62,11 @@ int QgsCoordinateUtils::calculateCoordinatePrecision( double mapUnitsPerPixel, c return dp; } -QString QgsCoordinateUtils::formatCoordinateForProject( const QgsPoint &point, const QgsCoordinateReferenceSystem &destCrs, int precision ) +QString QgsCoordinateUtils::formatCoordinateForProject( const QgsPointXY &point, const QgsCoordinateReferenceSystem &destCrs, int precision ) { QString format = QgsProject::instance()->readEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/DegreeFormat" ), QStringLiteral( "MU" ) ); - QgsPoint geo = point; + QgsPointXY geo = point; if ( format == QLatin1String( "DM" ) || format == QLatin1String( "DMS" ) || format == QLatin1String( "D" ) ) { // degrees diff --git a/src/core/qgscoordinateutils.h b/src/core/qgscoordinateutils.h index 7835aa435f4..9e30e3d6e7d 100644 --- a/src/core/qgscoordinateutils.h +++ b/src/core/qgscoordinateutils.h @@ -22,7 +22,7 @@ #include "qgis_core.h" -class QgsPoint; +class QgsPointXY; class QgsCoordinateReferenceSystem; //not stable api - I plan on reworking this when QgsCoordinateFormatter lands in 2.16 @@ -49,7 +49,7 @@ class CORE_EXPORT QgsCoordinateUtils */ static int calculateCoordinatePrecision( double mapUnitsPerPixel, const QgsCoordinateReferenceSystem &mapCrs ); - static QString formatCoordinateForProject( const QgsPoint &point, const QgsCoordinateReferenceSystem &destCrs, int precision ); + static QString formatCoordinateForProject( const QgsPointXY &point, const QgsCoordinateReferenceSystem &destCrs, int precision ); }; diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index 5afe9e8792f..167d0126a05 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -261,19 +261,19 @@ double QgsDistanceArea::measureLine( const QgsCurve *curve ) const } QgsPointSequence linePointsV2; - QList linePoints; + QList linePoints; curve->points( linePointsV2 ); QgsGeometry::convertPointList( linePointsV2, linePoints ); return measureLine( linePoints ); } -double QgsDistanceArea::measureLine( const QList &points ) const +double QgsDistanceArea::measureLine( const QList &points ) const { if ( points.size() < 2 ) return 0; double total = 0; - QgsPoint p1, p2; + QgsPointXY p1, p2; try { @@ -282,7 +282,7 @@ double QgsDistanceArea::measureLine( const QList &points ) const else p1 = points[0]; - for ( QList::const_iterator i = points.begin(); i != points.end(); ++i ) + for ( QList::const_iterator i = points.begin(); i != points.end(); ++i ) { if ( willUseEllipsoid() ) { @@ -309,13 +309,13 @@ double QgsDistanceArea::measureLine( const QList &points ) const } -double QgsDistanceArea::measureLine( const QgsPoint &p1, const QgsPoint &p2 ) const +double QgsDistanceArea::measureLine( const QgsPointXY &p1, const QgsPointXY &p2 ) const { double result; try { - QgsPoint pp1 = p1, pp2 = p2; + QgsPointXY pp1 = p1, pp2 = p2; QgsDebugMsgLevel( QString( "Measuring from %1 to %2" ).arg( p1.toString( 4 ), p2.toString( 4 ) ), 3 ); if ( willUseEllipsoid() ) @@ -344,10 +344,10 @@ double QgsDistanceArea::measureLine( const QgsPoint &p1, const QgsPoint &p2 ) co return result; } -double QgsDistanceArea::measureLineProjected( const QgsPoint &p1, double distance, double azimuth, QgsPoint *projectedPoint ) const +double QgsDistanceArea::measureLineProjected( const QgsPointXY &p1, double distance, double azimuth, QgsPointXY *projectedPoint ) const { double result = 0.0; - QgsPoint p2; + QgsPointXY p2; if ( mCoordTransform.sourceCrs().isGeographic() && willUseEllipsoid() ) { p2 = computeSpheroidProject( p1, distance, azimuth ); @@ -365,7 +365,7 @@ double QgsDistanceArea::measureLineProjected( const QgsPoint &p1, double distanc } if ( projectedPoint ) { - *projectedPoint = QgsPoint( p2 ); + *projectedPoint = QgsPointXY( p2 ); } return result; } @@ -377,8 +377,8 @@ double QgsDistanceArea::measureLineProjected( const QgsPoint &p1, double distanc * and * http://www.ga.gov.au/nmd/geodesy/datums/vincenty_direct.jsp */ -QgsPoint QgsDistanceArea::computeSpheroidProject( - const QgsPoint &p1, double distance, double azimuth ) const +QgsPointXY QgsDistanceArea::computeSpheroidProject( + const QgsPointXY &p1, double distance, double azimuth ) const { // ellipsoid double a = mSemiMajor; @@ -431,7 +431,7 @@ QgsPoint QgsDistanceArea::computeSpheroidProject( omega = lambda - ( 1.0 - C ) * f * sin_alpha * ( sigma + C * sin( sigma ) * ( cos( two_sigma_m ) + C * cos( sigma ) * ( -1.0 + 2.0 * POW2( cos( two_sigma_m ) ) ) ) ); lambda2 = radians_long + omega; - return QgsPoint( RAD2DEG( lambda2 ), RAD2DEG( lat2 ) ); + return QgsPointXY( RAD2DEG( lambda2 ), RAD2DEG( lat2 ) ); } QgsUnitTypes::DistanceUnit QgsDistanceArea::lengthUnits() const @@ -454,20 +454,20 @@ double QgsDistanceArea::measurePolygon( const QgsCurve *curve ) const QgsPointSequence linePointsV2; curve->points( linePointsV2 ); - QList linePoints; + QList linePoints; QgsGeometry::convertPointList( linePointsV2, linePoints ); return measurePolygon( linePoints ); } -double QgsDistanceArea::measurePolygon( const QList &points ) const +double QgsDistanceArea::measurePolygon( const QList &points ) const { try { if ( willUseEllipsoid() ) { - QList pts; - for ( QList::const_iterator i = points.begin(); i != points.end(); ++i ) + QList pts; + for ( QList::const_iterator i = points.begin(); i != points.end(); ++i ) { pts.append( mCoordTransform.transform( *i ) ); } @@ -487,9 +487,9 @@ double QgsDistanceArea::measurePolygon( const QList &points ) const } -double QgsDistanceArea::bearing( const QgsPoint &p1, const QgsPoint &p2 ) const +double QgsDistanceArea::bearing( const QgsPointXY &p1, const QgsPointXY &p2 ) const { - QgsPoint pp1 = p1, pp2 = p2; + QgsPointXY pp1 = p1, pp2 = p2; double bearing; if ( willUseEllipsoid() ) @@ -513,7 +513,7 @@ double QgsDistanceArea::bearing( const QgsPoint &p1, const QgsPoint &p2 ) const // distance calculation double QgsDistanceArea::computeDistanceBearing( - const QgsPoint &p1, const QgsPoint &p2, + const QgsPointXY &p1, const QgsPointXY &p2, double *course1, double *course2 ) const { if ( qgsDoubleNear( p1.x(), p2.x() ) && qgsDoubleNear( p1.y(), p2.y() ) ) @@ -667,7 +667,7 @@ void QgsDistanceArea::setFromParams( const QgsEllipsoidUtils::EllipsoidParameter } } -double QgsDistanceArea::computePolygonArea( const QList &points ) const +double QgsDistanceArea::computePolygonArea( const QList &points ) const { if ( points.isEmpty() ) { @@ -730,7 +730,7 @@ double QgsDistanceArea::computePolygonArea( const QList &points ) cons return area; } -double QgsDistanceArea::computePolygonFlatArea( const QList &points ) const +double QgsDistanceArea::computePolygonFlatArea( const QList &points ) const { // Normal plane area calculations. double area = 0.0; diff --git a/src/core/qgsdistancearea.h b/src/core/qgsdistancearea.h index e9527d2c3de..9fe6c8fd27c 100644 --- a/src/core/qgsdistancearea.h +++ b/src/core/qgsdistancearea.h @@ -167,7 +167,7 @@ class CORE_EXPORT QgsDistanceArea * \returns length of line. The units for the returned length can be retrieved by calling lengthUnits(). * \see lengthUnits() */ - double measureLine( const QList &points ) const; + double measureLine( const QList &points ) const; /** * Measures the distance between two points. @@ -176,7 +176,7 @@ class CORE_EXPORT QgsDistanceArea * \returns distance between points. The units for the returned distance can be retrieved by calling lengthUnits(). * \see lengthUnits() */ - double measureLine( const QgsPoint &p1, const QgsPoint &p2 ) const; + double measureLine( const QgsPointXY &p1, const QgsPointXY &p2 ) const; /** * Calculates the distance from one point with distance in meters and azimuth (direction) @@ -193,7 +193,7 @@ class CORE_EXPORT QgsDistanceArea * \see sourceCrs() * \see computeSpheroidProject() */ - double measureLineProjected( const QgsPoint &p1, double distance = 1, double azimuth = M_PI / 2, QgsPoint *projectedPoint SIP_OUT = nullptr ) const; + double measureLineProjected( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI / 2, QgsPointXY *projectedPoint SIP_OUT = nullptr ) const; /** * Returns the units of distance for length calculations made by this object. @@ -212,12 +212,12 @@ class CORE_EXPORT QgsDistanceArea /** * Measures the area of the polygon described by a set of points. */ - double measurePolygon( const QList &points ) const; + double measurePolygon( const QList &points ) const; /** * Computes the bearing (in radians) between two points. */ - double bearing( const QgsPoint &p1, const QgsPoint &p2 ) const; + double bearing( const QgsPointXY &p1, const QgsPointXY &p2 ) const; /** * Returns an distance formatted as a friendly string. @@ -283,7 +283,7 @@ class CORE_EXPORT QgsDistanceArea * \param azimuth - azimuth in radians, clockwise from North * \return p2 - location of projected point as longitude/latitude. */ - QgsPoint computeSpheroidProject( const QgsPoint &p1, double distance = 1, double azimuth = M_PI / 2 ) const; + QgsPointXY computeSpheroidProject( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI / 2 ) const; private: @@ -297,16 +297,16 @@ class CORE_EXPORT QgsDistanceArea * (the same for course2) * \returns distance in meters */ - double computeDistanceBearing( const QgsPoint &p1, const QgsPoint &p2, + double computeDistanceBearing( const QgsPointXY &p1, const QgsPointXY &p2, double *course1 = nullptr, double *course2 = nullptr ) const; /** * Calculates area of polygon on ellipsoid * algorithm has been taken from GRASS: gis/area_poly1.c */ - double computePolygonArea( const QList &points ) const; + double computePolygonArea( const QList &points ) const; - double computePolygonFlatArea( const QList &points ) const; + double computePolygonFlatArea( const QList &points ) const; /** * Precalculates some values diff --git a/src/core/qgsgeometryvalidator.cpp b/src/core/qgsgeometryvalidator.cpp index ffe079228e6..755ff7bdf93 100644 --- a/src/core/qgsgeometryvalidator.cpp +++ b/src/core/qgsgeometryvalidator.cpp @@ -53,7 +53,7 @@ void QgsGeometryValidator::checkRingIntersections( { QgsVector w = ring1[j + 1] - ring1[j]; - QgsPoint s; + QgsPointXY s; if ( intersectLines( ring0[i], v, ring1[j], w, s ) ) { double d = -distLine2Point( ring0[i], v.perpVector(), s ); @@ -142,7 +142,7 @@ void QgsGeometryValidator::validatePolyline( int i, QgsPolyline line, bool ring { QgsVector w = line[k + 1] - line[k]; - QgsPoint s; + QgsPointXY s; if ( !intersectLines( line[j], v, line[k], w, s ) ) continue; @@ -242,7 +242,7 @@ void QgsGeometryValidator::run() double x, y; GEOSCoordSeq_getX_r( handle, cs, 0, &x ); GEOSCoordSeq_getY_r( handle, cs, 0, &y ); - emit errorFound( QgsGeometry::Error( QObject::tr( "GEOS error:%1" ).arg( r ), QgsPoint( x, y ) ) ); + emit errorFound( QgsGeometry::Error( QObject::tr( "GEOS error:%1" ).arg( r ), QgsPointXY( x, y ) ) ); mErrorCount++; } @@ -364,7 +364,7 @@ void QgsGeometryValidator::validateGeometry( const QgsGeometry *g, QList0 => q lies left of the line // <0 => q lies right of the line // -double QgsGeometryValidator::distLine2Point( const QgsPoint &p, QgsVector v, const QgsPoint &q ) +double QgsGeometryValidator::distLine2Point( const QgsPointXY &p, QgsVector v, const QgsPointXY &q ) { if ( qgsDoubleNear( v.length(), 0 ) ) { @@ -374,7 +374,7 @@ double QgsGeometryValidator::distLine2Point( const QgsPoint &p, QgsVector v, con return ( v.x() * ( q.y() - p.y() ) - v.y() * ( q.x() - p.x() ) ) / v.length(); } -bool QgsGeometryValidator::intersectLines( const QgsPoint &p, QgsVector v, const QgsPoint &q, QgsVector w, QgsPoint &s ) +bool QgsGeometryValidator::intersectLines( const QgsPointXY &p, QgsVector v, const QgsPointXY &q, QgsVector w, QgsPointXY &s ) { double d = v.y() * w.x() - v.x() * w.y(); @@ -390,7 +390,7 @@ bool QgsGeometryValidator::intersectLines( const QgsPoint &p, QgsVector v, const return true; } -bool QgsGeometryValidator::pointInRing( const QgsPolyline &ring, const QgsPoint &p ) +bool QgsGeometryValidator::pointInRing( const QgsPolyline &ring, const QgsPointXY &p ) { bool inside = false; int j = ring.size() - 1; diff --git a/src/core/qgsgeometryvalidator.h b/src/core/qgsgeometryvalidator.h index b0e1d1219e1..a7d64fcd76c 100644 --- a/src/core/qgsgeometryvalidator.h +++ b/src/core/qgsgeometryvalidator.h @@ -49,10 +49,10 @@ class CORE_EXPORT QgsGeometryValidator : public QThread void validatePolyline( int i, QgsPolyline polyline, bool ring = false ); void validatePolygon( int i, const QgsPolygon &polygon ); void checkRingIntersections( int p0, int i0, const QgsPolyline &ring0, int p1, int i1, const QgsPolyline &ring1 ); - double distLine2Point( const QgsPoint &p, QgsVector v, const QgsPoint &q ); - bool intersectLines( const QgsPoint &p, QgsVector v, const QgsPoint &q, QgsVector w, QgsPoint &s ); + double distLine2Point( const QgsPointXY &p, QgsVector v, const QgsPointXY &q ); + bool intersectLines( const QgsPointXY &p, QgsVector v, const QgsPointXY &q, QgsVector w, QgsPointXY &s ); bool ringInRing( const QgsPolyline &inside, const QgsPolyline &outside ); - bool pointInRing( const QgsPolyline &ring, const QgsPoint &p ); + bool pointInRing( const QgsPolyline &ring, const QgsPointXY &p ); QgsGeometry mG; QList *mErrors; diff --git a/src/core/qgsgml.cpp b/src/core/qgsgml.cpp index 778fa74139a..bd859b93bcb 100644 --- a/src/core/qgsgml.cpp +++ b/src/core/qgsgml.cpp @@ -919,7 +919,7 @@ void QgsGmlStreamingParser::endElement( const XML_Char *el ) } else if ( parseMode == LowerCorner && isGMLNS && LOCALNAME_EQUALS( "lowerCorner" ) ) { - QList points; + QList points; pointsFromPosListString( points, mStringCash, 2 ); if ( points.size() == 1 ) { @@ -930,7 +930,7 @@ void QgsGmlStreamingParser::endElement( const XML_Char *el ) } else if ( parseMode == UpperCorner && isGMLNS && LOCALNAME_EQUALS( "upperCorner" ) ) { - QList points; + QList points; pointsFromPosListString( points, mStringCash, 2 ); if ( points.size() == 1 ) { @@ -975,7 +975,7 @@ void QgsGmlStreamingParser::endElement( const XML_Char *el ) } else if ( isGMLNS && LOCALNAME_EQUALS( "Point" ) ) { - QList pointList; + QList pointList; if ( pointsFromString( pointList, mStringCash ) != 0 ) { //error @@ -1019,7 +1019,7 @@ void QgsGmlStreamingParser::endElement( const XML_Char *el ) { //add WKB point to the feature - QList pointList; + QList pointList; if ( pointsFromString( pointList, mStringCash ) != 0 ) { //error @@ -1057,7 +1057,7 @@ void QgsGmlStreamingParser::endElement( const XML_Char *el ) else if ( ( parseMode == Geometry || parseMode == MultiPolygon ) && isGMLNS && LOCALNAME_EQUALS( "LinearRing" ) ) { - QList pointList; + QList pointList; if ( pointsFromString( pointList, mStringCash ) != 0 ) { //error @@ -1255,7 +1255,7 @@ QString QgsGmlStreamingParser::readAttribute( const QString &attributeName, cons bool QgsGmlStreamingParser::createBBoxFromCoordinateString( QgsRectangle &r, const QString &coordString ) const { - QList points; + QList points; if ( pointsFromCoordinateString( points, coordString ) != 0 ) { return false; @@ -1271,7 +1271,7 @@ bool QgsGmlStreamingParser::createBBoxFromCoordinateString( QgsRectangle &r, con return true; } -int QgsGmlStreamingParser::pointsFromCoordinateString( QList &points, const QString &coordString ) const +int QgsGmlStreamingParser::pointsFromCoordinateString( QList &points, const QString &coordString ) const { //tuples are separated by space, x/y by ',' QStringList tuples = coordString.split( mTupleSeparator, QString::SkipEmptyParts ); @@ -1297,12 +1297,12 @@ int QgsGmlStreamingParser::pointsFromCoordinateString( QList &points, { continue; } - points.push_back( ( mInvertAxisOrientation ) ? QgsPoint( y, x ) : QgsPoint( x, y ) ); + points.push_back( ( mInvertAxisOrientation ) ? QgsPointXY( y, x ) : QgsPointXY( x, y ) ); } return 0; } -int QgsGmlStreamingParser::pointsFromPosListString( QList &points, const QString &coordString, int dimension ) const +int QgsGmlStreamingParser::pointsFromPosListString( QList &points, const QString &coordString, int dimension ) const { // coordinates separated by spaces QStringList coordinates = coordString.split( ' ', QString::SkipEmptyParts ); @@ -1326,12 +1326,12 @@ int QgsGmlStreamingParser::pointsFromPosListString( QList &points, con { continue; } - points.append( ( mInvertAxisOrientation ) ? QgsPoint( y, x ) : QgsPoint( x, y ) ); + points.append( ( mInvertAxisOrientation ) ? QgsPointXY( y, x ) : QgsPointXY( x, y ) ); } return 0; } -int QgsGmlStreamingParser::pointsFromString( QList &points, const QString &coordString ) const +int QgsGmlStreamingParser::pointsFromString( QList &points, const QString &coordString ) const { if ( mCoorMode == QgsGmlStreamingParser::Coordinate ) { @@ -1344,7 +1344,7 @@ int QgsGmlStreamingParser::pointsFromString( QList &points, const QStr return 1; } -int QgsGmlStreamingParser::getPointWKB( QgsWkbPtr &wkbPtr, const QgsPoint &point ) const +int QgsGmlStreamingParser::getPointWKB( QgsWkbPtr &wkbPtr, const QgsPointXY &point ) const { int wkbSize = 1 + sizeof( int ) + 2 * sizeof( double ); wkbPtr = QgsWkbPtr( new unsigned char[wkbSize], wkbSize ); @@ -1355,7 +1355,7 @@ int QgsGmlStreamingParser::getPointWKB( QgsWkbPtr &wkbPtr, const QgsPoint &point return 0; } -int QgsGmlStreamingParser::getLineWKB( QgsWkbPtr &wkbPtr, const QList &lineCoordinates ) const +int QgsGmlStreamingParser::getLineWKB( QgsWkbPtr &wkbPtr, const QList &lineCoordinates ) const { int wkbSize = 1 + 2 * sizeof( int ) + lineCoordinates.size() * 2 * sizeof( double ); wkbPtr = QgsWkbPtr( new unsigned char[wkbSize], wkbSize ); @@ -1364,7 +1364,7 @@ int QgsGmlStreamingParser::getLineWKB( QgsWkbPtr &wkbPtr, const QList fillPtr << mEndian << QgsWkbTypes::LineString << lineCoordinates.size(); - QList::const_iterator iter; + QList::const_iterator iter; for ( iter = lineCoordinates.constBegin(); iter != lineCoordinates.constEnd(); ++iter ) { fillPtr << iter->x() << iter->y(); @@ -1373,7 +1373,7 @@ int QgsGmlStreamingParser::getLineWKB( QgsWkbPtr &wkbPtr, const QList return 0; } -int QgsGmlStreamingParser::getRingWKB( QgsWkbPtr &wkbPtr, const QList &ringCoordinates ) const +int QgsGmlStreamingParser::getRingWKB( QgsWkbPtr &wkbPtr, const QList &ringCoordinates ) const { int wkbSize = sizeof( int ) + ringCoordinates.size() * 2 * sizeof( double ); wkbPtr = QgsWkbPtr( new unsigned char[wkbSize], wkbSize ); @@ -1382,7 +1382,7 @@ int QgsGmlStreamingParser::getRingWKB( QgsWkbPtr &wkbPtr, const QList fillPtr << ringCoordinates.size(); - QList::const_iterator iter; + QList::const_iterator iter; for ( iter = ringCoordinates.constBegin(); iter != ringCoordinates.constEnd(); ++iter ) { fillPtr << iter->x() << iter->y(); diff --git a/src/core/qgsgml.h b/src/core/qgsgml.h index 086e36271a9..0e43ecea5b5 100644 --- a/src/core/qgsgml.h +++ b/src/core/qgsgml.h @@ -205,7 +205,7 @@ class CORE_EXPORT QgsGmlStreamingParser \param coordString the text containing the coordinates \returns 0 in case of success */ - int pointsFromCoordinateString( QList &points, const QString &coordString ) const; + int pointsFromCoordinateString( QList &points, const QString &coordString ) const; /** Creates a set of points from a gml:posList or gml:pos coordinate string. \param points list that will contain the created points @@ -213,12 +213,12 @@ class CORE_EXPORT QgsGmlStreamingParser \param dimension number of dimensions \returns 0 in case of success */ - int pointsFromPosListString( QList &points, const QString &coordString, int dimension ) const; + int pointsFromPosListString( QList &points, const QString &coordString, int dimension ) const; - int pointsFromString( QList &points, const QString &coordString ) const; - int getPointWKB( QgsWkbPtr &wkbPtr, const QgsPoint & ) const; - int getLineWKB( QgsWkbPtr &wkbPtr, const QList &lineCoordinates ) const; - int getRingWKB( QgsWkbPtr &wkbPtr, const QList &ringCoordinates ) const; + int pointsFromString( QList &points, const QString &coordString ) const; + int getPointWKB( QgsWkbPtr &wkbPtr, const QgsPointXY & ) const; + int getLineWKB( QgsWkbPtr &wkbPtr, const QList &lineCoordinates ) const; + int getRingWKB( QgsWkbPtr &wkbPtr, const QList &ringCoordinates ) const; /** Creates a multiline from the information in mCurrentWKBFragments and * mCurrentWKBFragmentSizes. Assign the result. The multiline is in diff --git a/src/core/qgslabelfeature.h b/src/core/qgslabelfeature.h index 0eb832a4297..a3e33f3d890 100644 --- a/src/core/qgslabelfeature.h +++ b/src/core/qgslabelfeature.h @@ -158,9 +158,9 @@ class CORE_EXPORT QgsLabelFeature //! Set whether the label should use a fixed position instead of being automatically placed void setHasFixedPosition( bool enabled ) { mHasFixedPosition = enabled; } //! Coordinates of the fixed position (relevant only if hasFixedPosition() returns true) - QgsPoint fixedPosition() const { return mFixedPosition; } + QgsPointXY fixedPosition() const { return mFixedPosition; } //! Set coordinates of the fixed position (relevant only if hasFixedPosition() returns true) - void setFixedPosition( const QgsPoint &point ) { mFixedPosition = point; } + void setFixedPosition( const QgsPointXY &point ) { mFixedPosition = point; } //! Whether the label should use a fixed angle instead of using angle from automatic placement bool hasFixedAngle() const { return mHasFixedAngle; } @@ -194,10 +194,10 @@ class CORE_EXPORT QgsLabelFeature void setQuadOffset( QPointF quadOffset ) { mQuadOffset = quadOffset; } //! Applies only to "offset from point" placement strategy. //! What offset (in map units) to use from the point - QgsPoint positionOffset() const { return mPositionOffset; } + QgsPointXY positionOffset() const { return mPositionOffset; } //! Applies only to "offset from point" placement strategy. //! Set what offset (in map units) to use from the point - void setPositionOffset( const QgsPoint &offset ) { mPositionOffset = offset; } + void setPositionOffset( const QgsPointXY &offset ) { mPositionOffset = offset; } /** Returns the offset type, which determines how offsets and distance to label * behaves. Support depends on which placement mode is used for generating @@ -318,7 +318,7 @@ class CORE_EXPORT QgsLabelFeature //! whether mFixedPosition should be respected bool mHasFixedPosition; //! fixed position for the label (instead of automatic placement) - QgsPoint mFixedPosition; + QgsPointXY mFixedPosition; //! whether mFixedAngle should be respected bool mHasFixedAngle; //! fixed rotation for the label (instead of automatic choice) @@ -328,7 +328,7 @@ class CORE_EXPORT QgsLabelFeature //! whether the side of the label is fixed (only for "around point" placement) QPointF mQuadOffset; //! offset of label from the feature (only for "offset from point" placement) - QgsPoint mPositionOffset; + QgsPointXY mPositionOffset; //! distance of label from the feature (only for "around point" placement or linestrings) double mDistLabel; //! Offset type for certain placement modes diff --git a/src/core/qgslabelsearchtree.cpp b/src/core/qgslabelsearchtree.cpp index 32da8b77a83..15acc6b7e13 100644 --- a/src/core/qgslabelsearchtree.cpp +++ b/src/core/qgslabelsearchtree.cpp @@ -31,7 +31,7 @@ QgsLabelSearchTree::~QgsLabelSearchTree() clear(); } -void QgsLabelSearchTree::label( const QgsPoint &p, QList &posList ) const +void QgsLabelSearchTree::label( const QgsPointXY &p, QList &posList ) const { double c_min[2]; c_min[0] = p.x() - 0.1; @@ -86,11 +86,11 @@ bool QgsLabelSearchTree::insertLabel( pal::LabelPosition *labelPos, int featureI double c_max[2]; labelPos->getBoundingBox( c_min, c_max ); - QVector cornerPoints; + QVector cornerPoints; cornerPoints.reserve( 4 ); for ( int i = 0; i < 4; ++i ) { - cornerPoints.push_back( QgsPoint( labelPos->getX( i ), labelPos->getY( i ) ) ); + cornerPoints.push_back( QgsPointXY( labelPos->getX( i ), labelPos->getY( i ) ) ); } QgsLabelPosition *newEntry = new QgsLabelPosition( featureId, labelPos->getAlpha(), cornerPoints, QgsRectangle( c_min[0], c_min[1], c_max[0], c_max[1] ), labelPos->getWidth(), labelPos->getHeight(), layerName, labeltext, labelfont, labelPos->getUpsideDown(), diagram, pinned, providerId ); diff --git a/src/core/qgslabelsearchtree.h b/src/core/qgslabelsearchtree.h index a7dc63d854b..fc8e994e5da 100644 --- a/src/core/qgslabelsearchtree.h +++ b/src/core/qgslabelsearchtree.h @@ -28,7 +28,7 @@ #include "qgspallabeling.h" #include "rtree.hpp" -class QgsPoint; +class QgsPointXY; /** \ingroup core * A class to query the labeling structure at a given point (small wraper around pal RTree class) @@ -51,7 +51,7 @@ class CORE_EXPORT QgsLabelSearchTree * \note not available in Python bindings * TODO: why does this break bindings with QList? */ - void label( const QgsPoint &p, QList &posList ) const SIP_SKIP; + void label( const QgsPointXY &p, QList &posList ) const SIP_SKIP; /** Returns label position(s) in given rectangle. QgsLabelSearchTree keeps ownership, don't delete the LabelPositions * \note not available in Python bindings diff --git a/src/core/qgsmaprendererjob.cpp b/src/core/qgsmaprendererjob.cpp index 19046c4ae4e..15930f050a6 100644 --- a/src/core/qgsmaprendererjob.cpp +++ b/src/core/qgsmaprendererjob.cpp @@ -151,12 +151,12 @@ bool QgsMapRendererJob::reprojectToLayerExtent( const QgsMapLayer *ml, const Qgs else { // Note: ll = lower left point - QgsPoint ll = ct.transform( extent.xMinimum(), extent.yMinimum(), - QgsCoordinateTransform::ReverseTransform ); + QgsPointXY ll = ct.transform( extent.xMinimum(), extent.yMinimum(), + QgsCoordinateTransform::ReverseTransform ); // and ur = upper right point - QgsPoint ur = ct.transform( extent.xMaximum(), extent.yMaximum(), - QgsCoordinateTransform::ReverseTransform ); + QgsPointXY ur = ct.transform( extent.xMaximum(), extent.yMaximum(), + QgsCoordinateTransform::ReverseTransform ); QgsDebugMsg( QString( "in:%1 (ll:%2 ur:%3)" ).arg( extent.toString(), ll.toString(), ur.toString() ) ); diff --git a/src/core/qgsmapsettings.cpp b/src/core/qgsmapsettings.cpp index e48b391dda4..b9c6b670e14 100644 --- a/src/core/qgsmapsettings.cpp +++ b/src/core/qgsmapsettings.cpp @@ -205,10 +205,10 @@ void QgsMapSettings::updateDerived() #if 1 // set visible extent taking rotation in consideration if ( mRotation ) { - QgsPoint p1 = mMapToPixel.toMapCoordinates( QPoint( 0, 0 ) ); - QgsPoint p2 = mMapToPixel.toMapCoordinates( QPoint( 0, myHeight ) ); - QgsPoint p3 = mMapToPixel.toMapCoordinates( QPoint( myWidth, 0 ) ); - QgsPoint p4 = mMapToPixel.toMapCoordinates( QPoint( myWidth, myHeight ) ); + QgsPointXY p1 = mMapToPixel.toMapCoordinates( QPoint( 0, 0 ) ); + QgsPointXY p2 = mMapToPixel.toMapCoordinates( QPoint( 0, myHeight ) ); + QgsPointXY p3 = mMapToPixel.toMapCoordinates( QPoint( myWidth, 0 ) ); + QgsPointXY p4 = mMapToPixel.toMapCoordinates( QPoint( myWidth, myHeight ) ); dxmin = std::min( p1.x(), std::min( p2.x(), std::min( p3.x(), p4.x() ) ) ); dymin = std::min( p1.y(), std::min( p2.y(), std::min( p3.y(), p4.y() ) ) ); dxmax = std::max( p1.x(), std::max( p2.x(), std::max( p3.x(), p4.x() ) ) ); @@ -370,11 +370,11 @@ QgsCoordinateTransform QgsMapSettings::layerTransform( const QgsMapLayer *layer double QgsMapSettings::layerToMapUnits( const QgsMapLayer *layer, const QgsRectangle &referenceExtent ) const { QgsRectangle extent = referenceExtent.isEmpty() ? layer->extent() : referenceExtent; - QgsPoint l1( extent.xMinimum(), extent.yMinimum() ); - QgsPoint l2( extent.xMaximum(), extent.yMaximum() ); + QgsPointXY l1( extent.xMinimum(), extent.yMinimum() ); + QgsPointXY l2( extent.xMaximum(), extent.yMaximum() ); double distLayerUnits = std::sqrt( l1.sqrDist( l2 ) ); - QgsPoint m1 = layerToMapCoordinates( layer, l1 ); - QgsPoint m2 = layerToMapCoordinates( layer, l2 ); + QgsPointXY m1 = layerToMapCoordinates( layer, l1 ); + QgsPointXY m2 = layerToMapCoordinates( layer, l2 ); double distMapUnits = std::sqrt( m1.sqrDist( m2 ) ); return distMapUnits / distLayerUnits; } @@ -428,7 +428,7 @@ QgsRectangle QgsMapSettings::outputExtentToLayerExtent( const QgsMapLayer *layer } -QgsPoint QgsMapSettings::layerToMapCoordinates( const QgsMapLayer *layer, QgsPoint point ) const +QgsPointXY QgsMapSettings::layerToMapCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const { try { @@ -462,7 +462,7 @@ QgsRectangle QgsMapSettings::layerToMapCoordinates( const QgsMapLayer *layer, Qg } -QgsPoint QgsMapSettings::mapToLayerCoordinates( const QgsMapLayer *layer, QgsPoint point ) const +QgsPointXY QgsMapSettings::mapToLayerCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const { try { diff --git a/src/core/qgsmapsettings.h b/src/core/qgsmapsettings.h index 364abe191ae..13f4cd50f7d 100644 --- a/src/core/qgsmapsettings.h +++ b/src/core/qgsmapsettings.h @@ -248,7 +248,7 @@ class CORE_EXPORT QgsMapSettings * \brief transform point coordinates from layer's CRS to output CRS * \returns the transformed point */ - QgsPoint layerToMapCoordinates( const QgsMapLayer *layer, QgsPoint point ) const; + QgsPointXY layerToMapCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const; /** * \brief transform rectangle from layer's CRS to output CRS @@ -261,7 +261,7 @@ class CORE_EXPORT QgsMapSettings * \brief transform point coordinates from output CRS to layer's CRS * \returns the transformed point */ - QgsPoint mapToLayerCoordinates( const QgsMapLayer *layer, QgsPoint point ) const; + QgsPointXY mapToLayerCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const; /** * \brief transform rectangle from output CRS to layer's CRS diff --git a/src/core/qgsmaptopixel.cpp b/src/core/qgsmaptopixel.cpp index 37201d4c224..7b428a373bc 100644 --- a/src/core/qgsmaptopixel.cpp +++ b/src/core/qgsmaptopixel.cpp @@ -99,7 +99,7 @@ bool QgsMapToPixel::updateMatrix() return true; } -QgsPoint QgsMapToPixel::toMapPoint( double x, double y ) const +QgsPointXY QgsMapToPixel::toMapPoint( double x, double y ) const { bool invertible; QTransform matrix = mMatrix.inverted( &invertible ); @@ -108,21 +108,21 @@ QgsPoint QgsMapToPixel::toMapPoint( double x, double y ) const qreal x_qreal = x, y_qreal = y; matrix.map( x_qreal, y_qreal, &mx, &my ); //QgsDebugMsg(QString("XXX toMapPoint x:%1 y:%2 -> x:%3 y:%4").arg(x).arg(y).arg(mx).arg(my)); - return QgsPoint( mx, my ); + return QgsPointXY( mx, my ); } -QgsPoint QgsMapToPixel::toMapCoordinates( QPoint p ) const +QgsPointXY QgsMapToPixel::toMapCoordinates( QPoint p ) const { - QgsPoint mapPt = toMapPoint( p.x(), p.y() ); - return QgsPoint( mapPt ); + QgsPointXY mapPt = toMapPoint( p.x(), p.y() ); + return QgsPointXY( mapPt ); } -QgsPoint QgsMapToPixel::toMapCoordinates( int x, int y ) const +QgsPointXY QgsMapToPixel::toMapCoordinates( int x, int y ) const { return toMapPoint( x, y ); } -QgsPoint QgsMapToPixel::toMapCoordinatesF( double x, double y ) const +QgsPointXY QgsMapToPixel::toMapCoordinatesF( double x, double y ) const { return toMapPoint( x, y ); } @@ -220,21 +220,21 @@ QString QgsMapToPixel::showParameters() const return rep; } -QgsPoint QgsMapToPixel::transform( qreal x, qreal y ) const +QgsPointXY QgsMapToPixel::transform( qreal x, qreal y ) const { transformInPlace( x, y ); - return QgsPoint( x, y ); + return QgsPointXY( x, y ); } -QgsPoint QgsMapToPixel::transform( const QgsPoint &p ) const +QgsPointXY QgsMapToPixel::transform( const QgsPointXY &p ) const { qreal x = p.x(), y = p.y(); transformInPlace( x, y ); // QgsDebugMsg(QString("Point to pixel...X : %1-->%2, Y: %3 -->%4").arg(p.x()).arg(dx).arg(p.y()).arg(dy)); - return QgsPoint( x, y ); + return QgsPointXY( x, y ); } -void QgsMapToPixel::transform( QgsPoint *p ) const +void QgsMapToPixel::transform( QgsPointXY *p ) const { qreal x = p->x(), y = p->y(); transformInPlace( x, y ); diff --git a/src/core/qgsmaptopixel.h b/src/core/qgsmaptopixel.h index 11c1ef87998..812eca864af 100644 --- a/src/core/qgsmaptopixel.h +++ b/src/core/qgsmaptopixel.h @@ -24,7 +24,7 @@ #include "qgsunittypes.h" #include -class QgsPoint; +class QgsPointXY; class QPoint; /** \ingroup core @@ -73,20 +73,20 @@ class CORE_EXPORT QgsMapToPixel /** * Transform the point from map (world) coordinates to device coordinates * \param p Point to transform - * \returns QgsPoint in device coordinates + * \returns QgsPointXY in device coordinates */ - QgsPoint transform( const QgsPoint &p ) const; + QgsPointXY transform( const QgsPointXY &p ) const; - void transform( QgsPoint *p ) const; + void transform( QgsPointXY *p ) const; /** * Transform the point specified by x,y from map (world) * coordinates to device coordinates * \param x x cordinate o point to transform * \param y y coordinate of point to transform - * \returns QgsPoint in device coordinates + * \returns QgsPointXY in device coordinates */ - QgsPoint transform( qreal x, qreal y ) const; + QgsPointXY transform( qreal x, qreal y ) const; /** * Transform device coordinates to map coordinates. Modifies the @@ -115,19 +115,19 @@ class CORE_EXPORT QgsMapToPixel } #endif - QgsPoint toMapCoordinates( int x, int y ) const; + QgsPointXY toMapCoordinates( int x, int y ) const; //! Transform device coordinates to map (world) coordinates - QgsPoint toMapCoordinatesF( double x, double y ) const; + QgsPointXY toMapCoordinatesF( double x, double y ) const; /** * Transform device coordinates to map (world) coordinates * \param p Point to be converted to map cooordinates - * \returns QgsPoint in map coorndiates + * \returns QgsPointXY in map coorndiates */ - QgsPoint toMapCoordinates( QPoint p ) const; + QgsPointXY toMapCoordinates( QPoint p ) const; - QgsPoint toMapPoint( double x, double y ) const; + QgsPointXY toMapPoint( double x, double y ) const; /** * Set map units per pixel diff --git a/src/core/qgsmaptopixelgeometrysimplifier.cpp b/src/core/qgsmaptopixelgeometrysimplifier.cpp index d6f001039cf..129078fb4bd 100644 --- a/src/core/qgsmaptopixelgeometrysimplifier.cpp +++ b/src/core/qgsmaptopixelgeometrysimplifier.cpp @@ -94,8 +94,8 @@ static QgsGeometry generalizeWkbGeometryByBoundingBox( if ( geometryType == QgsWkbTypes::LineString ) { QgsLineString *lineString = new QgsLineString(); - lineString->addVertex( QgsPointV2( x1, y1 ) ); - lineString->addVertex( QgsPointV2( x2, y2 ) ); + lineString->addVertex( QgsPoint( x1, y1 ) ); + lineString->addVertex( QgsPoint( x2, y2 ) ); return QgsGeometry( lineString ); } else @@ -179,7 +179,7 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry( !equalSnapToGrid( x, y, lastX, lastY, gridOriginX, gridOriginY, gridInverseSizeXY ) || ( !isaLinearRing && ( i == 1 || i >= numPoints - 2 ) ) ) { - output->insertVertex( QgsVertexId( 0, 0, output->numPoints() ), QgsPointV2( x, y ) ); + output->insertVertex( QgsVertexId( 0, 0, output->numPoints() ), QgsPoint( x, y ) ); lastX = x; lastY = y; } @@ -224,7 +224,7 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry( ( isLongSegment = ( calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol ) ) || ( !isaLinearRing && ( i == 1 || i >= numPoints - 2 ) ) ) { - output->insertVertex( QgsVertexId( 0, 0, output->numPoints() ), QgsPointV2( x, y ) ); + output->insertVertex( QgsVertexId( 0, 0, output->numPoints() ), QgsPoint( x, y ) ); lastX = x; lastY = y; @@ -259,7 +259,7 @@ QgsGeometry QgsMapToPixelSimplifier::simplifyGeometry( // make sure we keep the linear ring closed if ( !qgsDoubleNear( lastX, output->xAt( 0 ) ) || !qgsDoubleNear( lastY, output->yAt( 0 ) ) ) { - output->insertVertex( QgsVertexId( 0, 0, output->numPoints() ), QgsPointV2( output->xAt( 0 ), output->yAt( 0 ) ) ); + output->insertVertex( QgsVertexId( 0, 0, output->numPoints() ), QgsPoint( output->xAt( 0 ), output->yAt( 0 ) ) ); } } diff --git a/src/core/qgsogcutils.cpp b/src/core/qgsogcutils.cpp index c712c50ae86..78d42bf3d9d 100644 --- a/src/core/qgsogcutils.cpp +++ b/src/core/qgsogcutils.cpp @@ -876,7 +876,7 @@ bool QgsOgcUtils::readGMLCoordinates( QgsPolyline &coords, const QDomElement &el { return true; } - coords.push_back( QgsPoint( x, y ) ); + coords.push_back( QgsPointXY( x, y ) ); } return false; } @@ -956,7 +956,7 @@ bool QgsOgcUtils::readGMLPositions( QgsPolyline &coords, const QDomElement &elem { return true; } - coords.push_back( QgsPoint( x, y ) ); + coords.push_back( QgsPointXY( x, y ) ); } return false; } @@ -1513,7 +1513,7 @@ QDomElement QgsOgcUtils::createGMLCoordinates( const QgsPolyline &points, QDomDo coordElem.setAttribute( QStringLiteral( "ts" ), QStringLiteral( " " ) ); QString coordString; - QVector::const_iterator pointIt = points.constBegin(); + QVector::const_iterator pointIt = points.constBegin(); for ( ; pointIt != points.constEnd(); ++pointIt ) { if ( pointIt != points.constBegin() ) @@ -1538,7 +1538,7 @@ QDomElement QgsOgcUtils::createGMLPositions( const QgsPolyline &points, QDomDocu posElem.setAttribute( QStringLiteral( "srsDimension" ), QStringLiteral( "2" ) ); QString coordString; - QVector::const_iterator pointIt = points.constBegin(); + QVector::const_iterator pointIt = points.constBegin(); for ( ; pointIt != points.constEnd(); ++pointIt ) { if ( pointIt != points.constBegin() ) diff --git a/src/core/qgsogcutils.h b/src/core/qgsogcutils.h index ef300ca49e7..6c9f89b46d4 100644 --- a/src/core/qgsogcutils.h +++ b/src/core/qgsogcutils.h @@ -29,7 +29,7 @@ class QString; class QgsExpression; class QgsGeometry; -class QgsPoint; +class QgsPointXY; class QgsRectangle; #include "qgsgeometry.h" diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index d0a316febb9..59a215cb3c5 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -1087,7 +1087,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, QString t } #if 0 // XXX strk - QgsPoint ptSize = xform->toMapCoordinatesF( w, h ); + QgsPointXY ptSize = xform->toMapCoordinatesF( w, h ); labelX = qAbs( ptSize.x() - ptZero.x() ); labelY = qAbs( ptSize.y() - ptZero.y() ); #else @@ -1717,12 +1717,12 @@ void QgsPalLayerSettings::registerFeature( QgsFeature &f, QgsRenderContext &cont } //project xPos and yPos from layer to map CRS, handle rotation - QgsGeometry ddPoint( new QgsPointV2( xPos, yPos ) ); + QgsGeometry ddPoint( new QgsPoint( xPos, yPos ) ); if ( QgsPalLabeling::geometryRequiresPreparation( ddPoint, context, ct ) ) { ddPoint = QgsPalLabeling::prepareGeometry( ddPoint, context, ct ); - xPos = static_cast< QgsPointV2 * >( ddPoint.geometry() )->x(); - yPos = static_cast< QgsPointV2 * >( ddPoint.geometry() )->y(); + xPos = static_cast< QgsPoint * >( ddPoint.geometry() )->x(); + yPos = static_cast< QgsPoint * >( ddPoint.geometry() )->y(); } xPos += xdiff; @@ -1774,12 +1774,12 @@ void QgsPalLayerSettings::registerFeature( QgsFeature &f, QgsRenderContext &cont *labelFeature = lf; ( *labelFeature )->setHasFixedPosition( dataDefinedPosition ); - ( *labelFeature )->setFixedPosition( QgsPoint( xPos, yPos ) ); + ( *labelFeature )->setFixedPosition( QgsPointXY( xPos, yPos ) ); // use layer-level defined rotation, but not if position fixed ( *labelFeature )->setHasFixedAngle( dataDefinedRotation || ( !dataDefinedPosition && !qgsDoubleNear( angle, 0.0 ) ) ); ( *labelFeature )->setFixedAngle( angle ); ( *labelFeature )->setQuadOffset( QPointF( quadOffsetX, quadOffsetY ) ); - ( *labelFeature )->setPositionOffset( QgsPoint( offsetX, offsetY ) ); + ( *labelFeature )->setPositionOffset( QgsPointXY( offsetX, offsetY ) ); ( *labelFeature )->setOffsetType( offsetType ); ( *labelFeature )->setAlwaysShow( alwaysShow ); ( *labelFeature )->setRepeatDistance( repeatDist ); @@ -2834,7 +2834,7 @@ QgsGeometry QgsPalLabeling::prepareGeometry( const QgsGeometry &geometry, QgsRen const QgsMapToPixel &m2p = context.mapToPixel(); if ( !qgsDoubleNear( m2p.mapRotation(), 0 ) ) { - QgsPoint center = context.extent().center(); + QgsPointXY center = context.extent().center(); if ( ct.isValid() && !ct.isShortCircuited() ) { @@ -3337,7 +3337,7 @@ void QgsPalLabeling::dataDefinedDropShadow( QgsPalLayerSettings &tmpLyr, void QgsPalLabeling::drawLabelCandidateRect( pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform, QList *candidates ) { - QgsPoint outPt = xform->transform( lp->getX(), lp->getY() ); + QgsPointXY outPt = xform->transform( lp->getX(), lp->getY() ); painter->save(); @@ -3367,7 +3367,7 @@ void QgsPalLabeling::drawLabelCandidateRect( pal::LabelPosition *lp, QPainter *p painter->rotate( -lp->getAlpha() * 180 / M_PI ); painter->translate( -rect.bottomLeft() ); #else - QgsPoint outPt2 = xform->transform( lp->getX() + lp->getWidth(), lp->getY() + lp->getHeight() ); + QgsPointXY outPt2 = xform->transform( lp->getX() + lp->getWidth(), lp->getY() + lp->getHeight() ); QRectF rect( 0, 0, outPt2.x() - outPt.x(), outPt2.y() - outPt.y() ); painter->translate( QPointF( outPt.x(), outPt.y() ) ); painter->rotate( -lp->getAlpha() * 180 / M_PI ); @@ -3405,7 +3405,7 @@ QgsLabelingResults::~QgsLabelingResults() mLabelSearchTree = nullptr; } -QList QgsLabelingResults::labelsAtPosition( const QgsPoint &p ) const +QList QgsLabelingResults::labelsAtPosition( const QgsPointXY &p ) const { QList positions; diff --git a/src/core/qgspallabeling.h b/src/core/qgspallabeling.h index 7194971698c..d921c00ffba 100644 --- a/src/core/qgspallabeling.h +++ b/src/core/qgspallabeling.h @@ -79,7 +79,7 @@ class QgsExpressionContext; class CORE_EXPORT QgsLabelPosition { public: - QgsLabelPosition( int id, double r, const QVector< QgsPoint > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString() ) + QgsLabelPosition( int id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString() ) : featureId( id ) , rotation( r ) , cornerPoints( corners ) @@ -109,7 +109,7 @@ class CORE_EXPORT QgsLabelPosition {} int featureId; double rotation; - QVector< QgsPoint > cornerPoints; + QVector< QgsPointXY > cornerPoints; QgsRectangle labelRect; double width; double height; @@ -578,8 +578,8 @@ class CORE_EXPORT QgsPalLayerSettings const QgsMapToPixel *xform = nullptr; QgsCoordinateTransform ct; - QgsPoint ptZero; - QgsPoint ptOne; + QgsPointXY ptZero; + QgsPointXY ptOne; QgsGeometry extentGeom; int mFeaturesToLabel; // total features that will probably be labeled, may be less (figured before PAL) int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels) @@ -696,7 +696,7 @@ class CORE_EXPORT QgsLabelingResults QgsLabelingResults &operator=( const QgsLabelingResults &rh ) = delete; //! return infos about labels at a given (map) position - QList labelsAtPosition( const QgsPoint &p ) const; + QList labelsAtPosition( const QgsPointXY &p ) const; //! return infos about labels within a given (map) rectangle QList labelsWithinRect( const QgsRectangle &r ) const; diff --git a/src/core/qgspoint.cpp b/src/core/qgspoint.cpp index ada6b269e6e..8d6200ffb8f 100644 --- a/src/core/qgspoint.cpp +++ b/src/core/qgspoint.cpp @@ -25,24 +25,24 @@ #include "qgsexception.h" -QgsPoint::QgsPoint( const QgsPoint &p ) +QgsPointXY::QgsPointXY( const QgsPointXY &p ) { mX = p.x(); mY = p.y(); } -QgsPoint::QgsPoint( const QgsPointV2 &point ) +QgsPointXY::QgsPointXY( const QgsPoint &point ) : mX( point.x() ) , mY( point.y() ) { } -QPointF QgsPoint::toQPointF() const +QPointF QgsPointXY::toQPointF() const { return QPointF( mX, mY ); } -QString QgsPoint::toString() const +QString QgsPointXY::toString() const { QString rep; QTextStream ot( &rep ); @@ -51,14 +51,14 @@ QString QgsPoint::toString() const return rep; } -QString QgsPoint::toString( int precision ) const +QString QgsPointXY::toString( int precision ) const { QString x = qIsFinite( mX ) ? QString::number( mX, 'f', precision ) : QObject::tr( "infinite" ); QString y = qIsFinite( mY ) ? QString::number( mY, 'f', precision ) : QObject::tr( "infinite" ); return QStringLiteral( "%1,%2" ).arg( x, y ); } -QString QgsPoint::toDegreesMinutesSeconds( int precision, const bool useSuffix, const bool padded ) const +QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix, const bool padded ) const { //first, limit longitude to -360 to 360 degree range double myWrappedX = fmod( mX, 360.0 ); @@ -172,7 +172,7 @@ QString QgsPoint::toDegreesMinutesSeconds( int precision, const bool useSuffix, return rep; } -QString QgsPoint::toDegreesMinutes( int precision, const bool useSuffix, const bool padded ) const +QString QgsPointXY::toDegreesMinutes( int precision, const bool useSuffix, const bool padded ) const { //first, limit longitude to -360 to 360 degree range double myWrappedX = fmod( mX, 360.0 ); @@ -256,63 +256,63 @@ QString QgsPoint::toDegreesMinutes( int precision, const bool useSuffix, const b return rep; } -QString QgsPoint::wellKnownText() const +QString QgsPointXY::wellKnownText() const { return QStringLiteral( "POINT(%1 %2)" ).arg( qgsDoubleToString( mX ), qgsDoubleToString( mY ) ); } -double QgsPoint::sqrDist( double x, double y ) const +double QgsPointXY::sqrDist( double x, double y ) const { return ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ); } -double QgsPoint::sqrDist( const QgsPoint &other ) const +double QgsPointXY::sqrDist( const QgsPointXY &other ) const { return sqrDist( other.x(), other.y() ); } -double QgsPoint::distance( double x, double y ) const +double QgsPointXY::distance( double x, double y ) const { return sqrt( sqrDist( x, y ) ); } -double QgsPoint::distance( const QgsPoint &other ) const +double QgsPointXY::distance( const QgsPointXY &other ) const { return sqrt( sqrDist( other ) ); } -double QgsPoint::azimuth( const QgsPoint &other ) const +double QgsPointXY::azimuth( const QgsPointXY &other ) const { double dx = other.x() - mX; double dy = other.y() - mY; return ( atan2( dx, dy ) * 180.0 / M_PI ); } -QgsPoint QgsPoint::project( double distance, double bearing ) const +QgsPointXY QgsPointXY::project( double distance, double bearing ) const { double rads = bearing * M_PI / 180.0; double dx = distance * sin( rads ); double dy = distance * cos( rads ); - return QgsPoint( mX + dx, mY + dy ); + return QgsPointXY( mX + dx, mY + dy ); } -bool QgsPoint::compare( const QgsPoint &other, double epsilon ) const +bool QgsPointXY::compare( const QgsPointXY &other, double epsilon ) const { return ( qgsDoubleNear( mX, other.x(), epsilon ) && qgsDoubleNear( mY, other.y(), epsilon ) ); } // operators -bool QgsPoint::operator==( const QgsPoint &other ) +bool QgsPointXY::operator==( const QgsPointXY &other ) { return ( qgsDoubleNear( mX, other.x() ) && qgsDoubleNear( mY, other.y() ) ); } -bool QgsPoint::operator!=( const QgsPoint &other ) const +bool QgsPointXY::operator!=( const QgsPointXY &other ) const { return !( qgsDoubleNear( mX, other.x() ) && qgsDoubleNear( mY, other.y() ) ); } -QgsPoint &QgsPoint::operator=( const QgsPoint &other ) +QgsPointXY &QgsPointXY::operator=( const QgsPointXY &other ) { if ( &other != this ) { @@ -323,13 +323,13 @@ QgsPoint &QgsPoint::operator=( const QgsPoint &other ) return *this; } -void QgsPoint::multiply( double scalar ) +void QgsPointXY::multiply( double scalar ) { mX *= scalar; mY *= scalar; } -double QgsPoint::sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint &minDistPoint, double epsilon ) const +double QgsPointXY::sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPointXY &minDistPoint, double epsilon ) const { double nx, ny; //normal vector diff --git a/src/core/qgspoint.h b/src/core/qgspoint.h index b7a58bc1b93..7b63e26ee31 100644 --- a/src/core/qgspoint.h +++ b/src/core/qgspoint.h @@ -28,13 +28,13 @@ #include #include -class QgsPointV2; +class QgsPoint; /** \ingroup core * A class to represent a point. * For Z and M support prefer QgsPointV2. */ -class CORE_EXPORT QgsPoint +class CORE_EXPORT QgsPointXY { Q_GADGET @@ -43,19 +43,19 @@ class CORE_EXPORT QgsPoint public: /// Default constructor - QgsPoint() + QgsPointXY() : mX( 0.0 ) , mY( 0.0 ) {} //! Create a point from another point - QgsPoint( const QgsPoint &p ); + QgsPointXY( const QgsPointXY &p ); /** Create a point from x,y coordinates * \param x x coordinate * \param y y coordinate */ - QgsPoint( double x, double y ) + QgsPointXY( double x, double y ) : mX( x ) , mY( y ) {} @@ -64,7 +64,7 @@ class CORE_EXPORT QgsPoint * \param point QPointF source * \since QGIS 2.7 */ - QgsPoint( QPointF point ) + QgsPointXY( QPointF point ) : mX( point.x() ) , mY( point.y() ) {} @@ -73,7 +73,7 @@ class CORE_EXPORT QgsPoint * \param point QPoint source * \since QGIS 2.7 */ - QgsPoint( QPoint point ) + QgsPointXY( QPoint point ) : mX( point.x() ) , mY( point.y() ) {} @@ -84,9 +84,9 @@ class CORE_EXPORT QgsPoint * * \since QGIS 3.0 */ - QgsPoint( const QgsPointV2 &point ); + QgsPointXY( const QgsPoint &point ); - ~QgsPoint() + ~QgsPointXY() {} /** Sets the x value of the point @@ -177,7 +177,7 @@ class CORE_EXPORT QgsPoint /** Returns the squared distance between this point another point. * \see distance() */ - double sqrDist( const QgsPoint &other ) const; + double sqrDist( const QgsPointXY &other ) const; /** Returns the distance between this point and a specified x, y coordinate. * \param x x-coordniate @@ -192,13 +192,13 @@ class CORE_EXPORT QgsPoint * \see sqrDist() * \since QGIS 2.16 */ - double distance( const QgsPoint &other ) const; + double distance( const QgsPointXY &other ) const; //! Returns the minimum distance between this point and a segment - double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint &minDistPoint SIP_OUT, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; + double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPointXY &minDistPoint SIP_OUT, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; //! Calculates azimuth between this point and other one (clockwise in degree, starting from north) - double azimuth( const QgsPoint &other ) const; + double azimuth( const QgsPointXY &other ) const; /** Returns a new point which corresponds to this point projected by a specified distance * in a specified bearing. @@ -206,7 +206,7 @@ class CORE_EXPORT QgsPoint * \param bearing angle to project in, clockwise in degrees starting from north * \since QGIS 2.16 */ - QgsPoint project( double distance, double bearing ) const; + QgsPointXY project( double distance, double bearing ) const; /** Compares this point with another point with a fuzzy tolerance * \param other point to compare with @@ -214,46 +214,46 @@ class CORE_EXPORT QgsPoint * \returns true if points are equal within specified tolerance * \since QGIS 2.9 */ - bool compare( const QgsPoint &other, double epsilon = 4 * DBL_EPSILON ) const; + bool compare( const QgsPointXY &other, double epsilon = 4 * DBL_EPSILON ) const; //! equality operator - bool operator==( const QgsPoint &other ); + bool operator==( const QgsPointXY &other ); //! Inequality operator - bool operator!=( const QgsPoint &other ) const; + bool operator!=( const QgsPointXY &other ) const; //! Multiply x and y by the given value void multiply( double scalar ); //! Assignment - QgsPoint &operator=( const QgsPoint &other ); + QgsPointXY &operator=( const QgsPointXY &other ); //! Calculates the vector obtained by subtracting a point from this point - QgsVector operator-( const QgsPoint &p ) const { return QgsVector( mX - p.mX, mY - p.mY ); } + QgsVector operator-( const QgsPointXY &p ) const { return QgsVector( mX - p.mX, mY - p.mY ); } //! Adds a vector to this point in place - QgsPoint &operator+=( QgsVector v ) { *this = *this + v; return *this; } + QgsPointXY &operator+=( QgsVector v ) { *this = *this + v; return *this; } //! Subtracts a vector from this point in place - QgsPoint &operator-=( QgsVector v ) { *this = *this - v; return *this; } + QgsPointXY &operator-=( QgsVector v ) { *this = *this - v; return *this; } //! Adds a vector to this point - QgsPoint operator+( QgsVector v ) const { return QgsPoint( mX + v.x(), mY + v.y() ); } + QgsPointXY operator+( QgsVector v ) const { return QgsPointXY( mX + v.x(), mY + v.y() ); } //! Subtracts a vector from this point - QgsPoint operator-( QgsVector v ) const { return QgsPoint( mX - v.x(), mY - v.y() ); } + QgsPointXY operator-( QgsVector v ) const { return QgsPointXY( mX - v.x(), mY - v.y() ); } //! Multiplies the coordinates in this point by a scalar quantity - QgsPoint operator*( double scalar ) const { return QgsPoint( mX * scalar, mY * scalar ); } + QgsPointXY operator*( double scalar ) const { return QgsPointXY( mX * scalar, mY * scalar ); } //! Divides the coordinates in this point by a scalar quantity - QgsPoint operator/( double scalar ) const { return QgsPoint( mX / scalar, mY / scalar ); } + QgsPointXY operator/( double scalar ) const { return QgsPointXY( mX / scalar, mY / scalar ); } //! Multiplies the coordinates in this point by a scalar quantity in place - QgsPoint &operator*=( double scalar ) { mX *= scalar; mY *= scalar; return *this; } + QgsPointXY &operator*=( double scalar ) { mX *= scalar; mY *= scalar; return *this; } //! Divides the coordinates in this point by a scalar quantity in place - QgsPoint &operator/=( double scalar ) { mX /= scalar; mY /= scalar; return *this; } + QgsPointXY &operator/=( double scalar ) { mX /= scalar; mY /= scalar; return *this; } #ifdef SIP_RUN SIP_PYOBJECT __repr__(); @@ -300,12 +300,12 @@ class CORE_EXPORT QgsPoint //! y coordinate double mY; - friend uint qHash( const QgsPoint &pnt ); + friend uint qHash( const QgsPointXY &pnt ); }; // class QgsPoint -inline bool operator==( const QgsPoint &p1, const QgsPoint &p2 ) SIP_SKIP +inline bool operator==( const QgsPointXY &p1, const QgsPointXY &p2 ) SIP_SKIP { if ( qgsDoubleNear( p1.x(), p2.x() ) && qgsDoubleNear( p1.y(), p2.y() ) ) { return true; } @@ -313,14 +313,14 @@ inline bool operator==( const QgsPoint &p1, const QgsPoint &p2 ) SIP_SKIP { return false; } } -inline std::ostream &operator << ( std::ostream &os, const QgsPoint &p ) SIP_SKIP +inline std::ostream &operator << ( std::ostream &os, const QgsPointXY &p ) SIP_SKIP { // Use Local8Bit for printouts os << p.toString().toLocal8Bit().data(); return os; } -inline uint qHash( const QgsPoint &p ) SIP_SKIP +inline uint qHash( const QgsPointXY &p ) SIP_SKIP { uint hash; uint h1 = qHash( static_cast< quint64 >( p.mX ) ); diff --git a/src/core/qgspointlocator.cpp b/src/core/qgspointlocator.cpp index 6e9408e8e22..e2f2fd07975 100644 --- a/src/core/qgspointlocator.cpp +++ b/src/core/qgspointlocator.cpp @@ -30,7 +30,7 @@ using namespace SpatialIndex; -static SpatialIndex::Point point2point( const QgsPoint &point ) +static SpatialIndex::Point point2point( const QgsPointXY &point ) { double plow[2] = { point.x(), point.y() }; return Point( plow, 2 ); @@ -88,7 +88,7 @@ class QgsPointLocator_Stream : public IDataStream class QgsPointLocator_VisitorNearestVertex : public IVisitor { public: - QgsPointLocator_VisitorNearestVertex( QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPoint &srcPoint, QgsPointLocator::MatchFilter *filter = nullptr ) + QgsPointLocator_VisitorNearestVertex( QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter = nullptr ) : mLocator( pl ) , mBest( m ) , mSrcPoint( srcPoint ) @@ -105,7 +105,7 @@ class QgsPointLocator_VisitorNearestVertex : public IVisitor int vertexIndex, beforeVertex, afterVertex; double sqrDist; - QgsPoint pt = geom->closestVertex( mSrcPoint, vertexIndex, beforeVertex, afterVertex, sqrDist ); + QgsPointXY pt = geom->closestVertex( mSrcPoint, vertexIndex, beforeVertex, afterVertex, sqrDist ); if ( sqrDist < 0 ) return; // probably empty geometry @@ -121,7 +121,7 @@ class QgsPointLocator_VisitorNearestVertex : public IVisitor private: QgsPointLocator *mLocator = nullptr; QgsPointLocator::Match &mBest; - QgsPoint mSrcPoint; + QgsPointXY mSrcPoint; QgsPointLocator::MatchFilter *mFilter = nullptr; }; @@ -136,7 +136,7 @@ class QgsPointLocator_VisitorNearestVertex : public IVisitor class QgsPointLocator_VisitorNearestEdge : public IVisitor { public: - QgsPointLocator_VisitorNearestEdge( QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPoint &srcPoint, QgsPointLocator::MatchFilter *filter = nullptr ) + QgsPointLocator_VisitorNearestEdge( QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter = nullptr ) : mLocator( pl ) , mBest( m ) , mSrcPoint( srcPoint ) @@ -150,13 +150,13 @@ class QgsPointLocator_VisitorNearestEdge : public IVisitor { QgsFeatureId id = d.getIdentifier(); QgsGeometry *geom = mLocator->mGeoms.value( id ); - QgsPoint pt; + QgsPointXY pt; int afterVertex; double sqrDist = geom->closestSegmentWithContext( mSrcPoint, pt, afterVertex, nullptr, POINT_LOC_EPSILON ); if ( sqrDist < 0 ) return; - QgsPoint edgePoints[2]; + QgsPointXY edgePoints[2]; edgePoints[0] = geom->vertexAt( afterVertex - 1 ); edgePoints[1] = geom->vertexAt( afterVertex ); QgsPointLocator::Match m( QgsPointLocator::Edge, mLocator->mLayer, id, sqrt( sqrDist ), pt, afterVertex - 1, edgePoints ); @@ -171,7 +171,7 @@ class QgsPointLocator_VisitorNearestEdge : public IVisitor private: QgsPointLocator *mLocator = nullptr; QgsPointLocator::Match &mBest; - QgsPoint mSrcPoint; + QgsPointXY mSrcPoint; QgsPointLocator::MatchFilter *mFilter = nullptr; }; @@ -187,7 +187,7 @@ class QgsPointLocator_VisitorArea : public IVisitor { public: //! constructor - QgsPointLocator_VisitorArea( QgsPointLocator *pl, const QgsPoint &origPt, QgsPointLocator::MatchList &list ) + QgsPointLocator_VisitorArea( QgsPointLocator *pl, const QgsPointXY &origPt, QgsPointLocator::MatchList &list ) : mLocator( pl ) , mList( list ) , mGeomPt( QgsGeometry::fromPoint( origPt ) ) @@ -201,7 +201,7 @@ class QgsPointLocator_VisitorArea : public IVisitor QgsFeatureId id = d.getIdentifier(); QgsGeometry *g = mLocator->mGeoms.value( id ); if ( g->intersects( mGeomPt ) ) - mList << QgsPointLocator::Match( QgsPointLocator::Area, mLocator->mLayer, id, 0, QgsPoint() ); + mList << QgsPointLocator::Match( QgsPointLocator::Area, mLocator->mLayer, id, 0, QgsPointXY() ); } private: QgsPointLocator *mLocator = nullptr; @@ -371,10 +371,10 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co { if ( cs.isSegmentInRect( prevx, prevy, thisx, thisy ) ) { - QgsPoint edgePoints[2]; + QgsPointXY edgePoints[2]; edgePoints[0].set( prevx, prevy ); edgePoints[1].set( thisx, thisy ); - lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPoint(), index - 1, edgePoints ); + lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPointXY(), index - 1, edgePoints ); } } @@ -410,10 +410,10 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co { if ( cs.isSegmentInRect( prevx, prevy, thisx, thisy ) ) { - QgsPoint edgePoints[2]; + QgsPointXY edgePoints[2]; edgePoints[0].set( prevx, prevy ); edgePoints[1].set( thisx, thisy ); - lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPoint(), pointIndex - 1, edgePoints ); + lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPointXY(), pointIndex - 1, edgePoints ); } } @@ -451,10 +451,10 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co { if ( cs.isSegmentInRect( prevx, prevy, thisx, thisy ) ) { - QgsPoint edgePoints[2]; + QgsPointXY edgePoints[2]; edgePoints[0].set( prevx, prevy ); edgePoints[1].set( thisx, thisy ); - lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPoint(), pointIndex - 1, edgePoints ); + lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPointXY(), pointIndex - 1, edgePoints ); } } @@ -496,10 +496,10 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co { if ( cs.isSegmentInRect( prevx, prevy, thisx, thisy ) ) { - QgsPoint edgePoints[2]; + QgsPointXY edgePoints[2]; edgePoints[0].set( prevx, prevy ); edgePoints[1].set( thisx, thisy ); - lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPoint(), pointIndex - 1, edgePoints ); + lst << QgsPointLocator::Match( QgsPointLocator::Edge, vl, fid, 0, QgsPointXY(), pointIndex - 1, edgePoints ); } } @@ -840,7 +840,7 @@ void QgsPointLocator::onGeometryChanged( QgsFeatureId fid, const QgsGeometry &ge } -QgsPointLocator::Match QgsPointLocator::nearestVertex( const QgsPoint &point, double tolerance, MatchFilter *filter ) +QgsPointLocator::Match QgsPointLocator::nearestVertex( const QgsPointXY &point, double tolerance, MatchFilter *filter ) { if ( !mRTree ) { @@ -858,7 +858,7 @@ QgsPointLocator::Match QgsPointLocator::nearestVertex( const QgsPoint &point, do return m; } -QgsPointLocator::Match QgsPointLocator::nearestEdge( const QgsPoint &point, double tolerance, MatchFilter *filter ) +QgsPointLocator::Match QgsPointLocator::nearestEdge( const QgsPointXY &point, double tolerance, MatchFilter *filter ) { if ( !mRTree ) { @@ -900,14 +900,14 @@ QgsPointLocator::MatchList QgsPointLocator::edgesInRect( const QgsRectangle &rec return lst; } -QgsPointLocator::MatchList QgsPointLocator::edgesInRect( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter ) +QgsPointLocator::MatchList QgsPointLocator::edgesInRect( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter ) { QgsRectangle rect( point.x() - tolerance, point.y() - tolerance, point.x() + tolerance, point.y() + tolerance ); return edgesInRect( rect, filter ); } -QgsPointLocator::MatchList QgsPointLocator::pointInPolygon( const QgsPoint &point ) +QgsPointLocator::MatchList QgsPointLocator::pointInPolygon( const QgsPointXY &point ) { if ( !mRTree ) { diff --git a/src/core/qgspointlocator.h b/src/core/qgspointlocator.h index cbdff560761..e5b59f78996 100644 --- a/src/core/qgspointlocator.h +++ b/src/core/qgspointlocator.h @@ -16,7 +16,7 @@ #ifndef QGSPOINTLOCATOR_H #define QGSPOINTLOCATOR_H -class QgsPoint; +class QgsPointXY; class QgsVectorLayer; #include "qgis_core.h" @@ -109,7 +109,7 @@ class CORE_EXPORT QgsPointLocator : public QObject , mVertexIndex( 0 ) {} - Match( QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPoint &pt, int vertexIndex = 0, QgsPoint *edgePoints = nullptr ) + Match( QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPointXY &pt, int vertexIndex = 0, QgsPointXY *edgePoints = nullptr ) : mType( t ) , mDist( dist ) , mPoint( pt ) @@ -137,7 +137,7 @@ class CORE_EXPORT QgsPointLocator : public QObject //! for vertex / edge match //! coords depending on what class returns it (geom.cache: layer coords, map canvas snapper: dest coords) - QgsPoint point() const { return mPoint; } + QgsPointXY point() const { return mPoint; } //! for vertex / edge match (first vertex of the edge) int vertexIndex() const { return mVertexIndex; } @@ -154,7 +154,7 @@ class CORE_EXPORT QgsPointLocator : public QObject QgsFeatureId featureId() const { return mFid; } //! Only for a valid edge match - obtain endpoints of the edge - void edgePoints( QgsPoint &pt1 SIP_OUT, QgsPoint &pt2 SIP_OUT ) const + void edgePoints( QgsPointXY &pt1 SIP_OUT, QgsPointXY &pt2 SIP_OUT ) const { pt1 = mEdgePoints[0]; pt2 = mEdgePoints[1]; @@ -174,11 +174,11 @@ class CORE_EXPORT QgsPointLocator : public QObject protected: Type mType; double mDist; - QgsPoint mPoint; + QgsPointXY mPoint; QgsVectorLayer *mLayer = nullptr; QgsFeatureId mFid; int mVertexIndex; // e.g. vertex index - QgsPoint mEdgePoints[2]; + QgsPointXY mEdgePoints[2]; }; #ifndef SIP_RUN @@ -200,21 +200,21 @@ class CORE_EXPORT QgsPointLocator : public QObject //! Find nearest vertex to the specified point - up to distance specified by tolerance //! Optional filter may discard unwanted matches. - Match nearestVertex( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter = nullptr ); + Match nearestVertex( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = nullptr ); //! Find nearest edge to the specified point - up to distance specified by tolerance //! Optional filter may discard unwanted matches. - Match nearestEdge( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter = nullptr ); + Match nearestEdge( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = nullptr ); //! Find edges within a specified recangle //! Optional filter may discard unwanted matches. MatchList edgesInRect( const QgsRectangle &rect, QgsPointLocator::MatchFilter *filter = nullptr ); //! Override of edgesInRect that construct rectangle from a center point and tolerance - MatchList edgesInRect( const QgsPoint &point, double tolerance, QgsPointLocator::MatchFilter *filter = nullptr ); + MatchList edgesInRect( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = nullptr ); // point-in-polygon query // TODO: function to return just the first match? //! find out if the point is in any polygons - MatchList pointInPolygon( const QgsPoint &point ); + MatchList pointInPolygon( const QgsPointXY &point ); // diff --git a/src/core/qgspropertytransformer.cpp b/src/core/qgspropertytransformer.cpp index 77b21f9900e..c5b482fc7da 100644 --- a/src/core/qgspropertytransformer.cpp +++ b/src/core/qgspropertytransformer.cpp @@ -689,18 +689,18 @@ void QgsColorRampTransformer::setColorRamp( QgsColorRamp *ramp ) // QgsCurveTransform // -bool sortByX( const QgsPoint &a, const QgsPoint &b ) +bool sortByX( const QgsPointXY &a, const QgsPointXY &b ) { return a.x() < b.x(); } QgsCurveTransform::QgsCurveTransform() { - mControlPoints << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ); + mControlPoints << QgsPointXY( 0, 0 ) << QgsPointXY( 1, 1 ); calcSecondDerivativeArray(); } -QgsCurveTransform::QgsCurveTransform( const QList &controlPoints ) +QgsCurveTransform::QgsCurveTransform( const QList &controlPoints ) : mControlPoints( controlPoints ) { std::sort( mControlPoints.begin(), mControlPoints.end(), sortByX ); @@ -734,21 +734,21 @@ QgsCurveTransform &QgsCurveTransform::operator=( const QgsCurveTransform &other return *this; } -void QgsCurveTransform::setControlPoints( const QList &points ) +void QgsCurveTransform::setControlPoints( const QList &points ) { mControlPoints = points; std::sort( mControlPoints.begin(), mControlPoints.end(), sortByX ); for ( int i = 0; i < mControlPoints.count(); ++i ) { - mControlPoints[ i ] = QgsPoint( qBound( 0.0, mControlPoints.at( i ).x(), 1.0 ), - qBound( 0.0, mControlPoints.at( i ).y(), 1.0 ) ); + mControlPoints[ i ] = QgsPointXY( qBound( 0.0, mControlPoints.at( i ).x(), 1.0 ), + qBound( 0.0, mControlPoints.at( i ).y(), 1.0 ) ); } calcSecondDerivativeArray(); } void QgsCurveTransform::addControlPoint( double x, double y ) { - QgsPoint point( x, y ); + QgsPointXY point( x, y ); if ( mControlPoints.contains( point ) ) return; @@ -802,10 +802,10 @@ double QgsCurveTransform::y( double x ) const return qBound( 0.0, mControlPoints.at( n - 1 ).y(), 1.0 ); // find corresponding segment - QList::const_iterator pointIt = mControlPoints.constBegin(); - QgsPoint currentControlPoint = *pointIt; + QList::const_iterator pointIt = mControlPoints.constBegin(); + QgsPointXY currentControlPoint = *pointIt; ++pointIt; - QgsPoint nextControlPoint = *pointIt; + QgsPointXY nextControlPoint = *pointIt; for ( int i = 0; i < n - 1; ++i ) { @@ -852,10 +852,10 @@ QVector QgsCurveTransform::y( const QVector &x ) const } // find corresponding segment - QList::const_iterator pointIt = mControlPoints.constBegin(); - QgsPoint currentControlPoint = *pointIt; + QList::const_iterator pointIt = mControlPoints.constBegin(); + QgsPointXY currentControlPoint = *pointIt; ++pointIt; - QgsPoint nextControlPoint = *pointIt; + QgsPointXY nextControlPoint = *pointIt; int xIndex = 0; double currentX = x.at( xIndex ); @@ -914,7 +914,7 @@ bool QgsCurveTransform::readXml( const QDomElement &elem, const QDomDocument & ) if ( xVals.count() != yVals.count() ) return false; - QList< QgsPoint > newPoints; + QList< QgsPointXY > newPoints; bool ok = false; for ( int i = 0; i < xVals.count(); ++i ) { @@ -924,7 +924,7 @@ bool QgsCurveTransform::readXml( const QDomElement &elem, const QDomDocument & ) double y = yVals.at( i ).toDouble( &ok ); if ( !ok ) return false; - newPoints << QgsPoint( x, y ); + newPoints << QgsPointXY( x, y ); } setControlPoints( newPoints ); return true; @@ -934,7 +934,7 @@ bool QgsCurveTransform::writeXml( QDomElement &transformElem, QDomDocument & ) c { QStringList x; QStringList y; - Q_FOREACH ( const QgsPoint &p, mControlPoints ) + Q_FOREACH ( const QgsPointXY &p, mControlPoints ) { x << qgsDoubleToString( p.x() ); y << qgsDoubleToString( p.y() ); @@ -952,7 +952,7 @@ QVariant QgsCurveTransform::toVariant() const QStringList x; QStringList y; - Q_FOREACH ( const QgsPoint &p, mControlPoints ) + Q_FOREACH ( const QgsPointXY &p, mControlPoints ) { x << qgsDoubleToString( p.x() ); y << qgsDoubleToString( p.y() ); @@ -976,7 +976,7 @@ bool QgsCurveTransform::loadVariant( const QVariant &transformer ) if ( xVals.count() != yVals.count() ) return false; - QList< QgsPoint > newPoints; + QList< QgsPointXY > newPoints; bool ok = false; for ( int i = 0; i < xVals.count(); ++i ) { @@ -986,7 +986,7 @@ bool QgsCurveTransform::loadVariant( const QVariant &transformer ) double y = yVals.at( i ).toDouble( &ok ); if ( !ok ) return false; - newPoints << QgsPoint( x, y ); + newPoints << QgsPointXY( x, y ); } setControlPoints( newPoints ); return true; @@ -1010,12 +1010,12 @@ void QgsCurveTransform::calcSecondDerivativeArray() matrix[1] = 1; matrix[2] = 0; result[0] = 0; - QList::const_iterator pointIt = mControlPoints.constBegin(); - QgsPoint pointIm1 = *pointIt; + QList::const_iterator pointIt = mControlPoints.constBegin(); + QgsPointXY pointIm1 = *pointIt; ++pointIt; - QgsPoint pointI = *pointIt; + QgsPointXY pointI = *pointIt; ++pointIt; - QgsPoint pointIp1 = *pointIt; + QgsPointXY pointIp1 = *pointIt; for ( int i = 1; i < n - 1; ++i ) { diff --git a/src/core/qgspropertytransformer.h b/src/core/qgspropertytransformer.h index 382f8d2212e..cb299370401 100644 --- a/src/core/qgspropertytransformer.h +++ b/src/core/qgspropertytransformer.h @@ -68,7 +68,7 @@ class CORE_EXPORT QgsCurveTransform * Behavior is undefined if duplicate x values exist in the control points * list. */ - QgsCurveTransform( const QList< QgsPoint > &controlPoints ); + QgsCurveTransform( const QList< QgsPointXY > &controlPoints ); ~QgsCurveTransform(); @@ -83,14 +83,14 @@ class CORE_EXPORT QgsCurveTransform * Returns a list of the control points for the transform. * \see setControlPoints() */ - QList< QgsPoint > controlPoints() const { return mControlPoints; } + QList< QgsPointXY > controlPoints() const { return mControlPoints; } /** * Sets the list of control points for the transform. Any existing * points are removed. * \see controlPoints() */ - void setControlPoints( const QList< QgsPoint > &points ); + void setControlPoints( const QList< QgsPointXY > &points ); /** * Adds a control point to the transform. Behavior is undefined if duplicate @@ -154,7 +154,7 @@ class CORE_EXPORT QgsCurveTransform void calcSecondDerivativeArray(); - QList< QgsPoint > mControlPoints; + QList< QgsPointXY > mControlPoints; double *mSecondDerivativeArray = nullptr; }; diff --git a/src/core/qgssnappingutils.cpp b/src/core/qgssnappingutils.cpp index d91ff4e512a..a0af966bbdf 100644 --- a/src/core/qgssnappingutils.cpp +++ b/src/core/qgssnappingutils.cpp @@ -59,7 +59,7 @@ void QgsSnappingUtils::clearAllLocators() } -QgsPointLocator *QgsSnappingUtils::locatorForLayerUsingStrategy( QgsVectorLayer *vl, const QgsPoint &pointMap, double tolerance ) +QgsPointLocator *QgsSnappingUtils::locatorForLayerUsingStrategy( QgsVectorLayer *vl, const QgsPointXY &pointMap, double tolerance ) { QgsRectangle aoi( pointMap.x() - tolerance, pointMap.y() - tolerance, pointMap.x() + tolerance, pointMap.y() + tolerance ); @@ -69,7 +69,7 @@ QgsPointLocator *QgsSnappingUtils::locatorForLayerUsingStrategy( QgsVectorLayer return temporaryLocatorForLayer( vl, pointMap, tolerance ); } -QgsPointLocator *QgsSnappingUtils::temporaryLocatorForLayer( QgsVectorLayer *vl, const QgsPoint &pointMap, double tolerance ) +QgsPointLocator *QgsSnappingUtils::temporaryLocatorForLayer( QgsVectorLayer *vl, const QgsPointXY &pointMap, double tolerance ) { if ( mTemporaryLocators.contains( vl ) ) delete mTemporaryLocators.take( vl ); @@ -100,12 +100,12 @@ bool QgsSnappingUtils::isIndexPrepared( QgsVectorLayer *vl, const QgsRectangle & } -static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPoint &pt, const QgsPointLocator::MatchList &segments ) +static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPointXY &pt, const QgsPointLocator::MatchList &segments ) { if ( segments.isEmpty() ) return QgsPointLocator::Match(); - QSet endpoints; + QSet endpoints; // make a geometry QList geoms; @@ -123,10 +123,10 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPoint &p QgsGeometry g = QgsGeometry::unaryUnion( geoms ); // get intersection points - QList newPoints; + QList newPoints; if ( g.wkbType() == QgsWkbTypes::LineString ) { - Q_FOREACH ( const QgsPoint &p, g.asPolyline() ) + Q_FOREACH ( const QgsPointXY &p, g.asPolyline() ) { if ( !endpoints.contains( p ) ) newPoints << p; @@ -136,7 +136,7 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPoint &p { Q_FOREACH ( const QgsPolyline &pl, g.asMultiPolyline() ) { - Q_FOREACH ( const QgsPoint &p, pl ) + Q_FOREACH ( const QgsPointXY &p, pl ) { if ( !endpoints.contains( p ) ) newPoints << p; @@ -148,9 +148,9 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPoint &p return QgsPointLocator::Match(); // find the closest points - QgsPoint minP; + QgsPointXY minP; double minSqrDist = 1e20; // "infinity" - Q_FOREACH ( const QgsPoint &p, newPoints ) + Q_FOREACH ( const QgsPointXY &p, newPoints ) { double sqrDist = pt.sqrDist( p.x(), p.y() ); if ( sqrDist < minSqrDist ) @@ -182,7 +182,7 @@ static void _replaceIfBetter( QgsPointLocator::Match &mBest, const QgsPointLocat } -static void _updateBestMatch( QgsPointLocator::Match &bestMatch, const QgsPoint &pointMap, QgsPointLocator *loc, int type, double tolerance, QgsPointLocator::MatchFilter *filter ) +static void _updateBestMatch( QgsPointLocator::Match &bestMatch, const QgsPointXY &pointMap, QgsPointLocator *loc, int type, double tolerance, QgsPointLocator::MatchFilter *filter ) { if ( type & QgsPointLocator::Vertex ) { @@ -200,13 +200,13 @@ QgsPointLocator::Match QgsSnappingUtils::snapToMap( QPoint point, QgsPointLocato return snapToMap( mMapSettings.mapToPixel().toMapCoordinates( point ), filter ); } -inline QgsRectangle _areaOfInterest( const QgsPoint &point, double tolerance ) +inline QgsRectangle _areaOfInterest( const QgsPointXY &point, double tolerance ) { return QgsRectangle( point.x() - tolerance, point.y() - tolerance, point.x() + tolerance, point.y() + tolerance ); } -QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPoint &pointMap, QgsPointLocator::MatchFilter *filter ) +QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPointXY &pointMap, QgsPointLocator::MatchFilter *filter ) { if ( !mMapSettings.hasValidSettings() || !mSnappingConfig.enabled() ) { @@ -379,7 +379,7 @@ void QgsSnappingUtils::prepareIndex( const QList &layers else { // use area as big as we think may fit into our limit - QgsPoint c = entry.second.center(); + QgsPointXY c = entry.second.center(); double halfSide = sqrt( indexReasonableArea ) / 2; QgsRectangle rect( c.x() - halfSide, c.y() - halfSide, c.x() + halfSide, c.y() + halfSide ); @@ -435,7 +435,7 @@ QgsPointLocator::Match QgsSnappingUtils::snapToCurrentLayer( QPoint point, int t if ( !mCurrentLayer ) return QgsPointLocator::Match(); - QgsPoint pointMap = mMapSettings.mapToPixel().toMapCoordinates( point ); + QgsPointXY pointMap = mMapSettings.mapToPixel().toMapCoordinates( point ); double tolerance = QgsTolerance::vertexSearchRadius( mMapSettings ); QgsPointLocator *loc = locatorForLayerUsingStrategy( mCurrentLayer, pointMap, tolerance ); diff --git a/src/core/qgssnappingutils.h b/src/core/qgssnappingutils.h index a5ddedf5b99..bc1c7b290e7 100644 --- a/src/core/qgssnappingutils.h +++ b/src/core/qgssnappingutils.h @@ -60,7 +60,7 @@ class CORE_EXPORT QgsSnappingUtils : public QObject //! Snap to map according to the current configuration (mode). Optional filter allows discarding unwanted matches. QgsPointLocator::Match snapToMap( QPoint point, QgsPointLocator::MatchFilter *filter = nullptr ); - QgsPointLocator::Match snapToMap( const QgsPoint &pointMap, QgsPointLocator::MatchFilter *filter = nullptr ); + QgsPointLocator::Match snapToMap( const QgsPointXY &pointMap, QgsPointLocator::MatchFilter *filter = nullptr ); //! Snap to current layer QgsPointLocator::Match snapToCurrentLayer( QPoint point, int type, QgsPointLocator::MatchFilter *filter = nullptr ); @@ -198,9 +198,9 @@ class CORE_EXPORT QgsSnappingUtils : public QObject void clearAllLocators(); //! return a locator (temporary or not) according to the indexing strategy - QgsPointLocator *locatorForLayerUsingStrategy( QgsVectorLayer *vl, const QgsPoint &pointMap, double tolerance ); + QgsPointLocator *locatorForLayerUsingStrategy( QgsVectorLayer *vl, const QgsPointXY &pointMap, double tolerance ); //! return a temporary locator with index only for a small area (will be replaced by another one on next request) - QgsPointLocator *temporaryLocatorForLayer( QgsVectorLayer *vl, const QgsPoint &pointMap, double tolerance ); + QgsPointLocator *temporaryLocatorForLayer( QgsVectorLayer *vl, const QgsPointXY &pointMap, double tolerance ); typedef QPair< QgsVectorLayer *, QgsRectangle > LayerAndAreaOfInterest; diff --git a/src/core/qgsspatialindex.cpp b/src/core/qgsspatialindex.cpp index 349ae48f5e0..0861499e98e 100644 --- a/src/core/qgsspatialindex.cpp +++ b/src/core/qgsspatialindex.cpp @@ -332,7 +332,7 @@ QList QgsSpatialIndex::intersects( const QgsRectangle &rect ) cons return list; } -QList QgsSpatialIndex::nearestNeighbor( const QgsPoint &point, int neighbors ) const +QList QgsSpatialIndex::nearestNeighbor( const QgsPointXY &point, int neighbors ) const { QList list; QgisVisitor visitor( list ); diff --git a/src/core/qgsspatialindex.h b/src/core/qgsspatialindex.h index 7f2b1bbf06a..8cf18b620cc 100644 --- a/src/core/qgsspatialindex.h +++ b/src/core/qgsspatialindex.h @@ -35,7 +35,7 @@ namespace SpatialIndex SIP_SKIP class QgsFeature; class QgsRectangle; -class QgsPoint; +class QgsPointXY; #include "qgis_core.h" #include "qgis_sip.h" @@ -98,7 +98,7 @@ class CORE_EXPORT QgsSpatialIndex QList intersects( const QgsRectangle &rect ) const; //! Returns nearest neighbors (their count is specified by second parameter) - QList nearestNeighbor( const QgsPoint &point, int neighbors ) const; + QList nearestNeighbor( const QgsPointXY &point, int neighbors ) const; /* debugging */ diff --git a/src/core/qgstolerance.cpp b/src/core/qgstolerance.cpp index cd024655fa7..31e9f404554 100644 --- a/src/core/qgstolerance.cpp +++ b/src/core/qgstolerance.cpp @@ -26,10 +26,10 @@ double _ratioMU2LU( const QgsMapSettings &mapSettings, QgsMapLayer *layer ) { double distMU = mapSettings.mapUnitsPerPixel(); - QgsPoint ptMapCenterMU = mapSettings.visibleExtent().center(); - QgsPoint ptMapCenterRightMU( ptMapCenterMU.x() + distMU, ptMapCenterMU.y() ); - QgsPoint ptMapCenterLU = mapSettings.mapToLayerCoordinates( layer, ptMapCenterMU ); - QgsPoint ptMapCenterRightLU = mapSettings.mapToLayerCoordinates( layer, ptMapCenterRightMU ); + QgsPointXY ptMapCenterMU = mapSettings.visibleExtent().center(); + QgsPointXY ptMapCenterRightMU( ptMapCenterMU.x() + distMU, ptMapCenterMU.y() ); + QgsPointXY ptMapCenterLU = mapSettings.mapToLayerCoordinates( layer, ptMapCenterMU ); + QgsPointXY ptMapCenterRightLU = mapSettings.mapToLayerCoordinates( layer, ptMapCenterRightMU ); double distLU = sqrt( ptMapCenterLU.sqrDist( ptMapCenterRightLU ) ); double ratio = distMU / distLU; return ratio; @@ -101,10 +101,10 @@ double QgsTolerance::computeMapUnitPerPixel( QgsMapLayer *layer, const QgsMapSet // the layer is projected. Find out how many pixels are in one map unit - either horizontal and vertical direction // this check might not work correctly in some cases // (on a large area the pixels projected around "0,0" can have different properties from the actual point) - QgsPoint p1 = toLayerCoordinates( layer, mapSettings, QPoint( 0, 1 ) ); - QgsPoint p2 = toLayerCoordinates( layer, mapSettings, QPoint( 0, 2 ) ); - QgsPoint p3 = toLayerCoordinates( layer, mapSettings, QPoint( 1, 0 ) ); - QgsPoint p4 = toLayerCoordinates( layer, mapSettings, QPoint( 2, 0 ) ); + QgsPointXY p1 = toLayerCoordinates( layer, mapSettings, QPoint( 0, 1 ) ); + QgsPointXY p2 = toLayerCoordinates( layer, mapSettings, QPoint( 0, 2 ) ); + QgsPointXY p3 = toLayerCoordinates( layer, mapSettings, QPoint( 1, 0 ) ); + QgsPointXY p4 = toLayerCoordinates( layer, mapSettings, QPoint( 2, 0 ) ); double x = p1.sqrDist( p2 ); double y = p3.sqrDist( p4 ); if ( x > y ) @@ -118,8 +118,8 @@ double QgsTolerance::computeMapUnitPerPixel( QgsMapLayer *layer, const QgsMapSet } -QgsPoint QgsTolerance::toLayerCoordinates( QgsMapLayer *layer, const QgsMapSettings &mapSettings, QPoint point ) +QgsPointXY QgsTolerance::toLayerCoordinates( QgsMapLayer *layer, const QgsMapSettings &mapSettings, QPoint point ) { - QgsPoint pt = mapSettings.mapToPixel().toMapCoordinates( point ); + QgsPointXY pt = mapSettings.mapToPixel().toMapCoordinates( point ); return mapSettings.mapToLayerCoordinates( layer, pt ); } diff --git a/src/core/qgstolerance.h b/src/core/qgstolerance.h index 7acfc925db4..55dbda7b6d7 100644 --- a/src/core/qgstolerance.h +++ b/src/core/qgstolerance.h @@ -21,7 +21,7 @@ class QgsMapSettings; class QgsMapLayer; -class QgsPoint; +class QgsPointXY; /** \ingroup core * This is the class is providing tolerance value in map unit values. @@ -88,7 +88,7 @@ class CORE_EXPORT QgsTolerance private: static double computeMapUnitPerPixel( QgsMapLayer *layer, const QgsMapSettings &mapSettings ); - static QgsPoint toLayerCoordinates( QgsMapLayer *layer, const QgsMapSettings &mapSettings, QPoint point ); + static QgsPointXY toLayerCoordinates( QgsMapLayer *layer, const QgsMapSettings &mapSettings, QPoint point ); }; diff --git a/src/core/qgstracer.cpp b/src/core/qgstracer.cpp index b5234f72751..ec8af6373f1 100644 --- a/src/core/qgstracer.cpp +++ b/src/core/qgstracer.cpp @@ -62,10 +62,10 @@ double distance2D( const QgsPolyline &coords ) // TODO: move to geometry utils -double closestSegment( const QgsPolyline &pl, const QgsPoint &pt, int &vertexAfter, double epsilon ) +double closestSegment( const QgsPolyline &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon ) { double sqrDist = std::numeric_limits::max(); - const QgsPoint *pldata = pl.constData(); + const QgsPointXY *pldata = pl.constData(); int plcount = pl.count(); double prevX = pldata[0].x(), prevY = pldata[0].y(); double segmentPtX, segmentPtY; @@ -97,7 +97,7 @@ struct QgsTracerGraph //! vertices that the edge connects int v1, v2; //! coordinates of the edge (including endpoints) - QVector coords; + QVector coords; int otherVertex( int v0 ) const { return v1 == v0 ? v2 : v1; } double weight() const { return distance2D( coords ); } @@ -106,7 +106,7 @@ struct QgsTracerGraph struct V { //! location of the vertex - QgsPoint pt; + QgsPointXY pt; //! indices of adjacent edges (used in Dijkstra algorithm) QVector edges; }; @@ -127,12 +127,12 @@ QgsTracerGraph *makeGraph( const QVector &edges ) { QgsTracerGraph *g = new QgsTracerGraph(); g->joinedVertices = 0; - QHash point2vertex; + QHash point2vertex; Q_FOREACH ( const QgsPolyline &line, edges ) { - QgsPoint p1( line[0] ); - QgsPoint p2( line[line.count() - 1] ); + QgsPointXY p1( line[0] ); + QgsPointXY p2( line[line.count() - 1] ); int v1 = -1, v2 = -1; // get or add vertex 1 @@ -176,10 +176,10 @@ QgsTracerGraph *makeGraph( const QVector &edges ) } -QVector shortestPath( const QgsTracerGraph &g, int v1, int v2 ) +QVector shortestPath( const QgsTracerGraph &g, int v1, int v2 ) { if ( v1 == -1 || v2 == -1 ) - return QVector(); // invalid input + return QVector(); // invalid input // priority queue to drive Dijkstra: // first of the pair is vertex index, second is distance @@ -229,17 +229,17 @@ QVector shortestPath( const QgsTracerGraph &g, int v1, int v2 ) } if ( u != v2 ) // there's no path to the end vertex - return QVector(); + return QVector(); //qDebug("dist %f", D[u]); - QVector points; + QVector points; QList path; while ( S[u] != -1 ) { path << S[u]; const QgsTracerGraph::E &e = g.e[S[u]]; - QVector edgePoints = e.coords; + QVector edgePoints = e.coords; if ( edgePoints[0] != g.v[u].pt ) std::reverse( edgePoints.begin(), edgePoints.end() ); if ( !points.isEmpty() ) @@ -257,7 +257,7 @@ QVector shortestPath( const QgsTracerGraph &g, int v1, int v2 ) } -int point2vertex( const QgsTracerGraph &g, const QgsPoint &pt, double epsilon = 1e-6 ) +int point2vertex( const QgsTracerGraph &g, const QgsPointXY &pt, double epsilon = 1e-6 ) { // TODO: use spatial index @@ -272,7 +272,7 @@ int point2vertex( const QgsTracerGraph &g, const QgsPoint &pt, double epsilon = } -int point2edge( const QgsTracerGraph &g, const QgsPoint &pt, int &lineVertexAfter, double epsilon = 1e-6 ) +int point2edge( const QgsTracerGraph &g, const QgsPointXY &pt, int &lineVertexAfter, double epsilon = 1e-6 ) { int vertexAfter; @@ -293,7 +293,7 @@ int point2edge( const QgsTracerGraph &g, const QgsPoint &pt, int &lineVertexAfte } -void splitLinestring( const QgsPolyline &points, const QgsPoint &pt, int lineVertexAfter, QgsPolyline &pts1, QgsPolyline &pts2 ) +void splitLinestring( const QgsPolyline &points, const QgsPointXY &pt, int lineVertexAfter, QgsPolyline &pts1, QgsPolyline &pts2 ) { int count1 = lineVertexAfter; int count2 = points.count() - lineVertexAfter; @@ -310,7 +310,7 @@ void splitLinestring( const QgsPolyline &points, const QgsPoint &pt, int lineVer } -int joinVertexToGraph( QgsTracerGraph &g, const QgsPoint &pt ) +int joinVertexToGraph( QgsTracerGraph &g, const QgsPointXY &pt ) { // find edge where the point is int lineVertexAfter; @@ -363,7 +363,7 @@ int joinVertexToGraph( QgsTracerGraph &g, const QgsPoint &pt ) } -int pointInGraph( QgsTracerGraph &g, const QgsPoint &pt ) +int pointInGraph( QgsTracerGraph &g, const QgsPointXY &pt ) { // try to use existing vertex in the graph int v = point2vertex( g, pt ); @@ -663,13 +663,13 @@ void QgsTracer::onLayerDestroyed( QObject *obj ) invalidateGraph(); } -QVector QgsTracer::findShortestPath( const QgsPoint &p1, const QgsPoint &p2, PathError *error ) +QVector QgsTracer::findShortestPath( const QgsPointXY &p1, const QgsPointXY &p2, PathError *error ) { init(); // does nothing if the graph exists already if ( !mGraph ) { if ( error ) *error = ErrTooManyFeatures; - return QVector(); + return QVector(); } QTime t; @@ -681,12 +681,12 @@ QVector QgsTracer::findShortestPath( const QgsPoint &p1, const QgsPoin if ( v1 == -1 ) { if ( error ) *error = ErrPoint1; - return QVector(); + return QVector(); } if ( v2 == -1 ) { if ( error ) *error = ErrPoint2; - return QVector(); + return QVector(); } QTime t2; @@ -706,7 +706,7 @@ QVector QgsTracer::findShortestPath( const QgsPoint &p1, const QgsPoin return points; } -bool QgsTracer::isPointSnapped( const QgsPoint &pt ) +bool QgsTracer::isPointSnapped( const QgsPointXY &pt ) { init(); // does nothing if the graph exists already if ( !mGraph ) diff --git a/src/core/qgstracer.h b/src/core/qgstracer.h index f1a2901b09b..4bc3e8f8928 100644 --- a/src/core/qgstracer.h +++ b/src/core/qgstracer.h @@ -90,10 +90,10 @@ class CORE_EXPORT QgsTracer : public QObject //! Given two points, find the shortest path and return points on the way. //! The optional "error" argument may receive error code (PathError enum) if it is not null //! \returns array of points - trace of linestrings of other features (empty array one error) - QVector findShortestPath( const QgsPoint &p1, const QgsPoint &p2, PathError *error SIP_OUT = nullptr ); + QVector findShortestPath( const QgsPointXY &p1, const QgsPointXY &p2, PathError *error SIP_OUT = nullptr ); //! Find out whether the point is snapped to a vertex or edge (i.e. it can be used for tracing start/stop) - bool isPointSnapped( const QgsPoint &pt ); + bool isPointSnapped( const QgsPointXY &pt ); protected: //! Allows derived classes to setup the settings just before the tracer is initialized. diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index c4c67449baf..911925557ce 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -1005,7 +1005,7 @@ bool QgsVectorLayer::insertVertex( double x, double y, QgsFeatureId atFeatureId, } -bool QgsVectorLayer::insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex ) +bool QgsVectorLayer::insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return false; @@ -1031,7 +1031,7 @@ bool QgsVectorLayer::moveVertex( double x, double y, QgsFeatureId atFeatureId, i return result; } -bool QgsVectorLayer::moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) +bool QgsVectorLayer::moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return false; @@ -1090,7 +1090,7 @@ bool QgsVectorLayer::deleteSelectedFeatures( int *deletedCount ) return deleted == count; } -int QgsVectorLayer::addRing( const QList &ring, QgsFeatureId *featureId ) +int QgsVectorLayer::addRing( const QList &ring, QgsFeatureId *featureId ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return 6; @@ -1151,7 +1151,7 @@ int QgsVectorLayer::addRing( QgsCurve *ring, QgsFeatureId *featureId ) return result; } -int QgsVectorLayer::addPart( const QList &points ) +int QgsVectorLayer::addPart( const QList &points ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return 7; @@ -1242,7 +1242,7 @@ int QgsVectorLayer::translateFeature( QgsFeatureId featureId, double dx, double return result; } -int QgsVectorLayer::splitParts( const QList &splitLine, bool topologicalEditing ) +int QgsVectorLayer::splitParts( const QList &splitLine, bool topologicalEditing ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return -1; @@ -1251,7 +1251,7 @@ int QgsVectorLayer::splitParts( const QList &splitLine, bool topologic return utils.splitParts( splitLine, topologicalEditing ); } -int QgsVectorLayer::splitFeatures( const QList &splitLine, bool topologicalEditing ) +int QgsVectorLayer::splitFeatures( const QList &splitLine, bool topologicalEditing ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return -1; @@ -1269,7 +1269,7 @@ int QgsVectorLayer::addTopologicalPoints( const QgsGeometry &geom ) return utils.addTopologicalPoints( geom ); } -int QgsVectorLayer::addTopologicalPoints( const QgsPoint &p ) +int QgsVectorLayer::addTopologicalPoints( const QgsPointXY &p ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return -1; diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h index 41fd3186524..faae7d4fb49 100644 --- a/src/core/qgsvectorlayer.h +++ b/src/core/qgsvectorlayer.h @@ -68,7 +68,7 @@ class QgsVectorLayerEditBuffer; class QgsVectorLayerJoinBuffer; class QgsVectorLayerFeatureCounter; class QgsAbstractVectorLayerLabeling; -class QgsPointV2; +class QgsPoint; class QgsFeedback; typedef QList QgsAttributeList; @@ -920,7 +920,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * in the given ring, item (first number is index 0), and feature * Not meaningful for Point geometries */ - bool insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex ); + bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex ); /** Moves the vertex at the given position number, * ring and item (first number is index 0), and feature @@ -933,7 +933,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * to the given coordinates * \note available in Python as moveVertexV2 */ - bool moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 ); + bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 ); /** Deletes a vertex from a feature. * \param featureId ID of feature to remove vertex from @@ -960,7 +960,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * 6 layer not editable */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int addRing( const QList &ring, QgsFeatureId *featureId = nullptr ); + int addRing( const QList &ring, QgsFeatureId *featureId = nullptr ); /** Adds a ring to polygon/multipolygon features (takes ownership) * \param ring ring to add @@ -987,7 +987,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * 7 layer not editable */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int addPart( const QList &ring ); + int addPart( const QList &ring ); /** Adds a new part polygon to a multipart feature * \returns @@ -1023,7 +1023,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * 4 if there is a selection but no feature split */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int splitParts( const QList &splitLine, bool topologicalEditing = false ); + int splitParts( const QList &splitLine, bool topologicalEditing = false ); /** Splits features cut by the given line * \param splitLine line that splits the layer features @@ -1033,7 +1033,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * 4 if there is a selection but no feature split */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); /** Adds topological points for every vertex of the geometry. * \param geom the geometry where each vertex is added to segments of other features @@ -1049,7 +1049,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte * \param p position of the vertex * \returns 0 in case of success */ - int addTopologicalPoints( const QgsPoint &p ); + int addTopologicalPoints( const QgsPointXY &p ); /** Access to labeling configuration. May be null if labeling is not used. * \since QGIS 3.0 diff --git a/src/core/qgsvectorlayerdiagramprovider.cpp b/src/core/qgsvectorlayerdiagramprovider.cpp index 509c66edf04..69d716aea90 100644 --- a/src/core/qgsvectorlayerdiagramprovider.cpp +++ b/src/core/qgsvectorlayerdiagramprovider.cpp @@ -123,10 +123,10 @@ void QgsVectorLayerDiagramProvider::drawLabel( QgsRenderContext &context, pal::L centerX += label->getX( i ); centerY += label->getY( i ); } - QgsPoint outPt( centerX / 4.0, centerY / 4.0 ); + QgsPointXY outPt( centerX / 4.0, centerY / 4.0 ); //then, calculate the top left point for the diagram with this center position - QgsPoint centerPt = xform.transform( outPt.x() - label->getWidth() / 2, - outPt.y() - label->getHeight() / 2 ); + QgsPointXY centerPt = xform.transform( outPt.x() - label->getWidth() / 2, + outPt.y() - label->getHeight() / 2 ); mSettings.renderer()->renderDiagram( feature, context, centerPt.toQPointF(), mSettings.dataDefinedProperties() ); @@ -284,7 +284,7 @@ QgsLabelFeature *QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature &fea QgsDiagramLabelFeature *lf = new QgsDiagramLabelFeature( feat.id(), geomCopy, QSizeF( diagramWidth, diagramHeight ) ); lf->setHasFixedPosition( ddPos ); - lf->setFixedPosition( QgsPoint( ddPosX, ddPosY ) ); + lf->setFixedPosition( QgsPointXY( ddPosX, ddPosY ) ); lf->setHasFixedAngle( true ); lf->setFixedAngle( 0 ); lf->setAlwaysShow( alwaysShow ); @@ -322,8 +322,8 @@ QgsLabelFeature *QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature &fea lf->setZIndex( zIndex ); // label distance - QgsPoint ptZero = mapSettings.mapToPixel().toMapCoordinates( 0, 0 ); - QgsPoint ptOne = mapSettings.mapToPixel().toMapCoordinates( 1, 0 ); + QgsPointXY ptZero = mapSettings.mapToPixel().toMapCoordinates( 0, 0 ); + QgsPointXY ptOne = mapSettings.mapToPixel().toMapCoordinates( 1, 0 ); double dist = mSettings.distance(); if ( mSettings.dataDefinedProperties().hasProperty( QgsDiagramLayerSettings::Distance ) diff --git a/src/core/qgsvectorlayereditutils.cpp b/src/core/qgsvectorlayereditutils.cpp index fd4e97fa142..c6409ad243b 100644 --- a/src/core/qgsvectorlayereditutils.cpp +++ b/src/core/qgsvectorlayereditutils.cpp @@ -50,7 +50,7 @@ bool QgsVectorLayerEditUtils::insertVertex( double x, double y, QgsFeatureId atF return true; } -bool QgsVectorLayerEditUtils::insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex ) +bool QgsVectorLayerEditUtils::insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex ) { if ( !L->hasGeometryType() ) return false; @@ -69,11 +69,11 @@ bool QgsVectorLayerEditUtils::insertVertex( const QgsPointV2 &point, QgsFeatureI bool QgsVectorLayerEditUtils::moveVertex( double x, double y, QgsFeatureId atFeatureId, int atVertex ) { - QgsPointV2 p( x, y ); + QgsPoint p( x, y ); return moveVertex( p, atFeatureId, atVertex ); } -bool QgsVectorLayerEditUtils::moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) +bool QgsVectorLayerEditUtils::moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) { if ( !L->hasGeometryType() ) return false; @@ -115,7 +115,7 @@ QgsVectorLayer::EditResult QgsVectorLayerEditUtils::deleteVertex( QgsFeatureId f return !geometry.isNull() ? QgsVectorLayer::Success : QgsVectorLayer::EmptyGeometry; } -int QgsVectorLayerEditUtils::addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId ) +int QgsVectorLayerEditUtils::addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId ) { QgsLineString *ringLine = new QgsLineString( ring ); return addRing( ringLine, targetFeatureIds, modifiedFeatureId ); @@ -170,12 +170,12 @@ int QgsVectorLayerEditUtils::addRing( QgsCurve *ring, const QgsFeatureIds &targe return addRingReturnCode; } -int QgsVectorLayerEditUtils::addPart( const QList &points, QgsFeatureId featureId ) +int QgsVectorLayerEditUtils::addPart( const QList &points, QgsFeatureId featureId ) { QgsPointSequence l; - for ( QList::const_iterator it = points.constBegin(); it != points.constEnd(); ++it ) + for ( QList::const_iterator it = points.constBegin(); it != points.constEnd(); ++it ) { - l << QgsPointV2( *it ); + l << QgsPoint( *it ); } return addPart( l, featureId ); } @@ -271,7 +271,7 @@ int QgsVectorLayerEditUtils::translateFeature( QgsFeatureId featureId, double dx } -int QgsVectorLayerEditUtils::splitFeatures( const QList &splitLine, bool topologicalEditing ) +int QgsVectorLayerEditUtils::splitFeatures( const QList &splitLine, bool topologicalEditing ) { if ( !L->hasGeometryType() ) return 4; @@ -341,7 +341,7 @@ int QgsVectorLayerEditUtils::splitFeatures( const QList &splitLine, bo continue; } QList newGeometries; - QList topologyTestPoints; + QList topologyTestPoints; QgsGeometry featureGeom = feat.geometry(); splitFunctionReturn = featureGeom.splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints ); if ( splitFunctionReturn == 0 ) @@ -358,7 +358,7 @@ int QgsVectorLayerEditUtils::splitFeatures( const QList &splitLine, bo if ( topologicalEditing ) { - QList::const_iterator topol_it = topologyTestPoints.constBegin(); + QList::const_iterator topol_it = topologyTestPoints.constBegin(); for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it ) { addTopologicalPoints( *topol_it ); @@ -382,7 +382,7 @@ int QgsVectorLayerEditUtils::splitFeatures( const QList &splitLine, bo return returnCode; } -int QgsVectorLayerEditUtils::splitParts( const QList &splitLine, bool topologicalEditing ) +int QgsVectorLayerEditUtils::splitParts( const QList &splitLine, bool topologicalEditing ) { if ( !L->hasGeometryType() ) return 4; @@ -448,7 +448,7 @@ int QgsVectorLayerEditUtils::splitParts( const QList &splitLine, bool while ( fit.nextFeature( feat ) ) { QList newGeometries; - QList topologyTestPoints; + QList topologyTestPoints; QgsGeometry featureGeom = feat.geometry(); splitFunctionReturn = featureGeom.splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints ); if ( splitFunctionReturn == 0 ) @@ -493,7 +493,7 @@ int QgsVectorLayerEditUtils::splitParts( const QList &splitLine, bool if ( topologicalEditing ) { - QList::const_iterator topol_it = topologyTestPoints.constBegin(); + QList::const_iterator topol_it = topologyTestPoints.constBegin(); for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it ) { addTopologicalPoints( *topol_it ); @@ -626,7 +626,7 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsGeometry &geom ) } -int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPoint &p ) +int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPointXY &p ) { if ( !L->hasGeometryType() ) return 1; @@ -660,7 +660,7 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPoint &p ) while ( fit.nextFeature( f ) ) { int afterVertex; - QgsPoint snappedPoint; + QgsPointXY snappedPoint; double sqrDistSegmentSnap = f.geometry().closestSegmentWithContext( p, snappedPoint, afterVertex, nullptr, segmentSearchEpsilon ); if ( sqrDistSegmentSnap < sqrSnappingTolerance ) { @@ -695,7 +695,7 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPoint &p ) } -int QgsVectorLayerEditUtils::boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const +int QgsVectorLayerEditUtils::boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const { if ( list.size() < 1 ) { @@ -707,7 +707,7 @@ int QgsVectorLayerEditUtils::boundingBoxFromPointList( const QList &li ymin = std::numeric_limits::max(); ymax = -std::numeric_limits::max(); - for ( QList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it ) + for ( QList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it ) { if ( it->x() < xmin ) { diff --git a/src/core/qgsvectorlayereditutils.h b/src/core/qgsvectorlayereditutils.h index 5e4c55437a4..cd89c76969b 100644 --- a/src/core/qgsvectorlayereditutils.h +++ b/src/core/qgsvectorlayereditutils.h @@ -43,7 +43,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * in the given ring, item (first number is index 0), and feature * Not meaningful for Point geometries */ - bool insertVertex( const QgsPointV2 &point, QgsFeatureId atFeatureId, int beforeVertex ); + bool insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex ); /** Moves the vertex at the given position number, * ring and item (first number is index 0), and feature @@ -56,7 +56,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * to the given coordinates * \note available in Python bindings as moveVertexV2 */ - bool moveVertex( const QgsPointV2 &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 ); + bool moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex ) SIP_PYNAME( moveVertexV2 ); /** Deletes a vertex from a feature. * \param featureId ID of feature to remove vertex from @@ -79,7 +79,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * 5 no feature found where ring can be inserted */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ); + int addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ); /** Adds a ring to polygon/multipolygon features * \param ring ring to add @@ -109,7 +109,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * 6 if selected geometry not found */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int addPart( const QList &ring, QgsFeatureId featureId ); + int addPart( const QList &ring, QgsFeatureId featureId ); /** Adds a new part polygon to a multipart feature * \returns @@ -145,7 +145,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * 4 if there is a selection but no feature split */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int splitParts( const QList &splitLine, bool topologicalEditing = false ); + int splitParts( const QList &splitLine, bool topologicalEditing = false ); /** Splits features cut by the given line * \param splitLine line that splits the layer features @@ -155,7 +155,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * 4 if there is a selection but no feature split */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); /** Adds topological points for every vertex of the geometry. * \param geom the geometry where each vertex is added to segments of other features @@ -171,13 +171,13 @@ class CORE_EXPORT QgsVectorLayerEditUtils * \param p position of the vertex * \returns 0 in case of success */ - int addTopologicalPoints( const QgsPoint &p ); + int addTopologicalPoints( const QgsPointXY &p ); protected: /** Little helper function that gives bounding box from a list of points. \returns 0 in case of success */ - int boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const; + int boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const; private: diff --git a/src/core/qgsvectorlayerlabelprovider.cpp b/src/core/qgsvectorlayerlabelprovider.cpp index 5a9646db446..fe3cd44624a 100644 --- a/src/core/qgsvectorlayerlabelprovider.cpp +++ b/src/core/qgsvectorlayerlabelprovider.cpp @@ -275,7 +275,7 @@ QgsGeometry *QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature & for ( int i = 0; i < fet.geometry().geometry()->nCoordinates(); ++i ) { QRectF bounds; - QgsPointV2 p = fet.geometry().geometry()->vertexAt( QgsVertexId( i, 0, 0 ) ); + QgsPoint p = fet.geometry().geometry()->vertexAt( QgsVertexId( i, 0, 0 ) ); double x = p.x(); double y = p.y(); double z = 0; // dummy variable for coordinate transforms @@ -310,7 +310,7 @@ QgsGeometry *QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature & //TODO - remove when labeling is refactored to use screen units for ( int i = 0; i < boundLineString->numPoints(); ++i ) { - QgsPoint point = context.mapToPixel().toMapCoordinates( boundLineString->xAt( i ), boundLineString->yAt( i ) ); + QgsPointXY point = context.mapToPixel().toMapCoordinates( boundLineString->xAt( i ), boundLineString->yAt( i ) ); boundLineString->setXAt( i, point.x() ); boundLineString->setYAt( i, point.y() ); } @@ -464,7 +464,7 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition *label, Q if ( drawType != QgsTextRenderer::Text ) return; - QgsPoint outPt2 = xform.transform( label->getX() + label->getWidth(), label->getY() + label->getHeight() ); + QgsPointXY outPt2 = xform.transform( label->getX() + label->getWidth(), label->getY() + label->getHeight() ); QRectF rect( 0, 0, outPt2.x() - outPt.x(), outPt2.y() - outPt.y() ); painter->save(); painter->setRenderHint( QPainter::Antialiasing, false ); @@ -502,8 +502,8 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition *label, Q { // get rotated label's center point QPointF centerPt( outPt ); - QgsPoint outPt2 = xform.transform( label->getX() + label->getWidth() / 2, - label->getY() + label->getHeight() / 2 ); + QgsPointXY outPt2 = xform.transform( label->getX() + label->getWidth() / 2, + label->getY() + label->getHeight() / 2 ); double xc = outPt2.x() - outPt.x(); double yc = outPt2.y() - outPt.y(); diff --git a/src/core/qgsvectorlayerrenderer.cpp b/src/core/qgsvectorlayerrenderer.cpp index ddf1b43f326..25a8103a795 100644 --- a/src/core/qgsvectorlayerrenderer.cpp +++ b/src/core/qgsvectorlayerrenderer.cpp @@ -180,7 +180,7 @@ bool QgsVectorLayerRenderer::render() { try { - QgsPoint center = mContext.extent().center(); + QgsPointXY center = mContext.extent().center(); double rectSize = ct.sourceCrs().isGeographic() ? 0.0008983 /* ~100/(40075014/360=111319.4833) */ : 100; QgsRectangle sourceRect = QgsRectangle( center.x(), center.y(), center.x() + rectSize, center.y() + rectSize ); @@ -191,10 +191,10 @@ bool QgsVectorLayerRenderer::render() if ( !sourceRect.isEmpty() && sourceRect.isFinite() && !targetRect.isEmpty() && targetRect.isFinite() ) { - QgsPoint minimumSrcPoint( sourceRect.xMinimum(), sourceRect.yMinimum() ); - QgsPoint maximumSrcPoint( sourceRect.xMaximum(), sourceRect.yMaximum() ); - QgsPoint minimumDstPoint( targetRect.xMinimum(), targetRect.yMinimum() ); - QgsPoint maximumDstPoint( targetRect.xMaximum(), targetRect.yMaximum() ); + QgsPointXY minimumSrcPoint( sourceRect.xMinimum(), sourceRect.yMinimum() ); + QgsPointXY maximumSrcPoint( sourceRect.xMaximum(), sourceRect.yMaximum() ); + QgsPointXY minimumDstPoint( targetRect.xMinimum(), targetRect.yMinimum() ); + QgsPointXY maximumDstPoint( targetRect.xMaximum(), targetRect.yMaximum() ); double sourceHypothenuse = sqrt( minimumSrcPoint.sqrDist( maximumSrcPoint ) ); double targetHypothenuse = sqrt( minimumDstPoint.sqrDist( maximumDstPoint ) ); diff --git a/src/core/raster/qgsrasterdataprovider.cpp b/src/core/raster/qgsrasterdataprovider.cpp index 7f5cef13728..1bcf6a5371e 100644 --- a/src/core/raster/qgsrasterdataprovider.cpp +++ b/src/core/raster/qgsrasterdataprovider.cpp @@ -269,7 +269,7 @@ QString QgsRasterDataProvider::metadata() } // Default implementation for values -QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) +QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) { QgsDebugMsgLevel( "Entered", 4 ); QMap results; diff --git a/src/core/raster/qgsrasterdataprovider.h b/src/core/raster/qgsrasterdataprovider.h index 49c5dda3b9f..648d6d1a966 100644 --- a/src/core/raster/qgsrasterdataprovider.h +++ b/src/core/raster/qgsrasterdataprovider.h @@ -44,7 +44,7 @@ class QImage; class QByteArray; -class QgsPoint; +class QgsPointXY; class QgsRasterIdentifyResult; class QgsMapSettings; @@ -316,8 +316,8 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast * QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS). * Empty if failed or there are no results (TODO: better error reporting). */ - //virtual QMap identify( const QgsPoint & point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent = QgsRectangle(), int width = 0, int height = 0 ); - virtual QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ); + //virtual QMap identify( const QgsPointXY & point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent = QgsRectangle(), int width = 0, int height = 0 ); + virtual QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ); /** * \brief Returns the caption error text for the last error in this provider diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index f7566bcdfd7..edd8bd0d59f 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -1297,8 +1297,8 @@ QImage QgsRasterLayer::previewAsImage( QSize size, const QColor &bgColor, QImage double myPixelWidth = myExtent.width() / myMapUnitsPerPixel; double myPixelHeight = myExtent.height() / myMapUnitsPerPixel; - myRasterViewPort->mTopLeftPoint = QgsPoint( myX, myY ); - myRasterViewPort->mBottomRightPoint = QgsPoint( myPixelWidth, myPixelHeight ); + myRasterViewPort->mTopLeftPoint = QgsPointXY( myX, myY ); + myRasterViewPort->mBottomRightPoint = QgsPointXY( myPixelWidth, myPixelHeight ); myRasterViewPort->mWidth = myQImage.width(); myRasterViewPort->mHeight = myQImage.height(); diff --git a/src/core/raster/qgsrasterlayerrenderer.cpp b/src/core/raster/qgsrasterlayerrenderer.cpp index 453f3dea3ed..34db1505593 100644 --- a/src/core/raster/qgsrasterlayerrenderer.cpp +++ b/src/core/raster/qgsrasterlayerrenderer.cpp @@ -42,10 +42,10 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer *layer, QgsRender // Rotation will be handled by QPainter later // TODO: provide a method of QgsMapToPixel to fetch map center // in geographical units - QgsPoint center = mapToPixel.toMapCoordinates( - mapToPixel.mapWidth() / 2.0, - mapToPixel.mapHeight() / 2.0 - ); + QgsPointXY center = mapToPixel.toMapCoordinates( + mapToPixel.mapWidth() / 2.0, + mapToPixel.mapHeight() / 2.0 + ); mapToPixel.setMapRotation( 0, center.x(), center.y() ); } diff --git a/src/core/raster/qgsrasterprojector.cpp b/src/core/raster/qgsrasterprojector.cpp index fd072949c02..9e17b0b6d30 100644 --- a/src/core/raster/qgsrasterprojector.cpp +++ b/src/core/raster/qgsrasterprojector.cpp @@ -141,10 +141,10 @@ ProjectorData::ProjectorData( const QgsRectangle &extent, int width, int height, mCPCols = mCPRows = 3; for ( int i = 0; i < mCPRows; i++ ) { - QList myRow; - myRow.append( QgsPoint() ); - myRow.append( QgsPoint() ); - myRow.append( QgsPoint() ); + QList myRow; + myRow.append( QgsPointXY() ); + myRow.append( QgsPointXY() ); + myRow.append( QgsPointXY() ); mCPMatrix.insert( i, myRow ); // And the legal points QList myLegalRow; @@ -193,8 +193,8 @@ ProjectorData::ProjectorData( const QgsRectangle &extent, int width, int height, QgsDebugMsgLevel( cpToString(), 5 ); // init helper points - pHelperTop = new QgsPoint[mDestCols]; - pHelperBottom = new QgsPoint[mDestCols]; + pHelperTop = new QgsPointXY[mDestCols]; + pHelperBottom = new QgsPointXY[mDestCols]; calcHelper( 0, pHelperTop ); calcHelper( 1, pHelperBottom ); mHelperTopRow = 0; @@ -223,7 +223,7 @@ void ProjectorData::calcSrcExtent() // For now, we run through all matrix // mCPMatrix is used for both Approximate and Exact because QgsCoordinateTransform::transformBoundingBox() // is not precise enough, see #13665 - QgsPoint myPoint = mCPMatrix[0][0]; + QgsPointXY myPoint = mCPMatrix[0][0]; mSrcExtent = QgsRectangle( myPoint.x(), myPoint.y(), myPoint.x(), myPoint.y() ); for ( int i = 0; i < mCPRows; i++ ) { @@ -288,7 +288,7 @@ QString ProjectorData::cpToString() { if ( j > 0 ) myString += QLatin1String( " " ); - QgsPoint myPoint = mCPMatrix[i][j]; + QgsPointXY myPoint = mCPMatrix[i][j]; if ( mCPLegalMatrix[i][j] ) { myString += myPoint.toString(); @@ -322,9 +322,9 @@ void ProjectorData::calcSrcRowsCols() { for ( int j = 0; j < mCPCols - 1; j++ ) { - QgsPoint myPointA = mCPMatrix[i][j]; - QgsPoint myPointB = mCPMatrix[i][j + 1]; - QgsPoint myPointC = mCPMatrix[i + 1][j]; + QgsPointXY myPointA = mCPMatrix[i][j]; + QgsPointXY myPointB = mCPMatrix[i][j + 1]; + QgsPointXY myPointC = mCPMatrix[i + 1][j]; if ( mCPLegalMatrix[i][j] && mCPLegalMatrix[i][j + 1] && mCPLegalMatrix[i + 1][j] ) { double mySize = sqrt( myPointA.sqrDist( myPointB ) ) / myDestColsPerMatrixCell; @@ -391,7 +391,7 @@ inline int ProjectorData::matrixCol( int destCol ) return static_cast< int >( floor( ( destCol + 0.5 ) / mDestColsPerMatrixCol ) ); } -void ProjectorData::calcHelper( int matrixRow, QgsPoint *points ) +void ProjectorData::calcHelper( int matrixRow, QgsPointXY *points ) { // TODO?: should we also precalc dest cell center coordinates for x and y? for ( int myDestCol = 0; myDestCol < mDestCols; myDestCol++ ) @@ -407,8 +407,8 @@ void ProjectorData::calcHelper( int matrixRow, QgsPoint *points ) double xfrac = ( myDestX - myDestXMin ) / ( myDestXMax - myDestXMin ); - QgsPoint &mySrcPoint0 = mCPMatrix[matrixRow][myMatrixCol]; - QgsPoint &mySrcPoint1 = mCPMatrix[matrixRow][myMatrixCol + 1]; + QgsPointXY &mySrcPoint0 = mCPMatrix[matrixRow][myMatrixCol]; + QgsPointXY &mySrcPoint1 = mCPMatrix[matrixRow][myMatrixCol + 1]; double s = mySrcPoint0.x() + ( mySrcPoint1.x() - mySrcPoint0.x() ) * xfrac; double t = mySrcPoint0.y() + ( mySrcPoint1.y() - mySrcPoint0.y() ) * xfrac; @@ -420,7 +420,7 @@ void ProjectorData::calcHelper( int matrixRow, QgsPoint *points ) void ProjectorData::nextHelper() { // We just switch pHelperTop and pHelperBottom, memory is not lost - QgsPoint *tmp = nullptr; + QgsPointXY *tmp = nullptr; tmp = pHelperTop; pHelperTop = pHelperBottom; pHelperBottom = tmp; @@ -465,7 +465,7 @@ bool ProjectorData::preciseSrcRowCol( int destRow, int destCol, int *srcRow, int QgsDebugMsgLevel( QString( "x = %1 y = %2" ).arg( x ).arg( y ), 5 ); #endif - if ( !mExtent.contains( QgsPoint( x, y ) ) ) + if ( !mExtent.contains( QgsPointXY( x, y ) ) ) { return false; } @@ -511,8 +511,8 @@ bool ProjectorData::approximateSrcRowCol( int destRow, int destCol, int *srcRow, double yfrac = ( myDestY - myDestYMin ) / ( myDestYMax - myDestYMin ); - QgsPoint &myTop = pHelperTop[destCol]; - QgsPoint &myBot = pHelperBottom[destCol]; + QgsPointXY &myTop = pHelperTop[destCol]; + QgsPointXY &myBot = pHelperBottom[destCol]; // Warning: this is very SLOW compared to the following code!: //double mySrcX = myBot.x() + (myTop.x() - myBot.x()) * yfrac; @@ -525,7 +525,7 @@ bool ProjectorData::approximateSrcRowCol( int destRow, int destCol, int *srcRow, double mySrcX = bx + ( tx - bx ) * yfrac; double mySrcY = by + ( ty - by ) * yfrac; - if ( !mExtent.contains( QgsPoint( mySrcX, mySrcY ) ) ) + if ( !mExtent.contains( QgsPointXY( mySrcX, mySrcY ) ) ) { return false; } @@ -550,13 +550,13 @@ void ProjectorData::insertRows( const QgsCoordinateTransform &ct ) { for ( int r = 0; r < mCPRows - 1; r++ ) { - QList myRow; + QList myRow; QList myLegalRow; myRow.reserve( mCPCols ); myLegalRow.reserve( mCPCols ); for ( int c = 0; c < mCPCols; ++c ) { - myRow.append( QgsPoint() ); + myRow.append( QgsPointXY() ); myLegalRow.append( false ); } QgsDebugMsgLevel( QString( "insert new row at %1" ).arg( 1 + r * 2 ), 3 ); @@ -576,7 +576,7 @@ void ProjectorData::insertCols( const QgsCoordinateTransform &ct ) { for ( int c = 0; c < mCPCols - 1; c++ ) { - mCPMatrix[r].insert( 1 + c * 2, QgsPoint() ); + mCPMatrix[r].insert( 1 + c * 2, QgsPointXY() ); mCPLegalMatrix[r].insert( 1 + c * 2, false ); } } @@ -592,7 +592,7 @@ void ProjectorData::calcCP( int row, int col, const QgsCoordinateTransform &ct ) { double myDestX, myDestY; destPointOnCPMatrix( row, col, &myDestX, &myDestY ); - QgsPoint myDestPoint( myDestX, myDestY ); + QgsPointXY myDestPoint( myDestX, myDestY ); try { if ( ct.isValid() ) @@ -648,13 +648,13 @@ bool ProjectorData::checkCols( const QgsCoordinateTransform &ct ) { double myDestX, myDestY; destPointOnCPMatrix( r, c, &myDestX, &myDestY ); - QgsPoint myDestPoint( myDestX, myDestY ); + QgsPointXY myDestPoint( myDestX, myDestY ); - QgsPoint mySrcPoint1 = mCPMatrix[r - 1][c]; - QgsPoint mySrcPoint2 = mCPMatrix[r][c]; - QgsPoint mySrcPoint3 = mCPMatrix[r + 1][c]; + QgsPointXY mySrcPoint1 = mCPMatrix[r - 1][c]; + QgsPointXY mySrcPoint2 = mCPMatrix[r][c]; + QgsPointXY mySrcPoint3 = mCPMatrix[r + 1][c]; - QgsPoint mySrcApprox( ( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); + QgsPointXY mySrcApprox( ( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); if ( !mCPLegalMatrix[r - 1][c] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r + 1][c] ) { // There was an error earlier in transform, just abort @@ -662,7 +662,7 @@ bool ProjectorData::checkCols( const QgsCoordinateTransform &ct ) } try { - QgsPoint myDestApprox = ct.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform ); + QgsPointXY myDestApprox = ct.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform ); double mySqrDist = myDestApprox.sqrDist( myDestPoint ); if ( mySqrDist > mSqrTolerance ) { @@ -694,12 +694,12 @@ bool ProjectorData::checkRows( const QgsCoordinateTransform &ct ) double myDestX, myDestY; destPointOnCPMatrix( r, c, &myDestX, &myDestY ); - QgsPoint myDestPoint( myDestX, myDestY ); - QgsPoint mySrcPoint1 = mCPMatrix[r][c - 1]; - QgsPoint mySrcPoint2 = mCPMatrix[r][c]; - QgsPoint mySrcPoint3 = mCPMatrix[r][c + 1]; + QgsPointXY myDestPoint( myDestX, myDestY ); + QgsPointXY mySrcPoint1 = mCPMatrix[r][c - 1]; + QgsPointXY mySrcPoint2 = mCPMatrix[r][c]; + QgsPointXY mySrcPoint3 = mCPMatrix[r][c + 1]; - QgsPoint mySrcApprox( ( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); + QgsPointXY mySrcApprox( ( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); if ( !mCPLegalMatrix[r][c - 1] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r][c + 1] ) { // There was an error earlier in transform, just abort @@ -707,7 +707,7 @@ bool ProjectorData::checkRows( const QgsCoordinateTransform &ct ) } try { - QgsPoint myDestApprox = ct.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform ); + QgsPointXY myDestApprox = ct.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform ); double mySqrDist = myDestApprox.sqrDist( myDestPoint ); if ( mySqrDist > mSqrTolerance ) { diff --git a/src/core/raster/qgsrasterprojector.h b/src/core/raster/qgsrasterprojector.h index 3ae2cbffbbf..5ec6c5883d7 100644 --- a/src/core/raster/qgsrasterprojector.h +++ b/src/core/raster/qgsrasterprojector.h @@ -35,7 +35,7 @@ #include -class QgsPoint; +class QgsPointXY; /** \ingroup core * \brief QgsRasterProjector implements approximate projection support for @@ -181,7 +181,7 @@ class ProjectorData bool checkRows( const QgsCoordinateTransform &ct ); //! Calculate array of src helper points - void calcHelper( int matrixRow, QgsPoint *points ); + void calcHelper( int matrixRow, QgsPointXY *points ); //! Calc / switch helper void nextHelper(); @@ -236,7 +236,7 @@ class ProjectorData double mDestColsPerMatrixCol; //! Grid of source control points - QList< QList > mCPMatrix; + QList< QList > mCPMatrix; //! Grid of source control points transformation possible indicator /* Same size as mCPMatrix */ @@ -244,11 +244,11 @@ class ProjectorData //! Array of source points for each destination column on top of current CPMatrix grid row /* Warning: using QList is slow on access */ - QgsPoint *pHelperTop = nullptr; + QgsPointXY *pHelperTop = nullptr; //! Array of source points for each destination column on bottom of current CPMatrix grid row /* Warning: using QList is slow on access */ - QgsPoint *pHelperBottom = nullptr; + QgsPointXY *pHelperBottom = nullptr; //! Current mHelperTop matrix row int mHelperTopRow; diff --git a/src/core/raster/qgsrasterviewport.h b/src/core/raster/qgsrasterviewport.h index 86ce640cc0d..04675f1f1bc 100644 --- a/src/core/raster/qgsrasterviewport.h +++ b/src/core/raster/qgsrasterviewport.h @@ -34,11 +34,11 @@ struct QgsRasterViewPort /** \brief Coordinate (in output device coordinate system) of top left corner * of the part of the raster that is to be rendered.*/ - QgsPoint mTopLeftPoint; + QgsPointXY mTopLeftPoint; /** \brief Coordinate (in output device coordinate system) of bottom right corner * of the part of the raster that is to be rendered.*/ - QgsPoint mBottomRightPoint; + QgsPointXY mBottomRightPoint; //! \brief Width, number of columns to be rendered int mWidth; diff --git a/src/core/simplify/effectivearea.cpp b/src/core/simplify/effectivearea.cpp index e1343fcb4ea..0bb2393010d 100644 --- a/src/core/simplify/effectivearea.cpp +++ b/src/core/simplify/effectivearea.cpp @@ -41,7 +41,7 @@ static void destroy_minheap( MINHEAP tree ) /** * Calculate the area of a triangle in 2d */ -static double triarea2d( const QgsPointV2 &P1, const QgsPointV2 &P2, const QgsPointV2 &P3 ) +static double triarea2d( const QgsPoint &P1, const QgsPoint &P2, const QgsPoint &P3 ) { return qAbs( 0.5 * ( ( P1.x() - P2.x() ) * ( P3.y() - P2.y() ) - ( P1.y() - P2.y() ) * ( P3.x() - P2.x() ) ) ); } @@ -49,7 +49,7 @@ static double triarea2d( const QgsPointV2 &P1, const QgsPointV2 &P2, const QgsPo /** * Calculate the area of a triangle in 3d space */ -static double triarea3d( const QgsPointV2 &P1, const QgsPointV2 &P2, const QgsPointV2 &P3 ) +static double triarea3d( const QgsPoint &P1, const QgsPoint &P2, const QgsPoint &P3 ) { //LWDEBUG( 2, "Entered triarea3d" ); double ax, bx, ay, by, az, bz, cx, cy, cz, area; @@ -191,9 +191,9 @@ static void minheap_update( MINHEAP *tree, areanode *arealist, int idx ) static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld ) { //LWDEBUG( 2, "Entered tune_areas" ); - QgsPointV2 P1; - QgsPointV2 P2; - QgsPointV2 P3; + QgsPoint P1; + QgsPoint P2; + QgsPoint P3; double area; int go_on = 1; double check_order_min_area = 0; @@ -300,9 +300,9 @@ void ptarray_calc_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, d int npoints = ea->inpts.size(); double area; - QgsPointV2 P1; - QgsPointV2 P2; - QgsPointV2 P3; + QgsPoint P1; + QgsPoint P2; + QgsPoint P3; P1 = ea->inpts.at( 0 ); P2 = ea->inpts.at( 1 ); diff --git a/src/core/symbology-ng/qgsellipsesymbollayer.cpp b/src/core/symbology-ng/qgsellipsesymbollayer.cpp index 3ff9bfba263..4f6abf731c8 100644 --- a/src/core/symbology-ng/qgsellipsesymbollayer.cpp +++ b/src/core/symbology-ng/qgsellipsesymbollayer.cpp @@ -794,7 +794,7 @@ bool QgsEllipseSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFact { if ( qgsDoubleNear( halfWidth, halfHeight ) ) { - QgsPointV2 pt( t.map( QPointF( 0, 0 ) ) ); + QgsPoint pt( t.map( QPointF( 0, 0 ) ) ); e.writeFilledCircle( layerName, oc, pt, halfWidth ); } else @@ -807,7 +807,7 @@ bool QgsEllipseSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFact double angle = stepsize * i; double x = halfWidth * cos( angle ); double y = halfHeight * sin( angle ); - line << QgsPointV2( t.map( QPointF( x, y ) ) ); + line << QgsPoint( t.map( QPointF( x, y ) ) ); } //close ellipse with first point line << line.at( 0 ); @@ -821,10 +821,10 @@ bool QgsEllipseSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFact else if ( symbolName == QLatin1String( "rectangle" ) ) { QgsPointSequence p; - p << QgsPointV2( t.map( QPointF( -halfWidth, -halfHeight ) ) ) - << QgsPointV2( t.map( QPointF( halfWidth, -halfHeight ) ) ) - << QgsPointV2( t.map( QPointF( halfWidth, halfHeight ) ) ) - << QgsPointV2( t.map( QPointF( -halfWidth, halfHeight ) ) ); + p << QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) ) + << QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) ) + << QgsPoint( t.map( QPointF( halfWidth, halfHeight ) ) ) + << QgsPoint( t.map( QPointF( -halfWidth, halfHeight ) ) ); p << p[0]; if ( mBrush.style() != Qt::NoBrush ) @@ -836,21 +836,21 @@ bool QgsEllipseSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFact else if ( symbolName == QLatin1String( "cross" ) && mPen.style() != Qt::NoPen ) { e.writePolyline( QgsPointSequence() - << QgsPointV2( t.map( QPointF( -halfWidth, 0 ) ) ) - << QgsPointV2( t.map( QPointF( halfWidth, 0 ) ) ), + << QgsPoint( t.map( QPointF( -halfWidth, 0 ) ) ) + << QgsPoint( t.map( QPointF( halfWidth, 0 ) ) ), layerName, QStringLiteral( "CONTINUOUS" ), oc, strokeWidth ); e.writePolyline( QgsPointSequence() - << QgsPointV2( t.map( QPointF( 0, halfHeight ) ) ) - << QgsPointV2( t.map( QPointF( 0, -halfHeight ) ) ), + << QgsPoint( t.map( QPointF( 0, halfHeight ) ) ) + << QgsPoint( t.map( QPointF( 0, -halfHeight ) ) ), layerName, QStringLiteral( "CONTINUOUS" ), oc, strokeWidth ); return true; } else if ( symbolName == QLatin1String( "triangle" ) ) { QgsPointSequence p; - p << QgsPointV2( t.map( QPointF( -halfWidth, -halfHeight ) ) ) - << QgsPointV2( t.map( QPointF( halfWidth, -halfHeight ) ) ) - << QgsPointV2( t.map( QPointF( 0, halfHeight ) ) ); + p << QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) ) + << QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) ) + << QgsPoint( t.map( QPointF( 0, halfHeight ) ) ); p << p[0]; if ( mBrush.style() != Qt::NoBrush ) e.writePolygon( QgsRingSequence() << p, layerName, QStringLiteral( "SOLID" ), fc ); diff --git a/src/core/symbology-ng/qgsheatmaprenderer.cpp b/src/core/symbology-ng/qgsheatmaprenderer.cpp index 99104b5b22f..001d0ad8d37 100644 --- a/src/core/symbology-ng/qgsheatmaprenderer.cpp +++ b/src/core/symbology-ng/qgsheatmaprenderer.cpp @@ -153,7 +153,7 @@ bool QgsHeatmapRenderer::renderFeature( QgsFeature &feature, QgsRenderContext &c //loop through all points in multipoint for ( QgsMultiPoint::const_iterator pointIt = multiPoint.constBegin(); pointIt != multiPoint.constEnd(); ++pointIt ) { - QgsPoint pixel = context.mapToPixel().transform( *pointIt ); + QgsPointXY pixel = context.mapToPixel().transform( *pointIt ); int pointX = pixel.x() / mRenderQuality; int pointY = pixel.y() / mRenderQuality; for ( int x = qMax( pointX - mRadiusPixels, 0 ); x < qMin( pointX + mRadiusPixels, width ); ++x ) diff --git a/src/core/symbology-ng/qgslinesymbollayer.cpp b/src/core/symbology-ng/qgslinesymbollayer.cpp index a13e143b4e0..40787f7db83 100644 --- a/src/core/symbology-ng/qgslinesymbollayer.cpp +++ b/src/core/symbology-ng/qgslinesymbollayer.cpp @@ -1041,7 +1041,7 @@ void QgsMarkerLineSymbolLayer::renderPolylineVertex( const QPolygonF &points, Qg const QgsMapToPixel &mtp = context.renderContext().mapToPixel(); QgsVertexId vId; - QgsPointV2 vPoint; + QgsPoint vPoint; double x, y, z; QPointF mapPoint; int pointNum = 0; diff --git a/src/core/symbology-ng/qgsmarkersymbollayer.cpp b/src/core/symbology-ng/qgsmarkersymbollayer.cpp index c5b0ef3f8a6..6548586d1da 100644 --- a/src/core/symbology-ng/qgsmarkersymbollayer.cpp +++ b/src/core/symbology-ng/qgsmarkersymbollayer.cpp @@ -1337,7 +1337,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal QgsPointSequence p; p.reserve( polygon.size() ); for ( int i = 0; i < polygon.size(); i++ ) - p << QgsPointV2( polygon[i] ); + p << QgsPoint( polygon[i] ); p << p[0]; if ( mBrush.style() != Qt::NoBrush ) @@ -1348,9 +1348,9 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal else if ( shape == Circle ) { if ( mBrush.style() != Qt::NoBrush ) - e.writeFilledCircle( layerName, bc, QgsPointV2( shift ), halfSize ); + e.writeFilledCircle( layerName, bc, QgsPoint( shift ), halfSize ); if ( mPen.style() != Qt::NoPen ) - e.writeCircle( layerName, pc, QgsPointV2( shift ), halfSize, QStringLiteral( "CONTINUOUS" ), strokeWidth ); + e.writeCircle( layerName, pc, QgsPoint( shift ), halfSize, QStringLiteral( "CONTINUOUS" ), strokeWidth ); } else if ( shape == Line ) { @@ -1358,7 +1358,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal QPointF pt2 = t.map( QPointF( 0, halfSize ) ); if ( mPen.style() != Qt::NoPen ) - e.writeLine( QgsPointV2( pt1 ), QgsPointV2( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt1 ), QgsPoint( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); } else if ( shape == Cross ) { @@ -1369,8 +1369,8 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal QPointF pt3 = t.map( QPointF( 0, -halfSize ) ); QPointF pt4 = t.map( QPointF( 0, halfSize ) ); - e.writeLine( QgsPointV2( pt1 ), QgsPointV2( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); - e.writeLine( QgsPointV2( pt3 ), QgsPointV2( pt4 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt1 ), QgsPoint( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt3 ), QgsPoint( pt4 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); } } else if ( shape == Cross2 ) @@ -1382,8 +1382,8 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal QPointF pt3 = t.map( QPointF( halfSize, -halfSize ) ); QPointF pt4 = t.map( QPointF( -halfSize, halfSize ) ); - e.writeLine( QgsPointV2( pt1 ), QgsPointV2( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); - e.writeLine( QgsPointV2( pt3 ), QgsPointV2( pt4 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt1 ), QgsPoint( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt3 ), QgsPoint( pt4 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); } } else if ( shape == ArrowHead ) @@ -1394,8 +1394,8 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal QPointF pt2 = t.map( QPointF( 0, 0 ) ); QPointF pt3 = t.map( QPointF( -halfSize, -halfSize ) ); - e.writeLine( QgsPointV2( pt1 ), QgsPointV2( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); - e.writeLine( QgsPointV2( pt3 ), QgsPointV2( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt1 ), QgsPoint( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); + e.writeLine( QgsPoint( pt3 ), QgsPoint( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth ); } } else diff --git a/src/core/symbology-ng/qgspointdistancerenderer.cpp b/src/core/symbology-ng/qgspointdistancerenderer.cpp index 3a8e8fc8035..67eee8f7cfc 100644 --- a/src/core/symbology-ng/qgspointdistancerenderer.cpp +++ b/src/core/symbology-ng/qgspointdistancerenderer.cpp @@ -90,7 +90,7 @@ bool QgsPointDistanceRenderer::renderFeature( QgsFeature &feature, QgsRenderCont } double searchDistance = context.convertToMapUnits( mTolerance, mToleranceUnit, mToleranceMapUnitScale ); - QgsPoint point = transformedFeature.geometry().asPoint(); + QgsPointXY point = transformedFeature.geometry().asPoint(); QList intersectList = mSpatialIndex->intersects( searchRect( point, searchDistance ) ); if ( intersectList.empty() ) { @@ -123,8 +123,8 @@ bool QgsPointDistanceRenderer::renderFeature( QgsFeature &feature, QgsRenderCont ClusteredGroup &group = mClusteredGroups[groupIdx]; // calculate new centroid of group - QgsPoint oldCenter = mGroupLocations.value( minDistFeatureId ); - mGroupLocations[ minDistFeatureId ] = QgsPoint( ( oldCenter.x() * group.size() + point.x() ) / ( group.size() + 1.0 ), + QgsPointXY oldCenter = mGroupLocations.value( minDistFeatureId ); + mGroupLocations[ minDistFeatureId ] = QgsPointXY( ( oldCenter.x() * group.size() + point.x() ) / ( group.size() + 1.0 ), ( oldCenter.y() * group.size() + point.y() ) / ( group.size() + 1.0 ) ); // add to a group @@ -350,7 +350,7 @@ QgsLegendSymbolList QgsPointDistanceRenderer::legendSymbolItems( double scaleDen } -QgsRectangle QgsPointDistanceRenderer::searchRect( const QgsPoint &p, double distance ) const +QgsRectangle QgsPointDistanceRenderer::searchRect( const QgsPointXY &p, double distance ) const { return QgsRectangle( p.x() - distance, p.y() - distance, p.x() + distance, p.y() + distance ); } diff --git a/src/core/symbology-ng/qgspointdistancerenderer.h b/src/core/symbology-ng/qgspointdistancerenderer.h index 6c3cf859620..32ec13d386f 100644 --- a/src/core/symbology-ng/qgspointdistancerenderer.h +++ b/src/core/symbology-ng/qgspointdistancerenderer.h @@ -240,7 +240,7 @@ class CORE_EXPORT QgsPointDistanceRenderer: public QgsFeatureRenderer QMap mGroupIndex; //! Mapping of feature ID to approximate group location - QMap mGroupLocations; + QMap mGroupLocations; //! Spatial index for fast lookup of nearby points. QgsSpatialIndex *mSpatialIndex = nullptr; @@ -264,7 +264,7 @@ class CORE_EXPORT QgsPointDistanceRenderer: public QgsFeatureRenderer virtual void drawGroup( QPointF centerPoint, QgsRenderContext &context, const ClusteredGroup &group ) = 0; //! Creates a search rectangle with specified distance tolerance. - QgsRectangle searchRect( const QgsPoint &p, double distance ) const; + QgsRectangle searchRect( const QgsPointXY &p, double distance ) const; //! Debugging function to check the entries in the clustered groups void printGroupInfo() const; diff --git a/src/core/symbology-ng/qgsrenderer.cpp b/src/core/symbology-ng/qgsrenderer.cpp index 7a52b6ca4c5..7348ea9b74d 100644 --- a/src/core/symbology-ng/qgsrenderer.cpp +++ b/src/core/symbology-ng/qgsrenderer.cpp @@ -40,7 +40,7 @@ #include #include -QPointF QgsFeatureRenderer::_getPoint( QgsRenderContext &context, const QgsPointV2 &point ) +QPointF QgsFeatureRenderer::_getPoint( QgsRenderContext &context, const QgsPoint &point ) { return QgsSymbol::_getPoint( context, point ); } diff --git a/src/core/symbology-ng/qgsrenderer.h b/src/core/symbology-ng/qgsrenderer.h index d6c84b06839..42667943a5c 100644 --- a/src/core/symbology-ng/qgsrenderer.h +++ b/src/core/symbology-ng/qgsrenderer.h @@ -441,7 +441,7 @@ class CORE_EXPORT QgsFeatureRenderer * Creates a point in screen coordinates from a wkb string in map * coordinates */ - static QPointF _getPoint( QgsRenderContext &context, const QgsPointV2 &point ); + static QPointF _getPoint( QgsRenderContext &context, const QgsPoint &point ); /** * Clones generic renderer data to another renderer. diff --git a/src/core/symbology-ng/qgssymbol.cpp b/src/core/symbology-ng/qgssymbol.cpp index f57a4384f4e..7444f062459 100644 --- a/src/core/symbology-ng/qgssymbol.cpp +++ b/src/core/symbology-ng/qgssymbol.cpp @@ -734,7 +734,7 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont break; } - const QgsPointV2 *point = static_cast< const QgsPointV2 * >( segmentizedGeometry.geometry() ); + const QgsPoint *point = static_cast< const QgsPoint * >( segmentizedGeometry.geometry() ); const QPointF pt = _getPoint( context, *point ); static_cast( this )->renderPoint( pt, &feature, context, layer, selected ); @@ -819,7 +819,7 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont mSymbolRenderContext->setGeometryPartNum( i + 1 ); mSymbolRenderContext->expressionContextScope()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_PART_NUM, i + 1, true ) ); - const QgsPointV2 &point = static_cast< const QgsPointV2 & >( *mp.geometryN( i ) ); + const QgsPoint &point = static_cast< const QgsPoint & >( *mp.geometryN( i ) ); const QPointF pt = _getPoint( context, point ); static_cast( this )->renderPoint( pt, &feature, context, layer, selected ); @@ -963,7 +963,7 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont QgsCoordinateTransform ct = context.coordinateTransform(); const QgsMapToPixel &mtp = context.mapToPixel(); - QgsPointV2 vertexPoint; + QgsPoint vertexPoint; QgsVertexId vertexId; double x, y, z; QPointF mapPoint; diff --git a/src/core/symbology-ng/qgssymbol.h b/src/core/symbology-ng/qgssymbol.h index 0de148b49e3..cbefa4dab53 100644 --- a/src/core/symbology-ng/qgssymbol.h +++ b/src/core/symbology-ng/qgssymbol.h @@ -315,9 +315,9 @@ class CORE_EXPORT QgsSymbol QgsSymbol( SymbolType type, const QgsSymbolLayerList &layers SIP_TRANSFER ); // can't be instantiated /** - * Creates a point in screen coordinates from a QgsPointV2 in map coordinates + * Creates a point in screen coordinates from a QgsPoint in map coordinates */ - static inline QPointF _getPoint( QgsRenderContext &context, const QgsPointV2 &point ) + static inline QPointF _getPoint( QgsRenderContext &context, const QgsPoint &point ) { QPointF pt; if ( context.coordinateTransform().isValid() ) diff --git a/src/core/symbology-ng/qgssymbollayerutils.cpp b/src/core/symbology-ng/qgssymbollayerutils.cpp index daa2f5f31ac..23fa4eebb51 100644 --- a/src/core/symbology-ng/qgssymbollayerutils.cpp +++ b/src/core/symbology-ng/qgssymbollayerutils.cpp @@ -710,7 +710,7 @@ static QPolygonF makeOffsetGeometry( const QgsPolyline &polyline ) QPolygonF resultLine; resultLine.resize( pointCount ); - const QgsPoint *tempPtr = polyline.data(); + const QgsPointXY *tempPtr = polyline.data(); for ( i = 0; i < pointCount; ++i, tempPtr++ ) resultLine[i] = QPointF( tempPtr->x(), tempPtr->y() ); @@ -741,7 +741,7 @@ QList offsetLine( QPolygonF polyline, double dist, QgsWkbTypes::Geome QgsPolyline tempPolyline( pointCount ); QPointF *tempPtr = polyline.data(); for ( i = 0; i < pointCount; ++i, tempPtr++ ) - tempPolyline[i] = QgsPoint( tempPtr->rx(), tempPtr->ry() ); + tempPolyline[i] = QgsPointXY( tempPtr->rx(), tempPtr->ry() ); QgsGeometry tempGeometry = geometryType == QgsWkbTypes::PolygonGeometry ? QgsGeometry::fromPolygon( QgsPolygon() << tempPolyline ) : QgsGeometry::fromPolyline( tempPolyline ); if ( !tempGeometry.isNull() ) @@ -3703,7 +3703,7 @@ QPointF QgsSymbolLayerUtils::polygonPointOnSurface( const QPolygonF &points ) unsigned int i, pointCount = points.count(); QgsPolyline polyline( pointCount ); - for ( i = 0; i < pointCount; ++i ) polyline[i] = QgsPoint( points[i].x(), points[i].y() ); + for ( i = 0; i < pointCount; ++i ) polyline[i] = QgsPointXY( points[i].x(), points[i].y() ); QgsGeometry geom = QgsGeometry::fromPolygon( QgsPolygon() << polyline ); if ( !geom.isNull() ) @@ -3712,7 +3712,7 @@ QPointF QgsSymbolLayerUtils::polygonPointOnSurface( const QPolygonF &points ) if ( !pointOnSurfaceGeom.isNull() ) { - QgsPoint point = pointOnSurfaceGeom.asPoint(); + QgsPointXY point = pointOnSurfaceGeom.asPoint(); return QPointF( point.x(), point.y() ); } diff --git a/src/gui/editorwidgets/qgsrelationreferencewidget.cpp b/src/gui/editorwidgets/qgsrelationreferencewidget.cpp index 5386fe48684..d1276bc8bec 100644 --- a/src/gui/editorwidgets/qgsrelationreferencewidget.cpp +++ b/src/gui/editorwidgets/qgsrelationreferencewidget.cpp @@ -650,7 +650,7 @@ void QgsRelationReferenceWidget::highlightFeature( QgsFeature f, CanvasExtent ca else if ( canvasExtent == Pan ) { QgsGeometry centroid = geom.centroid(); - QgsPoint center = centroid.asPoint(); + QgsPointXY center = centroid.asPoint(); center = mCanvas->mapSettings().layerToMapCoordinates( mReferencedLayer, center ); mCanvas->zoomByFactor( 1.0, ¢er ); // refresh is done in this method } diff --git a/src/gui/qgsadvanceddigitizingcanvasitem.cpp b/src/gui/qgsadvanceddigitizingcanvasitem.cpp index 0f4862af672..060e3e6d398 100644 --- a/src/gui/qgsadvanceddigitizingcanvasitem.cpp +++ b/src/gui/qgsadvanceddigitizingcanvasitem.cpp @@ -45,11 +45,11 @@ void QgsAdvancedDigitizingCanvasItem::paint( QPainter *painter ) return; bool previousPointExist, penulPointExist; - const QgsPoint curPoint = mAdvancedDigitizingDockWidget->currentPoint(); - const QgsPoint prevPoint = mAdvancedDigitizingDockWidget->previousPoint( &previousPointExist ); - const QgsPoint penulPoint = mAdvancedDigitizingDockWidget->penultimatePoint( &penulPointExist ); + const QgsPointXY curPoint = mAdvancedDigitizingDockWidget->currentPoint(); + const QgsPointXY prevPoint = mAdvancedDigitizingDockWidget->previousPoint( &previousPointExist ); + const QgsPointXY penulPoint = mAdvancedDigitizingDockWidget->penultimatePoint( &penulPointExist ); const bool snappedToVertex = mAdvancedDigitizingDockWidget->snappedToVertex(); - const QList snappedSegment = mAdvancedDigitizingDockWidget->snappedSegment(); + const QList snappedSegment = mAdvancedDigitizingDockWidget->snappedSegment(); const bool hasSnappedSegment = snappedSegment.count() == 2; const bool curPointExist = mapRect.contains( curPoint ); @@ -185,7 +185,7 @@ void QgsAdvancedDigitizingCanvasItem::paint( QPainter *painter ) } else { - x = toCanvasCoordinates( QgsPoint( mAdvancedDigitizingDockWidget->constraintX()->value(), 0 ) ).x(); + x = toCanvasCoordinates( QgsPointXY( mAdvancedDigitizingDockWidget->constraintX()->value(), 0 ) ).x(); } if ( draw ) { @@ -216,7 +216,7 @@ void QgsAdvancedDigitizingCanvasItem::paint( QPainter *painter ) } else { - y = toCanvasCoordinates( QgsPoint( 0, mAdvancedDigitizingDockWidget->constraintY()->value() ) ).y(); + y = toCanvasCoordinates( QgsPointXY( 0, mAdvancedDigitizingDockWidget->constraintY()->value() ) ).y(); } if ( draw ) { diff --git a/src/gui/qgsadvanceddigitizingdockwidget.cpp b/src/gui/qgsadvanceddigitizingdockwidget.cpp index 54fcdaf1ce4..fd3c813e566 100644 --- a/src/gui/qgsadvanceddigitizingdockwidget.cpp +++ b/src/gui/qgsadvanceddigitizingdockwidget.cpp @@ -37,7 +37,7 @@ struct EdgesOnlyFilter : public QgsPointLocator::MatchFilter bool acceptMatch( const QgsPointLocator::Match &m ) override { return m.hasEdge(); } }; -bool QgsAdvancedDigitizingDockWidget::lineCircleIntersection( const QgsPoint ¢er, const double radius, const QList &segment, QgsPoint &intersection ) +bool QgsAdvancedDigitizingDockWidget::lineCircleIntersection( const QgsPointXY ¢er, const double radius, const QList &segment, QgsPointXY &intersection ) { Q_ASSERT( segment.count() == 2 ); @@ -67,11 +67,11 @@ bool QgsAdvancedDigitizingDockWidget::lineCircleIntersection( const QgsPoint &ce const double ax = center.x() + ( d * dy + sgnDy * dx * sqrt( pow( radius, 2 ) * pow( dr, 2 ) - pow( d, 2 ) ) ) / ( pow( dr, 2 ) ); const double ay = center.y() + ( -d * dx + qAbs( dy ) * sqrt( pow( radius, 2 ) * pow( dr, 2 ) - pow( d, 2 ) ) ) / ( pow( dr, 2 ) ); - const QgsPoint p1( ax, ay ); + const QgsPointXY p1( ax, ay ); const double bx = center.x() + ( d * dy - sgnDy * dx * sqrt( pow( radius, 2 ) * pow( dr, 2 ) - pow( d, 2 ) ) ) / ( pow( dr, 2 ) ); const double by = center.y() + ( -d * dx - qAbs( dy ) * sqrt( pow( radius, 2 ) * pow( dr, 2 ) - pow( d, 2 ) ) ) / ( pow( dr, 2 ) ); - const QgsPoint p2( bx, by ); + const QgsPointXY p2( bx, by ); // snap to nearest intersection @@ -599,13 +599,13 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e ) QgsDebugMsgLevel( QString( "X: %1 %2 %3" ).arg( mXConstraint->isLocked() ).arg( mXConstraint->relative() ).arg( mXConstraint->value() ), 4 ); QgsDebugMsgLevel( QString( "Y: %1 %2 %3" ).arg( mYConstraint->isLocked() ).arg( mYConstraint->relative() ).arg( mYConstraint->value() ), 4 ); - QgsPoint point = e->snapPoint( mSnappingMode ); + QgsPointXY point = e->snapPoint( mSnappingMode ); mSnappedSegment = e->snapSegment( mSnappingMode ); bool previousPointExist, penulPointExist; - QgsPoint previousPt = previousPoint( &previousPointExist ); - QgsPoint penultimatePt = penultimatePoint( &penulPointExist ); + QgsPointXY previousPt = previousPoint( &previousPointExist ); + QgsPointXY penultimatePt = penultimatePoint( &penulPointExist ); // ***************************** // ---- X constraint @@ -790,16 +790,16 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e ) // perform both to detect errors in constraints if ( mXConstraint->isLocked() ) { - const QList verticalSegment = QList() - << QgsPoint( mXConstraint->value(), point.y() ) - << QgsPoint( mXConstraint->value(), point.y() + 1 ); + const QList verticalSegment = QList() + << QgsPointXY( mXConstraint->value(), point.y() ) + << QgsPointXY( mXConstraint->value(), point.y() + 1 ); res &= lineCircleIntersection( previousPt, mDistanceConstraint->value(), verticalSegment, point ); } if ( mYConstraint->isLocked() ) { - const QList horizontalSegment = QList() - << QgsPoint( point.x(), mYConstraint->value() ) - << QgsPoint( point.x() + 1, mYConstraint->value() ); + const QList horizontalSegment = QList() + << QgsPointXY( point.x(), mYConstraint->value() ) + << QgsPointXY( point.x() + 1, mYConstraint->value() ); res &= lineCircleIntersection( previousPt, mDistanceConstraint->value(), horizontalSegment, point ); } } @@ -902,9 +902,9 @@ bool QgsAdvancedDigitizingDockWidget::alignToSegment( QgsMapMouseEvent *e, CadCo } bool previousPointExist, penulPointExist, mSnappedSegmentExist; - QgsPoint previousPt = previousPoint( &previousPointExist ); - QgsPoint penultimatePt = penultimatePoint( &penulPointExist ); - QList mSnappedSegment = e->snapSegment( mSnappingMode, &mSnappedSegmentExist, true ); + QgsPointXY previousPt = previousPoint( &previousPointExist ); + QgsPointXY penultimatePt = penultimatePoint( &penulPointExist ); + QList mSnappedSegment = e->snapSegment( mSnappingMode, &mSnappedSegmentExist, true ); if ( !previousPointExist || !mSnappedSegmentExist ) { @@ -1250,7 +1250,7 @@ void QgsAdvancedDigitizingDockWidget::disable() setCadEnabled( false ); } -void QgsAdvancedDigitizingDockWidget::addPoint( const QgsPoint &point ) +void QgsAdvancedDigitizingDockWidget::addPoint( const QgsPointXY &point ) { if ( !pointsCount() ) { @@ -1283,7 +1283,7 @@ void QgsAdvancedDigitizingDockWidget::clearPoints() updateCapacity(); } -void QgsAdvancedDigitizingDockWidget::updateCurrentPoint( const QgsPoint &point ) +void QgsAdvancedDigitizingDockWidget::updateCurrentPoint( const QgsPointXY &point ) { if ( !pointsCount() ) { @@ -1353,32 +1353,32 @@ void QgsAdvancedDigitizingDockWidget::CadConstraint::toggleRelative() setRelative( mRelative ? false : true ); } -QgsPoint QgsAdvancedDigitizingDockWidget::currentPoint( bool *exist ) const +QgsPointXY QgsAdvancedDigitizingDockWidget::currentPoint( bool *exist ) const { if ( exist ) *exist = pointsCount() > 0; if ( pointsCount() > 0 ) return mCadPointList.value( 0 ); else - return QgsPoint(); + return QgsPointXY(); } -QgsPoint QgsAdvancedDigitizingDockWidget::previousPoint( bool *exist ) const +QgsPointXY QgsAdvancedDigitizingDockWidget::previousPoint( bool *exist ) const { if ( exist ) *exist = pointsCount() > 1; if ( pointsCount() > 1 ) return mCadPointList.value( 1 ); else - return QgsPoint(); + return QgsPointXY(); } -QgsPoint QgsAdvancedDigitizingDockWidget::penultimatePoint( bool *exist ) const +QgsPointXY QgsAdvancedDigitizingDockWidget::penultimatePoint( bool *exist ) const { if ( exist ) *exist = pointsCount() > 2; if ( pointsCount() > 2 ) return mCadPointList.value( 2 ); else - return QgsPoint(); + return QgsPointXY(); } diff --git a/src/gui/qgsadvanceddigitizingdockwidget.h b/src/gui/qgsadvanceddigitizingdockwidget.h index b6f9293fbaa..c1bc020e58b 100644 --- a/src/gui/qgsadvanceddigitizingdockwidget.h +++ b/src/gui/qgsadvanceddigitizingdockwidget.h @@ -30,7 +30,7 @@ class QgsAdvancedDigitizingCanvasItem; class QgsMapCanvas; class QgsMapTool; class QgsMapToolAdvancedDigitizing; -class QgsPoint; +class QgsPointXY; // tolerances for soft constraints (last values, and common angles) // for angles, both tolerance in pixels and degrees are used for better performance @@ -200,7 +200,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private //! performs the intersection of a circle and a line //! \note from the two solutions, the intersection will be set to the closest point - static bool lineCircleIntersection( const QgsPoint ¢er, const double radius, const QList &segment, QgsPoint &intersection ); + static bool lineCircleIntersection( const QgsPointXY ¢er, const double radius, const QList &segment, QgsPointXY &intersection ); /** * Create an advanced digitizing dock widget @@ -288,21 +288,21 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private * Helper for the CAD point list. The CAD point list is the list of points * currently digitized. It contains both "normal" points and intermediate points (construction mode). */ - QgsPoint currentPoint( bool *exists = nullptr ) const; + QgsPointXY currentPoint( bool *exists = nullptr ) const; /** * The previous point. * Helper for the CAD point list. The CAD point list is the list of points * currently digitized. It contains both "normal" points and intermediate points (construction mode). */ - QgsPoint previousPoint( bool *exists = nullptr ) const; + QgsPointXY previousPoint( bool *exists = nullptr ) const; /** * The penultimate point. * Helper for the CAD point list. The CAD point list is the list of points * currently digitized. It contains both "normal" points and intermediate points (construction mode). */ - QgsPoint penultimatePoint( bool *exists = nullptr ) const; + QgsPointXY penultimatePoint( bool *exists = nullptr ) const; /** * The number of points in the CAD point helper list @@ -317,7 +317,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private /** * Snapped to a segment */ - QList snappedSegment() const { return mSnappedSegment; } + QList snappedSegment() const { return mSnappedSegment; } //! return the action used to enable/disable the tools QAction *enableAction() { return mEnableAction; } @@ -355,7 +355,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private * * \param point The last known digitizing point. Can be used to emulate a mouse event. */ - void pointChanged( const QgsPoint &point ); + void pointChanged( const QgsPointXY &point ); private slots: //! set the additional constraint by clicking on the perpendicular/parallel buttons @@ -405,16 +405,16 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private //! defines the additional constraint to be used (no/parallel/perpendicular) void lockAdditionalConstraint( AdditionalConstraint constraint ); - QList snapSegment( const QgsPointLocator::Match &snapMatch ); + QList snapSegment( const QgsPointLocator::Match &snapMatch ); //! align to segment for additional constraint. //! If additional constraints are used, this will determine the angle to be locked depending on the snapped segment. bool alignToSegment( QgsMapMouseEvent *e, CadConstraint::LockMode lockMode = CadConstraint::HardLock ); //! add point to the CAD point list - void addPoint( const QgsPoint &point ); + void addPoint( const QgsPointXY &point ); //! update the current point in the CAD point list - void updateCurrentPoint( const QgsPoint &point ); + void updateCurrentPoint( const QgsPointXY &point ); //! remove previous point in the CAD point list void removePreviousPoint(); //! remove all points from the CAD point list @@ -466,8 +466,8 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private int mCommonAngleConstraint; // if 0: do not snap to common angles // point list and current snap point / segment - QList mCadPointList; - QList mSnappedSegment; + QList mCadPointList; + QList mSnappedSegment; bool mSnappedToVertex; bool mSessionActive; diff --git a/src/gui/qgscomposerview.cpp b/src/gui/qgscomposerview.cpp index 5c45ba6e2a5..566d5fa325e 100644 --- a/src/gui/qgscomposerview.cpp +++ b/src/gui/qgscomposerview.cpp @@ -2035,9 +2035,9 @@ void QgsComposerView::wheelZoom( QWheelEvent *event ) QPointF scenePoint = mapToScene( event->pos() ); //adjust view center - QgsPoint oldCenter( visibleRect.center() ); - QgsPoint newCenter( scenePoint.x() + ( ( oldCenter.x() - scenePoint.x() ) * scaleFactor ), - scenePoint.y() + ( ( oldCenter.y() - scenePoint.y() ) * scaleFactor ) ); + QgsPointXY oldCenter( visibleRect.center() ); + QgsPointXY newCenter( scenePoint.x() + ( ( oldCenter.x() - scenePoint.x() ) * scaleFactor ), + scenePoint.y() + ( ( oldCenter.y() - scenePoint.y() ) * scaleFactor ) ); centerOn( newCenter.x(), newCenter.y() ); //zoom composition diff --git a/src/gui/qgscurveeditorwidget.cpp b/src/gui/qgscurveeditorwidget.cpp index 62cdb07e61d..fedf130e927 100644 --- a/src/gui/qgscurveeditorwidget.cpp +++ b/src/gui/qgscurveeditorwidget.cpp @@ -154,7 +154,7 @@ void QgsCurveEditorWidget::keyPressEvent( QKeyEvent *event ) { if ( event->key() == Qt::Key_Delete || event->key() == Qt::Key_Backspace ) { - QList< QgsPoint > cp = mCurve.controlPoints(); + QList< QgsPointXY > cp = mCurve.controlPoints(); if ( mCurrentPlotMarkerIndex > 0 && mCurrentPlotMarkerIndex < cp.count() - 1 ) { cp.removeAt( mCurrentPlotMarkerIndex ); @@ -184,11 +184,11 @@ int QgsCurveEditorWidget::findNearestControlPoint( QPointF point ) const double minDist = 3.0 / mPlot->width(); int currentPlotMarkerIndex = -1; - QList< QgsPoint > controlPoints = mCurve.controlPoints(); + QList< QgsPointXY > controlPoints = mCurve.controlPoints(); for ( int i = 0; i < controlPoints.count(); ++i ) { - QgsPoint currentPoint = controlPoints.at( i ); + QgsPointXY currentPoint = controlPoints.at( i ); double currentDist; currentDist = qPow( point.x() - currentPoint.x(), 2.0 ) + qPow( point.y() - currentPoint.y(), 2.0 ); if ( currentDist < minDist ) @@ -210,7 +210,7 @@ void QgsCurveEditorWidget::plotMouseMove( QPointF point ) if ( mCurrentPlotMarkerIndex < 0 ) return; - QList< QgsPoint > cp = mCurve.controlPoints(); + QList< QgsPointXY > cp = mCurve.controlPoints(); bool removePoint = false; if ( mCurrentPlotMarkerIndex == 0 ) { @@ -237,7 +237,7 @@ void QgsCurveEditorWidget::plotMouseMove( QPointF point ) } else { - cp[ mCurrentPlotMarkerIndex ] = QgsPoint( point.x(), point.y() ); + cp[ mCurrentPlotMarkerIndex ] = QgsPointXY( point.x(), point.y() ); } mCurve.setControlPoints( cp ); updatePlot(); @@ -312,7 +312,7 @@ void QgsCurveEditorWidget::updatePlot() QVector< double > x; int i = 0; - Q_FOREACH ( const QgsPoint &point, mCurve.controlPoints() ) + Q_FOREACH ( const QgsPointXY &point, mCurve.controlPoints() ) { x << point.x(); addPlotMarker( point.x(), point.y(), mCurrentPlotMarkerIndex == i ); diff --git a/src/gui/qgsgeometryrubberband.cpp b/src/gui/qgsgeometryrubberband.cpp index 65cef923f7d..68edfa71c9f 100644 --- a/src/gui/qgsgeometryrubberband.cpp +++ b/src/gui/qgsgeometryrubberband.cpp @@ -61,7 +61,7 @@ void QgsGeometryRubberBand::paint( QPainter *painter ) //draw vertices QgsVertexId vertexId; - QgsPointV2 vertex; + QgsPoint vertex; while ( paintGeom->nextVertex( vertexId, vertex ) ) { drawVertex( painter, vertex.x(), vertex.y() ); @@ -118,7 +118,7 @@ void QgsGeometryRubberBand::setGeometry( QgsAbstractGeometry *geom ) } } -void QgsGeometryRubberBand::moveVertex( QgsVertexId id, const QgsPointV2 &newPos ) +void QgsGeometryRubberBand::moveVertex( QgsVertexId id, const QgsPoint &newPos ) { if ( mGeometry ) { diff --git a/src/gui/qgsgeometryrubberband.h b/src/gui/qgsgeometryrubberband.h index 38252242c2b..f99f7098820 100644 --- a/src/gui/qgsgeometryrubberband.h +++ b/src/gui/qgsgeometryrubberband.h @@ -26,7 +26,7 @@ class QgsAbstractGeometry; -class QgsPointV2; +class QgsPoint; struct QgsVertexId; /** \ingroup gui @@ -76,7 +76,7 @@ class GUI_EXPORT QgsGeometryRubberBand: public QgsMapCanvasItem //! Returns a pointer to the geometry const QgsAbstractGeometry *geometry() { return mGeometry; } //! Moves vertex to new position (in map coordinates) - void moveVertex( QgsVertexId id, const QgsPointV2 &newPos ); + void moveVertex( QgsVertexId id, const QgsPoint &newPos ); //! Sets fill color for vertex markers void setFillColor( const QColor &c ); //! Sets stroke color for vertex markers diff --git a/src/gui/qgshighlight.cpp b/src/gui/qgshighlight.cpp index ab2db0ed370..21983206ad5 100644 --- a/src/gui/qgshighlight.cpp +++ b/src/gui/qgshighlight.cpp @@ -196,7 +196,7 @@ void QgsHighlight::setWidth( int width ) mPen.setWidth( width ); } -void QgsHighlight::paintPoint( QPainter *p, const QgsPoint &point ) +void QgsHighlight::paintPoint( QPainter *p, const QgsPointXY &point ) { QPolygonF r( 5 ); @@ -413,7 +413,7 @@ void QgsHighlight::updateRect() // This is an hack to pass QgsMapCanvasItem::setRect what it // expects (encoding of position and size of the item) const QgsMapToPixel &m2p = mMapCanvas->mapSettings().mapToPixel(); - QgsPoint topLeft = m2p.toMapPoint( 0, 0 ); + QgsPointXY topLeft = m2p.toMapPoint( 0, 0 ); double res = m2p.mapUnitsPerPixel(); QSizeF imageSize = mMapCanvas->mapSettings().outputSize(); QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + imageSize.width()*res, topLeft.y() - imageSize.height()*res ); diff --git a/src/gui/qgshighlight.h b/src/gui/qgshighlight.h index 9db1decf0af..c00ecf24aea 100644 --- a/src/gui/qgshighlight.h +++ b/src/gui/qgshighlight.h @@ -99,7 +99,7 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem double getSymbolWidth( const QgsRenderContext &context, double width, QgsUnitTypes::RenderUnit unit ); //! Get renderer for current color mode and colors. The renderer should be freed by caller. QgsFeatureRenderer *getRenderer( QgsRenderContext &context, const QColor &color, const QColor &fillColor ); - void paintPoint( QPainter *p, const QgsPoint &point ); + void paintPoint( QPainter *p, const QgsPointXY &point ); void paintLine( QPainter *p, QgsPolyline line ); void paintPolygon( QPainter *p, QgsPolygon polygon ); diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index 35b7ccf68e1..ac558153eba 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -631,7 +631,7 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage &img, const QgsMapSettings &m // This is a hack to pass QgsMapCanvasItem::setRect what it // expects (encoding of position and size of the item) const QgsMapToPixel &m2p = mapSettings.mapToPixel(); - QgsPoint topLeft = m2p.toMapPoint( 0, 0 ); + QgsPointXY topLeft = m2p.toMapPoint( 0, 0 ); double res = m2p.mapUnitsPerPixel(); QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res ); return rect; @@ -795,7 +795,7 @@ void QgsMapCanvas::setExtent( const QgsRectangle &r, bool magnified ) } // setExtent -void QgsMapCanvas::setCenter( const QgsPoint ¢er ) +void QgsMapCanvas::setCenter( const QgsPointXY ¢er ) { QgsRectangle r = mapSettings().extent(); double x = center.x(); @@ -809,7 +809,7 @@ void QgsMapCanvas::setCenter( const QgsPoint ¢er ) ); } // setCenter -QgsPoint QgsMapCanvas::center() const +QgsPointXY QgsMapCanvas::center() const { QgsRectangle r = mapSettings().extent(); return r.center(); @@ -927,7 +927,7 @@ void QgsMapCanvas::zoomToFeatureExtent( QgsRectangle &rect ) if ( rect.isEmpty() ) { // zoom in - QgsPoint c = rect.center(); + QgsPointXY c = rect.center(); rect = extent(); rect.scale( 1.0, &c ); } @@ -1219,7 +1219,7 @@ void QgsMapCanvas::endZoomRect( QPoint pos ) double sfy = ( double )zoomRectSize.height() / canvasSize.height(); double sf = qMax( sfx, sfy ); - QgsPoint c = mSettings.mapToPixel().toMapCoordinates( mZoomRect.center() ); + QgsPointXY c = mSettings.mapToPixel().toMapCoordinates( mZoomRect.center() ); zoomByFactor( sf, &c ); refresh(); @@ -1400,10 +1400,10 @@ void QgsMapCanvas::wheelEvent( QWheelEvent *e ) double signedWheelFactor = e->angleDelta().y() > 0 ? 1 / zoomFactor : zoomFactor; // zoom map to mouse cursor by scaling - QgsPoint oldCenter = center(); - QgsPoint mousePos( getCoordinateTransform()->toMapPoint( e->x(), e->y() ) ); - QgsPoint newCenter( mousePos.x() + ( ( oldCenter.x() - mousePos.x() ) * signedWheelFactor ), - mousePos.y() + ( ( oldCenter.y() - mousePos.y() ) * signedWheelFactor ) ); + QgsPointXY oldCenter = center(); + QgsPointXY mousePos( getCoordinateTransform()->toMapPoint( e->x(), e->y() ) ); + QgsPointXY newCenter( mousePos.x() + ( ( oldCenter.x() - mousePos.x() ) * signedWheelFactor ), + mousePos.y() + ( ( oldCenter.y() - mousePos.y() ) * signedWheelFactor ) ); zoomByFactor( signedWheelFactor, &newCenter ); } @@ -1441,7 +1441,7 @@ void QgsMapCanvas::zoomWithCenter( int x, int y, bool zoomIn ) else { // transform the mouse pos to map coordinates - QgsPoint center = getCoordinateTransform()->toMapPoint( x, y ); + QgsPointXY center = getCoordinateTransform()->toMapPoint( x, y ); QgsRectangle r = mapSettings().visibleExtent(); r.scale( scaleFactor, ¢er ); setExtent( r, true ); @@ -1480,7 +1480,7 @@ void QgsMapCanvas::mouseMoveEvent( QMouseEvent *e ) // show x y on status bar QPoint xy = e->pos(); - QgsPoint coord = getCoordinateTransform()->toMapCoordinates( xy ); + QgsPointXY coord = getCoordinateTransform()->toMapCoordinates( xy ); emit xyCoordinates( coord ); } @@ -1752,13 +1752,13 @@ void QgsMapCanvas::panActionEnd( QPoint releasePoint ) moveCanvasContents( true ); // true means reset // use start and end box points to calculate the extent - QgsPoint start = getCoordinateTransform()->toMapCoordinates( mCanvasProperties->rubberStartPoint ); - QgsPoint end = getCoordinateTransform()->toMapCoordinates( releasePoint ); + QgsPointXY start = getCoordinateTransform()->toMapCoordinates( mCanvasProperties->rubberStartPoint ); + QgsPointXY end = getCoordinateTransform()->toMapCoordinates( releasePoint ); // modify the center double dx = end.x() - start.x(); double dy = end.y() - start.y(); - QgsPoint c = center(); + QgsPointXY c = center(); c.set( c.x() - dx, c.y() - dy ); setCenter( c ); @@ -1982,7 +1982,7 @@ void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer *ml, const QString & } } -void QgsMapCanvas::zoomByFactor( double scaleFactor, const QgsPoint *center ) +void QgsMapCanvas::zoomByFactor( double scaleFactor, const QgsPointXY *center ) { if ( mScaleLocked ) { diff --git a/src/gui/qgsmapcanvas.h b/src/gui/qgsmapcanvas.h index 4b3c4573ecb..f5c45001b94 100644 --- a/src/gui/qgsmapcanvas.h +++ b/src/gui/qgsmapcanvas.h @@ -196,11 +196,11 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView //! Set the center of the map canvas, in geographical coordinates //! \since QGIS 2.8 - void setCenter( const QgsPoint ¢er ); + void setCenter( const QgsPointXY ¢er ); //! Get map center, in geographical coordinates //! \since QGIS 2.8 - QgsPoint center() const; + QgsPointXY center() const; //! Zoom to the full extent of all layers void zoomToFullExtent(); @@ -370,7 +370,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView //! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in //! If point is given, re-center on it - void zoomByFactor( double scaleFactor, const QgsPoint *center = nullptr ); + void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr ); //! Zooms in/out with a given center void zoomWithCenter( int x, int y, bool zoomIn ); @@ -590,7 +590,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView /** Emits current mouse position \note changed in 1.3 */ - void xyCoordinates( const QgsPoint &p ); + void xyCoordinates( const QgsPointXY &p ); //! Emitted when the scale of the map changes void scaleChanged( double ); diff --git a/src/gui/qgsmapcanvasannotationitem.cpp b/src/gui/qgsmapcanvasannotationitem.cpp index ad982243c7c..0029b30ee27 100644 --- a/src/gui/qgsmapcanvasannotationitem.cpp +++ b/src/gui/qgsmapcanvasannotationitem.cpp @@ -61,7 +61,7 @@ void QgsMapCanvasAnnotationItem::updatePosition() if ( mAnnotation->hasFixedMapPosition() ) { QgsCoordinateTransform t( mAnnotation->mapPositionCrs(), mMapCanvas->mapSettings().destinationCrs() ); - QgsPoint coord = mAnnotation->mapPosition(); + QgsPointXY coord = mAnnotation->mapPosition(); try { coord = t.transform( coord ); @@ -140,7 +140,7 @@ void QgsMapCanvasAnnotationItem::setFeatureForMapPosition() return; double halfIdentifyWidth = QgsMapTool::searchRadiusMU( mMapCanvas ); - QgsPoint mapPosition = mAnnotation->mapPosition(); + QgsPointXY mapPosition = mAnnotation->mapPosition(); try { diff --git a/src/gui/qgsmapcanvasitem.cpp b/src/gui/qgsmapcanvasitem.cpp index 8a9e17343be..296ce31ff1b 100644 --- a/src/gui/qgsmapcanvasitem.cpp +++ b/src/gui/qgsmapcanvasitem.cpp @@ -53,13 +53,13 @@ void QgsMapCanvasItem::paint( QPainter *painter, paint( painter ); // call the derived item's drawing routines } -QgsPoint QgsMapCanvasItem::toMapCoordinates( QPoint point ) const +QgsPointXY QgsMapCanvasItem::toMapCoordinates( QPoint point ) const { return mMapCanvas->getCoordinateTransform()->toMapCoordinates( point ); } -QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint &point ) const +QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPointXY &point ) const { qreal x = point.x(), y = point.y(); mMapCanvas->getCoordinateTransform()->transformInPlace( x, y ); diff --git a/src/gui/qgsmapcanvasitem.h b/src/gui/qgsmapcanvasitem.h index 9a956c7de0e..5e2a0a3179d 100644 --- a/src/gui/qgsmapcanvasitem.h +++ b/src/gui/qgsmapcanvasitem.h @@ -68,10 +68,10 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem void setRect( const QgsRectangle &r, bool resetRotation = true ); //! transformation from screen coordinates to map coordinates - QgsPoint toMapCoordinates( QPoint point ) const; + QgsPointXY toMapCoordinates( QPoint point ) const; //! transformation from map coordinates to screen coordinates - QPointF toCanvasCoordinates( const QgsPoint &point ) const; + QPointF toCanvasCoordinates( const QgsPointXY &point ) const; protected: diff --git a/src/gui/qgsmapmouseevent.cpp b/src/gui/qgsmapmouseevent.cpp index 6f75cf8625e..0a80040ec1c 100644 --- a/src/gui/qgsmapmouseevent.cpp +++ b/src/gui/qgsmapmouseevent.cpp @@ -30,7 +30,7 @@ struct EdgesOnlyFilter : public QgsPointLocator::MatchFilter QgsMapMouseEvent::QgsMapMouseEvent( QgsMapCanvas *mapCanvas, QMouseEvent *event ) : QMouseEvent( event->type(), event->pos(), event->button(), event->buttons(), event->modifiers() ) , mSnappingMode( NoSnapping ) - , mOriginalMapPoint( mapCanvas ? mapCanvas->mapSettings().mapToPixel().toMapCoordinates( event->pos() ) : QgsPoint() ) + , mOriginalMapPoint( mapCanvas ? mapCanvas->mapSettings().mapToPixel().toMapCoordinates( event->pos() ) : QgsPointXY() ) , mMapPoint( mOriginalMapPoint ) , mPixelPoint( event->pos() ) , mMapCanvas( mapCanvas ) @@ -40,14 +40,14 @@ QgsMapMouseEvent::QgsMapMouseEvent( QgsMapCanvas *mapCanvas, QMouseEvent *event QgsMapMouseEvent::QgsMapMouseEvent( QgsMapCanvas *mapCanvas, QEvent::Type type, QPoint pos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ) : QMouseEvent( type, pos, button, buttons, modifiers ) , mSnappingMode( NoSnapping ) - , mOriginalMapPoint( mapCanvas ? mapCanvas->mapSettings().mapToPixel().toMapCoordinates( pos ) : QgsPoint() ) + , mOriginalMapPoint( mapCanvas ? mapCanvas->mapSettings().mapToPixel().toMapCoordinates( pos ) : QgsPointXY() ) , mMapPoint( mOriginalMapPoint ) , mPixelPoint( pos ) , mMapCanvas( mapCanvas ) { } -QgsPoint QgsMapMouseEvent::snapPoint( SnappingMode snappingMode ) +QgsPointXY QgsMapMouseEvent::snapPoint( SnappingMode snappingMode ) { // Use cached result if ( mSnappingMode == snappingMode ) @@ -95,10 +95,10 @@ QgsPoint QgsMapMouseEvent::snapPoint( SnappingMode snappingMode ) return mMapPoint; } -QList QgsMapMouseEvent::snapSegment( SnappingMode snappingMode, bool *snapped, bool allLayers ) const +QList QgsMapMouseEvent::snapSegment( SnappingMode snappingMode, bool *snapped, bool allLayers ) const { - QList segment; - QgsPoint pt1, pt2; + QList segment; + QgsPointXY pt1, pt2; // If there's a cached snapping result we use it if ( snappingMode == mSnappingMode && mSnapMatch.hasEdge() ) @@ -147,13 +147,13 @@ QList QgsMapMouseEvent::snapSegment( SnappingMode snappingMode, bool * return segment; } -void QgsMapMouseEvent::setMapPoint( const QgsPoint &point ) +void QgsMapMouseEvent::setMapPoint( const QgsPointXY &point ) { mMapPoint = point; mPixelPoint = mapToPixelCoordinates( point ); } -QPoint QgsMapMouseEvent::mapToPixelCoordinates( const QgsPoint &point ) +QPoint QgsMapMouseEvent::mapToPixelCoordinates( const QgsPointXY &point ) { double x = point.x(), y = point.y(); diff --git a/src/gui/qgsmapmouseevent.h b/src/gui/qgsmapmouseevent.h index 52c280bc65d..2c2b653be14 100644 --- a/src/gui/qgsmapmouseevent.h +++ b/src/gui/qgsmapmouseevent.h @@ -77,7 +77,7 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent * \brief snapPoint will snap the points using the map canvas snapping utils configuration * \note if snapping did not succeeded, the map point will be reset to its original position */ - QgsPoint snapPoint( SnappingMode snappingMode ); + QgsPointXY snapPoint( SnappingMode snappingMode ); /** * Returns the first snapped segment. If the cached snapped match is a segment, it will simply return it. @@ -87,7 +87,7 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent * \param snapped if given, determines if a segment has been snapped * \param allLayers if true, override snapping mode */ - QList snapSegment( SnappingMode snappingMode, bool *snapped = nullptr, bool allLayers = false ) const; + QList snapSegment( SnappingMode snappingMode, bool *snapped = nullptr, bool allLayers = false ) const; /** * Returns true if there is a snapped point cached. @@ -101,7 +101,7 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent * \brief mapPoint returns the point in coordinates * \returns the point in map coordinates, after snapping if requested in the event. */ - inline QgsPoint mapPoint() const { return mMapPoint; } + inline QgsPointXY mapPoint() const { return mMapPoint; } /** * Returns the matching data from the most recently snapped point. @@ -116,14 +116,14 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent * * \param point The point in map coordinates */ - void setMapPoint( const QgsPoint &point ); + void setMapPoint( const QgsPointXY &point ); /** * Returns the original, unmodified map point of the mouse cursor. * * \returns The cursor position in map coordinates. */ - QgsPoint originalMapPoint() const { return mMapPoint; } + QgsPointXY originalMapPoint() const { return mMapPoint; } /** * The snapped mouse cursor in pixel coordinates. @@ -142,15 +142,15 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent private: - QPoint mapToPixelCoordinates( const QgsPoint &point ); + QPoint mapToPixelCoordinates( const QgsPointXY &point ); SnappingMode mSnappingMode; //! Unsnapped point in map coordinates. - QgsPoint mOriginalMapPoint; + QgsPointXY mOriginalMapPoint; //! Location in map coordinates. May be snapped. - QgsPoint mMapPoint; + QgsPointXY mMapPoint; //! Location in pixel coordinates. May be snapped. //! Original pixel point available through the parent QMouseEvent. diff --git a/src/gui/qgsmapoverviewcanvas.cpp b/src/gui/qgsmapoverviewcanvas.cpp index 6ffd64fcff9..341e4273635 100644 --- a/src/gui/qgsmapoverviewcanvas.cpp +++ b/src/gui/qgsmapoverviewcanvas.cpp @@ -91,10 +91,10 @@ void QgsMapOverviewCanvas::drawExtentRect() const QPolygonF &vPoly = mMapCanvas->mapSettings().visiblePolygon(); const QgsMapToPixel &cXf = mSettings.mapToPixel(); QVector< QPoint > pts; - pts.push_back( cXf.transform( QgsPoint( vPoly[0] ) ).toQPointF().toPoint() ); - pts.push_back( cXf.transform( QgsPoint( vPoly[1] ) ).toQPointF().toPoint() ); - pts.push_back( cXf.transform( QgsPoint( vPoly[2] ) ).toQPointF().toPoint() ); - pts.push_back( cXf.transform( QgsPoint( vPoly[3] ) ).toQPointF().toPoint() ); + pts.push_back( cXf.transform( QgsPointXY( vPoly[0] ) ).toQPointF().toPoint() ); + pts.push_back( cXf.transform( QgsPointXY( vPoly[1] ) ).toQPointF().toPoint() ); + pts.push_back( cXf.transform( QgsPointXY( vPoly[2] ) ).toQPointF().toPoint() ); + pts.push_back( cXf.transform( QgsPointXY( vPoly[3] ) ).toQPointF().toPoint() ); mPanningWidget->setPolygon( QPolygon( pts ) ); mPanningWidget->show(); // show if hidden } @@ -132,7 +132,7 @@ void QgsMapOverviewCanvas::mouseReleaseEvent( QMouseEvent *e ) const QgsMapToPixel &cXf = mSettings.mapToPixel(); QRect rect = mPanningWidget->geometry(); - QgsPoint center = cXf.toMapCoordinates( rect.center() ); + QgsPointXY center = cXf.toMapCoordinates( rect.center() ); mMapCanvas->setCenter( center ); mMapCanvas->refresh(); } diff --git a/src/gui/qgsmaptip.cpp b/src/gui/qgsmaptip.cpp index 7d1560bf547..34adc99c433 100644 --- a/src/gui/qgsmaptip.cpp +++ b/src/gui/qgsmaptip.cpp @@ -44,7 +44,7 @@ QgsMapTip::QgsMapTip() } void QgsMapTip::showMapTip( QgsMapLayer *pLayer, - QgsPoint &mapPosition, + QgsPointXY &mapPosition, QPoint &pixelPosition, QgsMapCanvas *pMapCanvas ) { @@ -165,7 +165,7 @@ void QgsMapTip::clear( QgsMapCanvas * ) mMapTipVisible = false; } -QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPoint &mapPosition, QgsMapCanvas *mapCanvas ) +QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPointXY &mapPosition, QgsMapCanvas *mapCanvas ) { QgsVectorLayer *vlayer = qobject_cast( layer ); if ( !vlayer ) diff --git a/src/gui/qgsmaptip.h b/src/gui/qgsmaptip.h index 0f93e5e2d5e..f4a929c29b8 100644 --- a/src/gui/qgsmaptip.h +++ b/src/gui/qgsmaptip.h @@ -19,7 +19,7 @@ class QgsMapLayer; class QgsMapCanvas; class QPoint; class QString; -class QgsPoint; +class QgsPointXY; class QgsVectorLayer; class QgsWebView; @@ -66,7 +66,7 @@ class GUI_EXPORT QgsMapTip : public QWidget * \param mpMapCanvas a map canvas on which the tip is drawn */ void showMapTip( QgsMapLayer *thepLayer, - QgsPoint &mapPosition, + QgsPointXY &mapPosition, QPoint &pixelPosition, QgsMapCanvas *mpMapCanvas ); @@ -78,7 +78,7 @@ class GUI_EXPORT QgsMapTip : public QWidget // Fetch the feature to use for the maptip text. // Only the first feature in the search radius is used QString fetchFeature( QgsMapLayer *thepLayer, - QgsPoint &mapPosition, + QgsPointXY &mapPosition, QgsMapCanvas *mapCanvas ); QString replaceText( diff --git a/src/gui/qgsmaptool.cpp b/src/gui/qgsmaptool.cpp index d9260db73e0..2fce839a551 100644 --- a/src/gui/qgsmaptool.cpp +++ b/src/gui/qgsmaptool.cpp @@ -40,30 +40,30 @@ QgsMapTool::~QgsMapTool() } -QgsPoint QgsMapTool::toMapCoordinates( QPoint point ) +QgsPointXY QgsMapTool::toMapCoordinates( QPoint point ) { return mCanvas->getCoordinateTransform()->toMapCoordinates( point ); } -QgsPointV2 QgsMapTool::toMapCoordinates( const QgsMapLayer *layer, const QgsPointV2 &point ) +QgsPoint QgsMapTool::toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ) { - QgsPoint result = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPoint( point.x(), point.y() ) ); - return QgsPointV2( result.x(), result.y() ); + QgsPointXY result = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPointXY( point.x(), point.y() ) ); + return QgsPoint( result.x(), result.y() ); } -QgsPoint QgsMapTool::toLayerCoordinates( const QgsMapLayer *layer, QPoint point ) +QgsPointXY QgsMapTool::toLayerCoordinates( const QgsMapLayer *layer, QPoint point ) { - QgsPoint pt = toMapCoordinates( point ); + QgsPointXY pt = toMapCoordinates( point ); return toLayerCoordinates( layer, pt ); } -QgsPoint QgsMapTool::toLayerCoordinates( const QgsMapLayer *layer, const QgsPoint &point ) +QgsPointXY QgsMapTool::toLayerCoordinates( const QgsMapLayer *layer, const QgsPointXY &point ) { return mCanvas->mapSettings().mapToLayerCoordinates( layer, point ); } -QgsPoint QgsMapTool::toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ) +QgsPointXY QgsMapTool::toMapCoordinates( const QgsMapLayer *layer, const QgsPointXY &point ) { return mCanvas->mapSettings().layerToMapCoordinates( layer, point ); } @@ -73,7 +73,7 @@ QgsRectangle QgsMapTool::toLayerCoordinates( const QgsMapLayer *layer, const Qgs return mCanvas->mapSettings().mapToLayerCoordinates( layer, rect ); } -QPoint QgsMapTool::toCanvasCoordinates( const QgsPoint &point ) +QPoint QgsMapTool::toCanvasCoordinates( const QgsPointXY &point ) { qreal x = point.x(), y = point.y(); mCanvas->getCoordinateTransform()->transformInPlace( x, y ); diff --git a/src/gui/qgsmaptool.h b/src/gui/qgsmaptool.h index 5d4953f2948..d8777134a71 100644 --- a/src/gui/qgsmaptool.h +++ b/src/gui/qgsmaptool.h @@ -35,7 +35,7 @@ class QgsRenderContext; class QKeyEvent; class QMouseEvent; class QWheelEvent; -class QgsPoint; +class QgsPointXY; class QgsRectangle; class QPoint; class QAction; @@ -195,26 +195,26 @@ class GUI_EXPORT QgsMapTool : public QObject QgsMapTool( QgsMapCanvas *canvas SIP_TRANSFERTHIS ); //! transformation from screen coordinates to map coordinates - QgsPoint toMapCoordinates( QPoint point ); + QgsPointXY toMapCoordinates( QPoint point ); //! transformation from screen coordinates to layer's coordinates - QgsPoint toLayerCoordinates( const QgsMapLayer *layer, QPoint point ); + QgsPointXY toLayerCoordinates( const QgsMapLayer *layer, QPoint point ); //! transformation from map coordinates to layer's coordinates - QgsPoint toLayerCoordinates( const QgsMapLayer *layer, const QgsPoint &point ); + QgsPointXY toLayerCoordinates( const QgsMapLayer *layer, const QgsPointXY &point ); //!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used) - QgsPoint toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ); + QgsPointXY toMapCoordinates( const QgsMapLayer *layer, const QgsPointXY &point ); //!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used) //! \note available in Python bindings as toMapCoordinatesV2 - QgsPointV2 toMapCoordinates( const QgsMapLayer *layer, const QgsPointV2 &point ) SIP_PYNAME( toMapCoordinatesV2 ); + QgsPoint toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point ) SIP_PYNAME( toMapCoordinatesV2 ); //! trnasformation of the rect from map coordinates to layer's coordinates QgsRectangle toLayerCoordinates( const QgsMapLayer *layer, const QgsRectangle &rect ); //! transformation from map coordinates to screen coordinates - QPoint toCanvasCoordinates( const QgsPoint &point ); + QPoint toCanvasCoordinates( const QgsPointXY &point ); //! pointer to map canvas QgsMapCanvas *mCanvas = nullptr; diff --git a/src/gui/qgsmaptooladvanceddigitizing.cpp b/src/gui/qgsmaptooladvanceddigitizing.cpp index 214d7508729..12745a0f634 100644 --- a/src/gui/qgsmaptooladvanceddigitizing.cpp +++ b/src/gui/qgsmaptooladvanceddigitizing.cpp @@ -80,7 +80,7 @@ void QgsMapToolAdvancedDigitizing::deactivate() mCadDockWidget->disable(); } -void QgsMapToolAdvancedDigitizing::cadPointChanged( const QgsPoint &point ) +void QgsMapToolAdvancedDigitizing::cadPointChanged( const QgsPointXY &point ) { Q_UNUSED( point ); QMouseEvent *ev = new QMouseEvent( QEvent::MouseMove, mCanvas->mouseLastXY(), Qt::NoButton, Qt::NoButton, Qt::NoModifier ); diff --git a/src/gui/qgsmaptooladvanceddigitizing.h b/src/gui/qgsmaptooladvanceddigitizing.h index de50b19af0c..f7f6c6eec50 100644 --- a/src/gui/qgsmaptooladvanceddigitizing.h +++ b/src/gui/qgsmaptooladvanceddigitizing.h @@ -139,7 +139,7 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit * * \param point The last point known to the cad system. */ - void cadPointChanged( const QgsPoint &point ); + void cadPointChanged( const QgsPointXY &point ); private: QgsAdvancedDigitizingDockWidget *mCadDockWidget = nullptr; diff --git a/src/gui/qgsmaptoolcapture.cpp b/src/gui/qgsmaptoolcapture.cpp index 24c298e2a9f..02edbe2cd6b 100644 --- a/src/gui/qgsmaptoolcapture.cpp +++ b/src/gui/qgsmaptoolcapture.cpp @@ -146,20 +146,20 @@ bool QgsMapToolCapture::tracingEnabled() } -QgsPoint QgsMapToolCapture::tracingStartPoint() +QgsPointXY QgsMapToolCapture::tracingStartPoint() { try { QgsMapLayer *layer = mCanvas->currentLayer(); if ( !layer ) - return QgsPoint(); - QgsPointV2 v = mCaptureCurve.endPoint(); - return toMapCoordinates( layer, QgsPoint( v.x(), v.y() ) ); + return QgsPointXY(); + QgsPoint v = mCaptureCurve.endPoint(); + return toMapCoordinates( layer, QgsPointXY( v.x(), v.y() ) ); } catch ( QgsCsException & ) { QgsDebugMsg( "transformation to layer coordinate failed" ); - return QgsPoint(); + return QgsPointXY(); } } @@ -169,8 +169,8 @@ bool QgsMapToolCapture::tracingMouseMove( QgsMapMouseEvent *e ) if ( !e->isSnapped() ) return false; - QgsPoint pt0 = tracingStartPoint(); - if ( pt0 == QgsPoint() ) + QgsPointXY pt0 = tracingStartPoint(); + if ( pt0 == QgsPointXY() ) return false; QgsMapCanvasTracer *tracer = QgsMapCanvasTracer::tracerForCanvas( mCanvas ); @@ -180,7 +180,7 @@ bool QgsMapToolCapture::tracingMouseMove( QgsMapMouseEvent *e ) mTempRubberBand->reset( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry ); QgsTracer::PathError err; - QVector points = tracer->findShortestPath( pt0, e->mapPoint(), &err ); + QVector points = tracer->findShortestPath( pt0, e->mapPoint(), &err ); if ( points.isEmpty() ) { tracer->reportError( err, false ); @@ -199,7 +199,7 @@ bool QgsMapToolCapture::tracingMouseMove( QgsMapMouseEvent *e ) } -bool QgsMapToolCapture::tracingAddVertex( const QgsPoint &point ) +bool QgsMapToolCapture::tracingAddVertex( const QgsPointXY &point ) { QgsMapCanvasTracer *tracer = QgsMapCanvasTracer::tracerForCanvas( mCanvas ); if ( !tracer ) @@ -217,8 +217,8 @@ bool QgsMapToolCapture::tracingAddVertex( const QgsPoint &point ) bool res = tracer->isPointSnapped( point ); if ( res ) { - QgsPointV2 layerPoint; - nextPoint( QgsPointV2( point ), layerPoint ); // assuming the transform went fine earlier + QgsPoint layerPoint; + nextPoint( QgsPoint( point ), layerPoint ); // assuming the transform went fine earlier mRubberBand->addPoint( point ); mCaptureCurve.addVertex( layerPoint ); @@ -226,21 +226,21 @@ bool QgsMapToolCapture::tracingAddVertex( const QgsPoint &point ) return res; } - QgsPoint pt0 = tracingStartPoint(); - if ( pt0 == QgsPoint() ) + QgsPointXY pt0 = tracingStartPoint(); + if ( pt0 == QgsPointXY() ) return false; QgsTracer::PathError err; - QVector points = tracer->findShortestPath( pt0, point, &err ); + QVector points = tracer->findShortestPath( pt0, point, &err ); if ( points.isEmpty() ) return false; // ignore the vertex - can't find path to the end point! // transform points QgsPointSequence layerPoints; - QgsPointV2 lp; // in layer coords + QgsPoint lp; // in layer coords for ( int i = 1; i < points.count(); ++i ) { - if ( nextPoint( QgsPointV2( points[i] ), lp ) != 0 ) + if ( nextPoint( QgsPoint( points[i] ), lp ) != 0 ) return false; layerPoints << lp; } @@ -262,7 +262,7 @@ void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e ) { QgsMapToolAdvancedDigitizing::cadCanvasMoveEvent( e ); bool snapped = e->isSnapped(); - QgsPoint point = e->mapPoint(); + QgsPointXY point = e->mapPoint(); if ( !snapped ) { @@ -284,8 +284,8 @@ void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e ) if ( !mTempRubberBand && mCaptureCurve.numPoints() > 0 ) { mTempRubberBand = createRubberBand( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry, true ); - QgsPointV2 pt = mCaptureCurve.endPoint(); - mTempRubberBand->addPoint( QgsPoint( pt.x(), pt.y() ) ); + QgsPoint pt = mCaptureCurve.endPoint(); + mTempRubberBand->addPoint( QgsPointXY( pt.x(), pt.y() ) ); mTempRubberBand->addPoint( point ); } @@ -308,8 +308,8 @@ void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e ) mTempRubberBand->reset( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry ); if ( mCaptureMode == CapturePolygon ) mTempRubberBand->addPoint( *mRubberBand->getPoint( 0, 0 ), false ); - QgsPointV2 pt = mCaptureCurve.endPoint(); - QgsPoint mapPt = toMapCoordinates( qobject_cast( mCanvas->currentLayer() ), QgsPoint( pt.x(), pt.y() ) ); + QgsPoint pt = mCaptureCurve.endPoint(); + QgsPointXY mapPt = toMapCoordinates( qobject_cast( mCanvas->currentLayer() ), QgsPointXY( pt.x(), pt.y() ) ); mTempRubberBand->addPoint( mapPt ); mTempRubberBand->addPoint( point ); } @@ -320,7 +320,7 @@ void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e ) } // mouseMoveEvent -int QgsMapToolCapture::nextPoint( const QgsPointV2 &mapPoint, QgsPointV2 &layerPoint ) +int QgsMapToolCapture::nextPoint( const QgsPoint &mapPoint, QgsPoint &layerPoint ) { QgsVectorLayer *vlayer = qobject_cast( mCanvas->currentLayer() ); if ( !vlayer ) @@ -330,8 +330,8 @@ int QgsMapToolCapture::nextPoint( const QgsPointV2 &mapPoint, QgsPointV2 &layerP } try { - QgsPoint mapP( mapPoint.x(), mapPoint.y() ); //#spellok - layerPoint = QgsPointV2( toLayerCoordinates( vlayer, mapP ) ); //transform snapped point back to layer crs //#spellok + QgsPointXY mapP( mapPoint.x(), mapPoint.y() ); //#spellok + layerPoint = QgsPoint( toLayerCoordinates( vlayer, mapP ) ); //transform snapped point back to layer crs //#spellok if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) ) layerPoint.addZValue( defaultZValue() ); if ( QgsWkbTypes::hasM( vlayer->wkbType() ) ) @@ -347,13 +347,13 @@ int QgsMapToolCapture::nextPoint( const QgsPointV2 &mapPoint, QgsPointV2 &layerP return 0; } -int QgsMapToolCapture::nextPoint( QPoint p, QgsPointV2 &layerPoint, QgsPointV2 &mapPoint ) +int QgsMapToolCapture::nextPoint( QPoint p, QgsPoint &layerPoint, QgsPoint &mapPoint ) { - mapPoint = QgsPointV2( toMapCoordinates( p ) ); + mapPoint = QgsPoint( toMapCoordinates( p ) ); return nextPoint( mapPoint, layerPoint ); } -int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, QgsPointV2 &layerPoint ) +int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint ) { QgsVectorLayer *vlayer = qobject_cast( mCanvas->currentLayer() ); QgsVectorLayer *sourceLayer = match.layer(); @@ -383,12 +383,12 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs } } -int QgsMapToolCapture::addVertex( const QgsPoint &point ) +int QgsMapToolCapture::addVertex( const QgsPointXY &point ) { return addVertex( point, QgsPointLocator::Match() ); } -int QgsMapToolCapture::addVertex( const QgsPoint &point, const QgsPointLocator::Match &match ) +int QgsMapToolCapture::addVertex( const QgsPointXY &point, const QgsPointLocator::Match &match ) { if ( mode() == CaptureNone ) { @@ -397,11 +397,11 @@ int QgsMapToolCapture::addVertex( const QgsPoint &point, const QgsPointLocator:: } int res; - QgsPointV2 layerPoint; + QgsPoint layerPoint; res = fetchLayerPoint( match, layerPoint ); if ( res != 0 ) { - res = nextPoint( QgsPointV2( point ), layerPoint ); + res = nextPoint( QgsPoint( point ), layerPoint ); if ( res != 0 ) { return res; @@ -441,7 +441,7 @@ int QgsMapToolCapture::addVertex( const QgsPoint &point, const QgsPointLocator:: } else if ( mCaptureMode == CapturePolygon ) { - const QgsPoint *firstPoint = mRubberBand->getPoint( 0, 0 ); + const QgsPointXY *firstPoint = mRubberBand->getPoint( 0, 0 ); mTempRubberBand->addPoint( *firstPoint ); mTempRubberBand->movePoint( point ); mTempRubberBand->addPoint( point ); @@ -471,7 +471,7 @@ int QgsMapToolCapture::addCurve( QgsCurve *c ) QgsPointSequence::const_iterator ptIt = linePoints.constBegin(); for ( ; ptIt != linePoints.constEnd(); ++ptIt ) { - mRubberBand->addPoint( QgsPoint( ptIt->x(), ptIt->y() ) ); + mRubberBand->addPoint( QgsPointXY( ptIt->x(), ptIt->y() ) ); } if ( !mTempRubberBand ) @@ -482,8 +482,8 @@ int QgsMapToolCapture::addCurve( QgsCurve *c ) { mTempRubberBand->reset(); } - QgsPointV2 endPt = c->endPoint(); - mTempRubberBand->addPoint( QgsPoint( endPt.x(), endPt.y() ) ); //add last point of c + QgsPoint endPt = c->endPoint(); + mTempRubberBand->addPoint( QgsPointXY( endPt.x(), endPt.y() ) ); //add last point of c //transform back to layer CRS in case map CRS and layer CRS are different QgsVectorLayer *vlayer = qobject_cast( mCanvas->currentLayer() ); @@ -517,7 +517,7 @@ void QgsMapToolCapture::undo() { if ( tempRubberBandSize > 1 ) { - const QgsPoint *point = mRubberBand->getPoint( 0, rubberBandSize - 2 ); + const QgsPointXY *point = mRubberBand->getPoint( 0, rubberBandSize - 2 ); mTempRubberBand->movePoint( tempRubberBandSize - 2, *point ); } } @@ -700,16 +700,16 @@ int QgsMapToolCapture::size() return mCaptureCurve.numPoints(); } -QList QgsMapToolCapture::points() +QList QgsMapToolCapture::points() { QgsPointSequence pts; - QList points; + QList points; mCaptureCurve.points( pts ); QgsGeometry::convertPointList( pts, points ); return points; } -void QgsMapToolCapture::setPoints( const QList &pointList ) +void QgsMapToolCapture::setPoints( const QList &pointList ) { QgsLineString *line = new QgsLineString( pointList ); mCaptureCurve.clear(); diff --git a/src/gui/qgsmaptoolcapture.h b/src/gui/qgsmaptoolcapture.h index b2f1a8f1108..b2f6cbdc651 100644 --- a/src/gui/qgsmaptoolcapture.h +++ b/src/gui/qgsmaptoolcapture.h @@ -90,7 +90,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * 2 if the transformation failed */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int nextPoint( const QgsPointV2 &mapPoint, QgsPointV2 &layerPoint ); + int nextPoint( const QgsPoint &mapPoint, QgsPoint &layerPoint ); /** Converts a point to map coordinates and layer coordinates * \param p the input point @@ -102,7 +102,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * 2 if the transformation failed */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int nextPoint( QPoint p, QgsPointV2 &layerPoint, QgsPointV2 &mapPoint ); + int nextPoint( QPoint p, QgsPoint &layerPoint, QgsPoint &mapPoint ); /** Fetches the original point from the source layer if it has the same * CRS as the current layer. @@ -110,20 +110,20 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * \since QGIS 2.14 */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPointV2 &layerPoint ); + int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint ); /** Adds a point to the rubber band (in map coordinates) and to the capture list (in layer coordinates) * \returns 0 in case of success, 1 if current layer is not a vector layer, 2 if coordinate transformation failed */ // TODO QGIS 3.0 returns an enum instead of a magic constant - int addVertex( const QgsPoint &point ); + int addVertex( const QgsPointXY &point ); /** Variant to supply more information in the case of snapping * \param mapPoint The vertex to add in map coordinates * \param match Data about the snapping match. Can be an invalid match, if point not snapped. * \since QGIS 2.14 */ - int addVertex( const QgsPoint &mapPoint, const QgsPointLocator::Match &match ); + int addVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match &match ); //! Removes the last vertex from mRubberBand and mCaptureList void undo(); @@ -156,14 +156,14 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * List of digitized points * \returns List of points */ - QList points(); + QList points(); /** * Set the points on which to work * * \param pointList A list of points */ - void setPoints( const QList &pointList ); + void setPoints( const QList &pointList ); /** * Close an open polygon @@ -174,11 +174,11 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing //! whether tracing has been requested by the user bool tracingEnabled(); //! first point that will be used as a start of the trace - QgsPoint tracingStartPoint(); + QgsPointXY tracingStartPoint(); //! handle of mouse movement when tracing enabled and capturing has started bool tracingMouseMove( QgsMapMouseEvent *e ); //! handle of addition of clicked point (with the rest of the trace) when tracing enabled - bool tracingAddVertex( const QgsPoint &point ); + bool tracingAddVertex( const QgsPointXY &point ); private: //! Flag to indicate a map canvas capture operation is taking place diff --git a/src/gui/qgsmaptooledit.cpp b/src/gui/qgsmaptooledit.cpp index 124269bf7b4..ce7ab14847d 100644 --- a/src/gui/qgsmaptooledit.cpp +++ b/src/gui/qgsmaptooledit.cpp @@ -92,7 +92,7 @@ QgsVectorLayer *QgsMapToolEdit::currentVectorLayer() } -int QgsMapToolEdit::addTopologicalPoints( const QList &geom ) +int QgsMapToolEdit::addTopologicalPoints( const QList &geom ) { if ( !mCanvas ) { @@ -107,7 +107,7 @@ int QgsMapToolEdit::addTopologicalPoints( const QList &geom ) return 2; } - QList::const_iterator list_it = geom.constBegin(); + QList::const_iterator list_it = geom.constBegin(); for ( ; list_it != geom.constEnd(); ++list_it ) { vlayer->addTopologicalPoints( *list_it ); diff --git a/src/gui/qgsmaptooledit.h b/src/gui/qgsmaptooledit.h index 0ad0e40bd0a..618ab164481 100644 --- a/src/gui/qgsmaptooledit.h +++ b/src/gui/qgsmaptooledit.h @@ -69,7 +69,7 @@ class GUI_EXPORT QgsMapToolEdit: public QgsMapTool * \param geom list of points (in layer coordinate system) * \returns 0 in case of success */ - int addTopologicalPoints( const QList &geom ); + int addTopologicalPoints( const QList &geom ); //! Display a timed message bar noting the active layer is not vector. void notifyNotVectorLayer(); diff --git a/src/gui/qgsmaptoolemitpoint.cpp b/src/gui/qgsmaptoolemitpoint.cpp index a14009258e4..f33aaa02ca5 100644 --- a/src/gui/qgsmaptoolemitpoint.cpp +++ b/src/gui/qgsmaptoolemitpoint.cpp @@ -31,7 +31,7 @@ void QgsMapToolEmitPoint::canvasMoveEvent( QgsMapMouseEvent *e ) void QgsMapToolEmitPoint::canvasPressEvent( QgsMapMouseEvent *e ) { - QgsPoint pnt = toMapCoordinates( e->pos() ); + QgsPointXY pnt = toMapCoordinates( e->pos() ); emit canvasClicked( pnt, e->button() ); } diff --git a/src/gui/qgsmaptoolemitpoint.h b/src/gui/qgsmaptoolemitpoint.h index 8bed5b9db19..4206b1c7735 100644 --- a/src/gui/qgsmaptoolemitpoint.h +++ b/src/gui/qgsmaptoolemitpoint.h @@ -41,7 +41,7 @@ class GUI_EXPORT QgsMapToolEmitPoint : public QgsMapTool signals: //! signal emitted on canvas click - void canvasClicked( const QgsPoint &point, Qt::MouseButton button ); + void canvasClicked( const QgsPointXY &point, Qt::MouseButton button ); }; #endif diff --git a/src/gui/qgsmaptoolidentify.cpp b/src/gui/qgsmaptoolidentify.cpp index e1eaa364729..17d652f58eb 100644 --- a/src/gui/qgsmaptoolidentify.cpp +++ b/src/gui/qgsmaptoolidentify.cpp @@ -181,7 +181,7 @@ void QgsMapToolIdentify::deactivate() QgsMapTool::deactivate(); } -bool QgsMapToolIdentify::identifyLayer( QList *results, QgsMapLayer *layer, const QgsPoint &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, LayerType layerType ) +bool QgsMapToolIdentify::identifyLayer( QList *results, QgsMapLayer *layer, const QgsPointXY &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, LayerType layerType ) { if ( layer->type() == QgsMapLayer::RasterLayer && layerType.testFlag( RasterLayer ) ) { @@ -197,7 +197,7 @@ bool QgsMapToolIdentify::identifyLayer( QList *results, QgsMapLa } } -bool QgsMapToolIdentify::identifyVectorLayer( QList *results, QgsVectorLayer *layer, const QgsPoint &point ) +bool QgsMapToolIdentify::identifyVectorLayer( QList *results, QgsVectorLayer *layer, const QgsPointXY &point ) { if ( !layer || !layer->hasGeometryType() ) return false; @@ -296,9 +296,9 @@ void QgsMapToolIdentify::closestVertexAttributes( const QgsAbstractGeometry &geo QString str = QLocale::system().toString( vId.vertex + 1 ); derivedAttributes.insert( tr( "Closest vertex number" ), str ); - QgsPointV2 closestPoint = geometry.vertexAt( vId ); + QgsPoint closestPoint = geometry.vertexAt( vId ); - QgsPoint closestPointMapCoords = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPoint( closestPoint.x(), closestPoint.y() ) ); + QgsPointXY closestPointMapCoords = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPointXY( closestPoint.x(), closestPoint.y() ) ); derivedAttributes.insert( QStringLiteral( "Closest vertex X" ), formatXCoordinate( closestPointMapCoords ) ); derivedAttributes.insert( QStringLiteral( "Closest vertex Y" ), formatYCoordinate( closestPointMapCoords ) ); @@ -326,25 +326,25 @@ void QgsMapToolIdentify::closestVertexAttributes( const QgsAbstractGeometry &geo } } -QString QgsMapToolIdentify::formatCoordinate( const QgsPoint &canvasPoint ) const +QString QgsMapToolIdentify::formatCoordinate( const QgsPointXY &canvasPoint ) const { return QgsCoordinateUtils::formatCoordinateForProject( canvasPoint, mCanvas->mapSettings().destinationCrs(), mCoordinatePrecision ); } -QString QgsMapToolIdentify::formatXCoordinate( const QgsPoint &canvasPoint ) const +QString QgsMapToolIdentify::formatXCoordinate( const QgsPointXY &canvasPoint ) const { QString coordinate = formatCoordinate( canvasPoint ); return coordinate.split( ',' ).at( 0 ); } -QString QgsMapToolIdentify::formatYCoordinate( const QgsPoint &canvasPoint ) const +QString QgsMapToolIdentify::formatYCoordinate( const QgsPointXY &canvasPoint ) const { QString coordinate = formatCoordinate( canvasPoint ); return coordinate.split( ',' ).at( 1 ); } -QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeature *feature, QgsMapLayer *layer, const QgsPoint &layerPoint ) +QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeature *feature, QgsMapLayer *layer, const QgsPointXY &layerPoint ) { // Calculate derived attributes and insert: // measure distance or area depending on geometry type @@ -360,13 +360,13 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::NullGeometry; QgsVertexId vId; - QgsPointV2 closestPoint; + QgsPoint closestPoint; if ( feature->hasGeometry() ) { geometryType = feature->geometry().type(); wkbType = feature->geometry().geometry()->wkbType(); //find closest vertex to clicked point - closestPoint = QgsGeometryUtils::closestVertex( *feature->geometry().geometry(), QgsPointV2( layerPoint.x(), layerPoint.y() ), vId ); + closestPoint = QgsGeometryUtils::closestVertex( *feature->geometry().geometry(), QgsPoint( layerPoint.x(), layerPoint.y() ), vId ); } if ( QgsWkbTypes::isMultiType( wkbType ) ) @@ -394,12 +394,12 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur closestVertexAttributes( *curve, vId, layer, derivedAttributes ); // Add the start and end points in as derived attributes - QgsPoint pnt = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPoint( curve->startPoint().x(), curve->startPoint().y() ) ); + QgsPointXY pnt = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPointXY( curve->startPoint().x(), curve->startPoint().y() ) ); str = formatXCoordinate( pnt ); derivedAttributes.insert( tr( "firstX", "attributes get sorted; translation for lastX should be lexically larger than this one" ), str ); str = formatYCoordinate( pnt ); derivedAttributes.insert( tr( "firstY" ), str ); - pnt = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPoint( curve->endPoint().x(), curve->endPoint().y() ) ); + pnt = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPointXY( curve->endPoint().x(), curve->endPoint().y() ) ); str = formatXCoordinate( pnt ); derivedAttributes.insert( tr( "lastX", "attributes get sorted; translation for firstX should be lexically smaller than this one" ), str ); str = formatYCoordinate( pnt ); @@ -428,7 +428,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur QgsWkbTypes::flatType( wkbType ) == QgsWkbTypes::Point ) { // Include the x and y coordinates of the point as a derived attribute - QgsPoint pnt = mCanvas->mapSettings().layerToMapCoordinates( layer, feature->geometry().asPoint() ); + QgsPointXY pnt = mCanvas->mapSettings().layerToMapCoordinates( layer, feature->geometry().asPoint() ); QString str = formatXCoordinate( pnt ); derivedAttributes.insert( QStringLiteral( "X" ), str ); str = formatYCoordinate( pnt ); @@ -436,12 +436,12 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur if ( QgsWkbTypes::hasZ( wkbType ) ) { - str = QLocale::system().toString( static_cast( feature->geometry().geometry() )->z(), 'g', 10 ); + str = QLocale::system().toString( static_cast( feature->geometry().geometry() )->z(), 'g', 10 ); derivedAttributes.insert( QStringLiteral( "Z" ), str ); } if ( QgsWkbTypes::hasM( wkbType ) ) { - str = QLocale::system().toString( static_cast( feature->geometry().geometry() )->m(), 'g', 10 ); + str = QLocale::system().toString( static_cast( feature->geometry().geometry() )->m(), 'g', 10 ); derivedAttributes.insert( QStringLiteral( "M" ), str ); } } @@ -449,7 +449,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur return derivedAttributes; } -bool QgsMapToolIdentify::identifyRasterLayer( QList *results, QgsRasterLayer *layer, QgsPoint point, const QgsRectangle &viewExtent, double mapUnitsPerPixel ) +bool QgsMapToolIdentify::identifyRasterLayer( QList *results, QgsRasterLayer *layer, QgsPointXY point, const QgsRectangle &viewExtent, double mapUnitsPerPixel ) { QgsDebugMsg( "point = " + point.toString() ); if ( !layer ) @@ -463,7 +463,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList *results, Qg if ( !( capabilities & QgsRasterDataProvider::Identify ) ) return false; - QgsPoint pointInCanvasCrs = point; + QgsPointXY pointInCanvasCrs = point; try { point = toLayerCoordinates( layer, point ); diff --git a/src/gui/qgsmaptoolidentify.h b/src/gui/qgsmaptoolidentify.h index e67390a8a6f..1de6d549f8f 100644 --- a/src/gui/qgsmaptoolidentify.h +++ b/src/gui/qgsmaptoolidentify.h @@ -146,10 +146,10 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool QgsIdentifyMenu *mIdentifyMenu = nullptr; //! Call the right method depending on layer type - bool identifyLayer( QList *results, QgsMapLayer *layer, const QgsPoint &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers ); + bool identifyLayer( QList *results, QgsMapLayer *layer, const QgsPointXY &point, const QgsRectangle &viewExtent, double mapUnitsPerPixel, QgsMapToolIdentify::LayerType layerType = AllLayers ); - bool identifyRasterLayer( QList *results, QgsRasterLayer *layer, QgsPoint point, const QgsRectangle &viewExtent, double mapUnitsPerPixel ); - bool identifyVectorLayer( QList *results, QgsVectorLayer *layer, const QgsPoint &point ); + bool identifyRasterLayer( QList *results, QgsRasterLayer *layer, QgsPointXY point, const QgsRectangle &viewExtent, double mapUnitsPerPixel ); + bool identifyVectorLayer( QList *results, QgsVectorLayer *layer, const QgsPointXY &point ); private: @@ -177,18 +177,18 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool */ QString formatArea( double area ) const; - QMap< QString, QString > featureDerivedAttributes( QgsFeature *feature, QgsMapLayer *layer, const QgsPoint &layerPoint = QgsPoint() ); + QMap< QString, QString > featureDerivedAttributes( QgsFeature *feature, QgsMapLayer *layer, const QgsPointXY &layerPoint = QgsPointXY() ); /** Adds details of the closest vertex to derived attributes */ void closestVertexAttributes( const QgsAbstractGeometry &geometry, QgsVertexId vId, QgsMapLayer *layer, QMap< QString, QString > &derivedAttributes ); - QString formatCoordinate( const QgsPoint &canvasPoint ) const; - QString formatXCoordinate( const QgsPoint &canvasPoint ) const; - QString formatYCoordinate( const QgsPoint &canvasPoint ) const; + QString formatCoordinate( const QgsPointXY &canvasPoint ) const; + QString formatXCoordinate( const QgsPointXY &canvasPoint ) const; + QString formatYCoordinate( const QgsPointXY &canvasPoint ) const; // Last point in canvas CRS - QgsPoint mLastPoint; + QgsPointXY mLastPoint; double mLastMapUnitsPerPixel; diff --git a/src/gui/qgsmaptoolidentifyfeature.cpp b/src/gui/qgsmaptoolidentifyfeature.cpp index e1ac7837501..d6a352e05d4 100644 --- a/src/gui/qgsmaptoolidentifyfeature.cpp +++ b/src/gui/qgsmaptoolidentifyfeature.cpp @@ -34,7 +34,7 @@ QgsMapToolIdentifyFeature::QgsMapToolIdentifyFeature( QgsMapCanvas *canvas, QgsV void QgsMapToolIdentifyFeature::canvasReleaseEvent( QgsMapMouseEvent *e ) { - QgsPoint point = mCanvas->getCoordinateTransform()->toMapCoordinates( e->x(), e->y() ); + QgsPointXY point = mCanvas->getCoordinateTransform()->toMapCoordinates( e->x(), e->y() ); QList results; if ( !identifyVectorLayer( &results, mLayer, point ) ) diff --git a/src/gui/qgsmaptoolpan.cpp b/src/gui/qgsmaptoolpan.cpp index bb7d4083b3f..dc7a24ea0b3 100644 --- a/src/gui/qgsmaptoolpan.cpp +++ b/src/gui/qgsmaptoolpan.cpp @@ -82,7 +82,7 @@ void QgsMapToolPan::canvasReleaseEvent( QgsMapMouseEvent *e ) else // add pan to mouse cursor { // transform the mouse pos to map coordinates - QgsPoint center = mCanvas->getCoordinateTransform()->toMapPoint( e->x(), e->y() ); + QgsPointXY center = mCanvas->getCoordinateTransform()->toMapPoint( e->x(), e->y() ); mCanvas->setCenter( center ); mCanvas->refresh(); } @@ -128,7 +128,7 @@ void QgsMapToolPan::pinchTriggered( QPinchGesture *gesture ) QPoint pos = gesture->centerPoint().toPoint(); pos = mCanvas->mapFromGlobal( pos ); // transform the mouse pos to map coordinates - QgsPoint center = mCanvas->getCoordinateTransform()->toMapPoint( pos.x(), pos.y() ); + QgsPointXY center = mCanvas->getCoordinateTransform()->toMapPoint( pos.x(), pos.y() ); QgsRectangle r = mCanvas->extent(); r.scale( 1 / gesture->totalScaleFactor(), ¢er ); mCanvas->setExtent( r ); diff --git a/src/gui/qgsmaptoolzoom.cpp b/src/gui/qgsmaptoolzoom.cpp index 72688dddadd..9996b84ab1d 100644 --- a/src/gui/qgsmaptoolzoom.cpp +++ b/src/gui/qgsmaptoolzoom.cpp @@ -119,7 +119,7 @@ void QgsMapToolZoom::canvasReleaseEvent( QgsMapMouseEvent *e ) double sf = qMax( sfx, sfy ); const QgsMapToPixel *m2p = mCanvas->getCoordinateTransform(); - QgsPoint c = m2p->toMapCoordinates( mZoomRect.center() ); + QgsPointXY c = m2p->toMapCoordinates( mZoomRect.center() ); mCanvas->zoomByFactor( zoomOut ? 1.0 / sf : sf, &c ); diff --git a/src/gui/qgsrasterlayersaveasdialog.cpp b/src/gui/qgsrasterlayersaveasdialog.cpp index d365cdca597..bf4c79dee57 100644 --- a/src/gui/qgsrasterlayersaveasdialog.cpp +++ b/src/gui/qgsrasterlayersaveasdialog.cpp @@ -349,9 +349,9 @@ void QgsRasterLayerSaveAsDialog::setResolution( double xRes, double yRes, const // close to margins are higher resolutions (even very, too high) // TODO: consider more precise resolution calculation - QgsPoint center = outputRectangle().center(); + QgsPointXY center = outputRectangle().center(); QgsCoordinateTransform ct( srcCrs, outputCrs() ); - QgsPoint srsCenter = ct.transform( center, QgsCoordinateTransform::ReverseTransform ); + QgsPointXY srsCenter = ct.transform( center, QgsCoordinateTransform::ReverseTransform ); QgsRectangle srcExtent( srsCenter.x() - xRes / 2, srsCenter.y() - yRes / 2, srsCenter.x() + xRes / 2, srsCenter.y() + yRes / 2 ); diff --git a/src/gui/qgsrubberband.cpp b/src/gui/qgsrubberband.cpp index a6ce147ffc5..f3c3c2ba306 100644 --- a/src/gui/qgsrubberband.cpp +++ b/src/gui/qgsrubberband.cpp @@ -103,7 +103,7 @@ void QgsRubberBand::reset( QgsWkbTypes::GeometryType geometryType ) update(); } -void QgsRubberBand::addPoint( const QgsPoint &p, bool doUpdate /* = true */, int geometryIndex ) +void QgsRubberBand::addPoint( const QgsPointXY &p, bool doUpdate /* = true */, int geometryIndex ) { if ( geometryIndex < 0 ) { @@ -117,7 +117,7 @@ void QgsRubberBand::addPoint( const QgsPoint &p, bool doUpdate /* = true */, int if ( geometryIndex == mPoints.size() ) { - mPoints.push_back( QList() << p ); + mPoints.push_back( QList() << p ); } if ( mPoints.at( geometryIndex ).size() == 2 && @@ -191,7 +191,7 @@ void QgsRubberBand::removeLastPoint( int geometryIndex, bool doUpdate/* = true*/ removePoint( -1, doUpdate, geometryIndex ); } -void QgsRubberBand::movePoint( const QgsPoint &p, int geometryIndex ) +void QgsRubberBand::movePoint( const QgsPointXY &p, int geometryIndex ) { if ( mPoints.size() < geometryIndex + 1 ) { @@ -209,7 +209,7 @@ void QgsRubberBand::movePoint( const QgsPoint &p, int geometryIndex ) update(); } -void QgsRubberBand::movePoint( int index, const QgsPoint &p, int geometryIndex ) +void QgsRubberBand::movePoint( int index, const QgsPointXY &p, int geometryIndex ) { if ( mPoints.size() < geometryIndex + 1 ) { @@ -257,7 +257,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geom, QgsVectorLayer *layer case QgsWkbTypes::Point: case QgsWkbTypes::Point25D: { - QgsPoint pt; + QgsPointXY pt; if ( layer ) { pt = ms.layerToMapCoordinates( layer, geom.asPoint() ); @@ -277,7 +277,7 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geom, QgsVectorLayer *layer QgsMultiPoint mpt = geom.asMultiPoint(); for ( int i = 0; i < mpt.size(); ++i, ++idx ) { - QgsPoint pt = mpt[i]; + QgsPointXY pt = mpt[i]; if ( layer ) { addPoint( ms.layerToMapCoordinates( layer, pt ), false, idx ); @@ -400,10 +400,10 @@ void QgsRubberBand::setToCanvasRectangle( QRect rect ) } const QgsMapToPixel *transform = mMapCanvas->getCoordinateTransform(); - QgsPoint ll = transform->toMapCoordinates( rect.left(), rect.bottom() ); - QgsPoint lr = transform->toMapCoordinates( rect.right(), rect.bottom() ); - QgsPoint ul = transform->toMapCoordinates( rect.left(), rect.top() ); - QgsPoint ur = transform->toMapCoordinates( rect.right(), rect.top() ); + QgsPointXY ll = transform->toMapCoordinates( rect.left(), rect.bottom() ); + QgsPointXY lr = transform->toMapCoordinates( rect.right(), rect.bottom() ); + QgsPointXY ul = transform->toMapCoordinates( rect.left(), rect.top() ); + QgsPointXY ur = transform->toMapCoordinates( rect.right(), rect.top() ); reset( QgsWkbTypes::PolygonGeometry ); addPoint( ll, false ); @@ -416,12 +416,12 @@ void QgsRubberBand::paint( QPainter *p ) { if ( !mPoints.isEmpty() ) { - Q_FOREACH ( const QList &line, mPoints ) + Q_FOREACH ( const QList &line, mPoints ) { QVector pts; - Q_FOREACH ( const QgsPoint &pt, line ) + Q_FOREACH ( const QgsPointXY &pt, line ) { - const QPointF cur = toCanvasCoordinates( QgsPoint( pt.x() + mTranslationOffsetX, pt.y() + mTranslationOffsetY ) ) - pos(); + const QPointF cur = toCanvasCoordinates( QgsPointXY( pt.x() + mTranslationOffsetX, pt.y() + mTranslationOffsetY ) ) - pos(); if ( pts.empty() || std::abs( pts.back().x() - cur.x() ) > 1 || std::abs( pts.back().y() - cur.y() ) > 1 ) pts.append( cur ); } @@ -536,11 +536,11 @@ void QgsRubberBand::updateRect() QgsRectangle r; // in canvas units for ( int i = 0; i < mPoints.size(); ++i ) { - QList::const_iterator it = mPoints.at( i ).constBegin(), - itE = mPoints.at( i ).constEnd(); + QList::const_iterator it = mPoints.at( i ).constBegin(), + itE = mPoints.at( i ).constEnd(); for ( ; it != itE; ++it ) { - QgsPoint p( it->x() + mTranslationOffsetX, it->y() + mTranslationOffsetY ); + QgsPointXY p( it->x() + mTranslationOffsetX, it->y() + mTranslationOffsetY ); p = m2p.transform( p ); QgsRectangle rect( p.x() - w, p.y() - w, p.x() + w, p.y() + w ); @@ -559,7 +559,7 @@ void QgsRubberBand::updateRect() // This is an hack to pass QgsMapCanvasItem::setRect what it // expects (encoding of position and size of the item) qreal res = m2p.mapUnitsPerPixel(); - QgsPoint topLeft = m2p.toMapPoint( r.xMinimum(), r.yMinimum() ); + QgsPointXY topLeft = m2p.toMapPoint( r.xMinimum(), r.yMinimum() ); QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + r.width()*res, topLeft.y() - r.height()*res ); setRect( rect ); @@ -596,10 +596,10 @@ int QgsRubberBand::partSize( int geometryIndex ) const int QgsRubberBand::numberOfVertices() const { int count = 0; - QList >::const_iterator it = mPoints.constBegin(); + QList >::const_iterator it = mPoints.constBegin(); for ( ; it != mPoints.constEnd(); ++it ) { - QList::const_iterator iter = it->constBegin(); + QList::const_iterator iter = it->constBegin(); for ( ; iter != it->constEnd(); ++iter ) { ++count; @@ -608,7 +608,7 @@ int QgsRubberBand::numberOfVertices() const return count; } -const QgsPoint *QgsRubberBand::getPoint( int i, int j ) const +const QgsPointXY *QgsRubberBand::getPoint( int i, int j ) const { if ( i < mPoints.size() && j < mPoints[i].size() ) return &mPoints[i][j]; @@ -625,7 +625,7 @@ QgsGeometry QgsRubberBand::asGeometry() const case QgsWkbTypes::PolygonGeometry: { QgsPolygon polygon; - QList< QList >::const_iterator it = mPoints.constBegin(); + QList< QList >::const_iterator it = mPoints.constBegin(); for ( ; it != mPoints.constEnd(); ++it ) { polygon.append( getPolyline( *it ) ); @@ -638,7 +638,7 @@ QgsGeometry QgsRubberBand::asGeometry() const { QgsMultiPoint multiPoint; - QList< QList >::const_iterator it = mPoints.constBegin(); + QList< QList >::const_iterator it = mPoints.constBegin(); for ( ; it != mPoints.constEnd(); ++it ) { multiPoint += getPolyline( *it ); @@ -655,7 +655,7 @@ QgsGeometry QgsRubberBand::asGeometry() const if ( mPoints.size() > 1 ) { QgsMultiPolyline multiPolyline; - QList< QList >::const_iterator it = mPoints.constBegin(); + QList< QList >::const_iterator it = mPoints.constBegin(); for ( ; it != mPoints.constEnd(); ++it ) { multiPolyline.append( getPolyline( *it ) ); @@ -673,10 +673,10 @@ QgsGeometry QgsRubberBand::asGeometry() const return geom; } -QgsPolyline QgsRubberBand::getPolyline( const QList &points ) +QgsPolyline QgsRubberBand::getPolyline( const QList &points ) { QgsPolyline polyline; - QList::const_iterator iter = points.constBegin(); + QList::const_iterator iter = points.constBegin(); for ( ; iter != points.constEnd(); ++iter ) { polyline.append( *iter ); diff --git a/src/gui/qgsrubberband.h b/src/gui/qgsrubberband.h index a800ca313d6..7a6cf2ec5c3 100644 --- a/src/gui/qgsrubberband.h +++ b/src/gui/qgsrubberband.h @@ -192,7 +192,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem * \param doUpdate Should the map canvas be updated immediately? * \param geometryIndex The index of the feature part (in case of multipart geometries) */ - void addPoint( const QgsPoint &p, bool doUpdate = true, int geometryIndex = 0 ); + void addPoint( const QgsPointXY &p, bool doUpdate = true, int geometryIndex = 0 ); /** Ensures that a polygon geometry is closed and that the last vertex equals the * first vertex. @@ -219,13 +219,13 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem * Moves the rubber band point specified by index. Note that if the rubber band is * not used to track the last mouse position, the first point of the rubber band has two vertices */ - void movePoint( const QgsPoint &p, int geometryIndex = 0 ); + void movePoint( const QgsPointXY &p, int geometryIndex = 0 ); /** * Moves the rubber band point specified by index. Note that if the rubber band is * not used to track the last mouse position, the first point of the rubber band has two vertices */ - void movePoint( int index, const QgsPoint &p, int geometryIndex = 0 ); + void movePoint( int index, const QgsPointXY &p, int geometryIndex = 0 ); /** * Returns number of vertices in feature part @@ -287,7 +287,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem * \param i The geometry index * \param j The vertex index within geometry i */ - const QgsPoint *getPoint( int i, int j = 0 ) const; + const QgsPointXY *getPoint( int i, int j = 0 ) const; /** * Returns the rubberband as a Geometry @@ -329,14 +329,14 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem /** * Nested lists used for multitypes */ - QList< QList > mPoints; + QList< QList > mPoints; QgsWkbTypes::GeometryType mGeometryType; double mTranslationOffsetX; double mTranslationOffsetY; QgsRubberBand(); - static QgsPolyline getPolyline( const QList &points ); + static QgsPolyline getPolyline( const QList &points ); }; diff --git a/src/gui/qgsvertexmarker.cpp b/src/gui/qgsvertexmarker.cpp index c4e2d7dbf9a..824d801705a 100644 --- a/src/gui/qgsvertexmarker.cpp +++ b/src/gui/qgsvertexmarker.cpp @@ -32,7 +32,7 @@ void QgsVertexMarker::setIconSize( int iconSize ) mIconSize = iconSize; } -void QgsVertexMarker::setCenter( const QgsPoint &point ) +void QgsVertexMarker::setCenter( const QgsPointXY &point ) { mCenter = point; QPointF pt = toCanvasCoordinates( mCenter ); diff --git a/src/gui/qgsvertexmarker.h b/src/gui/qgsvertexmarker.h index 487a29a61d0..b5b263a1d22 100644 --- a/src/gui/qgsvertexmarker.h +++ b/src/gui/qgsvertexmarker.h @@ -41,7 +41,7 @@ class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem QgsVertexMarker( QgsMapCanvas *mapCanvas SIP_TRANSFERTHIS ); - void setCenter( const QgsPoint &point ); + void setCenter( const QgsPointXY &point ); void setIconType( int iconType ); @@ -97,7 +97,7 @@ class GUI_EXPORT QgsVertexMarker : public QgsMapCanvasItem int mIconSize = 10; //! coordinates of the point in the center - QgsPoint mCenter; + QgsPointXY mCenter; //! color of the marker QColor mColor = QColor( 255, 0, 0 ); diff --git a/src/gui/raster/qgsrastertransparencywidget.cpp b/src/gui/raster/qgsrastertransparencywidget.cpp index 24fca41a520..7762e4f7542 100644 --- a/src/gui/raster/qgsrastertransparencywidget.cpp +++ b/src/gui/raster/qgsrastertransparencywidget.cpp @@ -405,7 +405,7 @@ void QgsRasterTransparencyWidget::apply() } } -void QgsRasterTransparencyWidget::pixelSelected( const QgsPoint &canvasPoint ) +void QgsRasterTransparencyWidget::pixelSelected( const QgsPointXY &canvasPoint ) { QgsRasterRenderer *renderer = mRasterLayer->renderer(); if ( !renderer ) @@ -419,7 +419,7 @@ void QgsRasterTransparencyWidget::pixelSelected( const QgsPoint &canvasPoint ) mMapCanvas->unsetMapTool( mPixelSelectorTool ); const QgsMapSettings &ms = mMapCanvas->mapSettings(); - QgsPoint myPoint = ms.mapToLayerCoordinates( mRasterLayer, canvasPoint ); + QgsPointXY myPoint = ms.mapToLayerCoordinates( mRasterLayer, canvasPoint ); QgsRectangle myExtent = ms.mapToLayerCoordinates( mRasterLayer, mMapCanvas->extent() ); double mapUnitsPerPixel = mMapCanvas->mapUnitsPerPixel(); diff --git a/src/gui/raster/qgsrastertransparencywidget.h b/src/gui/raster/qgsrastertransparencywidget.h index 52bd7d53a3a..362c757454c 100644 --- a/src/gui/raster/qgsrastertransparencywidget.h +++ b/src/gui/raster/qgsrastertransparencywidget.h @@ -26,7 +26,7 @@ class QgsRasterLayer; class QgsRasterRenderer; class QgsMapCanvas; class QgsMapToolEmitPoint; -class QgsPoint; +class QgsPointXY; /** \ingroup gui @@ -56,7 +56,7 @@ class GUI_EXPORT QgsRasterTransparencyWidget : public QgsMapLayerConfigWidget, p private slots: - void pixelSelected( const QgsPoint &canvasPoint ); + void pixelSelected( const QgsPointXY &canvasPoint ); //! Transparency cell changed void transparencyCellTextEdited( const QString &text ); diff --git a/src/plugins/coordinate_capture/coordinatecapture.cpp b/src/plugins/coordinate_capture/coordinatecapture.cpp index 0f5693fa32c..1186e6ea874 100644 --- a/src/plugins/coordinate_capture/coordinatecapture.cpp +++ b/src/plugins/coordinate_capture/coordinatecapture.cpp @@ -200,14 +200,14 @@ void CoordinateCapture::setSourceCrs() mCanvasDisplayPrecision = ( mQGisIface->mapCanvas()->mapSettings().destinationCrs().mapUnits() == QgsUnitTypes::DistanceDegrees ) ? 5 : 3; // for the map canvas coordinate display } -void CoordinateCapture::mouseClicked( const QgsPoint &point ) +void CoordinateCapture::mouseClicked( const QgsPointXY &point ) { //clicking on the canvas will update the widgets and then disable //tracking so the user can copy the click point coords mpTrackMouseButton->setChecked( false ); update( point ); } -void CoordinateCapture::mouseMoved( const QgsPoint &point ) +void CoordinateCapture::mouseMoved( const QgsPointXY &point ) { //mouse movements will only update the widgets if the //tracking button is checked @@ -216,10 +216,10 @@ void CoordinateCapture::mouseMoved( const QgsPoint &point ) update( point ); } } -void CoordinateCapture::update( const QgsPoint &point ) +void CoordinateCapture::update( const QgsPointXY &point ) { //this is the coordinate resolved back to lat / lon - QgsPoint myUserCrsPoint = mTransform.transform( point ); + QgsPointXY myUserCrsPoint = mTransform.transform( point ); mpUserCrsEdit->setText( QString::number( myUserCrsPoint.x(), 'f', mUserCrsDisplayPrecision ) + ',' + QString::number( myUserCrsPoint.y(), 'f', mUserCrsDisplayPrecision ) ); // This is the coordinate space of the map canvas diff --git a/src/plugins/coordinate_capture/coordinatecapture.h b/src/plugins/coordinate_capture/coordinatecapture.h index 0713ff7d124..cf06514efac 100644 --- a/src/plugins/coordinate_capture/coordinatecapture.h +++ b/src/plugins/coordinate_capture/coordinatecapture.h @@ -56,7 +56,7 @@ class QIcon; class QLabel; class QgisInterface; -class QgsPoint; +class QgsPointXY; /** * \class Plugin @@ -97,13 +97,13 @@ class CoordinateCapture: public QObject, public QgisPlugin //! Set the Coordinate Reference System used for displaying non canvas CRS coord void setCRS(); //! Called when mouse clicks on the canvas. Will populate text box with coords. - void mouseClicked( const QgsPoint &point ); + void mouseClicked( const QgsPointXY &point ); /** Called when mouse moved over the canvas. If the tracking button is toggled, * the text box coords will be updated. */ - void mouseMoved( const QgsPoint &point ); + void mouseMoved( const QgsPointXY &point ); //! Called when mouse is clicked on the canvas - void update( const QgsPoint &point ); + void update( const QgsPointXY &point ); //! Called when user clicks the copy button void copy(); //! called when the project's CRS is changed diff --git a/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp b/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp index 8bef1727f06..245d4a2e849 100644 --- a/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp +++ b/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp @@ -45,7 +45,7 @@ CoordinateCaptureMapTool::~CoordinateCaptureMapTool() void CoordinateCaptureMapTool::canvasMoveEvent( QgsMapMouseEvent *thepEvent ) { - QgsPoint myOriginalPoint = + QgsPointXY myOriginalPoint = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x(), thepEvent->y() ); emit mouseMoved( myOriginalPoint ); } @@ -57,19 +57,19 @@ void CoordinateCaptureMapTool::canvasPressEvent( QgsMapMouseEvent *thepEvent ) void CoordinateCaptureMapTool::canvasReleaseEvent( QgsMapMouseEvent *thepEvent ) { - QgsPoint myOriginalPoint = + QgsPointXY myOriginalPoint = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x(), thepEvent->y() ); emit mouseClicked( myOriginalPoint ); //make a little box for display - QgsPoint myPoint1 = + QgsPointXY myPoint1 = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() - 1, thepEvent->y() - 1 ); - QgsPoint myPoint2 = + QgsPointXY myPoint2 = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() + 1, thepEvent->y() - 1 ); - QgsPoint myPoint3 = + QgsPointXY myPoint3 = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() + 1, thepEvent->y() + 1 ); - QgsPoint myPoint4 = + QgsPointXY myPoint4 = mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() - 1, thepEvent->y() + 1 ); mpRubberBand->reset( QgsWkbTypes::PolygonGeometry ); diff --git a/src/plugins/coordinate_capture/coordinatecapturemaptool.h b/src/plugins/coordinate_capture/coordinatecapturemaptool.h index 6904bf8b028..3da28248540 100644 --- a/src/plugins/coordinate_capture/coordinatecapturemaptool.h +++ b/src/plugins/coordinate_capture/coordinatecapturemaptool.h @@ -51,8 +51,8 @@ class CoordinateCaptureMapTool : public QgsMapTool public slots: signals: - void mouseMoved( const QgsPoint & ); - void mouseClicked( const QgsPoint & ); + void mouseMoved( const QgsPointXY & ); + void mouseClicked( const QgsPointXY & ); private: //! Rubber band for highlighting identified feature diff --git a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp b/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp index 68fdc38fd63..771722dcae4 100644 --- a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp +++ b/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp @@ -533,7 +533,7 @@ void eVisGenericEventBrowserGui::displayImage() if ( !myFeature ) return; - QgsPoint myPoint = myFeature->geometry().asPoint(); + QgsPointXY myPoint = myFeature->geometry().asPoint(); myPoint = mCanvas->mapSettings().layerToMapCoordinates( mVectorLayer, myPoint ); //keep the extent the same just center the map canvas in the display so our feature is in the middle QgsRectangle myRect( myPoint.x() - ( mCanvas->extent().width() / 2 ), myPoint.y() - ( mCanvas->extent().height() / 2 ), myPoint.x() + ( mCanvas->extent().width() / 2 ), myPoint.y() + ( mCanvas->extent().height() / 2 ) ); @@ -1116,7 +1116,7 @@ void eVisGenericEventBrowserGui::renderSymbol( QPainter *painter ) if ( !myFeature ) return; - QgsPoint myPoint = myFeature->geometry().asPoint(); + QgsPointXY myPoint = myFeature->geometry().asPoint(); myPoint = mCanvas->mapSettings().layerToMapCoordinates( mVectorLayer, myPoint ); mCanvas->getCoordinateTransform()->transform( &myPoint ); diff --git a/src/plugins/evis/idtool/eviseventidtool.cpp b/src/plugins/evis/idtool/eviseventidtool.cpp index b96ddc9347a..56b518518c7 100644 --- a/src/plugins/evis/idtool/eviseventidtool.cpp +++ b/src/plugins/evis/idtool/eviseventidtool.cpp @@ -86,9 +86,9 @@ void eVisEventIdTool::canvasReleaseEvent( QgsMapMouseEvent *mouseEvent ) /** * Selection routine called by the mouse release event -* @param point = QgsPoint representing the x, y coordinates of the mouse release event +* @param point = QgsPointXY representing the x, y coordinates of the mouse release event */ -void eVisEventIdTool::select( const QgsPoint &point ) +void eVisEventIdTool::select( const QgsPointXY &point ) { if ( !mCanvas ) diff --git a/src/plugins/evis/idtool/eviseventidtool.h b/src/plugins/evis/idtool/eviseventidtool.h index af0eb6c188b..69dba547e6a 100644 --- a/src/plugins/evis/idtool/eviseventidtool.h +++ b/src/plugins/evis/idtool/eviseventidtool.h @@ -60,6 +60,6 @@ class eVisEventIdTool : public QgsMapTool eVisGenericEventBrowserGui *mBrowser = nullptr; //! \brief Selection routine called by the mouse release event - void select( const QgsPoint & ); + void select( const QgsPointXY & ); }; #endif diff --git a/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp index 7e8f6d49330..c7c08c54048 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp @@ -42,9 +42,9 @@ void QgsGeometryAngleCheck::collectErrors( QList &error } for ( int iVert = 0; iVert < nVerts; ++iVert ) { - const QgsPointV2 &p1 = geom->vertexAt( QgsVertexId( iPart, iRing, ( iVert - 1 + nVerts ) % nVerts ) ); - const QgsPointV2 &p2 = geom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); - const QgsPointV2 &p3 = geom->vertexAt( QgsVertexId( iPart, iRing, ( iVert + 1 ) % nVerts ) ); + const QgsPoint &p1 = geom->vertexAt( QgsVertexId( iPart, iRing, ( iVert - 1 + nVerts ) % nVerts ) ); + const QgsPoint &p2 = geom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); + const QgsPoint &p3 = geom->vertexAt( QgsVertexId( iPart, iRing, ( iVert + 1 ) % nVerts ) ); QgsVector v21, v23; try { @@ -94,9 +94,9 @@ void QgsGeometryAngleCheck::fixError( QgsGeometryCheckError *error, int method, error->setObsolete(); return; } - const QgsPointV2 &p1 = geometry->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex - 1 + n ) % n ) ); - const QgsPointV2 &p2 = geometry->vertexAt( vidx ); - const QgsPointV2 &p3 = geometry->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex + 1 ) % n ) ); + const QgsPoint &p1 = geometry->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex - 1 + n ) % n ) ); + const QgsPoint &p2 = geometry->vertexAt( vidx ); + const QgsPoint &p3 = geometry->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex + 1 ) % n ) ); QgsVector v21, v23; try { diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp index 64aafc2e713..caf43b5e362 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp @@ -58,7 +58,7 @@ double QgsGeometryCheckPrecision::reducedTolerance() QgsGeometryCheckError::QgsGeometryCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, QgsVertexId vidx, const QVariant &value, ValueType valueType ) : mCheck( check ) diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.h b/src/plugins/geometry_checker/checks/qgsgeometrycheck.h index f39ff038631..12d965a2c0c 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.h @@ -101,7 +101,7 @@ class QgsGeometryCheckError QgsGeometryCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, QgsVertexId vidx = QgsVertexId(), const QVariant &value = QVariant(), ValueType valueType = ValueOther ); @@ -114,7 +114,7 @@ class QgsGeometryCheckError virtual QgsAbstractGeometry *geometry(); virtual QgsRectangle affectedAreaBBox() { return geometry() ? geometry()->boundingBox() : QgsRectangle(); } virtual QString description() const { return mCheck->errorDescription(); } - const QgsPointV2 &location() const { return mErrorLocation; } + const QgsPoint &location() const { return mErrorLocation; } QVariant value() const { return mValue; } ValueType valueType() const { return mValueType; } QgsVertexId vidx() const { return mVidx; } @@ -155,7 +155,7 @@ class QgsGeometryCheckError protected: const QgsGeometryCheck *mCheck = nullptr; QgsFeatureId mFeatureId; - QgsPointV2 mErrorLocation; + QgsPoint mErrorLocation; QgsVertexId mVidx; QVariant mValue; ValueType mValueType; diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h index 126d96ef42a..209810104df 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h @@ -23,7 +23,7 @@ class QgsGeometryContainedCheckError : public QgsGeometryCheckError public: QgsGeometryContainedCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, QgsFeatureId otherId ) : QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), otherId, ValueOther ) diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h index 8b96969b633..c3fb0fd864a 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h @@ -23,7 +23,7 @@ class QgsGeometryDuplicateCheckError : public QgsGeometryCheckError public: QgsGeometryDuplicateCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, const QList &duplicates ) : QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), duplicatesString( duplicates ) ) , mDuplicates( duplicates ) diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp index d8035475156..69ae426ab0d 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp @@ -40,8 +40,8 @@ void QgsGeometryDuplicateNodesCheck::collectErrors( QListvertexAt( QgsVertexId( iPart, iRing, iVert ) ); - QgsPointV2 pj = geom->vertexAt( QgsVertexId( iPart, iRing, jVert ) ); + QgsPoint pi = geom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); + QgsPoint pj = geom->vertexAt( QgsVertexId( iPart, iRing, jVert ) ); if ( QgsGeometryUtils::sqrDistance2D( pi, pj ) < QgsGeometryCheckPrecision::tolerance() * QgsGeometryCheckPrecision::tolerance() ) { errors.append( new QgsGeometryCheckError( this, featureid, pj, QgsVertexId( iPart, iRing, jVert ) ) ); @@ -78,8 +78,8 @@ void QgsGeometryDuplicateNodesCheck::fixError( QgsGeometryCheckError *error, int error->setObsolete(); return; } - QgsPointV2 pi = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex + nVerts - 1 ) % nVerts ) ); - QgsPointV2 pj = geom->vertexAt( error->vidx() ); + QgsPoint pi = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex + nVerts - 1 ) % nVerts ) ); + QgsPoint pj = geom->vertexAt( error->vidx() ); if ( QgsGeometryUtils::sqrDistance2D( pi, pj ) >= QgsGeometryCheckPrecision::tolerance() * QgsGeometryCheckPrecision::tolerance() ) { error->setObsolete(); diff --git a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h index bcead1b8902..3a9b1212497 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h @@ -23,7 +23,7 @@ class QgsGeometryOverlapCheckError : public QgsGeometryCheckError public: QgsGeometryOverlapCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, const QVariant &value, QgsFeatureId otherId ) : QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), value, ValueArea ) diff --git a/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp index e203f92b934..0a1ac82fc1b 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp @@ -44,12 +44,12 @@ void QgsGeometrySegmentLengthCheck::collectErrors( QListvertexAt( QgsVertexId( iPart, iRing, iVert ) ); - QgsPointV2 pj = geom->vertexAt( QgsVertexId( iPart, iRing, jVert ) ); + QgsPoint pi = geom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); + QgsPoint pj = geom->vertexAt( QgsVertexId( iPart, iRing, jVert ) ); double dist = qSqrt( QgsGeometryUtils::sqrDistance2D( pi, pj ) ); if ( dist < mMinLength ) { - errors.append( new QgsGeometryCheckError( this, featureid, QgsPointV2( 0.5 * ( pi.x() + pj.x() ), 0.5 * ( pi.y() + pj.y() ) ), QgsVertexId( iPart, iRing, iVert ), dist, QgsGeometryCheckError::ValueLength ) ); + errors.append( new QgsGeometryCheckError( this, featureid, QgsPoint( 0.5 * ( pi.x() + pj.x() ), 0.5 * ( pi.y() + pj.y() ) ), QgsVertexId( iPart, iRing, iVert ), dist, QgsGeometryCheckError::ValueLength ) ); } } } @@ -85,8 +85,8 @@ void QgsGeometrySegmentLengthCheck::fixError( QgsGeometryCheckError *error, int return; } - QgsPointV2 pi = geom->vertexAt( error->vidx() ); - QgsPointV2 pj = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex - 1 + nVerts ) % nVerts ) ); + QgsPoint pi = geom->vertexAt( error->vidx() ); + QgsPoint pj = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( vidx.vertex - 1 + nVerts ) % nVerts ) ); double dist = qSqrt( QgsGeometryUtils::sqrDistance2D( pi, pj ) ); if ( dist >= mMinLength ) { diff --git a/src/plugins/geometry_checker/checks/qgsgeometryselfcontactcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryselfcontactcheck.cpp index 778493b9e66..1551f5284c5 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryselfcontactcheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometryselfcontactcheck.cpp @@ -33,12 +33,12 @@ void QgsGeometrySelfContactCheck::collectErrors( QList // Geometry ring without duplicate nodes QVector vtxMap; - QVector ring; + QVector ring; vtxMap.append( 0 ); ring.append( geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ) ); for ( int i = 1; i < n; ++i ) { - QgsPointV2 p = geom->vertexAt( QgsVertexId( iPart, iRing, i ) ); + QgsPoint p = geom->vertexAt( QgsVertexId( iPart, iRing, i ) ); if ( QgsGeometryUtils::sqrDistance2D( p, ring.last() ) > tolerance * tolerance ) { vtxMap.append( i ); @@ -60,16 +60,16 @@ void QgsGeometrySelfContactCheck::collectErrors( QList // For each vertex, check whether it lies on a segment for ( int iVert = 0, nVerts = n - isClosed; iVert < nVerts; ++iVert ) { - const QgsPointV2 &p = ring[iVert]; + const QgsPoint &p = ring[iVert]; for ( int i = 0, j = 1; j < n; i = j++ ) { if ( iVert == i || iVert == j || ( isClosed && iVert == 0 && j == n - 1 ) ) { continue; } - const QgsPointV2 &si = ring[i]; - const QgsPointV2 &sj = ring[j]; - QgsPointV2 q = QgsGeometryUtils::projPointOnSegment( p, si, sj ); + const QgsPoint &si = ring[i]; + const QgsPoint &sj = ring[j]; + QgsPoint q = QgsGeometryUtils::projPointOnSegment( p, si, sj ); if ( QgsGeometryUtils::sqrDistance2D( p, q ) < tolerance * tolerance ) { errors.append( new QgsGeometryCheckError( this, featureid, p, QgsVertexId( iPart, iRing, vtxMap[iVert] ) ) ); diff --git a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp index 57cfd37f8d3..0b57b95379d 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp @@ -115,11 +115,11 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError *error, i error->setObsolete(); return; } - QgsPointV2 p1 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, inter.segment1 ) ); - QgsPointV2 q1 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, inter.segment2 ) ); - QgsPointV2 p2 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( inter.segment1 + 1 ) % nVerts ) ); - QgsPointV2 q2 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( inter.segment2 + 1 ) % nVerts ) ); - QgsPointV2 s; + QgsPoint p1 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, inter.segment1 ) ); + QgsPoint q1 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, inter.segment2 ) ); + QgsPoint p2 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( inter.segment1 + 1 ) % nVerts ) ); + QgsPoint q2 = geom->vertexAt( QgsVertexId( vidx.part, vidx.ring, ( inter.segment2 + 1 ) % nVerts ) ); + QgsPoint s; if ( !QgsGeometryUtils::segmentIntersection( p1, p2, q1, q2, s, QgsGeometryCheckPrecision::tolerance() ) ) { error->setObsolete(); diff --git a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h index 935a2857308..35e273e9997 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h @@ -24,7 +24,7 @@ class QgsGeometrySelfIntersectionCheckError : public QgsGeometryCheckError public: QgsGeometrySelfIntersectionCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, QgsVertexId vidx, const QgsGeometryUtils::SelfIntersection &inter ) : QgsGeometryCheckError( check, featureId, errorLocation, vidx ) diff --git a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h index c4d3492582a..9308e7c3d46 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h @@ -23,7 +23,7 @@ class QgsGeometryTypeCheckError : public QgsGeometryCheckError public: QgsGeometryTypeCheckError( const QgsGeometryCheck *check, QgsFeatureId featureId, - const QgsPointV2 &errorLocation, + const QgsPoint &errorLocation, QgsWkbTypes::Type flatType ) : QgsGeometryCheckError( check, featureId, errorLocation ) { diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp b/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp index 8244924b185..3d0e5a99191 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp @@ -315,7 +315,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current ) mCurrentRubberBands.clear(); QList items; - QVector errorPositions; + QVector errorPositions; QgsRectangle totextent; if ( current ) @@ -350,7 +350,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current ) if ( ui.radioButtonError->isChecked() || current || error->status() == QgsGeometryCheckError::StatusFixed ) { QgsRubberBand *pointRubberBand = new QgsRubberBand( mIface->mapCanvas(), QgsWkbTypes::PointGeometry ); - QgsPoint pos = mIface->mapCanvas()->mapSettings().layerToMapCoordinates( mFeaturePool->getLayer(), QgsPoint( error->location().x(), error->location().y() ) ); + QgsPointXY pos = mIface->mapCanvas()->mapSettings().layerToMapCoordinates( mFeaturePool->getLayer(), QgsPointXY( error->location().x(), error->location().y() ) ); pointRubberBand->addPoint( pos ); pointRubberBand->setWidth( 20 ); pointRubberBand->setColor( Qt::red ); @@ -377,13 +377,13 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current ) { double cx = 0., cy = 0.; QgsRectangle pointExtent( errorPositions.first(), errorPositions.first() ); - Q_FOREACH ( const QgsPoint &p, errorPositions ) + Q_FOREACH ( const QgsPointXY &p, errorPositions ) { cx += p.x(); cy += p.y(); pointExtent.include( p ); } - QgsPoint center = QgsPoint( cx / errorPositions.size(), cy / errorPositions.size() ); + QgsPointXY center = QgsPointXY( cx / errorPositions.size(), cy / errorPositions.size() ); if ( totextent.isEmpty() ) { QgsRectangle extent = mIface->mapCanvas()->extent(); diff --git a/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.cpp b/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.cpp index bca52e59655..191ebbb908c 100644 --- a/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.cpp +++ b/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.cpp @@ -52,7 +52,7 @@ namespace QgsGeometryCheckerUtils } } - static inline double pointLineDist( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &q ) + static inline double pointLineDist( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q ) { double nom = qAbs( ( p2.y() - p1.y() ) * q.x() - ( p2.x() - p1.x() ) * q.y() + p2.x() * p1.y() - p2.y() * p1.x() ); double dx = p2.x() - p1.x(); @@ -71,8 +71,8 @@ namespace QgsGeometryCheckerUtils { for ( int iVert1 = 0, jVert1 = 1, nVerts1 = geom1->vertexCount( iPart1, iRing1 ); jVert1 < nVerts1; iVert1 = jVert1++ ) { - QgsPointV2 p1 = geom1->vertexAt( QgsVertexId( iPart1, iRing1, iVert1 ) ); - QgsPointV2 p2 = geom1->vertexAt( QgsVertexId( iPart1, iRing1, jVert1 ) ); + QgsPoint p1 = geom1->vertexAt( QgsVertexId( iPart1, iRing1, iVert1 ) ); + QgsPoint p2 = geom1->vertexAt( QgsVertexId( iPart1, iRing1, jVert1 ) ); double lambdap1 = 0.; double lambdap2 = qSqrt( QgsGeometryUtils::sqrDistance2D( p1, p2 ) ); QgsVector d; @@ -92,8 +92,8 @@ namespace QgsGeometryCheckerUtils { for ( int iVert2 = 0, jVert2 = 1, nVerts2 = geom2->vertexCount( iPart2, iRing2 ); jVert2 < nVerts2; iVert2 = jVert2++ ) { - QgsPointV2 q1 = geom2->vertexAt( QgsVertexId( iPart2, iRing2, iVert2 ) ); - QgsPointV2 q2 = geom2->vertexAt( QgsVertexId( iPart2, iRing2, jVert2 ) ); + QgsPoint q1 = geom2->vertexAt( QgsVertexId( iPart2, iRing2, iVert2 ) ); + QgsPoint q2 = geom2->vertexAt( QgsVertexId( iPart2, iRing2, jVert2 ) ); // Check whether q1 and q2 are on the line p1, p if ( pointLineDist( p1, p2, q1 ) <= tol && pointLineDist( p1, p2, q2 ) <= tol ) diff --git a/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.h b/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.h index fdcf9701f49..a313763261d 100644 --- a/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.h +++ b/src/plugins/geometry_checker/utils/qgsgeometrycheckerutils.h @@ -42,8 +42,8 @@ namespace QgsGeometryCheckerUtils if ( !geom->isEmpty() ) { int nVerts = geom->vertexCount( iPart, iRing ); - QgsPointV2 front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); - QgsPointV2 back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) ); + QgsPoint front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); + QgsPoint back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) ); bool closed = back == front; if ( isClosed ) *isClosed = closed; @@ -66,7 +66,7 @@ namespace QgsGeometryCheckerUtils * \param tol The tolerance * \returns Whether the points are equal */ - inline bool pointsFuzzyEqual( const QgsPointV2 &p1, const QgsPointV2 &p2, double tol ) + inline bool pointsFuzzyEqual( const QgsPoint &p1, const QgsPoint &p2, double tol ) { double dx = p1.x() - p2.x(), dy = p1.y() - p2.y(); return ( dx * dx + dy * dy ) < tol * tol; @@ -75,8 +75,8 @@ namespace QgsGeometryCheckerUtils inline bool canDeleteVertex( const QgsAbstractGeometry *geom, int iPart, int iRing ) { int nVerts = geom->vertexCount( iPart, iRing ); - QgsPointV2 front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); - QgsPointV2 back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) ); + QgsPoint front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); + QgsPoint back = geom->vertexAt( QgsVertexId( iPart, iRing, nVerts - 1 ) ); bool closed = back == front; return closed ? nVerts > 4 : nVerts > 2; } diff --git a/src/plugins/georeferencer/qgsgcpcanvasitem.cpp b/src/plugins/georeferencer/qgsgcpcanvasitem.cpp index 23049952569..6df8a591f2b 100644 --- a/src/plugins/georeferencer/qgsgcpcanvasitem.cpp +++ b/src/plugins/georeferencer/qgsgcpcanvasitem.cpp @@ -44,7 +44,7 @@ void QgsGCPCanvasItem::paint( QPainter *p ) p->setRenderHint( QPainter::Antialiasing ); bool enabled = true; - QgsPoint worldCoords; + QgsPointXY worldCoords; int id = -1; if ( mDataPoint ) diff --git a/src/plugins/georeferencer/qgsgcplist.cpp b/src/plugins/georeferencer/qgsgcplist.cpp index 55dc2de878c..8ea0aa19fa9 100644 --- a/src/plugins/georeferencer/qgsgcplist.cpp +++ b/src/plugins/georeferencer/qgsgcplist.cpp @@ -35,10 +35,10 @@ QgsGCPList::QgsGCPList( const QgsGCPList &list ) } } -void QgsGCPList::createGCPVectors( QVector &mapCoords, QVector &pixelCoords ) +void QgsGCPList::createGCPVectors( QVector &mapCoords, QVector &pixelCoords ) { - mapCoords = QVector( size() ); - pixelCoords = QVector( size() ); + mapCoords = QVector( size() ); + pixelCoords = QVector( size() ); for ( int i = 0, j = 0; i < sizeAll(); i++ ) { QgsGeorefDataPoint *pt = at( i ); diff --git a/src/plugins/georeferencer/qgsgcplist.h b/src/plugins/georeferencer/qgsgcplist.h index 8ab9ef5cd49..0ce73d8c280 100644 --- a/src/plugins/georeferencer/qgsgcplist.h +++ b/src/plugins/georeferencer/qgsgcplist.h @@ -20,7 +20,7 @@ #include class QgsGeorefDataPoint; -class QgsPoint; +class QgsPointXY; // what is better use inherid or agrigate QList? class QgsGCPList : public QList @@ -29,7 +29,7 @@ class QgsGCPList : public QList QgsGCPList(); QgsGCPList( const QgsGCPList &list ); - void createGCPVectors( QVector &mapCoords, QVector &pixelCoords ); + void createGCPVectors( QVector &mapCoords, QVector &pixelCoords ); int size() const; int sizeAll() const; diff --git a/src/plugins/georeferencer/qgsgcplistmodel.cpp b/src/plugins/georeferencer/qgsgcplistmodel.cpp index 9645a55ec1a..498588cc940 100644 --- a/src/plugins/georeferencer/qgsgcplistmodel.cpp +++ b/src/plugins/georeferencer/qgsgcplistmodel.cpp @@ -79,7 +79,7 @@ void QgsGCPListModel::updateModel() bool bTransformUpdated = false; - QVector mapCoords, pixelCoords; + QVector mapCoords, pixelCoords; mGCPList->createGCPVectors( mapCoords, pixelCoords ); // // Setup table header @@ -148,8 +148,8 @@ void QgsGCPListModel::updateModel() // Calculate residual if transform is available and up-to-date if ( mGeorefTransform && bTransformUpdated && mGeorefTransform->parametersInitialized() ) { - QgsPoint dst; - QgsPoint pixel = mGeorefTransform->hasCrs() ? mGeorefTransform->toColumnLine( p->pixelCoords() ) : p->pixelCoords(); + QgsPointXY dst; + QgsPointXY pixel = mGeorefTransform->hasCrs() ? mGeorefTransform->toColumnLine( p->pixelCoords() ) : p->pixelCoords(); if ( unitType == tr( "pixels" ) ) { // Transform from world to raster coordinate: diff --git a/src/plugins/georeferencer/qgsgcplistwidget.cpp b/src/plugins/georeferencer/qgsgcplistwidget.cpp index e7eeb1291d7..90b3e265900 100644 --- a/src/plugins/georeferencer/qgsgcplistwidget.cpp +++ b/src/plugins/georeferencer/qgsgcplistwidget.cpp @@ -145,8 +145,8 @@ void QgsGCPListWidget::updateItemCoords( QWidget *editor ) if ( lineEdit ) { double value = lineEdit->text().toDouble(); - QgsPoint newMapCoords( dataPoint->mapCoords() ); - QgsPoint newPixelCoords( dataPoint->pixelCoords() ); + QgsPointXY newMapCoords( dataPoint->mapCoords() ); + QgsPointXY newPixelCoords( dataPoint->pixelCoords() ); if ( mPrevColumn == 2 ) // srcX { newPixelCoords.setX( value ); diff --git a/src/plugins/georeferencer/qgsgcplistwidget.h b/src/plugins/georeferencer/qgsgcplistwidget.h index 4df7a863279..69ef3145d90 100644 --- a/src/plugins/georeferencer/qgsgcplistwidget.h +++ b/src/plugins/georeferencer/qgsgcplistwidget.h @@ -26,7 +26,7 @@ class QgsGCPList; class QgsGCPListModel; class QgsGeorefTransform; class QgsGeorefDataPoint; -class QgsPoint; +class QgsPointXY; class QgsGCPListWidget : public QTableView { diff --git a/src/plugins/georeferencer/qgsgeorefdatapoint.cpp b/src/plugins/georeferencer/qgsgeorefdatapoint.cpp index 4e59caf5eb2..84f89adcced 100644 --- a/src/plugins/georeferencer/qgsgeorefdatapoint.cpp +++ b/src/plugins/georeferencer/qgsgeorefdatapoint.cpp @@ -20,7 +20,7 @@ #include "qgsgeorefdatapoint.h" QgsGeorefDataPoint::QgsGeorefDataPoint( QgsMapCanvas *srcCanvas, QgsMapCanvas *dstCanvas, - const QgsPoint &pixelCoords, const QgsPoint &mapCoords, + const QgsPointXY &pixelCoords, const QgsPointXY &mapCoords, bool enable ) : mSrcCanvas( srcCanvas ) , mDstCanvas( dstCanvas ) @@ -62,14 +62,14 @@ QgsGeorefDataPoint::~QgsGeorefDataPoint() delete mGCPDestinationItem; } -void QgsGeorefDataPoint::setPixelCoords( const QgsPoint &p ) +void QgsGeorefDataPoint::setPixelCoords( const QgsPointXY &p ) { mPixelCoords = p; mGCPSourceItem->update(); mGCPDestinationItem->update(); } -void QgsGeorefDataPoint::setMapCoords( const QgsPoint &p ) +void QgsGeorefDataPoint::setMapCoords( const QgsPointXY &p ) { mMapCoords = p; if ( mGCPSourceItem ) @@ -145,12 +145,12 @@ void QgsGeorefDataPoint::moveTo( QPoint p, bool isMapPlugin ) { if ( isMapPlugin ) { - QgsPoint pnt = mGCPSourceItem->toMapCoordinates( p ); + QgsPointXY pnt = mGCPSourceItem->toMapCoordinates( p ); mPixelCoords = pnt; } else { - QgsPoint pnt = mGCPDestinationItem->toMapCoordinates( p ); + QgsPointXY pnt = mGCPDestinationItem->toMapCoordinates( p ); mMapCoords = pnt; } mGCPSourceItem->update(); diff --git a/src/plugins/georeferencer/qgsgeorefdatapoint.h b/src/plugins/georeferencer/qgsgeorefdatapoint.h index 4053b116910..bb087578756 100644 --- a/src/plugins/georeferencer/qgsgeorefdatapoint.h +++ b/src/plugins/georeferencer/qgsgeorefdatapoint.h @@ -27,17 +27,17 @@ class QgsGeorefDataPoint : public QObject public: //! constructor QgsGeorefDataPoint( QgsMapCanvas *srcCanvas, QgsMapCanvas *dstCanvas, - const QgsPoint &pixelCoords, const QgsPoint &mapCoords, + const QgsPointXY &pixelCoords, const QgsPointXY &mapCoords, bool enable ); QgsGeorefDataPoint( const QgsGeorefDataPoint &p ); ~QgsGeorefDataPoint(); //! returns coordinates of the point - QgsPoint pixelCoords() const { return mPixelCoords; } - void setPixelCoords( const QgsPoint &p ); + QgsPointXY pixelCoords() const { return mPixelCoords; } + void setPixelCoords( const QgsPointXY &p ); - QgsPoint mapCoords() const { return mMapCoords; } - void setMapCoords( const QgsPoint &p ); + QgsPointXY mapCoords() const { return mMapCoords; } + void setMapCoords( const QgsPointXY &p ); bool isEnabled() const { return mEnabled; } void setEnabled( bool enabled ); @@ -62,8 +62,8 @@ class QgsGeorefDataPoint : public QObject QgsMapCanvas *mDstCanvas = nullptr; QgsGCPCanvasItem *mGCPSourceItem = nullptr; QgsGCPCanvasItem *mGCPDestinationItem = nullptr; - QgsPoint mPixelCoords; - QgsPoint mMapCoords; + QgsPointXY mPixelCoords; + QgsPointXY mMapCoords; int mId; bool mEnabled; diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.cpp b/src/plugins/georeferencer/qgsgeorefplugingui.cpp index 915e4d6e8d5..7dbdcfc415c 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugingui.cpp @@ -491,7 +491,7 @@ void QgsGeorefPluginGui::linkGeorefToQGis( bool link ) } // GCPs slots -void QgsGeorefPluginGui::addPoint( const QgsPoint &pixelCoords, const QgsPoint &mapCoords, +void QgsGeorefPluginGui::addPoint( const QgsPointXY &pixelCoords, const QgsPointXY &mapCoords, bool enable, bool finalize ) { QgsGeorefDataPoint *pnt = new QgsGeorefDataPoint( mCanvas, mIface->mapCanvas(), @@ -582,13 +582,13 @@ void QgsGeorefPluginGui::releasePoint( QPoint p ) } } -void QgsGeorefPluginGui::showCoordDialog( const QgsPoint &pixelCoords ) +void QgsGeorefPluginGui::showCoordDialog( const QgsPointXY &pixelCoords ) { if ( mLayer && !mMapCoordsDialog ) { mMapCoordsDialog = new QgsMapCoordsDialog( mIface->mapCanvas(), pixelCoords, this ); connect( mMapCoordsDialog, &QgsMapCoordsDialog::pointAdded, - [this]( const QgsPoint & a, const QgsPoint & b ) { this->addPoint( a, b ); } + [this]( const QgsPointXY & a, const QgsPointXY & b ) { this->addPoint( a, b ); } ); mMapCoordsDialog->show(); } @@ -708,10 +708,10 @@ void QgsGeorefPluginGui::jumpToGCP( uint theGCPIndex ) // qgsmapcanvas doesn't seem to have a method for recentering the map QgsRectangle ext = mCanvas->extent(); - QgsPoint center = ext.center(); - QgsPoint new_center = mPoints[theGCPIndex]->pixelCoords(); + QgsPointXY center = ext.center(); + QgsPointXY new_center = mPoints[theGCPIndex]->pixelCoords(); - QgsPoint diff( new_center.x() - center.x(), new_center.y() - center.y() ); + QgsPointXY diff( new_center.x() - center.x(), new_center.y() - center.y() ); QgsRectangle new_extent( ext.xMinimum() + diff.x(), ext.yMinimum() + diff.y(), ext.xMaximum() + diff.x(), ext.yMaximum() + diff.y() ); mCanvas->setExtent( new_extent ); @@ -778,7 +778,7 @@ void QgsGeorefPluginGui::extentsChangedQGisCanvas() } // Canvas info slots (copy/pasted from QGIS :) ) -void QgsGeorefPluginGui::showMouseCoords( const QgsPoint &p ) +void QgsGeorefPluginGui::showMouseCoords( const QgsPointXY &p ) { mCoordsLabel->setText( p.toString( mMousePrecisionDecimalPlaces ) ); // Set minimum necessary width @@ -1254,8 +1254,8 @@ bool QgsGeorefPluginGui::loadGCPs( /*bool verbose*/ ) return false; } - QgsPoint mapCoords( ls.at( 0 ).toDouble(), ls.at( 1 ).toDouble() ); // map x,y - QgsPoint pixelCoords( ls.at( 2 ).toDouble(), ls.at( 3 ).toDouble() ); // pixel x,y + QgsPointXY mapCoords( ls.at( 0 ).toDouble(), ls.at( 1 ).toDouble() ); // map x,y + QgsPointXY pixelCoords( ls.at( 2 ).toDouble(), ls.at( 3 ).toDouble() ); // pixel x,y if ( ls.count() == 5 ) { bool enable = ls.at( 4 ).toInt(); @@ -1345,7 +1345,7 @@ bool QgsGeorefPluginGui::georeference() if ( mModifiedRasterFileName.isEmpty() && ( QgsGeorefTransform::Linear == mGeorefTransform.transformParametrisation() || QgsGeorefTransform::Helmert == mGeorefTransform.transformParametrisation() ) ) { - QgsPoint origin; + QgsPointXY origin; double pixelXSize, pixelYSize, rotation; if ( !mGeorefTransform.getOriginScaleRotation( origin, pixelXSize, pixelYSize, rotation ) ) { @@ -1421,7 +1421,7 @@ bool QgsGeorefPluginGui::georeference() } } -bool QgsGeorefPluginGui::writeWorldFile( const QgsPoint &origin, double pixelXSize, double pixelYSize, double rotation ) +bool QgsGeorefPluginGui::writeWorldFile( const QgsPointXY &origin, double pixelXSize, double pixelYSize, double rotation ) { // write the world file QFile file( mWorldFileName ); @@ -1647,7 +1647,7 @@ bool QgsGeorefPluginGui::writePDFReportFile( const QString &fileName, const QgsG QgsComposerTextTableV2 *parameterTable = nullptr; double scaleX, scaleY, rotation; - QgsPoint origin; + QgsPointXY origin; QgsComposerLabel *parameterLabel = nullptr; //transformation that involves only scaling and rotation (linear or helmert) ? @@ -1799,7 +1799,7 @@ void QgsGeorefPluginGui::updateTransformParamLabel() QString transformName = convertTransformEnumToString( mGeorefTransform.transformParametrisation() ); QString labelString = tr( "Transform: " ) + transformName; - QgsPoint origin; + QgsPointXY origin; double scaleX, scaleY, rotation; if ( mGeorefTransform.getOriginScaleRotation( origin, scaleX, scaleY, rotation ) ) { @@ -1962,7 +1962,7 @@ bool QgsGeorefPluginGui::checkReadyGeoref() bool QgsGeorefPluginGui::updateGeorefTransform() { - QVector mapCoords, pixelCoords; + QVector mapCoords, pixelCoords; if ( mGCPListWidget->gcpList() ) mGCPListWidget->gcpList()->createGCPVectors( mapCoords, pixelCoords ); else @@ -2000,20 +2000,20 @@ QgsRectangle QgsGeorefPluginGui::transformViewportBoundingBox( const QgsRectangl { for ( uint edge = 0; edge < 4; edge++ ) { - QgsPoint src, raster; + QgsPointXY src, raster; switch ( edge ) { case 0: - src = QgsPoint( oX + ( double )s * stepX, oY ); + src = QgsPointXY( oX + ( double )s * stepX, oY ); break; case 1: - src = QgsPoint( oX + ( double )s * stepX, dY ); + src = QgsPointXY( oX + ( double )s * stepX, dY ); break; case 2: - src = QgsPoint( oX, oY + ( double )s * stepY ); + src = QgsPointXY( oX, oY + ( double )s * stepY ); break; case 3: - src = QgsPoint( dX, oY + ( double )s * stepY ); + src = QgsPointXY( dX, oY + ( double )s * stepY ); break; } t.transform( src, raster, rasterToWorld ); diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.h b/src/plugins/georeferencer/qgsgeorefplugingui.h index 7994a78675c..1f63a2c46f3 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.h +++ b/src/plugins/georeferencer/qgsgeorefplugingui.h @@ -35,7 +35,7 @@ class QgsGCPListWidget; class QgsMapTool; class QgsMapCanvas; class QgsMapCoordsDialog; -class QgsPoint; +class QgsPointXY; class QgsRasterLayer; class QgsRectangle; class QgsMessageBar; @@ -86,11 +86,11 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas void linkQGisToGeoref( bool link ); // gcps - void addPoint( const QgsPoint &pixelCoords, const QgsPoint &mapCoords, + void addPoint( const QgsPointXY &pixelCoords, const QgsPointXY &mapCoords, bool enable = true, bool finalize = true ); void deleteDataPoint( QPoint pixelCoords ); void deleteDataPoint( int index ); - void showCoordDialog( const QgsPoint &pixelCoords ); + void showCoordDialog( const QgsPointXY &pixelCoords ); void selectPoint( QPoint ); void movePoint( QPoint ); @@ -112,7 +112,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas void extentsChangedQGisCanvas(); // canvas info - void showMouseCoords( const QgsPoint &pt ); + void showMouseCoords( const QgsPointXY &pt ); void updateMouseCoordinatePrecision(); // Histogram stretch @@ -162,7 +162,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas // georeference bool georeference(); - bool writeWorldFile( const QgsPoint &origin, double pixelXSize, double pixelYSize, double rotation ); + bool writeWorldFile( const QgsPointXY &origin, double pixelXSize, double pixelYSize, double rotation ); bool writePDFReportFile( const QString &fileName, const QgsGeorefTransform &transform ); bool writePDFMapFile( const QString &fileName, const QgsGeorefTransform &transform ); void updateTransformParamLabel(); diff --git a/src/plugins/georeferencer/qgsgeoreftooladdpoint.h b/src/plugins/georeferencer/qgsgeoreftooladdpoint.h index 1d12783d8bd..cf446e0edbe 100644 --- a/src/plugins/georeferencer/qgsgeoreftooladdpoint.h +++ b/src/plugins/georeferencer/qgsgeoreftooladdpoint.h @@ -20,7 +20,7 @@ #include "qgsmaptoolemitpoint.h" -class QgsPoint; +class QgsPointXY; class QgsMapCanvas; class QgsGeorefToolAddPoint : public QgsMapToolEmitPoint @@ -34,7 +34,7 @@ class QgsGeorefToolAddPoint : public QgsMapToolEmitPoint void canvasPressEvent( QgsMapMouseEvent *e ) override; signals: - void showCoordDialog( const QgsPoint & ); + void showCoordDialog( const QgsPointXY & ); }; #endif // QGSGEOREFTOOLADDPOINT_H diff --git a/src/plugins/georeferencer/qgsgeoreftooldeletepoint.h b/src/plugins/georeferencer/qgsgeoreftooldeletepoint.h index 75650c90d12..4a6a88caf22 100644 --- a/src/plugins/georeferencer/qgsgeoreftooldeletepoint.h +++ b/src/plugins/georeferencer/qgsgeoreftooldeletepoint.h @@ -20,7 +20,7 @@ #include "qgsmaptoolemitpoint.h" -class QgsPoint; +class QgsPointXY; class QgsMapCanvas; class QgsGeorefToolDeletePoint : public QgsMapToolEmitPoint diff --git a/src/plugins/georeferencer/qgsgeoreftransform.cpp b/src/plugins/georeferencer/qgsgeoreftransform.cpp index d579f47c7e2..1ee4a9ebf64 100644 --- a/src/plugins/georeferencer/qgsgeoreftransform.cpp +++ b/src/plugins/georeferencer/qgsgeoreftransform.cpp @@ -34,9 +34,9 @@ class QgsLinearGeorefTransform : public QgsGeorefTransformInterface public: QgsLinearGeorefTransform() : mParameters() {} - bool getOriginScale( QgsPoint &origin, double &scaleX, double &scaleY ) const; + bool getOriginScale( QgsPointXY &origin, double &scaleX, double &scaleY ) const; - bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; + bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; int getMinimumGCPCount() const override; GDALTransformerFunc GDALTransformer() const override { return QgsLinearGeorefTransform::linear_transform; } @@ -44,7 +44,7 @@ class QgsLinearGeorefTransform : public QgsGeorefTransformInterface private: struct LinearParameters { - QgsPoint origin; + QgsPointXY origin; double scaleX, scaleY; } mParameters; @@ -61,13 +61,13 @@ class QgsHelmertGeorefTransform : public QgsGeorefTransformInterface QgsHelmertGeorefTransform() : mHelmertParameters() {} struct HelmertParameters { - QgsPoint origin; + QgsPointXY origin; double scale; double angle; }; - bool getOriginScaleRotation( QgsPoint &origin, double &scale, double &rotation ) const; - bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; + bool getOriginScaleRotation( QgsPointXY &origin, double &scale, double &rotation ) const; + bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; int getMinimumGCPCount() const override; GDALTransformerFunc GDALTransformer() const override; @@ -88,7 +88,7 @@ class QgsGDALGeorefTransform : public QgsGeorefTransformInterface QgsGDALGeorefTransform( bool useTPS, unsigned int polynomialOrder ); ~QgsGDALGeorefTransform(); - bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; + bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; int getMinimumGCPCount() const override; GDALTransformerFunc GDALTransformer() const override; @@ -113,7 +113,7 @@ class QgsProjectiveGeorefTransform : public QgsGeorefTransformInterface public: QgsProjectiveGeorefTransform() : mParameters() {} - bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; + bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; int getMinimumGCPCount() const override; GDALTransformerFunc GDALTransformer() const override { return QgsProjectiveGeorefTransform::projective_transform; } @@ -190,7 +190,7 @@ bool QgsGeorefTransform::parametersInitialized() const return mParametersInitialized; } -bool QgsGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) +bool QgsGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) { if ( !mGeorefTransformImplementation ) { @@ -206,7 +206,7 @@ bool QgsGeorefTransform::updateParametersFromGCPs( const QVector &mapC } if ( mRasterChangeCoords.hasCrs() ) { - QVector pixelCoordsCorrect = mRasterChangeCoords.getPixelCoords( pixelCoords ); + QVector pixelCoordsCorrect = mRasterChangeCoords.getPixelCoords( pixelCoords ); mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoordsCorrect ); pixelCoordsCorrect.clear(); } @@ -255,14 +255,14 @@ QgsGeorefTransformInterface *QgsGeorefTransform::createImplementation( Transform } } -bool QgsGeorefTransform::transformRasterToWorld( const QgsPoint &raster, QgsPoint &world ) +bool QgsGeorefTransform::transformRasterToWorld( const QgsPointXY &raster, QgsPointXY &world ) { // flip y coordinate due to different CS orientation - QgsPoint raster_flipped( raster.x(), -raster.y() ); + QgsPointXY raster_flipped( raster.x(), -raster.y() ); return gdal_transform( raster_flipped, world, 0 ); } -bool QgsGeorefTransform::transformWorldToRaster( const QgsPoint &world, QgsPoint &raster ) +bool QgsGeorefTransform::transformWorldToRaster( const QgsPointXY &world, QgsPointXY &raster ) { bool success = gdal_transform( world, raster, 1 ); // flip y coordinate due to different CS orientation @@ -270,12 +270,12 @@ bool QgsGeorefTransform::transformWorldToRaster( const QgsPoint &world, QgsPoint return success; } -bool QgsGeorefTransform::transform( const QgsPoint &src, QgsPoint &dst, bool rasterToWorld ) +bool QgsGeorefTransform::transform( const QgsPointXY &src, QgsPointXY &dst, bool rasterToWorld ) { return rasterToWorld ? transformRasterToWorld( src, dst ) : transformWorldToRaster( src, dst ); } -bool QgsGeorefTransform::getLinearOriginScale( QgsPoint &origin, double &scaleX, double &scaleY ) const +bool QgsGeorefTransform::getLinearOriginScale( QgsPointXY &origin, double &scaleX, double &scaleY ) const { if ( transformParametrisation() != Linear ) { @@ -289,7 +289,7 @@ bool QgsGeorefTransform::getLinearOriginScale( QgsPoint &origin, double &scaleX, return transform && transform->getOriginScale( origin, scaleX, scaleY ); } -bool QgsGeorefTransform::getOriginScaleRotation( QgsPoint &origin, double &scaleX, double &scaleY, double &rotation ) const +bool QgsGeorefTransform::getOriginScaleRotation( QgsPointXY &origin, double &scaleX, double &scaleY, double &rotation ) const { if ( mTransformParametrisation == Linear ) @@ -314,7 +314,7 @@ bool QgsGeorefTransform::getOriginScaleRotation( QgsPoint &origin, double &scale } -bool QgsGeorefTransform::gdal_transform( const QgsPoint &src, QgsPoint &dst, int dstToSrc ) const +bool QgsGeorefTransform::gdal_transform( const QgsPointXY &src, QgsPointXY &dst, int dstToSrc ) const { GDALTransformerFunc t = GDALTransformer(); // Fail if no transformer function was returned @@ -338,7 +338,7 @@ bool QgsGeorefTransform::gdal_transform( const QgsPoint &src, QgsPoint &dst, int } -bool QgsLinearGeorefTransform::getOriginScale( QgsPoint &origin, double &scaleX, double &scaleY ) const +bool QgsLinearGeorefTransform::getOriginScale( QgsPointXY &origin, double &scaleX, double &scaleY ) const { origin = mParameters.origin; scaleX = mParameters.scaleX; @@ -346,7 +346,7 @@ bool QgsLinearGeorefTransform::getOriginScale( QgsPoint &origin, double &scaleX, return true; } -bool QgsLinearGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) +bool QgsLinearGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) { if ( mapCoords.size() < getMinimumGCPCount() ) return false; @@ -399,7 +399,7 @@ int QgsLinearGeorefTransform::linear_transform( void *pTransformerArg, int bDstT return true; } -bool QgsHelmertGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) +bool QgsHelmertGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) { if ( mapCoords.size() < getMinimumGCPCount() ) return false; @@ -424,7 +424,7 @@ void *QgsHelmertGeorefTransform::GDALTransformerArgs() const return ( void * )&mHelmertParameters; } -bool QgsHelmertGeorefTransform::getOriginScaleRotation( QgsPoint &origin, double &scale, double &rotation ) const +bool QgsHelmertGeorefTransform::getOriginScaleRotation( QgsPointXY &origin, double &scale, double &rotation ) const { origin = mHelmertParameters.origin; scale = mHelmertParameters.scale; @@ -498,7 +498,7 @@ QgsGDALGeorefTransform::~QgsGDALGeorefTransform() destroy_gdal_args(); } -bool QgsGDALGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) +bool QgsGDALGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) { assert( mapCoords.size() == pixelCoords.size() ); if ( mapCoords.size() != pixelCoords.size() ) @@ -569,17 +569,17 @@ void QgsGDALGeorefTransform::destroy_gdal_args() } } -bool QgsProjectiveGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) +bool QgsProjectiveGeorefTransform::updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) { if ( mapCoords.size() < getMinimumGCPCount() ) return false; // HACK: flip y coordinates, because georeferencer and gdal use different conventions - QVector flippedPixelCoords; + QVector flippedPixelCoords; flippedPixelCoords.reserve( pixelCoords.size() ); - Q_FOREACH ( const QgsPoint &coord, pixelCoords ) + Q_FOREACH ( const QgsPointXY &coord, pixelCoords ) { - flippedPixelCoords << QgsPoint( coord.x(), -coord.y() ); + flippedPixelCoords << QgsPointXY( coord.x(), -coord.y() ); } QgsLeastSquares::projective( mapCoords, flippedPixelCoords, mParameters.H ); diff --git a/src/plugins/georeferencer/qgsgeoreftransform.h b/src/plugins/georeferencer/qgsgeoreftransform.h index d2ba1dc3134..e979c5f2249 100644 --- a/src/plugins/georeferencer/qgsgeoreftransform.h +++ b/src/plugins/georeferencer/qgsgeoreftransform.h @@ -30,7 +30,7 @@ class QgsGeorefTransformInterface public: virtual ~QgsGeorefTransformInterface() { } - virtual bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) = 0; + virtual bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) = 0; /** * Returns the minimum number of GCPs required for parameter fitting. @@ -90,7 +90,7 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface bool hasCrs() const { return mRasterChangeCoords.hasCrs(); } //! \returns Coordinates of image - QgsPoint toColumnLine( const QgsPoint &pntMap ) { return mRasterChangeCoords.toColumnLine( pntMap ); } + QgsPointXY toColumnLine( const QgsPointXY &pntMap ) { return mRasterChangeCoords.toColumnLine( pntMap ); } //! \returns Bounding box of image(transform to coordinate of Map or Image ) QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel ) { return mRasterChangeCoords.getBoundingBox( rect, toPixel ); } @@ -109,7 +109,7 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface * * \returns true on success, false on failure */ - bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; + bool updateParametersFromGCPs( const QVector &mapCoords, const QVector &pixelCoords ) override; //! \brief Returns the minimum number of GCPs required for parameter fitting. int getMinimumGCPCount() const override; @@ -129,14 +129,14 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface * * \note Negative y-axis points down in raster CS. */ - bool transformRasterToWorld( const QgsPoint &raster, QgsPoint &world ); + bool transformRasterToWorld( const QgsPointXY &raster, QgsPointXY &world ); /** * \brief Transform from referenced coordinates to raster coordinates. * * \note Negative y-axis points down in raster CS. */ - bool transformWorldToRaster( const QgsPoint &world, QgsPoint &raster ); + bool transformWorldToRaster( const QgsPointXY &world, QgsPointXY &raster ); /** * \brief Transforms from raster to world if rasterToWorld is true, @@ -144,13 +144,13 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface * * \note Negative y-axis points down in raster CS. */ - bool transform( const QgsPoint &src, QgsPoint &dst, bool rasterToWorld ); + bool transform( const QgsPointXY &src, QgsPointXY &dst, bool rasterToWorld ); //! \brief Returns origin and scale if this is a linear transform, fails otherwise. - bool getLinearOriginScale( QgsPoint &origin, double &scaleX, double &scaleY ) const; + bool getLinearOriginScale( QgsPointXY &origin, double &scaleX, double &scaleY ) const; //! \brief Returns origin, scale and rotation for linear and helmert transform, fails otherwise. - bool getOriginScaleRotation( QgsPoint &origin, double &scaleX, double &scaleY, double &rotation ) const; + bool getOriginScaleRotation( QgsPointXY &origin, double &scaleX, double &scaleY, double &rotation ) const; private: // shallow copy constructor @@ -160,7 +160,7 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface static QgsGeorefTransformInterface *createImplementation( TransformParametrisation parametrisation ); // convenience wrapper around GDALTransformerFunc - bool gdal_transform( const QgsPoint &src, QgsPoint &dst, int dstToSrc ) const; + bool gdal_transform( const QgsPointXY &src, QgsPointXY &dst, int dstToSrc ) const; QgsGeorefTransformInterface *mGeorefTransformImplementation = nullptr; TransformParametrisation mTransformParametrisation; diff --git a/src/plugins/georeferencer/qgsleastsquares.cpp b/src/plugins/georeferencer/qgsleastsquares.cpp index 6e79042b412..2381117c901 100644 --- a/src/plugins/georeferencer/qgsleastsquares.cpp +++ b/src/plugins/georeferencer/qgsleastsquares.cpp @@ -23,9 +23,9 @@ #include "qgsleastsquares.h" -void QgsLeastSquares::linear( const QVector &mapCoords, - const QVector &pixelCoords, - QgsPoint &origin, double &pixelXSize, double &pixelYSize ) +void QgsLeastSquares::linear( const QVector &mapCoords, + const QVector &pixelCoords, + QgsPointXY &origin, double &pixelXSize, double &pixelYSize ) { int n = mapCoords.size(); if ( n < 2 ) @@ -62,9 +62,9 @@ void QgsLeastSquares::linear( const QVector &mapCoords, } -void QgsLeastSquares::helmert( const QVector &mapCoords, - const QVector &pixelCoords, - QgsPoint &origin, double &pixelSize, +void QgsLeastSquares::helmert( const QVector &mapCoords, + const QVector &pixelCoords, + QgsPointXY &origin, double &pixelSize, double &rotation ) { int n = mapCoords.size(); @@ -119,8 +119,8 @@ void QgsLeastSquares::helmert( const QVector &mapCoords, } -void QgsLeastSquares::affine( QVector mapCoords, - QVector pixelCoords ) +void QgsLeastSquares::affine( QVector mapCoords, + QVector pixelCoords ) { int n = mapCoords.size(); if ( n < 4 ) @@ -178,7 +178,7 @@ void QgsLeastSquares::affine( QVector mapCoords, * * Also returns 3x3 homogenous matrices which can be used to normalize and de-normalize coordinates. */ -void normalizeCoordinates( const QVector &coords, QVector &normalizedCoords, +void normalizeCoordinates( const QVector &coords, QVector &normalizedCoords, double normalizeMatrix[9], double denormalizeMatrix[9] ) { // Calculate center of gravity @@ -206,7 +206,7 @@ void normalizeCoordinates( const QVector &coords, QVector &n normalizedCoords.resize( coords.size() ); for ( int i = 0; i < coords.size(); i++ ) { - normalizedCoords[i] = QgsPoint( ( coords[i].x() - cogX ) * D, ( coords[i].y() - cogY ) * D ); + normalizedCoords[i] = QgsPointXY( ( coords[i].x() - cogX ) * D, ( coords[i].y() - cogY ) * D ); } normalizeMatrix[0] = D; @@ -232,8 +232,8 @@ void normalizeCoordinates( const QVector &coords, QVector &n // Fits a homography to the given corresponding points, and // return it in H (row-major format). -void QgsLeastSquares::projective( QVector mapCoords, - QVector pixelCoords, +void QgsLeastSquares::projective( QVector mapCoords, + QVector pixelCoords, double H[9] ) { Q_ASSERT( mapCoords.size() == pixelCoords.size() ); @@ -243,8 +243,8 @@ void QgsLeastSquares::projective( QVector mapCoords, throw std::domain_error( QObject::tr( "Fitting a projective transform requires at least 4 corresponding points." ).toLocal8Bit().constData() ); } - QVector mapCoordsNormalized; - QVector pixelCoordsNormalized; + QVector mapCoordsNormalized; + QVector pixelCoordsNormalized; double normMap[9], denormMap[9]; double normPixel[9], denormPixel[9]; diff --git a/src/plugins/georeferencer/qgsleastsquares.h b/src/plugins/georeferencer/qgsleastsquares.h index 6dd8aa29804..02f82c43cf8 100644 --- a/src/plugins/georeferencer/qgsleastsquares.h +++ b/src/plugins/georeferencer/qgsleastsquares.h @@ -25,19 +25,19 @@ class QgsLeastSquares { public: - static void linear( const QVector &mapCoords, - const QVector &pixelCoords, - QgsPoint &origin, double &pixelXSize, double &pixelYSize ); + static void linear( const QVector &mapCoords, + const QVector &pixelCoords, + QgsPointXY &origin, double &pixelXSize, double &pixelYSize ); - static void helmert( const QVector &mapCoords, - const QVector &pixelCoords, - QgsPoint &origin, double &pixelSize, double &rotation ); + static void helmert( const QVector &mapCoords, + const QVector &pixelCoords, + QgsPointXY &origin, double &pixelSize, double &rotation ); - static void affine( QVector mapCoords, - QVector pixelCoords ); + static void affine( QVector mapCoords, + QVector pixelCoords ); - static void projective( QVector mapCoords, - QVector pixelCoords, + static void projective( QVector mapCoords, + QVector pixelCoords, double H[9] ); }; diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp index 23b4a4dd04c..b12976ec40c 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp @@ -20,7 +20,7 @@ #include "qgsmapcoordsdialog.h" #include "qgssettings.h" -QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint &pixelCoords, QWidget *parent ) +QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPointXY &pixelCoords, QWidget *parent ) : QDialog( parent, Qt::Dialog ) , mPrevMapTool( nullptr ) , mQgisCanvas( qgisCanvas ) @@ -87,16 +87,16 @@ void QgsMapCoordsDialog::on_buttonBox_accepted() if ( !ok ) y = dmsToDD( leYCoord->text() ); - emit pointAdded( mPixelCoords, QgsPoint( x, y ) ); + emit pointAdded( mPixelCoords, QgsPointXY( x, y ) ); close(); } -void QgsMapCoordsDialog::maybeSetXY( const QgsPoint &xy, Qt::MouseButton button ) +void QgsMapCoordsDialog::maybeSetXY( const QgsPointXY &xy, Qt::MouseButton button ) { // Only LeftButton should set point if ( Qt::LeftButton == button ) { - QgsPoint mapCoordPoint = xy; + QgsPointXY mapCoordPoint = xy; leXCoord->clear(); leYCoord->clear(); diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.h b/src/plugins/georeferencer/qgsmapcoordsdialog.h index a91d92d88d4..f7713a64e1f 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.h +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.h @@ -85,20 +85,20 @@ class QgsGeorefMapToolEmitPoint : public QgsMapTool } signals: - void canvasClicked( const QgsPoint &point, Qt::MouseButton button ); + void canvasClicked( const QgsPointXY &point, Qt::MouseButton button ); void mouseReleased(); private: struct MappedPoint { MappedPoint() : snapped( false ) {} - QgsPoint point; + QgsPointXY point; bool snapped; }; MappedPoint mapPoint( QMouseEvent *e ) { - QgsPoint pnt = toMapCoordinates( e->pos() ); + QgsPointXY pnt = toMapCoordinates( e->pos() ); QgsSnappingUtils *snappingUtils = canvas()->snappingUtils(); QgsPointLocator::Match match = snappingUtils->snapToMap( pnt ); @@ -116,7 +116,7 @@ class QgsMapCoordsDialog : public QDialog, private Ui::QgsMapCoordsDialogBase Q_OBJECT public: - QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint &pixelCoords, QWidget *parent = nullptr ); + QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPointXY &pixelCoords, QWidget *parent = nullptr ); ~QgsMapCoordsDialog(); private slots: @@ -124,12 +124,12 @@ class QgsMapCoordsDialog : public QDialog, private Ui::QgsMapCoordsDialogBase void setToolEmitPoint( bool isEnable ); - void maybeSetXY( const QgsPoint &, Qt::MouseButton ); + void maybeSetXY( const QgsPointXY &, Qt::MouseButton ); void updateOK(); void setPrevTool(); signals: - void pointAdded( const QgsPoint &, const QgsPoint & ); + void pointAdded( const QgsPointXY &, const QgsPointXY & ); private: double dmsToDD( const QString &dms ); @@ -140,7 +140,7 @@ class QgsMapCoordsDialog : public QDialog, private Ui::QgsMapCoordsDialogBase QgsMapTool *mPrevMapTool = nullptr; QgsMapCanvas *mQgisCanvas = nullptr; - QgsPoint mPixelCoords; + QgsPointXY mPixelCoords; }; #endif diff --git a/src/plugins/georeferencer/qgsrasterchangecoords.cpp b/src/plugins/georeferencer/qgsrasterchangecoords.cpp index 86b4be088ba..30d371768e2 100644 --- a/src/plugins/georeferencer/qgsrasterchangecoords.cpp +++ b/src/plugins/georeferencer/qgsrasterchangecoords.cpp @@ -50,10 +50,10 @@ void QgsRasterChangeCoords::setRaster( const QString &fileRaster ) GDALClose( hDS ); } -QVector QgsRasterChangeCoords::getPixelCoords( const QVector &mapCoords ) +QVector QgsRasterChangeCoords::getPixelCoords( const QVector &mapCoords ) { const int size = mapCoords.size(); - QVector pixelCoords( size ); + QVector pixelCoords( size ); for ( int i = 0; i < size; i++ ) { pixelCoords[i] = toColumnLine( mapCoords.at( i ) ); @@ -64,9 +64,9 @@ QVector QgsRasterChangeCoords::getPixelCoords( const QVector QgsRectangle QgsRasterChangeCoords::getBoundingBox( const QgsRectangle &rect, bool toPixel ) { QgsRectangle rectReturn; - QgsPoint p1( rect.xMinimum(), rect.yMinimum() ); - QgsPoint p2( rect.xMaximum(), rect.yMaximum() ); - QgsPoint( QgsRasterChangeCoords::* func )( const QgsPoint & ); + QgsPointXY p1( rect.xMinimum(), rect.yMinimum() ); + QgsPointXY p2( rect.xMaximum(), rect.yMaximum() ); + QgsPointXY( QgsRasterChangeCoords::* func )( const QgsPointXY & ); func = toPixel ? &QgsRasterChangeCoords::toColumnLine : &QgsRasterChangeCoords::toXY; rectReturn.set( ( this->*func )( p1 ), ( this->*func )( p2 ) ); @@ -74,16 +74,16 @@ QgsRectangle QgsRasterChangeCoords::getBoundingBox( const QgsRectangle &rect, bo return rectReturn; } -QgsPoint QgsRasterChangeCoords::toColumnLine( const QgsPoint &pntMap ) +QgsPointXY QgsRasterChangeCoords::toColumnLine( const QgsPointXY &pntMap ) { double col = ( pntMap.x() - mUL_X ) / mResX; double line = ( mUL_Y - pntMap.y() ) / mResY; - return QgsPoint( col, line ); + return QgsPointXY( col, line ); } -QgsPoint QgsRasterChangeCoords::toXY( const QgsPoint &pntPixel ) +QgsPointXY QgsRasterChangeCoords::toXY( const QgsPointXY &pntPixel ) { double x = mUL_X + ( pntPixel.x() * mResX ); double y = mUL_Y + ( pntPixel.y() * -mResY ); - return QgsPoint( x, y ); + return QgsPointXY( x, y ); } diff --git a/src/plugins/georeferencer/qgsrasterchangecoords.h b/src/plugins/georeferencer/qgsrasterchangecoords.h index da6525bfe2a..05cac823d05 100644 --- a/src/plugins/georeferencer/qgsrasterchangecoords.h +++ b/src/plugins/georeferencer/qgsrasterchangecoords.h @@ -27,10 +27,10 @@ class QgsRasterChangeCoords QgsRasterChangeCoords(); void setRaster( const QString &fileRaster ); bool hasCrs() const { return mHasCrs; } - QVector getPixelCoords( const QVector &mapCoords ); + QVector getPixelCoords( const QVector &mapCoords ); QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel ); - QgsPoint toColumnLine( const QgsPoint &pntMap ); - QgsPoint toXY( const QgsPoint &pntPixel ); + QgsPointXY toColumnLine( const QgsPointXY &pntMap ); + QgsPointXY toXY( const QgsPointXY &pntPixel ); private: bool mHasCrs; diff --git a/src/plugins/georeferencer/qgsresidualplotitem.cpp b/src/plugins/georeferencer/qgsresidualplotitem.cpp index 5c3281c71af..3f2218b70b2 100644 --- a/src/plugins/georeferencer/qgsresidualplotitem.cpp +++ b/src/plugins/georeferencer/qgsresidualplotitem.cpp @@ -56,7 +56,7 @@ void QgsResidualPlotItem::paint( QPainter *painter, const QStyleOptionGraphicsIt QgsGCPList::const_iterator gcpIt = mGCPList.constBegin(); for ( ; gcpIt != mGCPList.constEnd(); ++gcpIt ) { - QgsPoint gcpCoords = ( *gcpIt )->pixelCoords(); + QgsPointXY gcpCoords = ( *gcpIt )->pixelCoords(); double gcpItemMMX = ( gcpCoords.x() - mExtent.xMinimum() ) / mExtent.width() * widthMM; double gcpItemMMY = ( 1 - ( gcpCoords.y() - mExtent.yMinimum() ) / mExtent.height() ) * heightMM; @@ -84,7 +84,7 @@ void QgsResidualPlotItem::paint( QPainter *painter, const QStyleOptionGraphicsIt gcpIt = mGCPList.constBegin(); for ( ; gcpIt != mGCPList.constEnd(); ++gcpIt ) { - QgsPoint gcpCoords = ( *gcpIt )->pixelCoords(); + QgsPointXY gcpCoords = ( *gcpIt )->pixelCoords(); double gcpItemMMX = ( gcpCoords.x() - mExtent.xMinimum() ) / mExtent.width() * widthMM; double gcpItemMMY = ( 1 - ( gcpCoords.y() - mExtent.yMinimum() ) / mExtent.height() ) * heightMM; if ( ( *gcpIt )->isEnabled() ) diff --git a/src/plugins/globe/featuresource/qgsglobefeatureutils.h b/src/plugins/globe/featuresource/qgsglobefeatureutils.h index b717114309b..85df4d972ec 100644 --- a/src/plugins/globe/featuresource/qgsglobefeatureutils.h +++ b/src/plugins/globe/featuresource/qgsglobefeatureutils.h @@ -31,12 +31,12 @@ class QgsGlobeFeatureUtils { public: - static inline QgsPointV2 qgsPointFromPoint( const osg::Vec3d &pt ) + static inline QgsPoint qgsPointFromPoint( const osg::Vec3d &pt ) { - return QgsPointV2( QgsWkbTypes::PointZ, pt.x(), pt.y(), pt.z() ); + return QgsPoint( QgsWkbTypes::PointZ, pt.x(), pt.y(), pt.z() ); } - static inline osg::Vec3d pointFromQgsPoint( const QgsPointV2 &pt ) + static inline osg::Vec3d pointFromQgsPointXY( const QgsPoint &pt ) { return osg::Vec3d( pt.x(), pt.y(), pt.z() ); } @@ -47,7 +47,7 @@ class QgsGlobeFeatureUtils osgEarth::Features::LineString *retLineString = new osgEarth::Features::LineString(); for ( int iVtx = 0, nVtx = linearString->vertexCount(); iVtx < nVtx; ++iVtx ) { - retLineString->push_back( pointFromQgsPoint( linearString->vertexAt( QgsVertexId( 0, 0, iVtx ) ) ) ); + retLineString->push_back( pointFromQgsPointXY( linearString->vertexAt( QgsVertexId( 0, 0, iVtx ) ) ) ); } delete linearString; return retLineString; @@ -63,7 +63,7 @@ class QgsGlobeFeatureUtils // the outer ring for ( int iVtx = 0, nVtx = linearPolygon->vertexCount( 0, 0 ); iVtx < nVtx; ++iVtx ) { - retPoly->push_back( pointFromQgsPoint( linearPolygon->vertexAt( QgsVertexId( 0, 0, iVtx ) ) ) ); + retPoly->push_back( pointFromQgsPointXY( linearPolygon->vertexAt( QgsVertexId( 0, 0, iVtx ) ) ) ); } retPoly->rewind( osgEarth::Symbology::Ring::ORIENTATION_CCW ); @@ -72,7 +72,7 @@ class QgsGlobeFeatureUtils osgEarth::Features::Ring *innerRing = new osgEarth::Features::Ring(); for ( int iVtx = 0, nVtx = linearPolygon->vertexCount( 0, iRing ); iVtx < nVtx; ++iVtx ) { - innerRing->push_back( pointFromQgsPoint( linearPolygon->vertexAt( QgsVertexId( 0, iRing, iVtx ) ) ) ); + innerRing->push_back( pointFromQgsPointXY( linearPolygon->vertexAt( QgsVertexId( 0, iRing, iVtx ) ) ) ); } innerRing->rewind( osgEarth::Symbology::Ring::ORIENTATION_CW ); retPoly->getHoles().push_back( osg::ref_ptr( innerRing ) ); @@ -97,7 +97,7 @@ class QgsGlobeFeatureUtils case QgsWkbTypes::Point: { osgEarth::Features::PointSet *pointSet = new osgEarth::Features::PointSet(); - pointSet->push_back( pointFromQgsPoint( *static_cast( geom.geometry() ) ) ); + pointSet->push_back( pointFromQgsPointXY( *static_cast( geom.geometry() ) ) ); return pointSet; } @@ -107,7 +107,7 @@ class QgsGlobeFeatureUtils QgsMultiPointV2 *multiPoint = static_cast( geom.geometry() ); for ( int i = 0, n = multiPoint->numGeometries(); i < n; ++i ) { - pointSet->push_back( pointFromQgsPoint( *static_cast( multiPoint->geometryN( i ) ) ) ); + pointSet->push_back( pointFromQgsPointXY( *static_cast( multiPoint->geometryN( i ) ) ) ); } return pointSet; } diff --git a/src/plugins/globe/globe_plugin.cpp b/src/plugins/globe/globe_plugin.cpp index e9e7b976772..95c23057ef7 100644 --- a/src/plugins/globe/globe_plugin.cpp +++ b/src/plugins/globe/globe_plugin.cpp @@ -275,7 +275,7 @@ void GlobePlugin::initGui() connect( mActionToggleGlobe, SIGNAL( triggered( bool ) ), this, SLOT( setGlobeEnabled( bool ) ) ); connect( mLayerPropertiesFactory, SIGNAL( layerSettingsChanged( QgsMapLayer * ) ), this, SLOT( layerChanged( QgsMapLayer * ) ) ); - connect( this, SIGNAL( xyCoordinates( const QgsPoint & ) ), mQGisIface->mapCanvas(), SIGNAL( xyCoordinates( const QgsPoint & ) ) ); + connect( this, SIGNAL( xyCoordinates( const QgsPointXY & ) ), mQGisIface->mapCanvas(), SIGNAL( xyCoordinates( const QgsPointXY & ) ) ); connect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); } @@ -618,7 +618,7 @@ QgsRectangle GlobePlugin::getQGISLayerExtent() const void GlobePlugin::showCurrentCoordinates( const osgEarth::GeoPoint &geoPoint ) { osg::Vec3d pos = geoPoint.vec3d(); - emit xyCoordinates( QgsCoordinateTransformCache::instance()->transform( GEO_EPSG_CRS_AUTHID, mQGisIface->mapCanvas()->mapSettings().destinationCrs().authid() ).transform( QgsPoint( pos.x(), pos.y() ) ) ); + emit xyCoordinates( QgsCoordinateTransformCache::instance()->transform( GEO_EPSG_CRS_AUTHID, mQGisIface->mapCanvas()->mapSettings().destinationCrs().authid() ).transform( QgsPointXY( pos.x(), pos.y() ) ) ); } void GlobePlugin::setSelectedCoordinates( const osg::Vec3d &coords ) @@ -626,7 +626,7 @@ void GlobePlugin::setSelectedCoordinates( const osg::Vec3d &coords ) mSelectedLon = coords.x(); mSelectedLat = coords.y(); mSelectedElevation = coords.z(); - emit newCoordinatesSelected( QgsPoint( mSelectedLon, mSelectedLat ) ); + emit newCoordinatesSelected( QgsPointXY( mSelectedLon, mSelectedLat ) ); } osg::Vec3d GlobePlugin::getSelectedCoordinates() @@ -655,8 +655,8 @@ void GlobePlugin::syncExtent() dist.setEllipsoidalMode( true ); dist.setEllipsoid( "WGS84" ); - QgsPoint ll = QgsPoint( extent.xMinimum(), extent.yMinimum() ); - QgsPoint ul = QgsPoint( extent.xMinimum(), extent.yMaximum() ); + QgsPointXY ll = QgsPointXY( extent.xMinimum(), extent.yMinimum() ); + QgsPointXY ul = QgsPointXY( extent.xMinimum(), extent.yMaximum() ); double height = dist.measureLine( ll, ul ); // double height = dist.computeDistanceBearing( ll, ul ); @@ -1098,8 +1098,8 @@ void GlobePlugin::unload() delete mSettingsDialog; mSettingsDialog = 0; - disconnect( this, SIGNAL( xyCoordinates( const QgsPoint & ) ), - mQGisIface->mapCanvas(), SIGNAL( xyCoordinates( const QgsPoint & ) ) ); + disconnect( this, SIGNAL( xyCoordinates( const QgsPointXY & ) ), + mQGisIface->mapCanvas(), SIGNAL( xyCoordinates( const QgsPointXY & ) ) ); } void GlobePlugin::enableFrustumHighlight( bool status ) diff --git a/src/plugins/globe/globe_plugin.h b/src/plugins/globe/globe_plugin.h index d79009f32e1..79dc6b7186a 100644 --- a/src/plugins/globe/globe_plugin.h +++ b/src/plugins/globe/globe_plugin.h @@ -36,7 +36,7 @@ class QgsGlobeLayerPropertiesFactory; class QgsGlobePluginDialog; class QgsGlobeWidget; class QgsMapLayer; -class QgsPoint; +class QgsPointXY; class QgsRectangle; class QgsGlobeFrustumHighlightCallback; class QgsGlobeFeatureIdentifyCallback; @@ -171,9 +171,9 @@ class GLOBE_EXPORT GlobePlugin : public QObject, public QgisPlugin signals: //! emits current mouse position - void xyCoordinates( const QgsPoint &p ); + void xyCoordinates( const QgsPointXY &p ); //! emits position of right click on globe - void newCoordinatesSelected( const QgsPoint &p ); + void newCoordinatesSelected( const QgsPointXY &p ); }; #endif // QGS_GLOBE_PLUGIN_H diff --git a/src/plugins/globe/qgsglobefrustumhighlight.cpp b/src/plugins/globe/qgsglobefrustumhighlight.cpp index 0711b2d863d..96fe1fc7e88 100644 --- a/src/plugins/globe/qgsglobefrustumhighlight.cpp +++ b/src/plugins/globe/qgsglobefrustumhighlight.cpp @@ -53,6 +53,6 @@ void QgsGlobeFrustumHighlightCallback::operator()( osg::Node *, osg::NodeVisitor { osg::Vec3d localCoords; mSrs->transformFromWorld( corners[i], localCoords ); - mRubberBand->addPoint( QgsPoint( localCoords.x(), localCoords.y() ) ); + mRubberBand->addPoint( QgsPointXY( localCoords.x(), localCoords.y() ) ); } } diff --git a/src/plugins/grass/qgsgrassnewmapset.cpp b/src/plugins/grass/qgsgrassnewmapset.cpp index d06da400dce..405b1afff05 100644 --- a/src/plugins/grass/qgsgrassnewmapset.cpp +++ b/src/plugins/grass/qgsgrassnewmapset.cpp @@ -504,11 +504,11 @@ void QgsGrassNewMapset::setRegionPage() double e = mEastLineEdit->text().toDouble(); double w = mWestLineEdit->text().toDouble(); - std::vector points; + std::vector points; // TODO: this is not perfect - points.push_back( QgsPoint( w, s ) ); - points.push_back( QgsPoint( e, n ) ); + points.push_back( QgsPointXY( w, s ) ); + points.push_back( QgsPointXY( e, n ) ); bool ok = true; for ( int i = 0; i < 2; i++ ) @@ -784,9 +784,9 @@ void QgsGrassNewMapset::loadRegions() // Add region mRegionsComboBox->addItem( nameElem.text() ); - QgsPoint llp( ll[0].toDouble(), ll[1].toDouble() ); + QgsPointXY llp( ll[0].toDouble(), ll[1].toDouble() ); mRegionsPoints.push_back( llp ); - QgsPoint urp( ur[0].toDouble(), ur[1].toDouble() ); + QgsPointXY urp( ur[0].toDouble(), ur[1].toDouble() ); mRegionsPoints.push_back( urp ); } mRegionsComboBox->setCurrentIndex( -1 ); @@ -800,14 +800,14 @@ void QgsGrassNewMapset::setSelectedRegion() // mRegionsPoints are in EPSG 4326 = LL WGS84 int index = 2 * mRegionsComboBox->currentIndex(); - std::vector points; + std::vector points; // corners ll lr ur ul - points.push_back( QgsPoint( mRegionsPoints[index] ) ); - points.push_back( QgsPoint( mRegionsPoints[index + 1].x(), - mRegionsPoints[index].y() ) ); - points.push_back( QgsPoint( mRegionsPoints[index + 1] ) ); - points.push_back( QgsPoint( mRegionsPoints[index].x(), - mRegionsPoints[index + 1].y() ) ); + points.push_back( QgsPointXY( mRegionsPoints[index] ) ); + points.push_back( QgsPointXY( mRegionsPoints[index + 1].x(), + mRegionsPoints[index].y() ) ); + points.push_back( QgsPointXY( mRegionsPoints[index + 1] ) ); + points.push_back( QgsPointXY( mRegionsPoints[index].x(), + mRegionsPoints[index + 1].y() ) ); // Convert to currently selected coordinate system @@ -913,11 +913,11 @@ void QgsGrassNewMapset::setCurrentRegion() QgsCoordinateReferenceSystem srs = mIface->mapCanvas()->mapSettings().destinationCrs(); QgsDebugMsg( "srs = " + srs.toWkt() ); - std::vector points; + std::vector points; // TODO: this is not perfect - points.push_back( QgsPoint( ext.xMinimum(), ext.yMinimum() ) ); - points.push_back( QgsPoint( ext.xMaximum(), ext.yMaximum() ) ); + points.push_back( QgsPointXY( ext.xMinimum(), ext.yMinimum() ) ); + points.push_back( QgsPointXY( ext.xMaximum(), ext.yMaximum() ) ); // TODO add a method, this code is copy-paste from setSelectedRegion if ( srs.isValid() && mCrs.isValid() @@ -996,17 +996,17 @@ void QgsGrassNewMapset::drawRegion() } } - QList tpoints; // ll lr ur ul ll - tpoints << QgsPoint( w, s ); - tpoints << QgsPoint( e, s ); - tpoints << QgsPoint( e, n ); - tpoints << QgsPoint( w, n ); - tpoints << QgsPoint( w, s ); + QList tpoints; // ll lr ur ul ll + tpoints << QgsPointXY( w, s ); + tpoints << QgsPointXY( e, s ); + tpoints << QgsPointXY( e, n ); + tpoints << QgsPointXY( w, n ); + tpoints << QgsPointXY( w, s ); // Because of possible shift +/- 360 in LL we have to split // the lines at least in 3 parts - QList points; // + QList points; // for ( int i = 0; i < 4; i++ ) { for ( int j = 0; j < 3; j++ ) @@ -1016,7 +1016,7 @@ void QgsGrassNewMapset::drawRegion() double dx = ( tpoints[i + 1].x() - x ) / 3; double dy = ( tpoints[i + 1].y() - y ) / 3; QgsDebugMsg( QString( "dx = %1 x = %2" ).arg( dx ).arg( x + j * dx ) ); - points << QgsPoint( x + j * dx, y + j * dy ); + points << QgsPointXY( x + j * dx, y + j * dy ); } } diff --git a/src/plugins/grass/qgsgrassnewmapset.h b/src/plugins/grass/qgsgrassnewmapset.h index cee5b9711a7..79010d80ca3 100644 --- a/src/plugins/grass/qgsgrassnewmapset.h +++ b/src/plugins/grass/qgsgrassnewmapset.h @@ -21,7 +21,7 @@ class QgsGrassPlugin; class QgisInterface; -class QgsPoint; +class QgsPointXY; class QgsProjectionSelectionTreeWidget; extern "C" @@ -225,7 +225,7 @@ class QgsGrassNewMapset : public QWizard, private Ui::QgsGrassNewMapsetBase //! Locations were initialized bool mRegionsInited; - std::vector mRegionsPoints; + std::vector mRegionsPoints; //! Last projection used for region QgsCoordinateReferenceSystem mCrs; diff --git a/src/plugins/grass/qgsgrassplugin.cpp b/src/plugins/grass/qgsgrassplugin.cpp index 5eeda380daf..6bfe9a4ee0d 100644 --- a/src/plugins/grass/qgsgrassplugin.cpp +++ b/src/plugins/grass/qgsgrassplugin.cpp @@ -687,7 +687,7 @@ void QgsGrassPlugin::displayRegion() return; } - QgsRectangle rect( QgsPoint( window.west, window.north ), QgsPoint( window.east, window.south ) ); + QgsRectangle rect( QgsPointXY( window.west, window.north ), QgsPointXY( window.east, window.south ) ); QPen regionPen = QgsGrass::regionPen(); mRegionBand->setColor( regionPen.color() ); diff --git a/src/plugins/grass/qgsgrassregion.cpp b/src/plugins/grass/qgsgrassregion.cpp index 6852bc10918..39ee364f854 100644 --- a/src/plugins/grass/qgsgrassregion.cpp +++ b/src/plugins/grass/qgsgrassregion.cpp @@ -96,7 +96,7 @@ void QgsGrassRegionEdit::deactivate() QgsMapTool::deactivate(); } -void QgsGrassRegionEdit::setRegion( const QgsPoint &ul, const QgsPoint &lr ) +void QgsGrassRegionEdit::setRegion( const QgsPointXY &ul, const QgsPointXY &lr ) { mStartPoint = ul; mEndPoint = lr; @@ -127,7 +127,7 @@ void QgsGrassRegionEdit::setTransform() } } -void QgsGrassRegionEdit::transform( QgsMapCanvas *, QVector &points, const QgsCoordinateTransform &coordinateTransform, QgsCoordinateTransform::TransformDirection direction ) +void QgsGrassRegionEdit::transform( QgsMapCanvas *, QVector &points, const QgsCoordinateTransform &coordinateTransform, QgsCoordinateTransform::TransformDirection direction ) { //! Coordinate transform //QgsDebugMsg ( "srcCrs = " + coordinateTransform->sourceCrs().toWkt() ); @@ -148,14 +148,14 @@ void QgsGrassRegionEdit::transform( QgsMapCanvas *, QVector &points, c void QgsGrassRegionEdit::drawRegion( QgsMapCanvas *canvas, QgsRubberBand *rubberBand, const QgsRectangle &rect, const QgsCoordinateTransform &coordinateTransform, bool isPolygon ) { - QVector points; - points.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); - points.append( QgsPoint( rect.xMaximum(), rect.yMinimum() ) ); - points.append( QgsPoint( rect.xMaximum(), rect.yMaximum() ) ); - points.append( QgsPoint( rect.xMinimum(), rect.yMaximum() ) ); + QVector points; + points.append( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); + points.append( QgsPointXY( rect.xMaximum(), rect.yMinimum() ) ); + points.append( QgsPointXY( rect.xMaximum(), rect.yMaximum() ) ); + points.append( QgsPointXY( rect.xMinimum(), rect.yMaximum() ) ); if ( !isPolygon ) { - points.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) ); + points.append( QgsPointXY( rect.xMinimum(), rect.yMinimum() ) ); } if ( coordinateTransform.isValid() ) @@ -487,8 +487,8 @@ void QgsGrassRegion::displayRegion() { return; } - QgsPoint ul( mWindow.west, mWindow.north ); - QgsPoint lr( mWindow.east, mWindow.south ); + QgsPointXY ul( mWindow.west, mWindow.north ); + QgsPointXY lr( mWindow.east, mWindow.south ); mRegionEdit->setSrcRegion( QgsRectangle( ul, lr ) ); } diff --git a/src/plugins/grass/qgsgrassregion.h b/src/plugins/grass/qgsgrassregion.h index 4db982c48a7..9105014f6fa 100644 --- a/src/plugins/grass/qgsgrassregion.h +++ b/src/plugins/grass/qgsgrassregion.h @@ -61,10 +61,10 @@ class QgsGrassRegion: public QWidget, private Ui::QgsGrassRegionBase void reloadRegion(); //! Mouse event receiver - //void mouseEventReceiverMove ( QgsPoint & ); + //void mouseEventReceiverMove ( QgsPointXY & ); //! Mouse event receiver - //void mouseEventReceiverClick ( QgsPoint & ); + //void mouseEventReceiverClick ( QgsPointXY & ); //! Calculate region, called if any value is changed void adjust( void ); @@ -154,12 +154,12 @@ class QgsGrassRegionEdit : public QgsMapTool QgsRectangle getRegion(); //! refresh the rectangle displayed in canvas - void setRegion( const QgsPoint &, const QgsPoint & ); + void setRegion( const QgsPointXY &, const QgsPointXY & ); void setSrcRegion( const QgsRectangle &rect ); static void drawRegion( QgsMapCanvas *canvas, QgsRubberBand *rubberBand, const QgsRectangle &rect, const QgsCoordinateTransform &coordinateTransform = QgsCoordinateTransform(), bool isPolygon = false ); void calcSrcRegion(); - static void transform( QgsMapCanvas *canvas, QVector &points, const QgsCoordinateTransform &coordinateTransform, QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform ); + static void transform( QgsMapCanvas *canvas, QVector &points, const QgsCoordinateTransform &coordinateTransform, QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform ); signals: void captureStarted(); @@ -177,9 +177,9 @@ class QgsGrassRegionEdit : public QgsMapTool bool mDraw; //! First rectangle point - QgsPoint mStartPoint; + QgsPointXY mStartPoint; //! Last rectangle point - QgsPoint mEndPoint; + QgsPointXY mEndPoint; //! Region rectangle in source CRS QgsRectangle mSrcRectangle; diff --git a/src/plugins/topology/topolTest.cpp b/src/plugins/topology/topolTest.cpp index 0a670cdf7c5..50a6d4cac27 100644 --- a/src/plugins/topology/topolTest.cpp +++ b/src/plugins/topology/topolTest.cpp @@ -256,10 +256,10 @@ ErrorList topolTest::checkDanglingLines( double tolerance, QgsVectorLayer *layer qDebug() << mFeatureList1.count(); - QgsPoint startPoint; - QgsPoint endPoint; + QgsPointXY startPoint; + QgsPointXY endPoint; - std::multimap endVerticesMap; + std::multimap endVerticesMap; for ( it = mFeatureList1.begin(); it != mFeatureList1.end(); ++it ) { @@ -292,8 +292,8 @@ ErrorList topolTest::checkDanglingLines( double tolerance, QgsVectorLayer *layer startPoint = line[0]; endPoint = line[line.size() - 1]; - endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); - endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); } } @@ -302,17 +302,17 @@ ErrorList topolTest::checkDanglingLines( double tolerance, QgsVectorLayer *layer QgsPolyline polyline = g1.asPolyline(); startPoint = polyline[0]; endPoint = polyline[polyline.size() - 1]; - endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); - endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); } } QgsGeometry canvasExtentPoly = QgsGeometry::fromWkt( qgsInterface->mapCanvas()->extent().asWktPolygon() ); - for ( std::multimap::iterator pointIt = endVerticesMap.begin(), end = endVerticesMap.end(); pointIt != end; pointIt = endVerticesMap.upper_bound( pointIt->first ) ) + for ( std::multimap::iterator pointIt = endVerticesMap.begin(), end = endVerticesMap.end(); pointIt != end; pointIt = endVerticesMap.upper_bound( pointIt->first ) ) { - QgsPoint p = pointIt->first; + QgsPointXY p = pointIt->first; QgsFeatureId k = pointIt->second; size_t repetitions = endVerticesMap.count( p ); @@ -743,10 +743,10 @@ ErrorList topolTest::checkPseudos( double tolerance, QgsVectorLayer *layer1, Qgs qDebug() << mFeatureList1.count(); - QgsPoint startPoint; - QgsPoint endPoint; + QgsPointXY startPoint; + QgsPointXY endPoint; - std::multimap endVerticesMap; + std::multimap endVerticesMap; for ( it = mFeatureList1.begin(); it != mFeatureList1.end(); ++it ) { @@ -779,8 +779,8 @@ ErrorList topolTest::checkPseudos( double tolerance, QgsVectorLayer *layer1, Qgs startPoint = line[0]; endPoint = line[line.size() - 1]; - endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); - endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); } } @@ -789,8 +789,8 @@ ErrorList topolTest::checkPseudos( double tolerance, QgsVectorLayer *layer1, Qgs QgsPolyline polyline = g1.asPolyline(); startPoint = polyline[0]; endPoint = polyline[polyline.size() - 1]; - endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); - endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( startPoint, it->feature.id() ) ); + endVerticesMap.insert( std::pair( endPoint, it->feature.id() ) ); } } @@ -798,9 +798,9 @@ ErrorList topolTest::checkPseudos( double tolerance, QgsVectorLayer *layer1, Qgs QgsGeometry canvasExtentPoly = QgsGeometry::fromWkt( qgsInterface->mapCanvas()->extent().asWktPolygon() ); - for ( std::multimap::iterator pointIt = endVerticesMap.begin(), end = endVerticesMap.end(); pointIt != end; pointIt = endVerticesMap.upper_bound( pointIt->first ) ) + for ( std::multimap::iterator pointIt = endVerticesMap.begin(), end = endVerticesMap.end(); pointIt != end; pointIt = endVerticesMap.upper_bound( pointIt->first ) ) { - QgsPoint p = pointIt->first; + QgsPointXY p = pointIt->first; QgsFeatureId k = pointIt->second; size_t repetitions = endVerticesMap.count( p ); diff --git a/src/plugins/topology/topolTest.h b/src/plugins/topology/topolTest.h index 625e04a4ed9..0db63075bda 100644 --- a/src/plugins/topology/topolTest.h +++ b/src/plugins/topology/topolTest.h @@ -81,7 +81,7 @@ class TopologyRule class PointComparer { public: - bool operator()( const QgsPoint &p1, const QgsPoint &p2 )const + bool operator()( const QgsPointXY &p1, const QgsPointXY &p2 )const { if ( p1.x() < p2.x() ) { diff --git a/src/providers/arcgisrest/qgsamsprovider.cpp b/src/providers/arcgisrest/qgsamsprovider.cpp index ba99c963bb7..e49adab2a7f 100644 --- a/src/providers/arcgisrest/qgsamsprovider.cpp +++ b/src/providers/arcgisrest/qgsamsprovider.cpp @@ -374,7 +374,7 @@ QgsImageFetcher *QgsAmsProvider::getLegendGraphicFetcher( const QgsMapSettings * return new QgsAmsLegendFetcher( this ); } -QgsRasterIdentifyResult QgsAmsProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent, int width, int height, int dpi ) +QgsRasterIdentifyResult QgsAmsProvider::identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent, int width, int height, int dpi ) { // http://resources.arcgis.com/en/help/rest/apiref/identify.html QgsDataSourceUri dataSource( dataSourceUri() ); diff --git a/src/providers/arcgisrest/qgsamsprovider.h b/src/providers/arcgisrest/qgsamsprovider.h index 512545d0111..f64174c338d 100644 --- a/src/providers/arcgisrest/qgsamsprovider.h +++ b/src/providers/arcgisrest/qgsamsprovider.h @@ -83,7 +83,7 @@ class QgsAmsProvider : public QgsRasterDataProvider bool supportsLegendGraphic() const override { return true; } QImage getLegendGraphic( double scale = 0, bool forceRefresh = false, const QgsRectangle *visibleExtent = 0 ) override; QgsImageFetcher *getLegendGraphicFetcher( const QgsMapSettings *mapSettings ) override; - QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; + QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; protected: void readBlock( int bandNo, const QgsRectangle &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback = nullptr ) override; diff --git a/src/providers/arcgisrest/qgsarcgisrestutils.cpp b/src/providers/arcgisrest/qgsarcgisrestutils.cpp index df0db175bb6..f8caaba59a0 100644 --- a/src/providers/arcgisrest/qgsarcgisrestutils.cpp +++ b/src/providers/arcgisrest/qgsarcgisrestutils.cpp @@ -100,7 +100,7 @@ QgsWkbTypes::Type QgsArcGisRestUtils::mapEsriGeometryType( const QString &esriGe return QgsWkbTypes::Unknown; } -static QgsPointV2 *parsePoint( const QVariantList &coordList, QgsWkbTypes::Type pointType ) +static QgsPoint *parsePoint( const QVariantList &coordList, QgsWkbTypes::Type pointType ) { int nCoords = coordList.size(); if ( nCoords < 2 ) @@ -112,19 +112,19 @@ static QgsPointV2 *parsePoint( const QVariantList &coordList, QgsWkbTypes::Type return nullptr; double z = nCoords >= 3 ? coordList[2].toDouble() : 0; double m = nCoords >= 4 ? coordList[3].toDouble() : 0; - return new QgsPointV2( pointType, x, y, z, m ); + return new QgsPoint( pointType, x, y, z, m ); } -static QgsCircularString *parseCircularString( const QVariantMap &curveData, QgsWkbTypes::Type pointType, const QgsPointV2 &startPoint ) +static QgsCircularString *parseCircularString( const QVariantMap &curveData, QgsWkbTypes::Type pointType, const QgsPoint &startPoint ) { QVariantList coordsList = curveData[QStringLiteral( "c" )].toList(); if ( coordsList.isEmpty() ) return nullptr; - QList points; + QList points; points.append( startPoint ); foreach ( const QVariant &coordData, coordsList ) { - QgsPointV2 *point = parsePoint( coordData.toList(), pointType ); + QgsPoint *point = parsePoint( coordData.toList(), pointType ); if ( !point ) { return nullptr; @@ -147,7 +147,7 @@ static QgsCompoundCurve *parseCompoundCurve( const QVariantList &curvesList, Qgs { if ( curveData.type() == QVariant::List ) { - QgsPointV2 *point = parsePoint( curveData.toList(), pointType ); + QgsPoint *point = parsePoint( curveData.toList(), pointType ); if ( !point ) { delete compoundCurve; @@ -191,7 +191,7 @@ static QgsAbstractGeometry *parseEsriGeometryPoint( const QVariantMap &geometryD return nullptr; double z = geometryData[QStringLiteral( "z" )].toDouble(); double m = geometryData[QStringLiteral( "m" )].toDouble(); - return new QgsPointV2( pointType, x, y, z, m ); + return new QgsPoint( pointType, x, y, z, m ); } static QgsAbstractGeometry *parseEsriGeometryMultiPoint( const QVariantMap &geometryData, QgsWkbTypes::Type pointType ) @@ -205,7 +205,7 @@ static QgsAbstractGeometry *parseEsriGeometryMultiPoint( const QVariantMap &geom Q_FOREACH ( const QVariant &coordData, coordsList ) { QVariantList coordList = coordData.toList(); - QgsPointV2 *p = parsePoint( coordList, pointType ); + QgsPoint *p = parsePoint( coordList, pointType ); if ( !p ) { delete multiPoint; @@ -282,11 +282,11 @@ static QgsAbstractGeometry *parseEsriEnvelope( const QVariantMap &geometryData ) if ( !xminOk || !yminOk || !xmaxOk || !ymaxOk ) return nullptr; QgsLineString *ext = new QgsLineString(); - ext->addVertex( QgsPointV2( xmin, ymin ) ); - ext->addVertex( QgsPointV2( xmax, ymin ) ); - ext->addVertex( QgsPointV2( xmax, ymax ) ); - ext->addVertex( QgsPointV2( xmin, ymax ) ); - ext->addVertex( QgsPointV2( xmin, ymin ) ); + ext->addVertex( QgsPoint( xmin, ymin ) ); + ext->addVertex( QgsPoint( xmax, ymin ) ); + ext->addVertex( QgsPoint( xmax, ymax ) ); + ext->addVertex( QgsPoint( xmin, ymax ) ); + ext->addVertex( QgsPoint( xmin, ymin ) ); QgsPolygonV2 *poly = new QgsPolygonV2(); poly->setExteriorRing( ext ); return poly; diff --git a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp index 51c8b809c6a..77351ea3710 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp @@ -246,7 +246,7 @@ bool QgsDelimitedTextFeatureIterator::close() /** * Check to see if the point is within the selection rectangle */ -bool QgsDelimitedTextFeatureIterator::wantGeometry( const QgsPoint &pt ) const +bool QgsDelimitedTextFeatureIterator::wantGeometry( const QgsPointXY &pt ) const { if ( ! mTestGeometry ) return true; return mRequest.filterRect().contains( pt ); @@ -415,7 +415,7 @@ QgsGeometry QgsDelimitedTextFeatureIterator::loadGeometryXY( const QStringList & return QgsGeometry(); } isNull = false; - QgsPoint pt; + QgsPointXY pt; bool ok = QgsDelimitedTextProvider::pointFromXY( sX, sY, pt, mSource->mDecimalPoint, mSource->mXyDms ); if ( ok && wantGeometry( pt ) ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h index 0d7f574e9b6..1a27ed0eaf8 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h +++ b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h @@ -72,7 +72,7 @@ class QgsDelimitedTextFeatureIterator : public QgsAbstractFeatureIteratorFromSou virtual bool close() override; // Tests whether the geometry is required, given that testGeometry is true. - bool wantGeometry( const QgsPoint &point ) const; + bool wantGeometry( const QgsPointXY &point ) const; bool wantGeometry( const QgsGeometry &geom ) const; protected: diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index fd6a8f58a11..3677dfc1a89 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -508,7 +508,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) } else { - QgsPoint pt; + QgsPointXY pt; bool ok = pointFromXY( sX, sY, pt, mDecimalPoint, mXyDms ); if ( ok ) @@ -861,7 +861,7 @@ double QgsDelimitedTextProvider::dmsStringToDouble( const QString &sX, bool *xOk return x; } -bool QgsDelimitedTextProvider::pointFromXY( QString &sX, QString &sY, QgsPoint &pt, const QString &decimalPoint, bool xyDms ) +bool QgsDelimitedTextProvider::pointFromXY( QString &sX, QString &sY, QgsPointXY &pt, const QString &decimalPoint, bool xyDms ) { if ( ! decimalPoint.isEmpty() ) { diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.h b/src/providers/delimitedtext/qgsdelimitedtextprovider.h index e502451dff5..7cf74c0c2b3 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.h +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.h @@ -28,7 +28,7 @@ class QgsFeature; class QgsField; class QgsGeometry; -class QgsPoint; +class QgsPointXY; class QFile; class QTextStream; @@ -203,7 +203,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider static QgsGeometry geomFromWkt( QString &sWkt, bool wktHasPrefixRegexp ); - static bool pointFromXY( QString &sX, QString &sY, QgsPoint &point, const QString &decimalPoint, bool xyDms ); + static bool pointFromXY( QString &sX, QString &sY, QgsPointXY &point, const QString &decimalPoint, bool xyDms ); static double dmsStringToDouble( const QString &sX, bool *xOk ); // mLayerValid defines whether the layer has been loaded as a valid layer diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp index d21fcf13901..37651876040 100644 --- a/src/providers/gdal/qgsgdalprovider.cpp +++ b/src/providers/gdal/qgsgdalprovider.cpp @@ -957,7 +957,7 @@ QString QgsGdalProvider::generateBandName( int bandNumber ) const return QgsRasterDataProvider::generateBandName( bandNumber ); } -QgsRasterIdentifyResult QgsGdalProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) +QgsRasterIdentifyResult QgsGdalProvider::identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) { QgsDebugMsg( QString( "thePoint = %1 %2" ).arg( point.x(), 0, 'g', 10 ).arg( point.y(), 0, 'g', 10 ) ); diff --git a/src/providers/gdal/qgsgdalprovider.h b/src/providers/gdal/qgsgdalprovider.h index 4de5cac1722..10eec447108 100644 --- a/src/providers/gdal/qgsgdalprovider.h +++ b/src/providers/gdal/qgsgdalprovider.h @@ -81,7 +81,7 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase virtual QgsCoordinateReferenceSystem crs() const override; virtual QgsRectangle extent() const override; bool isValid() const override; - QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; + QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; QString lastErrorTitle() override; QString lastError() override; int capabilities() const override; diff --git a/src/providers/gpx/qgsgpxfeatureiterator.cpp b/src/providers/gpx/qgsgpxfeatureiterator.cpp index 273ce1e493c..de537e18346 100644 --- a/src/providers/gpx/qgsgpxfeatureiterator.cpp +++ b/src/providers/gpx/qgsgpxfeatureiterator.cpp @@ -179,7 +179,7 @@ bool QgsGPXFeatureIterator::readWaypoint( const QgsWaypoint &wpt, QgsFeature &fe if ( !mRequest.filterRect().isNull() ) { const QgsRectangle &rect = mRequest.filterRect(); - if ( ! rect.contains( QgsPoint( wpt.lon, wpt.lat ) ) ) + if ( ! rect.contains( QgsPointXY( wpt.lon, wpt.lat ) ) ) return false; } diff --git a/src/providers/grass/qgis.v.in.cpp b/src/providers/grass/qgis.v.in.cpp index 31fa6cf02d1..9338f3e47a9 100644 --- a/src/providers/grass/qgis.v.in.cpp +++ b/src/providers/grass/qgis.v.in.cpp @@ -50,7 +50,7 @@ extern "C" static struct line_pnts *line = Vect_new_line_struct(); -void writePoint( struct Map_info *map, int type, const QgsPoint &point, struct line_cats *cats ) +void writePoint( struct Map_info *map, int type, const QgsPointXY &point, struct line_cats *cats ) { Vect_reset_line( line ); Vect_append_point( line, point.x(), point.y(), 0 ); @@ -60,7 +60,7 @@ void writePoint( struct Map_info *map, int type, const QgsPoint &point, struct l void writePolyline( struct Map_info *map, int type, const QgsPolyline &polyline, struct line_cats *cats ) { Vect_reset_line( line ); - Q_FOREACH ( const QgsPoint &point, polyline ) + Q_FOREACH ( const QgsPointXY &point, polyline ) { Vect_append_point( line, point.x(), point.y(), 0 ); } @@ -258,13 +258,13 @@ int main( int argc, char **argv ) if ( geometryType == QgsWkbTypes::Point ) { - QgsPoint point = geometry.asPoint(); + QgsPointXY point = geometry.asPoint(); writePoint( map, GV_POINT, point, cats ); } else if ( geometryType == QgsWkbTypes::MultiPoint ) { QgsMultiPoint multiPoint = geometry.asMultiPoint(); - Q_FOREACH ( const QgsPoint &point, multiPoint ) + Q_FOREACH ( const QgsPointXY &point, multiPoint ) { writePoint( map, GV_POINT, point, cats ); } @@ -400,7 +400,7 @@ int main( int argc, char **argv ) // TODO: send warning continue; } - QgsPoint point( x, y ); + QgsPointXY point( x, y ); QgsFeature feature( area ); feature.setGeometry( QgsGeometry::fromPoint( point ) ); feature.setValid( true ); @@ -455,7 +455,7 @@ int main( int argc, char **argv ) count = 0; Q_FOREACH ( const QgsFeature ¢roid, centroids.values() ) { - QgsPoint point = centroid.geometry().asPoint(); + QgsPointXY point = centroid.geometry().asPoint(); if ( centroid.attributes().size() > 0 ) { diff --git a/src/providers/grass/qgsgrassgislib.cpp b/src/providers/grass/qgsgrassgislib.cpp index 14e824e8c6c..66f2db90ef4 100644 --- a/src/providers/grass/qgsgrassgislib.cpp +++ b/src/providers/grass/qgsgrassgislib.cpp @@ -1089,7 +1089,7 @@ double QgsGrassGisLib::G_area_of_polygon( const double *x, const double *y, int QgsPolyline polyline; for ( int i = 0; i < n; i++ ) { - polyline.append( QgsPoint( x[i], y[i] ) ); + polyline.append( QgsPointXY( x[i], y[i] ) ); } QgsPolygon polygon; polygon.append( polyline ); @@ -1147,7 +1147,7 @@ double QgsGrassGisLib::distance( double e1, double n1, double e2, double n2 ) { // QgsDistanceArea states that results are in meters, but it does not // seem to be true, - double dist = mDistanceArea.measureLine( QgsPoint( e1, n1 ), QgsPoint( e2, n2 ) ); + double dist = mDistanceArea.measureLine( QgsPointXY( e1, n1 ), QgsPointXY( e2, n2 ) ); if ( !mCrs.isGeographic() ) { dist *= G_database_units_to_meters_factor(); @@ -1198,7 +1198,7 @@ int GRASS_LIB_EXPORT G_set_geodesic_distance_lat2( double lat2 ) double QgsGrassGisLib::G_geodesic_distance_lon_to_lon( double lon1, double lon2 ) { - double dist = mDistanceArea.measureLine( QgsPoint( lon1, mLat1 ), QgsPoint( lon2, mLat2 ) ); + double dist = mDistanceArea.measureLine( QgsPointXY( lon1, mLat1 ), QgsPointXY( lon2, mLat2 ) ); // TODO: not sure about this if ( !mCrs.isGeographic() ) { diff --git a/src/providers/grass/qgsgrassprovider.cpp b/src/providers/grass/qgsgrassprovider.cpp index 1c3577d218d..e33afcbf8c1 100644 --- a/src/providers/grass/qgsgrassprovider.cpp +++ b/src/providers/grass/qgsgrassprovider.cpp @@ -1153,7 +1153,7 @@ void QgsGrassProvider::setPoints( struct line_pnts *points, const QgsAbstractGeo } if ( geometry->wkbType() == QgsWkbTypes::Point || geometry->wkbType() == QgsWkbTypes::PointZ ) { - const QgsPointV2 *point = dynamic_cast( geometry ); + const QgsPoint *point = dynamic_cast( geometry ); if ( point ) { Vect_append_point( points, point->x(), point->y(), point->z() ); @@ -1167,7 +1167,7 @@ void QgsGrassProvider::setPoints( struct line_pnts *points, const QgsAbstractGeo { for ( int i = 0; i < lineString->numPoints(); i++ ) { - QgsPointV2 point = lineString->pointN( i ); + QgsPoint point = lineString->pointN( i ); Vect_append_point( points, point.x(), point.y(), point.z() ); } } @@ -1182,7 +1182,7 @@ void QgsGrassProvider::setPoints( struct line_pnts *points, const QgsAbstractGeo { for ( int i = 0; i < lineString->numPoints(); i++ ) { - QgsPointV2 point = lineString->pointN( i ); + QgsPoint point = lineString->pointN( i ); Vect_append_point( points, point.x(), point.y(), point.z() ); } } diff --git a/src/providers/grass/qgsgrassrasterprovider.cpp b/src/providers/grass/qgsgrassrasterprovider.cpp index 19eb60e3064..0ff9ef0a373 100644 --- a/src/providers/grass/qgsgrassrasterprovider.cpp +++ b/src/providers/grass/qgsgrassrasterprovider.cpp @@ -412,7 +412,7 @@ int QgsGrassRasterProvider::yBlockSize() const int QgsGrassRasterProvider::xSize() const { return mCols; } int QgsGrassRasterProvider::ySize() const { return mRows; } -QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) +QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) { Q_UNUSED( boundingBox ); Q_UNUSED( width ); diff --git a/src/providers/grass/qgsgrassrasterprovider.h b/src/providers/grass/qgsgrassrasterprovider.h index d887dfddb91..f4f470ce953 100644 --- a/src/providers/grass/qgsgrassrasterprovider.h +++ b/src/providers/grass/qgsgrassrasterprovider.h @@ -144,7 +144,7 @@ class GRASS_LIB_EXPORT QgsGrassRasterProvider : public QgsRasterDataProvider bool isValid() const override; - QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; + QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; /** * \brief Returns the caption error text for the last error in this provider diff --git a/src/providers/grass/qgsgrassvectormap.cpp b/src/providers/grass/qgsgrassvectormap.cpp index a4210ac4c54..b1e401c3bcc 100644 --- a/src/providers/grass/qgsgrassvectormap.cpp +++ b/src/providers/grass/qgsgrassvectormap.cpp @@ -640,7 +640,7 @@ QgsAbstractGeometry *QgsGrassVectorMap::lineGeometry( int id ) pointList.reserve( points->n_points ); for ( int i = 0; i < points->n_points; i++ ) { - pointList << QgsPointV2( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, points->x[i], points->y[i], points->z[i] ); + pointList << QgsPoint( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, points->x[i], points->y[i], points->z[i] ); } Vect_destroy_line_struct( points ); @@ -673,7 +673,7 @@ QgsAbstractGeometry *QgsGrassVectorMap::nodeGeometry( int id ) QgsDebugMsgLevel( QString( "id = %1" ).arg( id ), 3 ); double x, y, z; Vect_get_node_coor( mMap, id, &x, &y, &z ); - return new QgsPointV2( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, x, y, z ); + return new QgsPoint( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, x, y, z ); } QgsAbstractGeometry *QgsGrassVectorMap::areaGeometry( int id ) @@ -692,7 +692,7 @@ QgsAbstractGeometry *QgsGrassVectorMap::areaGeometry( int id ) pointList.reserve( points->n_points ); for ( int i = 0; i < points->n_points; i++ ) { - pointList << QgsPointV2( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, points->x[i], points->y[i], points->z[i] ); + pointList << QgsPoint( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, points->x[i], points->y[i], points->z[i] ); } QgsLineString *ring = new QgsLineString(); @@ -709,7 +709,7 @@ QgsAbstractGeometry *QgsGrassVectorMap::areaGeometry( int id ) pointList.reserve( points->n_points ); for ( int i = 0; i < points->n_points; i++ ) { - pointList << QgsPointV2( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, points->x[i], points->y[i], points->z[i] ); + pointList << QgsPoint( is3d() ? QgsWkbTypes::PointZ : QgsWkbTypes::Point, points->x[i], points->y[i], points->z[i] ); } ring = new QgsLineString(); ring->setPoints( pointList ); diff --git a/src/providers/wcs/qgswcsprovider.cpp b/src/providers/wcs/qgswcsprovider.cpp index 707a389299b..576f6a8a99b 100644 --- a/src/providers/wcs/qgswcsprovider.cpp +++ b/src/providers/wcs/qgswcsprovider.cpp @@ -211,7 +211,7 @@ QgsWcsProvider::QgsWcsProvider( const QString &uri ) } double xRes = box.width() / width; double yRes = box.height() / height; - QgsPoint p = box.center(); + QgsPointXY p = box.center(); // width and height different to recognize rotation int requestWidth = 6; @@ -1338,7 +1338,7 @@ QString QgsWcsProvider:: htmlRow( const QString &text1, const QString &text2 ) return "" + htmlCell( text1 ) + htmlCell( text2 ) + ""; } -QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) +QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) { QgsDebugMsg( QString( "thePoint = %1 %2" ).arg( point.x(), 0, 'g', 10 ).arg( point.y(), 0, 'g', 10 ) ); QgsDebugMsg( QString( "theWidth = %1 height = %2" ).arg( width ).arg( height ) ); diff --git a/src/providers/wcs/qgswcsprovider.h b/src/providers/wcs/qgswcsprovider.h index 89202be8f0a..6e7a4051e4e 100644 --- a/src/providers/wcs/qgswcsprovider.h +++ b/src/providers/wcs/qgswcsprovider.h @@ -171,7 +171,7 @@ class QgsWcsProvider : public QgsRasterDataProvider, QgsGdalProviderBase int xSize() const override; int ySize() const override; QString metadata() override; - QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; + QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; QString lastErrorTitle() override; QString lastError() override; QString lastErrorFormat() override; diff --git a/src/providers/wfs/qgswfscapabilities.cpp b/src/providers/wfs/qgswfscapabilities.cpp index d42381bd684..a2261fd2519 100644 --- a/src/providers/wfs/qgswfscapabilities.cpp +++ b/src/providers/wfs/qgswfscapabilities.cpp @@ -394,10 +394,10 @@ void QgsWfsCapabilities::capabilitiesReplyFinished() QgsCoordinateReferenceSystem crsWGS84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( QStringLiteral( "CRS:84" ) ); QgsCoordinateTransform ct( crsWGS84, crs ); - QgsPoint ptMin( featureType.bbox.xMinimum(), featureType.bbox.yMinimum() ); - QgsPoint ptMinBack( ct.transform( ct.transform( ptMin, QgsCoordinateTransform::ForwardTransform ), QgsCoordinateTransform::ReverseTransform ) ); - QgsPoint ptMax( featureType.bbox.xMaximum(), featureType.bbox.yMaximum() ); - QgsPoint ptMaxBack( ct.transform( ct.transform( ptMax, QgsCoordinateTransform::ForwardTransform ), QgsCoordinateTransform::ReverseTransform ) ); + QgsPointXY ptMin( featureType.bbox.xMinimum(), featureType.bbox.yMinimum() ); + QgsPointXY ptMinBack( ct.transform( ct.transform( ptMin, QgsCoordinateTransform::ForwardTransform ), QgsCoordinateTransform::ReverseTransform ) ); + QgsPointXY ptMax( featureType.bbox.xMaximum(), featureType.bbox.yMaximum() ); + QgsPointXY ptMaxBack( ct.transform( ct.transform( ptMax, QgsCoordinateTransform::ForwardTransform ), QgsCoordinateTransform::ReverseTransform ) ); QgsDebugMsg( featureType.bbox.toString() ); QgsDebugMsg( ptMinBack.toString() ); diff --git a/src/providers/wms/qgswmscapabilities.cpp b/src/providers/wms/qgswmscapabilities.cpp index 7e91cd780e4..9f1a285c0d7 100644 --- a/src/providers/wms/qgswmscapabilities.cpp +++ b/src/providers/wms/qgswmscapabilities.cpp @@ -1288,7 +1288,7 @@ void QgsWmsCapabilities::parseTileSetProfile( QDomElement const &e ) Q_ASSERT( l.boundingBoxes.size() == 1 ); m.matrixWidth = ceil( l.boundingBoxes.at( 0 ).box.width() / m.tileWidth / r ); m.matrixHeight = ceil( l.boundingBoxes.at( 0 ).box.height() / m.tileHeight / r ); - m.topLeft = QgsPoint( l.boundingBoxes.at( 0 ).box.xMinimum(), l.boundingBoxes.at( 0 ).box.yMinimum() + m.matrixHeight * m.tileHeight * r ); + m.topLeft = QgsPointXY( l.boundingBoxes.at( 0 ).box.xMinimum(), l.boundingBoxes.at( 0 ).box.yMinimum() + m.matrixHeight * m.tileHeight * r ); m.tres = r; ms.tileMatrices.insert( r, m ); i++; @@ -1422,8 +1422,8 @@ void QgsWmsCapabilities::parseWMTSContents( QDomElement const &e ) if ( ll.size() == 2 && ur.size() == 2 ) { bb.crs = DEFAULT_LATLON_CRS; - bb.box = QgsRectangle( QgsPoint( ll[0].toDouble(), ll[1].toDouble() ), - QgsPoint( ur[0].toDouble(), ur[1].toDouble() ) ); + bb.box = QgsRectangle( QgsPointXY( ll[0].toDouble(), ll[1].toDouble() ), + QgsPointXY( ur[0].toDouble(), ur[1].toDouble() ) ); l.boundingBoxes << bb; } @@ -1438,8 +1438,8 @@ void QgsWmsCapabilities::parseWMTSContents( QDomElement const &e ) if ( ll.size() == 2 && ur.size() == 2 ) { - bb.box = QgsRectangle( QgsPoint( ll[0].toDouble(), ll[1].toDouble() ), - QgsPoint( ur[0].toDouble(), ur[1].toDouble() ) ); + bb.box = QgsRectangle( QgsPointXY( ll[0].toDouble(), ll[1].toDouble() ), + QgsPointXY( ur[0].toDouble(), ur[1].toDouble() ) ); if ( bbox.hasAttribute( QStringLiteral( "SRS" ) ) ) bb.crs = bbox.attribute( QStringLiteral( "SRS" ) ); @@ -1834,8 +1834,8 @@ bool QgsWmsCapabilities::detectTileLayerBoundingBox( QgsWmtsTileLayer &l ) // the magic number below is "standardized rendering pixel size" defined // in WMTS (and WMS 1.3) standard, being 0.28 pixel double res = tm.scaleDenom * 0.00028 / metersPerUnit; - QgsPoint bottomRight( tm.topLeft.x() + res * tm.tileWidth * tm.matrixWidth, - tm.topLeft.y() - res * tm.tileHeight * tm.matrixHeight ); + QgsPointXY bottomRight( tm.topLeft.x() + res * tm.tileWidth * tm.matrixWidth, + tm.topLeft.y() - res * tm.tileHeight * tm.matrixHeight ); QgsDebugMsg( QString( "detecting WMTS layer bounding box: tileset %1 matrix %2 crs %3 res %4" ) .arg( tmsIt->identifier, tm.identifier, tmsIt->crs ).arg( res ) ); diff --git a/src/providers/wms/qgswmscapabilities.h b/src/providers/wms/qgswmscapabilities.h index 1ecef463fff..04f5d0339fc 100644 --- a/src/providers/wms/qgswmscapabilities.h +++ b/src/providers/wms/qgswmscapabilities.h @@ -317,7 +317,7 @@ struct QgsWmtsTileMatrix QString title, abstract; QStringList keywords; double scaleDenom; - QgsPoint topLeft; //!< Top-left corner of the tile matrix in map units + QgsPointXY topLeft; //!< Top-left corner of the tile matrix in map units int tileWidth; //!< Width of a tile in pixels int tileHeight; //!< Height of a tile in pixels int matrixWidth; //!< Number of tiles horizontally diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 4e49abdaf6a..0d27c8e2d4a 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -83,7 +83,7 @@ QMap QgsWmsStatistics::sData; //! a helper class for ordering tile requests according to the distance from view center struct LessThanTileRequest { - QgsPoint center; + QgsPointXY center; bool operator()( const QgsWmsProvider::TileRequest &req1, const QgsWmsProvider::TileRequest &req2 ) { QPointF p1 = req1.rect.center(); @@ -656,7 +656,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in // this is an ordinary WMS server, but the user requested tiled approach // so we will pretend it is a WMS-C server with just one tile matrix tempTm.reset( new QgsWmtsTileMatrix ); - tempTm->topLeft = QgsPoint( mLayerExtent.xMinimum(), mLayerExtent.yMaximum() ); + tempTm->topLeft = QgsPointXY( mLayerExtent.xMinimum(), mLayerExtent.yMaximum() ); tempTm->tileWidth = mSettings.mMaxWidth; tempTm->tileHeight = mSettings.mMaxHeight; tempTm->matrixWidth = ceil( mLayerExtent.width() / mSettings.mMaxWidth / vres ); @@ -1189,10 +1189,10 @@ void QgsWmsProvider::setupXyzCapabilities( const QString &uri ) // the whole world is projected to a square: // X going from 180 W to 180 E // Y going from ~85 N to ~85 S (=atan(sinh(pi)) ... to get a square) - QgsPoint topLeftLonLat( -180, 180.0 / M_PI * atan( sinh( M_PI ) ) ); - QgsPoint bottomRightLonLat( 180, 180.0 / M_PI * atan( sinh( -M_PI ) ) ); - QgsPoint topLeft = ct.transform( topLeftLonLat ); - QgsPoint bottomRight = ct.transform( bottomRightLonLat ); + QgsPointXY topLeftLonLat( -180, 180.0 / M_PI * atan( sinh( M_PI ) ) ); + QgsPointXY bottomRightLonLat( 180, 180.0 / M_PI * atan( sinh( -M_PI ) ) ); + QgsPointXY topLeft = ct.transform( topLeftLonLat ); + QgsPointXY bottomRight = ct.transform( bottomRightLonLat ); double xspan = ( bottomRight.x() - topLeft.x() ); QgsWmsBoundingBoxProperty bbox; @@ -2372,7 +2372,7 @@ QString QgsWmsProvider::metadata() return metadata; } -QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) +QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ ) { QgsDebugMsg( QString( "format = %1" ).arg( format ) ); @@ -2470,7 +2470,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint &point, QgsRast QgsDebugMsg( QString( "theWidth = %1 height = %2" ).arg( width ).arg( height ) ); QgsDebugMsg( QString( "xRes = %1 yRes = %2" ).arg( xRes ).arg( yRes ) ); - QgsPoint finalPoint; + QgsPointXY finalPoint; finalPoint.setX( floor( ( finalPoint.x() - myExtent.xMinimum() ) / xRes ) ); finalPoint.setY( floor( ( myExtent.yMaximum() - finalPoint.y() ) / yRes ) ); diff --git a/src/providers/wms/qgswmsprovider.h b/src/providers/wms/qgswmsprovider.h index 4886fd743a2..1422b4e363a 100644 --- a/src/providers/wms/qgswmsprovider.h +++ b/src/providers/wms/qgswmsprovider.h @@ -200,7 +200,7 @@ class QgsWmsProvider : public QgsRasterDataProvider Qgis::DataType sourceDataType( int bandNo ) const override; int bandCount() const override; QString metadata() override; - QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; + QgsRasterIdentifyResult identify( const QgsPointXY &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 ) override; QString lastErrorTitle() override; QString lastError() override; QString lastErrorFormat() override; @@ -350,7 +350,7 @@ class QgsWmsProvider : public QgsRasterDataProvider */ QUrl getLegendGraphicFullURL( double scale, const QgsRectangle &visibleExtent ); - //QStringList identifyAs( const QgsPoint &point, QString format ); + //QStringList identifyAs( const QgsPointXY &point, QString format ); QString layerMetadata( QgsWmsLayerProperty &layer ); diff --git a/src/server/qgswmsconfigparser.cpp b/src/server/qgswmsconfigparser.cpp index a06f9a1531d..1343d3acb55 100644 --- a/src/server/qgswmsconfigparser.cpp +++ b/src/server/qgswmsconfigparser.cpp @@ -413,7 +413,7 @@ QgsVectorLayer *QgsWmsConfigParser::createHighlightLayer( int i, const QString & QgsGeometry point = geom.pointOnSurface(); if ( point ) { - QgsPoint pt = point.asPoint(); + QgsPointXY pt = point.asPoint(); fet.setAttribute( 1, pt.x() ); fet.setAttribute( 2, pt.y() ); fet.setAttribute( 3, "Center" ); diff --git a/src/server/services/wms/qgswmsrenderer.cpp b/src/server/services/wms/qgswmsrenderer.cpp index 3187eef8d08..02a20f9aa40 100644 --- a/src/server/services/wms/qgswmsrenderer.cpp +++ b/src/server/services/wms/qgswmsrenderer.cpp @@ -900,7 +900,7 @@ namespace QgsWms return image.release(); } - static void infoPointToMapCoordinates( int i, int j, QgsPoint *infoPoint, const QgsMapSettings &mapSettings ) + static void infoPointToMapCoordinates( int i, int j, QgsPointXY *infoPoint, const QgsMapSettings &mapSettings ) { //check if i, j are in the pixel range of the image if ( i < 0 || i > mapSettings.outputSize().width() || j < 0 || j > mapSettings.outputSize().height() ) @@ -999,7 +999,7 @@ namespace QgsWms //However, in order to make attribute only queries via the FILTER parameter, it is allowed to skip them if the FILTER parameter is there std::unique_ptr featuresRect; - std::unique_ptr infoPoint; + std::unique_ptr infoPoint; if ( i == -1 || j == -1 ) { @@ -1015,7 +1015,7 @@ namespace QgsWms } else { - infoPoint.reset( new QgsPoint() ); + infoPoint.reset( new QgsPointXY() ); infoPointToMapCoordinates( i, j, infoPoint.get(), mapSettings ); } @@ -1163,7 +1163,7 @@ namespace QgsWms { continue; } - QgsPoint layerInfoPoint = mapSettings.mapToLayerCoordinates( currentLayer, *( infoPoint.get() ) ); + QgsPointXY layerInfoPoint = mapSettings.mapToLayerCoordinates( currentLayer, *( infoPoint.get() ) ); if ( !featureInfoFromRasterLayer( rasterLayer, mapSettings, &layerInfoPoint, result, layerElement, version, infoFormat ) ) { continue; @@ -1520,7 +1520,7 @@ namespace QgsWms } bool QgsRenderer::featureInfoFromVectorLayer( QgsVectorLayer *layer, - const QgsPoint *infoPoint, + const QgsPointXY *infoPoint, int nFeatures, QDomDocument &infoDocument, QDomElement &layerElement, @@ -1774,7 +1774,7 @@ namespace QgsWms bool QgsRenderer::featureInfoFromRasterLayer( QgsRasterLayer *layer, const QgsMapSettings &mapSettings, - const QgsPoint *infoPoint, + const QgsPointXY *infoPoint, QDomDocument &infoDocument, QDomElement &layerElement, const QString &version, @@ -2680,7 +2680,7 @@ namespace QgsWms return WMSPrecision; } - QgsRectangle QgsRenderer::featureInfoSearchRect( QgsVectorLayer *ml, const QgsMapSettings &mapSettings, const QgsRenderContext &rct, const QgsPoint &infoPoint ) const + QgsRectangle QgsRenderer::featureInfoSearchRect( QgsVectorLayer *ml, const QgsMapSettings &mapSettings, const QgsRenderContext &rct, const QgsPointXY &infoPoint ) const { if ( !ml ) { diff --git a/src/server/services/wms/qgswmsrenderer.h b/src/server/services/wms/qgswmsrenderer.h index bf7c001ff4e..c0871ada80f 100644 --- a/src/server/services/wms/qgswmsrenderer.h +++ b/src/server/services/wms/qgswmsrenderer.h @@ -37,7 +37,7 @@ class QgsFeature; class QgsFeatureRenderer; class QgsMapLayer; class QgsMapSettings; -class QgsPoint; +class QgsPointXY; class QgsRasterLayer; class QgsRasterRenderer; class QgsRectangle; @@ -203,7 +203,7 @@ namespace QgsWms \param featureBBox the bounding box of the selected features in output CRS \returns true in case of success*/ bool featureInfoFromVectorLayer( QgsVectorLayer *layer, - const QgsPoint *infoPoint, + const QgsPointXY *infoPoint, int nFeatures, QDomDocument &infoDocument, QDomElement &layerElement, @@ -215,7 +215,7 @@ namespace QgsWms //! Appends feature info xml for the layer to the layer element of the dom document bool featureInfoFromRasterLayer( QgsRasterLayer *layer, const QgsMapSettings &mapSettings, - const QgsPoint *infoPoint, + const QgsPointXY *infoPoint, QDomDocument &infoDocument, QDomElement &layerElement, const QString &version, @@ -298,7 +298,7 @@ namespace QgsWms //! Replaces attribute value with ValueRelation or ValueRelation if defined. Otherwise returns the original value static QString replaceValueMapAndRelation( QgsVectorLayer *vl, int idx, const QString &attributeVal ); //! Gets layer search rectangle (depending on request parameter, layer type, map and layer crs) - QgsRectangle featureInfoSearchRect( QgsVectorLayer *ml, const QgsMapSettings &ms, const QgsRenderContext &rct, const QgsPoint &infoPoint ) const; + QgsRectangle featureInfoSearchRect( QgsVectorLayer *ml, const QgsMapSettings &ms, const QgsRenderContext &rct, const QgsPointXY &infoPoint ) const; private: diff --git a/tests/scripts/sipifyheader.expected.sip b/tests/scripts/sipifyheader.expected.sip index 14da89067f2..e95d1143245 100644 --- a/tests/scripts/sipifyheader.expected.sip +++ b/tests/scripts/sipifyheader.expected.sip @@ -131,7 +131,7 @@ Default constructor bool operator==( const QgsSipifyHeader other ); - void multilineMethod( const QgsPoint &startPoint, + void multilineMethod( const QgsPointXY &startPoint, QgsFeatureId featureId, QgsVectorLayer *vl, QgsSnappingResult::SnappingType snap_to ) const; @@ -335,7 +335,7 @@ remove argument } else { - sipCpp = new sipQgsPointV2( a0, a1, a2, a3, a4 ); + sipCpp = new sipQgsPoint( a0, a1, a2, a3, a4 ); } %End diff --git a/tests/scripts/sipifyheader.h b/tests/scripts/sipifyheader.h index c4f3d971f0f..278ecfb5f0e 100644 --- a/tests/scripts/sipifyheader.h +++ b/tests/scripts/sipifyheader.h @@ -178,7 +178,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass, private Ui::QgsBas bool operator==( const QgsSipifyHeader other ); //! A multiline method signature - void multilineMethod( const QgsPoint &startPoint, + void multilineMethod( const QgsPointXY &startPoint, QgsFeatureId featureId, QgsVectorLayer *vl, QgsSnappingResult::SnappingType snap_to ) const; @@ -372,7 +372,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass, private Ui::QgsBas } else { - sipCpp = new sipQgsPointV2( a0, a1, a2, a3, a4 ); + sipCpp = new sipQgsPoint( a0, a1, a2, a3, a4 ); } % End #endif diff --git a/tests/src/app/testqgisappclipboard.cpp b/tests/src/app/testqgisappclipboard.cpp index 38220b58d30..e4b8c293e06 100644 --- a/tests/src/app/testqgisappclipboard.cpp +++ b/tests/src/app/testqgisappclipboard.cpp @@ -130,11 +130,11 @@ void TestQgisAppClipboard::copyToText() QgsFeature feat( fields, 5 ); feat.setAttribute( QStringLiteral( "int_field" ), 9 ); feat.setAttribute( QStringLiteral( "string_field" ), "val" ); - feat.setGeometry( QgsGeometry( new QgsPointV2( 5, 6 ) ) ); + feat.setGeometry( QgsGeometry( new QgsPoint( 5, 6 ) ) ); QgsFeature feat2( fields, 6 ); feat2.setAttribute( QStringLiteral( "int_field" ), 19 ); feat2.setAttribute( QStringLiteral( "string_field" ), "val2" ); - feat2.setGeometry( QgsGeometry( new QgsPointV2( 7, 8 ) ) ); + feat2.setGeometry( QgsGeometry( new QgsPoint( 7, 8 ) ) ); QgsFeatureStore feats; feats.addFeature( feat ); feats.addFeature( feat2 ); @@ -180,7 +180,7 @@ void TestQgisAppClipboard::copyToText() QgsCoordinateReferenceSystem crs( 3111, QgsCoordinateReferenceSystem::EpsgCrsId ); feats = QgsFeatureStore(); feats.setCrs( crs ); - feat.setGeometry( QgsGeometry( new QgsPointV2( 2502577, 2403869 ) ) ); + feat.setGeometry( QgsGeometry( new QgsPoint( 2502577, 2403869 ) ) ); feats.addFeature( feat ); feats.setFields( fields ); mQgisApp->clipboard()->replaceWithCopyOf( feats ); @@ -210,12 +210,12 @@ void TestQgisAppClipboard::pasteWkt() QVERIFY( features.at( 0 ).hasGeometry() && !features.at( 0 ).geometry().isNull() ); QCOMPARE( features.at( 0 ).geometry().geometry()->wkbType(), QgsWkbTypes::Point ); QgsGeometry featureGeom = features.at( 0 ).geometry(); - const QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( featureGeom.geometry() ); + const QgsPoint *point = dynamic_cast< QgsPoint * >( featureGeom.geometry() ); QCOMPARE( point->x(), 125.0 ); QCOMPARE( point->y(), 10.0 ); QVERIFY( features.at( 1 ).hasGeometry() && !features.at( 1 ).geometry().isNull() ); QCOMPARE( features.at( 1 ).geometry().geometry()->wkbType(), QgsWkbTypes::Point ); - point = dynamic_cast< QgsPointV2 * >( features.at( 1 ).geometry().geometry() ); + point = dynamic_cast< QgsPoint * >( features.at( 1 ).geometry().geometry() ); QCOMPARE( point->x(), 111.0 ); QCOMPARE( point->y(), 30.0 ); } @@ -231,7 +231,7 @@ void TestQgisAppClipboard::pasteGeoJson() QVERIFY( features.at( 0 ).hasGeometry() && !features.at( 0 ).geometry().isNull() ); QCOMPARE( features.at( 0 ).geometry().geometry()->wkbType(), QgsWkbTypes::Point ); QgsGeometry featureGeom = features.at( 0 ).geometry(); - const QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( featureGeom.geometry() ); + const QgsPoint *point = dynamic_cast< QgsPoint * >( featureGeom.geometry() ); QCOMPARE( point->x(), 125.0 ); QCOMPARE( point->y(), 10.0 ); QCOMPARE( features.at( 0 ).attribute( "name" ).toString(), QString( "Dinagat Islands" ) ); diff --git a/tests/src/app/testqgsattributetable.cpp b/tests/src/app/testqgsattributetable.cpp index 61c4d1ca40b..cc2a0bc1050 100644 --- a/tests/src/app/testqgsattributetable.cpp +++ b/tests/src/app/testqgsattributetable.cpp @@ -93,7 +93,7 @@ void TestQgsAttributeTable::testFieldCalculation() f1.setAttribute( QStringLiteral( "pk" ), 1 ); f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline line3111; - line3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ); + line3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ); QgsGeometry line3111G = QgsGeometry::fromPolyline( line3111 ) ; f1.setGeometry( line3111G ); tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 ); @@ -141,7 +141,7 @@ void TestQgsAttributeTable::testFieldCalculationArea() f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline polygonRing3111; - polygonRing3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ) << QgsPoint( 2520109, 2397715 ) << QgsPoint( 2520792, 2425494 ) << QgsPoint( 2484588, 2425722 ); + polygonRing3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ) << QgsPointXY( 2520109, 2397715 ) << QgsPointXY( 2520792, 2425494 ) << QgsPointXY( 2484588, 2425722 ); QgsPolygon polygon3111; polygon3111 << polygonRing3111; QgsGeometry polygon3111G = QgsGeometry::fromPolygon( polygon3111 ); diff --git a/tests/src/app/testqgsfieldcalculator.cpp b/tests/src/app/testqgsfieldcalculator.cpp index 499838f28ea..ab0478301d4 100644 --- a/tests/src/app/testqgsfieldcalculator.cpp +++ b/tests/src/app/testqgsfieldcalculator.cpp @@ -79,7 +79,7 @@ void TestQgsFieldCalculator::testLengthCalculations() f1.setAttribute( QStringLiteral( "pk" ), 1 ); f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline line3111; - line3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ); + line3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ); QgsGeometry line3111G = QgsGeometry::fromPolyline( line3111 ) ; f1.setGeometry( line3111G ); tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 ); @@ -138,7 +138,7 @@ void TestQgsFieldCalculator::testAreaCalculations() f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline polygonRing3111; - polygonRing3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ) << QgsPoint( 2520109, 2397715 ) << QgsPoint( 2520792, 2425494 ) << QgsPoint( 2484588, 2425722 ); + polygonRing3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ) << QgsPointXY( 2520109, 2397715 ) << QgsPointXY( 2520792, 2425494 ) << QgsPointXY( 2484588, 2425722 ); QgsPolygon polygon3111; polygon3111 << polygonRing3111; QgsGeometry polygon3111G = QgsGeometry::fromPolygon( polygon3111 ) ; diff --git a/tests/src/app/testqgsmaptoolidentifyaction.cpp b/tests/src/app/testqgsmaptoolidentifyaction.cpp index a46224d4d4b..8f3ff2920a6 100644 --- a/tests/src/app/testqgsmaptoolidentifyaction.cpp +++ b/tests/src/app/testqgsmaptoolidentifyaction.cpp @@ -122,7 +122,7 @@ void TestQgsMapToolIdentifyAction::lengthCalculation() f1.setAttribute( QStringLiteral( "pk" ), 1 ); f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline line3111; - line3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ); + line3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ); QgsGeometry line3111G = QgsGeometry::fromPolyline( line3111 ) ; f1.setGeometry( line3111G ); tempLayer->dataProvider()->addFeatures( QgsFeatureList() << f1 ); @@ -135,7 +135,7 @@ void TestQgsMapToolIdentifyAction::lengthCalculation() QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) ); QgsProject::instance()->setDistanceUnits( QgsUnitTypes::DistanceMeters ); - QgsPoint mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); + QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); std::unique_ptr< QgsMapToolIdentifyAction > action( new QgsMapToolIdentifyAction( canvas ) ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << tempLayer.get() ); @@ -173,7 +173,7 @@ void TestQgsMapToolIdentifyAction::perimeterCalculation() f1.setAttribute( QStringLiteral( "pk" ), 1 ); f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline polygonRing3111; - polygonRing3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ) << QgsPoint( 2520109, 2397715 ) << QgsPoint( 2520792, 2425494 ) << QgsPoint( 2484588, 2425722 ); + polygonRing3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ) << QgsPointXY( 2520109, 2397715 ) << QgsPointXY( 2520792, 2425494 ) << QgsPointXY( 2484588, 2425722 ); QgsPolygon polygon3111; polygon3111 << polygonRing3111; QgsGeometry polygon3111G = QgsGeometry::fromPolygon( polygon3111 ) ; @@ -188,7 +188,7 @@ void TestQgsMapToolIdentifyAction::perimeterCalculation() QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) ); QgsProject::instance()->setDistanceUnits( QgsUnitTypes::DistanceMeters ); - QgsPoint mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); + QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); std::unique_ptr< QgsMapToolIdentifyAction > action( new QgsMapToolIdentifyAction( canvas ) ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << tempLayer.get() ); @@ -227,7 +227,7 @@ void TestQgsMapToolIdentifyAction::areaCalculation() f1.setAttribute( QStringLiteral( "col1" ), 0.0 ); QgsPolyline polygonRing3111; - polygonRing3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ) << QgsPoint( 2520109, 2397715 ) << QgsPoint( 2520792, 2425494 ) << QgsPoint( 2484588, 2425722 ); + polygonRing3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ) << QgsPointXY( 2520109, 2397715 ) << QgsPointXY( 2520792, 2425494 ) << QgsPointXY( 2484588, 2425722 ); QgsPolygon polygon3111; polygon3111 << polygonRing3111; QgsGeometry polygon3111G = QgsGeometry::fromPolygon( polygon3111 ) ; @@ -242,7 +242,7 @@ void TestQgsMapToolIdentifyAction::areaCalculation() QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) ); QgsProject::instance()->setAreaUnits( QgsUnitTypes::AreaSquareMeters ); - QgsPoint mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); + QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 2484588, 2425722 ); std::unique_ptr< QgsMapToolIdentifyAction > action( new QgsMapToolIdentifyAction( canvas ) ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << tempLayer.get() ); @@ -273,7 +273,7 @@ void TestQgsMapToolIdentifyAction::areaCalculation() QString TestQgsMapToolIdentifyAction::testIdentifyRaster( QgsRasterLayer *layer, double xGeoref, double yGeoref ) { std::unique_ptr< QgsMapToolIdentifyAction > action( new QgsMapToolIdentifyAction( canvas ) ); - QgsPoint mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); + QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << layer ); if ( result.length() != 1 ) return QLatin1String( "" ); @@ -285,7 +285,7 @@ QList TestQgsMapToolIdentifyAction::testIdentifyVector( QgsVectorLayer *layer, double xGeoref, double yGeoref ) { std::unique_ptr< QgsMapToolIdentifyAction > action( new QgsMapToolIdentifyAction( canvas ) ); - QgsPoint mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); + QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); QList result = action->identify( mapPoint.x(), mapPoint.y(), QList() << layer ); return result; } diff --git a/tests/src/app/testqgsmaptoolselect.cpp b/tests/src/app/testqgsmaptoolselect.cpp index 31cf97f063a..d1f0268cbcb 100644 --- a/tests/src/app/testqgsmaptoolselect.cpp +++ b/tests/src/app/testqgsmaptoolselect.cpp @@ -109,7 +109,7 @@ QgsFeatureList TestQgsMapToolSelect::testSelectVector( QgsVectorLayer *layer, double xGeoref, double yGeoref ) { std::unique_ptr< QgsMapToolSelect > tool( new QgsMapToolSelect( canvas ) ); - QgsPoint mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); + QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( xGeoref, yGeoref ); // make given vector layer current canvas->setCurrentLayer( layer ); diff --git a/tests/src/app/testqgsmeasuretool.cpp b/tests/src/app/testqgsmeasuretool.cpp index 21f46e207fe..076cda2f104 100644 --- a/tests/src/app/testqgsmeasuretool.cpp +++ b/tests/src/app/testqgsmeasuretool.cpp @@ -103,8 +103,8 @@ void TestQgsMeasureTool::testLengthCalculation() std::unique_ptr< QgsMeasureDialog > dlg( new QgsMeasureDialog( tool.get() ) ); tool->restart(); - tool->addPoint( QgsPoint( 2484588, 2425722 ) ); - tool->addPoint( QgsPoint( 2482767, 2398853 ) ); + tool->addPoint( QgsPointXY( 2484588, 2425722 ) ); + tool->addPoint( QgsPointXY( 2482767, 2398853 ) ); //force dialog recalculation dlg->addPoint(); @@ -120,8 +120,8 @@ void TestQgsMeasureTool::testLengthCalculation() std::unique_ptr< QgsMeasureDialog > dlg2( new QgsMeasureDialog( tool2.get() ) ); tool2->restart(); - tool2->addPoint( QgsPoint( 2484588, 2425722 ) ); - tool2->addPoint( QgsPoint( 2482767, 2398853 ) ); + tool2->addPoint( QgsPointXY( 2484588, 2425722 ) ); + tool2->addPoint( QgsPointXY( 2482767, 2398853 ) ); //force dialog recalculation dlg2->addPoint(); @@ -136,13 +136,13 @@ void TestQgsMeasureTool::testLengthCalculation() QgsCoordinateTransform ct( srs, srs2 ); - QgsPoint p0 = ct.transform( tool2->points()[0] ); - QgsPoint p1 = ct.transform( tool2->points()[1] ); + QgsPointXY p0 = ct.transform( tool2->points()[0] ); + QgsPointXY p1 = ct.transform( tool2->points()[1] ); mCanvas->setDestinationCrs( srs2 ); - QgsPoint n0 = tool2->points()[0]; - QgsPoint n1 = tool2->points()[1]; + QgsPointXY n0 = tool2->points()[0]; + QgsPointXY n1 = tool2->points()[1]; QGSCOMPARENEAR( p0.x(), n0.x(), 0.001 ); QGSCOMPARENEAR( p0.y(), n0.y(), 0.001 ); @@ -165,8 +165,8 @@ void TestQgsMeasureTool::testLengthCalculationNoCrs() std::unique_ptr< QgsMeasureDialog > dlg( new QgsMeasureDialog( tool.get() ) ); tool->restart(); - tool->addPoint( QgsPoint( 2484588, 2425722 ) ); - tool->addPoint( QgsPoint( 2482767, 2398853 ) ); + tool->addPoint( QgsPointXY( 2484588, 2425722 ) ); + tool->addPoint( QgsPointXY( 2482767, 2398853 ) ); //force dialog recalculation dlg->addPoint(); @@ -195,10 +195,10 @@ void TestQgsMeasureTool::testAreaCalculation() std::unique_ptr< QgsMeasureDialog > dlg( new QgsMeasureDialog( tool.get() ) ); tool->restart(); - tool->addPoint( QgsPoint( 2484588, 2425722 ) ); - tool->addPoint( QgsPoint( 2482767, 2398853 ) ); - tool->addPoint( QgsPoint( 2520109, 2397715 ) ); - tool->addPoint( QgsPoint( 2520792, 2425494 ) ); + tool->addPoint( QgsPointXY( 2484588, 2425722 ) ); + tool->addPoint( QgsPointXY( 2482767, 2398853 ) ); + tool->addPoint( QgsPointXY( 2520109, 2397715 ) ); + tool->addPoint( QgsPointXY( 2520792, 2425494 ) ); //force dialog recalculation dlg->addPoint(); @@ -214,10 +214,10 @@ void TestQgsMeasureTool::testAreaCalculation() std::unique_ptr< QgsMeasureDialog > dlg2( new QgsMeasureDialog( tool2.get() ) ); tool2->restart(); - tool2->addPoint( QgsPoint( 2484588, 2425722 ) ); - tool2->addPoint( QgsPoint( 2482767, 2398853 ) ); - tool2->addPoint( QgsPoint( 2520109, 2397715 ) ); - tool2->addPoint( QgsPoint( 2520792, 2425494 ) ); + tool2->addPoint( QgsPointXY( 2484588, 2425722 ) ); + tool2->addPoint( QgsPointXY( 2482767, 2398853 ) ); + tool2->addPoint( QgsPointXY( 2520109, 2397715 ) ); + tool2->addPoint( QgsPointXY( 2520792, 2425494 ) ); //force dialog recalculation dlg2->addPoint(); diff --git a/tests/src/app/testqgsnodetool.cpp b/tests/src/app/testqgsnodetool.cpp index e4d16fe07d0..a2382763bda 100644 --- a/tests/src/app/testqgsnodetool.cpp +++ b/tests/src/app/testqgsnodetool.cpp @@ -67,7 +67,7 @@ class TestQgsNodeTool : public QObject private: QPoint mapToScreen( double mapX, double mapY ) { - QgsPoint pt = mCanvas->mapSettings().mapToPixel().transform( mapX, mapY ); + QgsPointXY pt = mCanvas->mapSettings().mapToPixel().transform( mapX, mapY ); return QPoint( qRound( pt.x() ), qRound( pt.y() ) ); } @@ -151,19 +151,19 @@ void TestQgsNodeTool::initTestCase() QgsProject::instance()->addMapLayers( QList() << mLayerLine << mLayerPolygon << mLayerPoint ); QgsPolyline line1; - line1 << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) << QgsPoint( 1, 3 ); + line1 << QgsPointXY( 2, 1 ) << QgsPointXY( 1, 1 ) << QgsPointXY( 1, 3 ); QgsFeature lineF1; lineF1.setGeometry( QgsGeometry::fromPolyline( line1 ) ); QgsPolygon polygon1; QgsPolyline polygon1exterior; - polygon1exterior << QgsPoint( 4, 1 ) << QgsPoint( 7, 1 ) << QgsPoint( 7, 4 ) << QgsPoint( 4, 4 ) << QgsPoint( 4, 1 ); + polygon1exterior << QgsPointXY( 4, 1 ) << QgsPointXY( 7, 1 ) << QgsPointXY( 7, 4 ) << QgsPointXY( 4, 4 ) << QgsPointXY( 4, 1 ); polygon1 << polygon1exterior; QgsFeature polygonF1; polygonF1.setGeometry( QgsGeometry::fromPolygon( polygon1 ) ); QgsFeature pointF1; - pointF1.setGeometry( QgsGeometry::fromPoint( QgsPoint( 2, 3 ) ) ); + pointF1.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 2, 3 ) ) ); mLayerLine->startEditing(); mLayerLine->addFeature( lineF1 ); diff --git a/tests/src/core/testqgsconnectionpool.cpp b/tests/src/core/testqgsconnectionpool.cpp index 0f773aafb09..1f826e87b1c 100644 --- a/tests/src/core/testqgsconnectionpool.cpp +++ b/tests/src/core/testqgsconnectionpool.cpp @@ -116,7 +116,7 @@ void TestQgsConnectionPool::layersFromSameDatasetGPX() for ( int i = 0, n = layer1Features.count(); i < n; ++i ) { QgsGeometry featureGeom = layer1Features[i].geometry(); - const QgsPointV2 *geom = dynamic_cast( featureGeom.geometry() ); + const QgsPoint *geom = dynamic_cast( featureGeom.geometry() ); QVERIFY( geom != nullptr ); QVERIFY( qFuzzyCompare( geom->x(), i ) ); QVERIFY( qFuzzyCompare( geom->y(), i ) ); @@ -130,7 +130,7 @@ void TestQgsConnectionPool::layersFromSameDatasetGPX() QVERIFY( nVtx == nRoutePts ); for ( int j = 0; j < nVtx; ++j ) { - QgsPointV2 p = geom->vertexAt( QgsVertexId( 0, 0, j ) ); + QgsPoint p = geom->vertexAt( QgsVertexId( 0, 0, j ) ); QVERIFY( qFuzzyCompare( p.x(), j ) ); QVERIFY( qFuzzyCompare( p.y(), i ) ); } diff --git a/tests/src/core/testqgsdistancearea.cpp b/tests/src/core/testqgsdistancearea.cpp index 859f7d044ab..463752d9936 100644 --- a/tests/src/core/testqgsdistancearea.cpp +++ b/tests/src/core/testqgsdistancearea.cpp @@ -67,7 +67,7 @@ void TestQgsDistanceArea::cleanupTestCase() void TestQgsDistanceArea::basic() { - QgsPoint p1( 1.0, 3.0 ), p2( -2.0, -1.0 ); + QgsPointXY p1( 1.0, 3.0 ), p2( -2.0, -1.0 ); QgsDistanceArea daA; double resultA, resultB, resultC; @@ -172,7 +172,7 @@ void TestQgsDistanceArea::test_distances() // Column 3 is latitude point 2 // Column 4 is longitude point 3 // Column 6 is the resulting distance in meters on the WGS84 ellipsoid - // Note: lat is north/south, so the QgsPoint should be ( long, lat ) + // Note: lat is north/south, so the QgsPointXY should be ( long, lat ) // See http://geographiclib.sourceforge.net/html/geodesic.html#testgeod // Set up DA @@ -199,8 +199,8 @@ void TestQgsDistanceArea::test_distances() { QStringList myLineList = line.split( ' ' ); // Split fields on space. // Create points - QgsPoint p1( myLineList[1].toDouble(), myLineList[0].toDouble() ); - QgsPoint p2( myLineList[4].toDouble(), myLineList[3].toDouble() ); + QgsPointXY p1( myLineList[1].toDouble(), myLineList[0].toDouble() ); + QgsPointXY p2( myLineList[4].toDouble(), myLineList[3].toDouble() ); double result = myDa.measureLine( p1, p2 ); // QgsDebugMsg( QString( "Distance from %1 to %2 is %3" ).arg( p1.toString( 15 ) ).arg( p2.toString( 15 ) ).arg( result, 0, 'g', 15 ) ); // QgsDebugMsg( QString( "Distance should be %1" ).arg( myLineList[6] ) ); @@ -259,8 +259,8 @@ void TestQgsDistanceArea::measureUnits() calc.setEllipsoid( QStringLiteral( "NONE" ) ); calc.setSourceCrs( QgsCoordinateReferenceSystem::fromSrsId( 254L ) ); QgsUnitTypes::DistanceUnit units; - QgsPoint p1( 1341683.9854275715, 408256.9562717728 ); - QgsPoint p2( 1349321.7807031618, 408256.9562717728 ); + QgsPointXY p1( 1341683.9854275715, 408256.9562717728 ); + QgsPointXY p2( 1349321.7807031618, 408256.9562717728 ); double result = calc.measureLine( p1, p2 ); units = calc.lengthUnits(); @@ -284,13 +284,13 @@ void TestQgsDistanceArea::measureAreaAndUnits() QgsCoordinateReferenceSystem daCRS; daCRS.createFromSrsId( da.sourceCrs().srsid() ); QgsPolyline ring; - ring << QgsPoint( 0, 0 ) - << QgsPoint( 1, 0 ) - << QgsPoint( 1, 1 ) - << QgsPoint( 2, 1 ) - << QgsPoint( 2, 2 ) - << QgsPoint( 0, 2 ) - << QgsPoint( 0, 0 ); + ring << QgsPointXY( 0, 0 ) + << QgsPointXY( 1, 0 ) + << QgsPointXY( 1, 1 ) + << QgsPointXY( 2, 1 ) + << QgsPointXY( 2, 2 ) + << QgsPointXY( 0, 2 ) + << QgsPointXY( 0, 0 ); QgsPolygon poly; poly << ring; @@ -320,13 +320,13 @@ void TestQgsDistanceArea::measureAreaAndUnits() // now try with a source CRS which is in feet ring.clear(); - ring << QgsPoint( 1850000, 4423000 ) - << QgsPoint( 1851000, 4423000 ) - << QgsPoint( 1851000, 4424000 ) - << QgsPoint( 1852000, 4424000 ) - << QgsPoint( 1852000, 4425000 ) - << QgsPoint( 1851000, 4425000 ) - << QgsPoint( 1850000, 4423000 ); + ring << QgsPointXY( 1850000, 4423000 ) + << QgsPointXY( 1851000, 4423000 ) + << QgsPointXY( 1851000, 4424000 ) + << QgsPointXY( 1852000, 4424000 ) + << QgsPointXY( 1852000, 4425000 ) + << QgsPointXY( 1851000, 4425000 ) + << QgsPointXY( 1850000, 4423000 ); poly.clear(); poly << ring; polygon = QgsGeometry::fromPolygon( poly ); @@ -365,7 +365,7 @@ void TestQgsDistanceArea::emptyPolygon() da.setEllipsoid( QStringLiteral( "WGS84" ) ); //test that measuring an empty polygon doesn't crash - da.measurePolygon( QList< QgsPoint >() ); + da.measurePolygon( QList< QgsPointXY >() ); } void TestQgsDistanceArea::regression14675() diff --git a/tests/src/core/testqgsexpression.cpp b/tests/src/core/testqgsexpression.cpp index 2626412982f..db2ebdcefc6 100644 --- a/tests/src/core/testqgsexpression.cpp +++ b/tests/src/core/testqgsexpression.cpp @@ -124,25 +124,25 @@ class TestQgsExpression: public QObject mAggregatesLayer = new QgsVectorLayer( QStringLiteral( "Point?field=col1:integer&field=col2:string&field=col3:integer&field=col4:string" ), QStringLiteral( "aggregate_layer" ), QStringLiteral( "memory" ) ); QVERIFY( mAggregatesLayer->isValid() ); QgsFeature af1( mAggregatesLayer->dataProvider()->fields(), 1 ); - af1.setGeometry( QgsGeometry::fromPoint( QgsPoint( 0, 0 ) ) ); + af1.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 0, 0 ) ) ); af1.setAttribute( QStringLiteral( "col1" ), 4 ); af1.setAttribute( QStringLiteral( "col2" ), "test" ); af1.setAttribute( QStringLiteral( "col3" ), 2 ); af1.setAttribute( QStringLiteral( "col4" ), QVariant( QVariant::String ) ); QgsFeature af2( mAggregatesLayer->dataProvider()->fields(), 2 ); - af2.setGeometry( QgsGeometry::fromPoint( QgsPoint( 1, 0 ) ) ); + af2.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 1, 0 ) ) ); af2.setAttribute( QStringLiteral( "col1" ), 2 ); af2.setAttribute( QStringLiteral( "col2" ), QVariant( QVariant::String ) ); af2.setAttribute( QStringLiteral( "col3" ), 1 ); af2.setAttribute( QStringLiteral( "col4" ), QVariant( QVariant::String ) ); QgsFeature af3( mAggregatesLayer->dataProvider()->fields(), 3 ); - af3.setGeometry( QgsGeometry::fromPoint( QgsPoint( 2, 0 ) ) ); + af3.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 2, 0 ) ) ); af3.setAttribute( QStringLiteral( "col1" ), 3 ); af3.setAttribute( QStringLiteral( "col2" ), "test333" ); af3.setAttribute( QStringLiteral( "col3" ), 2 ); af3.setAttribute( QStringLiteral( "col4" ), QVariant( QVariant::String ) ); QgsFeature af4( mAggregatesLayer->dataProvider()->fields(), 4 ); - af4.setGeometry( QgsGeometry::fromPoint( QgsPoint( 3, 0 ) ) ); + af4.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 3, 0 ) ) ); af4.setAttribute( QStringLiteral( "col1" ), 2 ); af4.setAttribute( QStringLiteral( "col2" ), "test4" ); af4.setAttribute( QStringLiteral( "col3" ), 2 ); @@ -154,7 +154,7 @@ class TestQgsExpression: public QObject af5.setAttribute( QStringLiteral( "col3" ), 3 ); af5.setAttribute( QStringLiteral( "col4" ), "test" ); QgsFeature af6( mAggregatesLayer->dataProvider()->fields(), 6 ); - af6.setGeometry( QgsGeometry::fromPoint( QgsPoint( 5, 0 ) ) ); + af6.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 5, 0 ) ) ); af6.setAttribute( QStringLiteral( "col1" ), 8 ); af6.setAttribute( QStringLiteral( "col2" ), "test4" ); af6.setAttribute( QStringLiteral( "col3" ), 3 ); @@ -1741,9 +1741,9 @@ class TestQgsExpression: public QObject QTest::addColumn( "evalError" ); QTest::addColumn( "result" ); - QgsPoint point( 123, 456 ); + QgsPointXY point( 123, 456 ); QgsPolyline line; - line << QgsPoint( 1, 1 ) << QgsPoint( 4, 2 ) << QgsPoint( 3, 1 ); + line << QgsPointXY( 1, 1 ) << QgsPointXY( 4, 2 ) << QgsPointXY( 3, 1 ); QTest::newRow( "geom x" ) << "$x" << QgsGeometry::fromPoint( point ) << false << QVariant( 123. ); QTest::newRow( "geom y" ) << "$y" << QgsGeometry::fromPoint( point ) << false << QVariant( 456. ); @@ -1775,8 +1775,8 @@ class TestQgsExpression: public QObject void eval_geometry_calc() { QgsPolyline polyline, polygon_ring; - polyline << QgsPoint( 0, 0 ) << QgsPoint( 10, 0 ); - polygon_ring << QgsPoint( 2, 1 ) << QgsPoint( 10, 1 ) << QgsPoint( 10, 6 ) << QgsPoint( 2, 6 ) << QgsPoint( 2, 1 ); + polyline << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 0 ); + polygon_ring << QgsPointXY( 2, 1 ) << QgsPointXY( 10, 1 ) << QgsPointXY( 10, 6 ) << QgsPointXY( 2, 6 ) << QgsPointXY( 2, 1 ); QgsPolygon polygon; polygon << polygon_ring; QgsFeature fPolygon, fPolyline; @@ -1909,7 +1909,7 @@ class TestQgsExpression: public QObject QgsFeature feat; QgsPolyline polygonRing3111; - polygonRing3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ) << QgsPoint( 2520109, 2397715 ) << QgsPoint( 2520792, 2425494 ) << QgsPoint( 2484588, 2425722 ); + polygonRing3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ) << QgsPointXY( 2520109, 2397715 ) << QgsPointXY( 2520792, 2425494 ) << QgsPointXY( 2484588, 2425722 ); QgsPolygon polygon3111; polygon3111 << polygonRing3111; QgsGeometry polygon3111G = QgsGeometry::fromPolygon( polygon3111 ); @@ -1981,7 +1981,7 @@ class TestQgsExpression: public QObject // test length without geomCalculator QgsPolyline line3111; - line3111 << QgsPoint( 2484588, 2425722 ) << QgsPoint( 2482767, 2398853 ); + line3111 << QgsPointXY( 2484588, 2425722 ) << QgsPointXY( 2482767, 2398853 ); QgsGeometry line3111G = QgsGeometry::fromPolyline( line3111 ) ; feat.setGeometry( line3111G ); context.setFeature( feat ); @@ -2020,14 +2020,14 @@ class TestQgsExpression: public QObject void eval_geometry_wkt() { QgsPolyline polyline, polygon_ring; - polyline << QgsPoint( 0, 0 ) << QgsPoint( 10, 0 ); - polygon_ring << QgsPoint( 2, 1 ) << QgsPoint( 10, 1 ) << QgsPoint( 10, 6 ) << QgsPoint( 2, 6 ) << QgsPoint( 2, 1 ); + polyline << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 0 ); + polygon_ring << QgsPointXY( 2, 1 ) << QgsPointXY( 10, 1 ) << QgsPointXY( 10, 6 ) << QgsPointXY( 2, 6 ) << QgsPointXY( 2, 1 ); QgsPolygon polygon; polygon << polygon_ring; QgsFeature fPoint, fPolygon, fPolyline; - QgsGeometry fPointG = QgsGeometry::fromPoint( QgsPoint( -1.23456789, 9.87654321 ) ); + QgsGeometry fPointG = QgsGeometry::fromPoint( QgsPointXY( -1.23456789, 9.87654321 ) ); fPoint.setGeometry( fPointG ); QgsGeometry fPolylineG = QgsGeometry::fromPolyline( polyline ); fPolyline.setGeometry( fPolylineG ); @@ -2062,13 +2062,13 @@ class TestQgsExpression: public QObject QTest::addColumn( "geom" ); QTest::addColumn( "evalError" ); - QgsPoint point( 123, 456 ); + QgsPointXY point( 123, 456 ); QgsPolyline line; - line << QgsPoint( 1, 1 ) << QgsPoint( 4, 2 ) << QgsPoint( 3, 1 ); + line << QgsPointXY( 1, 1 ) << QgsPointXY( 4, 2 ) << QgsPointXY( 3, 1 ); QgsPolyline polyline, polygon_ring; - polyline << QgsPoint( 0, 0 ) << QgsPoint( 10, 0 ); - polygon_ring << QgsPoint( 1, 1 ) << QgsPoint( 6, 1 ) << QgsPoint( 6, 6 ) << QgsPoint( 1, 6 ) << QgsPoint( 1, 1 ); + polyline << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 0 ); + polygon_ring << QgsPointXY( 1, 1 ) << QgsPointXY( 6, 1 ) << QgsPointXY( 6, 6 ) << QgsPointXY( 1, 6 ) << QgsPointXY( 1, 1 ); QgsPolygon polygon; polygon << polygon_ring; @@ -2126,13 +2126,13 @@ class TestQgsExpression: public QObject QTest::addColumn( "evalError" ); QTest::addColumn( "needsGeom" ); - QgsPoint point( 123, 456 ); + QgsPointXY point( 123, 456 ); QgsPolyline line; - line << QgsPoint( 1, 1 ) << QgsPoint( 4, 2 ) << QgsPoint( 3, 1 ); + line << QgsPointXY( 1, 1 ) << QgsPointXY( 4, 2 ) << QgsPointXY( 3, 1 ); QgsPolyline polyline, polygon_ring; - polyline << QgsPoint( 0, 0 ) << QgsPoint( 10, 0 ); - polygon_ring << QgsPoint( 1, 1 ) << QgsPoint( 6, 1 ) << QgsPoint( 6, 6 ) << QgsPoint( 1, 6 ) << QgsPoint( 1, 1 ); + polyline << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 0 ); + polygon_ring << QgsPointXY( 1, 1 ) << QgsPointXY( 6, 1 ) << QgsPointXY( 6, 6 ) << QgsPointXY( 1, 6 ) << QgsPointXY( 1, 1 ); QgsPolygon polygon; polygon << polygon_ring; @@ -2187,10 +2187,10 @@ class TestQgsExpression: public QObject QTest::addColumn( "evalError" ); QTest::addColumn( "result" ); - QgsPoint point( 0, 0 ); + QgsPointXY point( 0, 0 ); QgsPolyline line, polygon_ring; - line << QgsPoint( 0, 0 ) << QgsPoint( 10, 10 ); - polygon_ring << QgsPoint( 0, 0 ) << QgsPoint( 10, 10 ) << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ); + line << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 10 ); + polygon_ring << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 10 ) << QgsPointXY( 10, 0 ) << QgsPointXY( 0, 0 ); QgsPolygon polygon; polygon << polygon_ring; @@ -2244,10 +2244,10 @@ class TestQgsExpression: public QObject QTest::addColumn( "needGeom" ); QTest::addColumn( "result" ); - QgsPoint point( 0, 0 ); + QgsPointXY point( 0, 0 ); QgsPolyline line, polygon_ring; - line << QgsPoint( 0, 0 ) << QgsPoint( 10, 10 ); - polygon_ring << QgsPoint( 0, 0 ) << QgsPoint( 10, 10 ) << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ); + line << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 10 ); + polygon_ring << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 10 ) << QgsPointXY( 10, 0 ) << QgsPointXY( 0, 0 ); QgsPolygon polygon; polygon << polygon_ring; @@ -2258,8 +2258,8 @@ class TestQgsExpression: public QObject geom = QgsGeometry::fromPolygon( polygon ); QTest::newRow( "buffer" ) << "buffer( $geometry, 2.0)" << geom << false << true << geom.buffer( 2.0, 8 ); - QgsPoint point1( 10, 20 ); - QgsPoint point2( 30, 20 ); + QgsPointXY point1( 10, 20 ); + QgsPointXY point2( 30, 20 ); QgsGeometry pnt1 = QgsGeometry::fromPoint( point1 ); QgsGeometry pnt2 = QgsGeometry::fromPoint( point2 ); QTest::newRow( "union" ) << "union( $geometry, geomFromWKT('" + pnt2.exportToWkt() + "') )" << pnt1 << false << true << pnt1.combine( pnt2 ); diff --git a/tests/src/core/testqgsfeature.cpp b/tests/src/core/testqgsfeature.cpp index 6a4d6c8124c..a921716f3a9 100644 --- a/tests/src/core/testqgsfeature.cpp +++ b/tests/src/core/testqgsfeature.cpp @@ -392,7 +392,7 @@ void TestQgsFeature::equality() feature.setAttribute( 2, QStringLiteral( "attr3" ) ); feature.setValid( true ); feature.setId( 1 ); - feature.setGeometry( QgsGeometry( new QgsPointV2( 1, 2 ) ) ); + feature.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QgsFeature feature2 = feature; QVERIFY( feature == feature2 ); @@ -410,7 +410,7 @@ void TestQgsFeature::equality() feature3.setAttribute( 2, QStringLiteral( "attr3" ) ); feature3.setValid( true ); feature3.setId( 1 ); - feature3.setGeometry( QgsGeometry( new QgsPointV2( 1, 2 ) ) ); + feature3.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QVERIFY( feature == feature3 ); QgsFeature feature4; @@ -420,7 +420,7 @@ void TestQgsFeature::equality() feature4.setAttribute( 2, 3 ); feature4.setValid( true ); feature4.setId( 1 ); - feature4.setGeometry( QgsGeometry( new QgsPointV2( 1, 2 ) ) ); + feature4.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QVERIFY( feature != feature4 ); QgsFeature feature5; @@ -429,7 +429,7 @@ void TestQgsFeature::equality() feature5.setAttribute( 1, QStringLiteral( "attr2" ) ); feature5.setAttribute( 2, QStringLiteral( "attr3" ) ); feature5.setId( 1 ); - feature5.setGeometry( QgsGeometry( new QgsPointV2( 1, 2 ) ) ); + feature5.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); feature5.setValid( false ); QVERIFY( feature != feature5 ); @@ -441,7 +441,7 @@ void TestQgsFeature::equality() feature6.setAttribute( 2, QStringLiteral( "attr3" ) ); feature6.setValid( true ); feature6.setId( 2 ); - feature6.setGeometry( QgsGeometry( new QgsPointV2( 1, 2 ) ) ); + feature6.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QVERIFY( feature != feature6 ); @@ -452,7 +452,7 @@ void TestQgsFeature::equality() feature7.setAttribute( 2, QStringLiteral( "attr3" ) ); feature7.setValid( true ); feature7.setId( 1 ); - feature7.setGeometry( QgsGeometry( new QgsPointV2( 1, 3 ) ) ); + feature7.setGeometry( QgsGeometry( new QgsPoint( 1, 3 ) ) ); QVERIFY( feature != feature7 ); } diff --git a/tests/src/core/testqgsgeometry.cpp b/tests/src/core/testqgsgeometry.cpp index 91c2b069ad7..69ad6c54f2c 100644 --- a/tests/src/core/testqgsgeometry.cpp +++ b/tests/src/core/testqgsgeometry.cpp @@ -84,7 +84,7 @@ class TestQgsGeometry : public QObject void multiPolygon(); void geometryCollection(); - void fromQgsPoint(); + void fromQgsPointXY(); void fromQPoint(); void fromQPolygonF(); void asQPointF(); @@ -156,18 +156,18 @@ class TestQgsGeometry : public QObject QString elemToString( const QDomElement &elem ) const; - QgsPoint mPoint1; - QgsPoint mPoint2; - QgsPoint mPoint3; - QgsPoint mPoint4; - QgsPoint mPointA; - QgsPoint mPointB; - QgsPoint mPointC; - QgsPoint mPointD; - QgsPoint mPointW; - QgsPoint mPointX; - QgsPoint mPointY; - QgsPoint mPointZ; + QgsPointXY mPoint1; + QgsPointXY mPoint2; + QgsPointXY mPoint3; + QgsPointXY mPoint4; + QgsPointXY mPointA; + QgsPointXY mPointB; + QgsPointXY mPointC; + QgsPointXY mPointD; + QgsPointXY mPointW; + QgsPointXY mPointX; + QgsPointXY mPointY; + QgsPointXY mPointZ; QgsPolyline mPolylineA; QgsPolyline mPolylineB; QgsPolyline mPolylineC; @@ -232,18 +232,18 @@ void TestQgsGeometry::init() // // Reset / reinitialize the geometries before each test is run // - mPoint1 = QgsPoint( 20.0, 20.0 ); - mPoint2 = QgsPoint( 80.0, 20.0 ); - mPoint3 = QgsPoint( 80.0, 80.0 ); - mPoint4 = QgsPoint( 20.0, 80.0 ); - mPointA = QgsPoint( 40.0, 40.0 ); - mPointB = QgsPoint( 100.0, 40.0 ); - mPointC = QgsPoint( 100.0, 100.0 ); - mPointD = QgsPoint( 40.0, 100.0 ); - mPointW = QgsPoint( 200.0, 200.0 ); - mPointX = QgsPoint( 240.0, 200.0 ); - mPointY = QgsPoint( 240.0, 240.0 ); - mPointZ = QgsPoint( 200.0, 240.0 ); + mPoint1 = QgsPointXY( 20.0, 20.0 ); + mPoint2 = QgsPointXY( 80.0, 20.0 ); + mPoint3 = QgsPointXY( 80.0, 80.0 ); + mPoint4 = QgsPointXY( 20.0, 80.0 ); + mPointA = QgsPointXY( 40.0, 40.0 ); + mPointB = QgsPointXY( 100.0, 40.0 ); + mPointC = QgsPointXY( 100.0, 100.0 ); + mPointD = QgsPointXY( 40.0, 100.0 ); + mPointW = QgsPointXY( 200.0, 200.0 ); + mPointX = QgsPointXY( 240.0, 200.0 ); + mPointY = QgsPointXY( 240.0, 240.0 ); + mPointZ = QgsPointXY( 200.0, 240.0 ); mWktLine = QStringLiteral( "LINESTRING(117.623198 35.198654, 117.581274 35.198654, 117.078178 35.324427, 116.868555 35.534051, 116.617007 35.869448, 116.491233 35.953297, 116.155836 36.288694, 116.071987 36.372544, 115.443117 36.749865, 114.814247 37.043338, 114.311152 37.169112, 113.388810 37.378735, 113.095337 37.378735, 112.592241 37.378735, 111.753748 37.294886, 111.502201 37.252961, 111.082954 37.127187, 110.747557 37.127187, 110.160612 36.917564, 110.034838 36.833715, 109.741366 36.749865, 109.573667 36.666016, 109.238270 36.498317, 109.070571 36.414468, 108.819023 36.288694, 108.693250 36.246770, 108.483626 36.162920, 107.645134 35.911372, 106.597017 35.869448, 106.051997 35.701749, 105.800449 35.617900, 105.590826 35.575975, 105.297354 35.575975, 104.961956 35.575975, 104.710409 35.534051, 104.458861 35.492126, 103.871916 35.492126, 103.788066 35.492126, 103.326895 35.408277, 102.949574 35.408277, 102.488402 35.450201, 102.069156 35.450201, 101.482211 35.450201, 100.937191 35.659825, 100.308321 35.869448, 100.056773 36.037146, 99.050582 36.079071, 97.667069 35.743674, 97.163973 35.617900, 96.115857 35.534051, 95.612761 35.534051, 94.396947 35.911372, 93.684228 36.288694, 92.929584 36.833715, 92.258790 37.169112, 91.629920 37.504509, 90.414105 37.881831, 90.414105 37.881831, 90.246407 37.923755, 89.491763 37.839906, 89.156366 37.672207, 88.485572 37.504509, 87.814778 37.252961, 87.563230 37.169112, 87.143983 37.043338, 85.970093 36.875639, 85.802395 36.875639, 84.083484 36.959489, 84.041560 37.043338, 82.951519 37.546433, 82.699971 37.630283)" ); @@ -308,7 +308,7 @@ void TestQgsGeometry::cleanup() void TestQgsGeometry::copy() { //create a point geometry - QgsGeometry original( new QgsPointV2( 1.0, 2.0 ) ); + QgsGeometry original( new QgsPoint( 1.0, 2.0 ) ); QCOMPARE( original.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 1.0 ); QCOMPARE( original.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); @@ -318,7 +318,7 @@ void TestQgsGeometry::copy() QCOMPARE( copy.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); //trigger a detach - copy.setGeometry( new QgsPointV2( 3.0, 4.0 ) ); + copy.setGeometry( new QgsPoint( 3.0, 4.0 ) ); QCOMPARE( copy.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 3.0 ); QCOMPARE( copy.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 4.0 ); @@ -330,7 +330,7 @@ void TestQgsGeometry::copy() void TestQgsGeometry::assignment() { //create a point geometry - QgsGeometry original( new QgsPointV2( 1.0, 2.0 ) ); + QgsGeometry original( new QgsPoint( 1.0, 2.0 ) ); QCOMPARE( original.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 1.0 ); QCOMPARE( original.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); @@ -341,7 +341,7 @@ void TestQgsGeometry::assignment() QCOMPARE( copy.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); //trigger a detach - copy.setGeometry( new QgsPointV2( 3.0, 4.0 ) ); + copy.setGeometry( new QgsPoint( 3.0, 4.0 ) ); QCOMPARE( copy.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 3.0 ); QCOMPARE( copy.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 4.0 ); @@ -353,7 +353,7 @@ void TestQgsGeometry::assignment() void TestQgsGeometry::asVariant() { //create a point geometry - QgsGeometry original( new QgsPointV2( 1.0, 2.0 ) ); + QgsGeometry original( new QgsPoint( 1.0, 2.0 ) ); QCOMPARE( original.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 1.0 ); QCOMPARE( original.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); @@ -373,7 +373,7 @@ void TestQgsGeometry::asVariant() QCOMPARE( fromVar2.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); //modify original and check detachment - original.setGeometry( new QgsPointV2( 3.0, 4.0 ) ); + original.setGeometry( new QgsPoint( 3.0, 4.0 ) ); QgsGeometry fromVar3 = qvariant_cast( var ); QCOMPARE( fromVar3.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 1.0 ); QCOMPARE( fromVar3.geometry()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 ); @@ -384,7 +384,7 @@ void TestQgsGeometry::isEmpty() QgsGeometry geom; QVERIFY( geom.isNull() ); - geom.setGeometry( new QgsPointV2( 1.0, 2.0 ) ); + geom.setGeometry( new QgsPoint( 1.0, 2.0 ) ); QVERIFY( !geom.isNull() ); geom.setGeometry( 0 ); @@ -399,7 +399,7 @@ void TestQgsGeometry::operatorBool() QgsGeometry geom; QVERIFY( !geom ); - geom.setGeometry( new QgsPointV2( 1.0, 2.0 ) ); + geom.setGeometry( new QgsPoint( 1.0, 2.0 ) ); QVERIFY( geom ); geom.setGeometry( 0 ); @@ -411,7 +411,7 @@ void TestQgsGeometry::point() //test QgsPointV2 //test constructors - QgsPointV2 p1( 5.0, 6.0 ); + QgsPoint p1( 5.0, 6.0 ); QCOMPARE( p1.x(), 5.0 ); QCOMPARE( p1.y(), 6.0 ); QVERIFY( !p1.isEmpty() ); @@ -420,7 +420,7 @@ void TestQgsGeometry::point() QCOMPARE( p1.wkbType(), QgsWkbTypes::Point ); QCOMPARE( p1.wktTypeStr(), QString( "Point" ) ); - QgsPointV2 p2( QgsPoint( 3.0, 4.0 ) ); + QgsPoint p2( QgsPointXY( 3.0, 4.0 ) ); QCOMPARE( p2.x(), 3.0 ); QCOMPARE( p2.y(), 4.0 ); QVERIFY( !p2.isEmpty() ); @@ -428,7 +428,7 @@ void TestQgsGeometry::point() QVERIFY( !p2.isMeasure() ); QCOMPARE( p2.wkbType(), QgsWkbTypes::Point ); - QgsPointV2 p3( QPointF( 7.0, 9.0 ) ); + QgsPoint p3( QPointF( 7.0, 9.0 ) ); QCOMPARE( p3.x(), 7.0 ); QCOMPARE( p3.y(), 9.0 ); QVERIFY( !p3.isEmpty() ); @@ -436,7 +436,7 @@ void TestQgsGeometry::point() QVERIFY( !p3.isMeasure() ); QCOMPARE( p3.wkbType(), QgsWkbTypes::Point ); - QgsPointV2 p4( QgsWkbTypes::Point, 11.0, 13.0 ); + QgsPoint p4( QgsWkbTypes::Point, 11.0, 13.0 ); QCOMPARE( p4.x(), 11.0 ); QCOMPARE( p4.y(), 13.0 ); QVERIFY( !p4.isEmpty() ); @@ -444,7 +444,7 @@ void TestQgsGeometry::point() QVERIFY( !p4.isMeasure() ); QCOMPARE( p4.wkbType(), QgsWkbTypes::Point ); - QgsPointV2 p5( QgsWkbTypes::PointZ, 11.0, 13.0, 15.0 ); + QgsPoint p5( QgsWkbTypes::PointZ, 11.0, 13.0, 15.0 ); QCOMPARE( p5.x(), 11.0 ); QCOMPARE( p5.y(), 13.0 ); QCOMPARE( p5.z(), 15.0 ); @@ -454,7 +454,7 @@ void TestQgsGeometry::point() QCOMPARE( p5.wkbType(), QgsWkbTypes::PointZ ); QCOMPARE( p5.wktTypeStr(), QString( "PointZ" ) ); - QgsPointV2 p6( QgsWkbTypes::PointM, 11.0, 13.0, 0.0, 17.0 ); + QgsPoint p6( QgsWkbTypes::PointM, 11.0, 13.0, 0.0, 17.0 ); QCOMPARE( p6.x(), 11.0 ); QCOMPARE( p6.y(), 13.0 ); QCOMPARE( p6.m(), 17.0 ); @@ -464,7 +464,7 @@ void TestQgsGeometry::point() QCOMPARE( p6.wkbType(), QgsWkbTypes::PointM ); QCOMPARE( p6.wktTypeStr(), QString( "PointM" ) ); - QgsPointV2 p7( QgsWkbTypes::PointZM, 11.0, 13.0, 0.0, 17.0 ); + QgsPoint p7( QgsWkbTypes::PointZM, 11.0, 13.0, 0.0, 17.0 ); QCOMPARE( p7.x(), 11.0 ); QCOMPARE( p7.y(), 13.0 ); QCOMPARE( p7.m(), 17.0 ); @@ -474,7 +474,7 @@ void TestQgsGeometry::point() QCOMPARE( p7.wkbType(), QgsWkbTypes::PointZM ); QCOMPARE( p7.wktTypeStr(), QString( "PointZM" ) ); - QgsPointV2 p8( QgsWkbTypes::Point25D, 21.0, 23.0, 25.0 ); + QgsPoint p8( QgsWkbTypes::Point25D, 21.0, 23.0, 25.0 ); QCOMPARE( p8.x(), 21.0 ); QCOMPARE( p8.y(), 23.0 ); QCOMPARE( p8.z(), 25.0 ); @@ -485,31 +485,31 @@ void TestQgsGeometry::point() #if 0 //should trigger an assert //try creating a point with a nonsense WKB type - QgsPointV2 p9( QgsWkbTypes::PolygonZM, 11.0, 13.0, 9.0, 17.0 ); + QgsPoint p9( QgsWkbTypes::PolygonZM, 11.0, 13.0, 9.0, 17.0 ); QCOMPARE( p9.wkbType(), QgsWkbTypes::Unknown ); #endif //test equality operator - QVERIFY( QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::PointZ, 2 / 3.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::Point, 1 / 3.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 2 / 3.0 ) == QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); - QVERIFY( QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointZM, 3.0, 4.0, 1 / 3.0 ) ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 2 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) ) ); - QVERIFY( QgsPointV2( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 0.0, 1 / 3.0 ) ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 2 / 3.0 ) ) ); - QVERIFY( QgsPointV2( QgsWkbTypes::PointZM, 3.0, 4.0, 2 / 3.0, 1 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointZM, 3.0, 4.0, 2 / 3.0, 1 / 3.0 ) ); - QVERIFY( QgsPointV2( QgsWkbTypes::Point25D, 3.0, 4.0, 2 / 3.0 ) == QgsPointV2( QgsWkbTypes::Point25D, 3.0, 4.0, 2 / 3.0 ) ); - QVERIFY( !( QgsPointV2( QgsWkbTypes::Point25D, 3.0, 4.0, 2 / 3.0 ) == QgsPointV2( QgsWkbTypes::PointZ, 3.0, 4.0, 2 / 3.0 ) ) ); + QVERIFY( QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::PointZ, 2 / 3.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::Point, 1 / 3.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 2 / 3.0 ) == QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); + QVERIFY( QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::PointZM, 3.0, 4.0, 1 / 3.0 ) ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 2 / 3.0 ) == QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 1 / 3.0 ) ) ); + QVERIFY( QgsPoint( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 0.0, 1 / 3.0 ) ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::PointM, 3.0, 4.0, 0.0, 2 / 3.0 ) ) ); + QVERIFY( QgsPoint( QgsWkbTypes::PointZM, 3.0, 4.0, 2 / 3.0, 1 / 3.0 ) == QgsPoint( QgsWkbTypes::PointZM, 3.0, 4.0, 2 / 3.0, 1 / 3.0 ) ); + QVERIFY( QgsPoint( QgsWkbTypes::Point25D, 3.0, 4.0, 2 / 3.0 ) == QgsPoint( QgsWkbTypes::Point25D, 3.0, 4.0, 2 / 3.0 ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::Point25D, 3.0, 4.0, 2 / 3.0 ) == QgsPoint( QgsWkbTypes::PointZ, 3.0, 4.0, 2 / 3.0 ) ) ); //test inequality operator - QVERIFY( !( QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) != QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); - QVERIFY( QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) != QgsPointV2( QgsWkbTypes::PointZ, 2 / 3.0, 1 / 3.0 ) ); + QVERIFY( !( QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) != QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) ) ); + QVERIFY( QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 1 / 3.0 ) != QgsPoint( QgsWkbTypes::PointZ, 2 / 3.0, 1 / 3.0 ) ); //test setters and getters //x - QgsPointV2 p10( QgsWkbTypes::PointZM ); + QgsPoint p10( QgsWkbTypes::PointZM ); p10.setX( 5.0 ); QCOMPARE( p10.x(), 5.0 ); QCOMPARE( p10.rx(), 5.0 ); @@ -539,53 +539,53 @@ void TestQgsGeometry::point() QCOMPARE( p10.dimension(), 0 ); //clone - std::unique_ptr< QgsPointV2 >clone( p10.clone() ); + std::unique_ptr< QgsPoint >clone( p10.clone() ); QVERIFY( p10 == *clone ); //assignment - QgsPointV2 original( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 ); - QgsPointV2 assigned( 6.0, 7.0 ); + QgsPoint original( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 ); + QgsPoint assigned( 6.0, 7.0 ); assigned = original; QVERIFY( assigned == original ); //clear - QgsPointV2 p11( 5.0, 6.0 ); + QgsPoint p11( 5.0, 6.0 ); p11.clear(); QCOMPARE( p11.wkbType(), QgsWkbTypes::Point ); QCOMPARE( p11.x(), 0.0 ); QCOMPARE( p11.y(), 0.0 ); //toQPointF - QgsPointV2 p11a( 5.0, 9.0 ); + QgsPoint p11a( 5.0, 9.0 ); QPointF result = p11a.toQPointF(); QVERIFY( qgsDoubleNear( result.x(), 5.0 ) ); QVERIFY( qgsDoubleNear( result.y(), 9.0 ) ); //to/from WKB - QgsPointV2 p12( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 ); + QgsPoint p12( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 ); QByteArray wkb12 = p12.asWkb(); - QgsPointV2 p13; + QgsPoint p13; QgsConstWkbPtr wkb12ptr( wkb12 ); p13.fromWkb( wkb12ptr ); QVERIFY( p13 == p12 ); //bad WKB - check for no crash - p13 = QgsPointV2( 1, 2 ); + p13 = QgsPoint( 1, 2 ); QgsConstWkbPtr nullPtr( nullptr, 0 ); QVERIFY( !p13.fromWkb( nullPtr ) ); QCOMPARE( p13.wkbType(), QgsWkbTypes::Point ); QgsLineString line; - p13 = QgsPointV2( 1, 2 ); + p13 = QgsPoint( 1, 2 ); QByteArray wkbLine = line.asWkb(); QgsConstWkbPtr wkbLinePtr( wkbLine ); QVERIFY( !p13.fromWkb( wkbLinePtr ) ); QCOMPARE( p13.wkbType(), QgsWkbTypes::Point ); //to/from WKT - p13 = QgsPointV2( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 ); + p13 = QgsPoint( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 ); QString wkt = p13.asWkt(); QVERIFY( !wkt.isEmpty() ); - QgsPointV2 p14; + QgsPoint p14; QVERIFY( p14.fromWkt( wkt ) ); QVERIFY( p14 == p13 ); @@ -593,8 +593,8 @@ void TestQgsGeometry::point() QVERIFY( !p14.fromWkt( "Polygon()" ) ); //asGML2 - QgsPointV2 exportPoint( 1, 2 ); - QgsPointV2 exportPointFloat( 1 / 3.0, 2 / 3.0 ); + QgsPoint exportPoint( 1, 2 ); + QgsPoint exportPointFloat( 1 / 3.0, 2 / 3.0 ); QDomDocument doc( QStringLiteral( "gml" ) ); QString expectedGML2( QStringLiteral( "1,2" ) ); QCOMPARE( elemToString( exportPoint.asGML2( doc ) ), expectedGML2 ); @@ -614,7 +614,7 @@ void TestQgsGeometry::point() QCOMPARE( exportPointFloat.asJSON( 3 ), expectedJsonPrec3 ); //bounding box - QgsPointV2 p15( 1.0, 2.0 ); + QgsPoint p15( 1.0, 2.0 ); QCOMPARE( p15.boundingBox(), QgsRectangle( 1.0, 2.0, 1.0, 2.0 ) ); //modify points and test that bounding box is updated accordingly p15.setX( 3.0 ); @@ -625,9 +625,9 @@ void TestQgsGeometry::point() QCOMPARE( p15.boundingBox(), QgsRectangle( 4.0, 6.0, 4.0, 6.0 ) ); p15.ry() = 9.0; QCOMPARE( p15.boundingBox(), QgsRectangle( 4.0, 9.0, 4.0, 9.0 ) ); - p15.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( 11.0, 13.0 ) ); + p15.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( 11.0, 13.0 ) ); QCOMPARE( p15.boundingBox(), QgsRectangle( 11.0, 13.0, 11.0, 13.0 ) ); - p15 = QgsPointV2( 21.0, 23.0 ); + p15 = QgsPoint( 21.0, 23.0 ); QCOMPARE( p15.boundingBox(), QgsRectangle( 21.0, 23.0, 21.0, 23.0 ) ); //CRS transform @@ -636,7 +636,7 @@ void TestQgsGeometry::point() QgsCoordinateReferenceSystem destSrs; destSrs.createFromSrid( 4202 ); // want a transform with ellipsoid change QgsCoordinateTransform tr( sourceSrs, destSrs ); - QgsPointV2 p16( QgsWkbTypes::PointZM, 6374985, -3626584, 1, 2 ); + QgsPoint p16( QgsWkbTypes::PointZM, 6374985, -3626584, 1, 2 ); p16.transform( tr, QgsCoordinateTransform::ForwardTransform ); QGSCOMPARENEAR( p16.x(), 175.771, 0.001 ); QGSCOMPARENEAR( p16.y(), -39.724, 0.001 ); @@ -655,12 +655,12 @@ void TestQgsGeometry::point() //QTransform transform QTransform qtr = QTransform::fromScale( 2, 3 ); - QgsPointV2 p17( QgsWkbTypes::PointZM, 10, 20, 30, 40 ); + QgsPoint p17( QgsWkbTypes::PointZM, 10, 20, 30, 40 ); p17.transform( qtr ); - QVERIFY( p17 == QgsPointV2( QgsWkbTypes::PointZM, 20, 60, 30, 40 ) ); + QVERIFY( p17 == QgsPoint( QgsWkbTypes::PointZM, 20, 60, 30, 40 ) ); //coordinateSequence - QgsPointV2 p18( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ); + QgsPoint p18( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ); QgsCoordinateSequence coord = p18.coordinateSequence(); QCOMPARE( coord.count(), 1 ); QCOMPARE( coord.at( 0 ).count(), 1 ); @@ -669,43 +669,43 @@ void TestQgsGeometry::point() //low level editing //insertVertex should have no effect - QgsPointV2 p19( QgsWkbTypes::PointZM, 3.0, 4.0, 6.0, 7.0 ); - p19.insertVertex( QgsVertexId( 1, 2, 3 ), QgsPointV2( 6.0, 7.0 ) ); - QCOMPARE( p19, QgsPointV2( QgsWkbTypes::PointZM, 3.0, 4.0, 6.0, 7.0 ) ); + QgsPoint p19( QgsWkbTypes::PointZM, 3.0, 4.0, 6.0, 7.0 ); + p19.insertVertex( QgsVertexId( 1, 2, 3 ), QgsPoint( 6.0, 7.0 ) ); + QCOMPARE( p19, QgsPoint( QgsWkbTypes::PointZM, 3.0, 4.0, 6.0, 7.0 ) ); //moveVertex - p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); - QCOMPARE( p19, QgsPointV2( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); + p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); + QCOMPARE( p19, QgsPoint( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); //invalid vertex id, should not crash - p19.moveVertex( QgsVertexId( 1, 2, 3 ), QgsPointV2( QgsWkbTypes::PointZM, 2.0, 3.0, 1.0, 2.0 ) ); - QCOMPARE( p19, QgsPointV2( QgsWkbTypes::PointZM, 2.0, 3.0, 1.0, 2.0 ) ); + p19.moveVertex( QgsVertexId( 1, 2, 3 ), QgsPoint( QgsWkbTypes::PointZM, 2.0, 3.0, 1.0, 2.0 ) ); + QCOMPARE( p19, QgsPoint( QgsWkbTypes::PointZM, 2.0, 3.0, 1.0, 2.0 ) ); //move PointZM using Point - p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::Point, 11.0, 12.0 ) ); - QCOMPARE( p19, QgsPointV2( QgsWkbTypes::PointZM, 11.0, 12.0, 1.0, 2.0 ) ); + p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::Point, 11.0, 12.0 ) ); + QCOMPARE( p19, QgsPoint( QgsWkbTypes::PointZM, 11.0, 12.0, 1.0, 2.0 ) ); //move PointZM using PointZ - p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 21.0, 22.0, 23.0 ) ); - QCOMPARE( p19, QgsPointV2( QgsWkbTypes::PointZM, 21.0, 22.0, 23.0, 2.0 ) ); + p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZ, 21.0, 22.0, 23.0 ) ); + QCOMPARE( p19, QgsPoint( QgsWkbTypes::PointZM, 21.0, 22.0, 23.0, 2.0 ) ); //move PointZM using PointM - p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointM, 31.0, 32.0, 0.0, 43.0 ) ); - QCOMPARE( p19, QgsPointV2( QgsWkbTypes::PointZM, 31.0, 32.0, 23.0, 43.0 ) ); + p19.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointM, 31.0, 32.0, 0.0, 43.0 ) ); + QCOMPARE( p19, QgsPoint( QgsWkbTypes::PointZM, 31.0, 32.0, 23.0, 43.0 ) ); //move Point using PointZM (z/m should be ignored) - QgsPointV2 p20( 3.0, 4.0 ); - p20.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 2.0, 3.0, 1.0, 2.0 ) ); - QCOMPARE( p20, QgsPointV2( 2.0, 3.0 ) ); + QgsPoint p20( 3.0, 4.0 ); + p20.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 2.0, 3.0, 1.0, 2.0 ) ); + QCOMPARE( p20, QgsPoint( 2.0, 3.0 ) ); //deleteVertex - should do nothing, but not crash p20.deleteVertex( QgsVertexId( 0, 0, 0 ) ); - QCOMPARE( p20, QgsPointV2( 2.0, 3.0 ) ); + QCOMPARE( p20, QgsPoint( 2.0, 3.0 ) ); // closestSegment - QgsPointV2 closest; + QgsPoint closest; QgsVertexId after; // return error - points have no segments - QVERIFY( p20.closestSegment( QgsPointV2( 4.0, 6.0 ), closest, after, 0, 0 ) < 0 ); + QVERIFY( p20.closestSegment( QgsPoint( 4.0, 6.0 ), closest, after, 0, 0 ) < 0 ); //nextVertex - QgsPointV2 p21( 3.0, 4.0 ); - QgsPointV2 p22; + QgsPoint p21( 3.0, 4.0 ); + QgsPoint p22; QgsVertexId v( 0, 0, -1 ); QVERIFY( p21.nextVertex( v, p22 ) ); QCOMPARE( p22, p21 ); @@ -739,47 +739,47 @@ void TestQgsGeometry::point() QCOMPARE( p20.area(), 0.0 ); QCOMPARE( p20.centroid(), p20 ); QVERIFY( !p20.hasCurvedSegments() ); - std::unique_ptr< QgsPointV2 >segmented( static_cast< QgsPointV2 *>( p20.segmentize() ) ); + std::unique_ptr< QgsPoint >segmented( static_cast< QgsPoint *>( p20.segmentize() ) ); QCOMPARE( *segmented, p20 ); //addZValue - QgsPointV2 p23( 1.0, 2.0 ); + QgsPoint p23( 1.0, 2.0 ); QVERIFY( p23.addZValue( 5.0 ) ); - QCOMPARE( p23, QgsPointV2( QgsWkbTypes::PointZ, 1.0, 2.0, 5.0 ) ); + QCOMPARE( p23, QgsPoint( QgsWkbTypes::PointZ, 1.0, 2.0, 5.0 ) ); QVERIFY( !p23.addZValue( 6.0 ) ); //addMValue - QgsPointV2 p24( 1.0, 2.0 ); + QgsPoint p24( 1.0, 2.0 ); QVERIFY( p24.addMValue( 5.0 ) ); - QCOMPARE( p24, QgsPointV2( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 5.0 ) ); + QCOMPARE( p24, QgsPoint( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 5.0 ) ); QVERIFY( !p24.addMValue( 6.0 ) ); //dropZ - QgsPointV2 p25( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0 ); + QgsPoint p25( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0 ); QVERIFY( p25.dropZValue() ); - QCOMPARE( p25, QgsPointV2( 1.0, 2.0 ) ); + QCOMPARE( p25, QgsPoint( 1.0, 2.0 ) ); QVERIFY( !p25.dropZValue() ); - QgsPointV2 p26( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ); + QgsPoint p26( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ); QVERIFY( p26.dropZValue() ); - QCOMPARE( p26, QgsPointV2( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 4.0 ) ); + QCOMPARE( p26, QgsPoint( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 4.0 ) ); QVERIFY( !p26.dropZValue() ); - QgsPointV2 p26a( QgsWkbTypes::Point25D, 1.0, 2.0, 3.0 ); + QgsPoint p26a( QgsWkbTypes::Point25D, 1.0, 2.0, 3.0 ); QVERIFY( p26a.dropZValue() ); - QCOMPARE( p26a, QgsPointV2( QgsWkbTypes::Point, 1.0, 2.0 ) ); + QCOMPARE( p26a, QgsPoint( QgsWkbTypes::Point, 1.0, 2.0 ) ); QVERIFY( !p26a.dropZValue() ); //dropM - QgsPointV2 p27( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 3.0 ); + QgsPoint p27( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 3.0 ); QVERIFY( p27.dropMValue() ); - QCOMPARE( p27, QgsPointV2( 1.0, 2.0 ) ); + QCOMPARE( p27, QgsPoint( 1.0, 2.0 ) ); QVERIFY( !p27.dropMValue() ); - QgsPointV2 p28( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ); + QgsPoint p28( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ); QVERIFY( p28.dropMValue() ); - QCOMPARE( p28, QgsPointV2( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0, 0.0 ) ); + QCOMPARE( p28, QgsPoint( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0, 0.0 ) ); QVERIFY( !p28.dropMValue() ); //convertTo - QgsPointV2 p29( 1.0, 2.0 ); + QgsPoint p29( 1.0, 2.0 ); QVERIFY( p29.convertTo( QgsWkbTypes::Point ) ); QCOMPARE( p29.wkbType(), QgsWkbTypes::Point ); QVERIFY( p29.convertTo( QgsWkbTypes::PointZ ) ); @@ -803,135 +803,135 @@ void TestQgsGeometry::point() QVERIFY( !p29.convertTo( QgsWkbTypes::Polygon ) ); //boundary - QgsPointV2 p30( 1.0, 2.0 ); + QgsPoint p30( 1.0, 2.0 ); QVERIFY( !p30.boundary() ); // distance - QCOMPARE( QgsPointV2( 1, 2 ).distance( QgsPointV2( 2, 2 ) ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( 2, 2 ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( QgsPointV2( 3, 2 ) ), 2.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( 3, 2 ), 2.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( QgsPointV2( 1, 3 ) ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( 1, 3 ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( QgsPointV2( 1, 4 ) ), 2.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distance( 1, 4 ), 2.0 ); - QCOMPARE( QgsPointV2( 1, -2 ).distance( QgsPointV2( 1, -4 ) ), 2.0 ); - QCOMPARE( QgsPointV2( 1, -2 ).distance( 1, -4 ), 2.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 2, 2 ) ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( 2, 2 ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 3, 2 ) ), 2.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( 3, 2 ), 2.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 1, 3 ) ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( 1, 3 ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 1, 4 ) ), 2.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distance( 1, 4 ), 2.0 ); + QCOMPARE( QgsPoint( 1, -2 ).distance( QgsPoint( 1, -4 ) ), 2.0 ); + QCOMPARE( QgsPoint( 1, -2 ).distance( 1, -4 ), 2.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( QgsPointV2( 2, 2 ) ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( 2, 2 ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( QgsPointV2( 3, 2 ) ), 4.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( 3, 2 ), 4.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( QgsPointV2( 1, 3 ) ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( 1, 3 ), 1.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( QgsPointV2( 1, 4 ) ), 4.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).distanceSquared( 1, 4 ), 4.0 ); - QCOMPARE( QgsPointV2( 1, -2 ).distanceSquared( QgsPointV2( 1, -4 ) ), 4.0 ); - QCOMPARE( QgsPointV2( 1, -2 ).distanceSquared( 1, -4 ), 4.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( QgsPoint( 2, 2 ) ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( 2, 2 ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( QgsPoint( 3, 2 ) ), 4.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( 3, 2 ), 4.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( QgsPoint( 1, 3 ) ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( 1, 3 ), 1.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( QgsPoint( 1, 4 ) ), 4.0 ); + QCOMPARE( QgsPoint( 1, 2 ).distanceSquared( 1, 4 ), 4.0 ); + QCOMPARE( QgsPoint( 1, -2 ).distanceSquared( QgsPoint( 1, -4 ) ), 4.0 ); + QCOMPARE( QgsPoint( 1, -2 ).distanceSquared( 1, -4 ), 4.0 ); // distance 3D - QCOMPARE( QgsPointV2( 0, 0 ).distanceSquared3D( QgsPointV2( 1, 1 ) ), 2.0 ); - QCOMPARE( QgsPointV2( 0, 0 ).distanceSquared3D( 1, 1, 0 ), 2.0 ); - QCOMPARE( QgsPointV2( 0, 0 ).distanceSquared3D( QgsPointV2( QgsWkbTypes::PointZ, 2, 2, 2, 0 ) ), 12.0 ); - QCOMPARE( QgsPointV2( 0, 0 ).distanceSquared3D( 2, 2, 2 ), 12.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 2, 2, 2, 0 ).distanceSquared3D( QgsPointV2( 1, 1 ) ), 6.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 2, 2, 2, 0 ).distanceSquared3D( 1, 1, 0 ), 6.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( QgsPointV2( 0, 0 ) ), 12.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( 0, 0, 0 ), 12.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( QgsPointV2( QgsWkbTypes::PointZ, 2, 2, 2, 0 ) ), 48.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( 2, 2, 2 ), 48.0 ); + QCOMPARE( QgsPoint( 0, 0 ).distanceSquared3D( QgsPoint( 1, 1 ) ), 2.0 ); + QCOMPARE( QgsPoint( 0, 0 ).distanceSquared3D( 1, 1, 0 ), 2.0 ); + QCOMPARE( QgsPoint( 0, 0 ).distanceSquared3D( QgsPoint( QgsWkbTypes::PointZ, 2, 2, 2, 0 ) ), 12.0 ); + QCOMPARE( QgsPoint( 0, 0 ).distanceSquared3D( 2, 2, 2 ), 12.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 2, 2, 2, 0 ).distanceSquared3D( QgsPoint( 1, 1 ) ), 6.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 2, 2, 2, 0 ).distanceSquared3D( 1, 1, 0 ), 6.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( QgsPoint( 0, 0 ) ), 12.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( 0, 0, 0 ), 12.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( QgsPoint( QgsWkbTypes::PointZ, 2, 2, 2, 0 ) ), 48.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, -2, -2, -2, 0 ).distanceSquared3D( 2, 2, 2 ), 48.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( QgsPointV2( QgsWkbTypes::PointZ, 1, 3, 2, 0 ) ), 2.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( 1, 3, 2 ), 2.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 4, 0 ) ), 2.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( 1, 1, 4 ), 2.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, -2, 0 ).distance3D( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, -4, 0 ) ), 2.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, -2, 0 ).distance3D( 1, 1, -4 ), 2.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( QgsPoint( QgsWkbTypes::PointZ, 1, 3, 2, 0 ) ), 2.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( 1, 3, 2 ), 2.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 4, 0 ) ), 2.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).distance3D( 1, 1, 4 ), 2.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, -2, 0 ).distance3D( QgsPoint( QgsWkbTypes::PointZ, 1, 1, -4, 0 ) ), 2.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, -2, 0 ).distance3D( 1, 1, -4 ), 2.0 ); // azimuth - QCOMPARE( QgsPointV2( 1, 2 ).azimuth( QgsPointV2( 1, 2 ) ), 0.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).azimuth( QgsPointV2( 1, 3 ) ), 0.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).azimuth( QgsPointV2( 2, 2 ) ), 90.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).azimuth( QgsPointV2( 1, 0 ) ), 180.0 ); - QCOMPARE( QgsPointV2( 1, 2 ).azimuth( QgsPointV2( 0, 2 ) ), -90.0 ); + QCOMPARE( QgsPoint( 1, 2 ).azimuth( QgsPoint( 1, 2 ) ), 0.0 ); + QCOMPARE( QgsPoint( 1, 2 ).azimuth( QgsPoint( 1, 3 ) ), 0.0 ); + QCOMPARE( QgsPoint( 1, 2 ).azimuth( QgsPoint( 2, 2 ) ), 90.0 ); + QCOMPARE( QgsPoint( 1, 2 ).azimuth( QgsPoint( 1, 0 ) ), 180.0 ); + QCOMPARE( QgsPoint( 1, 2 ).azimuth( QgsPoint( 0, 2 ) ), -90.0 ); // operators - QgsPointV2 p31( 1, 2 ); - QgsPointV2 p32( 3, 5 ); + QgsPoint p31( 1, 2 ); + QgsPoint p32( 3, 5 ); QCOMPARE( p32 - p31, QgsVector( 2, 3 ) ); QCOMPARE( p31 - p32, QgsVector( -2, -3 ) ); - p31 = QgsPointV2( 1, 2 ); - QCOMPARE( p31 + QgsVector( 3, 5 ), QgsPointV2( 4, 7 ) ); + p31 = QgsPoint( 1, 2 ); + QCOMPARE( p31 + QgsVector( 3, 5 ), QgsPoint( 4, 7 ) ); p31 += QgsVector( 3, 5 ); - QCOMPARE( p31, QgsPointV2( 4, 7 ) ); + QCOMPARE( p31, QgsPoint( 4, 7 ) ); - QCOMPARE( p31 - QgsVector( 3, 5 ), QgsPointV2( 1, 2 ) ); + QCOMPARE( p31 - QgsVector( 3, 5 ), QgsPoint( 1, 2 ) ); p31 -= QgsVector( 3, 5 ); - QCOMPARE( p31, QgsPointV2( 1, 2 ) ); + QCOMPARE( p31, QgsPoint( 1, 2 ) ); // test projecting a point // 2D - QgsPointV2 p33 = QgsPointV2( 1, 2 ); - QCOMPARE( p33.project( 1, 0 ), QgsPointV2( 1, 3 ) ); - QCOMPARE( p33.project( 1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 1 ) ); - QCOMPARE( p33.project( 1.5, 90 ), QgsPointV2( 2.5, 2 ) ); - QCOMPARE( p33.project( 1.5, 90, 90 ), QgsPointV2( 2.5, 2 ) ); // stay QgsWkbTypes::Point - QCOMPARE( p33.project( 2, 180 ), QgsPointV2( 1, 0 ) ); - QCOMPARE( p33.project( 2, 180, 180 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, -2 ) ); - QCOMPARE( p33.project( 5, 270 ), QgsPointV2( -4, 2 ) ); - QCOMPARE( p33.project( 5, 270, 270 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 0 ) ); - QCOMPARE( p33.project( 6, 360 ), QgsPointV2( 1, 8 ) ); - QCOMPARE( p33.project( 6, 360, 360 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 6 ) ); - QCOMPARE( p33.project( 5, 450 ), QgsPointV2( 6, 2 ) ); - QCOMPARE( p33.project( 5, 450, 450 ), QgsPointV2( 6, 2 ) ); // stay QgsWkbTypes::Point - QCOMPARE( p33.project( -1, 0 ), QgsPointV2( 1, 1 ) ); - QCOMPARE( p33.project( -1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, -1 ) ); - QCOMPARE( p33.project( 1.5, -90 ), QgsPointV2( -0.5, 2 ) ); - QCOMPARE( p33.project( 1.5, -90, -90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 0 ) ); + QgsPoint p33 = QgsPoint( 1, 2 ); + QCOMPARE( p33.project( 1, 0 ), QgsPoint( 1, 3 ) ); + QCOMPARE( p33.project( 1, 0, 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 1 ) ); + QCOMPARE( p33.project( 1.5, 90 ), QgsPoint( 2.5, 2 ) ); + QCOMPARE( p33.project( 1.5, 90, 90 ), QgsPoint( 2.5, 2 ) ); // stay QgsWkbTypes::Point + QCOMPARE( p33.project( 2, 180 ), QgsPoint( 1, 0 ) ); + QCOMPARE( p33.project( 2, 180, 180 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, -2 ) ); + QCOMPARE( p33.project( 5, 270 ), QgsPoint( -4, 2 ) ); + QCOMPARE( p33.project( 5, 270, 270 ), QgsPoint( QgsWkbTypes::PointZ, 6, 2, 0 ) ); + QCOMPARE( p33.project( 6, 360 ), QgsPoint( 1, 8 ) ); + QCOMPARE( p33.project( 6, 360, 360 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 6 ) ); + QCOMPARE( p33.project( 5, 450 ), QgsPoint( 6, 2 ) ); + QCOMPARE( p33.project( 5, 450, 450 ), QgsPoint( 6, 2 ) ); // stay QgsWkbTypes::Point + QCOMPARE( p33.project( -1, 0 ), QgsPoint( 1, 1 ) ); + QCOMPARE( p33.project( -1, 0, 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, -1 ) ); + QCOMPARE( p33.project( 1.5, -90 ), QgsPoint( -0.5, 2 ) ); + QCOMPARE( p33.project( 1.5, -90, -90 ), QgsPoint( QgsWkbTypes::PointZ, 2.5, 2, 0 ) ); // PointM p33.addMValue( 5.0 ); - QCOMPARE( p33.project( 1, 0 ), QgsPointV2( QgsWkbTypes::PointM, 1, 3, 0, 5 ) ); - QCOMPARE( p33.project( 1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 1, 5 ) ); - QCOMPARE( p33.project( 5, 450, 450 ), QgsPointV2( QgsWkbTypes::PointM, 6, 2, 0, 5 ) ); + QCOMPARE( p33.project( 1, 0 ), QgsPoint( QgsWkbTypes::PointM, 1, 3, 0, 5 ) ); + QCOMPARE( p33.project( 1, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 1, 5 ) ); + QCOMPARE( p33.project( 5, 450, 450 ), QgsPoint( QgsWkbTypes::PointM, 6, 2, 0, 5 ) ); // 3D - QgsPointV2 p34 = QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ); - QCOMPARE( p34.project( 1, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 3, 2 ) ); - QCOMPARE( p34.project( 1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) ); - QCOMPARE( p34.project( 1.5, 90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 2 ) ); - QCOMPARE( p34.project( 1.5, 90, 90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 2 ) ); - QCOMPARE( p34.project( 2, 180 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 0, 2 ) ); - QCOMPARE( p34.project( 2, 180, 180 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 0 ) ); - QCOMPARE( p34.project( 5, 270 ), QgsPointV2( QgsWkbTypes::PointZ, -4, 2, 2 ) ); - QCOMPARE( p34.project( 5, 270, 270 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 2 ) ); - QCOMPARE( p34.project( 6, 360 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 8, 2 ) ); - QCOMPARE( p34.project( 6, 360, 360 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 8 ) ); - QCOMPARE( p34.project( 5, 450 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 2 ) ); - QCOMPARE( p34.project( 5, 450, 450 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 2 ) ); - QCOMPARE( p34.project( -1, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2 ) ); - QCOMPARE( p34.project( -1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 1 ) ); - QCOMPARE( p34.project( 1.5, -90 ), QgsPointV2( QgsWkbTypes::PointZ, -0.5, 2, 2 ) ); - QCOMPARE( p34.project( 1.5, -90, -90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 2 ) ); + QgsPoint p34 = QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ); + QCOMPARE( p34.project( 1, 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 3, 2 ) ); + QCOMPARE( p34.project( 1, 0, 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) ); + QCOMPARE( p34.project( 1.5, 90 ), QgsPoint( QgsWkbTypes::PointZ, 2.5, 2, 2 ) ); + QCOMPARE( p34.project( 1.5, 90, 90 ), QgsPoint( QgsWkbTypes::PointZ, 2.5, 2, 2 ) ); + QCOMPARE( p34.project( 2, 180 ), QgsPoint( QgsWkbTypes::PointZ, 1, 0, 2 ) ); + QCOMPARE( p34.project( 2, 180, 180 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 0 ) ); + QCOMPARE( p34.project( 5, 270 ), QgsPoint( QgsWkbTypes::PointZ, -4, 2, 2 ) ); + QCOMPARE( p34.project( 5, 270, 270 ), QgsPoint( QgsWkbTypes::PointZ, 6, 2, 2 ) ); + QCOMPARE( p34.project( 6, 360 ), QgsPoint( QgsWkbTypes::PointZ, 1, 8, 2 ) ); + QCOMPARE( p34.project( 6, 360, 360 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 8 ) ); + QCOMPARE( p34.project( 5, 450 ), QgsPoint( QgsWkbTypes::PointZ, 6, 2, 2 ) ); + QCOMPARE( p34.project( 5, 450, 450 ), QgsPoint( QgsWkbTypes::PointZ, 6, 2, 2 ) ); + QCOMPARE( p34.project( -1, 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2 ) ); + QCOMPARE( p34.project( -1, 0, 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 1 ) ); + QCOMPARE( p34.project( 1.5, -90 ), QgsPoint( QgsWkbTypes::PointZ, -0.5, 2, 2 ) ); + QCOMPARE( p34.project( 1.5, -90, -90 ), QgsPoint( QgsWkbTypes::PointZ, 2.5, 2, 2 ) ); // PointM p34.addMValue( 5.0 ); - QCOMPARE( p34.project( 1, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 3, 2, 5 ) ); - QCOMPARE( p34.project( 1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) ); - QCOMPARE( p34.project( 5, 450 ), QgsPointV2( QgsWkbTypes::PointZM, 6, 2, 2, 5 ) ); - QCOMPARE( p34.project( 5, 450, 450 ), QgsPointV2( QgsWkbTypes::PointZM, 6, 2, 2, 5 ) ); + QCOMPARE( p34.project( 1, 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 3, 2, 5 ) ); + QCOMPARE( p34.project( 1, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) ); + QCOMPARE( p34.project( 5, 450 ), QgsPoint( QgsWkbTypes::PointZM, 6, 2, 2, 5 ) ); + QCOMPARE( p34.project( 5, 450, 450 ), QgsPoint( QgsWkbTypes::PointZM, 6, 2, 2, 5 ) ); // inclination - QCOMPARE( QgsPointV2( 1, 2 ).inclination( QgsPointV2( 1, 2 ) ), 90.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2, 0 ) ), 90.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 90 ) ), 90.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, -90 ) ), 90.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 0 ) ), 0.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 180 ) ), 180.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, -180 ) ), 180.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 720 ) ), 0.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 45 ) ), 45.0 ); - QCOMPARE( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 135 ) ), 135.0 ); + QCOMPARE( QgsPoint( 1, 2 ).inclination( QgsPoint( 1, 2 ) ), 90.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2, 0 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 1, 2, 0 ) ), 90.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 90 ) ), 90.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, -90 ) ), 90.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 0 ) ), 0.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 180 ) ), 180.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, -180 ) ), 180.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 720 ) ), 0.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 45 ) ), 45.0 ); + QCOMPARE( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).inclination( QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ).project( 5, 90, 135 ) ), 135.0 ); } @@ -1065,9 +1065,9 @@ void TestQgsGeometry::lineString() QCOMPARE( fromArray8.zAt( 2 ), 23.0 ); QCOMPARE( fromArray8.mAt( 2 ), 33.0 ); - // from QList - QList ptsA; - ptsA << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ); + // from QList + QList ptsA; + ptsA << QgsPointXY( 1, 2 ) << QgsPointXY( 11, 12 ) << QgsPointXY( 21, 22 ); QgsLineString fromPts( ptsA ); QCOMPARE( fromPts.wkbType(), QgsWkbTypes::LineString ); QCOMPARE( fromPts.numPoints(), 3 ); @@ -1082,7 +1082,7 @@ void TestQgsGeometry::lineString() //addVertex QgsLineString l2; - l2.addVertex( QgsPointV2( 1.0, 2.0 ) ); + l2.addVertex( QgsPoint( 1.0, 2.0 ) ); QVERIFY( !l2.isEmpty() ); QCOMPARE( l2.numPoints(), 1 ); QCOMPARE( l2.vertexCount(), 1 ); @@ -1098,7 +1098,7 @@ void TestQgsGeometry::lineString() //adding first vertex should set linestring z/m type QgsLineString l3; - l3.addVertex( QgsPointV2( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0 ) ); + l3.addVertex( QgsPoint( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0 ) ); QVERIFY( !l3.isEmpty() ); QVERIFY( l3.is3D() ); QVERIFY( !l3.isMeasure() ); @@ -1106,7 +1106,7 @@ void TestQgsGeometry::lineString() QCOMPARE( l3.wktTypeStr(), QString( "LineStringZ" ) ); QgsLineString l4; - l4.addVertex( QgsPointV2( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 3.0 ) ); + l4.addVertex( QgsPoint( QgsWkbTypes::PointM, 1.0, 2.0, 0.0, 3.0 ) ); QVERIFY( !l4.isEmpty() ); QVERIFY( !l4.is3D() ); QVERIFY( l4.isMeasure() ); @@ -1114,7 +1114,7 @@ void TestQgsGeometry::lineString() QCOMPARE( l4.wktTypeStr(), QString( "LineStringM" ) ); QgsLineString l5; - l5.addVertex( QgsPointV2( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); + l5.addVertex( QgsPoint( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); QVERIFY( !l5.isEmpty() ); QVERIFY( l5.is3D() ); QVERIFY( l5.isMeasure() ); @@ -1122,7 +1122,7 @@ void TestQgsGeometry::lineString() QCOMPARE( l5.wktTypeStr(), QString( "LineStringZM" ) ); QgsLineString l25d; - l25d.addVertex( QgsPointV2( QgsWkbTypes::Point25D, 1.0, 2.0, 3.0 ) ); + l25d.addVertex( QgsPoint( QgsWkbTypes::Point25D, 1.0, 2.0, 3.0 ) ); QVERIFY( !l25d.isEmpty() ); QVERIFY( l25d.is3D() ); QVERIFY( !l25d.isMeasure() ); @@ -1131,9 +1131,9 @@ void TestQgsGeometry::lineString() //adding subsequent vertices should not alter z/m type, regardless of points type QgsLineString l6; - l6.addVertex( QgsPointV2( QgsWkbTypes::Point, 1.0, 2.0 ) ); //2d type + l6.addVertex( QgsPoint( QgsWkbTypes::Point, 1.0, 2.0 ) ); //2d type QCOMPARE( l6.wkbType(), QgsWkbTypes::LineString ); - l6.addVertex( QgsPointV2( QgsWkbTypes::PointZ, 11.0, 12.0, 13.0 ) ); // add 3d point + l6.addVertex( QgsPoint( QgsWkbTypes::PointZ, 11.0, 12.0, 13.0 ) ); // add 3d point QCOMPARE( l6.numPoints(), 2 ); QCOMPARE( l6.vertexCount(), 2 ); QCOMPARE( l6.nCoordinates(), 2 ); @@ -1145,11 +1145,11 @@ void TestQgsGeometry::lineString() QCOMPARE( l6.perimeter(), 0.0 ); QgsLineString l7; - l7.addVertex( QgsPointV2( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0 ) ); //3d type + l7.addVertex( QgsPoint( QgsWkbTypes::PointZ, 1.0, 2.0, 3.0 ) ); //3d type QCOMPARE( l7.wkbType(), QgsWkbTypes::LineStringZ ); - l7.addVertex( QgsPointV2( QgsWkbTypes::Point, 11.0, 12.0 ) ); //add 2d point + l7.addVertex( QgsPoint( QgsWkbTypes::Point, 11.0, 12.0 ) ); //add 2d point QCOMPARE( l7.wkbType(), QgsWkbTypes::LineStringZ ); //should still be 3d - QCOMPARE( l7.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZ, 11.0, 12.0, 0.0 ) ); + QCOMPARE( l7.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZ, 11.0, 12.0, 0.0 ) ); QVERIFY( l7.is3D() ); QCOMPARE( l7.numPoints(), 2 ); QCOMPARE( l7.vertexCount(), 2 ); @@ -1171,7 +1171,7 @@ void TestQgsGeometry::lineString() //setPoints QgsLineString l8; - l8.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 2, 3 ) << QgsPointV2( 3, 4 ) ); + l8.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 2, 3 ) << QgsPoint( 3, 4 ) ); QVERIFY( !l8.isEmpty() ); QCOMPARE( l8.numPoints(), 3 ); QCOMPARE( l8.vertexCount(), 3 ); @@ -1194,54 +1194,54 @@ void TestQgsGeometry::lineString() QCOMPARE( l8.wkbType(), QgsWkbTypes::LineString ); //setPoints with z - l8.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZ, 2, 3, 4 ) ); + l8.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 2, 3, 4 ) ); QCOMPARE( l8.numPoints(), 2 ); QVERIFY( l8.is3D() ); QVERIFY( !l8.isMeasure() ); QCOMPARE( l8.wkbType(), QgsWkbTypes::LineStringZ ); //setPoints with 25d - l8.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 4 ) << QgsPointV2( QgsWkbTypes::Point25D, 2, 3, 4 ) ); + l8.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 4 ) << QgsPoint( QgsWkbTypes::Point25D, 2, 3, 4 ) ); QCOMPARE( l8.numPoints(), 2 ); QVERIFY( l8.is3D() ); QVERIFY( !l8.isMeasure() ); QCOMPARE( l8.wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( l8.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 4 ) ); + QCOMPARE( l8.pointN( 0 ), QgsPoint( QgsWkbTypes::Point25D, 1, 2, 4 ) ); //setPoints with m - l8.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 3 ) << QgsPointV2( QgsWkbTypes::PointM, 2, 3, 0, 4 ) ); + l8.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 3 ) << QgsPoint( QgsWkbTypes::PointM, 2, 3, 0, 4 ) ); QCOMPARE( l8.numPoints(), 2 ); QVERIFY( !l8.is3D() ); QVERIFY( l8.isMeasure() ); QCOMPARE( l8.wkbType(), QgsWkbTypes::LineStringM ); //setPoints with zm - l8.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 4, 5 ) << QgsPointV2( QgsWkbTypes::PointZM, 2, 3, 4, 5 ) ); + l8.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 4, 5 ) << QgsPoint( QgsWkbTypes::PointZM, 2, 3, 4, 5 ) ); QCOMPARE( l8.numPoints(), 2 ); QVERIFY( l8.is3D() ); QVERIFY( l8.isMeasure() ); QCOMPARE( l8.wkbType(), QgsWkbTypes::LineStringZM ); //setPoints with MIXED dimensionality of points - l8.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 4, 5 ) << QgsPointV2( QgsWkbTypes::PointM, 2, 3, 0, 5 ) ); + l8.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 4, 5 ) << QgsPoint( QgsWkbTypes::PointM, 2, 3, 0, 5 ) ); QCOMPARE( l8.numPoints(), 2 ); QVERIFY( l8.is3D() ); QVERIFY( l8.isMeasure() ); QCOMPARE( l8.wkbType(), QgsWkbTypes::LineStringZM ); //test point - QCOMPARE( l8.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 4, 5 ) ); - QCOMPARE( l8.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 2, 3, 0, 5 ) ); + QCOMPARE( l8.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 4, 5 ) ); + QCOMPARE( l8.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 2, 3, 0, 5 ) ); //out of range - just want no crash here - QgsPointV2 bad = l8.pointN( -1 ); + QgsPoint bad = l8.pointN( -1 ); bad = l8.pointN( 100 ); //test getters/setters QgsLineString l9; - l9.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) - << QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 23, 24 ) ); + l9.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) + << QgsPoint( QgsWkbTypes::PointZM, 21, 22, 23, 24 ) ); QCOMPARE( l9.xAt( 0 ), 1.0 ); QCOMPARE( l9.xAt( 1 ), 11.0 ); QCOMPARE( l9.xAt( 2 ), 21.0 ); @@ -1295,9 +1295,9 @@ void TestQgsGeometry::lineString() l9.setMAt( 11, 54.0 ); //out of range //check zAt/setZAt with non-3d linestring - l9.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) - << QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 14 ) - << QgsPointV2( QgsWkbTypes::PointM, 21, 22, 0, 24 ) ); + l9.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) + << QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) + << QgsPoint( QgsWkbTypes::PointM, 21, 22, 0, 24 ) ); //basically we just don't want these to crash QCOMPARE( l9.zAt( 0 ), 0.0 ); @@ -1306,9 +1306,9 @@ void TestQgsGeometry::lineString() l9.setZAt( 1, 63.0 ); //check mAt/setMAt with non-measure linestring - l9.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 12 ) - << QgsPointV2( 21, 22 ) ); + l9.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 12 ) + << QgsPoint( 21, 22 ) ); //basically we just don't want these to crash QCOMPARE( l9.mAt( 0 ), 0.0 ); @@ -1325,9 +1325,9 @@ void TestQgsGeometry::lineString() QCOMPARE( l10.numPoints(), 0 ); std::unique_ptr toAppend( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 12 ) - << QgsPointV2( 21, 22 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 12 ) + << QgsPoint( 21, 22 ) ); l10.append( toAppend.get() ); QVERIFY( !l10.is3D() ); QVERIFY( !l10.isMeasure() ); @@ -1343,9 +1343,9 @@ void TestQgsGeometry::lineString() //add more points toAppend.reset( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( 31, 32 ) - << QgsPointV2( 41, 42 ) - << QgsPointV2( 51, 52 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( 31, 32 ) + << QgsPoint( 41, 42 ) + << QgsPoint( 51, 52 ) ); l10.append( toAppend.get() ); QCOMPARE( l10.numPoints(), 6 ); QCOMPARE( l10.vertexCount(), 6 ); @@ -1359,9 +1359,9 @@ void TestQgsGeometry::lineString() //check dimensionality is inherited from append line if initially empty l10.clear(); toAppend.reset( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 31, 32, 33, 34 ) - << QgsPointV2( QgsWkbTypes::PointZM, 41, 42, 43, 44 ) - << QgsPointV2( QgsWkbTypes::PointZM, 51, 52, 53, 54 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 31, 32, 33, 34 ) + << QgsPoint( QgsWkbTypes::PointZM, 41, 42, 43, 44 ) + << QgsPoint( QgsWkbTypes::PointZM, 51, 52, 53, 54 ) ); l10.append( toAppend.get() ); QVERIFY( l10.is3D() ); QVERIFY( l10.isMeasure() ); @@ -1375,74 +1375,74 @@ void TestQgsGeometry::lineString() //append points with z to non z linestring l10.clear(); - l10.addVertex( QgsPointV2( 1.0, 2.0 ) ); + l10.addVertex( QgsPoint( 1.0, 2.0 ) ); QVERIFY( !l10.is3D() ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineString ); toAppend.reset( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 31, 32, 33, 34 ) - << QgsPointV2( QgsWkbTypes::PointZM, 41, 42, 43, 44 ) - << QgsPointV2( QgsWkbTypes::PointZM, 51, 52, 53, 54 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 31, 32, 33, 34 ) + << QgsPoint( QgsWkbTypes::PointZM, 41, 42, 43, 44 ) + << QgsPoint( QgsWkbTypes::PointZM, 51, 52, 53, 54 ) ); l10.append( toAppend.get() ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l10.pointN( 0 ), QgsPointV2( 1, 2 ) ); - QCOMPARE( l10.pointN( 1 ), QgsPointV2( 31, 32 ) ); - QCOMPARE( l10.pointN( 2 ), QgsPointV2( 41, 42 ) ); - QCOMPARE( l10.pointN( 3 ), QgsPointV2( 51, 52 ) ); + QCOMPARE( l10.pointN( 0 ), QgsPoint( 1, 2 ) ); + QCOMPARE( l10.pointN( 1 ), QgsPoint( 31, 32 ) ); + QCOMPARE( l10.pointN( 2 ), QgsPoint( 41, 42 ) ); + QCOMPARE( l10.pointN( 3 ), QgsPoint( 51, 52 ) ); //append points without z/m to linestring with z & m l10.clear(); - l10.addVertex( QgsPointV2( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); + l10.addVertex( QgsPoint( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 ) ); QVERIFY( l10.is3D() ); QVERIFY( l10.isMeasure() ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineStringZM ); toAppend.reset( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( 31, 32 ) - << QgsPointV2( 41, 42 ) - << QgsPointV2( 51, 52 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( 31, 32 ) + << QgsPoint( 41, 42 ) + << QgsPoint( 51, 52 ) ); l10.append( toAppend.get() ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l10.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); - QCOMPARE( l10.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 31, 32 ) ); - QCOMPARE( l10.pointN( 2 ), QgsPointV2( QgsWkbTypes::PointZM, 41, 42 ) ); - QCOMPARE( l10.pointN( 3 ), QgsPointV2( QgsWkbTypes::PointZM, 51, 52 ) ); + QCOMPARE( l10.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); + QCOMPARE( l10.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 31, 32 ) ); + QCOMPARE( l10.pointN( 2 ), QgsPoint( QgsWkbTypes::PointZM, 41, 42 ) ); + QCOMPARE( l10.pointN( 3 ), QgsPoint( QgsWkbTypes::PointZM, 51, 52 ) ); //25d append l10.clear(); toAppend.reset( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 31, 32, 33 ) - << QgsPointV2( QgsWkbTypes::Point25D, 41, 42, 43 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 31, 32, 33 ) + << QgsPoint( QgsWkbTypes::Point25D, 41, 42, 43 ) ); l10.append( toAppend.get() ); QVERIFY( l10.is3D() ); QVERIFY( !l10.isMeasure() ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( l10.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point25D, 31, 32, 33 ) ); - QCOMPARE( l10.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point25D, 41, 42, 43 ) ); + QCOMPARE( l10.pointN( 0 ), QgsPoint( QgsWkbTypes::Point25D, 31, 32, 33 ) ); + QCOMPARE( l10.pointN( 1 ), QgsPoint( QgsWkbTypes::Point25D, 41, 42, 43 ) ); l10.clear(); - l10.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 33 ) ); + l10.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 33 ) ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineString25D ); l10.append( toAppend.get() ); QVERIFY( l10.is3D() ); QVERIFY( !l10.isMeasure() ); QCOMPARE( l10.wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( l10.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 33 ) ); - QCOMPARE( l10.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point25D, 31, 32, 33 ) ); - QCOMPARE( l10.pointN( 2 ), QgsPointV2( QgsWkbTypes::Point25D, 41, 42, 43 ) ); + QCOMPARE( l10.pointN( 0 ), QgsPoint( QgsWkbTypes::Point25D, 11, 12, 33 ) ); + QCOMPARE( l10.pointN( 1 ), QgsPoint( QgsWkbTypes::Point25D, 31, 32, 33 ) ); + QCOMPARE( l10.pointN( 2 ), QgsPoint( QgsWkbTypes::Point25D, 41, 42, 43 ) ); //append another line the closes the original geometry. //Make sure there are not duplicit points except start and end point l10.clear(); toAppend.reset( new QgsLineString() ); toAppend->setPoints( QgsPointSequence() - << QgsPointV2( 1, 1 ) - << QgsPointV2( 5, 5 ) - << QgsPointV2( 10, 1 ) ); + << QgsPoint( 1, 1 ) + << QgsPoint( 5, 5 ) + << QgsPoint( 10, 1 ) ); l10.append( toAppend.get() ); QCOMPARE( l10.numPoints(), 3 ); QCOMPARE( l10.vertexCount(), 3 ); toAppend.reset( new QgsLineString() ); toAppend->setPoints( QgsPointSequence() - << QgsPointV2( 10, 1 ) - << QgsPointV2( 1, 1 ) ); + << QgsPoint( 10, 1 ) + << QgsPoint( 1, 1 ) ); l10.append( toAppend.get() ); QVERIFY( l10.isClosed() ); @@ -1454,50 +1454,50 @@ void TestQgsGeometry::lineString() QgsLineString e2; QVERIFY( e1 == e2 ); QVERIFY( !( e1 != e2 ) ); - e1.addVertex( QgsPointV2( 1, 2 ) ); + e1.addVertex( QgsPoint( 1, 2 ) ); QVERIFY( !( e1 == e2 ) ); //different number of vertices QVERIFY( e1 != e2 ); - e2.addVertex( QgsPointV2( 1, 2 ) ); + e2.addVertex( QgsPoint( 1, 2 ) ); QVERIFY( e1 == e2 ); QVERIFY( !( e1 != e2 ) ); - e1.addVertex( QgsPointV2( 1 / 3.0, 4 / 3.0 ) ); - e2.addVertex( QgsPointV2( 2 / 6.0, 8 / 6.0 ) ); + e1.addVertex( QgsPoint( 1 / 3.0, 4 / 3.0 ) ); + e2.addVertex( QgsPoint( 2 / 6.0, 8 / 6.0 ) ); QVERIFY( e1 == e2 ); //check non-integer equality QVERIFY( !( e1 != e2 ) ); - e1.addVertex( QgsPointV2( 7, 8 ) ); - e2.addVertex( QgsPointV2( 6, 9 ) ); + e1.addVertex( QgsPoint( 7, 8 ) ); + e2.addVertex( QgsPoint( 6, 9 ) ); QVERIFY( !( e1 == e2 ) ); //different coordinates QVERIFY( e1 != e2 ); QgsLineString e3; - e3.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 0 ) - << QgsPointV2( QgsWkbTypes::PointZ, 1 / 3.0, 4 / 3.0, 0 ) - << QgsPointV2( QgsWkbTypes::PointZ, 7, 8, 0 ) ); + e3.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 0 ) + << QgsPoint( QgsWkbTypes::PointZ, 1 / 3.0, 4 / 3.0, 0 ) + << QgsPoint( QgsWkbTypes::PointZ, 7, 8, 0 ) ); QVERIFY( !( e1 == e3 ) ); //different dimension QVERIFY( e1 != e3 ); QgsLineString e4; - e4.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ) - << QgsPointV2( QgsWkbTypes::PointZ, 1 / 3.0, 4 / 3.0, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 7, 8, 4 ) ); + e4.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ) + << QgsPoint( QgsWkbTypes::PointZ, 1 / 3.0, 4 / 3.0, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 7, 8, 4 ) ); QVERIFY( !( e3 == e4 ) ); //different z coordinates QVERIFY( e3 != e4 ); QgsLineString e5; - e5.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 1 / 3.0, 4 / 3.0, 0, 2 ) - << QgsPointV2( QgsWkbTypes::PointM, 7, 8, 0, 3 ) ); + e5.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 1 / 3.0, 4 / 3.0, 0, 2 ) + << QgsPoint( QgsWkbTypes::PointM, 7, 8, 0, 3 ) ); QgsLineString e6; - e6.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 11 ) - << QgsPointV2( QgsWkbTypes::PointM, 1 / 3.0, 4 / 3.0, 0, 12 ) - << QgsPointV2( QgsWkbTypes::PointM, 7, 8, 0, 13 ) ); + e6.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 11 ) + << QgsPoint( QgsWkbTypes::PointM, 1 / 3.0, 4 / 3.0, 0, 12 ) + << QgsPoint( QgsWkbTypes::PointM, 7, 8, 0, 13 ) ); QVERIFY( !( e5 == e6 ) ); //different m values QVERIFY( e5 != e6 ); //close/isClosed QgsLineString l11; QVERIFY( !l11.isClosed() ); - l11.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 2 ) - << QgsPointV2( 11, 22 ) - << QgsPointV2( 1, 22 ) ); + l11.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 2 ) + << QgsPoint( 11, 22 ) + << QgsPoint( 1, 22 ) ); QVERIFY( !l11.isClosed() ); QCOMPARE( l11.numPoints(), 4 ); QCOMPARE( l11.area(), 0.0 ); @@ -1509,37 +1509,37 @@ void TestQgsGeometry::lineString() QCOMPARE( l11.nCoordinates(), 5 ); QCOMPARE( l11.ringCount(), 1 ); QCOMPARE( l11.partCount(), 1 ); - QCOMPARE( l11.pointN( 4 ), QgsPointV2( 1, 2 ) ); + QCOMPARE( l11.pointN( 4 ), QgsPoint( 1, 2 ) ); QCOMPARE( l11.area(), 0.0 ); QCOMPARE( l11.perimeter(), 0.0 ); //try closing already closed line, should be no change l11.close(); QVERIFY( l11.isClosed() ); QCOMPARE( l11.numPoints(), 5 ); - QCOMPARE( l11.pointN( 4 ), QgsPointV2( 1, 2 ) ); + QCOMPARE( l11.pointN( 4 ), QgsPoint( 1, 2 ) ); //test that m values aren't considered when testing for closedness - l11.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 11, 2, 0, 4 ) - << QgsPointV2( QgsWkbTypes::PointM, 11, 22, 0, 5 ) - << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 6 ) ); + l11.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 11, 2, 0, 4 ) + << QgsPoint( QgsWkbTypes::PointM, 11, 22, 0, 5 ) + << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 6 ) ); QVERIFY( l11.isClosed() ); //close with z and m QgsLineString l12; - l12.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); + l12.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); l12.close(); - QCOMPARE( l12.pointN( 4 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); + QCOMPARE( l12.pointN( 4 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); //polygonf QgsLineString l13; - l13.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); + l13.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); QPolygonF poly = l13.asQPolygonF(); QCOMPARE( poly.count(), 4 ); @@ -1555,10 +1555,10 @@ void TestQgsGeometry::lineString() // clone tests. At the same time, check segmentize as the result should // be equal to a clone for LineStrings QgsLineString l14; - l14.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 2 ) - << QgsPointV2( 11, 22 ) - << QgsPointV2( 1, 22 ) ); + l14.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 2 ) + << QgsPoint( 11, 22 ) + << QgsPoint( 1, 22 ) ); std::unique_ptr cloned( l14.clone() ); QCOMPARE( cloned->numPoints(), 4 ); QCOMPARE( cloned->vertexCount(), 4 ); @@ -1582,10 +1582,10 @@ void TestQgsGeometry::lineString() QCOMPARE( segmentized->pointN( 3 ), l14.pointN( 3 ) ); //clone with Z/M - l14.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); + l14.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); cloned.reset( l14.clone() ); QCOMPARE( cloned->numPoints(), 4 ); QCOMPARE( cloned->wkbType(), QgsWkbTypes::LineStringZM ); @@ -1622,10 +1622,10 @@ void TestQgsGeometry::lineString() //to/from WKB QgsLineString l15; - l15.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); + l15.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); QByteArray wkb15 = l15.asWkb(); QgsLineString l16; QgsConstWkbPtr wkb15ptr( wkb15 ); @@ -1648,7 +1648,7 @@ void TestQgsGeometry::lineString() QgsConstWkbPtr nullPtr( nullptr, 0 ); QVERIFY( !l16.fromWkb( nullPtr ) ); QCOMPARE( l16.wkbType(), QgsWkbTypes::LineString ); - QgsPointV2 point( 1, 2 ); + QgsPoint point( 1, 2 ); QByteArray wkb16 = point.asWkb(); QgsConstWkbPtr wkb16ptr( wkb16 ); QVERIFY( !l16.fromWkb( wkb16ptr ) ); @@ -1656,10 +1656,10 @@ void TestQgsGeometry::lineString() //to/from WKT QgsLineString l17; - l17.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); + l17.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 2, 11, 14 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 22, 21, 24 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 31, 34 ) ); QString wkt = l17.asWkt(); QVERIFY( !wkt.isEmpty() ); @@ -1684,13 +1684,13 @@ void TestQgsGeometry::lineString() //asGML2 QgsLineString exportLine; - exportLine.setPoints( QgsPointSequence() << QgsPointV2( 31, 32 ) - << QgsPointV2( 41, 42 ) - << QgsPointV2( 51, 52 ) ); + exportLine.setPoints( QgsPointSequence() << QgsPoint( 31, 32 ) + << QgsPoint( 41, 42 ) + << QgsPoint( 51, 52 ) ); QgsLineString exportLineFloat; - exportLineFloat.setPoints( QgsPointSequence() << QgsPointV2( 1 / 3.0, 2 / 3.0 ) - << QgsPointV2( 1 + 1 / 3.0, 1 + 2 / 3.0 ) - << QgsPointV2( 2 + 1 / 3.0, 2 + 2 / 3.0 ) ); + exportLineFloat.setPoints( QgsPointSequence() << QgsPoint( 1 / 3.0, 2 / 3.0 ) + << QgsPoint( 1 + 1 / 3.0, 1 + 2 / 3.0 ) + << QgsPoint( 2 + 1 / 3.0, 2 + 2 / 3.0 ) ); QDomDocument doc( QStringLiteral( "gml" ) ); QString expectedGML2( QStringLiteral( "31,32 41,42 51,52" ) ); QCOMPARE( elemToString( exportLine.asGML2( doc ) ), expectedGML2 ); @@ -1712,26 +1712,26 @@ void TestQgsGeometry::lineString() //length QgsLineString l19; QCOMPARE( l19.length(), 0.0 ); - l19.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + l19.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); QCOMPARE( l19.length(), 23.0 ); //startPoint - QCOMPARE( l19.startPoint(), QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) ); + QCOMPARE( l19.startPoint(), QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) ); //endPoint - QCOMPARE( l19.endPoint(), QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + QCOMPARE( l19.endPoint(), QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); //bad start/end points. Test that this doesn't crash. l19.clear(); - QCOMPARE( l19.startPoint(), QgsPointV2() ); - QCOMPARE( l19.endPoint(), QgsPointV2() ); + QCOMPARE( l19.startPoint(), QgsPoint() ); + QCOMPARE( l19.endPoint(), QgsPoint() ); //curveToLine - no segmentation required, so should return a clone - l19.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + l19.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); segmentized.reset( l19.curveToLine() ); QCOMPARE( segmentized->numPoints(), 3 ); QCOMPARE( segmentized->wkbType(), QgsWkbTypes::LineStringZM ); @@ -1746,14 +1746,14 @@ void TestQgsGeometry::lineString() QgsPointSequence points; l20.points( points ); QVERIFY( l20.isEmpty() ); - l20.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + l20.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); l20.points( points ); QCOMPARE( points.count(), 3 ); - QCOMPARE( points.at( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) ); - QCOMPARE( points.at( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) ); - QCOMPARE( points.at( 2 ), QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + QCOMPARE( points.at( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) ); + QCOMPARE( points.at( 1 ), QgsPoint( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) ); + QCOMPARE( points.at( 2 ), QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); //CRS transform QgsCoordinateReferenceSystem sourceSrs; @@ -1764,8 +1764,8 @@ void TestQgsGeometry::lineString() // 2d CRS transform QgsLineString l21; - l21.setPoints( QgsPointSequence() << QgsPointV2( 6374985, -3626584 ) - << QgsPointV2( 6474985, -3526584 ) ); + l21.setPoints( QgsPointSequence() << QgsPoint( 6374985, -3626584 ) + << QgsPoint( 6474985, -3526584 ) ); l21.transform( tr, QgsCoordinateTransform::ForwardTransform ); QGSCOMPARENEAR( l21.pointN( 0 ).x(), 175.771, 0.001 ); QGSCOMPARENEAR( l21.pointN( 0 ).y(), -39.724, 0.001 ); @@ -1778,8 +1778,8 @@ void TestQgsGeometry::lineString() //3d CRS transform QgsLineString l22; - l22.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 6374985, -3626584, 1, 2 ) - << QgsPointV2( QgsWkbTypes::PointZM, 6474985, -3526584, 3, 4 ) ); + l22.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 6374985, -3626584, 1, 2 ) + << QgsPoint( QgsWkbTypes::PointZM, 6474985, -3526584, 3, 4 ) ); l22.transform( tr, QgsCoordinateTransform::ForwardTransform ); QGSCOMPARENEAR( l22.pointN( 0 ).x(), 175.771, 0.001 ); QGSCOMPARENEAR( l22.pointN( 0 ).y(), -39.724, 0.001 ); @@ -1812,130 +1812,130 @@ void TestQgsGeometry::lineString() //QTransform transform QTransform qtr = QTransform::fromScale( 2, 3 ); QgsLineString l23; - l23.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + l23.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); l23.transform( qtr ); - QCOMPARE( l23.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 2, 6, 3, 4 ) ); - QCOMPARE( l23.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 22, 36, 13, 14 ) ); + QCOMPARE( l23.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 2, 6, 3, 4 ) ); + QCOMPARE( l23.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 22, 36, 13, 14 ) ); QCOMPARE( l23.boundingBox(), QgsRectangle( 2, 6, 22, 36 ) ); //insert vertex //insert vertex in empty line QgsLineString l24; - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( 6.0, 7.0 ) ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( 6.0, 7.0 ) ) ); QCOMPARE( l24.numPoints(), 1 ); QVERIFY( !l24.is3D() ); QVERIFY( !l24.isMeasure() ); QCOMPARE( l24.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l24.pointN( 0 ), QgsPointV2( 6.0, 7.0 ) ); + QCOMPARE( l24.pointN( 0 ), QgsPoint( 6.0, 7.0 ) ); //insert 4d vertex in empty line, should set line to 4d l24.clear(); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 6.0, 7.0, 1.0, 2.0 ) ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 6.0, 7.0, 1.0, 2.0 ) ) ); QCOMPARE( l24.numPoints(), 1 ); QVERIFY( l24.is3D() ); QVERIFY( l24.isMeasure() ); QCOMPARE( l24.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l24.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 6.0, 7.0, 1.0, 2.0 ) ); + QCOMPARE( l24.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 6.0, 7.0, 1.0, 2.0 ) ); //2d line - l24.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 12 ) << QgsPointV2( 21, 22 ) ); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( 6.0, 7.0 ) ) ); + l24.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( 6.0, 7.0 ) ) ); QCOMPARE( l24.numPoints(), 4 ); QVERIFY( !l24.is3D() ); QVERIFY( !l24.isMeasure() ); QCOMPARE( l24.wkbType(), QgsWkbTypes::LineString ); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( 8.0, 9.0 ) ) ); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 2 ), QgsPointV2( 18.0, 19.0 ) ) ); - QCOMPARE( l24.pointN( 0 ), QgsPointV2( 6.0, 7.0 ) ); - QCOMPARE( l24.pointN( 1 ), QgsPointV2( 8.0, 9.0 ) ); - QCOMPARE( l24.pointN( 2 ), QgsPointV2( 18.0, 19.0 ) ); - QCOMPARE( l24.pointN( 3 ), QgsPointV2( 1.0, 2.0 ) ); - QCOMPARE( l24.pointN( 4 ), QgsPointV2( 11.0, 12.0 ) ); - QCOMPARE( l24.pointN( 5 ), QgsPointV2( 21.0, 22.0 ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( 8.0, 9.0 ) ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 2 ), QgsPoint( 18.0, 19.0 ) ) ); + QCOMPARE( l24.pointN( 0 ), QgsPoint( 6.0, 7.0 ) ); + QCOMPARE( l24.pointN( 1 ), QgsPoint( 8.0, 9.0 ) ); + QCOMPARE( l24.pointN( 2 ), QgsPoint( 18.0, 19.0 ) ); + QCOMPARE( l24.pointN( 3 ), QgsPoint( 1.0, 2.0 ) ); + QCOMPARE( l24.pointN( 4 ), QgsPoint( 11.0, 12.0 ) ); + QCOMPARE( l24.pointN( 5 ), QgsPoint( 21.0, 22.0 ) ); //insert vertex at end - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 6 ), QgsPointV2( 31.0, 32.0 ) ) ); - QCOMPARE( l24.pointN( 6 ), QgsPointV2( 31.0, 32.0 ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 6 ), QgsPoint( 31.0, 32.0 ) ) ); + QCOMPARE( l24.pointN( 6 ), QgsPoint( 31.0, 32.0 ) ); QCOMPARE( l24.numPoints(), 7 ); //insert vertex past end - QVERIFY( !l24.insertVertex( QgsVertexId( 0, 0, 8 ), QgsPointV2( 41.0, 42.0 ) ) ); + QVERIFY( !l24.insertVertex( QgsVertexId( 0, 0, 8 ), QgsPoint( 41.0, 42.0 ) ) ); QCOMPARE( l24.numPoints(), 7 ); //insert vertex before start - QVERIFY( !l24.insertVertex( QgsVertexId( 0, 0, -18 ), QgsPointV2( 41.0, 42.0 ) ) ); + QVERIFY( !l24.insertVertex( QgsVertexId( 0, 0, -18 ), QgsPoint( 41.0, 42.0 ) ) ); QCOMPARE( l24.numPoints(), 7 ); //insert 4d vertex in 4d line - l24.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ) ); + l24.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ) ); QCOMPARE( l24.numPoints(), 4 ); - QCOMPARE( l24.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + QCOMPARE( l24.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); //insert 2d vertex in 4d line - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( 101, 102 ) ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( 101, 102 ) ) ); QCOMPARE( l24.numPoints(), 5 ); QCOMPARE( l24.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l24.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 101, 102, 0, 0 ) ); + QCOMPARE( l24.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 101, 102, 0, 0 ) ); //insert 4d vertex in 2d line - l24.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 12 ) << QgsPointV2( 21, 22 ) ); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 101, 102, 103, 104 ) ) ); + l24.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 101, 102, 103, 104 ) ) ); QCOMPARE( l24.numPoints(), 4 ); QCOMPARE( l24.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l24.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point, 101, 102 ) ); + QCOMPARE( l24.pointN( 0 ), QgsPoint( QgsWkbTypes::Point, 101, 102 ) ); //insert first vertex as Point25D l24.clear(); - QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::Point25D, 101, 102, 103 ) ) ); + QVERIFY( l24.insertVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::Point25D, 101, 102, 103 ) ) ); QCOMPARE( l24.wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( l24.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point25D, 101, 102, 103 ) ); + QCOMPARE( l24.pointN( 0 ), QgsPoint( QgsWkbTypes::Point25D, 101, 102, 103 ) ); //move vertex //empty line QgsLineString l25; - QVERIFY( !l25.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( 6.0, 7.0 ) ) ); + QVERIFY( !l25.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( 6.0, 7.0 ) ) ); QVERIFY( l25.isEmpty() ); //valid line - l25.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 12 ) << QgsPointV2( 21, 22 ) ); - QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( 6.0, 7.0 ) ) ); - QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( 16.0, 17.0 ) ) ); - QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 2 ), QgsPointV2( 26.0, 27.0 ) ) ); - QCOMPARE( l25.pointN( 0 ), QgsPointV2( 6.0, 7.0 ) ); - QCOMPARE( l25.pointN( 1 ), QgsPointV2( 16.0, 17.0 ) ); - QCOMPARE( l25.pointN( 2 ), QgsPointV2( 26.0, 27.0 ) ); + l25.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) ); + QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( 6.0, 7.0 ) ) ); + QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( 16.0, 17.0 ) ) ); + QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 2 ), QgsPoint( 26.0, 27.0 ) ) ); + QCOMPARE( l25.pointN( 0 ), QgsPoint( 6.0, 7.0 ) ); + QCOMPARE( l25.pointN( 1 ), QgsPoint( 16.0, 17.0 ) ); + QCOMPARE( l25.pointN( 2 ), QgsPoint( 26.0, 27.0 ) ); //out of range - QVERIFY( !l25.moveVertex( QgsVertexId( 0, 0, -1 ), QgsPointV2( 3.0, 4.0 ) ) ); - QVERIFY( !l25.moveVertex( QgsVertexId( 0, 0, 10 ), QgsPointV2( 3.0, 4.0 ) ) ); - QCOMPARE( l25.pointN( 0 ), QgsPointV2( 6.0, 7.0 ) ); - QCOMPARE( l25.pointN( 1 ), QgsPointV2( 16.0, 17.0 ) ); - QCOMPARE( l25.pointN( 2 ), QgsPointV2( 26.0, 27.0 ) ); + QVERIFY( !l25.moveVertex( QgsVertexId( 0, 0, -1 ), QgsPoint( 3.0, 4.0 ) ) ); + QVERIFY( !l25.moveVertex( QgsVertexId( 0, 0, 10 ), QgsPoint( 3.0, 4.0 ) ) ); + QCOMPARE( l25.pointN( 0 ), QgsPoint( 6.0, 7.0 ) ); + QCOMPARE( l25.pointN( 1 ), QgsPoint( 16.0, 17.0 ) ); + QCOMPARE( l25.pointN( 2 ), QgsPoint( 26.0, 27.0 ) ); //move 4d point in 4d line - l25.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); - QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( QgsWkbTypes::PointZM, 6, 7, 12, 13 ) ) ); - QCOMPARE( l25.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 6, 7, 12, 13 ) ); + l25.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 10, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 15, 10, 6, 7 ) ); + QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( QgsWkbTypes::PointZM, 6, 7, 12, 13 ) ) ); + QCOMPARE( l25.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 6, 7, 12, 13 ) ); //move 2d point in 4d line, existing z/m should be maintained - QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( 34, 35 ) ) ); - QCOMPARE( l25.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 34, 35, 12, 13 ) ); + QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( 34, 35 ) ) ); + QCOMPARE( l25.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 34, 35, 12, 13 ) ); //move 4d point in 2d line - l25.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) - << QgsPointV2( 11, 12 ) << QgsPointV2( 21, 22 ) ); - QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 3, 4, 2, 3 ) ) ); - QCOMPARE( l25.pointN( 0 ), QgsPointV2( 3, 4 ) ); + l25.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) + << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) ); + QVERIFY( l25.moveVertex( QgsVertexId( 0, 0, 0 ), QgsPoint( QgsWkbTypes::PointZM, 3, 4, 2, 3 ) ) ); + QCOMPARE( l25.pointN( 0 ), QgsPoint( 3, 4 ) ); //delete vertex @@ -1946,9 +1946,9 @@ void TestQgsGeometry::lineString() QVERIFY( l26.isEmpty() ); //valid line - l26.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); + l26.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); //out of range vertices QVERIFY( !l26.deleteVertex( QgsVertexId( 0, 0, -1 ) ) ); QVERIFY( !l26.deleteVertex( QgsVertexId( 0, 0, 100 ) ) ); @@ -1956,8 +1956,8 @@ void TestQgsGeometry::lineString() //valid vertices QVERIFY( l26.deleteVertex( QgsVertexId( 0, 0, 1 ) ) ); QCOMPARE( l26.numPoints(), 2 ); - QCOMPARE( l26.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) ); - QCOMPARE( l26.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); + QCOMPARE( l26.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) ); + QCOMPARE( l26.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); //removing the second to last vertex removes both remaining vertices QVERIFY( l26.deleteVertex( QgsVertexId( 0, 0, 0 ) ) ); QCOMPARE( l26.numPoints(), 0 ); @@ -1968,17 +1968,17 @@ void TestQgsGeometry::lineString() QgsLineString l27; std::unique_ptr< QgsLineString > reversed( l27.reversed() ); QVERIFY( reversed->isEmpty() ); - l27.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); + l27.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); reversed.reset( l27.reversed() ); QCOMPARE( reversed->numPoints(), 3 ); QCOMPARE( reversed->wkbType(), QgsWkbTypes::LineStringZM ); QVERIFY( reversed->is3D() ); QVERIFY( reversed->isMeasure() ); - QCOMPARE( reversed->pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); - QCOMPARE( reversed->pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); - QCOMPARE( reversed->pointN( 2 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) ); + QCOMPARE( reversed->pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); + QCOMPARE( reversed->pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); + QCOMPARE( reversed->pointN( 2 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) ); //addZValue @@ -1990,30 +1990,30 @@ void TestQgsGeometry::lineString() QVERIFY( l28.addZValue() ); QCOMPARE( l28.wkbType(), QgsWkbTypes::LineStringZ ); //2d line - l28.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l28.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); QVERIFY( l28.addZValue( 2 ) ); QVERIFY( l28.is3D() ); QCOMPARE( l28.wkbType(), QgsWkbTypes::LineStringZ ); - QCOMPARE( l28.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ) ); - QCOMPARE( l28.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 2 ) ); + QCOMPARE( l28.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ) ); + QCOMPARE( l28.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZ, 11, 12, 2 ) ); QVERIFY( !l28.addZValue( 4 ) ); //already has z value, test that existing z is unchanged - QCOMPARE( l28.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 ) ); - QCOMPARE( l28.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 2 ) ); + QCOMPARE( l28.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 2 ) ); + QCOMPARE( l28.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZ, 11, 12, 2 ) ); //linestring with m - l28.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 3 ) << QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 4 ) ); + l28.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 3 ) << QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 4 ) ); QVERIFY( l28.addZValue( 5 ) ); QVERIFY( l28.is3D() ); QVERIFY( l28.isMeasure() ); QCOMPARE( l28.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l28.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 5, 3 ) ); - QCOMPARE( l28.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 5, 4 ) ); + QCOMPARE( l28.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 5, 3 ) ); + QCOMPARE( l28.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 5, 4 ) ); //linestring25d - l28.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 4 ) ); + l28.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 4 ) ); QCOMPARE( l28.wkbType(), QgsWkbTypes::LineString25D ); QVERIFY( !l28.addZValue( 5 ) ); QCOMPARE( l28.wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( l28.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) ); - QCOMPARE( l28.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 4 ) ); + QCOMPARE( l28.pointN( 0 ), QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) ); + QCOMPARE( l28.pointN( 1 ), QgsPoint( QgsWkbTypes::Point25D, 11, 12, 4 ) ); //addMValue @@ -2025,39 +2025,39 @@ void TestQgsGeometry::lineString() QVERIFY( l29.addMValue() ); QCOMPARE( l29.wkbType(), QgsWkbTypes::LineStringM ); //2d line - l29.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l29.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); QVERIFY( l29.addMValue( 2 ) ); QVERIFY( !l29.is3D() ); QVERIFY( l29.isMeasure() ); QCOMPARE( l29.wkbType(), QgsWkbTypes::LineStringM ); - QCOMPARE( l29.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 2 ) ); - QCOMPARE( l29.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 2 ) ); + QCOMPARE( l29.pointN( 0 ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 2 ) ); + QCOMPARE( l29.pointN( 1 ), QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 2 ) ); QVERIFY( !l29.addMValue( 4 ) ); //already has m value, test that existing m is unchanged - QCOMPARE( l29.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 2 ) ); - QCOMPARE( l29.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 2 ) ); + QCOMPARE( l29.pointN( 0 ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 2 ) ); + QCOMPARE( l29.pointN( 1 ), QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 2 ) ); //linestring with z - l29.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 4 ) ); + l29.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 11, 12, 4 ) ); QVERIFY( l29.addMValue( 5 ) ); QVERIFY( l29.is3D() ); QVERIFY( l29.isMeasure() ); QCOMPARE( l29.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l29.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) ); - QCOMPARE( l29.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); + QCOMPARE( l29.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) ); + QCOMPARE( l29.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); //linestring25d, should become LineStringZM - l29.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 4 ) ); + l29.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 4 ) ); QCOMPARE( l29.wkbType(), QgsWkbTypes::LineString25D ); QVERIFY( l29.addMValue( 5 ) ); QVERIFY( l29.is3D() ); QVERIFY( l29.isMeasure() ); QCOMPARE( l29.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l29.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) ); - QCOMPARE( l29.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); + QCOMPARE( l29.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) ); + QCOMPARE( l29.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); //dropZValue QgsLineString l28d; QVERIFY( !l28d.dropZValue() ); - l28d.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l28d.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); QVERIFY( !l28d.dropZValue() ); l28d.addZValue( 1.0 ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringZ ); @@ -2065,27 +2065,27 @@ void TestQgsGeometry::lineString() QVERIFY( l28d.dropZValue() ); QVERIFY( !l28d.is3D() ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point, 1, 2 ) ); - QCOMPARE( l28d.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point, 11, 12 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::Point, 1, 2 ) ); + QCOMPARE( l28d.pointN( 1 ), QgsPoint( QgsWkbTypes::Point, 11, 12 ) ); QVERIFY( !l28d.dropZValue() ); //already dropped //linestring with m - l28d.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 3, 4 ) ); + l28d.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 3, 4 ) ); QVERIFY( l28d.dropZValue() ); QVERIFY( !l28d.is3D() ); QVERIFY( l28d.isMeasure() ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringM ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); - QCOMPARE( l28d.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 4 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); + QCOMPARE( l28d.pointN( 1 ), QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 4 ) ); //linestring25d - l28d.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 4 ) ); + l28d.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 4 ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString25D ); QVERIFY( l28d.dropZValue() ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point, 1, 2 ) ); - QCOMPARE( l28d.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point, 11, 12 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::Point, 1, 2 ) ); + QCOMPARE( l28d.pointN( 1 ), QgsPoint( QgsWkbTypes::Point, 11, 12 ) ); //dropMValue - l28d.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l28d.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); QVERIFY( !l28d.dropMValue() ); l28d.addMValue( 1.0 ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringM ); @@ -2093,49 +2093,49 @@ void TestQgsGeometry::lineString() QVERIFY( l28d.dropMValue() ); QVERIFY( !l28d.isMeasure() ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point, 1, 2 ) ); - QCOMPARE( l28d.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point, 11, 12 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::Point, 1, 2 ) ); + QCOMPARE( l28d.pointN( 1 ), QgsPoint( QgsWkbTypes::Point, 11, 12 ) ); QVERIFY( !l28d.dropMValue() ); //already dropped //linestring with z - l28d.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 3, 4 ) ); + l28d.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 3, 4 ) ); QVERIFY( l28d.dropMValue() ); QVERIFY( !l28d.isMeasure() ); QVERIFY( l28d.is3D() ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringZ ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3, 0 ) ); - QCOMPARE( l28d.pointN( 1 ), QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 3, 0 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3, 0 ) ); + QCOMPARE( l28d.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZ, 11, 12, 3, 0 ) ); //convertTo - l28d.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l28d.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); QVERIFY( l28d.convertTo( QgsWkbTypes::LineString ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString ); QVERIFY( l28d.convertTo( QgsWkbTypes::LineStringZ ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringZ ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 0.0 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 0.0 ) ); l28d.setZAt( 0, 5.0 ); QVERIFY( l28d.convertTo( QgsWkbTypes::LineString25D ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 5.0 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::Point25D, 1, 2, 5.0 ) ); QVERIFY( l28d.convertTo( QgsWkbTypes::LineStringZM ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 5.0 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 5.0 ) ); l28d.setMAt( 0, 6.0 ); QVERIFY( l28d.convertTo( QgsWkbTypes::LineStringM ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineStringM ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0.0, 6.0 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0.0, 6.0 ) ); QVERIFY( l28d.convertTo( QgsWkbTypes::LineString ) ); QCOMPARE( l28d.wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( l28d.pointN( 0 ), QgsPointV2( 1, 2 ) ); + QCOMPARE( l28d.pointN( 0 ), QgsPoint( 1, 2 ) ); QVERIFY( !l28d.convertTo( QgsWkbTypes::Polygon ) ); //isRing QgsLineString l30; QVERIFY( !l30.isRing() ); - l30.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) << QgsPointV2( 1, 2 ) ); + l30.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) << QgsPoint( 1, 2 ) ); QVERIFY( !l30.isRing() ); //<4 points - l30.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) << QgsPointV2( 21, 22 ) << QgsPointV2( 31, 32 ) ); + l30.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) << QgsPoint( 31, 32 ) ); QVERIFY( !l30.isRing() ); //not closed - l30.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) << QgsPointV2( 21, 22 ) << QgsPointV2( 1, 2 ) ); + l30.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) << QgsPoint( 21, 22 ) << QgsPoint( 1, 2 ) ); QVERIFY( l30.isRing() ); //coordinateSequence @@ -2144,29 +2144,29 @@ void TestQgsGeometry::lineString() QCOMPARE( coords.count(), 1 ); QCOMPARE( coords.at( 0 ).count(), 1 ); QVERIFY( coords.at( 0 ).at( 0 ).isEmpty() ); - l31.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); + l31.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); coords = l31.coordinateSequence(); QCOMPARE( coords.count(), 1 ); QCOMPARE( coords.at( 0 ).count(), 1 ); QCOMPARE( coords.at( 0 ).at( 0 ).count(), 3 ); - QCOMPARE( coords.at( 0 ).at( 0 ).at( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) ); - QCOMPARE( coords.at( 0 ).at( 0 ).at( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); - QCOMPARE( coords.at( 0 ).at( 0 ).at( 2 ), QgsPointV2( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); + QCOMPARE( coords.at( 0 ).at( 0 ).at( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 2, 3 ) ); + QCOMPARE( coords.at( 0 ).at( 0 ).at( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 4, 5 ) ); + QCOMPARE( coords.at( 0 ).at( 0 ).at( 2 ), QgsPoint( QgsWkbTypes::PointZM, 21, 22, 6, 7 ) ); //nextVertex QgsLineString l32; QgsVertexId v; - QgsPointV2 p; + QgsPoint p; QVERIFY( !l32.nextVertex( v, p ) ); v = QgsVertexId( 0, 0, -2 ); QVERIFY( !l32.nextVertex( v, p ) ); v = QgsVertexId( 0, 0, 10 ); QVERIFY( !l32.nextVertex( v, p ) ); //LineString - l32.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l32.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); v = QgsVertexId( 0, 0, 2 ); //out of range QVERIFY( !l32.nextVertex( v, p ) ); v = QgsVertexId( 0, 0, -5 ); @@ -2174,59 +2174,59 @@ void TestQgsGeometry::lineString() v = QgsVertexId( 0, 0, -1 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 0 ) ); - QCOMPARE( p, QgsPointV2( 1, 2 ) ); + QCOMPARE( p, QgsPoint( 1, 2 ) ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); - QCOMPARE( p, QgsPointV2( 11, 12 ) ); + QCOMPARE( p, QgsPoint( 11, 12 ) ); QVERIFY( !l32.nextVertex( v, p ) ); v = QgsVertexId( 0, 1, 0 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 1, 1 ) ); //test that ring number is maintained - QCOMPARE( p, QgsPointV2( 11, 12 ) ); + QCOMPARE( p, QgsPoint( 11, 12 ) ); v = QgsVertexId( 1, 0, 0 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 1, 0, 1 ) ); //test that part number is maintained - QCOMPARE( p, QgsPointV2( 11, 12 ) ); + QCOMPARE( p, QgsPoint( 11, 12 ) ); //LineStringZ - l32.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 13 ) ); + l32.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) ); v = QgsVertexId( 0, 0, -1 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 0 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 13 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) ); QVERIFY( !l32.nextVertex( v, p ) ); //LineStringM - l32.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); + l32.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); v = QgsVertexId( 0, 0, -1 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 0 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); QVERIFY( !l32.nextVertex( v, p ) ); //LineStringZM - l32.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + l32.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); v = QgsVertexId( 0, 0, -1 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 0 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); QVERIFY( !l32.nextVertex( v, p ) ); //LineString25D - l32.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 13 ) ); + l32.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) ); v = QgsVertexId( 0, 0, -1 ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 0 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) ); QVERIFY( l32.nextVertex( v, p ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 13 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) ); QVERIFY( !l32.nextVertex( v, p ) ); //vertexAt and pointAt @@ -2237,105 +2237,105 @@ void TestQgsGeometry::lineString() QVERIFY( !l33.pointAt( -10, p, type ) ); QVERIFY( !l33.pointAt( 10, p, type ) ); //LineString - l33.setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 11, 12 ) ); + l33.setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 11, 12 ) ); l33.vertexAt( QgsVertexId( 0, 0, -10 ) ); l33.vertexAt( QgsVertexId( 0, 0, 10 ) ); //out of bounds, check for no crash - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( 1, 2 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( 11, 12 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( 1, 2 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( 11, 12 ) ); QVERIFY( !l33.pointAt( -10, p, type ) ); QVERIFY( !l33.pointAt( 10, p, type ) ); QVERIFY( l33.pointAt( 0, p, type ) ); - QCOMPARE( p, QgsPointV2( 1, 2 ) ); + QCOMPARE( p, QgsPoint( 1, 2 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); QVERIFY( l33.pointAt( 1, p, type ) ); - QCOMPARE( p, QgsPointV2( 11, 12 ) ); + QCOMPARE( p, QgsPoint( 11, 12 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); //LineStringZ - l33.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 13 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 13 ) ); + l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) ); QVERIFY( l33.pointAt( 0, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); QVERIFY( l33.pointAt( 1, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZ, 11, 12, 13 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); //LineStringM - l33.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); + l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); QVERIFY( l33.pointAt( 0, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); QVERIFY( l33.pointAt( 1, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); //LineStringZM - l33.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); QVERIFY( l33.pointAt( 0, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); QVERIFY( l33.pointAt( 1, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); //LineString25D - l33.setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 13 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) ); - QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 13 ) ); + l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) ); + QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) ); QVERIFY( l33.pointAt( 0, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::Point25D, 1, 2, 3 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); QVERIFY( l33.pointAt( 1, p, type ) ); - QCOMPARE( p, QgsPointV2( QgsWkbTypes::Point25D, 11, 12, 13 ) ); + QCOMPARE( p, QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) ); QCOMPARE( type, QgsVertexId::SegmentVertex ); //centroid QgsLineString l34; - QCOMPARE( l34.centroid(), QgsPointV2() ); - l34.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) ); - QCOMPARE( l34.centroid(), QgsPointV2( 5, 10 ) ); - l34.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 20, 10 ) ); - QCOMPARE( l34.centroid(), QgsPointV2( 10, 5 ) ); - l34.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 9 ) << QgsPointV2( 2, 9 ) << QgsPointV2( 2, 0 ) ); - QCOMPARE( l34.centroid(), QgsPointV2( 1, 4.95 ) ); + QCOMPARE( l34.centroid(), QgsPoint() ); + l34.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) ); + QCOMPARE( l34.centroid(), QgsPoint( 5, 10 ) ); + l34.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 20, 10 ) ); + QCOMPARE( l34.centroid(), QgsPoint( 10, 5 ) ); + l34.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 9 ) << QgsPoint( 2, 9 ) << QgsPoint( 2, 0 ) ); + QCOMPARE( l34.centroid(), QgsPoint( 1, 4.95 ) ); //linestring with 0 length segment - l34.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 9 ) << QgsPointV2( 2, 9 ) << QgsPointV2( 2, 9 ) << QgsPointV2( 2, 0 ) ); - QCOMPARE( l34.centroid(), QgsPointV2( 1, 4.95 ) ); + l34.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 9 ) << QgsPoint( 2, 9 ) << QgsPoint( 2, 9 ) << QgsPoint( 2, 0 ) ); + QCOMPARE( l34.centroid(), QgsPoint( 1, 4.95 ) ); //linestring with 0 total length segment - l34.setPoints( QgsPointSequence() << QgsPointV2( 5, 4 ) << QgsPointV2( 5, 4 ) << QgsPointV2( 5, 4 ) ); - QCOMPARE( l34.centroid(), QgsPointV2( 5, 4 ) ); + l34.setPoints( QgsPointSequence() << QgsPoint( 5, 4 ) << QgsPoint( 5, 4 ) << QgsPoint( 5, 4 ) ); + QCOMPARE( l34.centroid(), QgsPoint( 5, 4 ) ); //closest segment QgsLineString l35; bool leftOf = false; - p = QgsPointV2(); // reset all coords to zero - ( void )l35.closestSegment( QgsPointV2( 1, 2 ), p, v, 0, 0 ); //empty line, just want no crash - l35.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) ); - QVERIFY( l35.closestSegment( QgsPointV2( 5, 10 ), p, v, 0, 0 ) < 0 ); - l35.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) << QgsPointV2( 10, 10 ) ); - QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPointV2( 4, 11 ), p, v, &leftOf, 0 ), 2.0 ) ); - QCOMPARE( p, QgsPointV2( 5, 10 ) ); + p = QgsPoint(); // reset all coords to zero + ( void )l35.closestSegment( QgsPoint( 1, 2 ), p, v, 0, 0 ); //empty line, just want no crash + l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) ); + QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v, 0, 0 ) < 0 ); + l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) ); + QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf, 0 ), 2.0 ) ); + QCOMPARE( p, QgsPoint( 5, 10 ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); QCOMPARE( leftOf, true ); - QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPointV2( 8, 11 ), p, v, &leftOf, 0 ), 1.0 ) ); - QCOMPARE( p, QgsPointV2( 8, 10 ) ); + QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf, 0 ), 1.0 ) ); + QCOMPARE( p, QgsPoint( 8, 10 ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); QCOMPARE( leftOf, true ); - QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPointV2( 8, 9 ), p, v, &leftOf, 0 ), 1.0 ) ); - QCOMPARE( p, QgsPointV2( 8, 10 ) ); + QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf, 0 ), 1.0 ) ); + QCOMPARE( p, QgsPoint( 8, 10 ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); QCOMPARE( leftOf, false ); - QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPointV2( 11, 9 ), p, v, &leftOf, 0 ), 2.0 ) ); - QCOMPARE( p, QgsPointV2( 10, 10 ) ); + QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf, 0 ), 2.0 ) ); + QCOMPARE( p, QgsPoint( 10, 10 ) ); QCOMPARE( v, QgsVertexId( 0, 0, 1 ) ); QCOMPARE( leftOf, false ); - l35.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) - << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 15 ) ); - QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPointV2( 11, 12 ), p, v, &leftOf, 0 ), 1.0 ) ); - QCOMPARE( p, QgsPointV2( 10, 12 ) ); + l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) + << QgsPoint( 10, 10 ) + << QgsPoint( 10, 15 ) ); + QVERIFY( qgsDoubleNear( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf, 0 ), 1.0 ) ); + QCOMPARE( p, QgsPoint( 10, 12 ) ); QCOMPARE( v, QgsVertexId( 0, 0, 2 ) ); QCOMPARE( leftOf, false ); @@ -2344,25 +2344,25 @@ void TestQgsGeometry::lineString() double area = 1.0; //sumUpArea adds to area, so start with non-zero value l36.sumUpArea( area ); QCOMPARE( area, 1.0 ); - l36.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) ); + l36.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) ); l36.sumUpArea( area ); QCOMPARE( area, 1.0 ); - l36.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) << QgsPointV2( 10, 10 ) ); + l36.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) ); l36.sumUpArea( area ); QVERIFY( qgsDoubleNear( area, -24 ) ); - l36.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 2, 0 ) << QgsPointV2( 2, 2 ) ); + l36.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 2, 0 ) << QgsPoint( 2, 2 ) ); l36.sumUpArea( area ); QVERIFY( qgsDoubleNear( area, -22 ) ); - l36.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 2, 0 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 0, 2 ) ); + l36.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 2, 0 ) << QgsPoint( 2, 2 ) << QgsPoint( 0, 2 ) ); l36.sumUpArea( area ); QVERIFY( qgsDoubleNear( area, -18 ) ); //boundingBox - test that bounding box is updated after every modification to the line string QgsLineString l37; QVERIFY( l37.boundingBox().isNull() ); - l37.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) << QgsPointV2( 10, 15 ) ); + l37.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 15 ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( 5, 10, 10, 15 ) ); - l37.setPoints( QgsPointSequence() << QgsPointV2( -5, -10 ) << QgsPointV2( -6, -10 ) << QgsPointV2( -5.5, -9 ) ); + l37.setPoints( QgsPointSequence() << QgsPoint( -5, -10 ) << QgsPoint( -6, -10 ) << QgsPoint( -5.5, -9 ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( -6, -10, -5, -9 ) ); //setXAt l37.setXAt( 2, -4 ); @@ -2372,23 +2372,23 @@ void TestQgsGeometry::lineString() QCOMPARE( l37.boundingBox(), QgsRectangle( -6, -15, -4, -9 ) ); //append toAppend.reset( new QgsLineString() ); - toAppend->setPoints( QgsPointSequence() << QgsPointV2( 1, 2 ) << QgsPointV2( 4, 0 ) ); + toAppend->setPoints( QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 4, 0 ) ); l37.append( toAppend.get() ); QCOMPARE( l37.boundingBox(), QgsRectangle( -6, -15, 4, 2 ) ); - l37.addVertex( QgsPointV2( 6, 3 ) ); + l37.addVertex( QgsPoint( 6, 3 ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( -6, -15, 6, 3 ) ); l37.clear(); QVERIFY( l37.boundingBox().isNull() ); - l37.setPoints( QgsPointSequence() << QgsPointV2( 5, 10 ) << QgsPointV2( 10, 15 ) ); + l37.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 15 ) ); QByteArray wkbToAppend = toAppend->asWkb(); QgsConstWkbPtr wkbToAppendPtr( wkbToAppend ); l37.fromWkb( wkbToAppendPtr ); QCOMPARE( l37.boundingBox(), QgsRectangle( 1, 0, 4, 2 ) ); l37.fromWkt( QStringLiteral( "LineString( 1 5, 3 4, 6 3 )" ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( 1, 3, 6, 5 ) ); - l37.insertVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( -1, 7 ) ); + l37.insertVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( -1, 7 ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( -1, 3, 6, 7 ) ); - l37.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPointV2( -3, 10 ) ); + l37.moveVertex( QgsVertexId( 0, 0, 1 ), QgsPoint( -3, 10 ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( -3, 3, 6, 10 ) ); l37.deleteVertex( QgsVertexId( 0, 0, 1 ) ); QCOMPARE( l37.boundingBox(), QgsRectangle( 1, 3, 6, 5 ) ); @@ -2397,27 +2397,27 @@ void TestQgsGeometry::lineString() QgsLineString l38; ( void )l38.vertexAngle( QgsVertexId() ); //just want no crash ( void )l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ); //just want no crash - l38.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) ); ( void )l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ); //just want no crash, any answer is meaningless - l38.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 1.5708, 0.0001 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 1.5708, 0.0001 ) ); ( void )l38.vertexAngle( QgsVertexId( 0, 0, 2 ) ); //no crash - l38.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 1 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 1 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 0.0 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 0.0 ) ); - l38.setPoints( QgsPointSequence() << QgsPointV2( 1, 0 ) << QgsPointV2( 0, 0 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 1, 0 ) << QgsPoint( 0, 0 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 4.71239, 0.0001 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 4.71239, 0.0001 ) ); - l38.setPoints( QgsPointSequence() << QgsPointV2( 0, 1 ) << QgsPointV2( 0, 0 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 0, 1 ) << QgsPoint( 0, 0 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 3.1416, 0.0001 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 3.1416, 0.0001 ) ); - l38.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 1.5708, 0.0001 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 0.7854, 0.0001 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 2 ) ), 0.0, 0.0001 ) ); - l38.setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0.5, 0 ) << QgsPointV2( 1, 0 ) - << QgsPointV2( 2, 1 ) << QgsPointV2( 1, 2 ) << QgsPointV2( 0, 2 ) ); + l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0.5, 0 ) << QgsPoint( 1, 0 ) + << QgsPoint( 2, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 0, 2 ) ); ( void )l38.vertexAngle( QgsVertexId( 0, 0, 20 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 1.5708, 0.0001 ) ); QVERIFY( qgsDoubleNear( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 1.5708, 0.0001 ) ); @@ -2433,7 +2433,7 @@ void TestQgsGeometry::lineString() //removing the second to last vertex should remove the whole line QgsLineString l39; - l39.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 1 ) ); + l39.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) ); QVERIFY( l39.numPoints() == 2 ); l39.deleteVertex( QgsVertexId( 0, 0, 1 ) ); QVERIFY( l39.numPoints() == 0 ); @@ -2441,44 +2441,44 @@ void TestQgsGeometry::lineString() //boundary QgsLineString boundary1; QVERIFY( !boundary1.boundary() ); - boundary1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) ); + boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); QgsAbstractGeometry *boundary = boundary1.boundary(); QgsMultiPointV2 *mpBoundary = dynamic_cast< QgsMultiPointV2 * >( boundary ); QVERIFY( mpBoundary ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); delete boundary; // closed string = no boundary - boundary1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 0 ) ); + boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QVERIFY( !boundary1.boundary() ); \ //boundary with z - boundary1.setPoints( QList() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); boundary = boundary1.boundary(); mpBoundary = dynamic_cast< QgsMultiPointV2 * >( boundary ); QVERIFY( mpBoundary ); QCOMPARE( mpBoundary->geometryN( 0 )->wkbType(), QgsWkbTypes::PointZ ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->z(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->z(), 10.0 ); QCOMPARE( mpBoundary->geometryN( 1 )->wkbType(), QgsWkbTypes::PointZ ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->z(), 20.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->z(), 20.0 ); delete boundary; //extend QgsLineString extend1; extend1.extend( 10, 10 ); //test no crash - extend1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) ); + extend1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); extend1.extend( 1, 2 ); - QCOMPARE( extend1.pointN( 0 ), QgsPointV2( QgsWkbTypes::Point, -1, 0 ) ); - QCOMPARE( extend1.pointN( 1 ), QgsPointV2( QgsWkbTypes::Point, 1, 0 ) ); - QCOMPARE( extend1.pointN( 2 ), QgsPointV2( QgsWkbTypes::Point, 1, 3 ) ); + QCOMPARE( extend1.pointN( 0 ), QgsPoint( QgsWkbTypes::Point, -1, 0 ) ); + QCOMPARE( extend1.pointN( 1 ), QgsPoint( QgsWkbTypes::Point, 1, 0 ) ); + QCOMPARE( extend1.pointN( 2 ), QgsPoint( QgsWkbTypes::Point, 1, 3 ) ); } void TestQgsGeometry::polygon() @@ -2530,8 +2530,8 @@ void TestQgsGeometry::polygon() //valid exterior ring ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p1.setExteriorRing( ext ); QVERIFY( !p1.isEmpty() ); QCOMPARE( p1.numInteriorRings(), 0 ); @@ -2555,8 +2555,8 @@ void TestQgsGeometry::polygon() //test that a non closed exterior ring will be automatically closed ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) ); QVERIFY( !ext->isClosed() ); p1.setExteriorRing( ext ); QVERIFY( !p1.isEmpty() ); @@ -2566,9 +2566,9 @@ void TestQgsGeometry::polygon() //initial setting of exterior ring should set z/m type QgsPolygonV2 p2; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) ); p2.setExteriorRing( ext ); QVERIFY( p2.is3D() ); QVERIFY( !p2.isMeasure() ); @@ -2578,9 +2578,9 @@ void TestQgsGeometry::polygon() QCOMPARE( *( static_cast< const QgsLineString * >( p2.exteriorRing() ) ), *ext ); QgsPolygonV2 p3; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 0, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 0, 10, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 10, 10, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 10, 0, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 0, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 0, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 0, 10, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 10, 10, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 10, 0, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 0, 0, 0, 1 ) ); p3.setExteriorRing( ext ); QVERIFY( !p3.is3D() ); QVERIFY( p3.isMeasure() ); @@ -2589,9 +2589,9 @@ void TestQgsGeometry::polygon() QCOMPARE( *( static_cast< const QgsLineString * >( p3.exteriorRing() ) ), *ext ); QgsPolygonV2 p4; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 2, 1 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 3, 2 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 5, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 10, 0, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 2, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 2, 1 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 3, 2 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 5, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 10, 0, 0, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 2, 1 ) ); p4.setExteriorRing( ext ); QVERIFY( p4.is3D() ); QVERIFY( p4.isMeasure() ); @@ -2600,9 +2600,9 @@ void TestQgsGeometry::polygon() QCOMPARE( *( static_cast< const QgsLineString * >( p4.exteriorRing() ) ), *ext ); QgsPolygonV2 p5; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::Point25D, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::Point25D, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::Point25D, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::Point25D, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::Point25D, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::Point25D, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::Point25D, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::Point25D, 0, 0, 1 ) ); p5.setExteriorRing( ext ); QVERIFY( p5.is3D() ); QVERIFY( !p5.isMeasure() ); @@ -2612,8 +2612,8 @@ void TestQgsGeometry::polygon() //setting curved exterior ring should be segmentized QgsCircularString *circularRing = new QgsCircularString(); - circularRing->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + circularRing->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); QVERIFY( circularRing->hasCurvedSegments() ); p5.setExteriorRing( circularRing ); QVERIFY( !p5.exteriorRing()->hasCurvedSegments() ); @@ -2622,8 +2622,8 @@ void TestQgsGeometry::polygon() //addInteriorRing QgsPolygonV2 p6; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p6.setExteriorRing( ext ); //empty ring QCOMPARE( p6.numInteriorRings(), 0 ); @@ -2632,8 +2632,8 @@ void TestQgsGeometry::polygon() p6.addInteriorRing( 0 ); QCOMPARE( p6.numInteriorRings(), 0 ); QgsLineString *ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( 1, 1 ) << QgsPointV2( 1, 9 ) << QgsPointV2( 9, 9 ) - << QgsPointV2( 9, 1 ) << QgsPointV2( 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( 1, 1 ) << QgsPoint( 1, 9 ) << QgsPoint( 9, 9 ) + << QgsPoint( 9, 1 ) << QgsPoint( 1, 1 ) ); p6.addInteriorRing( ring ); QCOMPARE( p6.numInteriorRings(), 1 ); QCOMPARE( p6.interiorRing( 0 ), ring ); @@ -2641,8 +2641,8 @@ void TestQgsGeometry::polygon() //add non-closed interior ring, should be closed automatically ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( 0.1, 0.1 ) << QgsPointV2( 0.1, 0.9 ) << QgsPointV2( 0.9, 0.9 ) - << QgsPointV2( 0.9, 0.1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.1, 0.9 ) << QgsPoint( 0.9, 0.9 ) + << QgsPoint( 0.9, 0.1 ) ); QVERIFY( !ring->isClosed() ); p6.addInteriorRing( ring ); QCOMPARE( p6.numInteriorRings(), 2 ); @@ -2650,9 +2650,9 @@ void TestQgsGeometry::polygon() //try adding an interior ring with z to a 2d polygon, z should be dropped ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); p6.addInteriorRing( ring ); QCOMPARE( p6.numInteriorRings(), 3 ); QVERIFY( !p6.is3D() ); @@ -2665,9 +2665,9 @@ void TestQgsGeometry::polygon() //try adding an interior ring with m to a 2d polygon, m should be dropped ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 0.1, 0.2, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 0.2, 0.2, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 0.2, 0.1, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 0.1, 0.2, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 0.2, 0.2, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 0.2, 0.1, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) ); p6.addInteriorRing( ring ); QCOMPARE( p6.numInteriorRings(), 4 ); QVERIFY( !p6.is3D() ); @@ -2681,73 +2681,73 @@ void TestQgsGeometry::polygon() //addInteriorRing without z/m to PolygonZM QgsPolygonV2 p6b; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::PointZM, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::PointZM, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1 ) ); p6b.setExteriorRing( ext ); QVERIFY( p6b.is3D() ); QVERIFY( p6b.isMeasure() ); QCOMPARE( p6b.wkbType(), QgsWkbTypes::PolygonZM ); //ring has no z ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 1, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 1, 9 ) << QgsPointV2( QgsWkbTypes::PointM, 9, 9 ) - << QgsPointV2( QgsWkbTypes::PointM, 9, 1 ) << QgsPointV2( QgsWkbTypes::PointM, 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 1, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 1, 9 ) << QgsPoint( QgsWkbTypes::PointM, 9, 9 ) + << QgsPoint( QgsWkbTypes::PointM, 9, 1 ) << QgsPoint( QgsWkbTypes::PointM, 1, 1 ) ); p6b.addInteriorRing( ring ); QVERIFY( p6b.interiorRing( 0 ) ); QVERIFY( p6b.interiorRing( 0 )->is3D() ); QVERIFY( p6b.interiorRing( 0 )->isMeasure() ); QCOMPARE( p6b.interiorRing( 0 )->wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( p6b.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 0, 2 ) ); + QCOMPARE( p6b.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZM, 1, 1, 0, 2 ) ); //ring has no m ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); p6b.addInteriorRing( ring ); QVERIFY( p6b.interiorRing( 1 ) ); QVERIFY( p6b.interiorRing( 1 )->is3D() ); QVERIFY( p6b.interiorRing( 1 )->isMeasure() ); QCOMPARE( p6b.interiorRing( 1 )->wkbType(), QgsWkbTypes::LineStringZM ); - QCOMPARE( p6b.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::PointZM, 0.1, 0.1, 1, 0 ) ); + QCOMPARE( p6b.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZM, 0.1, 0.1, 1, 0 ) ); //test handling of 25D rings/polygons QgsPolygonV2 p6c; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::Point25D, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::Point25D, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::Point25D, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::Point25D, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::Point25D, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::Point25D, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::Point25D, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::Point25D, 0, 0, 1 ) ); p6c.setExteriorRing( ext ); QVERIFY( p6c.is3D() ); QVERIFY( !p6c.isMeasure() ); QCOMPARE( p6c.wkbType(), QgsWkbTypes::Polygon25D ); //adding a LineStringZ, should become LineString25D ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); QCOMPARE( ring->wkbType(), QgsWkbTypes::LineStringZ ); p6c.addInteriorRing( ring ); QVERIFY( p6c.interiorRing( 0 ) ); QVERIFY( p6c.interiorRing( 0 )->is3D() ); QVERIFY( !p6c.interiorRing( 0 )->isMeasure() ); QCOMPARE( p6c.interiorRing( 0 )->wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( p6c.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::Point25D, 0.1, 0.1, 1 ) ); + QCOMPARE( p6c.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point25D, 0.1, 0.1, 1 ) ); //add a LineStringM, should become LineString25D ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 0.1, 0.2, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 0.2, 0.2, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 0.2, 0.1, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 0.1, 0.2, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 0.2, 0.2, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 0.2, 0.1, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 0.1, 0.1, 0, 1 ) ); QCOMPARE( ring->wkbType(), QgsWkbTypes::LineStringM ); p6c.addInteriorRing( ring ); QVERIFY( p6c.interiorRing( 1 ) ); QVERIFY( p6c.interiorRing( 1 )->is3D() ); QVERIFY( !p6c.interiorRing( 1 )->isMeasure() ); QCOMPARE( p6c.interiorRing( 1 )->wkbType(), QgsWkbTypes::LineString25D ); - QCOMPARE( p6c.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::Point25D, 0.1, 0.1, 0, 0 ) ); + QCOMPARE( p6c.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point25D, 0.1, 0.1, 0, 0 ) ); //add curved ring to polygon circularRing = new QgsCircularString(); - circularRing->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + circularRing->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); QVERIFY( circularRing->hasCurvedSegments() ); p6c.addInteriorRing( circularRing ); QVERIFY( p6c.interiorRing( 2 ) ); @@ -2759,36 +2759,36 @@ void TestQgsGeometry::polygon() //set interior rings QgsPolygonV2 p7; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p7.setExteriorRing( ext ); //add a list of rings with mixed types QList< QgsCurve * > rings; rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); + static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[1] )->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 0.3, 0.3, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 0.3, 0.4, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 0.4, 0.4, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 0.4, 0.3, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 0.3, 0.3, 0, 1 ) ); + static_cast< QgsLineString *>( rings[1] )->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 0.3, 0.3, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 0.3, 0.4, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 0.4, 0.4, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 0.4, 0.3, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 0.3, 0.3, 0, 1 ) ); //throw an empty ring in too rings << 0; rings << new QgsCircularString(); - static_cast< QgsCircularString *>( rings[3] )->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + static_cast< QgsCircularString *>( rings[3] )->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p7.setInteriorRings( rings ); QCOMPARE( p7.numInteriorRings(), 3 ); QVERIFY( p7.interiorRing( 0 ) ); QVERIFY( !p7.interiorRing( 0 )->is3D() ); QVERIFY( !p7.interiorRing( 0 )->isMeasure() ); QCOMPARE( p7.interiorRing( 0 )->wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( p7.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::Point, 0.1, 0.1 ) ); + QCOMPARE( p7.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point, 0.1, 0.1 ) ); QVERIFY( p7.interiorRing( 1 ) ); QVERIFY( !p7.interiorRing( 1 )->is3D() ); QVERIFY( !p7.interiorRing( 1 )->isMeasure() ); QCOMPARE( p7.interiorRing( 1 )->wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( p7.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::Point, 0.3, 0.3 ) ); + QCOMPARE( p7.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point, 0.3, 0.3 ) ); QVERIFY( p7.interiorRing( 2 ) ); QVERIFY( !p7.interiorRing( 2 )->is3D() ); QVERIFY( !p7.interiorRing( 2 )->isMeasure() ); @@ -2797,16 +2797,16 @@ void TestQgsGeometry::polygon() //set rings with existing rings.clear(); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPointV2( 0.8, 0.8 ) - << QgsPointV2( 0.8, 0.9 ) << QgsPointV2( 0.9, 0.9 ) - << QgsPointV2( 0.9, 0.8 ) << QgsPointV2( 0.8, 0.8 ) ); + static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPoint( 0.8, 0.8 ) + << QgsPoint( 0.8, 0.9 ) << QgsPoint( 0.9, 0.9 ) + << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.8, 0.8 ) ); p7.setInteriorRings( rings ); QCOMPARE( p7.numInteriorRings(), 1 ); QVERIFY( p7.interiorRing( 0 ) ); QVERIFY( !p7.interiorRing( 0 )->is3D() ); QVERIFY( !p7.interiorRing( 0 )->isMeasure() ); QCOMPARE( p7.interiorRing( 0 )->wkbType(), QgsWkbTypes::LineString ); - QCOMPARE( p7.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( QgsWkbTypes::Point, 0.8, 0.8 ) ); + QCOMPARE( p7.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point, 0.8, 0.8 ) ); rings.clear(); p7.setInteriorRings( rings ); QCOMPARE( p7.numInteriorRings(), 0 ); @@ -2814,18 +2814,18 @@ void TestQgsGeometry::polygon() //change dimensionality of interior rings using setExteriorRing QgsPolygonV2 p7a; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 10, 2 ) - << QgsPointV2( QgsWkbTypes::PointZ, 10, 10, 1 ) << QgsPointV2( QgsWkbTypes::PointZ, 10, 0, 3 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 10, 2 ) + << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 1 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 0, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) ); p7a.setExteriorRing( ext ); rings.clear(); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); + static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.2, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.2, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.2, 0.1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0.1, 0.1, 1 ) ); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[1] )->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0.3, 0.3, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.3, 0.4, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.4, 0.4, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0.4, 0.3, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0.3, 0.3, 1 ) ); + static_cast< QgsLineString *>( rings[1] )->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0.3, 0.3, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.3, 0.4, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 0.4, 0.4, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 0.4, 0.3, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0.3, 0.3, 1 ) ); p7a.setInteriorRings( rings ); QVERIFY( p7a.is3D() ); QVERIFY( !p7a.isMeasure() ); @@ -2835,24 +2835,24 @@ void TestQgsGeometry::polygon() QVERIFY( !p7a.interiorRing( 1 )->isMeasure() ); //reset exterior ring to 2d ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) - << QgsPointV2( 10, 10 ) << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) + << QgsPoint( 10, 10 ) << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p7a.setExteriorRing( ext ); QVERIFY( !p7a.is3D() ); QVERIFY( !p7a.interiorRing( 0 )->is3D() ); //rings should also be made 2D QVERIFY( !p7a.interiorRing( 1 )->is3D() ); //reset exterior ring to LineStringM ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 0, 0 ) << QgsPointV2( QgsWkbTypes::PointM, 0, 10 ) - << QgsPointV2( QgsWkbTypes::PointM, 10, 10 ) << QgsPointV2( QgsWkbTypes::PointM, 10, 0 ) << QgsPointV2( QgsWkbTypes::PointM, 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 0, 0 ) << QgsPoint( QgsWkbTypes::PointM, 0, 10 ) + << QgsPoint( QgsWkbTypes::PointM, 10, 10 ) << QgsPoint( QgsWkbTypes::PointM, 10, 0 ) << QgsPoint( QgsWkbTypes::PointM, 0, 0 ) ); p7a.setExteriorRing( ext ); QVERIFY( p7a.isMeasure() ); QVERIFY( p7a.interiorRing( 0 )->isMeasure() ); //rings should also gain measure QVERIFY( p7a.interiorRing( 1 )->isMeasure() ); //25D exterior ring ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 0, 0 ) << QgsPointV2( QgsWkbTypes::Point25D, 0, 10 ) - << QgsPointV2( QgsWkbTypes::Point25D, 10, 10 ) << QgsPointV2( QgsWkbTypes::Point25D, 10, 0 ) << QgsPointV2( QgsWkbTypes::Point25D, 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 0, 0 ) << QgsPoint( QgsWkbTypes::Point25D, 0, 10 ) + << QgsPoint( QgsWkbTypes::Point25D, 10, 10 ) << QgsPoint( QgsWkbTypes::Point25D, 10, 0 ) << QgsPoint( QgsWkbTypes::Point25D, 0, 0 ) ); p7a.setExteriorRing( ext ); QVERIFY( p7a.is3D() ); QVERIFY( !p7a.isMeasure() ); @@ -2867,33 +2867,33 @@ void TestQgsGeometry::polygon() //removeInteriorRing QgsPolygonV2 p8; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p8.setExteriorRing( ext ); QVERIFY( !p8.removeInteriorRing( -1 ) ); QVERIFY( !p8.removeInteriorRing( 0 ) ); rings.clear(); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPointV2( 0.1, 0.1 ) - << QgsPointV2( 0.1, 0.2 ) << QgsPointV2( 0.2, 0.2 ) - << QgsPointV2( 0.2, 0.1 ) << QgsPointV2( 0.1, 0.1 ) ); + static_cast< QgsLineString *>( rings[0] )->setPoints( QgsPointSequence() << QgsPoint( 0.1, 0.1 ) + << QgsPoint( 0.1, 0.2 ) << QgsPoint( 0.2, 0.2 ) + << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.1, 0.1 ) ); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[1] )->setPoints( QgsPointSequence() << QgsPointV2( 0.3, 0.3 ) - << QgsPointV2( 0.3, 0.4 ) << QgsPointV2( 0.4, 0.4 ) - << QgsPointV2( 0.4, 0.3 ) << QgsPointV2( 0.3, 0.3 ) ); + static_cast< QgsLineString *>( rings[1] )->setPoints( QgsPointSequence() << QgsPoint( 0.3, 0.3 ) + << QgsPoint( 0.3, 0.4 ) << QgsPoint( 0.4, 0.4 ) + << QgsPoint( 0.4, 0.3 ) << QgsPoint( 0.3, 0.3 ) ); rings << new QgsLineString(); - static_cast< QgsLineString *>( rings[2] )->setPoints( QgsPointSequence() << QgsPointV2( 0.8, 0.8 ) - << QgsPointV2( 0.8, 0.9 ) << QgsPointV2( 0.9, 0.9 ) - << QgsPointV2( 0.9, 0.8 ) << QgsPointV2( 0.8, 0.8 ) ); + static_cast< QgsLineString *>( rings[2] )->setPoints( QgsPointSequence() << QgsPoint( 0.8, 0.8 ) + << QgsPoint( 0.8, 0.9 ) << QgsPoint( 0.9, 0.9 ) + << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.8, 0.8 ) ); p8.setInteriorRings( rings ); QCOMPARE( p8.numInteriorRings(), 3 ); QVERIFY( p8.removeInteriorRing( 0 ) ); QCOMPARE( p8.numInteriorRings(), 2 ); - QCOMPARE( p8.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( 0.3, 0.3 ) ); - QCOMPARE( p8.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( 0.8, 0.8 ) ); + QCOMPARE( p8.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( 0.3, 0.3 ) ); + QCOMPARE( p8.interiorRing( 1 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( 0.8, 0.8 ) ); QVERIFY( p8.removeInteriorRing( 1 ) ); QCOMPARE( p8.numInteriorRings(), 1 ); - QCOMPARE( p8.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( 0.3, 0.3 ) ); + QCOMPARE( p8.interiorRing( 0 )->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( 0.3, 0.3 ) ); QVERIFY( p8.removeInteriorRing( 0 ) ); QCOMPARE( p8.numInteriorRings(), 0 ); QVERIFY( !p8.removeInteriorRing( 0 ) ); @@ -2901,14 +2901,14 @@ void TestQgsGeometry::polygon() //clear QgsPolygonV2 p9; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) ); p9.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 1, 9, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 9, 9, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 9, 1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 1, 9, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 9, 9, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 9, 1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 1 ) ); p9.addInteriorRing( ring ); QCOMPARE( p9.numInteriorRings(), 1 ); p9.clear(); @@ -2927,26 +2927,26 @@ void TestQgsGeometry::polygon() QVERIFY( p10 == p10b ); QVERIFY( !( p10 != p10b ) ); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p10.setExteriorRing( ext ); QVERIFY( !( p10 == p10b ) ); QVERIFY( p10 != p10b ); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 10, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p10b.setExteriorRing( ext ); QVERIFY( p10 == p10b ); QVERIFY( !( p10 != p10b ) ); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 9 ) << QgsPointV2( 9, 9 ) - << QgsPointV2( 9, 0 ) << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 9 ) << QgsPoint( 9, 9 ) + << QgsPoint( 9, 0 ) << QgsPoint( 0, 0 ) ); p10b.setExteriorRing( ext ); QVERIFY( !( p10 == p10b ) ); QVERIFY( p10 != p10b ); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 10, 2 ) - << QgsPointV2( QgsWkbTypes::PointZ, 10, 10, 3 ) << QgsPointV2( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 10, 2 ) + << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) ); p10b.setExteriorRing( ext ); QVERIFY( !( p10 == p10b ) ); QVERIFY( p10 != p10b ); @@ -2954,16 +2954,16 @@ void TestQgsGeometry::polygon() QVERIFY( p10 == p10b ); QVERIFY( !( p10 != p10b ) ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( 1, 1 ) - << QgsPointV2( 1, 9 ) << QgsPointV2( 9, 9 ) - << QgsPointV2( 9, 1 ) << QgsPointV2( 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( 1, 1 ) + << QgsPoint( 1, 9 ) << QgsPoint( 9, 9 ) + << QgsPoint( 9, 1 ) << QgsPoint( 1, 1 ) ); p10.addInteriorRing( ring ); QVERIFY( !( p10 == p10b ) ); QVERIFY( p10 != p10b ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( 2, 1 ) - << QgsPointV2( 2, 9 ) << QgsPointV2( 9, 9 ) - << QgsPointV2( 9, 1 ) << QgsPointV2( 2, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( 2, 1 ) + << QgsPoint( 2, 9 ) << QgsPoint( 9, 9 ) + << QgsPoint( 9, 1 ) << QgsPoint( 2, 1 ) ); p10b.addInteriorRing( ring ); QVERIFY( !( p10 == p10b ) ); QVERIFY( p10 != p10b ); @@ -2978,14 +2978,14 @@ void TestQgsGeometry::polygon() std::unique_ptr< QgsPolygonV2 >cloned( p11.clone() ); QCOMPARE( p11, *cloned ); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) - << QgsPointV2( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) + << QgsPoint( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); p11.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) - << QgsPointV2( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) + << QgsPoint( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); p11.addInteriorRing( ring ); cloned.reset( p11.clone() ); QCOMPARE( p11, *cloned ); @@ -2995,14 +2995,14 @@ void TestQgsGeometry::polygon() QgsPolygonV2 p13( p12 ); QCOMPARE( p12, p13 ); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) - << QgsPointV2( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) + << QgsPoint( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); p12.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) - << QgsPointV2( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) + << QgsPoint( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); p12.addInteriorRing( ring ); QgsPolygonV2 p14( p12 ); QCOMPARE( p12, p14 ); @@ -3021,14 +3021,14 @@ void TestQgsGeometry::polygon() //to/fromWKB QgsPolygonV2 p16; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point, 0, 0 ) - << QgsPointV2( QgsWkbTypes::Point, 0, 10 ) << QgsPointV2( QgsWkbTypes::Point, 10, 10 ) - << QgsPointV2( QgsWkbTypes::Point, 10, 0 ) << QgsPointV2( QgsWkbTypes::Point, 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point, 0, 0 ) + << QgsPoint( QgsWkbTypes::Point, 0, 10 ) << QgsPoint( QgsWkbTypes::Point, 10, 10 ) + << QgsPoint( QgsWkbTypes::Point, 10, 0 ) << QgsPoint( QgsWkbTypes::Point, 0, 0 ) ); p16.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point, 1, 1 ) - << QgsPointV2( QgsWkbTypes::Point, 1, 9 ) << QgsPointV2( QgsWkbTypes::Point, 9, 9 ) - << QgsPointV2( QgsWkbTypes::Point, 9, 1 ) << QgsPointV2( QgsWkbTypes::Point, 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point, 1, 1 ) + << QgsPoint( QgsWkbTypes::Point, 1, 9 ) << QgsPoint( QgsWkbTypes::Point, 9, 9 ) + << QgsPoint( QgsWkbTypes::Point, 9, 1 ) << QgsPoint( QgsWkbTypes::Point, 1, 1 ) ); p16.addInteriorRing( ring ); QByteArray wkb16 = p16.asWkb(); QgsPolygonV2 p17; @@ -3039,14 +3039,14 @@ void TestQgsGeometry::polygon() p16.clear(); p17.clear(); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 1 ) ); p16.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 1 ) - << QgsPointV2( QgsWkbTypes::PointZ, 1, 9, 2 ) << QgsPointV2( QgsWkbTypes::PointZ, 9, 9, 3 ) - << QgsPointV2( QgsWkbTypes::PointZ, 9, 1, 4 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 1 ) + << QgsPoint( QgsWkbTypes::PointZ, 1, 9, 2 ) << QgsPoint( QgsWkbTypes::PointZ, 9, 9, 3 ) + << QgsPoint( QgsWkbTypes::PointZ, 9, 1, 4 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 1 ) ); p16.addInteriorRing( ring ); wkb16 = p16.asWkb(); QgsConstWkbPtr wkb16ptr2( wkb16 ); @@ -3056,14 +3056,14 @@ void TestQgsGeometry::polygon() p16.clear(); p17.clear(); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 0, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 0, 10, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 10, 10, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 10, 0, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 0, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 0, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 0, 10, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 10, 10, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 10, 0, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 0, 0, 0, 1 ) ); p16.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointM, 1, 1, 0, 1 ) - << QgsPointV2( QgsWkbTypes::PointM, 1, 9, 0, 2 ) << QgsPointV2( QgsWkbTypes::PointM, 9, 9, 0, 3 ) - << QgsPointV2( QgsWkbTypes::PointM, 9, 1, 0, 4 ) << QgsPointV2( QgsWkbTypes::PointM, 1, 1, 0, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 1, 0, 1 ) + << QgsPoint( QgsWkbTypes::PointM, 1, 9, 0, 2 ) << QgsPoint( QgsWkbTypes::PointM, 9, 9, 0, 3 ) + << QgsPoint( QgsWkbTypes::PointM, 9, 1, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 1, 1, 0, 1 ) ); p16.addInteriorRing( ring ); wkb16 = p16.asWkb(); QgsConstWkbPtr wkb16ptr3( wkb16 ); @@ -3073,14 +3073,14 @@ void TestQgsGeometry::polygon() p16.clear(); p17.clear(); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) - << QgsPointV2( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) + << QgsPoint( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); p16.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) - << QgsPointV2( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) + << QgsPoint( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); p16.addInteriorRing( ring ); wkb16 = p16.asWkb(); QgsConstWkbPtr wkb16ptr4( wkb16 ); @@ -3090,14 +3090,14 @@ void TestQgsGeometry::polygon() p16.clear(); p17.clear(); ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 0, 0, 1 ) - << QgsPointV2( QgsWkbTypes::Point25D, 0, 10, 2 ) << QgsPointV2( QgsWkbTypes::Point25D, 10, 10, 3 ) - << QgsPointV2( QgsWkbTypes::Point25D, 10, 0, 4 ) << QgsPointV2( QgsWkbTypes::Point25D, 0, 0, 1 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 0, 0, 1 ) + << QgsPoint( QgsWkbTypes::Point25D, 0, 10, 2 ) << QgsPoint( QgsWkbTypes::Point25D, 10, 10, 3 ) + << QgsPoint( QgsWkbTypes::Point25D, 10, 0, 4 ) << QgsPoint( QgsWkbTypes::Point25D, 0, 0, 1 ) ); p16.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point25D, 1, 1, 1 ) - << QgsPointV2( QgsWkbTypes::Point25D, 1, 9, 2 ) << QgsPointV2( QgsWkbTypes::Point25D, 9, 9, 3 ) - << QgsPointV2( QgsWkbTypes::Point25D, 9, 1, 4 ) << QgsPointV2( QgsWkbTypes::Point25D, 1, 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 1, 1 ) + << QgsPoint( QgsWkbTypes::Point25D, 1, 9, 2 ) << QgsPoint( QgsWkbTypes::Point25D, 9, 9, 3 ) + << QgsPoint( QgsWkbTypes::Point25D, 9, 1, 4 ) << QgsPoint( QgsWkbTypes::Point25D, 1, 1, 1 ) ); p16.addInteriorRing( ring ); wkb16 = p16.asWkb(); p17.clear(); @@ -3110,7 +3110,7 @@ void TestQgsGeometry::polygon() QgsConstWkbPtr nullPtr( nullptr, 0 ); QVERIFY( !p17.fromWkb( nullPtr ) ); QCOMPARE( p17.wkbType(), QgsWkbTypes::Polygon ); - QgsPointV2 point( 1, 2 ); + QgsPoint point( 1, 2 ); QByteArray wkbPoint = point.asWkb(); QgsConstWkbPtr wkbPointPtr( wkbPoint ); QVERIFY( !p17.fromWkb( wkbPointPtr ) ); @@ -3119,14 +3119,14 @@ void TestQgsGeometry::polygon() //to/from WKT QgsPolygonV2 p18; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) - << QgsPointV2( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) + << QgsPoint( QgsWkbTypes::PointZM, 10, 0, 4, 8 ) << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 9 ) ); p18.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) - << QgsPointV2( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPointV2( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) - << QgsPointV2( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPointV2( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 2 ) + << QgsPoint( QgsWkbTypes::PointZM, 1, 9, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZM, 9, 9, 3, 6 ) + << QgsPoint( QgsWkbTypes::PointZM, 9, 1, 4, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 1, 1, 1, 7 ) ); p18.addInteriorRing( ring ); QString wkt = p18.asWkt(); @@ -3147,14 +3147,14 @@ void TestQgsGeometry::polygon() //as JSON QgsPolygonV2 exportPolygon; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point, 0, 0 ) - << QgsPointV2( QgsWkbTypes::Point, 0, 10 ) << QgsPointV2( QgsWkbTypes::Point, 10, 10 ) - << QgsPointV2( QgsWkbTypes::Point, 10, 0 ) << QgsPointV2( QgsWkbTypes::Point, 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point, 0, 0 ) + << QgsPoint( QgsWkbTypes::Point, 0, 10 ) << QgsPoint( QgsWkbTypes::Point, 10, 10 ) + << QgsPoint( QgsWkbTypes::Point, 10, 0 ) << QgsPoint( QgsWkbTypes::Point, 0, 0 ) ); exportPolygon.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point, 1, 1 ) - << QgsPointV2( QgsWkbTypes::Point, 1, 9 ) << QgsPointV2( QgsWkbTypes::Point, 9, 9 ) - << QgsPointV2( QgsWkbTypes::Point, 9, 1 ) << QgsPointV2( QgsWkbTypes::Point, 1, 1 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point, 1, 1 ) + << QgsPoint( QgsWkbTypes::Point, 1, 9 ) << QgsPoint( QgsWkbTypes::Point, 9, 9 ) + << QgsPoint( QgsWkbTypes::Point, 9, 1 ) << QgsPoint( QgsWkbTypes::Point, 1, 1 ) ); exportPolygon.addInteriorRing( ring ); QString expectedJson( QStringLiteral( "{\"type\": \"Polygon\", \"coordinates\": [[ [0, 0], [0, 10], [10, 10], [10, 0], [0, 0]], [ [1, 1], [1, 9], [9, 9], [9, 1], [1, 1]]] }" ) ); @@ -3162,14 +3162,14 @@ void TestQgsGeometry::polygon() QgsPolygonV2 exportPolygonFloat; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point, 10 / 9.0, 10 / 9.0 ) - << QgsPointV2( QgsWkbTypes::Point, 10 / 9.0, 100 / 9.0 ) << QgsPointV2( QgsWkbTypes::Point, 100 / 9.0, 100 / 9.0 ) - << QgsPointV2( QgsWkbTypes::Point, 100 / 9.0, 10 / 9.0 ) << QgsPointV2( QgsWkbTypes::Point, 10 / 9.0, 10 / 9.0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point, 10 / 9.0, 10 / 9.0 ) + << QgsPoint( QgsWkbTypes::Point, 10 / 9.0, 100 / 9.0 ) << QgsPoint( QgsWkbTypes::Point, 100 / 9.0, 100 / 9.0 ) + << QgsPoint( QgsWkbTypes::Point, 100 / 9.0, 10 / 9.0 ) << QgsPoint( QgsWkbTypes::Point, 10 / 9.0, 10 / 9.0 ) ); exportPolygonFloat.setExteriorRing( ext ); ring = new QgsLineString(); - ring->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 2 / 3.0 ) - << QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 4 / 3.0 ) << QgsPointV2( QgsWkbTypes::Point, 4 / 3.0, 4 / 3.0 ) - << QgsPointV2( QgsWkbTypes::Point, 4 / 3.0, 2 / 3.0 ) << QgsPointV2( QgsWkbTypes::Point, 2 / 3.0, 2 / 3.0 ) ); + ring->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 2 / 3.0 ) + << QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 4 / 3.0 ) << QgsPoint( QgsWkbTypes::Point, 4 / 3.0, 4 / 3.0 ) + << QgsPoint( QgsWkbTypes::Point, 4 / 3.0, 2 / 3.0 ) << QgsPoint( QgsWkbTypes::Point, 2 / 3.0, 2 / 3.0 ) ); exportPolygonFloat.addInteriorRing( ring ); QString expectedJsonPrec3( QStringLiteral( "{\"type\": \"Polygon\", \"coordinates\": [[ [1.111, 1.111], [1.111, 11.111], [11.111, 11.111], [11.111, 1.111], [1.111, 1.111]], [ [0.667, 0.667], [0.667, 1.333], [1.333, 1.333], [1.333, 0.667], [0.667, 0.667]]] }" ) ); @@ -3196,7 +3196,7 @@ void TestQgsGeometry::polygon() //removing the fourth to last vertex removes the whole ring QgsPolygonV2 p20; QgsLineString *p20ExteriorRing = new QgsLineString(); - p20ExteriorRing->setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 0 ) ); + p20ExteriorRing->setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); p20.setExteriorRing( p20ExteriorRing ); QVERIFY( p20.exteriorRing() ); p20.deleteVertex( QgsVertexId( 0, 0, 2 ) ); @@ -3204,7 +3204,7 @@ void TestQgsGeometry::polygon() //boundary QgsLineString boundary1; - boundary1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 0 ) ); + boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygonV2 boundaryPolygon; QVERIFY( !boundaryPolygon.boundary() ); @@ -3225,9 +3225,9 @@ void TestQgsGeometry::polygon() // add interior rings QgsLineString boundaryRing1; - boundaryRing1.setPoints( QList() << QgsPointV2( 0.1, 0.1 ) << QgsPointV2( 0.2, 0.1 ) << QgsPointV2( 0.2, 0.2 ) << QgsPointV2( 0.1, 0.1 ) ); + boundaryRing1.setPoints( QList() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) ); QgsLineString boundaryRing2; - boundaryRing2.setPoints( QList() << QgsPointV2( 0.8, 0.8 ) << QgsPointV2( 0.9, 0.8 ) << QgsPointV2( 0.9, 0.9 ) << QgsPointV2( 0.8, 0.8 ) ); + boundaryRing2.setPoints( QList() << QgsPoint( 0.8, 0.8 ) << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.9, 0.9 ) << QgsPoint( 0.8, 0.8 ) ); boundaryPolygon.setInteriorRings( QList< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() ); boundary = boundaryPolygon.boundary(); QgsMultiLineString *multiLineBoundary = dynamic_cast< QgsMultiLineString * >( boundary ); @@ -3264,8 +3264,8 @@ void TestQgsGeometry::polygon() delete boundary; //test boundary with z - boundary1.setPoints( QList() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 0, 15 ) - << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 20 ) << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 10 ) ); + boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) + << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) ); boundaryPolygon.setExteriorRing( boundary1.clone() ); boundary = boundaryPolygon.boundary(); lineBoundary = dynamic_cast< QgsLineString * >( boundary ); @@ -3281,7 +3281,7 @@ void TestQgsGeometry::polygon() // point distance to boundary QgsLineString pd1; - pd1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 1 ) << QgsPointV2( 0, 0 ) ); + pd1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygonV2 pd; // no meaning, but let's not crash ( void )pd.pointDistanceToBoundary( 0, 0 ); @@ -3292,7 +3292,7 @@ void TestQgsGeometry::polygon() QGSCOMPARENEAR( pd.pointDistanceToBoundary( -0.1, 0.5 ), -0.1, 0.0000000001 ); // with a ring QgsLineString pdRing1; - pdRing1.setPoints( QList() << QgsPointV2( 0.1, 0.1 ) << QgsPointV2( 0.2, 0.1 ) << QgsPointV2( 0.2, 0.6 ) << QgsPointV2( 0.1, 0.6 ) << QgsPointV2( 0.1, 0.1 ) ); + pdRing1.setPoints( QList() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.6 ) << QgsPoint( 0.1, 0.6 ) << QgsPoint( 0.1, 0.1 ) ); pd.setInteriorRings( QList< QgsCurve * >() << pdRing1.clone() ); QGSCOMPARENEAR( pd.pointDistanceToBoundary( 0, 0.5 ), 0.0, 0.0000000001 ); QGSCOMPARENEAR( pd.pointDistanceToBoundary( 0.1, 0.5 ), 0.0, 0.0000000001 ); @@ -3303,7 +3303,7 @@ void TestQgsGeometry::polygon() // remove interior rings QgsLineString removeRingsExt; - removeRingsExt.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 0 ) ); + removeRingsExt.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygonV2 removeRings1; removeRings1.removeInteriorRings(); @@ -3313,9 +3313,9 @@ void TestQgsGeometry::polygon() // add interior rings QgsLineString removeRingsRing1; - removeRingsRing1.setPoints( QList() << QgsPointV2( 0.1, 0.1 ) << QgsPointV2( 0.2, 0.1 ) << QgsPointV2( 0.2, 0.2 ) << QgsPointV2( 0.1, 0.1 ) ); + removeRingsRing1.setPoints( QList() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) ); QgsLineString removeRingsRing2; - removeRingsRing1.setPoints( QList() << QgsPointV2( 0.6, 0.8 ) << QgsPointV2( 0.9, 0.8 ) << QgsPointV2( 0.9, 0.9 ) << QgsPointV2( 0.6, 0.8 ) ); + removeRingsRing1.setPoints( QList() << QgsPoint( 0.6, 0.8 ) << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.9, 0.9 ) << QgsPoint( 0.6, 0.8 ) ); removeRings1.setInteriorRings( QList< QgsCurve * >() << removeRingsRing1.clone() << removeRingsRing2.clone() ); // remove ring with size filter @@ -3365,8 +3365,8 @@ void TestQgsGeometry::triangle() //valid exterior ring ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 0, 0 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) + << QgsPoint( 0, 0 ) ); QVERIFY( ext->isClosed() ); t1.setExteriorRing( ext ); QVERIFY( !t1.isEmpty() ); @@ -3391,8 +3391,8 @@ void TestQgsGeometry::triangle() //set new ExteriorRing ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 10 ) << QgsPointV2( 5, 5 ) << QgsPointV2( 10, 10 ) - << QgsPointV2( 0, 10 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 10 ) << QgsPoint( 5, 5 ) << QgsPoint( 10, 10 ) + << QgsPoint( 0, 10 ) ); QVERIFY( ext->isClosed() ); t1.setExteriorRing( ext ); QVERIFY( !t1.isEmpty() ); @@ -3416,7 +3416,7 @@ void TestQgsGeometry::triangle() //test that a non closed exterior ring will be automatically closed QgsTriangle t2; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) ); QVERIFY( !ext->isClosed() ); t2.setExteriorRing( ext ); QVERIFY( !t2.isEmpty() ); @@ -3426,34 +3426,34 @@ void TestQgsGeometry::triangle() // invalid number of points ext = new QgsLineString(); t2.clear(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) ); t2.setExteriorRing( ext ); QVERIFY( t2.isEmpty() ); ext = new QgsLineString(); t2.clear(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) << QgsPointV2( 5, 10 ) << QgsPointV2( 8, 10 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) << QgsPoint( 5, 10 ) << QgsPoint( 8, 10 ) ); t2.setExteriorRing( ext ); QVERIFY( t2.isEmpty() ); // invalid exterior ring ext = new QgsLineString(); t2.clear(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) << QgsPointV2( 5, 10 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) << QgsPoint( 5, 10 ) ); t2.setExteriorRing( ext ); QVERIFY( t2.isEmpty() ); // circular ring QgsCircularString *circularRing = new QgsCircularString(); t2.clear(); - circularRing->setPoints( QgsPointSequence() << QgsPointV2( 0, 0 ) << QgsPointV2( 0, 10 ) << QgsPointV2( 10, 10 ) ); + circularRing->setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 10 ) << QgsPoint( 10, 10 ) ); QVERIFY( circularRing->hasCurvedSegments() ); t2.setExteriorRing( circularRing ); QVERIFY( t2.isEmpty() ); //constructor with 3 points // double points - QgsTriangle t3( QgsPointV2( 0, 0 ), QgsPointV2( 0, 0 ), QgsPointV2( 10, 10 ) ); + QgsTriangle t3( QgsPoint( 0, 0 ), QgsPoint( 0, 0 ), QgsPoint( 10, 10 ) ); QVERIFY( t3.isEmpty() ); QCOMPARE( t3.numInteriorRings(), 0 ); QCOMPARE( t3.nCoordinates(), 0 ); @@ -3472,7 +3472,7 @@ void TestQgsGeometry::triangle() QVERIFY( !t3.interiorRing( 0 ) ); // colinear - t3 = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 0, 10 ) ); + t3 = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 10 ) ); QVERIFY( t3.isEmpty() ); QCOMPARE( t3.numInteriorRings(), 0 ); QCOMPARE( t3.nCoordinates(), 0 ); @@ -3490,7 +3490,7 @@ void TestQgsGeometry::triangle() QVERIFY( !t3.exteriorRing() ); QVERIFY( !t3.interiorRing( 0 ) ); - t3 = QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 10 ), QgsPointV2( 10, 10 ) ); + t3 = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 10 ), QgsPoint( 10, 10 ) ); QVERIFY( !t3.isEmpty() ); QCOMPARE( t3.numInteriorRings(), 0 ); QCOMPARE( t3.nCoordinates(), 4 ); @@ -3510,19 +3510,19 @@ void TestQgsGeometry::triangle() // equality QVERIFY( QgsTriangle() == QgsTriangle( ) ); // empty - QVERIFY( QgsTriangle() == QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 0, 10 ) ) ); // empty - QVERIFY( QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 0, 10 ) ) == QgsTriangle() ); // empty - QVERIFY( QgsTriangle() != QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 5, 5 ), QgsPointV2( 0, 10 ) ) ); - QVERIFY( QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 5, 5 ), QgsPointV2( 0, 10 ) ) != QgsTriangle() ); - QVERIFY( QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 5, 5 ), QgsPointV2( 0, 10 ) ) != QgsTriangle( QgsPointV2( 0, 10 ), QgsPointV2( 5, 5 ), QgsPointV2( 0, 0 ) ) ); + QVERIFY( QgsTriangle() == QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 10 ) ) ); // empty + QVERIFY( QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 0, 10 ) ) == QgsTriangle() ); // empty + QVERIFY( QgsTriangle() != QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 5, 5 ), QgsPoint( 0, 10 ) ) ); + QVERIFY( QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 5, 5 ), QgsPoint( 0, 10 ) ) != QgsTriangle() ); + QVERIFY( QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 5, 5 ), QgsPoint( 0, 10 ) ) != QgsTriangle( QgsPoint( 0, 10 ), QgsPoint( 5, 5 ), QgsPoint( 0, 0 ) ) ); // clone QgsTriangle *t4 = t3.clone(); QCOMPARE( t3, *t4 ); delete t4; - // constructor from QgsPoint and QPointF - QgsTriangle t_qgspoint = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 10 ), QgsPoint( 10, 10 ) ); + // constructor from QgsPointXY and QPointF + QgsTriangle t_qgspoint = QgsTriangle( QgsPointXY( 0, 0 ), QgsPointXY( 0, 10 ), QgsPointXY( 10, 10 ) ); QVERIFY( t3 == t_qgspoint ); QgsTriangle t_pointf = QgsTriangle( QPointF( 0, 0 ), QPointF( 0, 10 ), QPointF( 10, 10 ) ); QVERIFY( t3 == t_pointf ); @@ -3530,8 +3530,8 @@ void TestQgsGeometry::triangle() // fromWkt QgsTriangle t5; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) ); t5.setExteriorRing( ext ); QString wkt = t5.asWkt(); QVERIFY( !wkt.isEmpty() ); @@ -3542,8 +3542,8 @@ void TestQgsGeometry::triangle() // conversion QgsPolygonV2 p1; ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) - << QgsPointV2( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPointV2( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 0, 0, 1, 5 ) + << QgsPoint( QgsWkbTypes::PointZM, 0, 10, 2, 6 ) << QgsPoint( QgsWkbTypes::PointZM, 10, 10, 3, 7 ) ); p1.setExteriorRing( ext ); //toPolygon std::unique_ptr< QgsPolygonV2 > poly( t5.toPolygon() ); @@ -3574,14 +3574,14 @@ void TestQgsGeometry::triangle() QgsConstWkbPtr nullPtr( nullptr, 0 ); QVERIFY( !t6.fromWkb( nullPtr ) ); QCOMPARE( t6.wkbType(), QgsWkbTypes::Triangle ); - QgsPointV2 point( 1, 2 ); + QgsPoint point( 1, 2 ); QByteArray wkbPoint = point.asWkb(); QgsConstWkbPtr wkbPointPtr( wkbPoint ); QVERIFY( !t6.fromWkb( wkbPointPtr ) ); QCOMPARE( t6.wkbType(), QgsWkbTypes::Triangle ); // lengths and angles - QgsTriangle t7( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ), QgsPointV2( 5, 5 ) ); + QgsTriangle t7( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) ); QVector a_tested, a_t7 = t7.angles(); a_tested.append( M_PI / 4.0 ); @@ -3605,7 +3605,7 @@ void TestQgsGeometry::triangle() QVERIFY( !t7.isScalene() ); QVERIFY( !t7.isEquilateral() ); - QgsTriangle t8( QgsPointV2( 7.2825, 4.2368 ), QgsPointV2( 13.0058, 3.3218 ), QgsPointV2( 9.2145, 6.5242 ) ); + QgsTriangle t8( QgsPoint( 7.2825, 4.2368 ), QgsPoint( 13.0058, 3.3218 ), QgsPoint( 9.2145, 6.5242 ) ); // angles in radians 58.8978;31.1036;89.9985 // length 5.79598;4.96279;2.99413 QVERIFY( t8.isRight() ); @@ -3613,69 +3613,69 @@ void TestQgsGeometry::triangle() QVERIFY( t8.isScalene() ); QVERIFY( !t8.isEquilateral() ); - QgsTriangle t9( QgsPointV2( 10, 10 ), QgsPointV2( 16, 10 ), QgsPointV2( 13, 15.1962 ) ); + QgsTriangle t9( QgsPoint( 10, 10 ), QgsPoint( 16, 10 ), QgsPoint( 13, 15.1962 ) ); QVERIFY( !t9.isRight() ); QVERIFY( t9.isIsocele() ); QVERIFY( !t9.isScalene() ); QVERIFY( t9.isEquilateral() ); // vertex - QCOMPARE( t9.vertexAt( -1 ), QgsPointV2( 0, 0 ) ); - QCOMPARE( t9.vertexAt( 0 ), QgsPointV2( 10, 10 ) ); - QCOMPARE( t9.vertexAt( 1 ), QgsPointV2( 16, 10 ) ); - QCOMPARE( t9.vertexAt( 2 ), QgsPointV2( 13, 15.1962 ) ); - QCOMPARE( t9.vertexAt( 3 ), QgsPointV2( 10, 10 ) ); - QCOMPARE( t9.vertexAt( 4 ), QgsPointV2( 0, 0 ) ); + QCOMPARE( t9.vertexAt( -1 ), QgsPoint( 0, 0 ) ); + QCOMPARE( t9.vertexAt( 0 ), QgsPoint( 10, 10 ) ); + QCOMPARE( t9.vertexAt( 1 ), QgsPoint( 16, 10 ) ); + QCOMPARE( t9.vertexAt( 2 ), QgsPoint( 13, 15.1962 ) ); + QCOMPARE( t9.vertexAt( 3 ), QgsPoint( 10, 10 ) ); + QCOMPARE( t9.vertexAt( 4 ), QgsPoint( 0, 0 ) ); // altitudes - QgsTriangle t10( QgsPointV2( 20, 2 ), QgsPointV2( 16, 6 ), QgsPointV2( 26, 2 ) ); + QgsTriangle t10( QgsPoint( 20, 2 ), QgsPoint( 16, 6 ), QgsPoint( 26, 2 ) ); QVector alt = t10.altitudes(); - QGSCOMPARENEARPOINT( alt.at( 0 ).pointN( 1 ), QgsPointV2( 20.8276, 4.0690 ), 0.0001 ); - QGSCOMPARENEARPOINT( alt.at( 1 ).pointN( 1 ), QgsPointV2( 16, 2 ), 0.0001 ); - QGSCOMPARENEARPOINT( alt.at( 2 ).pointN( 1 ), QgsPointV2( 23, -1 ), 0.0001 ); + QGSCOMPARENEARPOINT( alt.at( 0 ).pointN( 1 ), QgsPoint( 20.8276, 4.0690 ), 0.0001 ); + QGSCOMPARENEARPOINT( alt.at( 1 ).pointN( 1 ), QgsPoint( 16, 2 ), 0.0001 ); + QGSCOMPARENEARPOINT( alt.at( 2 ).pointN( 1 ), QgsPoint( 23, -1 ), 0.0001 ); // orthocenter - QCOMPARE( QgsPointV2( 16, -8 ), t10.orthocenter() ); - QCOMPARE( QgsPointV2( 0, 5 ), t7.orthocenter() ); - QGSCOMPARENEARPOINT( QgsPointV2( 13, 11.7321 ), t9.orthocenter(), 0.0001 ); + QCOMPARE( QgsPoint( 16, -8 ), t10.orthocenter() ); + QCOMPARE( QgsPoint( 0, 5 ), t7.orthocenter() ); + QGSCOMPARENEARPOINT( QgsPoint( 13, 11.7321 ), t9.orthocenter(), 0.0001 ); // circumscribed circle - QCOMPARE( QgsPointV2( 2.5, 2.5 ), t7.circumscribedCenter() ); + QCOMPARE( QgsPoint( 2.5, 2.5 ), t7.circumscribedCenter() ); QGSCOMPARENEAR( 3.5355, t7.circumscribedRadius(), 0.0001 ); - QCOMPARE( QgsPointV2( 23, 9 ), t10.circumscribedCenter() ); + QCOMPARE( QgsPoint( 23, 9 ), t10.circumscribedCenter() ); QGSCOMPARENEAR( 7.6158, t10.circumscribedRadius(), 0.0001 ); - QGSCOMPARENEARPOINT( QgsPointV2( 13, 11.7321 ), t9.circumscribedCenter(), 0.0001 ); + QGSCOMPARENEARPOINT( QgsPoint( 13, 11.7321 ), t9.circumscribedCenter(), 0.0001 ); QGSCOMPARENEAR( 3.4641, t9.circumscribedRadius(), 0.0001 ); - QGSCOMPARENEARPOINT( QgsPointV2( 13, 11.7321 ), t9.circumscribedCircle().center(), 0.0001 ); + QGSCOMPARENEARPOINT( QgsPoint( 13, 11.7321 ), t9.circumscribedCircle().center(), 0.0001 ); QGSCOMPARENEAR( 3.4641, t9.circumscribedCircle().radius(), 0.0001 ); // inscribed circle - QGSCOMPARENEARPOINT( QgsPointV2( 1.4645, 3.5355 ), t7.inscribedCenter(), 0.001 ); + QGSCOMPARENEARPOINT( QgsPoint( 1.4645, 3.5355 ), t7.inscribedCenter(), 0.001 ); QGSCOMPARENEAR( 1.4645, t7.inscribedRadius(), 0.0001 ); - QGSCOMPARENEARPOINT( QgsPointV2( 20.4433, 3.0701 ), t10.inscribedCenter(), 0.001 ); + QGSCOMPARENEARPOINT( QgsPoint( 20.4433, 3.0701 ), t10.inscribedCenter(), 0.001 ); QGSCOMPARENEAR( 1.0701, t10.inscribedRadius(), 0.0001 ); - QGSCOMPARENEARPOINT( QgsPointV2( 13, 11.7321 ), t9.inscribedCenter(), 0.0001 ); + QGSCOMPARENEARPOINT( QgsPoint( 13, 11.7321 ), t9.inscribedCenter(), 0.0001 ); QGSCOMPARENEAR( 1.7321, t9.inscribedRadius(), 0.0001 ); - QGSCOMPARENEARPOINT( QgsPointV2( 13, 11.7321 ), t9.inscribedCircle().center(), 0.0001 ); + QGSCOMPARENEARPOINT( QgsPoint( 13, 11.7321 ), t9.inscribedCircle().center(), 0.0001 ); QGSCOMPARENEAR( 1.7321, t9.inscribedCircle().radius(), 0.0001 ); // medians QVector med = t7.medians(); QCOMPARE( med.at( 0 ).pointN( 0 ), t7.vertexAt( 0 ) ); - QGSCOMPARENEARPOINT( med.at( 0 ).pointN( 1 ), QgsPointV2( 2.5, 5 ), 0.0001 ); + QGSCOMPARENEARPOINT( med.at( 0 ).pointN( 1 ), QgsPoint( 2.5, 5 ), 0.0001 ); QCOMPARE( med.at( 1 ).pointN( 0 ), t7.vertexAt( 1 ) ); - QGSCOMPARENEARPOINT( med.at( 1 ).pointN( 1 ), QgsPointV2( 2.5, 2.5 ), 0.0001 ); + QGSCOMPARENEARPOINT( med.at( 1 ).pointN( 1 ), QgsPoint( 2.5, 2.5 ), 0.0001 ); QCOMPARE( med.at( 2 ).pointN( 0 ), t7.vertexAt( 2 ) ); - QGSCOMPARENEARPOINT( med.at( 2 ).pointN( 1 ), QgsPointV2( 0, 2.5 ), 0.0001 ); + QGSCOMPARENEARPOINT( med.at( 2 ).pointN( 1 ), QgsPoint( 0, 2.5 ), 0.0001 ); med.clear(); med = t10.medians(); QCOMPARE( med.at( 0 ).pointN( 0 ), t10.vertexAt( 0 ) ); - QGSCOMPARENEARPOINT( med.at( 0 ).pointN( 1 ), QgsPointV2( 21, 4 ), 0.0001 ); + QGSCOMPARENEARPOINT( med.at( 0 ).pointN( 1 ), QgsPoint( 21, 4 ), 0.0001 ); QCOMPARE( med.at( 1 ).pointN( 0 ), t10.vertexAt( 1 ) ); - QGSCOMPARENEARPOINT( med.at( 1 ).pointN( 1 ), QgsPointV2( 23, 2 ), 0.0001 ); + QGSCOMPARENEARPOINT( med.at( 1 ).pointN( 1 ), QgsPoint( 23, 2 ), 0.0001 ); QCOMPARE( med.at( 2 ).pointN( 0 ), t10.vertexAt( 2 ) ); - QGSCOMPARENEARPOINT( med.at( 2 ).pointN( 1 ), QgsPointV2( 18, 4 ), 0.0001 ); + QGSCOMPARENEARPOINT( med.at( 2 ).pointN( 1 ), QgsPoint( 18, 4 ), 0.0001 ); med.clear(); alt.clear(); @@ -3689,7 +3689,7 @@ void TestQgsGeometry::triangle() QGSCOMPARENEARPOINT( med.at( 2 ).pointN( 1 ), alt.at( 2 ).pointN( 1 ), 0.0001 ); // medial - QCOMPARE( t7.medial(), QgsTriangle( QgsPointV2( 0, 2.5 ), QgsPointV2( 2.5, 5 ), QgsPointV2( 2.5, 2.5 ) ) ); + QCOMPARE( t7.medial(), QgsTriangle( QgsPoint( 0, 2.5 ), QgsPoint( 2.5, 5 ), QgsPoint( 2.5, 2.5 ) ) ); QCOMPARE( t9.medial(), QgsTriangle( QgsGeometryUtils::midpoint( t9.vertexAt( 0 ), t9.vertexAt( 1 ) ), QgsGeometryUtils::midpoint( t9.vertexAt( 1 ), t9.vertexAt( 2 ) ), QgsGeometryUtils::midpoint( t9.vertexAt( 2 ), t9.vertexAt( 0 ) ) ) ); @@ -3697,17 +3697,17 @@ void TestQgsGeometry::triangle() // bisectors QVector bis = t7.bisectors(); QCOMPARE( bis.at( 0 ).pointN( 0 ), t7.vertexAt( 0 ) ); - QGSCOMPARENEARPOINT( bis.at( 0 ).pointN( 1 ), QgsPointV2( 2.0711, 5 ), 0.0001 ); + QGSCOMPARENEARPOINT( bis.at( 0 ).pointN( 1 ), QgsPoint( 2.0711, 5 ), 0.0001 ); QCOMPARE( bis.at( 1 ).pointN( 0 ), t7.vertexAt( 1 ) ); - QGSCOMPARENEARPOINT( bis.at( 1 ).pointN( 1 ), QgsPointV2( 2.5, 2.5 ), 0.0001 ); + QGSCOMPARENEARPOINT( bis.at( 1 ).pointN( 1 ), QgsPoint( 2.5, 2.5 ), 0.0001 ); QCOMPARE( bis.at( 2 ).pointN( 0 ), t7.vertexAt( 2 ) ); - QGSCOMPARENEARPOINT( bis.at( 2 ).pointN( 1 ), QgsPointV2( 0, 2.9289 ), 0.0001 ); + QGSCOMPARENEARPOINT( bis.at( 2 ).pointN( 1 ), QgsPoint( 0, 2.9289 ), 0.0001 ); // "deleted" method - QgsTriangle t11( QgsPointV2( 0, 0 ), QgsPointV2( 100, 100 ), QgsPointV2( 0, 200 ) ); - ext->setPoints( QgsPointSequence() << QgsPointV2( 5, 5 ) - << QgsPointV2( 50, 50 ) << QgsPointV2( 0, 25 ) - << QgsPointV2( 5, 5 ) ); + QgsTriangle t11( QgsPoint( 0, 0 ), QgsPoint( 100, 100 ), QgsPoint( 0, 200 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 5, 5 ) + << QgsPoint( 50, 50 ) << QgsPoint( 0, 25 ) + << QgsPoint( 5, 5 ) ); t11.addInteriorRing( ext ); QCOMPARE( t11.asWkt(), QString( "Triangle ((0 0, 100 100, 0 200, 0 0))" ) ); @@ -3719,11 +3719,11 @@ void TestQgsGeometry::triangle() QgsVertexId id( 0, 0, 1 ); QVERIFY( !t11.deleteVertex( id ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((0 0, 100 100, 0 200, 0 0))" ) ); - QVERIFY( !t11.insertVertex( id, QgsPointV2( 5, 5 ) ) ); + QVERIFY( !t11.insertVertex( id, QgsPoint( 5, 5 ) ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((0 0, 100 100, 0 200, 0 0))" ) ); //move vertex - QgsPointV2 pt1( 5, 5 ); + QgsPoint pt1( 5, 5 ); // invalid part id.part = -1; QVERIFY( !t11.moveVertex( id, pt1 ) ); @@ -3745,25 +3745,25 @@ void TestQgsGeometry::triangle() id.vertex = 0; QVERIFY( t11.moveVertex( id, pt1 ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((5 5, 100 100, 0 200, 5 5))" ) ); - pt1 = QgsPointV2(); + pt1 = QgsPoint(); QVERIFY( t11.moveVertex( id, pt1 ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((0 0, 100 100, 0 200, 0 0))" ) ); id.vertex = 4; - pt1 = QgsPointV2( 5, 5 ); + pt1 = QgsPoint( 5, 5 ); QVERIFY( t11.moveVertex( id, pt1 ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((5 5, 100 100, 0 200, 5 5))" ) ); - pt1 = QgsPointV2(); + pt1 = QgsPoint(); QVERIFY( t11.moveVertex( id, pt1 ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((0 0, 100 100, 0 200, 0 0))" ) ); id.vertex = 1; - pt1 = QgsPointV2( 5, 5 ); + pt1 = QgsPoint( 5, 5 ); QVERIFY( t11.moveVertex( id, pt1 ) ); QCOMPARE( t11.asWkt(), QString( "Triangle ((0 0, 5 5, 0 200, 0 0))" ) ); // colinear - pt1 = QgsPointV2( 0, 100 ); + pt1 = QgsPoint( 0, 100 ); QVERIFY( !t11.moveVertex( id, pt1 ) ); // duplicate point - pt1 = QgsPointV2( 0, 0 ); + pt1 = QgsPoint( 0, 0 ); QVERIFY( !t11.moveVertex( id, pt1 ) ); } @@ -3772,28 +3772,28 @@ void TestQgsGeometry::ellipse() { //test constructors QgsEllipse elp1; - QVERIFY( elp1.center() == QgsPointV2() ); + QVERIFY( elp1.center() == QgsPoint() ); QCOMPARE( elp1.semiMajorAxis(), 0.0 ); QCOMPARE( elp1.semiMinorAxis(), 0.0 ); QCOMPARE( elp1.azimuth(), 90.0 ); QVERIFY( elp1.isEmpty() ); - QgsEllipse elp2( QgsPointV2( 5, 10 ), 3, 2 ); - QVERIFY( elp2.center() == QgsPointV2( 5, 10 ) ); + QgsEllipse elp2( QgsPoint( 5, 10 ), 3, 2 ); + QVERIFY( elp2.center() == QgsPoint( 5, 10 ) ); QCOMPARE( elp2.semiMajorAxis(), 3.0 ); QCOMPARE( elp2.semiMinorAxis(), 2.0 ); QCOMPARE( elp2.azimuth(), 90.0 ); QVERIFY( !elp2.isEmpty() ); - QgsEllipse elp3( QgsPointV2( 5, 10 ), 3, 2, 45 ); - QVERIFY( elp3.center() == QgsPointV2( 5, 10 ) ); + QgsEllipse elp3( QgsPoint( 5, 10 ), 3, 2, 45 ); + QVERIFY( elp3.center() == QgsPoint( 5, 10 ) ); QCOMPARE( elp3.semiMajorAxis(), 3.0 ); QCOMPARE( elp3.semiMinorAxis(), 2.0 ); QCOMPARE( elp3.azimuth(), 45.0 ); QVERIFY( !elp3.isEmpty() ); - QgsEllipse elp4( QgsPointV2( 5, 10 ), 2, 3, 45 ); - QVERIFY( elp4.center() == QgsPointV2( 5, 10 ) ); + QgsEllipse elp4( QgsPoint( 5, 10 ), 2, 3, 45 ); + QVERIFY( elp4.center() == QgsPoint( 5, 10 ) ); QCOMPARE( elp4.semiMajorAxis(), 3.0 ); QCOMPARE( elp4.semiMinorAxis(), 2.0 ); QCOMPARE( elp4.azimuth(), 135.0 ); @@ -3806,12 +3806,12 @@ void TestQgsGeometry::ellipse() QCOMPARE( elp4.toString(), QString( "Ellipse (Center: Point (5 10), Semi-Major Axis: 3, Semi-Minor Axis: 2, Azimuth: 135)" ) ); //test equality operator - QVERIFY( QgsEllipse() == QgsEllipse( QgsPointV2(), 0, 0, 90 ) ); - QVERIFY( !( QgsEllipse() == QgsEllipse( QgsPointV2(), 0, 0, 0.0005 ) ) ); - QVERIFY( elp2 == QgsEllipse( QgsPointV2( 5, 10 ), 2, 3, 0 ) ); + QVERIFY( QgsEllipse() == QgsEllipse( QgsPoint(), 0, 0, 90 ) ); + QVERIFY( !( QgsEllipse() == QgsEllipse( QgsPoint(), 0, 0, 0.0005 ) ) ); + QVERIFY( elp2 == QgsEllipse( QgsPoint( 5, 10 ), 2, 3, 0 ) ); QVERIFY( elp2 != elp3 ); QVERIFY( elp3 != elp4 ); - QVERIFY( elp4 == QgsEllipse( QgsPointV2( 5, 10 ), 3, 2, 90 + 45 ) ); + QVERIFY( elp4 == QgsEllipse( QgsPoint( 5, 10 ), 3, 2, 90 + 45 ) ); //test setter and getter elp1.setAzimuth( 45 ); @@ -3833,117 +3833,117 @@ void TestQgsGeometry::ellipse() QCOMPARE( elp1.semiMinorAxis(), 2.0 ); QCOMPARE( elp1.semiMajorAxis(), 3.0 ); - elp1.setCenter( QgsPointV2( 5, 10 ) ); - QVERIFY( elp1.center() == QgsPointV2( 5, 10 ) ); - QVERIFY( elp1.rcenter() == QgsPointV2( 5, 10 ) ); - elp1.rcenter() = QgsPointV2( 25, 310 ); - QVERIFY( elp1.center() == QgsPointV2( 25, 310 ) ); + elp1.setCenter( QgsPoint( 5, 10 ) ); + QVERIFY( elp1.center() == QgsPoint( 5, 10 ) ); + QVERIFY( elp1.rcenter() == QgsPoint( 5, 10 ) ); + elp1.rcenter() = QgsPoint( 25, 310 ); + QVERIFY( elp1.center() == QgsPoint( 25, 310 ) ); //test "alt" constructors // fromExtent - QgsEllipse elp_alt = QgsEllipse( QgsPointV2( 2.5, 5 ), 2.5, 5 ); - QVERIFY( QgsEllipse().fromExtent( QgsPointV2( 0, 0 ), QgsPointV2( 5, 10 ) ) == elp_alt ); - QVERIFY( QgsEllipse().fromExtent( QgsPointV2( 5, 10 ), QgsPointV2( 0, 0 ) ) == elp_alt ); - QVERIFY( QgsEllipse().fromExtent( QgsPointV2( 5, 0 ), QgsPointV2( 0, 10 ) ) == elp_alt ); - QVERIFY( QgsEllipse().fromExtent( QgsPointV2( -5, 0 ), QgsPointV2( 0, 10 ) ) != elp_alt ); + QgsEllipse elp_alt = QgsEllipse( QgsPoint( 2.5, 5 ), 2.5, 5 ); + QVERIFY( QgsEllipse().fromExtent( QgsPoint( 0, 0 ), QgsPoint( 5, 10 ) ) == elp_alt ); + QVERIFY( QgsEllipse().fromExtent( QgsPoint( 5, 10 ), QgsPoint( 0, 0 ) ) == elp_alt ); + QVERIFY( QgsEllipse().fromExtent( QgsPoint( 5, 0 ), QgsPoint( 0, 10 ) ) == elp_alt ); + QVERIFY( QgsEllipse().fromExtent( QgsPoint( -5, 0 ), QgsPoint( 0, 10 ) ) != elp_alt ); // fromCenterPoint - QVERIFY( QgsEllipse().fromCenterPoint( QgsPointV2( 2.5, 5 ), QgsPointV2( 5, 10 ) ) == elp_alt ); - QVERIFY( QgsEllipse().fromCenterPoint( QgsPointV2( 2.5, 5 ), QgsPointV2( -0, 0 ) ) == elp_alt ); - QVERIFY( QgsEllipse().fromCenterPoint( QgsPointV2( 2.5, 5 ), QgsPointV2( 0, -10 ) ) != elp_alt ); + QVERIFY( QgsEllipse().fromCenterPoint( QgsPoint( 2.5, 5 ), QgsPoint( 5, 10 ) ) == elp_alt ); + QVERIFY( QgsEllipse().fromCenterPoint( QgsPoint( 2.5, 5 ), QgsPoint( -0, 0 ) ) == elp_alt ); + QVERIFY( QgsEllipse().fromCenterPoint( QgsPoint( 2.5, 5 ), QgsPoint( 0, -10 ) ) != elp_alt ); // fromCenter2Points - QVERIFY( QgsEllipse().fromCenter2Points( QgsPointV2( 2.5, 5 ), QgsPointV2( 2.5, 0 ), QgsPointV2( 7.5, 5 ) ) == - QgsEllipse( QgsPointV2( 2.5, 5 ), 5, 5, 180 ) ); - QVERIFY( QgsEllipse().fromCenter2Points( QgsPointV2( 2.5, 5 ), QgsPointV2( 2.5, 7.5 ), QgsPointV2( 7.5, 5 ) ) != elp_alt ); //same ellipse with different azimuth - QVERIFY( QgsEllipse().fromCenter2Points( QgsPointV2( 2.5, 5 ), QgsPointV2( 2.5, 2.5 ), QgsPointV2( 7.5, 5 ) ) != elp_alt ); //same ellipse with different azimuth - QVERIFY( QgsEllipse().fromCenter2Points( QgsPointV2( 2.5, 5 ), QgsPointV2( 2.5, 0 ), QgsPointV2( 5, 5 ) ) == elp_alt ); - QVERIFY( QgsEllipse().fromCenter2Points( QgsPointV2( 5, 10 ), QgsPointV2( 5, 10 ).project( 3, 45 ), QgsPointV2( 5, 10 ).project( 2, 90 + 45 ) ) == - QgsEllipse( QgsPointV2( 5, 10 ), 3, 2, 45 ) ); + QVERIFY( QgsEllipse().fromCenter2Points( QgsPoint( 2.5, 5 ), QgsPoint( 2.5, 0 ), QgsPoint( 7.5, 5 ) ) == + QgsEllipse( QgsPoint( 2.5, 5 ), 5, 5, 180 ) ); + QVERIFY( QgsEllipse().fromCenter2Points( QgsPoint( 2.5, 5 ), QgsPoint( 2.5, 7.5 ), QgsPoint( 7.5, 5 ) ) != elp_alt ); //same ellipse with different azimuth + QVERIFY( QgsEllipse().fromCenter2Points( QgsPoint( 2.5, 5 ), QgsPoint( 2.5, 2.5 ), QgsPoint( 7.5, 5 ) ) != elp_alt ); //same ellipse with different azimuth + QVERIFY( QgsEllipse().fromCenter2Points( QgsPoint( 2.5, 5 ), QgsPoint( 2.5, 0 ), QgsPoint( 5, 5 ) ) == elp_alt ); + QVERIFY( QgsEllipse().fromCenter2Points( QgsPoint( 5, 10 ), QgsPoint( 5, 10 ).project( 3, 45 ), QgsPoint( 5, 10 ).project( 2, 90 + 45 ) ) == + QgsEllipse( QgsPoint( 5, 10 ), 3, 2, 45 ) ); // fromFoci // horizontal - QgsEllipse elp_hor = QgsEllipse().fromFoci( QgsPointV2( -4, 0 ), QgsPointV2( 4, 0 ), QgsPointV2( 0, 4 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 0, 0 ), sqrt( 32.0 ), sqrt( 16.0 ), 90.0 ) == elp_hor ); - QGSCOMPARENEARPOINT( QgsPointV2( 4, 0 ), elp_hor.foci().at( 0 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( -4, 0 ), elp_hor.foci().at( 1 ), 1e-8 ); - elp_hor = QgsEllipse().fromFoci( QgsPointV2( 4, 0 ), QgsPointV2( -4, 0 ), QgsPointV2( 0, 4 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 0, 0 ), sqrt( 32.0 ), sqrt( 16.0 ), 270.0 ) == elp_hor ); - QGSCOMPARENEARPOINT( QgsPointV2( -4, 0 ), elp_hor.foci().at( 0 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( 4, 0 ), elp_hor.foci().at( 1 ), 1e-8 ); + QgsEllipse elp_hor = QgsEllipse().fromFoci( QgsPoint( -4, 0 ), QgsPoint( 4, 0 ), QgsPoint( 0, 4 ) ); + QVERIFY( QgsEllipse( QgsPoint( 0, 0 ), sqrt( 32.0 ), sqrt( 16.0 ), 90.0 ) == elp_hor ); + QGSCOMPARENEARPOINT( QgsPoint( 4, 0 ), elp_hor.foci().at( 0 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( -4, 0 ), elp_hor.foci().at( 1 ), 1e-8 ); + elp_hor = QgsEllipse().fromFoci( QgsPoint( 4, 0 ), QgsPoint( -4, 0 ), QgsPoint( 0, 4 ) ); + QVERIFY( QgsEllipse( QgsPoint( 0, 0 ), sqrt( 32.0 ), sqrt( 16.0 ), 270.0 ) == elp_hor ); + QGSCOMPARENEARPOINT( QgsPoint( -4, 0 ), elp_hor.foci().at( 0 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( 4, 0 ), elp_hor.foci().at( 1 ), 1e-8 ); // vertical - QgsEllipse elp_ver = QgsEllipse().fromFoci( QgsPointV2( 45, -15 ), QgsPointV2( 45, 10 ), QgsPointV2( 55, 0 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 45, -2.5 ), 16.084946, 10.123017725, 0.0 ) == elp_ver ); - elp_ver = QgsEllipse().fromFoci( QgsPointV2( 45, 10 ), QgsPointV2( 45, -15 ), QgsPointV2( 55, 0 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 45, -2.5 ), 16.084946, 10.123017725, 180.0 ) == elp_ver ); - QGSCOMPARENEARPOINT( QgsPointV2( 45, -15 ), elp_ver.foci().at( 0 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( 45, 10 ), elp_ver.foci().at( 1 ), 1e-8 ); + QgsEllipse elp_ver = QgsEllipse().fromFoci( QgsPoint( 45, -15 ), QgsPoint( 45, 10 ), QgsPoint( 55, 0 ) ); + QVERIFY( QgsEllipse( QgsPoint( 45, -2.5 ), 16.084946, 10.123017725, 0.0 ) == elp_ver ); + elp_ver = QgsEllipse().fromFoci( QgsPoint( 45, 10 ), QgsPoint( 45, -15 ), QgsPoint( 55, 0 ) ); + QVERIFY( QgsEllipse( QgsPoint( 45, -2.5 ), 16.084946, 10.123017725, 180.0 ) == elp_ver ); + QGSCOMPARENEARPOINT( QgsPoint( 45, -15 ), elp_ver.foci().at( 0 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( 45, 10 ), elp_ver.foci().at( 1 ), 1e-8 ); // oriented // first quadrant - QgsEllipse elp_ori = QgsEllipse().fromFoci( QgsPointV2( 10, 10 ), QgsPointV2( 25, 20 ), QgsPointV2( 15, 20 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 17.5, 15.0 ), 10.5901699437, 5.55892970251, 90.0 - 33.690067526 ) == elp_ori ); - QGSCOMPARENEARPOINT( QgsPointV2( 25, 20 ), elp_ori.foci().at( 0 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); + QgsEllipse elp_ori = QgsEllipse().fromFoci( QgsPoint( 10, 10 ), QgsPoint( 25, 20 ), QgsPoint( 15, 20 ) ); + QVERIFY( QgsEllipse( QgsPoint( 17.5, 15.0 ), 10.5901699437, 5.55892970251, 90.0 - 33.690067526 ) == elp_ori ); + QGSCOMPARENEARPOINT( QgsPoint( 25, 20 ), elp_ori.foci().at( 0 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); // second quadrant - elp_ori = QgsEllipse().fromFoci( QgsPointV2( 10, 10 ), QgsPointV2( 5, 20 ), QgsPointV2( 15, 20 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 7.5, 15.0 ), 10.5901699437, 8.99453719974, 360 - 26.56505117 ) == elp_ori ); - QGSCOMPARENEARPOINT( QgsPointV2( 5, 20 ), elp_ori.foci().at( 0 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); + elp_ori = QgsEllipse().fromFoci( QgsPoint( 10, 10 ), QgsPoint( 5, 20 ), QgsPoint( 15, 20 ) ); + QVERIFY( QgsEllipse( QgsPoint( 7.5, 15.0 ), 10.5901699437, 8.99453719974, 360 - 26.56505117 ) == elp_ori ); + QGSCOMPARENEARPOINT( QgsPoint( 5, 20 ), elp_ori.foci().at( 0 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); // third quadrant - elp_ori = QgsEllipse().fromFoci( QgsPointV2( 10, 10 ), QgsPointV2( 5, -5 ), QgsPointV2( 15, 20 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 7.5, 2.5 ), 19.0530819616, 17.3355107289893, 198.434948822922 ) == elp_ori ); - QGSCOMPARENEARPOINT( QgsPointV2( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( 5, -5 ), elp_ori.foci().at( 0 ), 1e-8 ); + elp_ori = QgsEllipse().fromFoci( QgsPoint( 10, 10 ), QgsPoint( 5, -5 ), QgsPoint( 15, 20 ) ); + QVERIFY( QgsEllipse( QgsPoint( 7.5, 2.5 ), 19.0530819616, 17.3355107289893, 198.434948822922 ) == elp_ori ); + QGSCOMPARENEARPOINT( QgsPoint( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( 5, -5 ), elp_ori.foci().at( 0 ), 1e-8 ); // fourth quadrant - elp_ori = QgsEllipse().fromFoci( QgsPointV2( 10, 10 ), QgsPointV2( 25, -5 ), QgsPointV2( 15, 20 ) ); - QVERIFY( QgsEllipse( QgsPointV2( 17.5, 2.5 ), 19.0530819616, 15.82782146, 135 ) == elp_ori ); - QGSCOMPARENEARPOINT( QgsPointV2( 25, -5 ), elp_ori.foci().at( 0 ), 1e-8 ); - QGSCOMPARENEARPOINT( QgsPointV2( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); + elp_ori = QgsEllipse().fromFoci( QgsPoint( 10, 10 ), QgsPoint( 25, -5 ), QgsPoint( 15, 20 ) ); + QVERIFY( QgsEllipse( QgsPoint( 17.5, 2.5 ), 19.0530819616, 15.82782146, 135 ) == elp_ori ); + QGSCOMPARENEARPOINT( QgsPoint( 25, -5 ), elp_ori.foci().at( 0 ), 1e-8 ); + QGSCOMPARENEARPOINT( QgsPoint( 10, 10 ), elp_ori.foci().at( 1 ), 1e-8 ); // test quadrant - QgsEllipse elpq( QgsPointV2( 5, 10 ), 3, 2, 45 ); - QVector q = elpq.quadrant(); - QGSCOMPARENEARPOINT( q.at( 0 ), QgsPointV2( 7.1213, 12.1213 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 3 ), QgsPointV2( 3.5858, 11.4142 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 2 ), QgsPointV2( 2.8787, 7.8787 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 1 ), QgsPointV2( 6.4142, 8.5858 ), 0.001 ); + QgsEllipse elpq( QgsPoint( 5, 10 ), 3, 2, 45 ); + QVector q = elpq.quadrant(); + QGSCOMPARENEARPOINT( q.at( 0 ), QgsPoint( 7.1213, 12.1213 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 3 ), QgsPoint( 3.5858, 11.4142 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 2 ), QgsPoint( 2.8787, 7.8787 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 1 ), QgsPoint( 6.4142, 8.5858 ), 0.001 ); - elpq = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 90 ); + elpq = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 90 ); q.clear(); q = elpq.quadrant(); - QCOMPARE( q.at( 3 ), QgsPointV2( 0, 2 ) ); - QCOMPARE( q.at( 0 ), QgsPointV2( 5, 0 ) ); - QCOMPARE( q.at( 1 ), QgsPointV2( 0, -2 ) ); - QCOMPARE( q.at( 2 ), QgsPointV2( -5, 0 ) ); + QCOMPARE( q.at( 3 ), QgsPoint( 0, 2 ) ); + QCOMPARE( q.at( 0 ), QgsPoint( 5, 0 ) ); + QCOMPARE( q.at( 1 ), QgsPoint( 0, -2 ) ); + QCOMPARE( q.at( 2 ), QgsPoint( -5, 0 ) ); - elpq = QgsEllipse( QgsPointV2( QgsWkbTypes::PointZM, 0, 0, 123, 321 ), 5, 2, 0 ); + elpq = QgsEllipse( QgsPoint( QgsWkbTypes::PointZM, 0, 0, 123, 321 ), 5, 2, 0 ); q.clear(); q = elpq.quadrant(); - QCOMPARE( q.at( 0 ), QgsPointV2( QgsWkbTypes::PointZM, 0, 5, 123, 321 ) ); - QCOMPARE( q.at( 3 ), QgsPointV2( QgsWkbTypes::PointZM, -2, 0, 123, 321 ) ); - QCOMPARE( q.at( 2 ), QgsPointV2( QgsWkbTypes::PointZM, 0, -5, 123, 321 ) ); - QCOMPARE( q.at( 1 ), QgsPointV2( QgsWkbTypes::PointZM, 2, 0, 123, 321 ) ); + QCOMPARE( q.at( 0 ), QgsPoint( QgsWkbTypes::PointZM, 0, 5, 123, 321 ) ); + QCOMPARE( q.at( 3 ), QgsPoint( QgsWkbTypes::PointZM, -2, 0, 123, 321 ) ); + QCOMPARE( q.at( 2 ), QgsPoint( QgsWkbTypes::PointZM, 0, -5, 123, 321 ) ); + QCOMPARE( q.at( 1 ), QgsPoint( QgsWkbTypes::PointZM, 2, 0, 123, 321 ) ); - elpq = QgsEllipse( QgsPointV2( 0, 0 ), 2.5, 2, 315 ); + elpq = QgsEllipse( QgsPoint( 0, 0 ), 2.5, 2, 315 ); q.clear(); q = elpq.quadrant(); - QGSCOMPARENEARPOINT( q.at( 1 ), QgsPointV2( 1.4142, 1.4142 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 2 ), QgsPointV2( 1.7678, -1.7678 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 3 ), QgsPointV2( -1.4142, -1.4142 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 0 ), QgsPointV2( -1.7678, 1.7678 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 1 ), QgsPoint( 1.4142, 1.4142 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 2 ), QgsPoint( 1.7678, -1.7678 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 3 ), QgsPoint( -1.4142, -1.4142 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 0 ), QgsPoint( -1.7678, 1.7678 ), 0.001 ); - elpq = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2.5, 45 ); + elpq = QgsEllipse( QgsPoint( 0, 0 ), 5, 2.5, 45 ); q.clear(); q = elpq.quadrant(); - QGSCOMPARENEARPOINT( q.at( 3 ), QgsPointV2( -1.7678, 1.7678 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 0 ), QgsPointV2( 3.5355, 3.5355 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 1 ), QgsPointV2( 1.7678, -1.7678 ), 0.001 ); - QGSCOMPARENEARPOINT( q.at( 2 ), QgsPointV2( -3.5355, -3.5355 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 3 ), QgsPoint( -1.7678, 1.7678 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 0 ), QgsPoint( 3.5355, 3.5355 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 1 ), QgsPoint( 1.7678, -1.7678 ), 0.001 ); + QGSCOMPARENEARPOINT( q.at( 2 ), QgsPoint( -3.5355, -3.5355 ), 0.001 ); //test conversion // points QgsPointSequence pts; - pts = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 0 ).points( 4 ); - q = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 0 ).quadrant(); + pts = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).points( 4 ); + q = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).quadrant(); QCOMPARE( pts.length(), 4 ); QGSCOMPARENEARPOINT( q.at( 0 ), pts.at( 0 ), 2 ); QGSCOMPARENEARPOINT( q.at( 1 ), pts.at( 1 ), 2 ); @@ -3952,7 +3952,7 @@ void TestQgsGeometry::ellipse() // linestring QgsLineString *l = new QgsLineString(); - l = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 0 ).toLineString( 4 ); + l = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).toLineString( 4 ); QCOMPARE( l->numPoints(), 4 ); QgsPointSequence pts_l; l->points( pts_l ); @@ -3961,8 +3961,8 @@ void TestQgsGeometry::ellipse() // polygon QgsPolygonV2 *p1 = new QgsPolygonV2(); - p1 = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 0 ).toPolygon( 4 ); - q = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 0 ).quadrant(); + p1 = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).toPolygon( 4 ); + q = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).quadrant(); QCOMPARE( p1->vertexAt( QgsVertexId( 0, 0, 0 ) ), q.at( 0 ) ); QCOMPARE( p1->vertexAt( QgsVertexId( 0, 0, 1 ) ), q.at( 1 ) ); QCOMPARE( p1->vertexAt( QgsVertexId( 0, 0, 2 ) ), q.at( 2 ) ); @@ -3971,8 +3971,8 @@ void TestQgsGeometry::ellipse() QCOMPARE( 0, p1->numInteriorRings() ); QCOMPARE( 5, p1->exteriorRing()->numPoints() ); - p1 = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 90 ).toPolygon( 4 ); - q = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 90 ).quadrant(); + p1 = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 90 ).toPolygon( 4 ); + q = QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 90 ).quadrant(); QCOMPARE( p1->vertexAt( QgsVertexId( 0, 0, 0 ) ), q.at( 0 ) ); QCOMPARE( p1->vertexAt( QgsVertexId( 0, 0, 1 ) ), q.at( 1 ) ); QCOMPARE( p1->vertexAt( QgsVertexId( 0, 0, 2 ) ), q.at( 2 ) ); @@ -3994,51 +3994,51 @@ void TestQgsGeometry::ellipse() // oriented bounding box QVERIFY( QgsEllipse().orientedBoundingBox()->isEmpty() ); - elpq = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2 ); + elpq = QgsEllipse( QgsPoint( 0, 0 ), 5, 2 ); QgsPolygonV2 *ombb = new QgsPolygonV2(); QgsLineString *ext = new QgsLineString(); - ext->setPoints( QgsPointSequence() << QgsPointV2( 5, 2 ) << QgsPointV2( 5, -2 ) << QgsPointV2( -5, -2 ) << QgsPointV2( -5, 2 ) ); + ext->setPoints( QgsPointSequence() << QgsPoint( 5, 2 ) << QgsPoint( 5, -2 ) << QgsPoint( -5, -2 ) << QgsPoint( -5, 2 ) ); ombb->setExteriorRing( ext ); QCOMPARE( ombb->asWkt( 2 ), elpq.orientedBoundingBox()->asWkt( 2 ) ); - elpq = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2.5, 45 ); + elpq = QgsEllipse( QgsPoint( 0, 0 ), 5, 2.5, 45 ); ombb = elpq.orientedBoundingBox(); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( 1.7678, 5.3033 ), 0.0001 ); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( 5.3033, 1.7678 ), 0.0001 ); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPointV2( -1.7678, -5.3033 ), 0.0001 ); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 3 ) ), QgsPointV2( -5.3033, -1.7678 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( 1.7678, 5.3033 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( 5.3033, 1.7678 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( -1.7678, -5.3033 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 3 ) ), QgsPoint( -5.3033, -1.7678 ), 0.0001 ); - elpq = QgsEllipse( QgsPointV2( 0, 0 ), 5, 2.5, 315 ); + elpq = QgsEllipse( QgsPoint( 0, 0 ), 5, 2.5, 315 ); ombb = elpq.orientedBoundingBox(); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPointV2( -5.3033, 1.7678 ), 0.0001 ); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPointV2( -1.7678, 5.3033 ), 0.0001 ); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPointV2( 5.3033, -1.7678 ), 0.0001 ); - QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 3 ) ), QgsPointV2( 1.7678, -5.3033 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( -5.3033, 1.7678 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( -1.7678, 5.3033 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( 5.3033, -1.7678 ), 0.0001 ); + QGSCOMPARENEARPOINT( ombb->exteriorRing()->vertexAt( QgsVertexId( 0, 0, 3 ) ), QgsPoint( 1.7678, -5.3033 ), 0.0001 ); // bounding box QCOMPARE( QgsEllipse().boundingBox(), QgsRectangle() ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 5, 2 ).boundingBox(), QgsEllipse( QgsPointV2( 0, 0 ), 5, 2 ).orientedBoundingBox()->boundingBox() ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 5, 5 ).boundingBox(), QgsRectangle( QgsPoint( -5, -5 ), QgsPoint( 5, 5 ) ) ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 5, 5, 60 ).boundingBox(), QgsRectangle( QgsPoint( -5, -5 ), QgsPoint( 5, 5 ) ) ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 13, 9, 45 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPoint( -11.1803, -11.1803 ), QgsPoint( 11.1803, 11.1803 ) ).toString( 4 ).toStdString() ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 13, 9, 60 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPoint( -12.12436, -10.14889 ), QgsPoint( 12.12436, 10.14889 ) ).toString( 4 ).toStdString() ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 13, 9, 60 + 90 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPoint( -10.14889, -12.12436 ), QgsPoint( 10.14889, 12.12436 ) ).toString( 4 ).toStdString() ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 13, 9, 300 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPoint( -12.12436, -10.14889 ), QgsPoint( 12.12436, 10.14889 ) ).toString( 4 ).toStdString() ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 13, 9, 300 - 90 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPoint( -10.14889, -12.12436 ), QgsPoint( 10.14889, 12.12436 ) ).toString( 4 ).toStdString() ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 5, 2 ).boundingBox(), QgsEllipse( QgsPoint( 0, 0 ), 5, 2 ).orientedBoundingBox()->boundingBox() ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 5, 5 ).boundingBox(), QgsRectangle( QgsPointXY( -5, -5 ), QgsPointXY( 5, 5 ) ) ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 5, 5, 60 ).boundingBox(), QgsRectangle( QgsPointXY( -5, -5 ), QgsPointXY( 5, 5 ) ) ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 13, 9, 45 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPointXY( -11.1803, -11.1803 ), QgsPointXY( 11.1803, 11.1803 ) ).toString( 4 ).toStdString() ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 13, 9, 60 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPointXY( -12.12436, -10.14889 ), QgsPointXY( 12.12436, 10.14889 ) ).toString( 4 ).toStdString() ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 13, 9, 60 + 90 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPointXY( -10.14889, -12.12436 ), QgsPointXY( 10.14889, 12.12436 ) ).toString( 4 ).toStdString() ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 13, 9, 300 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPointXY( -12.12436, -10.14889 ), QgsPointXY( 12.12436, 10.14889 ) ).toString( 4 ).toStdString() ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 13, 9, 300 - 90 ).boundingBox().toString( 4 ).toStdString(), QgsRectangle( QgsPointXY( -10.14889, -12.12436 ), QgsPointXY( 10.14889, 12.12436 ) ).toString( 4 ).toStdString() ); // focus - QCOMPARE( QgsEllipse().fromFoci( QgsPointV2( -4, 0 ), QgsPointV2( 4, 0 ), QgsPointV2( 0, 4 ) ).focusDistance(), 4.0 ); - QGSCOMPARENEAR( QgsEllipse().fromFoci( QgsPointV2( 10, 10 ), QgsPointV2( 25, 20 ), QgsPointV2( 15, 20 ) ).focusDistance(), 9.01388, 0.0001 ); + QCOMPARE( QgsEllipse().fromFoci( QgsPoint( -4, 0 ), QgsPoint( 4, 0 ), QgsPoint( 0, 4 ) ).focusDistance(), 4.0 ); + QGSCOMPARENEAR( QgsEllipse().fromFoci( QgsPoint( 10, 10 ), QgsPoint( 25, 20 ), QgsPoint( 15, 20 ) ).focusDistance(), 9.01388, 0.0001 ); // eccentricity - QCOMPARE( QgsEllipse().fromFoci( QgsPointV2( -4, 0 ), QgsPointV2( 4, 0 ), QgsPointV2( 0, 4 ) ).eccentricity(), 0.7071067811865475 ); - QCOMPARE( QgsEllipse( QgsPointV2( 0, 0 ), 3, 3 ).eccentricity(), 0.0 ); + QCOMPARE( QgsEllipse().fromFoci( QgsPoint( -4, 0 ), QgsPoint( 4, 0 ), QgsPoint( 0, 4 ) ).eccentricity(), 0.7071067811865475 ); + QCOMPARE( QgsEllipse( QgsPoint( 0, 0 ), 3, 3 ).eccentricity(), 0.0 ); QVERIFY( std::isnan( QgsEllipse().eccentricity() ) ); // area - QGSCOMPARENEAR( 31.4159, QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 0 ).area(), 0.0001 ); + QGSCOMPARENEAR( 31.4159, QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 0 ).area(), 0.0001 ); // perimeter - QGSCOMPARENEAR( QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 45 ).perimeter(), QgsEllipse( QgsPointV2( 0, 0 ), 5, 2, 45 ).toPolygon( 10000 )->perimeter(), 0.001 ); + QGSCOMPARENEAR( QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 45 ).perimeter(), QgsEllipse( QgsPoint( 0, 0 ), 5, 2, 45 ).toPolygon( 10000 )->perimeter(), 0.001 ); } @@ -4046,19 +4046,19 @@ void TestQgsGeometry::circle() { //test constructors QgsCircle circ1; - QVERIFY( circ1.center() == QgsPointV2() ); + QVERIFY( circ1.center() == QgsPoint() ); QCOMPARE( circ1.radius(), 0.0 ); QCOMPARE( circ1.azimuth(), 0.0 ); QVERIFY( circ1.isEmpty() ); - QgsCircle circ2( QgsPointV2( 5, 10 ), 3 ); - QVERIFY( circ2.center() == QgsPointV2( 5, 10 ) ); + QgsCircle circ2( QgsPoint( 5, 10 ), 3 ); + QVERIFY( circ2.center() == QgsPoint( 5, 10 ) ); QCOMPARE( circ2.radius(), 3.0 ); QCOMPARE( circ2.azimuth(), 0.0 ); QVERIFY( !circ2.isEmpty() ); - QgsCircle circ3( QgsPointV2( 5, 10 ), 3, 45 ); - QVERIFY( circ3.center() == QgsPointV2( 5, 10 ) ); + QgsCircle circ3( QgsPoint( 5, 10 ), 3, 45 ); + QVERIFY( circ3.center() == QgsPoint( 5, 10 ) ); QCOMPARE( circ3.radius(), 3.0 ); QCOMPARE( circ3.azimuth(), 45.0 ); QVERIFY( !circ3.isEmpty() ); @@ -4069,9 +4069,9 @@ void TestQgsGeometry::circle() QCOMPARE( circ3.toString(), QString( "Circle (Center: Point (5 10), Radius: 3, Azimuth: 45)" ) ); //test equality operator - QVERIFY( QgsCircle() == QgsCircle( QgsPointV2(), 0, 0 ) ); - QVERIFY( !( QgsCircle() == QgsCircle( QgsPointV2(), 0, 0.0005 ) ) ); - QVERIFY( circ2 == QgsCircle( QgsPointV2( 5, 10 ), 3, 0 ) ); + QVERIFY( QgsCircle() == QgsCircle( QgsPoint(), 0, 0 ) ); + QVERIFY( !( QgsCircle() == QgsCircle( QgsPoint(), 0, 0.0005 ) ) ); + QVERIFY( circ2 == QgsCircle( QgsPoint( 5, 10 ), 3, 0 ) ); QVERIFY( circ2 != circ3 ); //test setter and getter @@ -4093,198 +4093,198 @@ void TestQgsGeometry::circle() QCOMPARE( circ1.semiMajorAxis(), 8250.0 ); QCOMPARE( circ1.semiMinorAxis(), 8250.0 ); - circ1.setCenter( QgsPointV2( 5, 10 ) ); - QVERIFY( circ1.center() == QgsPointV2( 5, 10 ) ); - QVERIFY( circ1.rcenter() == QgsPointV2( 5, 10 ) ); - circ1.rcenter() = QgsPointV2( 25, 310 ); - QVERIFY( circ1.center() == QgsPointV2( 25, 310 ) ); + circ1.setCenter( QgsPoint( 5, 10 ) ); + QVERIFY( circ1.center() == QgsPoint( 5, 10 ) ); + QVERIFY( circ1.rcenter() == QgsPoint( 5, 10 ) ); + circ1.rcenter() = QgsPoint( 25, 310 ); + QVERIFY( circ1.center() == QgsPoint( 25, 310 ) ); //test "alt" constructors // by2Points - QVERIFY( QgsCircle().from2Points( QgsPointV2( -5, 0 ), QgsPointV2( 5, 0 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 10, 90 ) ); - QVERIFY( QgsCircle().from2Points( QgsPointV2( 0, -5 ), QgsPointV2( 0, 5 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 10, 0 ) ); + QVERIFY( QgsCircle().from2Points( QgsPoint( -5, 0 ), QgsPoint( 5, 0 ) ) == QgsCircle( QgsPoint( 0, 0 ), 10, 90 ) ); + QVERIFY( QgsCircle().from2Points( QgsPoint( 0, -5 ), QgsPoint( 0, 5 ) ) == QgsCircle( QgsPoint( 0, 0 ), 10, 0 ) ); // byExtent - QVERIFY( QgsCircle().fromExtent( QgsPointV2( -5, -5 ), QgsPointV2( 5, 5 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 5, 0 ) ); - QVERIFY( QgsCircle().fromExtent( QgsPointV2( -7.5, -2.5 ), QgsPointV2( 2.5, 200.5 ) ) == QgsCircle() ); + QVERIFY( QgsCircle().fromExtent( QgsPoint( -5, -5 ), QgsPoint( 5, 5 ) ) == QgsCircle( QgsPoint( 0, 0 ), 5, 0 ) ); + QVERIFY( QgsCircle().fromExtent( QgsPoint( -7.5, -2.5 ), QgsPoint( 2.5, 200.5 ) ) == QgsCircle() ); // by3Points - QVERIFY( QgsCircle().from3Points( QgsPointV2( -5, 0 ), QgsPointV2( 5, 0 ), QgsPointV2( 0, 5 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 5 ) ); - QVERIFY( QgsCircle().from3Points( QgsPointV2( 5, 0 ), QgsPointV2( 6, 0 ), QgsPointV2( 7, 0 ) ) == QgsCircle() ); + QVERIFY( QgsCircle().from3Points( QgsPoint( -5, 0 ), QgsPoint( 5, 0 ), QgsPoint( 0, 5 ) ) == QgsCircle( QgsPoint( 0, 0 ), 5 ) ); + QVERIFY( QgsCircle().from3Points( QgsPoint( 5, 0 ), QgsPoint( 6, 0 ), QgsPoint( 7, 0 ) ) == QgsCircle() ); // byCenterDiameter - QVERIFY( QgsCircle().fromCenterDiameter( QgsPointV2( 0, 0 ), 10 ) == QgsCircle( QgsPointV2( 0, 0 ), 5, 0 ) ); - QVERIFY( QgsCircle().fromCenterDiameter( QgsPointV2( 2, 100 ), -10 ) == QgsCircle( QgsPointV2( 2, 100 ), 5, 0 ) ); - QVERIFY( QgsCircle().fromCenterDiameter( QgsPointV2( 2, 100 ), -10, 45 ) == QgsCircle( QgsPointV2( 2, 100 ), 5, 45 ) ); + QVERIFY( QgsCircle().fromCenterDiameter( QgsPoint( 0, 0 ), 10 ) == QgsCircle( QgsPoint( 0, 0 ), 5, 0 ) ); + QVERIFY( QgsCircle().fromCenterDiameter( QgsPoint( 2, 100 ), -10 ) == QgsCircle( QgsPoint( 2, 100 ), 5, 0 ) ); + QVERIFY( QgsCircle().fromCenterDiameter( QgsPoint( 2, 100 ), -10, 45 ) == QgsCircle( QgsPoint( 2, 100 ), 5, 45 ) ); // byCenterPoint - QVERIFY( QgsCircle().fromCenterPoint( QgsPointV2( 0, 0 ), QgsPointV2( 5, 0 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 5, 90 ) ); - QVERIFY( QgsCircle().fromCenterPoint( QgsPointV2( 0, 0 ), QgsPointV2( 0, 5 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 5, 0 ) ); - QVERIFY( QgsCircle().fromCenterPoint( QgsPointV2( 0, 0 ), QgsPointV2( 5 * cos( 45 * M_PI / 180.0 ), 5 * sin( 45 * M_PI / 180.0 ) ) ) == QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ) ); + QVERIFY( QgsCircle().fromCenterPoint( QgsPoint( 0, 0 ), QgsPoint( 5, 0 ) ) == QgsCircle( QgsPoint( 0, 0 ), 5, 90 ) ); + QVERIFY( QgsCircle().fromCenterPoint( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ) ) == QgsCircle( QgsPoint( 0, 0 ), 5, 0 ) ); + QVERIFY( QgsCircle().fromCenterPoint( QgsPoint( 0, 0 ), QgsPoint( 5 * cos( 45 * M_PI / 180.0 ), 5 * sin( 45 * M_PI / 180.0 ) ) ) == QgsCircle( QgsPoint( 0, 0 ), 5, 45 ) ); // by3Tangents // Tangents from triangle tri1( 0,0 ; 0,5 ), tri2( 0,0 ; 5,0 ), tri3( 5,0 ; 0,5 ) - QgsCircle circ_tgt = QgsCircle().from3Tangents( QgsPointV2( 0, 0 ), QgsPointV2( 0, 1 ), QgsPointV2( 2, 0 ), QgsPointV2( 3, 0 ), QgsPointV2( 5, 0 ), QgsPointV2( 0, 5 ) ); - QGSCOMPARENEARPOINT( circ_tgt.center(), QgsPointV2( 1.4645, 1.4645 ), 0.0001 ); + QgsCircle circ_tgt = QgsCircle().from3Tangents( QgsPoint( 0, 0 ), QgsPoint( 0, 1 ), QgsPoint( 2, 0 ), QgsPoint( 3, 0 ), QgsPoint( 5, 0 ), QgsPoint( 0, 5 ) ); + QGSCOMPARENEARPOINT( circ_tgt.center(), QgsPoint( 1.4645, 1.4645 ), 0.0001 ); QGSCOMPARENEAR( circ_tgt.radius(), 1.4645, 0.0001 ); // test quadrant - QVector quad = QgsCircle( QgsPointV2( 0, 0 ), 5 ).northQuadrant(); - QVERIFY( quad.at( 0 ) == QgsPointV2( 0, 5 ) ); - QVERIFY( quad.at( 1 ) == QgsPointV2( 5, 0 ) ); - QVERIFY( quad.at( 2 ) == QgsPointV2( 0, -5 ) ); - QVERIFY( quad.at( 3 ) == QgsPointV2( -5, 0 ) ); + QVector quad = QgsCircle( QgsPoint( 0, 0 ), 5 ).northQuadrant(); + QVERIFY( quad.at( 0 ) == QgsPoint( 0, 5 ) ); + QVERIFY( quad.at( 1 ) == QgsPoint( 5, 0 ) ); + QVERIFY( quad.at( 2 ) == QgsPoint( 0, -5 ) ); + QVERIFY( quad.at( 3 ) == QgsPoint( -5, 0 ) ); - quad = QgsCircle( QgsPointV2( 0, 0 ), 5, 123 ).northQuadrant(); - QVERIFY( quad.at( 0 ) == QgsPointV2( 0, 5 ) ); - QVERIFY( quad.at( 1 ) == QgsPointV2( 5, 0 ) ); - QVERIFY( quad.at( 2 ) == QgsPointV2( 0, -5 ) ); - QVERIFY( quad.at( 3 ) == QgsPointV2( -5, 0 ) ); + quad = QgsCircle( QgsPoint( 0, 0 ), 5, 123 ).northQuadrant(); + QVERIFY( quad.at( 0 ) == QgsPoint( 0, 5 ) ); + QVERIFY( quad.at( 1 ) == QgsPoint( 5, 0 ) ); + QVERIFY( quad.at( 2 ) == QgsPoint( 0, -5 ) ); + QVERIFY( quad.at( 3 ) == QgsPoint( -5, 0 ) ); - quad = QgsCircle( QgsPointV2( 0, 0 ), 5, 456 ).northQuadrant(); - QVERIFY( quad.at( 0 ) == QgsPointV2( 0, 5 ) ); - QVERIFY( quad.at( 1 ) == QgsPointV2( 5, 0 ) ); - QVERIFY( quad.at( 2 ) == QgsPointV2( 0, -5 ) ); - QVERIFY( quad.at( 3 ) == QgsPointV2( -5, 0 ) ); + quad = QgsCircle( QgsPoint( 0, 0 ), 5, 456 ).northQuadrant(); + QVERIFY( quad.at( 0 ) == QgsPoint( 0, 5 ) ); + QVERIFY( quad.at( 1 ) == QgsPoint( 5, 0 ) ); + QVERIFY( quad.at( 2 ) == QgsPoint( 0, -5 ) ); + QVERIFY( quad.at( 3 ) == QgsPoint( -5, 0 ) ); - quad = QgsCircle( QgsPointV2( 0, 0 ), 5, -789l ).northQuadrant(); - QVERIFY( quad.at( 0 ) == QgsPointV2( 0, 5 ) ); - QVERIFY( quad.at( 1 ) == QgsPointV2( 5, 0 ) ); - QVERIFY( quad.at( 2 ) == QgsPointV2( 0, -5 ) ); - QVERIFY( quad.at( 3 ) == QgsPointV2( -5, 0 ) ); + quad = QgsCircle( QgsPoint( 0, 0 ), 5, -789l ).northQuadrant(); + QVERIFY( quad.at( 0 ) == QgsPoint( 0, 5 ) ); + QVERIFY( quad.at( 1 ) == QgsPoint( 5, 0 ) ); + QVERIFY( quad.at( 2 ) == QgsPoint( 0, -5 ) ); + QVERIFY( quad.at( 3 ) == QgsPoint( -5, 0 ) ); //test conversion QgsPointSequence ptsPol; std::unique_ptr< QgsPolygonV2 > pol( new QgsPolygonV2() ); // polygon - pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 ) ); + pol.reset( QgsCircle( QgsPoint( 0, 0 ), 5 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); QCOMPARE( ptsPol.length(), 5 ); - QVERIFY( ptsPol.at( 0 ) == QgsPointV2( 0, 5 ) ); - QVERIFY( ptsPol.at( 1 ) == QgsPointV2( 5, 0 ) ); - QVERIFY( ptsPol.at( 2 ) == QgsPointV2( 0, -5 ) ); - QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -5, 0 ) ); - QVERIFY( ptsPol.at( 4 ) == QgsPointV2( 0, 5 ) ); + QVERIFY( ptsPol.at( 0 ) == QgsPoint( 0, 5 ) ); + QVERIFY( ptsPol.at( 1 ) == QgsPoint( 5, 0 ) ); + QVERIFY( ptsPol.at( 2 ) == QgsPoint( 0, -5 ) ); + QVERIFY( ptsPol.at( 3 ) == QgsPoint( -5, 0 ) ); + QVERIFY( ptsPol.at( 4 ) == QgsPoint( 0, 5 ) ); // oriented //45 double val = 5 * sin( M_PI / 4 ); - pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 ) ); + pol.reset( QgsCircle( QgsPoint( 0, 0 ), 5, 45 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); QCOMPARE( ptsPol.length(), 5 ); - QVERIFY( ptsPol.at( 0 ) == QgsPointV2( val, val ) ); - QVERIFY( ptsPol.at( 1 ) == QgsPointV2( val, -val ) ); - QVERIFY( ptsPol.at( 2 ) == QgsPointV2( -val, -val ) ); - QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -val, val ) ); - QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, val ) ); + QVERIFY( ptsPol.at( 0 ) == QgsPoint( val, val ) ); + QVERIFY( ptsPol.at( 1 ) == QgsPoint( val, -val ) ); + QVERIFY( ptsPol.at( 2 ) == QgsPoint( -val, -val ) ); + QVERIFY( ptsPol.at( 3 ) == QgsPoint( -val, val ) ); + QVERIFY( ptsPol.at( 4 ) == QgsPoint( val, val ) ); //135 - pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 ) ); + pol.reset( QgsCircle( QgsPoint( 0, 0 ), 5, 135 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); QCOMPARE( ptsPol.length(), 5 ); - QVERIFY( ptsPol.at( 0 ) == QgsPointV2( val, -val ) ); - QVERIFY( ptsPol.at( 1 ) == QgsPointV2( -val, -val ) ); - QVERIFY( ptsPol.at( 2 ) == QgsPointV2( -val, val ) ); - QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, val ) ); - QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, -val ) ); + QVERIFY( ptsPol.at( 0 ) == QgsPoint( val, -val ) ); + QVERIFY( ptsPol.at( 1 ) == QgsPoint( -val, -val ) ); + QVERIFY( ptsPol.at( 2 ) == QgsPoint( -val, val ) ); + QVERIFY( ptsPol.at( 3 ) == QgsPoint( val, val ) ); + QVERIFY( ptsPol.at( 4 ) == QgsPoint( val, -val ) ); //225 - pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 ) ); + pol.reset( QgsCircle( QgsPoint( 0, 0 ), 5, 225 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); QCOMPARE( ptsPol.length(), 5 ); - QVERIFY( ptsPol.at( 0 ) == QgsPointV2( -val, -val ) ); - QVERIFY( ptsPol.at( 1 ) == QgsPointV2( -val, val ) ); - QVERIFY( ptsPol.at( 2 ) == QgsPointV2( val, val ) ); - QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, -val ) ); - QVERIFY( ptsPol.at( 4 ) == QgsPointV2( -val, -val ) ); + QVERIFY( ptsPol.at( 0 ) == QgsPoint( -val, -val ) ); + QVERIFY( ptsPol.at( 1 ) == QgsPoint( -val, val ) ); + QVERIFY( ptsPol.at( 2 ) == QgsPoint( val, val ) ); + QVERIFY( ptsPol.at( 3 ) == QgsPoint( val, -val ) ); + QVERIFY( ptsPol.at( 4 ) == QgsPoint( -val, -val ) ); //315 - pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 ) ); + pol.reset( QgsCircle( QgsPoint( 0, 0 ), 5, 315 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); QCOMPARE( ptsPol.length(), 5 ); - QVERIFY( ptsPol.at( 0 ) == QgsPointV2( -val, val ) ); - QVERIFY( ptsPol.at( 1 ) == QgsPointV2( val, val ) ); - QVERIFY( ptsPol.at( 2 ) == QgsPointV2( val, -val ) ); - QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -val, -val ) ); - QVERIFY( ptsPol.at( 4 ) == QgsPointV2( -val, val ) ); + QVERIFY( ptsPol.at( 0 ) == QgsPoint( -val, val ) ); + QVERIFY( ptsPol.at( 1 ) == QgsPoint( val, val ) ); + QVERIFY( ptsPol.at( 2 ) == QgsPoint( val, -val ) ); + QVERIFY( ptsPol.at( 3 ) == QgsPoint( -val, -val ) ); + QVERIFY( ptsPol.at( 4 ) == QgsPoint( -val, val ) ); // circular arc - QCOMPARE( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toCircularString()->asWkt( 2 ), QString( "CircularString (0 5, 5 0, 0 -5, -5 0, 0 5)" ) ); - QCOMPARE( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toCircularString( true )->asWkt( 2 ), QString( "CircularString (0 5, 5 0, 0 -5, -5 -0, 0 5)" ) ); - QCOMPARE( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toCircularString()->asWkt( 2 ), QString( "CircularString (0 5, 5 0, 0 -5, -5 0, 0 5)" ) ); - QCOMPARE( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toCircularString( true )->asWkt( 2 ), QString( "CircularString (-3.54 3.54, 3.54 3.54, 3.54 -3.54, -3.54 -3.54, -3.54 3.54)" ) ); + QCOMPARE( QgsCircle( QgsPoint( 0, 0 ), 5 ).toCircularString()->asWkt( 2 ), QString( "CircularString (0 5, 5 0, 0 -5, -5 0, 0 5)" ) ); + QCOMPARE( QgsCircle( QgsPoint( 0, 0 ), 5 ).toCircularString( true )->asWkt( 2 ), QString( "CircularString (0 5, 5 0, 0 -5, -5 -0, 0 5)" ) ); + QCOMPARE( QgsCircle( QgsPoint( 0, 0 ), 5, 315 ).toCircularString()->asWkt( 2 ), QString( "CircularString (0 5, 5 0, 0 -5, -5 0, 0 5)" ) ); + QCOMPARE( QgsCircle( QgsPoint( 0, 0 ), 5, 315 ).toCircularString( true )->asWkt( 2 ), QString( "CircularString (-3.54 3.54, 3.54 3.54, 3.54 -3.54, -3.54 -3.54, -3.54 3.54)" ) ); // bounding box - QVERIFY( QgsRectangle( QgsPoint( -2.5, -2.5 ), QgsPoint( 2.5, 2.5 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 2.5, 0 ).boundingBox() ); - QVERIFY( QgsRectangle( QgsPoint( -2.5, -2.5 ), QgsPoint( 2.5, 2.5 ) ) == QgsCircle( QgsPointV2( 0, 0 ), 2.5, 45 ).boundingBox() ); + QVERIFY( QgsRectangle( QgsPointXY( -2.5, -2.5 ), QgsPointXY( 2.5, 2.5 ) ) == QgsCircle( QgsPoint( 0, 0 ), 2.5, 0 ).boundingBox() ); + QVERIFY( QgsRectangle( QgsPointXY( -2.5, -2.5 ), QgsPointXY( 2.5, 2.5 ) ) == QgsCircle( QgsPoint( 0, 0 ), 2.5, 45 ).boundingBox() ); // area - QGSCOMPARENEAR( 314.1593, QgsCircle( QgsPointV2( 0, 0 ), 10 ).area(), 0.0001 ); + QGSCOMPARENEAR( 314.1593, QgsCircle( QgsPoint( 0, 0 ), 10 ).area(), 0.0001 ); // perimeter - QGSCOMPARENEAR( 31.4159, QgsCircle( QgsPointV2( 0, 0 ), 5 ).perimeter(), 0.0001 ); + QGSCOMPARENEAR( 31.4159, QgsCircle( QgsPoint( 0, 0 ), 5 ).perimeter(), 0.0001 ); } void TestQgsGeometry::regularPolygon() { // constructors QgsRegularPolygon rp1 = QgsRegularPolygon(); - QCOMPARE( rp1.center(), QgsPointV2() ); - QCOMPARE( rp1.firstVertex(), QgsPointV2() ); + QCOMPARE( rp1.center(), QgsPoint() ); + QCOMPARE( rp1.firstVertex(), QgsPoint() ); QCOMPARE( rp1.numberSides(), 0 ); QCOMPARE( rp1.radius(), 0.0 ); QVERIFY( rp1.isEmpty() ); QgsRegularPolygon rp2; - QgsRegularPolygon( QgsPointV2(), 5, 0, 2, QgsRegularPolygon::InscribedCircle ); + QgsRegularPolygon( QgsPoint(), 5, 0, 2, QgsRegularPolygon::InscribedCircle ); QVERIFY( rp2.isEmpty() ); - QgsRegularPolygon( QgsPointV2(), 5, 0, 5, static_cast< QgsRegularPolygon::ConstructionOption >( 4 ) ); + QgsRegularPolygon( QgsPoint(), 5, 0, 5, static_cast< QgsRegularPolygon::ConstructionOption >( 4 ) ); QVERIFY( rp2.isEmpty() ); - rp2 = QgsRegularPolygon( QgsPointV2(), 5, 0, 5, QgsRegularPolygon::InscribedCircle ); + rp2 = QgsRegularPolygon( QgsPoint(), 5, 0, 5, QgsRegularPolygon::InscribedCircle ); QVERIFY( !rp2.isEmpty() ); - QCOMPARE( rp2.center(), QgsPointV2() ); - QCOMPARE( rp2.firstVertex(), QgsPointV2( 0, 5 ) ); + QCOMPARE( rp2.center(), QgsPoint() ); + QCOMPARE( rp2.firstVertex(), QgsPoint( 0, 5 ) ); QCOMPARE( rp2.numberSides(), 5 ); QCOMPARE( rp2.radius(), 5.0 ); QGSCOMPARENEAR( rp2.apothem(), 4.0451, 10E-4 ); - QVERIFY( rp2 == QgsRegularPolygon( QgsPointV2(), -5, 0, 5, QgsRegularPolygon::InscribedCircle ) ); + QVERIFY( rp2 == QgsRegularPolygon( QgsPoint(), -5, 0, 5, QgsRegularPolygon::InscribedCircle ) ); - QgsRegularPolygon rp3 = QgsRegularPolygon( QgsPointV2(), rp2.apothem(), 36.0, 5, QgsRegularPolygon::CircumscribedCircle ); + QgsRegularPolygon rp3 = QgsRegularPolygon( QgsPoint(), rp2.apothem(), 36.0, 5, QgsRegularPolygon::CircumscribedCircle ); QVERIFY( rp2 == rp3 ); - QVERIFY( rp2 == QgsRegularPolygon( QgsPointV2(), -rp2.apothem(), 36.0, 5, QgsRegularPolygon::CircumscribedCircle ) ); + QVERIFY( rp2 == QgsRegularPolygon( QgsPoint(), -rp2.apothem(), 36.0, 5, QgsRegularPolygon::CircumscribedCircle ) ); QVERIFY( rp1 != rp3 ); - QVERIFY( rp1 != QgsRegularPolygon( QgsPointV2( 5, 5 ), rp2.apothem(), 36.0, 5, QgsRegularPolygon::CircumscribedCircle ) ); - QVERIFY( rp1 != QgsRegularPolygon( QgsPointV2( 0, 0 ), 5, 36.0, 5, QgsRegularPolygon::CircumscribedCircle ) ); - QVERIFY( rp1 != QgsRegularPolygon( QgsPointV2( 0, 0 ), 5, 36.0, 5, QgsRegularPolygon::InscribedCircle ) ); + QVERIFY( rp1 != QgsRegularPolygon( QgsPoint( 5, 5 ), rp2.apothem(), 36.0, 5, QgsRegularPolygon::CircumscribedCircle ) ); + QVERIFY( rp1 != QgsRegularPolygon( QgsPoint( 0, 0 ), 5, 36.0, 5, QgsRegularPolygon::CircumscribedCircle ) ); + QVERIFY( rp1 != QgsRegularPolygon( QgsPoint( 0, 0 ), 5, 36.0, 5, QgsRegularPolygon::InscribedCircle ) ); - QgsRegularPolygon rp4 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 5 ), 2, QgsRegularPolygon::InscribedCircle ); + QgsRegularPolygon rp4 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 5 ), 2, QgsRegularPolygon::InscribedCircle ); QVERIFY( rp4.isEmpty() ); - rp4 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 5 ), 5, static_cast< QgsRegularPolygon::ConstructionOption >( 4 ) ); + rp4 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 5 ), 5, static_cast< QgsRegularPolygon::ConstructionOption >( 4 ) ); QVERIFY( rp4.isEmpty() ); - rp4 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 5 ), 5, QgsRegularPolygon::InscribedCircle ); + rp4 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 5 ), 5, QgsRegularPolygon::InscribedCircle ); QVERIFY( rp4 == rp2 ); - QgsRegularPolygon rp5 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 0 ).project( rp2.apothem(), 36.0 ), 2, QgsRegularPolygon::CircumscribedCircle ); + QgsRegularPolygon rp5 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 0 ).project( rp2.apothem(), 36.0 ), 2, QgsRegularPolygon::CircumscribedCircle ); QVERIFY( rp5.isEmpty() ); - rp5 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 0 ).project( rp2.apothem(), 36.0 ), 5, static_cast< QgsRegularPolygon::ConstructionOption >( 4 ) ); + rp5 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 0 ).project( rp2.apothem(), 36.0 ), 5, static_cast< QgsRegularPolygon::ConstructionOption >( 4 ) ); QVERIFY( rp5.isEmpty() ); - rp5 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 0 ).project( rp2.apothem(), 36.0 ), 5, QgsRegularPolygon::CircumscribedCircle ); + rp5 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 0 ).project( rp2.apothem(), 36.0 ), 5, QgsRegularPolygon::CircumscribedCircle ); QVERIFY( rp5 == rp2 ); - QgsRegularPolygon rp6 = QgsRegularPolygon( QgsPointV2( 0, 5 ), QgsPointV2( 0, 0 ).project( 5.0, 72 ), 5 ); + QgsRegularPolygon rp6 = QgsRegularPolygon( QgsPoint( 0, 5 ), QgsPoint( 0, 0 ).project( 5.0, 72 ), 5 ); QVERIFY( rp6 == rp2 ); // setters and getters QgsRegularPolygon rp7 = QgsRegularPolygon(); - rp7.setCenter( QgsPointV2( 5, 5 ) ); + rp7.setCenter( QgsPoint( 5, 5 ) ); QVERIFY( rp7.isEmpty() ); - QCOMPARE( rp7.center(), QgsPointV2( 5, 5 ) ); + QCOMPARE( rp7.center(), QgsPoint( 5, 5 ) ); rp7.setNumberSides( 2 ); QVERIFY( rp7.isEmpty() ); @@ -4304,20 +4304,20 @@ void TestQgsGeometry::regularPolygon() QCOMPARE( rp7.radius(), 6.0 ); QCOMPARE( rp7.firstVertex(), rp7.center().project( 6, 0 ) ); - rp7.setFirstVertex( QgsPointV2( 4, 4 ) ); - QCOMPARE( rp7.firstVertex(), QgsPointV2( 4, 4 ) ); - QCOMPARE( rp7.radius(), rp7.center().distance3D( QgsPointV2( 4, 4 ) ) ); + rp7.setFirstVertex( QgsPoint( 4, 4 ) ); + QCOMPARE( rp7.firstVertex(), QgsPoint( 4, 4 ) ); + QCOMPARE( rp7.radius(), rp7.center().distance3D( QgsPoint( 4, 4 ) ) ); - rp7 = QgsRegularPolygon( QgsPointV2(), QgsPointV2( 0, 5 ), 5, QgsRegularPolygon::InscribedCircle ); - rp7.setCenter( QgsPointV2( 5, 5 ) ); + rp7 = QgsRegularPolygon( QgsPoint(), QgsPoint( 0, 5 ), 5, QgsRegularPolygon::InscribedCircle ); + rp7.setCenter( QgsPoint( 5, 5 ) ); QCOMPARE( rp7.radius(), 5.0 ); - QCOMPARE( rp7.firstVertex(), QgsPointV2( 5, 10 ) ); + QCOMPARE( rp7.firstVertex(), QgsPoint( 5, 10 ) ); rp7.setNumberSides( 3 ); QCOMPARE( rp7.radius(), 5.0 ); - QCOMPARE( rp7.firstVertex(), QgsPointV2( 5, 10 ) ); + QCOMPARE( rp7.firstVertex(), QgsPoint( 5, 10 ) ); rp7.setNumberSides( 2 ); QCOMPARE( rp7.radius(), 5.0 ); - QCOMPARE( rp7.firstVertex(), QgsPointV2( 5, 10 ) ); + QCOMPARE( rp7.firstVertex(), QgsPoint( 5, 10 ) ); // measures QGSCOMPARENEAR( rp1.length(), 0.0, 10e-4 ); @@ -4328,7 +4328,7 @@ void TestQgsGeometry::regularPolygon() QGSCOMPARENEAR( rp2.perimeter(), 29.3893, 10e-4 ); QCOMPARE( rp2.interiorAngle(), 108.0 ); QCOMPARE( rp2.centralAngle(), 72.0 ); - QgsRegularPolygon rp8 = QgsRegularPolygon( QgsPointV2( 0, 0 ), QgsPointV2( 5, 0 ), 5 ); + QgsRegularPolygon rp8 = QgsRegularPolygon( QgsPoint( 0, 0 ), QgsPoint( 5, 0 ), 5 ); QGSCOMPARENEAR( rp8.area(), 43.0119, 10e-4 ); QCOMPARE( rp8.perimeter(), 25.0 ); QCOMPARE( rp8.length(), 5.0 ); @@ -4344,23 +4344,23 @@ void TestQgsGeometry::regularPolygon() //test conversions // circle - QVERIFY( QgsCircle( QgsPointV2( 0, 0 ), 5 ) == rp2.circumscribedCircle() ); - QVERIFY( rp2.inscribedCircle() == QgsRegularPolygon( QgsPointV2( 0, 0 ), rp2.apothem(), 36.0, 5, QgsRegularPolygon::InscribedCircle ).circumscribedCircle() ); + QVERIFY( QgsCircle( QgsPoint( 0, 0 ), 5 ) == rp2.circumscribedCircle() ); + QVERIFY( rp2.inscribedCircle() == QgsRegularPolygon( QgsPoint( 0, 0 ), rp2.apothem(), 36.0, 5, QgsRegularPolygon::InscribedCircle ).circumscribedCircle() ); // triangle QCOMPARE( QgsTriangle(), rp2.toTriangle() ); QCOMPARE( QgsTriangle(), QgsRegularPolygon().toTriangle() ); - QgsRegularPolygon rp9 = QgsRegularPolygon( QgsPointV2( 0, 0 ), 5, 0, 3, QgsRegularPolygon::InscribedCircle ); + QgsRegularPolygon rp9 = QgsRegularPolygon( QgsPoint( 0, 0 ), 5, 0, 3, QgsRegularPolygon::InscribedCircle ); - QVERIFY( QgsCircle( QgsPointV2( 0, 0 ), 5 ) == rp9.toTriangle().circumscribedCircle() ); + QVERIFY( QgsCircle( QgsPoint( 0, 0 ), 5 ) == rp9.toTriangle().circumscribedCircle() ); - QgsRegularPolygon rp10 = QgsRegularPolygon( QgsPointV2( 0, 0 ), QgsPointV2( 0, 4 ), 4 ); + QgsRegularPolygon rp10 = QgsRegularPolygon( QgsPoint( 0, 0 ), QgsPoint( 0, 4 ), 4 ); QList rp10_tri = rp10.triangulate(); QCOMPARE( rp10_tri.length(), ( int )rp10.numberSides() ); - QVERIFY( rp10_tri.at( 0 ) == QgsTriangle( QgsPointV2( 0, 0 ), QgsPointV2( 0, 4 ), rp10.center() ) ); - QVERIFY( rp10_tri.at( 1 ) == QgsTriangle( QgsPointV2( 0, 4 ), QgsPointV2( 4, 4 ), rp10.center() ) ); - QVERIFY( rp10_tri.at( 2 ) == QgsTriangle( QgsPointV2( 4, 4 ), QgsPointV2( 4, 0 ), rp10.center() ) ); - QVERIFY( rp10_tri.at( 3 ) == QgsTriangle( QgsPointV2( 4, 0 ), QgsPointV2( 0, 0 ), rp10.center() ) ); + QVERIFY( rp10_tri.at( 0 ) == QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 4 ), rp10.center() ) ); + QVERIFY( rp10_tri.at( 1 ) == QgsTriangle( QgsPoint( 0, 4 ), QgsPoint( 4, 4 ), rp10.center() ) ); + QVERIFY( rp10_tri.at( 2 ) == QgsTriangle( QgsPoint( 4, 4 ), QgsPoint( 4, 0 ), rp10.center() ) ); + QVERIFY( rp10_tri.at( 3 ) == QgsTriangle( QgsPoint( 4, 0 ), QgsPoint( 0, 0 ), rp10.center() ) ); // polygon QgsPointSequence ptsPol; @@ -4371,11 +4371,11 @@ void TestQgsGeometry::regularPolygon() pol->exteriorRing()->points( ptsPol ); QCOMPARE( ptsPol.length(), 5 ); - QVERIFY( ptsPol.at( 0 ) == QgsPointV2( 0, 0 ) ); - QVERIFY( ptsPol.at( 1 ) == QgsPointV2( 0, 4 ) ); - QVERIFY( ptsPol.at( 2 ) == QgsPointV2( 4, 4 ) ); - QVERIFY( ptsPol.at( 3 ) == QgsPointV2( 4, 0 ) ); - QVERIFY( ptsPol.at( 4 ) == QgsPointV2( 0, 0 ) ); + QVERIFY( ptsPol.at( 0 ) == QgsPoint( 0, 0 ) ); + QVERIFY( ptsPol.at( 1 ) == QgsPoint( 0, 4 ) ); + QVERIFY( ptsPol.at( 2 ) == QgsPoint( 4, 4 ) ); + QVERIFY( ptsPol.at( 3 ) == QgsPoint( 4, 0 ) ); + QVERIFY( ptsPol.at( 4 ) == QgsPoint( 0, 0 ) ); ptsPol.pop_back(); std::unique_ptr< QgsLineString > l( new QgsLineString() ); @@ -4396,21 +4396,21 @@ void TestQgsGeometry::compoundCurve() //test that area of a compound curve ring is equal to a closed linestring with the same vertices QgsCompoundCurve cc; QgsLineString *l1 = new QgsLineString(); - l1->setPoints( QgsPointSequence() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) ); + l1->setPoints( QgsPointSequence() << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) ); cc.addCurve( l1 ); QgsLineString *l2 = new QgsLineString(); - l2->setPoints( QgsPointSequence() << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 ) ); + l2->setPoints( QgsPointSequence() << QgsPoint( 0, 2 ) << QgsPoint( -1, 0 ) << QgsPoint( 0, -1 ) ); cc.addCurve( l2 ); QgsLineString *l3 = new QgsLineString(); - l3->setPoints( QgsPointSequence() << QgsPointV2( 0, -1 ) << QgsPointV2( 1, 1 ) ); + l3->setPoints( QgsPointSequence() << QgsPoint( 0, -1 ) << QgsPoint( 1, 1 ) ); cc.addCurve( l3 ); double ccArea = 0.0; cc.sumUpArea( ccArea ); QgsLineString ls; - ls.setPoints( QgsPointSequence() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 ) - << QgsPointV2( 1, 1 ) ); + ls.setPoints( QgsPointSequence() << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) << QgsPoint( -1, 0 ) << QgsPoint( 0, -1 ) + << QgsPoint( 1, 1 ) ); double lsArea = 0.0; ls.sumUpArea( lsArea ); QVERIFY( qgsDoubleNear( ccArea, lsArea ) ); @@ -4424,15 +4424,15 @@ void TestQgsGeometry::multiPoint() QgsMultiPointV2 boundaryMP; QVERIFY( !boundaryMP.boundary() ); // add some points and retest, should still be undefined - boundaryMP.addGeometry( new QgsPointV2( 0, 0 ) ); - boundaryMP.addGeometry( new QgsPointV2( 1, 1 ) ); + boundaryMP.addGeometry( new QgsPoint( 0, 0 ) ); + boundaryMP.addGeometry( new QgsPoint( 1, 1 ) ); QVERIFY( !boundaryMP.boundary() ); // closestSegment - QgsPointV2 closest; + QgsPoint closest; QgsVertexId after; // return error - points have no segments - QVERIFY( boundaryMP.closestSegment( QgsPointV2( 0.5, 0.5 ), closest, after, 0, 0 ) < 0 ); + QVERIFY( boundaryMP.closestSegment( QgsPoint( 0.5, 0.5 ), closest, after, 0, 0 ) < 0 ); } void TestQgsGeometry::multiLineString() @@ -4441,58 +4441,58 @@ void TestQgsGeometry::multiLineString() QgsMultiLineString multiLine1; QVERIFY( !multiLine1.boundary() ); QgsLineString boundaryLine1; - boundaryLine1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) ); + boundaryLine1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); multiLine1.addGeometry( boundaryLine1.clone() ); QgsAbstractGeometry *boundary = multiLine1.boundary(); QgsMultiPointV2 *mpBoundary = dynamic_cast< QgsMultiPointV2 * >( boundary ); QVERIFY( mpBoundary ); QCOMPARE( mpBoundary->numGeometries(), 2 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); delete boundary; // add another linestring QgsLineString boundaryLine2; - boundaryLine2.setPoints( QList() << QgsPointV2( 10, 10 ) << QgsPointV2( 11, 10 ) << QgsPointV2( 11, 11 ) ); + boundaryLine2.setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) ); multiLine1.addGeometry( boundaryLine2.clone() ); boundary = multiLine1.boundary(); mpBoundary = dynamic_cast< QgsMultiPointV2 * >( boundary ); QVERIFY( mpBoundary ); QCOMPARE( mpBoundary->numGeometries(), 4 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->x(), 10.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->y(), 10.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->x(), 11.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->y(), 11.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->x(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->y(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->x(), 11.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->y(), 11.0 ); delete boundary; // add a closed string = no boundary QgsLineString boundaryLine3; - boundaryLine3.setPoints( QList() << QgsPointV2( 20, 20 ) << QgsPointV2( 21, 20 ) << QgsPointV2( 21, 21 ) << QgsPointV2( 20, 20 ) ); + boundaryLine3.setPoints( QList() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 21, 21 ) << QgsPoint( 20, 20 ) ); multiLine1.addGeometry( boundaryLine3.clone() ); boundary = multiLine1.boundary(); mpBoundary = dynamic_cast< QgsMultiPointV2 * >( boundary ); QVERIFY( mpBoundary ); QCOMPARE( mpBoundary->numGeometries(), 4 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->x(), 10.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->y(), 10.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->x(), 11.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->y(), 11.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->x(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->y(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->x(), 11.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->y(), 11.0 ); delete boundary; //boundary with z QgsLineString boundaryLine4; - boundaryLine4.setPoints( QList() << QgsPointV2( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundaryLine4.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); QgsLineString boundaryLine5; - boundaryLine5.setPoints( QList() << QgsPointV2( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPointV2( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPointV2( QgsWkbTypes::PointZ, 20, 20, 200 ) ); + boundaryLine5.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 20, 20, 200 ) ); QgsMultiLineString multiLine2; multiLine2.addGeometry( boundaryLine4.clone() ); multiLine2.addGeometry( boundaryLine5.clone() ); @@ -4502,21 +4502,21 @@ void TestQgsGeometry::multiLineString() QVERIFY( mpBoundary ); QCOMPARE( mpBoundary->numGeometries(), 4 ); QCOMPARE( mpBoundary->geometryN( 0 )->wkbType(), QgsWkbTypes::PointZ ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 0 ) )->z(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->x(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->y(), 0.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 0 ) )->z(), 10.0 ); QCOMPARE( mpBoundary->geometryN( 1 )->wkbType(), QgsWkbTypes::PointZ ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 1 ) )->z(), 20.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->x(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->y(), 1.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 1 ) )->z(), 20.0 ); QCOMPARE( mpBoundary->geometryN( 2 )->wkbType(), QgsWkbTypes::PointZ ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->x(), 10.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->y(), 10.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 2 ) )->z(), 100.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->x(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->y(), 10.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 2 ) )->z(), 100.0 ); QCOMPARE( mpBoundary->geometryN( 3 )->wkbType(), QgsWkbTypes::PointZ ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->x(), 20.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->y(), 20.0 ); - QCOMPARE( static_cast< QgsPointV2 *>( mpBoundary->geometryN( 3 ) )->z(), 200.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->x(), 20.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->y(), 20.0 ); + QCOMPARE( static_cast< QgsPoint *>( mpBoundary->geometryN( 3 ) )->z(), 200.0 ); delete boundary; } @@ -4527,7 +4527,7 @@ void TestQgsGeometry::multiPolygon() QVERIFY( !multiPolygon1.boundary() ); QgsLineString ring1; - ring1.setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 0 ) ); + ring1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygonV2 polygon1; polygon1.setExteriorRing( ring1.clone() ); multiPolygon1.addGeometry( polygon1.clone() ); @@ -4549,13 +4549,13 @@ void TestQgsGeometry::multiPolygon() // add polygon with interior rings QgsLineString ring2; - ring2.setPoints( QList() << QgsPointV2( 10, 10 ) << QgsPointV2( 11, 10 ) << QgsPointV2( 11, 11 ) << QgsPointV2( 10, 10 ) ); + ring2.setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) << QgsPoint( 10, 10 ) ); QgsPolygonV2 polygon2; polygon2.setExteriorRing( ring2.clone() ); QgsLineString boundaryRing1; - boundaryRing1.setPoints( QList() << QgsPointV2( 10.1, 10.1 ) << QgsPointV2( 10.2, 10.1 ) << QgsPointV2( 10.2, 10.2 ) << QgsPointV2( 10.1, 10.1 ) ); + boundaryRing1.setPoints( QList() << QgsPoint( 10.1, 10.1 ) << QgsPoint( 10.2, 10.1 ) << QgsPoint( 10.2, 10.2 ) << QgsPoint( 10.1, 10.1 ) ); QgsLineString boundaryRing2; - boundaryRing2.setPoints( QList() << QgsPointV2( 10.8, 10.8 ) << QgsPointV2( 10.9, 10.8 ) << QgsPointV2( 10.9, 10.9 ) << QgsPointV2( 10.8, 10.8 ) ); + boundaryRing2.setPoints( QList() << QgsPoint( 10.8, 10.8 ) << QgsPoint( 10.9, 10.8 ) << QgsPoint( 10.9, 10.9 ) << QgsPoint( 10.8, 10.8 ) ); polygon2.setInteriorRings( QList< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() ); multiPolygon1.addGeometry( polygon2.clone() ); @@ -4612,17 +4612,17 @@ void TestQgsGeometry::geometryCollection() QVERIFY( !boundaryCollection.boundary() ); // add a geometry and retest, should still be undefined QgsLineString *lineBoundary = new QgsLineString(); - lineBoundary->setPoints( QList() << QgsPointV2( 0, 0 ) << QgsPointV2( 1, 0 ) ); + lineBoundary->setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) ); boundaryCollection.addGeometry( lineBoundary ); QVERIFY( !boundaryCollection.boundary() ); } -void TestQgsGeometry::fromQgsPoint() +void TestQgsGeometry::fromQgsPointXY() { - QgsPoint point( 1.0, 2.0 ); + QgsPointXY point( 1.0, 2.0 ); QgsGeometry result( QgsGeometry::fromPoint( point ) ); QCOMPARE( result.wkbType(), QgsWkbTypes::Point ); - QgsPoint resultPoint = result.asPoint(); + QgsPointXY resultPoint = result.asPoint(); QCOMPARE( resultPoint, point ); } @@ -4631,7 +4631,7 @@ void TestQgsGeometry::fromQPoint() QPointF point( 1.0, 2.0 ); QgsGeometry result( QgsGeometry::fromQPointF( point ) ); QCOMPARE( result.wkbType(), QgsWkbTypes::Point ); - QgsPoint resultPoint = result.asPoint(); + QgsPointXY resultPoint = result.asPoint(); QCOMPARE( resultPoint.x(), 1.0 ); QCOMPARE( resultPoint.y(), 2.0 ); } @@ -4645,10 +4645,10 @@ void TestQgsGeometry::fromQPolygonF() QCOMPARE( result.wkbType(), QgsWkbTypes::LineString ); QgsPolyline resultLine = result.asPolyline(); QCOMPARE( resultLine.size(), 4 ); - QCOMPARE( resultLine.at( 0 ), QgsPoint( 1.0, 2.0 ) ); - QCOMPARE( resultLine.at( 1 ), QgsPoint( 4.0, 6.0 ) ); - QCOMPARE( resultLine.at( 2 ), QgsPoint( 4.0, 3.0 ) ); - QCOMPARE( resultLine.at( 3 ), QgsPoint( 2.0, 2.0 ) ); + QCOMPARE( resultLine.at( 0 ), QgsPointXY( 1.0, 2.0 ) ); + QCOMPARE( resultLine.at( 1 ), QgsPointXY( 4.0, 6.0 ) ); + QCOMPARE( resultLine.at( 2 ), QgsPointXY( 4.0, 3.0 ) ); + QCOMPARE( resultLine.at( 3 ), QgsPointXY( 2.0, 2.0 ) ); //test with a closed polygon QPolygonF polygon; @@ -4657,11 +4657,11 @@ void TestQgsGeometry::fromQPolygonF() QCOMPARE( result2.wkbType(), QgsWkbTypes::Polygon ); QgsPolygon resultPolygon = result2.asPolygon(); QCOMPARE( resultPolygon.size(), 1 ); - QCOMPARE( resultPolygon.at( 0 ).at( 0 ), QgsPoint( 1.0, 2.0 ) ); - QCOMPARE( resultPolygon.at( 0 ).at( 1 ), QgsPoint( 4.0, 6.0 ) ); - QCOMPARE( resultPolygon.at( 0 ).at( 2 ), QgsPoint( 4.0, 3.0 ) ); - QCOMPARE( resultPolygon.at( 0 ).at( 3 ), QgsPoint( 2.0, 2.0 ) ); - QCOMPARE( resultPolygon.at( 0 ).at( 4 ), QgsPoint( 1.0, 2.0 ) ); + QCOMPARE( resultPolygon.at( 0 ).at( 0 ), QgsPointXY( 1.0, 2.0 ) ); + QCOMPARE( resultPolygon.at( 0 ).at( 1 ), QgsPointXY( 4.0, 6.0 ) ); + QCOMPARE( resultPolygon.at( 0 ).at( 2 ), QgsPointXY( 4.0, 3.0 ) ); + QCOMPARE( resultPolygon.at( 0 ).at( 3 ), QgsPointXY( 2.0, 2.0 ) ); + QCOMPARE( resultPolygon.at( 0 ).at( 4 ), QgsPointXY( 1.0, 2.0 ) ); } void TestQgsGeometry::asQPointF() @@ -4830,38 +4830,38 @@ void TestQgsGeometry::rotateCheck1() { QString wkt = QStringLiteral( "LineString (0 0, 10 0, 10 10)" ); QgsGeometry geom( QgsGeometry::fromWkt( wkt ) ); - geom.rotate( 90, QgsPoint( 0, 0 ) ); + geom.rotate( 90, QgsPointXY( 0, 0 ) ); QString obtained = geom.exportToWkt(); QString expected = QStringLiteral( "LineString (0 0, 0 -10, 10 -10)" ); QCOMPARE( obtained, expected ); - geom.rotate( -90, QgsPoint( 0, 0 ) ); + geom.rotate( -90, QgsPointXY( 0, 0 ) ); obtained = geom.exportToWkt(); QCOMPARE( obtained, wkt ); wkt = QStringLiteral( "Polygon ((-2 4, -2 -10, 2 3, -2 4),(1 1, -1 1, -1 -1, 1 1))" ); geom = QgsGeometry::fromWkt( wkt ); - geom.rotate( 90, QgsPoint( 0, 0 ) ); + geom.rotate( 90, QgsPointXY( 0, 0 ) ); obtained = geom.exportToWkt(); expected = QStringLiteral( "Polygon ((4 2, -10 2, 3 -2, 4 2),(1 -1, 1 1, -1 1, 1 -1))" ); QCOMPARE( obtained, expected ); - geom.rotate( -90, QgsPoint( 0, 0 ) ); + geom.rotate( -90, QgsPointXY( 0, 0 ) ); obtained = geom.exportToWkt(); QCOMPARE( obtained, wkt ); wkt = QStringLiteral( "Point (40 50)" ); geom = QgsGeometry::fromWkt( wkt ); - geom.rotate( 90, QgsPoint( 0, 0 ) ); + geom.rotate( 90, QgsPointXY( 0, 0 ) ); obtained = geom.exportToWkt(); expected = QStringLiteral( "Point (50 -40)" ); QCOMPARE( obtained, expected ); - geom.rotate( -90, QgsPoint( 0, 0 ) ); + geom.rotate( -90, QgsPointXY( 0, 0 ) ); obtained = geom.exportToWkt(); QCOMPARE( obtained, wkt ); - geom.rotate( 180, QgsPoint( 40, 0 ) ); + geom.rotate( 180, QgsPointXY( 40, 0 ) ); expected = QStringLiteral( "Point (40 -50)" ); obtained = geom.exportToWkt(); QCOMPARE( obtained, expected ); - geom.rotate( 180, QgsPoint( 40, 0 ) ); // round-trip + geom.rotate( 180, QgsPointXY( 40, 0 ) ); // round-trip obtained = geom.exportToWkt(); QCOMPARE( obtained, wkt ); @@ -4941,8 +4941,8 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25 ); QgsPolyline line = result.asPolyline(); QgsPolyline expectedLine; - expectedLine << QgsPoint( 0, 0 ) << QgsPoint( 7.5, 0 ) << QgsPoint( 10.0, 2.5 ) - << QgsPoint( 10.0, 7.5 ) << QgsPoint( 12.5, 10.0 ) << QgsPoint( 20.0, 10.0 ); + expectedLine << QgsPointXY( 0, 0 ) << QgsPointXY( 7.5, 0 ) << QgsPointXY( 10.0, 2.5 ) + << QgsPointXY( 10.0, 7.5 ) << QgsPointXY( 12.5, 10.0 ) << QgsPointXY( 20.0, 10.0 ); QVERIFY( QgsGeometry::compare( line, expectedLine ) ); //linestring, with min distance @@ -4951,8 +4951,8 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25, 6 ); line = result.asPolyline(); expectedLine.clear(); - expectedLine << QgsPoint( 0, 0 ) << QgsPoint( 7.5, 0 ) << QgsPoint( 10.0, 2.5 ) - << QgsPoint( 10.0, 7.5 ) << QgsPoint( 15, 12.5 ) << QgsPoint( 15.0, 20.0 ); + expectedLine << QgsPointXY( 0, 0 ) << QgsPointXY( 7.5, 0 ) << QgsPointXY( 10.0, 2.5 ) + << QgsPointXY( 10.0, 7.5 ) << QgsPointXY( 15, 12.5 ) << QgsPointXY( 15.0, 20.0 ); QVERIFY( QgsGeometry::compare( line, expectedLine ) ); //linestring, with max angle @@ -4961,8 +4961,8 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25, 0, 50 ); line = result.asPolyline(); expectedLine.clear(); - expectedLine << QgsPoint( 0, 0 ) << QgsPoint( 7.5, 0 ) << QgsPoint( 11.25, 1.25 ) - << QgsPoint( 15.0, 5.0 ) << QgsPoint( 22.5, -2.5 ) << QgsPoint( 26.25, -5 ) << QgsPoint( 30, -5 ); + expectedLine << QgsPointXY( 0, 0 ) << QgsPointXY( 7.5, 0 ) << QgsPointXY( 11.25, 1.25 ) + << QgsPointXY( 15.0, 5.0 ) << QgsPointXY( 22.5, -2.5 ) << QgsPointXY( 26.25, -5 ) << QgsPointXY( 30, -5 ); QVERIFY( QgsGeometry::compare( line, expectedLine ) ); //linestring, with max angle, other direction @@ -4971,8 +4971,8 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25, 0, 50 ); line = result.asPolyline(); expectedLine.clear(); - expectedLine << QgsPoint( 30, -5 ) << QgsPoint( 26.25, -5 ) << QgsPoint( 22.5, -2.5 ) - << QgsPoint( 15.0, 5.0 ) << QgsPoint( 11.25, 1.25 ) << QgsPoint( 7.5, 0 ) << QgsPoint( 0, 0 ); + expectedLine << QgsPointXY( 30, -5 ) << QgsPointXY( 26.25, -5 ) << QgsPointXY( 22.5, -2.5 ) + << QgsPointXY( 15.0, 5.0 ) << QgsPointXY( 11.25, 1.25 ) << QgsPointXY( 7.5, 0 ) << QgsPointXY( 0, 0 ); QVERIFY( QgsGeometry::compare( line, expectedLine ) ); //linestring, max angle, first corner sharp @@ -4981,7 +4981,7 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25, 0, 50 ); line = result.asPolyline(); expectedLine.clear(); - expectedLine << QgsPoint( 0, 0 ) << QgsPoint( 10, 0 ) << QgsPoint( 10, 10 ); + expectedLine << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 0 ) << QgsPointXY( 10, 10 ); QVERIFY( QgsGeometry::compare( line, expectedLine ) ); wkt = QStringLiteral( "MultiLineString ((0 0, 10 0, 10 10, 20 10),(30 30, 40 30, 40 40, 50 40))" ); @@ -4989,10 +4989,10 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25 ); QgsMultiPolyline multiLine = result.asMultiPolyline(); QgsMultiPolyline expectedMultiline; - expectedMultiline << ( QgsPolyline() << QgsPoint( 0, 0 ) << QgsPoint( 7.5, 0 ) << QgsPoint( 10.0, 2.5 ) - << QgsPoint( 10.0, 7.5 ) << QgsPoint( 12.5, 10.0 ) << QgsPoint( 20.0, 10.0 ) ) - << ( QgsPolyline() << QgsPoint( 30.0, 30.0 ) << QgsPoint( 37.5, 30.0 ) << QgsPoint( 40.0, 32.5 ) - << QgsPoint( 40.0, 37.5 ) << QgsPoint( 42.5, 40.0 ) << QgsPoint( 50.0, 40.0 ) ); + expectedMultiline << ( QgsPolyline() << QgsPointXY( 0, 0 ) << QgsPointXY( 7.5, 0 ) << QgsPointXY( 10.0, 2.5 ) + << QgsPointXY( 10.0, 7.5 ) << QgsPointXY( 12.5, 10.0 ) << QgsPointXY( 20.0, 10.0 ) ) + << ( QgsPolyline() << QgsPointXY( 30.0, 30.0 ) << QgsPointXY( 37.5, 30.0 ) << QgsPointXY( 40.0, 32.5 ) + << QgsPointXY( 40.0, 37.5 ) << QgsPointXY( 42.5, 40.0 ) << QgsPointXY( 50.0, 40.0 ) ); QVERIFY( QgsGeometry::compare( multiLine, expectedMultiline ) ); //polygon @@ -5001,12 +5001,12 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25 ); QgsPolygon poly = result.asPolygon(); QgsPolygon expectedPolygon; - expectedPolygon << ( QgsPolyline() << QgsPoint( 2.5, 0 ) << QgsPoint( 7.5, 0 ) << QgsPoint( 10.0, 2.5 ) - << QgsPoint( 10.0, 7.5 ) << QgsPoint( 7.5, 10.0 ) << QgsPoint( 2.5, 10.0 ) << QgsPoint( 0, 7.5 ) - << QgsPoint( 0, 2.5 ) << QgsPoint( 2.5, 0 ) ) - << ( QgsPolyline() << QgsPoint( 2.5, 2.0 ) << QgsPoint( 3.5, 2.0 ) << QgsPoint( 4.0, 2.5 ) - << QgsPoint( 4.0, 3.5 ) << QgsPoint( 3.5, 4.0 ) << QgsPoint( 2.5, 4.0 ) - << QgsPoint( 2.0, 3.5 ) << QgsPoint( 2.0, 2.5 ) << QgsPoint( 2.5, 2.0 ) ); + expectedPolygon << ( QgsPolyline() << QgsPointXY( 2.5, 0 ) << QgsPointXY( 7.5, 0 ) << QgsPointXY( 10.0, 2.5 ) + << QgsPointXY( 10.0, 7.5 ) << QgsPointXY( 7.5, 10.0 ) << QgsPointXY( 2.5, 10.0 ) << QgsPointXY( 0, 7.5 ) + << QgsPointXY( 0, 2.5 ) << QgsPointXY( 2.5, 0 ) ) + << ( QgsPolyline() << QgsPointXY( 2.5, 2.0 ) << QgsPointXY( 3.5, 2.0 ) << QgsPointXY( 4.0, 2.5 ) + << QgsPointXY( 4.0, 3.5 ) << QgsPointXY( 3.5, 4.0 ) << QgsPointXY( 2.5, 4.0 ) + << QgsPointXY( 2.0, 3.5 ) << QgsPointXY( 2.0, 2.5 ) << QgsPointXY( 2.5, 2.0 ) ); QVERIFY( QgsGeometry::compare( poly, expectedPolygon ) ); //polygon with max angle - should be unchanged @@ -5015,8 +5015,8 @@ void TestQgsGeometry::smoothCheck() result = geom.smooth( 1, 0.25, -1, 50 ); poly = result.asPolygon(); expectedPolygon.clear(); - expectedPolygon << ( QgsPolyline() << QgsPoint( 0, 0 ) << QgsPoint( 10, 0 ) << QgsPoint( 10.0, 10 ) - << QgsPoint( 0, 10 ) << QgsPoint( 0, 0 ) ); + expectedPolygon << ( QgsPolyline() << QgsPointXY( 0, 0 ) << QgsPointXY( 10, 0 ) << QgsPointXY( 10.0, 10 ) + << QgsPointXY( 0, 10 ) << QgsPointXY( 0, 0 ) ); QVERIFY( QgsGeometry::compare( poly, expectedPolygon ) ); //multipolygon) @@ -5026,12 +5026,12 @@ void TestQgsGeometry::smoothCheck() QgsMultiPolygon multipoly = result.asMultiPolygon(); QgsMultiPolygon expectedMultiPoly; expectedMultiPoly - << ( QgsPolygon() << ( QgsPolyline() << QgsPoint( 1.0, 0 ) << QgsPoint( 9, 0 ) << QgsPoint( 10.0, 1 ) - << QgsPoint( 10.0, 9 ) << QgsPoint( 9, 10.0 ) << QgsPoint( 1, 10.0 ) << QgsPoint( 0, 9 ) - << QgsPoint( 0, 1 ) << QgsPoint( 1, 0 ) ) ) - << ( QgsPolygon() << ( QgsPolyline() << QgsPoint( 2.2, 2.0 ) << QgsPoint( 3.8, 2.0 ) << QgsPoint( 4.0, 2.2 ) - << QgsPoint( 4.0, 3.8 ) << QgsPoint( 3.8, 4.0 ) << QgsPoint( 2.2, 4.0 ) << QgsPoint( 2.0, 3.8 ) - << QgsPoint( 2, 2.2 ) << QgsPoint( 2.2, 2 ) ) ); + << ( QgsPolygon() << ( QgsPolyline() << QgsPointXY( 1.0, 0 ) << QgsPointXY( 9, 0 ) << QgsPointXY( 10.0, 1 ) + << QgsPointXY( 10.0, 9 ) << QgsPointXY( 9, 10.0 ) << QgsPointXY( 1, 10.0 ) << QgsPointXY( 0, 9 ) + << QgsPointXY( 0, 1 ) << QgsPointXY( 1, 0 ) ) ) + << ( QgsPolygon() << ( QgsPolyline() << QgsPointXY( 2.2, 2.0 ) << QgsPointXY( 3.8, 2.0 ) << QgsPointXY( 4.0, 2.2 ) + << QgsPointXY( 4.0, 3.8 ) << QgsPointXY( 3.8, 4.0 ) << QgsPointXY( 2.2, 4.0 ) << QgsPointXY( 2.0, 3.8 ) + << QgsPointXY( 2, 2.2 ) << QgsPointXY( 2.2, 2 ) ) ); QVERIFY( QgsGeometry::compare( multipoly, expectedMultiPoly ) ); } @@ -5165,7 +5165,7 @@ void TestQgsGeometry::dumpPolygon( QgsPolygon &polygon ) for ( int k = 0; k < myPolyline.size(); k++ ) { - QgsPoint myPoint = myPolyline.at( k ); + QgsPointXY myPoint = myPolyline.at( k ); qDebug( "\t\t\tPoint in ring %d : %s", k, myPoint.toString().toLocal8Bit().constData() ); myPoints << QPointF( myPoint.x(), myPoint.y() ); } @@ -5179,14 +5179,14 @@ void TestQgsGeometry::dumpPolyline( QgsPolyline &polyline ) // QgsPolyline myPolyline = polyline.at( j ); //rings of polygon for ( int j = 0; j < polyline.size(); j++ ) { - QgsPoint myPoint = polyline.at( j ); + QgsPointXY myPoint = polyline.at( j ); // QgsPolyline myPolyline = polygon.at( j ); //rings of polygon myPoints << QPointF( myPoint.x(), myPoint.y() ); qDebug( "\t\tPoint in line: %d", j ); // for ( int k = 0; k < myPolyline.size(); k++ ) // { -// QgsPoint myPoint = myPolyline.at( k ); +// QgsPointXY myPoint = myPolyline.at( k ); // qDebug( "\t\t\tPoint in ring %d : %s", k, myPoint.toString().toLocal8Bit().constData() ); // myPoints << QPointF( myPoint.x(), myPoint.y() ); // } @@ -5243,7 +5243,7 @@ void TestQgsGeometry::segmentizeCircularString() delete lineString; //make sure the curve point is part of the segmentized result - QVERIFY( points.contains( QgsPointV2( 0.5, 0.5 ) ) ); + QVERIFY( points.contains( QgsPoint( 0.5, 0.5 ) ) ); } void TestQgsGeometry::directionNeutralSegmentation() @@ -5349,7 +5349,7 @@ void TestQgsGeometry::poleOfInaccessibility() QgsGeometry poly2 = QgsGeometry::fromWkt( poly2Wkt ); double distance; - QgsPoint point = poly1.poleOfInaccessibility( 1, &distance ).asPoint(); + QgsPointXY point = poly1.poleOfInaccessibility( 1, &distance ).asPoint(); QGSCOMPARENEAR( point.x(), 3867.37, 0.01 ); QGSCOMPARENEAR( point.y(), 2126.45, 0.01 ); QGSCOMPARENEAR( distance, 289.51, 0.01 ); diff --git a/tests/src/core/testqgsgeometryimport.cpp b/tests/src/core/testqgsgeometryimport.cpp index ea2c3848f67..7e1157b311b 100644 --- a/tests/src/core/testqgsgeometryimport.cpp +++ b/tests/src/core/testqgsgeometryimport.cpp @@ -79,7 +79,7 @@ void TestQgsGeometryImport::pointWkt() QgsGeometry geom = QgsGeometry::fromWkt( wktString ); QCOMPARE( geom.wkbType(), QgsWkbTypes::Point ); - QgsPoint point = geom.asPoint(); + QgsPointXY point = geom.asPoint(); QVERIFY( qgsDoubleNear( point.x(), x ) ); QVERIFY( qgsDoubleNear( point.y(), y ) ); @@ -106,7 +106,7 @@ void TestQgsGeometryImport::pointWkb() QgsGeometry geom; geom.fromWkb( geomPtr, 21 ); - QgsPoint point = geom.asPoint(); + QgsPointXY point = geom.asPoint(); QCOMPARE( geom.wkbType(), QgsWkbTypes::Point ); QVERIFY( qgsDoubleNear( point.x(), x ) ); @@ -135,7 +135,7 @@ void TestQgsGeometryImport::pointGeos() geom.fromGeos( geosPt ); QVERIFY( geom.wkbType() == QgsWkbTypes::Point ); - QgsPoint geomPt = geom.asPoint(); + QgsPointXY geomPt = geom.asPoint(); QVERIFY( qgsDoubleNear( x, geomPt.x() ) ); QVERIFY( qgsDoubleNear( y, geomPt.y() ) ); @@ -236,7 +236,7 @@ bool TestQgsGeometryImport::compareLineStrings( const QgsPolyline &polyline, QVa for ( int i = 0; i < polyline.size(); ++i ) { - const QgsPoint &polylinePt = polyline.at( i ); + const QgsPointXY &polylinePt = polyline.at( i ); QPointF linePt = line.at( i ).toPointF(); if ( !qgsDoubleNear( polylinePt.x(), linePt.x() ) || !qgsDoubleNear( polylinePt.y(), linePt.y() ) ) { diff --git a/tests/src/core/testqgsgeometryutils.cpp b/tests/src/core/testqgsgeometryutils.cpp index cdb99a75b4a..72f105dc680 100644 --- a/tests/src/core/testqgsgeometryutils.cpp +++ b/tests/src/core/testqgsgeometryutils.cpp @@ -61,17 +61,17 @@ class TestQgsGeometryUtils: public QObject void TestQgsGeometryUtils::testExtractLinestrings() { QgsLineString *outerRing1 = new QgsLineString(); - outerRing1->setPoints( QList() << QgsPointV2( 1, 1 ) << QgsPointV2( 1, 2 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 2, 1 ) << QgsPointV2( 1, 1 ) ); + outerRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QgsPolygonV2 *polygon1 = new QgsPolygonV2(); polygon1->setExteriorRing( outerRing1 ); QgsLineString *outerRing2 = new QgsLineString(); - outerRing2->setPoints( QList() << QgsPointV2( 10, 10 ) << QgsPointV2( 10, 20 ) << QgsPointV2( 20, 20 ) << QgsPointV2( 20, 10 ) << QgsPointV2( 10, 10 ) ); + outerRing2->setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 10, 20 ) << QgsPoint( 20, 20 ) << QgsPoint( 20, 10 ) << QgsPoint( 10, 10 ) ); QgsPolygonV2 *polygon2 = new QgsPolygonV2(); polygon2->setExteriorRing( outerRing2 ); QgsLineString *innerRing2 = new QgsLineString(); - innerRing2->setPoints( QList() << QgsPointV2( 14, 14 ) << QgsPointV2( 14, 16 ) << QgsPointV2( 16, 16 ) << QgsPointV2( 16, 14 ) << QgsPointV2( 14, 14 ) ); + innerRing2->setPoints( QList() << QgsPoint( 14, 14 ) << QgsPoint( 14, 16 ) << QgsPoint( 16, 16 ) << QgsPoint( 16, 14 ) << QgsPoint( 14, 14 ) ); polygon2->setInteriorRings( QList() << innerRing2 ); QgsMultiPolygonV2 mpg; @@ -184,8 +184,8 @@ void TestQgsGeometryUtils::testSegmentMidPoint() QFETCH( double, expectedX ); QFETCH( double, expectedY ); - QgsPointV2 midPoint; - bool ok = QgsGeometryUtils::segmentMidPoint( QgsPointV2( pt1x, pt1y ), QgsPointV2( pt2x, pt2y ), + QgsPoint midPoint; + bool ok = QgsGeometryUtils::segmentMidPoint( QgsPoint( pt1x, pt1y ), QgsPoint( pt2x, pt2y ), midPoint, radius, left ); QVERIFY( ok ); @@ -346,7 +346,7 @@ void TestQgsGeometryUtils::testAdjacentVertices() { // test polygon - should wrap around! QgsLineString *closedRing1 = new QgsLineString(); - closedRing1->setPoints( QList() << QgsPointV2( 1, 1 ) << QgsPointV2( 1, 2 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 2, 1 ) << QgsPointV2( 1, 1 ) ); + closedRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QgsPolygonV2 polygon1; polygon1.setExteriorRing( closedRing1 ); QgsVertexId previous; @@ -357,7 +357,7 @@ void TestQgsGeometryUtils::testAdjacentVertices() QCOMPARE( next, QgsVertexId( 0, 0, 1 ) ); // test point - both vertices should be invalid - QgsPointV2 point( 1, 2 ); + QgsPoint point( 1, 2 ); QgsGeometryUtils::adjacentVertices( point, QgsVertexId( 0, 0, 0 ), previous, next ); QVERIFY( !previous.isValid() ); QVERIFY( !next.isValid() ); @@ -367,7 +367,7 @@ void TestQgsGeometryUtils::testDistanceToVertex() { //test with linestring QgsLineString *outerRing1 = new QgsLineString(); - outerRing1->setPoints( QList() << QgsPointV2( 1, 1 ) << QgsPointV2( 1, 2 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 2, 1 ) << QgsPointV2( 1, 1 ) ); + outerRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QCOMPARE( QgsGeometryUtils::distanceToVertex( *outerRing1, QgsVertexId( 0, 0, 0 ) ), 0.0 ); QCOMPARE( QgsGeometryUtils::distanceToVertex( *outerRing1, QgsVertexId( 0, 0, 1 ) ), 1.0 ); QCOMPARE( QgsGeometryUtils::distanceToVertex( *outerRing1, QgsVertexId( 0, 0, 2 ) ), 2.0 ); @@ -388,7 +388,7 @@ void TestQgsGeometryUtils::testDistanceToVertex() QCOMPARE( QgsGeometryUtils::distanceToVertex( polygon1, QgsVertexId( 0, 1, 1 ) ), -1.0 ); //test with point - QgsPointV2 point( 1, 2 ); + QgsPoint point( 1, 2 ); QCOMPARE( QgsGeometryUtils::distanceToVertex( point, QgsVertexId( 0, 0, 0 ) ), 0.0 ); QCOMPARE( QgsGeometryUtils::distanceToVertex( point, QgsVertexId( 0, 0, 1 ) ), -1.0 ); } @@ -401,7 +401,7 @@ void TestQgsGeometryUtils::testVerticesAtDistance() QgsVertexId next; QVERIFY( !QgsGeometryUtils::verticesAtDistance( *outerRing1, .5, previous, next ) ); - outerRing1->setPoints( QList() << QgsPointV2( 1, 1 ) << QgsPointV2( 1, 2 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 2, 1 ) << QgsPointV2( 3, 1 ) ); + outerRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 3, 1 ) ); QVERIFY( QgsGeometryUtils::verticesAtDistance( *outerRing1, .5, previous, next ) ); QCOMPARE( previous, QgsVertexId( 0, 0, 0 ) ); QCOMPARE( next, QgsVertexId( 0, 0, 1 ) ); @@ -436,7 +436,7 @@ void TestQgsGeometryUtils::testVerticesAtDistance() // test closed line QgsLineString *closedRing1 = new QgsLineString(); - closedRing1->setPoints( QList() << QgsPointV2( 1, 1 ) << QgsPointV2( 1, 2 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 2, 1 ) << QgsPointV2( 1, 1 ) ); + closedRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QVERIFY( QgsGeometryUtils::verticesAtDistance( *closedRing1, 0, previous, next ) ); QCOMPARE( previous, QgsVertexId( 0, 0, 0 ) ); QCOMPARE( next, QgsVertexId( 0, 0, 0 ) ); @@ -468,7 +468,7 @@ void TestQgsGeometryUtils::testVerticesAtDistance() QCOMPARE( next, QgsVertexId( 0, 0, 4 ) ); //test with point - QgsPointV2 point( 1, 2 ); + QgsPoint point( 1, 2 ); QVERIFY( !QgsGeometryUtils::verticesAtDistance( point, .5, previous, next ) ); } @@ -501,7 +501,7 @@ void TestQgsGeometryUtils::testCircleCenterRadius() QFETCH( double, expectedCenterY ); double radius, centerX, centerY; - QgsGeometryUtils::circleCenterRadius( QgsPointV2( x1, y1 ), QgsPointV2( x2, y2 ), QgsPointV2( x3, y3 ), radius, centerX, centerY ); + QgsGeometryUtils::circleCenterRadius( QgsPoint( x1, y1 ), QgsPoint( x2, y2 ), QgsPoint( x3, y3 ), radius, centerX, centerY ); QVERIFY( qgsDoubleNear( expectedRadius, radius ) ); QVERIFY( qgsDoubleNear( expectedCenterX, centerX ) ); QVERIFY( qgsDoubleNear( expectedCenterY, centerY ) ); @@ -512,9 +512,9 @@ void TestQgsGeometryUtils::testSqrDistToLine() { // See https://issues.qgis.org/issues/13952#note-26 - QgsPoint qp( 771938, 6.95593e+06 ); - QgsPoint p1( 771946, 6.95593e+06 ); - QgsPoint p2( 771904, 6.95595e+06 ); + QgsPointXY qp( 771938, 6.95593e+06 ); + QgsPointXY p1( 771946, 6.95593e+06 ); + QgsPointXY p2( 771904, 6.95595e+06 ); double rx = 0, ry = 0; double epsilon = 1e-18; double sqrDist = QgsGeometryUtils::sqrDistToLine( qp.x(), qp.y(), @@ -526,38 +526,38 @@ void TestQgsGeometryUtils::testSqrDistToLine() void TestQgsGeometryUtils::testAngleThreePoints() { - QgsPoint p1( 0, 0 ); - QgsPoint p2( 1, 0 ); - QgsPoint p3( 1, 1 ); + QgsPointXY p1( 0, 0 ); + QgsPointXY p2( 1, 0 ); + QgsPointXY p3( 1, 1 ); QGSCOMPARENEAR( QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ), M_PI / 2.0, 0.00000001 ); - p3 = QgsPoint( 1, -1 ); + p3 = QgsPointXY( 1, -1 ); QGSCOMPARENEAR( QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ), 3 * M_PI / 2.0, 0.00000001 ); - p3 = QgsPoint( 2, 0 ); + p3 = QgsPointXY( 2, 0 ); QGSCOMPARENEAR( QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ), M_PI, 0.00000001 ); - p3 = QgsPoint( 0, 0 ); + p3 = QgsPointXY( 0, 0 ); QGSCOMPARENEAR( QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ), 0.0, 0.00000001 ); - p3 = QgsPoint( 1, 0 ); + p3 = QgsPointXY( 1, 0 ); //undefined, but want no crash ( void )QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ); - p2 = QgsPoint( 0, 0 ); + p2 = QgsPointXY( 0, 0 ); ( void )QgsGeometryUtils::angleBetweenThreePoints( p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() ); } void TestQgsGeometryUtils::testMidPoint() { - QgsPointV2 p1( 4, 6 ); - QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPointV2( 2, 2 ) ), QgsPointV2( 3, 4 ) ); - QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPointV2( QgsWkbTypes::PointZ, 2, 2, 2 ) ), QgsPointV2( QgsWkbTypes::PointZ, 3, 4, 1 ) ); - QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPointV2( QgsWkbTypes::PointM, 2, 2, 0, 2 ) ), QgsPointV2( QgsWkbTypes::PointM, 3, 4, 0, 1 ) ); - QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPointV2( QgsWkbTypes::PointZM, 2, 2, 2, 2 ) ), QgsPointV2( QgsWkbTypes::PointZM, 3, 4, 1, 1 ) ); + QgsPoint p1( 4, 6 ); + QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPoint( 2, 2 ) ), QgsPoint( 3, 4 ) ); + QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPoint( QgsWkbTypes::PointZ, 2, 2, 2 ) ), QgsPoint( QgsWkbTypes::PointZ, 3, 4, 1 ) ); + QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPoint( QgsWkbTypes::PointM, 2, 2, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointM, 3, 4, 0, 1 ) ); + QCOMPARE( QgsGeometryUtils::midpoint( p1, QgsPoint( QgsWkbTypes::PointZM, 2, 2, 2, 2 ) ), QgsPoint( QgsWkbTypes::PointZM, 3, 4, 1, 1 ) ); } void TestQgsGeometryUtils::testGradient() { - QVERIFY( QgsGeometryUtils::gradient( QgsPointV2( 4, 6 ), QgsPointV2( 4, 8 ) ) == INFINITY ); - QGSCOMPARENEAR( QgsGeometryUtils::gradient( QgsPointV2( 2, 8 ), QgsPointV2( 3, 20 ) ), 12, 0.00000001 ); - QGSCOMPARENEAR( QgsGeometryUtils::gradient( QgsPointV2( 2, -88 ), QgsPointV2( 4, -4 ) ), 42, 0.00000001 ); - QGSCOMPARENEAR( QgsGeometryUtils::gradient( QgsPointV2( 4, 6 ), QgsPointV2( 8, 6 ) ), 0, 0.00000001 ); + QVERIFY( QgsGeometryUtils::gradient( QgsPoint( 4, 6 ), QgsPoint( 4, 8 ) ) == INFINITY ); + QGSCOMPARENEAR( QgsGeometryUtils::gradient( QgsPoint( 2, 8 ), QgsPoint( 3, 20 ) ), 12, 0.00000001 ); + QGSCOMPARENEAR( QgsGeometryUtils::gradient( QgsPoint( 2, -88 ), QgsPoint( 4, -4 ) ), 42, 0.00000001 ); + QGSCOMPARENEAR( QgsGeometryUtils::gradient( QgsPoint( 4, 6 ), QgsPoint( 8, 6 ) ), 0, 0.00000001 ); } void TestQgsGeometryUtils::testCoefficients() @@ -565,70 +565,70 @@ void TestQgsGeometryUtils::testCoefficients() double a, b, c; // pt1.x == pt2.x - QgsGeometryUtils::coefficients( QgsPointV2( 4, 6 ), QgsPointV2( 4, 8 ), a, b, c ); + QgsGeometryUtils::coefficients( QgsPoint( 4, 6 ), QgsPoint( 4, 8 ), a, b, c ); QGSCOMPARENEAR( a, 1, 0.00000001 ); QGSCOMPARENEAR( b, 0, 0.00000001 ); QGSCOMPARENEAR( c, -4, 0.00000001 ); // pt1.y == pt2.y - QgsGeometryUtils::coefficients( QgsPointV2( 6, 4 ), QgsPointV2( 8, 4 ), a, b, c ); + QgsGeometryUtils::coefficients( QgsPoint( 6, 4 ), QgsPoint( 8, 4 ), a, b, c ); QGSCOMPARENEAR( a, 0, 0.00000001 ); QGSCOMPARENEAR( b, 1, 0.00000001 ); QGSCOMPARENEAR( c, -4, 0.00000001 ); // else - QgsGeometryUtils::coefficients( QgsPointV2( 6, 4 ), QgsPointV2( 4, 8 ), a, b, c ); + QgsGeometryUtils::coefficients( QgsPoint( 6, 4 ), QgsPoint( 4, 8 ), a, b, c ); QGSCOMPARENEAR( a, -4, 0.00000001 ); QGSCOMPARENEAR( b, -2, 0.00000001 ); QGSCOMPARENEAR( c, 32, 0.00000001 ); - QgsGeometryUtils::coefficients( QgsPointV2( -4, -2 ), QgsPointV2( 4, 2 ), a, b, c ); + QgsGeometryUtils::coefficients( QgsPoint( -4, -2 ), QgsPoint( 4, 2 ), a, b, c ); QGSCOMPARENEAR( a, -4, 0.00000001 ); QGSCOMPARENEAR( b, 8, 0.00000001 ); QGSCOMPARENEAR( c, 0, 0.00000001 ); } void TestQgsGeometryUtils::testPerpendicularSegment() { - QgsPointV2 p1( 3, 13 ); - QgsPointV2 s1( 2, 3 ); - QgsPointV2 s2( 7, 11 ); + QgsPoint p1( 3, 13 ); + QgsPoint s1( 2, 3 ); + QgsPoint s2( 7, 11 ); QgsLineString line_r = QgsGeometryUtils::perpendicularSegment( p1, s1, s2 ); // default case QgsLineString line; line.addVertex( p1 ); - line.addVertex( QgsPointV2( 6.7753, 10.6404 ) ); + line.addVertex( QgsPoint( 6.7753, 10.6404 ) ); QGSCOMPARENEARPOINT( line.pointN( 0 ), line_r.pointN( 0 ), 0.0001 ); QGSCOMPARENEARPOINT( line.pointN( 1 ), line_r.pointN( 1 ), 0.0001 ); // perpendicular line don't intersect segment line.clear(); - p1 = QgsPointV2( 11, 11 ); + p1 = QgsPoint( 11, 11 ); line_r = QgsGeometryUtils::perpendicularSegment( p1, s1, s2 ); line.addVertex( p1 ); - line.addVertex( QgsPointV2( 8.1236, 12.7978 ) ); + line.addVertex( QgsPoint( 8.1236, 12.7978 ) ); QGSCOMPARENEARPOINT( line.pointN( 0 ), line_r.pointN( 0 ), 0.0001 ); QGSCOMPARENEARPOINT( line.pointN( 1 ), line_r.pointN( 1 ), 0.0001 ); // horizontal - s1 = QgsPointV2( -3, 3 ); - s2 = QgsPointV2( 2, 3 ); + s1 = QgsPoint( -3, 3 ); + s2 = QgsPoint( 2, 3 ); line.clear(); - p1 = QgsPointV2( 3, 13 ); + p1 = QgsPoint( 3, 13 ); line_r = QgsGeometryUtils::perpendicularSegment( p1, s1, s2 ); line.addVertex( p1 ); - line.addVertex( QgsPointV2( 3, 3 ) ); + line.addVertex( QgsPoint( 3, 3 ) ); QCOMPARE( line.pointN( 0 ), line_r.pointN( 0 ) ); QCOMPARE( line.pointN( 1 ), line_r.pointN( 1 ) ); // vertical - s1 = QgsPointV2( 3, 13 ); - s2 = QgsPointV2( 3, 3 ); + s1 = QgsPoint( 3, 13 ); + s2 = QgsPoint( 3, 3 ); line.clear(); - p1 = QgsPointV2( -7, 8 ); + p1 = QgsPoint( -7, 8 ); line_r = QgsGeometryUtils::perpendicularSegment( p1, s1, s2 ); line.addVertex( p1 ); - line.addVertex( QgsPointV2( 3, 8 ) ); + line.addVertex( QgsPoint( 3, 8 ) ); QCOMPARE( line.pointN( 0 ), line_r.pointN( 0 ) ); QCOMPARE( line.pointN( 1 ), line_r.pointN( 1 ) ); } diff --git a/tests/src/core/testqgsgml.cpp b/tests/src/core/testqgsgml.cpp index 2071d6b2526..a458d19d1c8 100644 --- a/tests/src/core/testqgsgml.cpp +++ b/tests/src/core/testqgsgml.cpp @@ -158,7 +158,7 @@ void TestQgsGML::testStreamingParser() QCOMPARE( features[0].first->attributes().at( 4 ), QVariant( QDateTime( QDate( 2016, 4, 10 ), QTime( 12, 34, 56, 789 ), Qt::UTC ) ) ); QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 10, 20 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 10, 20 ) ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( gmlParser.getAndStealReadyFeatures().size(), 0 ); QCOMPARE( gmlParser.getEPSGCode(), 27700 ); @@ -196,7 +196,7 @@ void TestQgsGML::testPointGML2() QCOMPARE( features.size(), 1 ); QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 10, 20 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 10, 20 ) ); delete features[0].first; } @@ -224,8 +224,8 @@ void TestQgsGML::testLineStringGML2() QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::LineString ); QgsPolyline line = features[0].first->geometry().asPolyline(); QCOMPARE( line.size(), 2 ); - QCOMPARE( line[0], QgsPoint( 10, 20 ) ); - QCOMPARE( line[1], QgsPoint( 30, 40 ) ); + QCOMPARE( line[0], QgsPointXY( 10, 20 ) ); + QCOMPARE( line[1], QgsPointXY( 30, 40 ) ); delete features[0].first; } @@ -300,8 +300,8 @@ void TestQgsGML::testMultiPointGML2() QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::MultiPoint ); QgsMultiPoint multi = features[0].first->geometry().asMultiPoint(); QCOMPARE( multi.size(), 2 ); - QCOMPARE( multi[0], QgsPoint( 10, 20 ) ); - QCOMPARE( multi[1], QgsPoint( 30, 40 ) ); + QCOMPARE( multi[0], QgsPointXY( 10, 20 ) ); + QCOMPARE( multi[1], QgsPointXY( 30, 40 ) ); delete features[0].first; } @@ -339,8 +339,8 @@ void TestQgsGML::testMultiLineStringGML2() QgsMultiPolyline multi = features[0].first->geometry().asMultiPolyline(); QCOMPARE( multi.size(), 2 ); QCOMPARE( multi[0].size(), 2 ); - QCOMPARE( multi[0][0], QgsPoint( 10, 20 ) ); - QCOMPARE( multi[0][1], QgsPoint( 30, 40 ) ); + QCOMPARE( multi[0][0], QgsPointXY( 10, 20 ) ); + QCOMPARE( multi[0][1], QgsPointXY( 30, 40 ) ); QCOMPARE( multi[1].size(), 3 ); delete features[0].first; } @@ -406,7 +406,7 @@ void TestQgsGML::testPointGML3() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 10, 20 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 10, 20 ) ); delete features[0].first; } @@ -434,7 +434,7 @@ void TestQgsGML::testPointGML3_EPSG_4326() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 2, 49 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 2, 49 ) ); delete features[0].first; } @@ -462,7 +462,7 @@ void TestQgsGML::testPointGML3_urn_EPSG_4326() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 2, 49 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 2, 49 ) ); delete features[0].first; } @@ -490,7 +490,7 @@ void TestQgsGML::testPointGML3_EPSG_4326_honour_EPSG() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 2, 49 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 2, 49 ) ); delete features[0].first; } @@ -518,7 +518,7 @@ void TestQgsGML::testPointGML3_EPSG_4326_honour_EPSG_invert() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 2, 49 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 2, 49 ) ); delete features[0].first; } @@ -546,8 +546,8 @@ void TestQgsGML::testLineStringGML3() QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::LineString ); QgsPolyline line = features[0].first->geometry().asPolyline(); QCOMPARE( line.size(), 2 ); - QCOMPARE( line[0], QgsPoint( 10, 20 ) ); - QCOMPARE( line[1], QgsPoint( 30, 40 ) ); + QCOMPARE( line[0], QgsPointXY( 10, 20 ) ); + QCOMPARE( line[1], QgsPointXY( 30, 40 ) ); delete features[0].first; } @@ -573,8 +573,8 @@ void TestQgsGML::testLineStringGML3_LineStringSegment() QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::LineString ); QgsPolyline line = features[0].first->geometry().asPolyline(); QCOMPARE( line.size(), 2 ); - QCOMPARE( line[0], QgsPoint( 10, 20 ) ); - QCOMPARE( line[1], QgsPoint( 30, 40 ) ); + QCOMPARE( line[0], QgsPointXY( 10, 20 ) ); + QCOMPARE( line[1], QgsPointXY( 30, 40 ) ); delete features[0].first; } @@ -682,8 +682,8 @@ void TestQgsGML::testMultiLineStringGML3() QgsMultiPolyline multi = features[0].first->geometry().asMultiPolyline(); QCOMPARE( multi.size(), 2 ); QCOMPARE( multi[0].size(), 2 ); - QCOMPARE( multi[0][0], QgsPoint( 10, 20 ) ); - QCOMPARE( multi[0][1], QgsPoint( 30, 40 ) ); + QCOMPARE( multi[0][0], QgsPointXY( 10, 20 ) ); + QCOMPARE( multi[0][1], QgsPointXY( 30, 40 ) ); QCOMPARE( multi[1].size(), 3 ); delete features[0].first; } @@ -759,7 +759,7 @@ void TestQgsGML::testPointGML3_2() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mytypename.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 10, 20 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 10, 20 ) ); delete features[0].first; } @@ -958,7 +958,7 @@ void TestQgsGML::testTuple() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "firstlayer.1|secondlayer.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 10, 20 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 10, 20 ) ); delete features[0].first; } @@ -998,7 +998,7 @@ void TestQgsGML::testRenamedFields() QVERIFY( features[0].first->hasGeometry() ); QCOMPARE( features[0].second, QString( "mylayer.1" ) ); QCOMPARE( features[0].first->geometry().wkbType(), QgsWkbTypes::Point ); - QCOMPARE( features[0].first->geometry().asPoint(), QgsPoint( 10, 20 ) ); + QCOMPARE( features[0].first->geometry().asPoint(), QgsPointXY( 10, 20 ) ); delete features[0].first; } @@ -1100,7 +1100,7 @@ void TestQgsGML::testThroughOGRGeometry_urn_EPSG_4326() QCOMPARE( multi[0].size(), 1 ); QCOMPARE( multi[0][0].size(), 4 ); QgsDebugMsg( multi[0][0][0].toString() ); - QCOMPARE( multi[0][0][0], QgsPoint( 2, 49 ) ); + QCOMPARE( multi[0][0][0], QgsPointXY( 2, 49 ) ); delete features[0].first; } diff --git a/tests/src/core/testqgsinvertedpolygonrenderer.cpp b/tests/src/core/testqgsinvertedpolygonrenderer.cpp index 20096747c3a..7d188fd41ef 100644 --- a/tests/src/core/testqgsinvertedpolygonrenderer.cpp +++ b/tests/src/core/testqgsinvertedpolygonrenderer.cpp @@ -140,7 +140,7 @@ void TestQgsInvertedPolygon::projectionTest() { mReport += QLatin1String( "

Inverted polygon renderer, projection test

\n" ); mMapSettings.setDestinationCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:2154" ) ) ); - QgsRectangle extent( QgsPoint( -8639421, 8382691 ), QgsPoint( -3969110, 12570905 ) ); + QgsRectangle extent( QgsPointXY( -8639421, 8382691 ), QgsPointXY( -3969110, 12570905 ) ); QVERIFY( setQml( mpPolysLayer, "inverted_polys_single.qml" ) ); QVERIFY( imageCheck( "inverted_polys_projection", &extent ) ); QVERIFY( setQml( mpPolysLayer, "inverted_polys_preprocess.qml" ) ); diff --git a/tests/src/core/testqgslabelingengine.cpp b/tests/src/core/testqgslabelingengine.cpp index 29a10eabaca..02d9730f796 100644 --- a/tests/src/core/testqgslabelingengine.cpp +++ b/tests/src/core/testqgslabelingengine.cpp @@ -442,7 +442,7 @@ void TestQgsLabelingEngine::testSubstitutions() QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl, QStringLiteral( "test" ), true, &settings ); QgsFeature f( vl->fields(), 1 ); - f.setGeometry( QgsGeometry::fromPoint( QgsPoint( 1, 2 ) ) ); + f.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 1, 2 ) ) ); // make a fake render context QSize size( 640, 480 ); @@ -474,7 +474,7 @@ void TestQgsLabelingEngine::testSubstitutions() void TestQgsLabelingEngine::testCapitalization() { QgsFeature f( vl->fields(), 1 ); - f.setGeometry( QgsGeometry::fromPoint( QgsPoint( 1, 2 ) ) ); + f.setGeometry( QgsGeometry::fromPoint( QgsPointXY( 1, 2 ) ) ); // make a fake render context QSize size( 640, 480 ); diff --git a/tests/src/core/testqgslegendrenderer.cpp b/tests/src/core/testqgslegendrenderer.cpp index 6f79c868f9c..84bf3f81846 100644 --- a/tests/src/core/testqgslegendrenderer.cpp +++ b/tests/src/core/testqgslegendrenderer.cpp @@ -189,15 +189,15 @@ void TestQgsLegendRenderer::init() QList features; QgsFeature f1( fields, 1 ); f1.setAttribute( 0, 1 ); - QgsGeometry f1G = QgsGeometry::fromPoint( QgsPoint( 1.0, 1.0 ) ); + QgsGeometry f1G = QgsGeometry::fromPoint( QgsPointXY( 1.0, 1.0 ) ); f1.setGeometry( f1G ); QgsFeature f2( fields, 2 ); f2.setAttribute( 0, 2 ); - QgsGeometry f2G = QgsGeometry::fromPoint( QgsPoint( 9.0, 1.0 ) ); + QgsGeometry f2G = QgsGeometry::fromPoint( QgsPointXY( 9.0, 1.0 ) ); f2.setGeometry( f2G ); QgsFeature f3( fields, 3 ); f3.setAttribute( 0, 3 ); - QgsGeometry f3G = QgsGeometry::fromPoint( QgsPoint( 5.0, 5.0 ) ) ; + QgsGeometry f3G = QgsGeometry::fromPoint( QgsPointXY( 5.0, 5.0 ) ) ; f3.setGeometry( f3G ); features << f1 << f2 << f3; pr->addFeatures( features ); @@ -449,15 +449,15 @@ void TestQgsLegendRenderer::testFilterByMapSameSymbol() QList features; QgsFeature f1( fields, 1 ); f1.setAttribute( 0, 1 ); - QgsGeometry f1G = QgsGeometry::fromPoint( QgsPoint( 1.0, 1.0 ) ); + QgsGeometry f1G = QgsGeometry::fromPoint( QgsPointXY( 1.0, 1.0 ) ); f1.setGeometry( f1G ); QgsFeature f2( fields, 2 ); f2.setAttribute( 0, 2 ); - QgsGeometry f2G = QgsGeometry::fromPoint( QgsPoint( 9.0, 1.0 ) ); + QgsGeometry f2G = QgsGeometry::fromPoint( QgsPointXY( 9.0, 1.0 ) ); f2.setGeometry( f2G ); QgsFeature f3( fields, 3 ); f3.setAttribute( 0, 3 ); - QgsGeometry f3G = QgsGeometry::fromPoint( QgsPoint( 5.0, 5.0 ) ); + QgsGeometry f3G = QgsGeometry::fromPoint( QgsPointXY( 5.0, 5.0 ) ); f3.setGeometry( f3G ); features << f1 << f2 << f3; pr->addFeatures( features ); diff --git a/tests/src/core/testqgsmaprendererjob.cpp b/tests/src/core/testqgsmaprendererjob.cpp index c1501b6a610..dfd971e8f53 100644 --- a/tests/src/core/testqgsmaprendererjob.cpp +++ b/tests/src/core/testqgsmaprendererjob.cpp @@ -136,10 +136,10 @@ void TestQgsMapRendererJob::initTestCase() // Create a polygon feature // QgsPolyline myPolyline; - QgsPoint myPoint1 = QgsPoint( i, j ); - QgsPoint myPoint2 = QgsPoint( i + myInterval, j ); - QgsPoint myPoint3 = QgsPoint( i + myInterval, j + myInterval ); - QgsPoint myPoint4 = QgsPoint( i, j + myInterval ); + QgsPointXY myPoint1 = QgsPointXY( i, j ); + QgsPointXY myPoint2 = QgsPointXY( i + myInterval, j ); + QgsPointXY myPoint3 = QgsPointXY( i + myInterval, j + myInterval ); + QgsPointXY myPoint4 = QgsPointXY( i, j + myInterval ); myPolyline << myPoint1 << myPoint2 << myPoint3 << myPoint4 << myPoint1; QgsPolygon myPolygon; myPolygon << myPolyline; diff --git a/tests/src/core/testqgsmaptopixel.cpp b/tests/src/core/testqgsmaptopixel.cpp index ae683309861..9cc00531b5b 100644 --- a/tests/src/core/testqgsmaptopixel.cpp +++ b/tests/src/core/testqgsmaptopixel.cpp @@ -36,12 +36,12 @@ void TestQgsMapToPixel::rotation() { QgsMapToPixel m2p( 1, 5, 5, 10, 10, 90 ); - QgsPoint p( 5, 5 ); // in geographical units - QgsPoint d = m2p.transform( p ); // to device pixels + QgsPointXY p( 5, 5 ); // in geographical units + QgsPointXY d = m2p.transform( p ); // to device pixels QCOMPARE( d.x(), 5.0 ); // center doesn't move QCOMPARE( d.y(), 5.0 ); - QgsPoint b = m2p.toMapCoordinatesF( d.x(), d.y() ); // transform back + QgsPointXY b = m2p.toMapCoordinatesF( d.x(), d.y() ); // transform back QCOMPARE( p, b ); m2p.transform( &p ); // in place transform @@ -52,27 +52,27 @@ void TestQgsMapToPixel::rotation() QCOMPARE( p.x(), 5.0 ); // center doesn't move QCOMPARE( p.y(), 5.0 ); d = m2p.transform( p ); - QCOMPARE( d, QgsPoint( 5, 5 ) ); + QCOMPARE( d, QgsPointXY( 5, 5 ) ); p = m2p.toMapCoordinates( 10, 0 ); QCOMPARE( p.x(), 5.5 ); // corner scales and rotates QCOMPARE( p.y(), 4.5 ); d = m2p.transform( p ); - QCOMPARE( d, QgsPoint( 10, 0 ) ); + QCOMPARE( d, QgsPointXY( 10, 0 ) ); m2p.setParameters( 0.1, 5, 5, 10, 10, 360 ); p = m2p.toMapCoordinates( 10, 0 ); QCOMPARE( p.x(), 5.5 ); // corner scales QCOMPARE( p.y(), 5.5 ); d = m2p.transform( p ); - QCOMPARE( d, QgsPoint( 10, 0 ) ); + QCOMPARE( d, QgsPointXY( 10, 0 ) ); m2p.setParameters( 0.1, 5, 5, 10, 10, 0 ); p = m2p.toMapCoordinates( 10, 0 ); QCOMPARE( p.x(), 5.5 ); // corner scales QCOMPARE( p.y(), 5.5 ); d = m2p.transform( p ); - QCOMPARE( d, QgsPoint( 10, 0 ) ); + QCOMPARE( d, QgsPointXY( 10, 0 ) ); } @@ -110,14 +110,14 @@ void TestQgsMapToPixel::fromScale() void TestQgsMapToPixel::toMapPoint() { QgsMapToPixel m2p( 1, 5, 5, 10, 10, 90 ); - QgsPoint p = m2p.toMapPoint( 5, 5 ); - QCOMPARE( p, QgsPoint( 5, 5 ) ); + QgsPointXY p = m2p.toMapPoint( 5, 5 ); + QCOMPARE( p, QgsPointXY( 5, 5 ) ); p = m2p.toMapPoint( 10, 10 ); - QCOMPARE( p, QgsPoint( 10, 10 ) ); + QCOMPARE( p, QgsPointXY( 10, 10 ) ); p = m2p.toMapPoint( 20, 20 ); - QCOMPARE( p, QgsPoint( 20, 20 ) ); + QCOMPARE( p, QgsPointXY( 20, 20 ) ); } QGSTEST_MAIN( TestQgsMapToPixel ) diff --git a/tests/src/core/testqgsogcutils.cpp b/tests/src/core/testqgsogcutils.cpp index e691cdd28c1..abbdbfba4b0 100644 --- a/tests/src/core/testqgsogcutils.cpp +++ b/tests/src/core/testqgsogcutils.cpp @@ -75,7 +75,7 @@ void TestQgsOgcUtils::testGeometryFromGML() QgsGeometry geom( QgsOgcUtils::geometryFromGML( QStringLiteral( "123,456" ) ) ); QVERIFY( geom ); QVERIFY( geom.wkbType() == QgsWkbTypes::Point ); - QVERIFY( geom.asPoint() == QgsPoint( 123, 456 ) ); + QVERIFY( geom.asPoint() == QgsPointXY( 123, 456 ) ); QgsGeometry geomBox( QgsOgcUtils::geometryFromGML( QStringLiteral( "135.2239,34.4879 135.8578,34.8471" ) ) ); QVERIFY( geomBox ); @@ -86,7 +86,7 @@ void TestQgsOgcUtils::testGeometryFromGML() geom = QgsOgcUtils::geometryFromGML( QStringLiteral( "123 456" ) ); QVERIFY( geom ); QVERIFY( geom.wkbType() == QgsWkbTypes::Point ); - QVERIFY( geom.asPoint() == QgsPoint( 123, 456 ) ); + QVERIFY( geom.asPoint() == QgsPointXY( 123, 456 ) ); geomBox = QgsOgcUtils::geometryFromGML( QStringLiteral( "135.2239 34.4879135.8578 34.8471" ) ); QVERIFY( geomBox ); @@ -206,7 +206,7 @@ static QDomElement comparableElement( const QString &xmlText ) void TestQgsOgcUtils::testGeometryToGML() { QDomDocument doc; - QgsGeometry geomPoint( QgsGeometry::fromPoint( QgsPoint( 111, 222 ) ) ); + QgsGeometry geomPoint( QgsGeometry::fromPoint( QgsPointXY( 111, 222 ) ) ); QgsGeometry geomLine( QgsGeometry::fromWkt( QStringLiteral( "LINESTRING(111 222, 222 222)" ) ) ); // Elements to compare diff --git a/tests/src/core/testqgsogrutils.cpp b/tests/src/core/testqgsogrutils.cpp index 068b5125a47..47f07bd03dc 100644 --- a/tests/src/core/testqgsogrutils.cpp +++ b/tests/src/core/testqgsogrutils.cpp @@ -333,7 +333,7 @@ void TestQgsOgrUtils::stringToFeatureList() QVERIFY( features.at( 0 ).hasGeometry() && !features.at( 0 ).geometry().isNull() ); QCOMPARE( features.at( 0 ).geometry().geometry()->wkbType(), QgsWkbTypes::Point ); QgsGeometry featureGeom = features.at( 0 ).geometry(); - const QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( featureGeom.geometry() ); + const QgsPoint *point = dynamic_cast< QgsPoint * >( featureGeom.geometry() ); QCOMPARE( point->x(), 125.0 ); QCOMPARE( point->y(), 10.0 ); QCOMPARE( features.at( 0 ).attribute( "name" ).toString(), QString( "Dinagat Islands" ) ); @@ -345,14 +345,14 @@ void TestQgsOgrUtils::stringToFeatureList() QVERIFY( features.at( 0 ).hasGeometry() && !features.at( 0 ).geometry().isNull() ); QCOMPARE( features.at( 0 ).geometry().geometry()->wkbType(), QgsWkbTypes::Point ); featureGeom = features.at( 0 ).geometry(); - point = dynamic_cast< QgsPointV2 * >( featureGeom.geometry() ); + point = dynamic_cast< QgsPoint * >( featureGeom.geometry() ); QCOMPARE( point->x(), 125.0 ); QCOMPARE( point->y(), 10.0 ); QCOMPARE( features.at( 0 ).attribute( "name" ).toString(), QString( "Dinagat Islands" ) ); QVERIFY( features.at( 1 ).hasGeometry() && !features.at( 1 ).geometry().isNull() ); QCOMPARE( features.at( 1 ).geometry().geometry()->wkbType(), QgsWkbTypes::Point ); featureGeom = features.at( 1 ).geometry(); - point = dynamic_cast< QgsPointV2 * >( featureGeom.geometry() ); + point = dynamic_cast< QgsPoint * >( featureGeom.geometry() ); QCOMPARE( point->x(), 110.0 ); QCOMPARE( point->y(), 20.0 ); QCOMPARE( features.at( 1 ).attribute( "name" ).toString(), QString( "Henry Gale Island" ) ); diff --git a/tests/src/core/testqgspoint.cpp b/tests/src/core/testqgspoint.cpp index e5a44471ce9..f6383e6fe97 100644 --- a/tests/src/core/testqgspoint.cpp +++ b/tests/src/core/testqgspoint.cpp @@ -26,7 +26,7 @@ //header for class being tested #include -class TestQgsPoint: public QObject +class TestQgsPointXY: public QObject { Q_OBJECT private slots: @@ -53,47 +53,47 @@ class TestQgsPoint: public QObject void vector(); //tests for QgsVector private: - QgsPoint mPoint1; - QgsPoint mPoint2; - QgsPoint mPoint3; - QgsPoint mPoint4; + QgsPointXY mPoint1; + QgsPointXY mPoint2; + QgsPointXY mPoint3; + QgsPointXY mPoint4; QString mReport; }; -void TestQgsPoint::init() +void TestQgsPointXY::init() { // // Reset / reinitialize the geometries before each test is run // - mPoint1 = QgsPoint( 20.0, -20.0 ); - mPoint2 = QgsPoint( -80.0, 20.0 ); - mPoint3 = QgsPoint( -80.0, -20.0 ); - mPoint4 = QgsPoint( 80.0, 20.0 ); + mPoint1 = QgsPointXY( 20.0, -20.0 ); + mPoint2 = QgsPointXY( -80.0, 20.0 ); + mPoint3 = QgsPointXY( -80.0, -20.0 ); + mPoint4 = QgsPointXY( 80.0, 20.0 ); } -void TestQgsPoint::cleanup() +void TestQgsPointXY::cleanup() { // will be called after every testfunction. } -void TestQgsPoint::equality() +void TestQgsPointXY::equality() { - QgsPoint point1( 5.0, 9.0 ); - QgsPoint point2( 5.0, 9.0 ); + QgsPointXY point1( 5.0, 9.0 ); + QgsPointXY point2( 5.0, 9.0 ); QCOMPARE( point1, point2 ); - QgsPoint point3( 5.0, 6.0 ); + QgsPointXY point3( 5.0, 6.0 ); QVERIFY( !( point3 == point1 ) ); QVERIFY( point3 != point1 ); - QgsPoint point4( 8.0, 9.0 ); + QgsPointXY point4( 8.0, 9.0 ); QVERIFY( !( point4 == point1 ) ); QVERIFY( point4 != point1 ); QVERIFY( !( point4 == point3 ) ); QVERIFY( point4 != point3 ); } -void TestQgsPoint::gettersSetters() +void TestQgsPointXY::gettersSetters() { - QgsPoint point; + QgsPointXY point; point.setX( 1.0 ); QCOMPARE( point.x(), 1.0 ); point.setY( 2.0 ); @@ -103,56 +103,56 @@ void TestQgsPoint::gettersSetters() QCOMPARE( point.y(), 4.0 ); } -void TestQgsPoint::constructors() +void TestQgsPointXY::constructors() { - QgsPoint point1 = QgsPoint( 20.0, -20.0 ); + QgsPointXY point1 = QgsPointXY( 20.0, -20.0 ); QCOMPARE( point1.x(), 20.0 ); QCOMPARE( point1.y(), -20.0 ); - QgsPoint point2( point1 ); + QgsPointXY point2( point1 ); QCOMPARE( point2, point1 ); QPointF sourceQPointF( 20.0, -20.0 ); - QgsPoint fromQPointF( sourceQPointF ); + QgsPointXY fromQPointF( sourceQPointF ); QCOMPARE( fromQPointF.x(), 20.0 ); QCOMPARE( fromQPointF.y(), -20.0 ); QPointF sourceQPoint( 20, -20 ); - QgsPoint fromQPoint( sourceQPoint ); + QgsPointXY fromQPoint( sourceQPoint ); QCOMPARE( fromQPoint.x(), 20.0 ); QCOMPARE( fromQPoint.y(), -20.0 ); } -void TestQgsPoint::toQPointF() +void TestQgsPointXY::toQPointF() { - QgsPoint point( 20.0, -20.0 ); + QgsPointXY point( 20.0, -20.0 ); QPointF result = point.toQPointF(); QCOMPARE( result.x(), 20.0 ); QCOMPARE( result.y(), -20.0 ); } -void TestQgsPoint::operators() +void TestQgsPointXY::operators() { - QgsPoint p( 1, 2 ); - QCOMPARE( p - QgsVector( 3, 5 ), QgsPoint( -2, -3 ) ); + QgsPointXY p( 1, 2 ); + QCOMPARE( p - QgsVector( 3, 5 ), QgsPointXY( -2, -3 ) ); p -= QgsVector( 3, 5 ); - QCOMPARE( p, QgsPoint( -2, -3 ) ); + QCOMPARE( p, QgsPointXY( -2, -3 ) ); - p = QgsPoint( 1, 2 ); - QCOMPARE( p + QgsVector( 3, 5 ), QgsPoint( 4, 7 ) ); + p = QgsPointXY( 1, 2 ); + QCOMPARE( p + QgsVector( 3, 5 ), QgsPointXY( 4, 7 ) ); p += QgsVector( 3, 5 ); - QCOMPARE( p, QgsPoint( 4, 7 ) ); + QCOMPARE( p, QgsPointXY( 4, 7 ) ); - p = QgsPoint( 1, 2 ); - QCOMPARE( p * 3, QgsPoint( 3, 6 ) ); + p = QgsPointXY( 1, 2 ); + QCOMPARE( p * 3, QgsPointXY( 3, 6 ) ); p *= 3; - QCOMPARE( p, QgsPoint( 3, 6 ) ); + QCOMPARE( p, QgsPointXY( 3, 6 ) ); - QCOMPARE( p / 3.0, QgsPoint( 1, 2 ) ); + QCOMPARE( p / 3.0, QgsPointXY( 1, 2 ) ); p /= 3; - QCOMPARE( p, QgsPoint( 1, 2 ) ); + QCOMPARE( p, QgsPointXY( 1, 2 ) ); } -void TestQgsPoint::initTestCase() +void TestQgsPointXY::initTestCase() { // // Runs once before any tests are run @@ -164,7 +164,7 @@ void TestQgsPoint::initTestCase() } -void TestQgsPoint::cleanupTestCase() +void TestQgsPointXY::cleanupTestCase() { // // Runs once after all tests are run @@ -181,7 +181,7 @@ void TestQgsPoint::cleanupTestCase() } -void TestQgsPoint::toString() +void TestQgsPointXY::toString() { mReport += QLatin1String( "

Testing toString()

" ); mReport += "

" + mPoint1.toString( 2 ) + "

"; @@ -191,7 +191,7 @@ void TestQgsPoint::toString() QCOMPARE( mPoint1.toString( 2 ), QString( "20.00,-20.00" ) ); } -void TestQgsPoint::toDegreesMinutesSeconds() +void TestQgsPointXY::toDegreesMinutesSeconds() { mReport += QLatin1String( "

Testing toDegreesMinutesSeconds()

" ); mReport += "

" + mPoint1.toDegreesMinutesSeconds( 2 ) + "

"; @@ -214,64 +214,64 @@ void TestQgsPoint::toDegreesMinutesSeconds() QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 370, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 370, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "10" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( -370, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -370, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 181, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 181, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( -181, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -181, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "1" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 359, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 359, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "1" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( -359, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -359, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); //check if latitudes > 90 or <-90 wrap around myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( ",10" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, 190 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 190 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( ",10" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, -190 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -190 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( ",89" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, 91 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 91 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( ",89" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, -91 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -91 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( ",1" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, 179 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 179 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( ",1" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, -179 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -179 ).toDegreesMinutesSeconds( 2 ), myControlString ); //should be no directional suffixes for 0 degree coordinates myControlString = QStringLiteral( "0" ) + QChar( 176 ) + @@ -279,41 +279,41 @@ void TestQgsPoint::toDegreesMinutesSeconds() QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 0, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); //should also be no directional suffix for 0 degree coordinates within specified precision - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutesSeconds( 2 ), myControlString ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutesSeconds( 2 ), myControlString ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutesSeconds( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutesSeconds( 5 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutesSeconds( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutesSeconds( 5 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); //test rounding does not create seconds >= 60 myControlString = QStringLiteral( "100" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",90" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 99.999999, 89.999999 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 99.999999, 89.999999 ).toDegreesMinutesSeconds( 2 ), myControlString ); //should be no directional suffixes for 180 degree longitudes myControlString = QStringLiteral( "180" ) + QChar( 176 ) + @@ -321,23 +321,23 @@ void TestQgsPoint::toDegreesMinutesSeconds() QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 180, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 180, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); //should also be no directional suffix for 180 degree longitudes within specified precision - QCOMPARE( QgsPoint( 180.000001, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); - QCOMPARE( QgsPoint( 179.999999, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 180.000001, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 179.999999, 0 ).toDegreesMinutesSeconds( 2 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "59" ) + QChar( 0x2032 ) + QStringLiteral( "59.99640" ) + QChar( 0x2033 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 180.000001, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 180.000001, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "59" ) + QChar( 0x2032 ) + QStringLiteral( "59.99640" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 179.999999, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 179.999999, 0 ).toDegreesMinutesSeconds( 5 ), myControlString ); } -void TestQgsPoint::toDegreesMinutesSecondsNoSuffix() +void TestQgsPointXY::toDegreesMinutesSecondsNoSuffix() { QString myControlString = QStringLiteral( "80" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + @@ -352,41 +352,41 @@ void TestQgsPoint::toDegreesMinutesSecondsNoSuffix() QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00" ) + QChar( 0x2033 ); - QVERIFY( QgsPoint( 0, 0 ).toDegreesMinutesSeconds( 2, false ) == myControlString ); + QVERIFY( QgsPointXY( 0, 0 ).toDegreesMinutesSeconds( 2, false ) == myControlString ); //test near zero lat/long - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutesSeconds( 2, false ), myControlString ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutesSeconds( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutesSeconds( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutesSeconds( 2, false ), myControlString ); //should be no "-" prefix for near-zero lat/long when rounding to 2 decimal places - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutesSeconds( 2, false ), myControlString ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutesSeconds( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutesSeconds( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutesSeconds( 2, false ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutesSeconds( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutesSeconds( 5, false ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ) + QStringLiteral( ",-0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutesSeconds( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutesSeconds( 5, false ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutesSeconds( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutesSeconds( 5, false ), myControlString ); myControlString = QStringLiteral( "-0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00360" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0" ) + QChar( 0x2032 ) + QStringLiteral( "0.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutesSeconds( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutesSeconds( 5, false ), myControlString ); } -void TestQgsPoint::toDegreesMinutesSecondsPadded() +void TestQgsPointXY::toDegreesMinutesSecondsPadded() { QString myControlString = QStringLiteral( "80" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00" ) + @@ -403,37 +403,37 @@ void TestQgsPoint::toDegreesMinutesSecondsPadded() QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00" ) + QChar( 0x2033 ); - QVERIFY( QgsPoint( 0, 0 ).toDegreesMinutesSeconds( 2, true, true ) == myControlString ); + QVERIFY( QgsPointXY( 0, 0 ).toDegreesMinutesSeconds( 2, true, true ) == myControlString ); //should also be no directional suffix for 0 degree coordinates within specified precision - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutesSeconds( 2, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00000" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00360" ) + QChar( 0x2033 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00000" ) + QChar( 0x2033 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00360" ) + QChar( 0x2033 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00360" ) + QChar( 0x2033 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00360" ) + QChar( 0x2033 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00" ) + QChar( 0x2032 ) + QStringLiteral( "00.00000" ) + QChar( 0x2033 ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutesSeconds( 5, true, true ), myControlString ); } -void TestQgsPoint::toDegreesMinutes() +void TestQgsPointXY::toDegreesMinutes() { mReport += QLatin1String( "

Testing toDegreesMinutes()

" ); mReport += "

" + mPoint1.toDegreesMinutes( 2 ) + "

"; @@ -454,94 +454,94 @@ void TestQgsPoint::toDegreesMinutes() QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 370, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 370, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "10" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( -370, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -370, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 181, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 181, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( -181, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -181, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "1" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 359, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 359, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "1" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( -359, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -359, 0 ).toDegreesMinutes( 2 ), myControlString ); //should be no directional suffixes for 0 degree coordinates myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QVERIFY( QgsPoint( 0, 0 ).toDegreesMinutes( 2 ) == myControlString ); + QVERIFY( QgsPointXY( 0, 0 ).toDegreesMinutes( 2 ) == myControlString ); //should also be no directional suffix for 0 degree coordinates within specified precision - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutes( 2 ), myControlString ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutes( 2 ), myControlString ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutes( 2 ), myControlString ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutes( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutes( 5 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutes( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutes( 5 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutes( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutes( 5 ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutes( 5 ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutes( 5 ), myControlString ); //test rounding does not create minutes >= 60 myControlString = QStringLiteral( "100" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",100" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 99.999999, 99.999999 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 99.999999, 99.999999 ).toDegreesMinutes( 2 ), myControlString ); //should be no directional suffixes for 180 degree longitudes myControlString = QStringLiteral( "180" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 180, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 180, 0 ).toDegreesMinutes( 2 ), myControlString ); //should also be no directional suffix for 180 degree longitudes within specified precision - QCOMPARE( QgsPoint( 180.000001, 0 ).toDegreesMinutes( 2 ), myControlString ); - QCOMPARE( QgsPoint( 179.999999, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 180.000001, 0 ).toDegreesMinutes( 2 ), myControlString ); + QCOMPARE( QgsPointXY( 179.999999, 0 ).toDegreesMinutes( 2 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "59.99994" ) + QChar( 0x2032 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 180.000001, 0 ).toDegreesMinutes( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 180.000001, 0 ).toDegreesMinutes( 5 ), myControlString ); myControlString = QStringLiteral( "179" ) + QChar( 176 ) + QStringLiteral( "59.99994" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 179.999999, 0 ).toDegreesMinutes( 5 ), myControlString ); + QCOMPARE( QgsPointXY( 179.999999, 0 ).toDegreesMinutes( 5 ), myControlString ); } -void TestQgsPoint::toDegreesMinutesNoSuffix() +void TestQgsPointXY::toDegreesMinutesNoSuffix() { QString myControlString = QStringLiteral( "80" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ) + @@ -554,37 +554,37 @@ void TestQgsPoint::toDegreesMinutesNoSuffix() QStringLiteral( "0.00" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00" ) + QChar( 0x2032 ); - QVERIFY( QgsPoint( 0, 0 ).toDegreesMinutes( 2, false ) == myControlString ); + QVERIFY( QgsPointXY( 0, 0 ).toDegreesMinutes( 2, false ) == myControlString ); //test near zero lat/long - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutes( 2, false ), myControlString ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutes( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutes( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutes( 2, false ), myControlString ); //should be no "-" prefix for near-zero lat/long when rounding to 2 decimal places - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutes( 2, false ), myControlString ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutes( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutes( 2, false ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutes( 2, false ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutes( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutes( 5, false ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ) + QStringLiteral( ",-0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutes( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutes( 5, false ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutes( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutes( 5, false ), myControlString ); myControlString = QStringLiteral( "-0" ) + QChar( 176 ) + QStringLiteral( "0.00006" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "0.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutes( 5, false ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutes( 5, false ), myControlString ); } -void TestQgsPoint::toDegreesMinutesPadded() +void TestQgsPointXY::toDegreesMinutesPadded() { QString myControlString = QStringLiteral( "80" ) + QChar( 176 ) + QStringLiteral( "00.00" ) + QChar( 0x2032 ) + @@ -598,88 +598,88 @@ void TestQgsPoint::toDegreesMinutesPadded() QStringLiteral( "00.00" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00.00" ) + QChar( 0x2032 ); - QVERIFY( QgsPoint( 0, 0 ).toDegreesMinutes( 2, true, true ) == myControlString ); + QVERIFY( QgsPointXY( 0, 0 ).toDegreesMinutes( 2, true, true ) == myControlString ); //should also be no directional suffix for 0 degree coordinates within specified precision - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutes( 2, true, true ), myControlString ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutes( 2, true, true ), myControlString ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutes( 2, true, true ), myControlString ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutes( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutes( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutes( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutes( 2, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutes( 2, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00.00000" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00.00006" ) + QChar( 0x2032 ) + QStringLiteral( "N" ); - QCOMPARE( QgsPoint( 0, 0.000001 ).toDegreesMinutes( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, 0.000001 ).toDegreesMinutes( 5, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00.00000" ) + QChar( 0x2032 ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00.00006" ) + QChar( 0x2032 ) + QStringLiteral( "S" ); - QCOMPARE( QgsPoint( 0, -0.000001 ).toDegreesMinutes( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0, -0.000001 ).toDegreesMinutes( 5, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00.00006" ) + QChar( 0x2032 ) + QStringLiteral( "E" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( 0.000001, 0 ).toDegreesMinutes( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( 0.000001, 0 ).toDegreesMinutes( 5, true, true ), myControlString ); myControlString = QStringLiteral( "0" ) + QChar( 176 ) + QStringLiteral( "00.00006" ) + QChar( 0x2032 ) + QStringLiteral( "W" ) + QStringLiteral( ",0" ) + QChar( 176 ) + QStringLiteral( "00.00000" ) + QChar( 0x2032 ); - QCOMPARE( QgsPoint( -0.000001, 0 ).toDegreesMinutes( 5, true, true ), myControlString ); + QCOMPARE( QgsPointXY( -0.000001, 0 ).toDegreesMinutes( 5, true, true ), myControlString ); } -void TestQgsPoint::sqrDist() +void TestQgsPointXY::sqrDist() { - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( QgsPoint( 2, 2 ) ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( 2, 2 ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( QgsPoint( 3, 2 ) ), 4.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( 3, 2 ), 4.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( QgsPoint( 1, 3 ) ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( 1, 3 ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( QgsPoint( 1, 4 ) ), 4.0 ); - QCOMPARE( QgsPoint( 1, 2 ).sqrDist( 1, 4 ), 4.0 ); - QCOMPARE( QgsPoint( 1, -2 ).sqrDist( QgsPoint( 1, -4 ) ), 4.0 ); - QCOMPARE( QgsPoint( 1, -2 ).sqrDist( 1, -4 ), 4.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( QgsPointXY( 2, 2 ) ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( 2, 2 ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( QgsPointXY( 3, 2 ) ), 4.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( 3, 2 ), 4.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( QgsPointXY( 1, 3 ) ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( 1, 3 ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( QgsPointXY( 1, 4 ) ), 4.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).sqrDist( 1, 4 ), 4.0 ); + QCOMPARE( QgsPointXY( 1, -2 ).sqrDist( QgsPointXY( 1, -4 ) ), 4.0 ); + QCOMPARE( QgsPointXY( 1, -2 ).sqrDist( 1, -4 ), 4.0 ); } -void TestQgsPoint::distance() +void TestQgsPointXY::distance() { - QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 2, 2 ) ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( 2, 2 ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 3, 2 ) ), 2.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( 3, 2 ), 2.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 1, 3 ) ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( 1, 3 ), 1.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( QgsPoint( 1, 4 ) ), 2.0 ); - QCOMPARE( QgsPoint( 1, 2 ).distance( 1, 4 ), 2.0 ); - QCOMPARE( QgsPoint( 1, -2 ).distance( QgsPoint( 1, -4 ) ), 2.0 ); - QCOMPARE( QgsPoint( 1, -2 ).distance( 1, -4 ), 2.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( QgsPointXY( 2, 2 ) ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( 2, 2 ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( QgsPointXY( 3, 2 ) ), 2.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( 3, 2 ), 2.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( QgsPointXY( 1, 3 ) ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( 1, 3 ), 1.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( QgsPointXY( 1, 4 ) ), 2.0 ); + QCOMPARE( QgsPointXY( 1, 2 ).distance( 1, 4 ), 2.0 ); + QCOMPARE( QgsPointXY( 1, -2 ).distance( QgsPointXY( 1, -4 ) ), 2.0 ); + QCOMPARE( QgsPointXY( 1, -2 ).distance( 1, -4 ), 2.0 ); } -void TestQgsPoint::compare() +void TestQgsPointXY::compare() { - QgsPoint point1( 5.000000000001, 9.0 ); - QgsPoint point2( 5.0, 8.999999999999999 ); + QgsPointXY point1( 5.000000000001, 9.0 ); + QgsPointXY point2( 5.0, 8.999999999999999 ); QVERIFY( point1.compare( point2, 0.00000001 ) ); - QgsPoint point3( 5.0, 6.0 ); + QgsPointXY point3( 5.0, 6.0 ); QVERIFY( !( point3.compare( point1 ) ) ); - QgsPoint point4( 10 / 3.0, 12 / 7.0 ); - QVERIFY( point4.compare( QgsPoint( 10 / 3.0, 12 / 7.0 ) ) ); + QgsPointXY point4( 10 / 3.0, 12 / 7.0 ); + QVERIFY( point4.compare( QgsPointXY( 10 / 3.0, 12 / 7.0 ) ) ); } -void TestQgsPoint::project() +void TestQgsPointXY::project() { // test projecting a point - QgsPoint p( 1, 2 ); - QVERIFY( p.project( 1, 0 ).compare( QgsPoint( 1, 3 ), 0.0000000001 ) ); - QVERIFY( p.project( 1.5, 90 ).compare( QgsPoint( 2.5, 2 ), 0.0000000001 ) ); - QVERIFY( p.project( 2, 180 ).compare( QgsPoint( 1, 0 ), 0.0000000001 ) ); - QVERIFY( p.project( 5, 270 ).compare( QgsPoint( -4, 2 ), 0.0000000001 ) ); - QVERIFY( p.project( 6, 360 ).compare( QgsPoint( 1, 8 ), 0.0000000001 ) ); - QVERIFY( p.project( 5, 450 ).compare( QgsPoint( 6, 2 ), 0.0000000001 ) ); - QVERIFY( p.project( -1, 0 ).compare( QgsPoint( 1, 1 ), 0.0000000001 ) ); - QVERIFY( p.project( 1.5, -90 ).compare( QgsPoint( -0.5, 2 ), 0.0000000001 ) ); + QgsPointXY p( 1, 2 ); + QVERIFY( p.project( 1, 0 ).compare( QgsPointXY( 1, 3 ), 0.0000000001 ) ); + QVERIFY( p.project( 1.5, 90 ).compare( QgsPointXY( 2.5, 2 ), 0.0000000001 ) ); + QVERIFY( p.project( 2, 180 ).compare( QgsPointXY( 1, 0 ), 0.0000000001 ) ); + QVERIFY( p.project( 5, 270 ).compare( QgsPointXY( -4, 2 ), 0.0000000001 ) ); + QVERIFY( p.project( 6, 360 ).compare( QgsPointXY( 1, 8 ), 0.0000000001 ) ); + QVERIFY( p.project( 5, 450 ).compare( QgsPointXY( 6, 2 ), 0.0000000001 ) ); + QVERIFY( p.project( -1, 0 ).compare( QgsPointXY( 1, 1 ), 0.0000000001 ) ); + QVERIFY( p.project( 1.5, -90 ).compare( QgsPointXY( -0.5, 2 ), 0.0000000001 ) ); } -void TestQgsPoint::vector() +void TestQgsPointXY::vector() { //equality QVERIFY( QgsVector( 1, 2 ) == QgsVector( 1, 2 ) ); @@ -760,5 +760,5 @@ void TestQgsPoint::vector() QCOMPARE( v1.y(), 3.0 ); } -QGSTEST_MAIN( TestQgsPoint ) +QGSTEST_MAIN( TestQgsPointXY ) #include "testqgspoint.moc" diff --git a/tests/src/core/testqgspointlocator.cpp b/tests/src/core/testqgspointlocator.cpp index e81cdfb2a50..9adf597c701 100644 --- a/tests/src/core/testqgspointlocator.cpp +++ b/tests/src/core/testqgspointlocator.cpp @@ -28,28 +28,28 @@ struct FilterExcludePoint : public QgsPointLocator::MatchFilter { - explicit FilterExcludePoint( const QgsPoint &p ) : mPoint( p ) {} + explicit FilterExcludePoint( const QgsPointXY &p ) : mPoint( p ) {} bool acceptMatch( const QgsPointLocator::Match &match ) { return match.point() != mPoint; } - QgsPoint mPoint; + QgsPointXY mPoint; }; struct FilterExcludeEdge : public QgsPointLocator::MatchFilter { - FilterExcludeEdge( const QgsPoint &p1, const QgsPoint &p2 ) + FilterExcludeEdge( const QgsPointXY &p1, const QgsPointXY &p2 ) : mP1( p1 ) , mP2( p2 ) {} bool acceptMatch( const QgsPointLocator::Match &match ) { - QgsPoint p1, p2; + QgsPointXY p1, p2; match.edgePoints( p1, p2 ); return !( p1 == mP1 && p2 == mP2 ) && !( p1 == mP2 && p2 == mP1 ); } - QgsPoint mP1, mP2; + QgsPointXY mP1, mP2; }; @@ -84,7 +84,7 @@ class TestQgsPointLocator : public QObject QgsFeature ff( 0 ); QgsPolygon polygon; QgsPolyline polyline; - polyline << QgsPoint( 0, 1 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 1 ); + polyline << QgsPointXY( 0, 1 ) << QgsPointXY( 1, 0 ) << QgsPointXY( 1, 1 ) << QgsPointXY( 0, 1 ); polygon << polyline; QgsGeometry ffGeom = QgsGeometry::fromPolygon( polygon ); ff.setGeometry( ffGeom ); @@ -103,13 +103,13 @@ class TestQgsPointLocator : public QObject void testNearestVertex() { QgsPointLocator loc( mVL ); - QgsPoint pt( 2, 2 ); + QgsPointXY pt( 2, 2 ); QgsPointLocator::Match m = loc.nearestVertex( pt, 999 ); QVERIFY( m.isValid() ); QVERIFY( m.hasVertex() ); QCOMPARE( m.layer(), mVL ); QCOMPARE( m.featureId(), ( QgsFeatureId )1 ); - QCOMPARE( m.point(), QgsPoint( 1, 1 ) ); + QCOMPARE( m.point(), QgsPointXY( 1, 1 ) ); QCOMPARE( m.distance(), sqrt( 2.0 ) ); QCOMPARE( m.vertexIndex(), 2 ); } @@ -117,25 +117,25 @@ class TestQgsPointLocator : public QObject void testNearestEdge() { QgsPointLocator loc( mVL ); - QgsPoint pt( 1.1, 0.5 ); + QgsPointXY pt( 1.1, 0.5 ); QgsPointLocator::Match m = loc.nearestEdge( pt, 999 ); QVERIFY( m.isValid() ); QVERIFY( m.hasEdge() ); QCOMPARE( m.layer(), mVL ); QCOMPARE( m.featureId(), ( QgsFeatureId )1 ); - QCOMPARE( m.point(), QgsPoint( 1, 0.5 ) ); + QCOMPARE( m.point(), QgsPointXY( 1, 0.5 ) ); QCOMPARE( m.distance(), 0.1 ); QCOMPARE( m.vertexIndex(), 1 ); - QgsPoint pt1, pt2; + QgsPointXY pt1, pt2; m.edgePoints( pt1, pt2 ); - QCOMPARE( pt1, QgsPoint( 1, 0 ) ); - QCOMPARE( pt2, QgsPoint( 1, 1 ) ); + QCOMPARE( pt1, QgsPointXY( 1, 0 ) ); + QCOMPARE( pt2, QgsPointXY( 1, 1 ) ); } void testPointInPolygon() { QgsPointLocator loc( mVL ); - QgsPointLocator::MatchList mValid = loc.pointInPolygon( QgsPoint( 0.8, 0.8 ) ); + QgsPointLocator::MatchList mValid = loc.pointInPolygon( QgsPointXY( 0.8, 0.8 ) ); QCOMPARE( mValid.count(), 1 ); QgsPointLocator::Match m = mValid[0]; QVERIFY( m.isValid() ); @@ -143,7 +143,7 @@ class TestQgsPointLocator : public QObject QCOMPARE( m.layer(), mVL ); QCOMPARE( m.featureId(), ( QgsFeatureId )1 ); - QgsPointLocator::MatchList mInvalid = loc.pointInPolygon( QgsPoint( 0, 0 ) ); + QgsPointLocator::MatchList mInvalid = loc.pointInPolygon( QgsPointXY( 0, 0 ) ); QCOMPARE( mInvalid.count(), 0 ); } @@ -151,38 +151,38 @@ class TestQgsPointLocator : public QObject void testVerticesInRect() { QgsPointLocator loc( mVL ); - QgsPointLocator::MatchList lst = loc.verticesInRect( QgsPoint( 1, 0 ), 2 ); + QgsPointLocator::MatchList lst = loc.verticesInRect( QgsPointXY( 1, 0 ), 2 ); QCOMPARE( lst.count(), 4 ); - QCOMPARE( lst[0].point(), QgsPoint( 1, 0 ) ); + QCOMPARE( lst[0].point(), QgsPointXY( 1, 0 ) ); QCOMPARE( lst[0].distance(), 0. ); - QCOMPARE( lst[1].point(), QgsPoint( 1, 1 ) ); + QCOMPARE( lst[1].point(), QgsPointXY( 1, 1 ) ); QCOMPARE( lst[1].distance(), 1. ); - QCOMPARE( lst[2].point(), QgsPoint( 0, 1 ) ); + QCOMPARE( lst[2].point(), QgsPointXY( 0, 1 ) ); QCOMPARE( lst[2].distance(), sqrt( 2 ) ); - QgsPointLocator::MatchList lst2 = loc.verticesInRect( QgsPoint( 1, 0 ), 1 ); + QgsPointLocator::MatchList lst2 = loc.verticesInRect( QgsPointXY( 1, 0 ), 1 ); QCOMPARE( lst2.count(), 2 ); // test match filtering - FilterExcludePoint myFilter( QgsPoint( 1, 0 ) ); - QgsPointLocator::MatchList lst3 = loc.verticesInRect( QgsPoint( 1, 0 ), 1, &myFilter ); + FilterExcludePoint myFilter( QgsPointXY( 1, 0 ) ); + QgsPointLocator::MatchList lst3 = loc.verticesInRect( QgsPointXY( 1, 0 ), 1, &myFilter ); QCOMPARE( lst3.count(), 1 ); - QCOMPARE( lst3[0].point(), QgsPoint( 1, 1 ) ); + QCOMPARE( lst3[0].point(), QgsPointXY( 1, 1 ) ); } #endif void testEdgesInTolerance() { QgsPointLocator loc( mVL ); - QgsPointLocator::MatchList lst = loc.edgesInRect( QgsPoint( 0, 0 ), 2 ); + QgsPointLocator::MatchList lst = loc.edgesInRect( QgsPointXY( 0, 0 ), 2 ); QCOMPARE( lst.count(), 3 ); - QgsPointLocator::MatchList lst2 = loc.edgesInRect( QgsPoint( 0, 0 ), 0.9 ); + QgsPointLocator::MatchList lst2 = loc.edgesInRect( QgsPointXY( 0, 0 ), 0.9 ); QCOMPARE( lst2.count(), 1 ); // test match filtering - FilterExcludeEdge myFilter( QgsPoint( 1, 0 ), QgsPoint( 0, 1 ) ); - QgsPointLocator::MatchList lst3 = loc.edgesInRect( QgsPoint( 0, 0 ), 2, &myFilter ); + FilterExcludeEdge myFilter( QgsPointXY( 1, 0 ), QgsPointXY( 0, 1 ) ); + QgsPointLocator::MatchList lst3 = loc.edgesInRect( QgsPointXY( 0, 0 ), 2, &myFilter ); QCOMPARE( lst3.count(), 2 ); } @@ -192,9 +192,9 @@ class TestQgsPointLocator : public QObject QgsPointLocator loc( mVL ); - QgsPointLocator::Match mAddV0 = loc.nearestVertex( QgsPoint( 12, 12 ), 999 ); + QgsPointLocator::Match mAddV0 = loc.nearestVertex( QgsPointXY( 12, 12 ), 999 ); QVERIFY( mAddV0.isValid() ); - QCOMPARE( mAddV0.point(), QgsPoint( 1, 1 ) ); + QCOMPARE( mAddV0.point(), QgsPointXY( 1, 1 ) ); mVL->startEditing(); @@ -202,7 +202,7 @@ class TestQgsPointLocator : public QObject QgsFeature ff( 0 ); QgsPolygon polygon; QgsPolyline polyline; - polyline << QgsPoint( 10, 11 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) << QgsPoint( 10, 11 ); + polyline << QgsPointXY( 10, 11 ) << QgsPointXY( 11, 10 ) << QgsPointXY( 11, 11 ) << QgsPointXY( 10, 11 ); polygon << polyline; QgsGeometry ffGeom = QgsGeometry::fromPolygon( polygon ) ; ff.setGeometry( ffGeom ); @@ -212,13 +212,13 @@ class TestQgsPointLocator : public QObject QVERIFY( resA ); // verify it is added in the point locator - QgsPointLocator::Match mAddV = loc.nearestVertex( QgsPoint( 12, 12 ), 999 ); + QgsPointLocator::Match mAddV = loc.nearestVertex( QgsPointXY( 12, 12 ), 999 ); QVERIFY( mAddV.isValid() ); - QCOMPARE( mAddV.point(), QgsPoint( 11, 11 ) ); - QgsPointLocator::Match mAddE = loc.nearestEdge( QgsPoint( 11.1, 10.5 ), 999 ); + QCOMPARE( mAddV.point(), QgsPointXY( 11, 11 ) ); + QgsPointLocator::Match mAddE = loc.nearestEdge( QgsPointXY( 11.1, 10.5 ), 999 ); QVERIFY( mAddE.isValid() ); - QCOMPARE( mAddE.point(), QgsPoint( 11, 10.5 ) ); - QgsPointLocator::MatchList mAddA = loc.pointInPolygon( QgsPoint( 10.8, 10.8 ) ); + QCOMPARE( mAddE.point(), QgsPointXY( 11, 10.5 ) ); + QgsPointLocator::MatchList mAddA = loc.pointInPolygon( QgsPointXY( 10.8, 10.8 ) ); QVERIFY( mAddA.count() == 1 ); // change geometry @@ -228,21 +228,21 @@ class TestQgsPointLocator : public QObject delete newGeom; // verify it is changed in the point locator - QgsPointLocator::Match mChV = loc.nearestVertex( QgsPoint( 12, 12 ), 999 ); + QgsPointLocator::Match mChV = loc.nearestVertex( QgsPointXY( 12, 12 ), 999 ); QVERIFY( mChV.isValid() ); - QVERIFY( mChV.point() != QgsPoint( 11, 11 ) ); // that point does not exist anymore - mChV = loc.nearestVertex( QgsPoint( 9, 9 ), 999 ); + QVERIFY( mChV.point() != QgsPointXY( 11, 11 ) ); // that point does not exist anymore + mChV = loc.nearestVertex( QgsPointXY( 9, 9 ), 999 ); QVERIFY( mChV.isValid() ); - QVERIFY( mChV.point() == QgsPoint( 10, 10 ) ); // updated point + QVERIFY( mChV.point() == QgsPointXY( 10, 10 ) ); // updated point // delete feature bool resD = mVL->deleteFeature( ff.id() ); QVERIFY( resD ); // verify it is deleted from the point locator - QgsPointLocator::Match mDelV = loc.nearestVertex( QgsPoint( 12, 12 ), 999 ); + QgsPointLocator::Match mDelV = loc.nearestVertex( QgsPointXY( 12, 12 ), 999 ); QVERIFY( mDelV.isValid() ); - QCOMPARE( mDelV.point(), QgsPoint( 1, 1 ) ); + QCOMPARE( mDelV.point(), QgsPointXY( 1, 1 ) ); mVL->rollBack(); } @@ -252,15 +252,15 @@ class TestQgsPointLocator : public QObject QgsRectangle bbox1( 10, 10, 11, 11 ); // out of layer's bounds QgsPointLocator loc1( mVL, QgsCoordinateReferenceSystem(), &bbox1 ); - QgsPointLocator::Match m1 = loc1.nearestVertex( QgsPoint( 2, 2 ), 999 ); + QgsPointLocator::Match m1 = loc1.nearestVertex( QgsPointXY( 2, 2 ), 999 ); QVERIFY( !m1.isValid() ); QgsRectangle bbox2( 0, 0, 1, 1 ); // in layer's bounds QgsPointLocator loc2( mVL, QgsCoordinateReferenceSystem(), &bbox2 ); - QgsPointLocator::Match m2 = loc2.nearestVertex( QgsPoint( 2, 2 ), 999 ); + QgsPointLocator::Match m2 = loc2.nearestVertex( QgsPointXY( 2, 2 ), 999 ); QVERIFY( m2.isValid() ); - QCOMPARE( m2.point(), QgsPoint( 1, 1 ) ); + QCOMPARE( m2.point(), QgsPointXY( 1, 1 ) ); } void testNullGeometries() @@ -274,10 +274,10 @@ class TestQgsPointLocator : public QObject QgsPointLocator loc( vlNullGeom, QgsCoordinateReferenceSystem(), nullptr ); - QgsPointLocator::Match m1 = loc.nearestVertex( QgsPoint( 2, 2 ), std::numeric_limits::max() ); + QgsPointLocator::Match m1 = loc.nearestVertex( QgsPointXY( 2, 2 ), std::numeric_limits::max() ); QVERIFY( !m1.isValid() ); - QgsPointLocator::Match m2 = loc.nearestEdge( QgsPoint( 2, 2 ), std::numeric_limits::max() ); + QgsPointLocator::Match m2 = loc.nearestEdge( QgsPointXY( 2, 2 ), std::numeric_limits::max() ); QVERIFY( !m2.isValid() ); delete vlNullGeom; @@ -296,10 +296,10 @@ class TestQgsPointLocator : public QObject QgsPointLocator loc( vlEmptyGeom, QgsCoordinateReferenceSystem(), nullptr ); - QgsPointLocator::Match m1 = loc.nearestVertex( QgsPoint( 2, 2 ), std::numeric_limits::max() ); + QgsPointLocator::Match m1 = loc.nearestVertex( QgsPointXY( 2, 2 ), std::numeric_limits::max() ); QVERIFY( !m1.isValid() ); - QgsPointLocator::Match m2 = loc.nearestEdge( QgsPoint( 2, 2 ), std::numeric_limits::max() ); + QgsPointLocator::Match m2 = loc.nearestEdge( QgsPointXY( 2, 2 ), std::numeric_limits::max() ); QVERIFY( !m2.isValid() ); delete vlEmptyGeom; diff --git a/tests/src/core/testqgsprocessing.cpp b/tests/src/core/testqgsprocessing.cpp index d801178bbd5..bbc41699049 100644 --- a/tests/src/core/testqgsprocessing.cpp +++ b/tests/src/core/testqgsprocessing.cpp @@ -594,7 +594,7 @@ void TestQgsProcessing::features() for ( int i = 1; i < 6; ++i ) { QgsFeature f( i ); - f.setGeometry( QgsGeometry( new QgsPointV2( 1, 2 ) ) ); + f.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); layer->dataProvider()->addFeatures( QgsFeatureList() << f ); } @@ -750,7 +750,7 @@ void TestQgsProcessing::createIndex() for ( int i = 1; i < 6; ++i ) { QgsFeature f( i ); - f.setGeometry( QgsGeometry( new QgsPointV2( i, 2 ) ) ); + f.setGeometry( QgsGeometry( new QgsPoint( i, 2 ) ) ); layer->dataProvider()->addFeatures( QgsFeatureList() << f ); } @@ -758,25 +758,25 @@ void TestQgsProcessing::createIndex() // disable selected features check context.setFlags( QgsProcessingContext::Flags( 0 ) ); QgsSpatialIndex index = QgsProcessingUtils::createSpatialIndex( layer, context ); - QList ids = index.nearestNeighbor( QgsPoint( 2.1, 2 ), 1 ); + QList ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 2 ); // selected features check, but none selected context.setFlags( QgsProcessingContext::UseSelectionIfPresent ); index = QgsProcessingUtils::createSpatialIndex( layer, context ); - ids = index.nearestNeighbor( QgsPoint( 2.1, 2 ), 1 ); + ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 2 ); // create selection layer->selectByIds( QgsFeatureIds() << 4 << 5 ); index = QgsProcessingUtils::createSpatialIndex( layer, context ); - ids = index.nearestNeighbor( QgsPoint( 2.1, 2 ), 1 ); + ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 4 ); // selection but not using selection mode context.setFlags( QgsProcessingContext::Flags( 0 ) ); index = QgsProcessingUtils::createSpatialIndex( layer, context ); - ids = index.nearestNeighbor( QgsPoint( 2.1, 2 ), 1 ); + ids = index.nearestNeighbor( QgsPointXY( 2.1, 2 ), 1 ); QCOMPARE( ids, QList() << 2 ); } @@ -1228,7 +1228,7 @@ void TestQgsProcessing::parameterPoint() // string representing a point QVariantMap params; params.insert( "non_optional", QString( "1.1,2.2" ) ); - QgsPoint point = QgsProcessingParameters::parameterAsPoint( def.get(), params, QStringLiteral( "non_optional" ), context ); + QgsPointXY point = QgsProcessingParameters::parameterAsPoint( def.get(), params, QStringLiteral( "non_optional" ), context ); QGSCOMPARENEAR( point.x(), 1.1, 0.001 ); QGSCOMPARENEAR( point.y(), 2.2, 0.001 ); diff --git a/tests/src/core/testqgsproperty.cpp b/tests/src/core/testqgsproperty.cpp index fad4c026421..2835c807742 100644 --- a/tests/src/core/testqgsproperty.cpp +++ b/tests/src/core/testqgsproperty.cpp @@ -97,7 +97,7 @@ class TestQgsProperty : public QObject private: QgsPropertiesDefinition mDefinitions; - void checkCurveResult( const QList< QgsPoint > &controlPoints, const QVector &x, const QVector &y ); + void checkCurveResult( const QList< QgsPointXY > &controlPoints, const QVector &x, const QVector &y ); }; @@ -720,9 +720,9 @@ void TestQgsProperty::genericNumericTransformer() // add a curve QVERIFY( !t1.curveTransform() ); - t1.setCurveTransform( new QgsCurveTransform( QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ) ); + t1.setCurveTransform( new QgsCurveTransform( QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ) ); QVERIFY( t1.curveTransform() ); - QCOMPARE( t1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( t1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); QCOMPARE( t1.transform( context, 10 ).toInt(), 180 ); QCOMPARE( t1.transform( context, 20 ).toInt(), 120 ); @@ -730,13 +730,13 @@ void TestQgsProperty::genericNumericTransformer() // copy QgsGenericNumericTransformer s1( t1 ); QVERIFY( s1.curveTransform() ); - QCOMPARE( s1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( s1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); // assignment QgsGenericNumericTransformer s2; s2 = t1; QVERIFY( s2.curveTransform() ); - QCOMPARE( s2.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( s2.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); //saving and restoring @@ -753,7 +753,7 @@ void TestQgsProperty::genericNumericTransformer() 250, -10, 99 ); - t2.setCurveTransform( new QgsCurveTransform( QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ) ); + t2.setCurveTransform( new QgsCurveTransform( QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ) ); QVariant element; element = t2.toVariant(); @@ -766,7 +766,7 @@ void TestQgsProperty::genericNumericTransformer() QCOMPARE( r1.nullOutputValue(), -10.0 ); QCOMPARE( r1.exponent(), 99.0 ); QVERIFY( r1.curveTransform() ); - QCOMPARE( r1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); // test cloning std::unique_ptr< QgsGenericNumericTransformer > r2( t2.clone() ); @@ -777,7 +777,7 @@ void TestQgsProperty::genericNumericTransformer() QCOMPARE( r2->nullOutputValue(), -10.0 ); QCOMPARE( r2->exponent(), 99.0 ); QVERIFY( r2->curveTransform() ); - QCOMPARE( r2->curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r2->curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); //test various min/max value/size and scaling methods @@ -914,22 +914,22 @@ void TestQgsProperty::sizeScaleTransformer() // add a curve QVERIFY( !scale.curveTransform() ); - scale.setCurveTransform( new QgsCurveTransform( QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ) ); + scale.setCurveTransform( new QgsCurveTransform( QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ) ); QVERIFY( scale.curveTransform() ); - QCOMPARE( scale.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ); + QCOMPARE( scale.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ); QCOMPARE( scale.transform( context, 10 ).toInt(), 120 ); QCOMPARE( scale.transform( context, 20 ).toInt(), 180 ); // copy QgsSizeScaleTransformer s1( scale ); QVERIFY( s1.curveTransform() ); - QCOMPARE( s1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ); + QCOMPARE( s1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ); // assignment QgsSizeScaleTransformer s2; s2 = scale; QVERIFY( s2.curveTransform() ); - QCOMPARE( s2.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ); + QCOMPARE( s2.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ); //saving and restoring @@ -947,7 +947,7 @@ void TestQgsProperty::sizeScaleTransformer() 250, -10, 99 ); - t1.setCurveTransform( new QgsCurveTransform( QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ) ); + t1.setCurveTransform( new QgsCurveTransform( QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ) ); QVariant element; element = t1.toVariant(); @@ -961,7 +961,7 @@ void TestQgsProperty::sizeScaleTransformer() QCOMPARE( r1.exponent(), 99.0 ); QCOMPARE( r1.type(), QgsSizeScaleTransformer::Exponential ); QVERIFY( r1.curveTransform() ); - QCOMPARE( r1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); // test cloning std::unique_ptr< QgsSizeScaleTransformer > r2( t1.clone() ); @@ -973,7 +973,7 @@ void TestQgsProperty::sizeScaleTransformer() QCOMPARE( r2->exponent(), 99.0 ); QCOMPARE( r2->type(), QgsSizeScaleTransformer::Exponential ); QVERIFY( r2->curveTransform() ); - QCOMPARE( r2->curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r2->curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); //test various min/max value/size and scaling methods @@ -1143,9 +1143,9 @@ void TestQgsProperty::colorRampTransformer() // add a curve QVERIFY( !scale.curveTransform() ); - scale.setCurveTransform( new QgsCurveTransform( QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ) ); + scale.setCurveTransform( new QgsCurveTransform( QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ) ); QVERIFY( scale.curveTransform() ); - QCOMPARE( scale.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ); + QCOMPARE( scale.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ); QCOMPARE( scale.transform( context, 10 ).value().name(), QString( "#333333" ) ); QCOMPARE( scale.transform( context, 20 ).value().name(), QString( "#cccccc" ) ); @@ -1153,13 +1153,13 @@ void TestQgsProperty::colorRampTransformer() // copy QgsColorRampTransformer s1( scale ); QVERIFY( s1.curveTransform() ); - QCOMPARE( s1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ); + QCOMPARE( s1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ); // assignment QgsColorRampTransformer s2; s2 = scale; QVERIFY( s2.curveTransform() ); - QCOMPARE( s2.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1, 0.8 ) ); + QCOMPARE( s2.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1, 0.8 ) ); //saving and restoring @@ -1175,7 +1175,7 @@ void TestQgsProperty::colorRampTransformer() new QgsGradientColorRamp( QColor( 10, 20, 30 ), QColor( 200, 190, 180 ) ), QColor( 100, 150, 200 ) ); t1.setRampName( "rampname " ); - t1.setCurveTransform( new QgsCurveTransform( QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ) ); + t1.setCurveTransform( new QgsCurveTransform( QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ) ); QVariant element; element = t1.toVariant(); @@ -1189,7 +1189,7 @@ void TestQgsProperty::colorRampTransformer() QCOMPARE( static_cast< QgsGradientColorRamp * >( r1.colorRamp() )->color1(), QColor( 10, 20, 30 ) ); QCOMPARE( static_cast< QgsGradientColorRamp * >( r1.colorRamp() )->color2(), QColor( 200, 190, 180 ) ); QVERIFY( r1.curveTransform() ); - QCOMPARE( r1.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r1.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); // test cloning std::unique_ptr< QgsColorRampTransformer > r2( t1.clone() ); @@ -1200,7 +1200,7 @@ void TestQgsProperty::colorRampTransformer() QCOMPARE( static_cast< QgsGradientColorRamp * >( r2->colorRamp() )->color1(), QColor( 10, 20, 30 ) ); QCOMPARE( static_cast< QgsGradientColorRamp * >( r2->colorRamp() )->color2(), QColor( 200, 190, 180 ) ); QVERIFY( r2->curveTransform() ); - QCOMPARE( r2->curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r2->curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); // copy constructor QgsColorRampTransformer r3( t1 ); @@ -1211,7 +1211,7 @@ void TestQgsProperty::colorRampTransformer() QCOMPARE( static_cast< QgsGradientColorRamp * >( r3.colorRamp() )->color1(), QColor( 10, 20, 30 ) ); QCOMPARE( static_cast< QgsGradientColorRamp * >( r3.colorRamp() )->color2(), QColor( 200, 190, 180 ) ); QVERIFY( r3.curveTransform() ); - QCOMPARE( r3.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r3.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); // assignment operator QgsColorRampTransformer r4; @@ -1223,7 +1223,7 @@ void TestQgsProperty::colorRampTransformer() QCOMPARE( static_cast< QgsGradientColorRamp * >( r4.colorRamp() )->color1(), QColor( 10, 20, 30 ) ); QCOMPARE( static_cast< QgsGradientColorRamp * >( r4.colorRamp() )->color2(), QColor( 200, 190, 180 ) ); QVERIFY( r4.curveTransform() ); - QCOMPARE( r4.curveTransform()->controlPoints(), QList< QgsPoint >() << QgsPoint( 0, 0.8 ) << QgsPoint( 1, 0.2 ) ); + QCOMPARE( r4.curveTransform()->controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0, 0.8 ) << QgsPointXY( 1, 0.2 ) ); //test various min/max value/color and scaling methods @@ -1685,68 +1685,68 @@ void TestQgsProperty::curveTransform() QCOMPARE( y[6], 1.0 ); // linear transform with y =/= x - checkCurveResult( QList< QgsPoint >() << QgsPoint( 0, 0.2 ) << QgsPoint( 1.0, 0.8 ), + checkCurveResult( QList< QgsPointXY >() << QgsPointXY( 0, 0.2 ) << QgsPointXY( 1.0, 0.8 ), QVector< double >() << -1 << 0 << 0.2 << 0.5 << 0.8 << 1 << 2, QVector< double >() << 0.2 << 0.2 << 0.32 << 0.5 << 0.68 << 0.8 << 0.8 ); // reverse linear transform with y = -x - checkCurveResult( QList< QgsPoint >() << QgsPoint( 0.0, 1.0 ) << QgsPoint( 1.0, 0 ), + checkCurveResult( QList< QgsPointXY >() << QgsPointXY( 0.0, 1.0 ) << QgsPointXY( 1.0, 0 ), QVector< double >() << -1 << 0 << 0.2 << 0.5 << 0.8 << 1 << 2, QVector< double >() << 1.0 << 1.0 << 0.8 << 0.5 << 0.2 << 0.0 << 0.0 ); // ok, time for some more complex tests... // 3 control points, but linear - checkCurveResult( QList< QgsPoint >() << QgsPoint( 0, 0.0 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 1.0, 1.0 ), + checkCurveResult( QList< QgsPointXY >() << QgsPointXY( 0, 0.0 ) << QgsPointXY( 0.2, 0.2 ) << QgsPointXY( 1.0, 1.0 ), QVector< double >() << -1 << 0 << 0.2 << 0.5 << 0.8 << 1 << 2, QVector< double >() << 0.0 << 0.0 << 0.2 << 0.5 << 0.8 << 1.0 << 1.0 ); // test for "flat" response for x outside of control point range - checkCurveResult( QList< QgsPoint >() << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.5, 0.5 ) << QgsPoint( 0.8, 0.8 ), + checkCurveResult( QList< QgsPointXY >() << QgsPointXY( 0.2, 0.2 ) << QgsPointXY( 0.5, 0.5 ) << QgsPointXY( 0.8, 0.8 ), QVector< double >() << -1 << 0 << 0.1 << 0.2 << 0.5 << 0.8 << 0.9 << 1 << 2, QVector< double >() << 0.2 << 0.2 << 0.2 << 0.2 << 0.5 << 0.8 << 0.8 << 0.8 << 0.8 ); //curves! - checkCurveResult( QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.4, 0.6 ) << QgsPoint( 0.6, 0.8 ) << QgsPoint( 1.0, 1.0 ), + checkCurveResult( QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.4, 0.6 ) << QgsPointXY( 0.6, 0.8 ) << QgsPointXY( 1.0, 1.0 ), QVector< double >() << -1 << 0 << 0.2 << 0.4 << 0.5 << 0.6 << 0.8 << 0.9 << 1.0 << 2.0, QVector< double >() << 0.0 << 0.0 << 0.321429 << 0.6 << 0.710714 << 0.8 << 0.921429 << 0.963393 << 1.0 << 1.0 ); //curves with more control points - checkCurveResult( QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.2, 0.6 ) << QgsPoint( 0.4, 0.6 ) << QgsPoint( 0.6, 0.8 ) << QgsPoint( 0.8, 0.3 ) << QgsPoint( 1.0, 1.0 ), + checkCurveResult( QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.2, 0.6 ) << QgsPointXY( 0.4, 0.6 ) << QgsPointXY( 0.6, 0.8 ) << QgsPointXY( 0.8, 0.3 ) << QgsPointXY( 1.0, 1.0 ), QVector< double >() << -1 << 0 << 0.2 << 0.4 << 0.5 << 0.6 << 0.8 << 0.9 << 1.0 << 2.0, QVector< double >() << 0.0 << 0.0 << 0.6 << 0.6 << 0.751316 << 0.8 << 0.3 << 0.508074 << 1.0 << 1.0 ); // general tests - QList< QgsPoint > points = QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.4, 0.6 ) << QgsPoint( 0.6, 0.8 ) << QgsPoint( 1.0, 1.0 ); + QList< QgsPointXY > points = QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.4, 0.6 ) << QgsPointXY( 0.6, 0.8 ) << QgsPointXY( 1.0, 1.0 ); QgsCurveTransform src( points ); QCOMPARE( src.controlPoints(), points ); - points = QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.5, 0.6 ) << QgsPoint( 0.6, 0.8 ) << QgsPoint( 1.0, 1.0 ); + points = QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.5, 0.6 ) << QgsPointXY( 0.6, 0.8 ) << QgsPointXY( 1.0, 1.0 ); src.setControlPoints( points ); QCOMPARE( src.controlPoints(), points ); - src.setControlPoints( QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 1.0, 1.0 ) ); + src.setControlPoints( QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 1.0, 1.0 ) ); src.addControlPoint( 0.2, 0.3 ); src.addControlPoint( 0.1, 0.4 ); - QCOMPARE( src.controlPoints(), QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.1, 0.4 ) << QgsPoint( 0.2, 0.3 ) << QgsPoint( 1.0, 1.0 ) ); + QCOMPARE( src.controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.1, 0.4 ) << QgsPointXY( 0.2, 0.3 ) << QgsPointXY( 1.0, 1.0 ) ); // remove non-existent point src.removeControlPoint( 0.6, 0.7 ); - QCOMPARE( src.controlPoints(), QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.1, 0.4 ) << QgsPoint( 0.2, 0.3 ) << QgsPoint( 1.0, 1.0 ) ); + QCOMPARE( src.controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.1, 0.4 ) << QgsPointXY( 0.2, 0.3 ) << QgsPointXY( 1.0, 1.0 ) ); // remove valid point src.removeControlPoint( 0.1, 0.4 ); - QCOMPARE( src.controlPoints(), QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.2, 0.3 ) << QgsPoint( 1.0, 1.0 ) ); + QCOMPARE( src.controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.2, 0.3 ) << QgsPointXY( 1.0, 1.0 ) ); // copy constructor QgsCurveTransform dest( src ); - QCOMPARE( dest.controlPoints(), QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.2, 0.3 ) << QgsPoint( 1.0, 1.0 ) ); + QCOMPARE( dest.controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.2, 0.3 ) << QgsPointXY( 1.0, 1.0 ) ); // check a value to ensure that derivative matrix was copied ok QGSCOMPARENEAR( dest.y( 0.5 ), 0.1, 0.638672 ); // assignment operator QgsCurveTransform dest2; dest2 = src; - QCOMPARE( dest2.controlPoints(), QList< QgsPoint >() << QgsPoint( 0.0, 0.0 ) << QgsPoint( 0.2, 0.3 ) << QgsPoint( 1.0, 1.0 ) ); + QCOMPARE( dest2.controlPoints(), QList< QgsPointXY >() << QgsPointXY( 0.0, 0.0 ) << QgsPointXY( 0.2, 0.3 ) << QgsPointXY( 1.0, 1.0 ) ); QGSCOMPARENEAR( dest2.y( 0.5 ), 0.1, 0.638672 ); // writing and reading from xml @@ -1779,7 +1779,7 @@ void TestQgsProperty::asVariant() QCOMPARE( fromVar.field(), QStringLiteral( "field1" ) ); } -void TestQgsProperty::checkCurveResult( const QList &controlPoints, const QVector &x, const QVector &y ) +void TestQgsProperty::checkCurveResult( const QList &controlPoints, const QVector &x, const QVector &y ) { // build transform QgsCurveTransform t( controlPoints ); diff --git a/tests/src/core/testqgsrasterlayer.cpp b/tests/src/core/testqgsrasterlayer.cpp index 1a454080077..0e2060db5a1 100644 --- a/tests/src/core/testqgsrasterlayer.cpp +++ b/tests/src/core/testqgsrasterlayer.cpp @@ -450,7 +450,7 @@ void TestQgsRasterLayer::checkScaleOffset() QVERIFY( fabs( myStatistics.stdDev - stdDev ) < 0.0000001 ); QgsRasterDataProvider *myProvider = myRasterLayer->dataProvider(); - QgsPoint myPoint( 1535030, 5083350 ); + QgsPointXY myPoint( 1535030, 5083350 ); QgsRectangle myRect( 1535030 - 5, 5083350 - 5, 1535030 + 5, 5083350 + 5 ); QgsRasterIdentifyResult identifyResult = myProvider->identify( myPoint, QgsRaster::IdentifyFormatValue, myRect, 1, 1 ); diff --git a/tests/src/core/testqgsrectangle.cpp b/tests/src/core/testqgsrectangle.cpp index dab6cd77694..a38e2277fe7 100644 --- a/tests/src/core/testqgsrectangle.cpp +++ b/tests/src/core/testqgsrectangle.cpp @@ -75,7 +75,7 @@ void TestQgsRectangle::regression6194() rect2.setYMaximum( 520.0 ); // Scale by 2.5, keeping bottom left as is. - QgsPoint p( 135.0, 270.0 ); + QgsPointXY p( 135.0, 270.0 ); rect1.scale( 2.5, &p ); QVERIFY( rect2.xMinimum() == rect1.xMinimum() ); diff --git a/tests/src/core/testqgssnappingutils.cpp b/tests/src/core/testqgssnappingutils.cpp index 50a42e61d0f..ec7548396f0 100644 --- a/tests/src/core/testqgssnappingutils.cpp +++ b/tests/src/core/testqgssnappingutils.cpp @@ -28,11 +28,11 @@ struct FilterExcludePoint : public QgsPointLocator::MatchFilter { - explicit FilterExcludePoint( const QgsPoint &p ) : mPoint( p ) {} + explicit FilterExcludePoint( const QgsPointXY &p ) : mPoint( p ) {} bool acceptMatch( const QgsPointLocator::Match &match ) { return match.point() != mPoint; } - QgsPoint mPoint; + QgsPointXY mPoint; }; @@ -66,7 +66,7 @@ class TestQgsSnappingUtils : public QObject QgsFeature ff( 0 ); QgsPolygon polygon; QgsPolyline polyline; - polyline << QgsPoint( 0, 1 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 1 ); + polyline << QgsPointXY( 0, 1 ) << QgsPointXY( 1, 0 ) << QgsPointXY( 1, 1 ) << QgsPointXY( 0, 1 ); polygon << polyline; QgsGeometry polygonGeom = QgsGeometry::fromPolygon( polygon ); ff.setGeometry( polygonGeom ); @@ -113,7 +113,7 @@ class TestQgsSnappingUtils : public QObject QgsPointLocator::Match m = u.snapToMap( QPoint( 100, 100 ) ); QVERIFY( m.isValid() ); QVERIFY( m.hasVertex() ); - QCOMPARE( m.point(), QgsPoint( 1, 0 ) ); + QCOMPARE( m.point(), QgsPointXY( 1, 0 ) ); QgsPointLocator::Match m2 = u.snapToMap( QPoint( 0, 100 ) ); QVERIFY( !m2.isValid() ); @@ -126,7 +126,7 @@ class TestQgsSnappingUtils : public QObject u.setConfig( snappingConfig ); // test with filtering - FilterExcludePoint myFilter( QgsPoint( 1, 0 ) ); + FilterExcludePoint myFilter( QgsPointXY( 1, 0 ) ); QgsPointLocator::Match m3 = u.snapToMap( QPoint( 100, 100 ), &myFilter ); QVERIFY( !m3.isValid() ); } @@ -156,7 +156,7 @@ class TestQgsSnappingUtils : public QObject QgsPointLocator::Match m2 = u.snapToMap( QPoint( 100, 100 ) ); QVERIFY( m2.isValid() ); - QCOMPARE( m2.point(), QgsPoint( 1, 0 ) ); + QCOMPARE( m2.point(), QgsPointXY( 1, 0 ) ); } void testSnapModeAdvanced() @@ -177,10 +177,10 @@ class TestQgsSnappingUtils : public QObject QgsPointLocator::Match m = u.snapToMap( QPoint( 100, 100 ) ); QVERIFY( m.isValid() ); QVERIFY( m.hasVertex() ); - QCOMPARE( m.point(), QgsPoint( 1, 0 ) ); + QCOMPARE( m.point(), QgsPointXY( 1, 0 ) ); // test with filtering - FilterExcludePoint myFilter( QgsPoint( 1, 0 ) ); + FilterExcludePoint myFilter( QgsPointXY( 1, 0 ) ); QgsPointLocator::Match m2 = u.snapToMap( QPoint( 100, 100 ), &myFilter ); QVERIFY( !m2.isValid() ); } @@ -194,8 +194,8 @@ class TestQgsSnappingUtils : public QObject // (0,0) x x (1,0) QgsVectorLayer *vl = new QgsVectorLayer( QStringLiteral( "LineString" ), QStringLiteral( "x" ), QStringLiteral( "memory" ) ); QgsPolyline polyline1, polyline2; - polyline1 << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ); - polyline2 << QgsPoint( 1, 0 ) << QgsPoint( 0, 1 ); + polyline1 << QgsPointXY( 0, 0 ) << QgsPointXY( 1, 1 ); + polyline2 << QgsPointXY( 1, 0 ) << QgsPointXY( 0, 1 ); QgsFeature f1; QgsGeometry f1g = QgsGeometry::fromPolyline( polyline1 ) ; f1.setGeometry( f1g ); @@ -223,16 +223,16 @@ class TestQgsSnappingUtils : public QObject u.setConfig( snappingConfig ); // no snapping on intersections by default - should find nothing - QgsPointLocator::Match m = u.snapToMap( QgsPoint( 0.45, 0.5 ) ); + QgsPointLocator::Match m = u.snapToMap( QgsPointXY( 0.45, 0.5 ) ); QVERIFY( !m.isValid() ); snappingConfig.setIntersectionSnapping( true ); u.setConfig( snappingConfig ); - QgsPointLocator::Match m2 = u.snapToMap( QgsPoint( 0.45, 0.5 ) ); + QgsPointLocator::Match m2 = u.snapToMap( QgsPointXY( 0.45, 0.5 ) ); QVERIFY( m2.isValid() ); QCOMPARE( m2.type(), QgsPointLocator::Vertex ); - QCOMPARE( m2.point(), QgsPoint( 0.5, 0.5 ) ); + QCOMPARE( m2.point(), QgsPointXY( 0.5, 0.5 ) ); delete vl; } diff --git a/tests/src/core/testqgsspatialindex.cpp b/tests/src/core/testqgsspatialindex.cpp index a012be491b5..fa724d67b2a 100644 --- a/tests/src/core/testqgsspatialindex.cpp +++ b/tests/src/core/testqgsspatialindex.cpp @@ -27,7 +27,7 @@ static QgsFeature _pointFeature( QgsFeatureId id, qreal x, qreal y ) { QgsFeature f( id ); - QgsGeometry g = QgsGeometry::fromPoint( QgsPoint( x, y ) ); + QgsGeometry g = QgsGeometry::fromPoint( QgsPointXY( x, y ) ); f.setGeometry( g ); return f; } @@ -145,7 +145,7 @@ class TestQgsSpatialIndex : public QObject for ( int k = 0; k < 500; ++k ) { QgsFeature f( i * 1000 + k ); - QgsGeometry g = QgsGeometry::fromPoint( QgsPoint( i / 10, i % 10 ) ); + QgsGeometry g = QgsGeometry::fromPoint( QgsPointXY( i / 10, i % 10 ) ); f.setGeometry( g ); index.insertFeature( f ); } @@ -167,7 +167,7 @@ class TestQgsSpatialIndex : public QObject for ( int k = 0; k < 500; ++k ) { QgsFeature f( i * 1000 + k ); - QgsGeometry g = QgsGeometry::fromPoint( QgsPoint( i / 10, i % 10 ) ); + QgsGeometry g = QgsGeometry::fromPoint( QgsPointXY( i / 10, i % 10 ) ); f.setGeometry( g ); flist << f; } diff --git a/tests/src/core/testqgstracer.cpp b/tests/src/core/testqgstracer.cpp index 3f432d22648..7642aa6ee68 100644 --- a/tests/src/core/testqgstracer.cpp +++ b/tests/src/core/testqgstracer.cpp @@ -43,9 +43,9 @@ class TestQgsTracer : public QObject namespace QTest { template<> - char *toString( const QgsPoint &point ) + char *toString( const QgsPointXY &point ) { - QByteArray ba = "QgsPoint(" + QByteArray::number( point.x() ) + + QByteArray ba = "QgsPointXY(" + QByteArray::number( point.x() ) + ", " + QByteArray::number( point.y() ) + ")"; return qstrdup( ba.data() ); } @@ -75,15 +75,15 @@ static QgsVectorLayer *make_layer( const QStringList &wkts ) return vl; } -void print_shortest_path( QgsTracer &tracer, const QgsPoint &p1, const QgsPoint &p2 ) +void print_shortest_path( QgsTracer &tracer, const QgsPointXY &p1, const QgsPointXY &p2 ) { qDebug( "from (%f,%f) to (%f,%f)", p1.x(), p1.y(), p2.x(), p2.y() ); - QVector points = tracer.findShortestPath( p1, p2 ); + QVector points = tracer.findShortestPath( p1, p2 ); if ( points.isEmpty() ) qDebug( "no path!" ); - Q_FOREACH ( const QgsPoint &p, points ) + Q_FOREACH ( const QgsPointXY &p, points ) qDebug( "p: %f %f", p.x(), p.y() ); } @@ -121,35 +121,35 @@ void TestQgsTracer::testSimple() QgsTracer tracer; tracer.setLayers( QList() << vl ); - QgsPolyline points1 = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 20, 10 ) ); + QgsPolyline points1 = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 20, 10 ) ); QCOMPARE( points1.count(), 3 ); - QCOMPARE( points1[0], QgsPoint( 0, 0 ) ); - QCOMPARE( points1[1], QgsPoint( 10, 0 ) ); - QCOMPARE( points1[2], QgsPoint( 20, 10 ) ); + QCOMPARE( points1[0], QgsPointXY( 0, 0 ) ); + QCOMPARE( points1[1], QgsPointXY( 10, 0 ) ); + QCOMPARE( points1[2], QgsPointXY( 20, 10 ) ); // one joined point - QgsPolyline points2 = tracer.findShortestPath( QgsPoint( 5, 10 ), QgsPoint( 0, 0 ) ); + QgsPolyline points2 = tracer.findShortestPath( QgsPointXY( 5, 10 ), QgsPointXY( 0, 0 ) ); QCOMPARE( points2.count(), 3 ); - QCOMPARE( points2[0], QgsPoint( 5, 10 ) ); - QCOMPARE( points2[1], QgsPoint( 0, 10 ) ); - QCOMPARE( points2[2], QgsPoint( 0, 0 ) ); + QCOMPARE( points2[0], QgsPointXY( 5, 10 ) ); + QCOMPARE( points2[1], QgsPointXY( 0, 10 ) ); + QCOMPARE( points2[2], QgsPointXY( 0, 0 ) ); // two joined points - QgsPolyline points3 = tracer.findShortestPath( QgsPoint( 0, 1 ), QgsPoint( 11, 1 ) ); + QgsPolyline points3 = tracer.findShortestPath( QgsPointXY( 0, 1 ), QgsPointXY( 11, 1 ) ); QCOMPARE( points3.count(), 4 ); - QCOMPARE( points3[0], QgsPoint( 0, 1 ) ); - QCOMPARE( points3[1], QgsPoint( 0, 0 ) ); - QCOMPARE( points3[2], QgsPoint( 10, 0 ) ); - QCOMPARE( points3[3], QgsPoint( 11, 1 ) ); + QCOMPARE( points3[0], QgsPointXY( 0, 1 ) ); + QCOMPARE( points3[1], QgsPointXY( 0, 0 ) ); + QCOMPARE( points3[2], QgsPointXY( 10, 0 ) ); + QCOMPARE( points3[3], QgsPointXY( 11, 1 ) ); // two joined points on one line - QgsPolyline points4 = tracer.findShortestPath( QgsPoint( 11, 1 ), QgsPoint( 19, 9 ) ); + QgsPolyline points4 = tracer.findShortestPath( QgsPointXY( 11, 1 ), QgsPointXY( 19, 9 ) ); QCOMPARE( points4.count(), 2 ); - QCOMPARE( points4[0], QgsPoint( 11, 1 ) ); - QCOMPARE( points4[1], QgsPoint( 19, 9 ) ); + QCOMPARE( points4[0], QgsPointXY( 11, 1 ) ); + QCOMPARE( points4[1], QgsPointXY( 19, 9 ) ); // no path to (1,1) - QgsPolyline points5 = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 1, 1 ) ); + QgsPolyline points5 = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 1, 1 ) ); QCOMPARE( points5.count(), 0 ); delete vl; @@ -168,11 +168,11 @@ void TestQgsTracer::testPolygon() QgsTracer tracer; tracer.setLayers( QList() << vl ); - QgsPolyline points = tracer.findShortestPath( QgsPoint( 1, 0 ), QgsPoint( 0, 1 ) ); + QgsPolyline points = tracer.findShortestPath( QgsPointXY( 1, 0 ), QgsPointXY( 0, 1 ) ); QCOMPARE( points.count(), 3 ); - QCOMPARE( points[0], QgsPoint( 1, 0 ) ); - QCOMPARE( points[1], QgsPoint( 0, 0 ) ); - QCOMPARE( points[2], QgsPoint( 0, 1 ) ); + QCOMPARE( points[0], QgsPointXY( 1, 0 ) ); + QCOMPARE( points[1], QgsPointXY( 0, 0 ) ); + QCOMPARE( points[2], QgsPointXY( 0, 1 ) ); delete vl; } @@ -197,12 +197,12 @@ void TestQgsTracer::testButterfly() QgsTracer tracer; tracer.setLayers( QList() << vl ); - QgsPolyline points = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 10, 0 ) ); + QgsPolyline points = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 10, 0 ) ); QCOMPARE( points.count(), 3 ); - QCOMPARE( points[0], QgsPoint( 0, 0 ) ); - QCOMPARE( points[1], QgsPoint( 5, 5 ) ); - QCOMPARE( points[2], QgsPoint( 10, 0 ) ); + QCOMPARE( points[0], QgsPointXY( 0, 0 ) ); + QCOMPARE( points[1], QgsPointXY( 5, 5 ) ); + QCOMPARE( points[2], QgsPointXY( 10, 0 ) ); delete vl; } @@ -224,11 +224,11 @@ void TestQgsTracer::testLayerUpdates() tracer.setLayers( QList() << vl ); tracer.init(); - QgsPolyline points1 = tracer.findShortestPath( QgsPoint( 10, 0 ), QgsPoint( 10, 10 ) ); + QgsPolyline points1 = tracer.findShortestPath( QgsPointXY( 10, 0 ), QgsPointXY( 10, 10 ) ); QCOMPARE( points1.count(), 3 ); - QCOMPARE( points1[0], QgsPoint( 10, 0 ) ); - QCOMPARE( points1[1], QgsPoint( 20, 10 ) ); - QCOMPARE( points1[2], QgsPoint( 10, 10 ) ); + QCOMPARE( points1[0], QgsPointXY( 10, 0 ) ); + QCOMPARE( points1[1], QgsPointXY( 20, 10 ) ); + QCOMPARE( points1[2], QgsPointXY( 10, 10 ) ); vl->startEditing(); @@ -236,35 +236,35 @@ void TestQgsTracer::testLayerUpdates() QgsFeature f( make_feature( QStringLiteral( "LINESTRING(10 0, 10 10)" ) ) ); vl->addFeature( f ); - QgsPolyline points2 = tracer.findShortestPath( QgsPoint( 10, 0 ), QgsPoint( 10, 10 ) ); + QgsPolyline points2 = tracer.findShortestPath( QgsPointXY( 10, 0 ), QgsPointXY( 10, 10 ) ); QCOMPARE( points2.count(), 2 ); - QCOMPARE( points2[0], QgsPoint( 10, 0 ) ); - QCOMPARE( points2[1], QgsPoint( 10, 10 ) ); + QCOMPARE( points2[0], QgsPointXY( 10, 0 ) ); + QCOMPARE( points2[1], QgsPointXY( 10, 10 ) ); // delete the shortcut vl->deleteFeature( f.id() ); - QgsPolyline points3 = tracer.findShortestPath( QgsPoint( 10, 0 ), QgsPoint( 10, 10 ) ); + QgsPolyline points3 = tracer.findShortestPath( QgsPointXY( 10, 0 ), QgsPointXY( 10, 10 ) ); QCOMPARE( points3.count(), 3 ); - QCOMPARE( points3[0], QgsPoint( 10, 0 ) ); - QCOMPARE( points3[1], QgsPoint( 20, 10 ) ); - QCOMPARE( points3[2], QgsPoint( 10, 10 ) ); + QCOMPARE( points3[0], QgsPointXY( 10, 0 ) ); + QCOMPARE( points3[1], QgsPointXY( 20, 10 ) ); + QCOMPARE( points3[2], QgsPointXY( 10, 10 ) ); // make the shortcut again from a different feature QgsGeometry g = QgsGeometry::fromWkt( QStringLiteral( "LINESTRING(10 0, 10 10)" ) ); vl->changeGeometry( 2, g ); // change bottom line (second item in wkts) - QgsPolyline points4 = tracer.findShortestPath( QgsPoint( 10, 0 ), QgsPoint( 10, 10 ) ); + QgsPolyline points4 = tracer.findShortestPath( QgsPointXY( 10, 0 ), QgsPointXY( 10, 10 ) ); QCOMPARE( points4.count(), 2 ); - QCOMPARE( points4[0], QgsPoint( 10, 0 ) ); - QCOMPARE( points4[1], QgsPoint( 10, 10 ) ); + QCOMPARE( points4[0], QgsPointXY( 10, 0 ) ); + QCOMPARE( points4[1], QgsPointXY( 10, 10 ) ); - QgsPolyline points5 = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 10, 0 ) ); + QgsPolyline points5 = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 10, 0 ) ); QCOMPARE( points5.count(), 4 ); - QCOMPARE( points5[0], QgsPoint( 0, 0 ) ); - QCOMPARE( points5[1], QgsPoint( 0, 10 ) ); - QCOMPARE( points5[2], QgsPoint( 10, 10 ) ); - QCOMPARE( points5[3], QgsPoint( 10, 0 ) ); + QCOMPARE( points5[0], QgsPointXY( 0, 0 ) ); + QCOMPARE( points5[1], QgsPointXY( 0, 10 ) ); + QCOMPARE( points5[2], QgsPointXY( 10, 10 ) ); + QCOMPARE( points5[3], QgsPointXY( 10, 0 ) ); vl->rollBack(); @@ -289,12 +289,12 @@ void TestQgsTracer::testExtent() tracer.setExtent( QgsRectangle( 0, 0, 5, 5 ) ); tracer.init(); - QgsPolyline points1 = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 10, 0 ) ); + QgsPolyline points1 = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 10, 0 ) ); QCOMPARE( points1.count(), 2 ); - QCOMPARE( points1[0], QgsPoint( 0, 0 ) ); - QCOMPARE( points1[1], QgsPoint( 10, 0 ) ); + QCOMPARE( points1[0], QgsPointXY( 0, 0 ) ); + QCOMPARE( points1[1], QgsPointXY( 10, 0 ) ); - QgsPolyline points2 = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 20, 10 ) ); + QgsPolyline points2 = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 20, 10 ) ); QCOMPARE( points2.count(), 0 ); } @@ -307,8 +307,8 @@ void TestQgsTracer::testReprojection() QgsCoordinateReferenceSystem dstCrs( QStringLiteral( "EPSG:3857" ) ); QgsCoordinateTransform ct( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ), dstCrs ); - QgsPoint p1 = ct.transform( QgsPoint( 1, 0 ) ); - QgsPoint p2 = ct.transform( QgsPoint( 2, 0 ) ); + QgsPointXY p1 = ct.transform( QgsPointXY( 1, 0 ) ); + QgsPointXY p2 = ct.transform( QgsPointXY( 2, 0 ) ); QgsTracer tracer; tracer.setLayers( QList() << vl ); @@ -335,7 +335,7 @@ void TestQgsTracer::testCurved() QgsTracer tracer; tracer.setLayers( QList() << vl ); - QgsPolyline points1 = tracer.findShortestPath( QgsPoint( 0, 0 ), QgsPoint( 10, 10 ) ); + QgsPolyline points1 = tracer.findShortestPath( QgsPointXY( 0, 0 ), QgsPointXY( 10, 10 ) ); QVERIFY( points1.count() != 0 ); @@ -346,8 +346,8 @@ void TestQgsTracer::testCurved() double full_circle_length = 2 * M_PI * 10; QGSCOMPARENEAR( l, full_circle_length / 4, 0.01 ); - QCOMPARE( points1[0], QgsPoint( 0, 0 ) ); - QCOMPARE( points1[points1.count() - 1], QgsPoint( 10, 10 ) ); + QCOMPARE( points1[0], QgsPointXY( 0, 0 ) ); + QCOMPARE( points1[points1.count() - 1], QgsPointXY( 10, 10 ) ); delete vl; } diff --git a/tests/src/core/testqgsvectorfilewriter.cpp b/tests/src/core/testqgsvectorfilewriter.cpp index 6080da04ee1..f803d35b66e 100644 --- a/tests/src/core/testqgsvectorfilewriter.cpp +++ b/tests/src/core/testqgsvectorfilewriter.cpp @@ -87,9 +87,9 @@ class TestQgsVectorFileWriter: public QObject QgsVectorFileWriter::WriterError mError; QgsCoordinateReferenceSystem mCRS; QgsFields mFields; - QgsPoint mPoint1; - QgsPoint mPoint2; - QgsPoint mPoint3; + QgsPointXY mPoint1; + QgsPointXY mPoint2; + QgsPointXY mPoint3; }; TestQgsVectorFileWriter::TestQgsVectorFileWriter() @@ -115,9 +115,9 @@ void TestQgsVectorFileWriter::initTestCase() QgsField myField1( QStringLiteral( "Field1" ), QVariant::String, QStringLiteral( "String" ), 10, 0, QStringLiteral( "Field 1 comment" ) ); mFields.append( myField1 ); mCRS = QgsCoordinateReferenceSystem( GEOWKT ); - mPoint1 = QgsPoint( 10.0, 10.0 ); - mPoint2 = QgsPoint( 15.0, 10.0 ); - mPoint3 = QgsPoint( 15.0, 12.0 ); + mPoint1 = QgsPointXY( 10.0, 10.0 ); + mPoint2 = QgsPointXY( 15.0, 10.0 ); + mPoint3 = QgsPointXY( 15.0, 12.0 ); } void TestQgsVectorFileWriter::cleanupTestCase() @@ -286,10 +286,10 @@ void TestQgsVectorFileWriter::polygonGridTest() // Create a polygon feature // QgsPolyline myPolyline; - QgsPoint myPoint1 = QgsPoint( i, j ); - QgsPoint myPoint2 = QgsPoint( i + myInterval, j ); - QgsPoint myPoint3 = QgsPoint( i + myInterval, j + myInterval ); - QgsPoint myPoint4 = QgsPoint( i, j + myInterval ); + QgsPointXY myPoint1 = QgsPointXY( i, j ); + QgsPointXY myPoint2 = QgsPointXY( i + myInterval, j ); + QgsPointXY myPoint3 = QgsPointXY( i + myInterval, j + myInterval ); + QgsPointXY myPoint4 = QgsPointXY( i, j + myInterval ); myPolyline << myPoint1 << myPoint2 << myPoint3 << myPoint4 << myPoint1; QgsPolygon myPolygon; myPolygon << myPolyline; @@ -356,10 +356,10 @@ void TestQgsVectorFileWriter::projectedPlygonGridTest() // Create a polygon feature // QgsPolyline myPolyline; - QgsPoint myPoint1 = QgsPoint( i, j ); - QgsPoint myPoint2 = QgsPoint( i + myInterval, j ); - QgsPoint myPoint3 = QgsPoint( i + myInterval, j + myInterval ); - QgsPoint myPoint4 = QgsPoint( i, j + myInterval ); + QgsPointXY myPoint1 = QgsPointXY( i, j ); + QgsPointXY myPoint2 = QgsPointXY( i + myInterval, j ); + QgsPointXY myPoint3 = QgsPointXY( i + myInterval, j + myInterval ); + QgsPointXY myPoint4 = QgsPointXY( i, j + myInterval ); myPolyline << myPoint1 << myPoint2 << myPoint3 << myPoint4 << myPoint1; QgsPolygon myPolygon; myPolygon << myPolyline; @@ -427,7 +427,7 @@ void TestQgsVectorFileWriter::regression1141() QgsWkbTypes::Point, crs ); - QgsPoint myPoint = QgsPoint( 10.0, 10.0 ); + QgsPointXY myPoint = QgsPointXY( 10.0, 10.0 ); QgsGeometry mypPointGeometry = QgsGeometry::fromPoint( myPoint ); QgsFeature myFeature; myFeature.setGeometry( mypPointGeometry ); diff --git a/tests/src/core/testqgsvectorlayer.cpp b/tests/src/core/testqgsvectorlayer.cpp index 325a256b403..3533b628816 100644 --- a/tests/src/core/testqgsvectorlayer.cpp +++ b/tests/src/core/testqgsvectorlayer.cpp @@ -347,7 +347,7 @@ void TestQgsVectorLayer::testAddTopologicalPoints() QVERIFY( layerLine->isValid() ); QgsPolyline line1; - line1 << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) << QgsPoint( 1, 3 ); + line1 << QgsPointXY( 2, 1 ) << QgsPointXY( 1, 1 ) << QgsPointXY( 1, 3 ); QgsFeature lineF1; lineF1.setGeometry( QgsGeometry::fromPolyline( line1 ) ); @@ -359,19 +359,19 @@ void TestQgsVectorLayer::testAddTopologicalPoints() QCOMPARE( layerLine->undoStack()->index(), 1 ); // outside of the linestring - nothing should happen - layerLine->addTopologicalPoints( QgsPoint( 2, 2 ) ); + layerLine->addTopologicalPoints( QgsPointXY( 2, 2 ) ); QCOMPARE( layerLine->undoStack()->index(), 1 ); QCOMPARE( layerLine->getFeature( fidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 3)" ) ); // add point at an existing vertex - layerLine->addTopologicalPoints( QgsPoint( 1, 1 ) ); + layerLine->addTopologicalPoints( QgsPointXY( 1, 1 ) ); QCOMPARE( layerLine->undoStack()->index(), 1 ); QCOMPARE( layerLine->getFeature( fidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 3)" ) ); // add point on segment of linestring - layerLine->addTopologicalPoints( QgsPoint( 1, 2 ) ); + layerLine->addTopologicalPoints( QgsPointXY( 1, 2 ) ); QCOMPARE( layerLine->undoStack()->index(), 2 ); QCOMPARE( layerLine->getFeature( fidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 2, 1 3)" ) ); diff --git a/tests/src/gui/testqgsrubberband.cpp b/tests/src/gui/testqgsrubberband.cpp index c0787b43c02..1f5cb0712bd 100644 --- a/tests/src/gui/testqgsrubberband.cpp +++ b/tests/src/gui/testqgsrubberband.cpp @@ -178,11 +178,11 @@ void TestQgsRubberband::testVisibility() // Add point without update mRubberband->reset( QgsWkbTypes::PolygonGeometry ); - mRubberband->addPoint( QgsPoint( 10, 10 ), false ); + mRubberband->addPoint( QgsPointXY( 10, 10 ), false ); QCOMPARE( mRubberband->isVisible(), false ); // Add point with update - mRubberband->addPoint( QgsPoint( 20, 20 ), true ); + mRubberband->addPoint( QgsPointXY( 20, 20 ), true ); QCOMPARE( mRubberband->isVisible(), true ); // Check visibility after zoom (should not be changed) @@ -200,9 +200,9 @@ void TestQgsRubberband::testClose() r.closePoints(); QCOMPARE( r.partSize( 0 ), 0 ); - r.addPoint( QgsPoint( 1, 2 ) ); - r.addPoint( QgsPoint( 1, 3 ) ); - r.addPoint( QgsPoint( 2, 3 ) ); + r.addPoint( QgsPointXY( 1, 2 ) ); + r.addPoint( QgsPointXY( 1, 3 ) ); + r.addPoint( QgsPointXY( 2, 3 ) ); QCOMPARE( r.partSize( 0 ), 3 ); // test with some bad geometry indexes - don't want to crash! diff --git a/tests/src/providers/grass/testqgsgrassprovider.cpp b/tests/src/providers/grass/testqgsgrassprovider.cpp index 933cc279ce6..4828de82962 100644 --- a/tests/src/providers/grass/testqgsgrassprovider.cpp +++ b/tests/src/providers/grass/testqgsgrassprovider.cpp @@ -917,7 +917,7 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands() TestQgsGrassFeature grassFeature; QgsLineString *line = nullptr; QgsGeometry *geometry = nullptr; - QList pointList; + QList pointList; // Start editing command = TestQgsGrassCommand( TestQgsGrassCommand::StartEditing ); @@ -929,7 +929,7 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands() command = TestQgsGrassCommand( TestQgsGrassCommand::AddFeature ); grassFeature = TestQgsGrassFeature( GV_POINT ); grassFeature.setId( 1 ); - geometry = new QgsGeometry( new QgsPointV2( QgsWkbTypes::Point, 10, 10, 0 ) ); + geometry = new QgsGeometry( new QgsPoint( QgsWkbTypes::Point, 10, 10, 0 ) ); grassFeature.setGeometry( *geometry ); delete geometry; command.grassFeatures << grassFeature; @@ -939,7 +939,7 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands() // Change geometry command = TestQgsGrassCommand( TestQgsGrassCommand::ChangeGeometry ); command.fid = 1; - command.geometry = new QgsGeometry( new QgsPointV2( QgsWkbTypes::Point, 20, 20, 0 ) ); + command.geometry = new QgsGeometry( new QgsPoint( QgsWkbTypes::Point, 20, 20, 0 ) ); commandGroup.commands << command; // Add field @@ -1021,8 +1021,8 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands() grassFeature.setId( 1 ); line = new QgsLineString(); pointList.clear(); - pointList << QgsPointV2( QgsWkbTypes::Point, 0, 0, 0 ); - pointList << QgsPointV2( QgsWkbTypes::Point, 20, 10, 0 ); + pointList << QgsPoint( QgsWkbTypes::Point, 0, 0, 0 ); + pointList << QgsPoint( QgsWkbTypes::Point, 20, 10, 0 ); line->setPoints( pointList ); pointList.clear(); geometry = new QgsGeometry( line ); @@ -1062,8 +1062,8 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands() grassFeature.setId( 1 ); line = new QgsLineString(); pointList.clear(); - pointList << QgsPointV2( QgsWkbTypes::Point, 0, 0, 0 ); - pointList << QgsPointV2( QgsWkbTypes::Point, 20, 10, 0 ); + pointList << QgsPoint( QgsWkbTypes::Point, 0, 0, 0 ); + pointList << QgsPoint( QgsWkbTypes::Point, 20, 10, 0 ); line->setPoints( pointList ); pointList.clear(); geometry = new QgsGeometry( line ); diff --git a/tests/src/python/acceptable_missing_doc.py b/tests/src/python/acceptable_missing_doc.py index dde34772a6c..f90cc36b1e2 100644 --- a/tests/src/python/acceptable_missing_doc.py +++ b/tests/src/python/acceptable_missing_doc.py @@ -82,7 +82,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsAddRemoveMultiFrameCommand": ["State", "QgsAddRemoveMultiFrameCommand(State s, QgsComposerMultiFrame *multiFrame, QgsComposition *c, const QString &text, QUndoCommand *parent=0)"], "QgsRelationReferenceFactory": ["QgsRelationReferenceFactory(const QString &name, QgsMapCanvas *canvas, QgsMessageBar *messageBar)"], "QgsDxfPaintDevice": ["setDrawingSize(QSizeF size)", "setLayer(const QString &layer)", "setOutputSize(const QRectF &r)", "QgsDxfPaintDevice(QgsDxfExport *dxf)", "setShift(QPointF shift)"], - "QgsPoint": ["operator-(const QgsPoint &p) const ", "operator-(QgsVector v) const ", "operator+=(QgsVector v)", "operator-=(QgsVector v)", "operator+(QgsVector v) const "], + "QgsPoint": ["operator-(const QgsPointXY &p) const ", "operator-(QgsVector v) const ", "operator+=(QgsVector v)", "operator-=(QgsVector v)", "operator+(QgsVector v) const "], "QgsVectorGradientColorRampDialog": ["setItemStopColor(const QColor &newColor)", "setColor1(const QColor &color)", "stopDoubleClicked(QTreeWidgetItem *item, int column)", "setStopColor(QTreeWidgetItem *item, const QColor &color)", "QgsVectorGradientColorRampDialog(QgsVectorGradientColorRamp *ramp, QWidget *parent=nullptr)", "setColor2(const QColor &color)", "addStop()", "toggledStops(bool on)", "removeStop()", "updateStops()", "updatePreview()"], "QgsCptCityColorRampDialog": ["clearCopyingInfo()", "showAll()", "saveAsGradientRamp() const ", "updatePreview(bool clear=false)", "setTreeModel(QgsCptCityBrowserModel *model)", "updateCopyingInfo(const QMap< QString, QString > ©ingMap)", "QgsCptCityColorRampDialog(QgsCptCityColorRamp *ramp, QWidget *parent=nullptr)", "updateTreeView(QgsCptCityDataItem *item, bool resetRamp=true)", "onFinished()", "updateRamp()", "populateVariants()", "updateListWidget(QgsCptCityDataItem *item)", "selectedName() const "], "QgsComposerMouseHandles": ["SnapGuideMode", "composition()", "QgsComposerMouseHandles(QgsComposition *composition)", "setComposition(QgsComposition *c)", "ItemPositionMode"], @@ -96,7 +96,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsCptCityDataItem": ["icon()", "setIcon(const QIcon &icon)", "emitEndRemoveItems()", "deleteChildItem(QgsCptCityDataItem *child)", "shortInfo() const ", "createChildren()", "refresh()", "Type", "addChildItem(QgsCptCityDataItem *child, bool refresh=false)", "equal(const QgsCptCityDataItem *other)", "toolTip() const ", "hasChildren()", "isPopulated()", "leafCount() const ", "setParent(QgsCptCityDataItem *parent)", "acceptDrop()", "name() const ", "actions()", "icon(QSize size)", "endRemoveItems()", "endInsertItems()", "paramWidget()", "beginInsertItems(QgsCptCityDataItem *parent, int first, int last)", "setToolTip(const QString &msg)", "parent() const ", "children() const ", "emitBeginInsertItems(QgsCptCityDataItem *parent, int first, int last)", "emitEndInsertItems()", "findItem(QVector< QgsCptCityDataItem * > items, QgsCptCityDataItem *item)", "rowCount()", "handleDrop(const QMimeData *, Qt::DropAction)", "QgsCptCityDataItem(QgsCptCityDataItem::Type type, QgsCptCityDataItem *parent, const QString &name, const QString &path)", "emitBeginRemoveItems(QgsCptCityDataItem *parent, int first, int last)", "info() const ", "populate()", "isValid()", "type() const ", "removeChildItem(QgsCptCityDataItem *child)", "beginRemoveItems(QgsCptCityDataItem *parent, int first, int last)", "path() const "], "QgsVectorLayerEditBuffer": ["committedAttributeValuesChanges(const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues)", "committedGeometriesChanges(const QString &layerId, const QgsGeometryMap &changedGeometries)", "featureDeleted(QgsFeatureId fid)", "committedFeaturesRemoved(const QString &layerId, const QgsFeatureIds &deletedFeatureIds)", "committedAttributesAdded(const QString &layerId, const QList< QgsField > &addedAttributes)", "committedFeaturesAdded(const QString &layerId, const QgsFeatureList &addedFeatures)", "attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &)", "updateFields(QgsFields &fields)", "QgsVectorLayerEditBuffer(QgsVectorLayer *layer)", "geometryChanged(QgsFeatureId fid, QgsGeometry &geom)", "updateLayerFields()", "deletedFeatureIds()", "featureAdded(QgsFeatureId fid)", "undoIndexChanged(int index)", "attributeAdded(int idx)", "attributeDeleted(int idx)"], "QgsRasterLayerSaveAsDialog": ["buildPyramidsFlag() const ", "outputRectangle() const ", "ResolutionState", "outputCrs()", "hideOutput()", "hideFormat()", "tileMode() const ", "nRows() const ", "yResolution() const ", "CrsState", "noData() const ", "createOptions() const ", "nColumns() const ", "addToCanvas() const ", "pyramidsList() const ", "Mode", "pyramidsConfigOptions() const ", "pyramidsFormat() const ", "mode() const ", "outputFormat() const ", "maximumTileSizeY() const ", "outputFileName() const ", "maximumTileSizeX() const ", "pyramidsResamplingMethod() const ", "xResolution() const ", "QgsRasterLayerSaveAsDialog(QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle ¤tExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem ¤tCrs, QWidget *parent=nullptr, Qt::WindowFlags f=0)"], - "QgsOSMNode": ["point() const ", "QgsOSMNode(QgsOSMId id, const QgsPoint &point)"], + "QgsOSMNode": ["point() const ", "QgsOSMNode(QgsOSMId id, const QgsPointXY &point)"], "QgsPointLocator_VisitorEdgesInRect": ["QgsPointLocator_VisitorEdgesInRect(QgsPointLocator *pl, QgsPointLocator::MatchList &lst, const QgsRectangle &srcRect, QgsPointLocator::MatchFilter *filter=nullptr)"], "QgsMapLayerLegendUtils": ["hasLegendNodeUserLabel(QgsLayerTreeLayer *nodeLayer, int originalIndex)", "hasLegendNodeOrder(QgsLayerTreeLayer *nodeLayer)", "setLegendNodeUserLabel(QgsLayerTreeLayer *nodeLayer, int originalIndex, const QString &newLabel)", "legendNodeOrder(QgsLayerTreeLayer *nodeLayer)", "legendNodeUserLabel(QgsLayerTreeLayer *nodeLayer, int originalIndex)", "setLegendNodeOrder(QgsLayerTreeLayer *nodeLayer, const QList< int > &order)"], "QgsMultiRenderChecker": ["setControlPathPrefix(const QString &prefix)"], @@ -246,7 +246,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsVectorDataProvider": ["convertValue(QVariant::Type type, const QString &value)", "clearMinMaxCache()", "pushError(const QString &msg)", "fillMinMaxCache()"], "pal::PriorityQueue": ["sort()", "getSizeByPos()", "getBest()", "getSize()", "setPriority(int key, double new_p)", "getId(int key)", "insert(int key, double p)", "upheap(int key)", "decreaseKey(int key)", "print()", "downheap(int id)", "remove(int key)", "isIn(int key)"], "QgsVectorFileWriter::StringOption": ["StringOption(const QString &docString, const QString &defaultValue=QString())"], - "QgsLabelPosition": ["QgsLabelPosition(int id, double r, const QVector< QgsPoint > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram=false, bool pinned=false, const QString &providerId=QString())"], + "QgsLabelPosition": ["QgsLabelPosition(int id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram=false, bool pinned=false, const QString &providerId=QString())"], "QgsColorRampComboBox": ["QgsColorRampComboBox(QWidget *parent=nullptr)", "colorRampChanged(int index)"], "QgsSvgSelectorWidget": ["imagesListView()", "svgSelected(const QString &path)", "filePathLineEdit()", "selectorLayout()", "QgsSvgSelectorWidget(QWidget *parent=0)", "relativePathCheckbox()", "currentSvgPathToName() const ", "currentSvgPath() const ", "groupsTreeView()", "filePathButton()", "create(QWidget *parent=nullptr)", "populateList()"], "QgsEnumerationWidgetWrapper": ["QgsEnumerationWidgetWrapper(QgsVectorLayer *vl, int fieldIdx, QWidget *editor=nullptr, QWidget *parent=nullptr)"], @@ -255,7 +255,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsNumericScaleBarStyle": ["QgsNumericScaleBarStyle(QgsComposerScaleBar *bar)"], "QgsSymbolRenderContext": ["renderContext() const ", "setMapUnitScale(const QgsMapUnitScale &scale)", "renderContext()", "outputUnit() const ", "outputLineWidth(double width) const ", "outputPixelSize(double size) const ", "selected() const ", "setRenderHints(int hints)", "QgsSymbolRenderContext(QgsRenderContext &c, QgsSymbol::OutputUnit u, qreal alpha=1.0, bool selected=false, int renderHints=0, const QgsFeature *f=nullptr, const QgsFields *fields=nullptr, const QgsMapUnitScale &mapUnitScale=QgsMapUnitScale())", "setSelected(bool selected)", "setOutputUnit(QgsSymbol::OutputUnit u)", "setFeature(const QgsFeature *f)", "renderHints() const ", "mapUnitScale() const "], "QgsIdentifyMenu": ["MenuLevel", "execWithSingleResult()", "allowMultipleReturn()", "resultsIfExternalAction()", "showFeatureActions()", "maxFeatureDisplay()", "maxLayerDisplay()"], - "QgsPointLocator_VisitorNearestEdge": ["QgsPointLocator_VisitorNearestEdge(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPoint &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)"], + "QgsPointLocator_VisitorNearestEdge": ["QgsPointLocator_VisitorNearestEdge(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)"], "ParametricLine": ["getControlPoint(int number) const =0", "getDegree() const =0", "calcPoint(float t, Point3D *)=0", "calcFirstDer(float t, Vector3D *v)=0", "remove(int i)=0", "setParent(ParametricLine *paral)=0", "calcSecDer(float t, Vector3D *v)=0", "getParent() const =0", "changeDirection()=0", "add(ParametricLine *pl)=0", "getControlPoly() const =0", "setControlPoly(QVector< Point3D * > *cp)=0"], "QgsComposerAttributeTable": ["QgsComposerAttributeTable(QgsComposition *composition)"], "QgisInterface": ["helpToolBar()=0", "actionToggleFullScreen()=0", "newLayerMenu()=0", "actionNodeTool()=0", "actionCopyFeatures()=0", "actionNewProject()=0", "actionNewVectorLayer()=0", "actionCancelEdits()=0", "actionSplitParts()=0", "actionShowComposerManager()=0", "actionHelpContents()=0", "actionOpenFieldCalculator()=0", "actionSaveProjectAs()=0", "actionLayerProperties()=0", "helpMenu()=0", "actionSimplifyFeature()=0", "actionAddAllToOverview()=0", "databaseMenu()=0", "actionCheckQgisVersion()=0", "actionSaveProject()=0", "actionCancelAllEdits()=0", "layerTreeView()=0", "advancedDigitizeToolBar()=0", "actionAbout()=0", "webMenu()=0", "actionDuplicateLayer()=0", "actionShowPythonDialog()=0", "vectorToolBar()=0", "actionPasteFeatures()=0", "actionPrintComposer()=0", "actionSplitFeatures()=0", "actionPluginListSeparator()=0", "pluginManagerInterface()=0", "actionRemoveAllFromOverview()=0", "digitizeToolBar()=0", "actionSaveActiveLayerEdits()=0", "firstRightStandardMenu()=0", "projectMenu()=0", "actionProjectProperties()=0", "actionCopyLayerStyle()=0", "actionAllEdits()=0", "actionAddOgrLayer()=0", "actionDeleteRing()=0", "actionAddWmsLayer()=0", "settingsMenu()=0", "actionAddRing()=0", "fileToolBar()=0", "editMenu()=0", "pluginMenu()=0", "mapNavToolToolBar()=0", "vectorMenu()=0", "actionCutFeatures()=0", "actionSaveMapAsImage()=0", "actionMoveFeature()=0", "windowMenu()=0", "actionShowSelectedLayers()=0", "actionDeleteSelected()=0", "actionOptions()=0", "layerToolBar()=0", "actionDeletePart()=0", "actionAddPgLayer()=0", "databaseToolBar()=0", "actionRollbackAllEdits()=0", "actionShowAllLayers()=0", "viewMenu()=0", "actionRollbackEdits()=0", "actionSaveAllEdits()=0", "actionPasteLayerStyle()=0", "actionQgisHomePage()=0", "attributesToolBar()=0", "actionExit()=0", "rasterToolBar()=0", "actionHideAllLayers()=0", "actionAddToOverview()=0", "layerMenu()=0", "actionToggleEditing()=0", "actionLayerSaveAs()=0", "actionManagePlugins()=0", "actionCustomProjection()=0", "rasterMenu()=0", "actionAddPart()=0", "pluginToolBar()=0", "actionRemoveLayer()=0", "actionOpenTable()=0", "actionSaveEdits()=0", "actionOpenProject()=0", "webToolBar()=0", "actionAddFeature()=0", "actionHideSelectedLayers()=0", "actionAddRasterLayer()=0"], @@ -278,7 +278,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsLayerTreeGroup": ["QgsLayerTreeGroup(const QString &name=QString(), Qt::CheckState checked=Qt::Checked)", "nodeVisibilityChanged(QgsLayerTreeNode *node)", "QgsLayerTreeGroup(const QgsLayerTreeGroup &other)", "layerDestroyed()"], "QgsSLConnect": ["sqlite3_close_v2(sqlite3 *)", "sqlite3_close(sqlite3 *)", "sqlite3_open(const char *filename, sqlite3 **ppDb)", "sqlite3_open_v2(const char *filename, sqlite3 **ppDb, int flags, const char *zVfs)"], "QgsVectorColorBrewerColorRamp": ["listSchemeNames()", "QgsVectorColorBrewerColorRamp(const QString &schemeName=DEFAULT_COLORBREWER_SCHEMENAME, int colors=DEFAULT_COLORBREWER_COLORS)", "setColors(int colors)", "loadPalette()", "colors() const ", "schemeName() const ", "create(const QgsStringMap &properties=QgsStringMap())", "setSchemeName(const QString &schemeName)", "listSchemeVariants(const QString &schemeName)"], - "QgsPointCompare": ["operator()(const QgsPoint &p1, const QgsPoint &p2) const ", "QgsPointCompare(double tolerance)"], + "QgsPointCompare": ["operator()(const QgsPointXY &p1, const QgsPointXY &p2) const ", "QgsPointCompare(double tolerance)"], "QgsRasterShaderFunction": ["minimumValue() const ", "QgsRasterShaderFunction(double minimumValue=0.0, double maximumValue=255.0)", "maximumValue() const ", "minimumMaximumRange() const ", "legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const "], "QgsRasterPyramidsOptionsWidget": ["pyramidsFormat() const ", "overviewList() const ", "overviewListChanged()", "QgsRasterPyramidsOptionsWidget(QWidget *parent=0, const QString &provider=\"gdal\")", "setRasterLayer(QgsRasterLayer *rasterLayer)", "checkAllLevels(bool checked)", "setRasterFileName(const QString &file)", "resamplingMethod() const ", "configOptions() const ", "someValueChanged()", "apply()", "createOptionsWidget()"], "QgsRasterFillSymbolLayerWidget": ["QgsRasterFillSymbolLayerWidget(const QgsVectorLayer *vl, QWidget *parent=nullptr)", "create(const QgsVectorLayer *vl)"], @@ -286,7 +286,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsComposerLabel": ["QgsComposerLabel(QgsComposition *composition)", "text()", "setHtmlState(int state)", "refreshExpressionContext()", "setText(const QString &text)", "font() const ", "htmlState()", "setFont(const QFont &f)"], "QgsDefaultPluginLayerLegend": ["QgsDefaultPluginLayerLegend(QgsPluginLayer *pl)"], "QgsLayerTreeRegistryBridge": ["groupWillRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)", "QgsLayerTreeRegistryBridge(QgsLayerTreeGroup *root, QObject *parent=nullptr)", "removeLayersFromRegistry(const QStringList &layerIds)", "isEnabled() const ", "layersAdded(const QList< QgsMapLayer * > &layers)", "newLayersVisible() const ", "setEnabled(bool enabled)", "layersWillBeRemoved(const QStringList &layerIds)", "setNewLayersVisible(bool enabled)", "groupRemovedChildren()"], - "QgsLabelComponent": ["setUseCenter(const bool use)", "setPictureBuffer(const double buffer)", "offset() const ", "dpiRatio() const ", "setSize(const QgsPoint &point)", "setRotation(const double rotation)", "picture() const ", "rotationOffset() const ", "setRotationOffset(const double rotation)", "setCenter(const QgsPoint &point)", "pictureBuffer() const ", "setDpiRatio(const double ratio)", "size() const ", "setUseRotation(const bool use)", "setPicture(QPicture *picture)", "text() const ", "center() const ", "setOrigin(const QgsPoint &point)", "setUseOrigin(const bool use)", "setText(const QString &text)", "useOrigin() const ", "useCenter() const ", "origin() const ", "setOffset(const QgsPoint &point)", "rotation() const ", "useRotation() const "], + "QgsLabelComponent": ["setUseCenter(const bool use)", "setPictureBuffer(const double buffer)", "offset() const ", "dpiRatio() const ", "setSize(const QgsPointXY &point)", "setRotation(const double rotation)", "picture() const ", "rotationOffset() const ", "setRotationOffset(const double rotation)", "setCenter(const QgsPointXY &point)", "pictureBuffer() const ", "setDpiRatio(const double ratio)", "size() const ", "setUseRotation(const bool use)", "setPicture(QPicture *picture)", "text() const ", "center() const ", "setOrigin(const QgsPointXY &point)", "setUseOrigin(const bool use)", "setText(const QString &text)", "useOrigin() const ", "useCenter() const ", "origin() const ", "setOffset(const QgsPointXY &point)", "rotation() const ", "useRotation() const "], "QgsMarkerSymbolLayer": ["setAngle(double angle)", "sizeMapUnitScale() const ", "scaleMethod() const ", "VerticalAnchorPoint", "offsetMapUnitScale() const ", "renderPoint(QPointF point, QgsSymbolRenderContext &context)=0", "setOffsetUnit(QgsSymbol::OutputUnit unit)", "setSizeUnit(QgsSymbol::OutputUnit unit)", "setVerticalAnchorPoint(VerticalAnchorPoint v)", "setHorizontalAnchorPoint(HorizontalAnchorPoint h)", "_rotatedOffset(QPointF offset, double angle)", "writeSldMarker(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const ", "offsetUnit() const ", "offset() const ", "sizeUnit() const ", "QgsMarkerSymbolLayer(bool locked=false)", "setSize(double size)", "setSizeMapUnitScale(const QgsMapUnitScale &scale)", "size() const ", "horizontalAnchorPoint() const ", "setScaleMethod(QgsSymbol::ScaleMethod scaleMethod)", "setOffset(QPointF offset)", "markerOffset(QgsSymbolRenderContext &context, double &offsetX, double &offsetY) const ", "verticalAnchorPoint() const ", "HorizontalAnchorPoint", "setOffsetMapUnitScale(const QgsMapUnitScale &scale)", "angle() const "], "QgsApplication": ["QgsApplication(int &argc, char **argv, bool GUIenabled, const QString &customConfigPath=QString(), const QString &platformName=\"desktop\")"], "QgsExpression::Visitor": ["visit(const NodeLiteral &n)=0", "visit(const NodeFunction &n)=0", "visit(const NodeCondition &n)=0", "visit(const NodeUnaryOperator &n)=0", "visit(const NodeInOperator &n)=0", "visit(const NodeBinaryOperator &n)=0", "visit(const NodeColumnRef &n)=0"], @@ -321,7 +321,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsExpressionFieldBuffer": ["None", "expressions() const "], "QgsGPSConnection": ["Status", "nmeaSentenceReceived(const QString &substring)", "stateChanged(const QgsGPSInformation &info)"], "QgsMapServiceException": ["code() const ", "QgsMapServiceException(const QString &code, const QString &message)", "message() const "], - "QgsMapToPixel": ["toMapPoint(double x, double y) const ", "transform(QgsPoint *p) const ", "transformInPlace(float &x, float &y) const ", "toMapCoordinates(int x, int y) const ", "transform() const "], + "QgsMapToPixel": ["toMapPoint(double x, double y) const ", "transform(QgsPointXY *p) const ", "transformInPlace(float &x, float &y) const ", "toMapCoordinates(int x, int y) const ", "transform() const "], "QgsPenJoinStyleComboBox": ["penJoinStyle() const ", "setPenJoinStyle(Qt::PenJoinStyle style)", "QgsPenJoinStyleComboBox(QWidget *parent=nullptr)"], "QgsPaintEngineHack": ["fixEngineFlags(QPaintEngine *engine)", "fixFlags()"], "QgsRasterDataProvider": ["colorName(int colorInterpretation) const ", "progressUpdate(int progress)", "identifyFormatToCapability(QgsRaster::IdentifyFormat format)", "makeTableCell(const QString &value)", "identifyFormatName(QgsRaster::IdentifyFormat format)", "setUserNoDataValue(int bandNo, const QgsRasterRangeList &noData)", "colorTable(int bandNo) const ", "identifyFormatLabel(QgsRaster::IdentifyFormat format)", "makeTableCells(const QStringList &values)", "identifyFormatFromName(const QString &formatName)", "QgsRasterDataProvider(const QString &uri)", "colorInterpretationName(int bandNo) const "], @@ -378,7 +378,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsDataDefinedAssistant": ["dataDefined() const =0"], "QgsTransaction": ["QgsTransaction(const QString &connString)"], "QgsBrowserTreeView": ["hasExpandedDescendant(const QModelIndex &index) const ", "setSettingsSection(const QString §ion)", "QgsBrowserTreeView(QWidget *parent=0)"], - "QgsDistanceArea": ["computePolygonFlatArea(const QList< QgsPoint > &points) const "], + "QgsDistanceArea": ["computePolygonFlatArea(const QList< QgsPointXY > &points) const "], "QgsContrastEnhancement": ["writeXML(QDomDocument &doc, QDomElement &parentElem) const ", "QgsContrastEnhancement(const QgsContrastEnhancement &ce)", "QgsContrastEnhancement(Qgis::DataType datatype=Qgis::Byte)", "contrastEnhancementAlgorithm() const ", "readXML(const QDomElement &elem)", "contrastEnhancementAlgorithmFromString(const QString &contrastEnhancementString)", "contrastEnhancementAlgorithmString(ContrastEnhancementAlgorithm algorithm)"], "QgsExpression::Interval": ["Interval(double seconds=0)"], "QgsManageConnectionsDialog": ["doExportImport()", "selectionChanged()", "Mode", "clearSelection()", "QgsManageConnectionsDialog(QWidget *parent=nullptr, Mode mode=Export, Type type=WMS, const QString &fileName=\"\")", "selectAll()", "Type"], @@ -396,14 +396,14 @@ ACCEPTABLE_MISSING_DOCS = { "QgsRasterMatrix": ["setNodataValue(double d)", "greaterThan(const QgsRasterMatrix &other)", "changeSign()", "nodataValue() const ", "cosinus()", "lesserEqual(const QgsRasterMatrix &other)", "logicalAnd(const QgsRasterMatrix &other)", "TwoArgOperator", "log()", "divide(const QgsRasterMatrix &other)", "log10()", "QgsRasterMatrix(const QgsRasterMatrix &m)", "setData(int cols, int rows, double *data, double nodataValue)", "greaterEqual(const QgsRasterMatrix &other)", "equal(const QgsRasterMatrix &other)", "sinus()", "asinus()", "logicalOr(const QgsRasterMatrix &other)", "squareRoot()", "nColumns() const ", "OneArgOperator", "atangens()", "number() const ", "lesserThan(const QgsRasterMatrix &other)", "tangens()", "acosinus()", "power(const QgsRasterMatrix &other)", "multiply(const QgsRasterMatrix &other)", "nRows() const ", "notEqual(const QgsRasterMatrix &other)"], "QgsLayerTreeView": ["layerForIndex(const QModelIndex &index) const ", "updateExpandedStateToNode(const QModelIndex &index)", "QgsLayerTreeView(QWidget *parent=0)", "modelRowsRemoved()", "onExpandedChanged(QgsLayerTreeNode *node, bool expanded)", "updateExpandedStateFromNode(QgsLayerTreeNode *node)", "modelRowsInserted(const QModelIndex &index, int start, int end)", "onModelReset()", "onCurrentChanged()"], "QgsCredentials": ["put(const QString &realm, const QString &username, const QString &password)", "getMasterPassword(QString &password, bool stored=false)", "get(const QString &realm, QString &username, QString &password, const QString &message=QString::null)"], - "QgsSnappingUtils": ["QgsSnappingUtils(QObject *parent=0)", "IndexingStrategy", "snapToMap(const QgsPoint &pointMap, QgsPointLocator::MatchFilter *filter=nullptr)", "currentLayer() const ", "mapSettings() const "], + "QgsSnappingUtils": ["QgsSnappingUtils(QObject *parent=0)", "IndexingStrategy", "snapToMap(const QgsPointXY &pointMap, QgsPointLocator::MatchFilter *filter=nullptr)", "currentLayer() const ", "mapSettings() const "], "QgsComposerRuler": ["Direction", "QgsComposerRuler(QgsComposerRuler::Direction d)", "updateMarker(QPointF pos)", "setComposition(QgsComposition *c)", "setSceneTransform(const QTransform &transform)", "composition()", "rulerSize()"], "QgsSimplifyMethod": ["MethodType"], "QgsComposerTextTable": ["QgsComposerTextTable(QgsComposition *c)"], "QgsDataItemProviderFromPlugin": ["QgsDataItemProviderFromPlugin(const QString &name, dataCapabilities_t *capabilitiesFunc, dataItem_t *dataItemFunc)"], "QgsMessageLogViewer": ["QgsMessageLogViewer(QStatusBar *statusBar=nullptr, QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)", "logMessage(QString message, QString tag, QgsMessageLog::MessageLevel level)"], - "QgsAnnotationItem": ["drawSelectionBoxes(QPainter *p)", "mapPositionFixed() const ", "frameBackgroundColor() const ", "MouseMoveAction", "markerSymbol() const ", "offsetFromReferencePoint() const ", "frameColor() const ", "setFrameSize(QSizeF size)", "minimumFrameSize() const ", "setFrameStrokeWidth(double w)", "setFrameColor(const QColor &c)", "writeXML(QDomDocument &doc) const =0", "setOffsetFromReferencePoint(QPointF offset)", "frameStrokeWidth() const ", "_readXML(const QDomDocument &doc, const QDomElement &annotationElem)", "setMapPosition(const QgsPoint &pos)", "drawFrame(QPainter *p)", "readXML(const QDomDocument &doc, const QDomElement &itemElem)=0", "QgsAnnotationItem(QgsMapCanvas *mapCanvas)", "updateBoundingRect()", "_writeXML(QDomDocument &doc, QDomElement &itemElem) const ", "setMapPositionFixed(bool fixed)", "mapPosition() const ", "frameSize() const ", "setFrameBackgroundColor(const QColor &c)", "drawMarkerSymbol(QPainter *p)"], - "QgsVertexMarker": ["QgsVertexMarker(QgsMapCanvas *mapCanvas)", "setColor(const QColor &color)", "setIconSize(int iconSize)", "setCenter(const QgsPoint &point)", "setPenWidth(int width)", "setIconType(int iconType)"], + "QgsAnnotationItem": ["drawSelectionBoxes(QPainter *p)", "mapPositionFixed() const ", "frameBackgroundColor() const ", "MouseMoveAction", "markerSymbol() const ", "offsetFromReferencePoint() const ", "frameColor() const ", "setFrameSize(QSizeF size)", "minimumFrameSize() const ", "setFrameStrokeWidth(double w)", "setFrameColor(const QColor &c)", "writeXML(QDomDocument &doc) const =0", "setOffsetFromReferencePoint(QPointF offset)", "frameStrokeWidth() const ", "_readXML(const QDomDocument &doc, const QDomElement &annotationElem)", "setMapPosition(const QgsPointXY &pos)", "drawFrame(QPainter *p)", "readXML(const QDomDocument &doc, const QDomElement &itemElem)=0", "QgsAnnotationItem(QgsMapCanvas *mapCanvas)", "updateBoundingRect()", "_writeXML(QDomDocument &doc, QDomElement &itemElem) const ", "setMapPositionFixed(bool fixed)", "mapPosition() const ", "frameSize() const ", "setFrameBackgroundColor(const QColor &c)", "drawMarkerSymbol(QPainter *p)"], + "QgsVertexMarker": ["QgsVertexMarker(QgsMapCanvas *mapCanvas)", "setColor(const QColor &color)", "setIconSize(int iconSize)", "setCenter(const QgsPointXY &point)", "setPenWidth(int width)", "setIconType(int iconType)"], "QgsAttributeFormLegacyInterface": ["QgsAttributeFormLegacyInterface(const QString &function, const QString &pyFormName, QgsAttributeForm *form)"], "QgsLongLongValidator": ["QgsLongLongValidator(qint64 bottom, qint64 top, QObject *parent)", "setTop(qint64 top)", "setRange(qint64 bottom, qint64 top)", "bottom() const ", "setBottom(qint64 bottom)", "QgsLongLongValidator(QObject *parent)", "top() const "], "QgsPalLayerSettings": ["DataDefinedProperties", "ShapeType", "DirectionSymbols", "UpsideDownLabels", "QuadrantPosition", "MultiLineAlign", "writeToLayer(QgsVectorLayer *layer)", "RotationType", "ShadowType", "calculateLabelSize(const QFontMetricsF *fm, QString text, double &labelX, double &labelY, QgsFeature *f=nullptr, QgsRenderContext *context=nullptr)", "QgsPalLayerSettings(const QgsPalLayerSettings &s)", "SizeType", "readFromLayer(QgsVectorLayer *layer)"], @@ -414,10 +414,10 @@ ACCEPTABLE_MISSING_DOCS = { "QgsExternalResourceWidget": ["DocumentViewerContent", "setDocumentPath(const QVariant &documentPath)"], "QgsCoordinateTransformCache": ["instance()"], "QgsCptCityDirectoryItem": ["QgsCptCityDirectoryItem(QgsCptCityDataItem *parent, const QString &name, const QString &path)", "rampsMap()", "dataItem(QgsCptCityDataItem *parent, const QString &name, const QString &path)", "dirEntries() const "], - "QgsGeometry::Error": ["Error(const QString &m, const QgsPoint &p)", "Error(const QString &m)", "hasWhere()", "what()", "where()"], + "QgsGeometry::Error": ["Error(const QString &m, const QgsPointXY &p)", "Error(const QString &m)", "hasWhere()", "what()", "where()"], "QgsConstWkbPtr": ["operator+=(int n)", "operator>>(double &v) const ", "operator>>(int &v) const ", "QgsConstWkbPtr(const unsigned char *p, int size)", "operator>>(char &v) const ", "operator const unsigned char *() const ", "remaining() const ", "operator-=(int n)", "readHeader() const ", "operator>>(unsigned int &v) const ", "operator>>(float &r) const "], "QgsExternalResourceConfigDlg": ["QgsExternalResourceConfigDlg(QgsVectorLayer *vl, int fieldIdx, QWidget *parent=0)"], - "QgsPointLocator_VisitorNearestVertex": ["QgsPointLocator_VisitorNearestVertex(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPoint &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)"], + "QgsPointLocator_VisitorNearestVertex": ["QgsPointLocator_VisitorNearestVertex(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)"], "QgsConditionalStyle": ["QgsConditionalStyle(const QgsConditionalStyle &other)", "QgsConditionalStyle(const QString &rule)"], "QgsColorEffectWidget": ["QgsColorEffectWidget(QWidget *parent=nullptr)", "create()"], "QgsRaster": ["RasterProgressType", "RasterPyramidsFormat", "IdentifyFormat", "contrastEnhancementLimitsAsString(QgsRaster::ContrastEnhancementLimits limits)", "contrastEnhancementLimitsFromString(const QString &limits)", "RasterBuildPyramids", "ColorInterpretation"], @@ -429,14 +429,14 @@ ACCEPTABLE_MISSING_DOCS = { "pal::GeomFunction": ["cross_product(double x1, double y1, double x2, double y2, double x3, double y3)", "dist_euc2d(double x1, double y1, double x2, double y2)", "findLineCircleIntersection(double cx, double cy, double radius, double x1, double y1, double x2, double y2, double &xRes, double &yRes)", "dist_euc2d_sq(double x1, double y1, double x2, double y2)"], "QgsSizeScaleWidget": ["QgsSizeScaleWidget(const QgsVectorLayer *layer, const QgsSymbol *symbol)"], "QgsSVGFillSymbolLayer": ["svgStrokeWidth() const ", "QgsSVGFillSymbolLayer(const QString &svgFilePath=\"\", double width=20, double rotation=0.0)", "svgFilePath() const ", "patternWidthMapUnitScale() const ", "setPatternWidthUnit(QgsSymbol::OutputUnit unit)", "setSvgStrokeWidthUnit(QgsSymbol::OutputUnit unit)", "setSvgFilePath(const QString &svgPath)", "setSvgStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)", "setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)", "patternWidthUnit() const ", "setSvgStrokeWidth(double w)", "svgStrokeColor() const ", "setSvgStrokeColor(const QColor &c)", "patternWidth() const ", "createFromSld(QDomElement &element)", "svgFillColor() const ", "svgStrokeWidthMapUnitScale() const ", "setPatternWidth(double width)", "svgStrokeWidthUnit() const ", "setSvgFillColor(const QColor &c)", "create(const QgsStringMap &properties=QgsStringMap())", "QgsSVGFillSymbolLayer(const QByteArray &svgData, double width=20, double rotation=0.0)"], - "QgsMapToolIdentify": ["formatChanged(QgsRasterLayer *layer)", "changedRasterResults(QList< IdentifyResult > &)", "identifyProgress(int, int)", "Type", "identifyVectorLayer(QList< IdentifyResult > *results, QgsVectorLayer *layer, const QgsPoint &point)", "IdentifyMode", "identifyRasterLayer(QList< IdentifyResult > *results, QgsRasterLayer *layer, QgsPoint point, const QgsRectangle &viewExtent, double mapUnitsPerPixel)", "identifyMessage(const QString &)"], + "QgsMapToolIdentify": ["formatChanged(QgsRasterLayer *layer)", "changedRasterResults(QList< IdentifyResult > &)", "identifyProgress(int, int)", "Type", "identifyVectorLayer(QList< IdentifyResult > *results, QgsVectorLayer *layer, const QgsPointXY &point)", "IdentifyMode", "identifyRasterLayer(QList< IdentifyResult > *results, QgsRasterLayer *layer, QgsPointXY point, const QgsRectangle &viewExtent, double mapUnitsPerPixel)", "identifyMessage(const QString &)"], "QgsLayerPropertiesWidget": ["updateSymbolLayerWidget(QgsSymbolLayer *layer)", "changed()", "populateLayerTypes()", "emitSignalChanged()", "QgsLayerPropertiesWidget(QgsSymbolLayer *layer, const QgsSymbol *symbol, const QgsVectorLayer *vl, QWidget *parent=nullptr)", "changeLayer(QgsSymbolLayer *)", "layerTypeChanged()"], "pal::PointSet": ["getBoundingBox(double min[2], double max[2]) const ", "compute_chull_bbox()", "getGeosType() const ", "invalidateGeos()", "extractShape(int nbPtSh, int imin, int imax, int fps, int fpe, double fptx, double fpty)", "PointSet(double x, double y)", "getNumPoints() const ", "createGeosGeom() const ", "preparedGeom() const ", "deleteCoords()", "getCentroid(double &px, double &py, bool forceInside=false) const ", "PointSet(int nbPoints, double *x, double *y)", "PointSet(const PointSet &ps)"], "QgsComposerScaleBar": ["unitLabeling() const ", "numSegmentsLeft() const ", "setNumSegments(int nSegments)", "labelBarSpace() const ", "numSegments() const ", "updateSegmentSize()", "QgsComposerScaleBar(QgsComposition *composition)", "composerMap() const ", "setComposerMap(const QgsComposerMap *map)", "setNumSegmentsLeft(int nSegmentsLeft)", "setFont(const QFont &font)", "setBoxContentSpace(double space)", "numUnitsPerSegment() const ", "setHeight(double h)", "setUnits(ScaleBarUnits u)", "setNumMapUnitsPerScaleBarUnit(double d)", "units() const ", "setAlignment(Alignment a)", "ScaleBarUnits", "boxContentSpace() const ", "setUnitLabeling(const QString &label)", "setLabelBarSpace(double space)", "font() const ", "setNumUnitsPerSegment(double units)", "numMapUnitsPerScaleBarUnit() const ", "segmentMillimeters() const ", "height() const ", "Alignment"], "QgsExpression::NodeList": ["dump() const ", "count()", "list()"], "QgsComposerAttributeTableV2": ["QgsComposerAttributeTableV2(QgsComposition *composition, bool createUndoCommands)"], "QgsMapLayerLegend": ["QgsMapLayerLegend(QObject *parent=0)"], - "QgsGeometryEngine": ["buffer(double distance, int segments, QString *errorMsg=nullptr) const =0", "contains(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "prepareGeometry()=0", "length(QString *errorMsg=nullptr) const =0", "splitGeometry(const QgsLineString &splitLine, QList< QgsAbstractGeometry * > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg=nullptr) const ", "within(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "geometryChanged()=0", "overlaps(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "interpolate(double distance, QString *errorMsg=nullptr) const =0", "intersection(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "centroid(QgsPointV2 &pt, QString *errorMsg=nullptr) const =0", "simplify(double tolerance, QString *errorMsg=nullptr) const =0", "QgsGeometryEngine(const QgsAbstractGeometry *geometry)", "isValid(QString *errorMsg=nullptr) const =0", "area(QString *errorMsg=nullptr) const =0", "combine(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "combine(const QList< QgsAbstractGeometry * > &, QString *errorMsg=nullptr) const =0", "isEmpty(QString *errorMsg) const =0", "envelope(QString *errorMsg=nullptr) const =0", "touches(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "distance(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "disjoint(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "convexHull(QString *errorMsg=nullptr) const =0", "offsetCurve(double distance, int segments, int joinStyle, double mitreLimit, QString *errorMsg=nullptr) const =0", "buffer(double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString *errorMsg=nullptr) const =0", "pointOnSurface(QgsPointV2 &pt, QString *errorMsg=nullptr) const =0", "intersects(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "difference(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "symDifference(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "isEqual(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "crosses(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0"], + "QgsGeometryEngine": ["buffer(double distance, int segments, QString *errorMsg=nullptr) const =0", "contains(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "prepareGeometry()=0", "length(QString *errorMsg=nullptr) const =0", "splitGeometry(const QgsLineString &splitLine, QList< QgsAbstractGeometry * > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg=nullptr) const ", "within(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "geometryChanged()=0", "overlaps(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "interpolate(double distance, QString *errorMsg=nullptr) const =0", "intersection(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "centroid(QgsPoint &pt, QString *errorMsg=nullptr) const =0", "simplify(double tolerance, QString *errorMsg=nullptr) const =0", "QgsGeometryEngine(const QgsAbstractGeometry *geometry)", "isValid(QString *errorMsg=nullptr) const =0", "area(QString *errorMsg=nullptr) const =0", "combine(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "combine(const QList< QgsAbstractGeometry * > &, QString *errorMsg=nullptr) const =0", "isEmpty(QString *errorMsg) const =0", "envelope(QString *errorMsg=nullptr) const =0", "touches(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "distance(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "disjoint(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "convexHull(QString *errorMsg=nullptr) const =0", "offsetCurve(double distance, int segments, int joinStyle, double mitreLimit, QString *errorMsg=nullptr) const =0", "buffer(double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString *errorMsg=nullptr) const =0", "pointOnSurface(QgsPoint &pt, QString *errorMsg=nullptr) const =0", "intersects(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "difference(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "symDifference(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "isEqual(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0", "crosses(const QgsAbstractGeometry &geom, QString *errorMsg=nullptr) const =0"], "QgsMapToolAdvancedDigitizing": ["cadDockWidget() const "], "QgsCptCityBrowserModel": ["findItem(QgsCptCityDataItem *item, QgsCptCityDataItem *parent=nullptr) const ", "QgsCptCityBrowserModel(QObject *parent=nullptr, QgsCptCityArchive *archive=QgsCptCityArchive::defaultArchive(), ViewType Type=Authors)", "endInsertItems()", "reload()", "beginInsertItems(QgsCptCityDataItem *parent, int first, int last)", "addRootItems()", "connectItem(QgsCptCityDataItem *item)", "refresh(const QString &path)", "beginRemoveItems(QgsCptCityDataItem *parent, int first, int last)", "endRemoveItems()", "refresh(const QModelIndex &index=QModelIndex())", "ViewType", "removeRootItems()"], "QgsComposerPicture": ["QgsComposerPicture(QgsComposition *composition)"], @@ -511,7 +511,7 @@ ACCEPTABLE_MISSING_DOCS = { "QgsDialog": ["QgsDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, const QDialogButtonBox::StandardButtons &buttons=QDialogButtonBox::Close, Qt::Orientation orientation=Qt::Horizontal)"], "QgsDartMeasurement": ["typeToString(Type type)", "send() const ", "Type", "QgsDartMeasurement(const QString &name, Type type, const QString &value)", "toString() const "], "QgsDirectoryParamWidget": ["showHideColumn()", "QgsDirectoryParamWidget(const QString &path, QWidget *parent=nullptr)"], - "QgsGeometryUtils": ["componentType", "closestSegmentFromComponents(T &container, componentType ctype, const QgsPointV2 &pt, QgsPointV2 &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon)"], + "QgsGeometryUtils": ["componentType", "closestSegmentFromComponents(T &container, componentType ctype, const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon)"], "QgsProjectionSelectionWidget": ["QgsProjectionSelectionWidget(QWidget *parent=0)"], "QgsLinePatternFillSymbolLayer": ["setOffsetUnit(QgsSymbol::OutputUnit unit)", "distance() const ", "lineWidthUnit() const ", "lineWidth() const ", "offsetMapUnitScale() const ", "setOffsetMapUnitScale(const QgsMapUnitScale &scale)", "offsetUnit() const ", "lineAngle() const ", "createFromSld(QDomElement &element)", "ogrFeatureStyleWidth(double widthScaleFactor) const ", "distanceUnit() const ", "setLineAngle(double a)", "lineWidthMapUnitScale() const ", "offset() const ", "distanceMapUnitScale() const ", "setDistanceMapUnitScale(const QgsMapUnitScale &scale)", "setDistance(double d)", "setOffset(double offset)", "setLineWidthMapUnitScale(const QgsMapUnitScale &scale)", "setLineWidth(double w)", "create(const QgsStringMap &properties=QgsStringMap())", "setDistanceUnit(QgsSymbol::OutputUnit unit)", "setLineWidthUnit(QgsSymbol::OutputUnit unit)"], "QgsColorButton": ["transpBkgrd()"], diff --git a/tests/src/python/offlineditingtestbase.py b/tests/src/python/offlineditingtestbase.py index 392dd345872..6183f507d22 100644 --- a/tests/src/python/offlineditingtestbase.py +++ b/tests/src/python/offlineditingtestbase.py @@ -43,16 +43,16 @@ from qgis.core import ( # Tet features, fields: [id, name, geometry] # "id" is used as a pk to retriev features by attribute TEST_FEATURES = [ - (1, 'name 1', QgsPoint(9, 45)), - (2, 'name 2', QgsPoint(9.5, 45.5)), - (3, 'name 3', QgsPoint(9.5, 46)), - (4, 'name 4', QgsPoint(10, 46.5)), + (1, 'name 1', QgsPointXY(9, 45)), + (2, 'name 2', QgsPointXY(9.5, 45.5)), + (3, 'name 3', QgsPointXY(9.5, 46)), + (4, 'name 4', QgsPointXY(10, 46.5)), ] # Additional features for insert test TEST_FEATURES_INSERT = [ - (5, 'name 5', QgsPoint(9.7, 45.7)), - (6, 'name 6', QgsPoint(10.6, 46.6)), + (5, 'name 5', QgsPointXY(9.7, 45.7)), + (6, 'name 6', QgsPointXY(10.6, 46.6)), ] @@ -152,7 +152,7 @@ class OfflineTestBase(object): feat2 = self._getFeatureByAttribute(offline_layer, 'name', "'name 2'") self.assertTrue(offline_layer.startEditing()) self.assertTrue(offline_layer.changeAttributeValue(feat2.id(), offline_layer.fields().lookupField('name'), 'name 2 edited')) - self.assertTrue(offline_layer.changeGeometry(feat2.id(), QgsGeometry.fromPoint(QgsPoint(33.0, 60.0)))) + self.assertTrue(offline_layer.changeGeometry(feat2.id(), QgsGeometry.fromPoint(QgsPointXY(33.0, 60.0)))) self.assertTrue(offline_layer.commitChanges()) feat2 = self._getFeatureByAttribute(offline_layer, 'name', "'name 2 edited'") self.assertTrue(ol.isOfflineProject()) @@ -167,7 +167,7 @@ class OfflineTestBase(object): # Check that data have changed in the backend (raise exception if not found) feat2 = self._getFeatureByAttribute(self._getLayer('test_point'), 'name', "'name 2 edited'") feat2 = self._getFeatureByAttribute(online_layer, 'name', "'name 2 edited'") - self.assertEqual(feat2.geometry().asPoint().toString(), QgsPoint(33.0, 60.0).toString()) + self.assertEqual(feat2.geometry().asPoint().toString(), QgsPointXY(33.0, 60.0).toString()) # Check that all other features have not changed layer = self._getLayer('test_point') self.assertTrue(self._compareFeature(layer, TEST_FEATURES[1 - 1])) diff --git a/tests/src/python/test_layer_dependencies.py b/tests/src/python/test_layer_dependencies.py index 8b99f60554b..976acf796ed 100644 --- a/tests/src/python/test_layer_dependencies.py +++ b/tests/src/python/test_layer_dependencies.py @@ -120,7 +120,7 @@ class TestLayerDependencies(unittest.TestCase): m = u.snapToMap(QPoint(95, 100)) self.assertTrue(m.isValid()) self.assertTrue(m.hasVertex()) - self.assertEqual(m.point(), QgsPoint(1, 0)) + self.assertEqual(m.point(), QgsPointXY(1, 0)) f = QgsFeature(self.linesLayer.fields()) f.setId(1) @@ -151,7 +151,7 @@ class TestLayerDependencies(unittest.TestCase): m = u.snapToMap(QPoint(45, 50)) self.assertTrue(m.isValid()) self.assertTrue(m.hasVertex()) - self.assertEqual(m.point(), QgsPoint(0.5, 0.5)) + self.assertEqual(m.point(), QgsPointXY(0.5, 0.5)) self.pointsLayer.setDependencies([]) # test chained layer dependencies A -> B -> C @@ -173,7 +173,7 @@ class TestLayerDependencies(unittest.TestCase): m = u.snapToMap(QPoint(75, 100 - 80)) self.assertTrue(m.isValid()) self.assertTrue(m.hasVertex()) - self.assertEqual(m.point(), QgsPoint(0.7, 0.8)) + self.assertEqual(m.point(), QgsPointXY(0.7, 0.8)) self.pointsLayer.setDependencies([]) self.pointsLayer2.setDependencies([]) @@ -254,7 +254,7 @@ class TestLayerDependencies(unittest.TestCase): m = u.snapToMap(QPoint(75, 100 - 0)) self.assertTrue(m.isValid()) self.assertTrue(m.hasVertex()) - self.assertEqual(m.point(), QgsPoint(0.8, 0.0)) + self.assertEqual(m.point(), QgsPointXY(0.8, 0.0)) self.pointsLayer.setDependencies([]) self.pointsLayer2.setDependencies([]) diff --git a/tests/src/python/test_provider_memory.py b/tests/src/python/test_provider_memory.py index bbaa2aee56a..e70c04855db 100644 --- a/tests/src/python/test_provider_memory.py +++ b/tests/src/python/test_provider_memory.py @@ -191,7 +191,7 @@ class TestPyQgsMemoryProvider(unittest.TestCase, ProviderTestCase): assert len(provider.fields()) == 3, myMessage ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes(["Johny", 20, 0.3]) @@ -239,7 +239,7 @@ class TestPyQgsMemoryProvider(unittest.TestCase, ProviderTestCase): assert len(provider.fields()) == 3, myMessage ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes(["Johny", 20, 0.3]) @@ -310,7 +310,7 @@ class TestPyQgsMemoryProvider(unittest.TestCase, ProviderTestCase): layer.updateFields() assert res, "Failed to add attributes" ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes(["Johny", 20, 0.3]) diff --git a/tests/src/python/test_provider_spatialite.py b/tests/src/python/test_provider_spatialite.py index ef2b33595b1..f6bda86534e 100644 --- a/tests/src/python/test_provider_spatialite.py +++ b/tests/src/python/test_provider_spatialite.py @@ -259,8 +259,8 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase): self.assertTrue(layer.isValid()) self.assertTrue(layer.hasGeometryType()) layer.startEditing() - self.assertEqual(layer.splitFeatures([QgsPoint(0.75, -0.5), QgsPoint(0.75, 1.5)], 0), 0) - self.assertEqual(layer.splitFeatures([QgsPoint(-0.5, 0.25), QgsPoint(1.5, 0.25)], 0), 0) + self.assertEqual(layer.splitFeatures([QgsPointXY(0.75, -0.5), QgsPointXY(0.75, 1.5)], 0), 0) + self.assertEqual(layer.splitFeatures([QgsPointXY(-0.5, 0.25), QgsPointXY(1.5, 0.25)], 0), 0) self.assertTrue(layer.commitChanges()) self.assertEqual(layer.featureCount(), 4) @@ -270,8 +270,8 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase): self.assertTrue(layer.isValid()) self.assertTrue(layer.hasGeometryType()) layer.startEditing() - self.assertEqual(layer.splitFeatures([QgsPoint(0.5, -0.5), QgsPoint(0.5, 1.5)], 0), 0) - self.assertEqual(layer.splitFeatures([QgsPoint(-0.5, 0.5), QgsPoint(1.5, 0.5)], 0), 0) + self.assertEqual(layer.splitFeatures([QgsPointXY(0.5, -0.5), QgsPointXY(0.5, 1.5)], 0), 0) + self.assertEqual(layer.splitFeatures([QgsPointXY(-0.5, 0.5), QgsPointXY(1.5, 0.5)], 0), 0) self.assertTrue(layer.commitChanges()) def test_queries(self): diff --git a/tests/src/python/test_provider_wfs.py b/tests/src/python/test_provider_wfs.py index f62fa470ebf..8f4e55a150d 100644 --- a/tests/src/python/test_provider_wfs.py +++ b/tests/src/python/test_provider_wfs.py @@ -2057,7 +2057,7 @@ class TestPyQgsWFSProvider(unittest.TestCase, ProviderTestCase): self.assertEqual(len(features), 0) # Check that the approx extent contains the geometry - assert vl.extent().contains(QgsPoint(2, 49)) + assert vl.extent().contains(QgsPointXY(2, 49)) def testGeomedia(self): """Test various interoperability specifities that occur with Geomedia Web Server.""" diff --git a/tests/src/python/test_qgsatlascomposition.py b/tests/src/python/test_qgsatlascomposition.py index 193c1651c6b..4a2fed2d3c5 100644 --- a/tests/src/python/test_qgsatlascomposition.py +++ b/tests/src/python/test_qgsatlascomposition.py @@ -266,12 +266,12 @@ class TestQgsAtlasComposition(unittest.TestCase): f1.initAttributes(2) f1.setAttribute(0, 1) f1.setAttribute(1, "Test label 1") - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(-0.638, 48.954))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(-0.638, 48.954))) f2 = QgsFeature(2) f2.initAttributes(2) f2.setAttribute(0, 2) f2.setAttribute(1, "Test label 2") - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(-1.682, 48.550))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(-1.682, 48.550))) pr.addFeatures([f1, f2]) # categorized symbology diff --git a/tests/src/python/test_qgsattributetablemodel.py b/tests/src/python/test_qgsattributetablemodel.py index 74894b37170..3176401db3a 100644 --- a/tests/src/python/test_qgsattributetablemodel.py +++ b/tests/src/python/test_qgsattributetablemodel.py @@ -56,7 +56,7 @@ class TestQgsAttributeTableModel(unittest.TestCase): for i in range(10): f = QgsFeature() f.setAttributes(["test", i]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100 * i, 2 ^ i))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100 * i, 2 ^ i))) features.append(f) self.assertTrue(pr.addFeatures(features)) @@ -79,7 +79,7 @@ class TestQgsAttributeTableModel(unittest.TestCase): f = QgsFeature() f.setAttributes(["test", 8]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) self.layer.addFeature(f) self.assertEqual(self.am.rowCount(), 11) diff --git a/tests/src/python/test_qgsbearingutils.py b/tests/src/python/test_qgsbearingutils.py index 1c161e4d135..5ff59de3969 100644 --- a/tests/src/python/test_qgsbearingutils.py +++ b/tests/src/python/test_qgsbearingutils.py @@ -32,26 +32,26 @@ class TestQgsBearingUtils(unittest.TestCase): # short circuit - already a geographic crs crs = QgsCoordinateReferenceSystem.fromEpsgId(4326) - self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(0, 0)), 0) - self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(44, 0)), 0) - self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(44, -43)), 0) - self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(44, 43)), 0) + self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(0, 0)), 0) + self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(44, 0)), 0) + self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(44, -43)), 0) + self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(44, 43)), 0) - self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(44, 200)), 0) - self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(44, -200)), 0) + self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(44, 200)), 0) + self.assertEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(44, -200)), 0) # no short circuit crs = QgsCoordinateReferenceSystem.fromEpsgId(3111) - self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(2508807, 2423425)), 0.06, 2) + self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(2508807, 2423425)), 0.06, 2) # try a south-up crs crs = QgsCoordinateReferenceSystem.fromEpsgId(2053) - self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(29, -27.55)), -180.0, 1) + self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(29, -27.55)), -180.0, 1) # try a north pole crs crs = QgsCoordinateReferenceSystem.fromEpsgId(3575) - self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(-780770, 652329)), 129.9, 1) - self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPoint(513480, 873173)), -149.5, 1) + self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(-780770, 652329)), 129.9, 1) + self.assertAlmostEqual(QgsBearingUtils.bearingTrueNorth(crs, QgsPointXY(513480, 873173)), -149.5, 1) if __name__ == '__main__': diff --git a/tests/src/python/test_qgsbox3d.py b/tests/src/python/test_qgsbox3d.py index 16213fd7a39..5f95d6e995e 100644 --- a/tests/src/python/test_qgsbox3d.py +++ b/tests/src/python/test_qgsbox3d.py @@ -35,7 +35,7 @@ class TestQgsBox3d(unittest.TestCase): self.assertEqual(box.yMaximum(), 11.0) self.assertEqual(box.zMaximum(), 12.0) - box = QgsBox3d(QgsPointV2(QgsWkbTypes.PointZ, 5, 6, 7), QgsPointV2(QgsWkbTypes.PointZ, 10, 11, 12)) + box = QgsBox3d(QgsPoint(QgsWkbTypes.PointZ, 5, 6, 7), QgsPoint(QgsWkbTypes.PointZ, 10, 11, 12)) self.assertEqual(box.xMinimum(), 5.0) self.assertEqual(box.yMinimum(), 6.0) self.assertEqual(box.zMinimum(), 7.0) @@ -44,7 +44,7 @@ class TestQgsBox3d(unittest.TestCase): self.assertEqual(box.zMaximum(), 12.0) # point constructor should normalize - box = QgsBox3d(QgsPointV2(QgsWkbTypes.PointZ, 10, 11, 12), QgsPointV2(QgsWkbTypes.PointZ, 5, 6, 7)) + box = QgsBox3d(QgsPoint(QgsWkbTypes.PointZ, 10, 11, 12), QgsPoint(QgsWkbTypes.PointZ, 5, 6, 7)) self.assertEqual(box.xMinimum(), 5.0) self.assertEqual(box.yMinimum(), 6.0) self.assertEqual(box.zMinimum(), 7.0) @@ -137,14 +137,14 @@ class TestQgsBox3d(unittest.TestCase): def testContainsPoint(self): box = QgsBox3d(5.0, 6.0, 7.0, 11.0, 13.0, 15.0) - self.assertTrue(box.contains(QgsPointV2(QgsWkbTypes.PointZ, 6, 7, 8))) - self.assertFalse(box.contains(QgsPointV2(QgsWkbTypes.PointZ, 16, 7, 8))) - self.assertFalse(box.contains(QgsPointV2(QgsWkbTypes.PointZ, 6, 17, 8))) - self.assertFalse(box.contains(QgsPointV2(QgsWkbTypes.PointZ, 6, 7, 18))) + self.assertTrue(box.contains(QgsPoint(QgsWkbTypes.PointZ, 6, 7, 8))) + self.assertFalse(box.contains(QgsPoint(QgsWkbTypes.PointZ, 16, 7, 8))) + self.assertFalse(box.contains(QgsPoint(QgsWkbTypes.PointZ, 6, 17, 8))) + self.assertFalse(box.contains(QgsPoint(QgsWkbTypes.PointZ, 6, 7, 18))) # 2d containment - self.assertTrue(box.contains(QgsPointV2(QgsWkbTypes.Point, 6, 7))) - self.assertFalse(box.contains(QgsPointV2(QgsWkbTypes.Point, 16, 7))) - self.assertFalse(box.contains(QgsPointV2(QgsWkbTypes.Point, 6, 17))) + self.assertTrue(box.contains(QgsPoint(QgsWkbTypes.Point, 6, 7))) + self.assertFalse(box.contains(QgsPoint(QgsWkbTypes.Point, 16, 7))) + self.assertFalse(box.contains(QgsPoint(QgsWkbTypes.Point, 6, 17))) def testVolume(self): box = QgsBox3d(5.0, 6.0, 7.0, 11.0, 13.0, 15.0) diff --git a/tests/src/python/test_qgscomposition.py b/tests/src/python/test_qgscomposition.py index 22d72fd8b5f..cfd972766f2 100644 --- a/tests/src/python/test_qgscomposition.py +++ b/tests/src/python/test_qgscomposition.py @@ -48,7 +48,7 @@ class TestQgsComposition(unittest.TestCase): """Test that we can use degree symbols in substitutions. """ # Create a point and convert it to text containing a degree symbol. - myPoint = QgsPoint(12.3, -33.33) + myPoint = QgsPointXY(12.3, -33.33) myCoordinates = myPoint.toDegreesMinutesSeconds(2) myTokens = myCoordinates.split(',') myLongitude = myTokens[0] diff --git a/tests/src/python/test_qgsdistancearea.py b/tests/src/python/test_qgsdistancearea.py index 92081a0aa4b..59c02a8e8d5 100644 --- a/tests/src/python/test_qgsdistancearea.py +++ b/tests/src/python/test_qgsdistancearea.py @@ -48,7 +48,7 @@ class TestQgsDistanceArea(unittest.TestCase): # | | # +-+ + linestring = QgsGeometry.fromPolyline( - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ] ) da = QgsDistanceArea() length = da.measureLength(linestring) @@ -82,13 +82,13 @@ class TestQgsDistanceArea(unittest.TestCase): # 1998-10-02 SRID=3068;POINT(23082.30 20267.80) # 1998-10-02 SRID=4326;POINT(13.37625537334001 52.50926345498337) # values returned by spatialite - point_soldner_1924 = QgsPoint(23099.49, 20296.69) - point_soldner_1998 = QgsPoint(23082.30, 20267.80) + point_soldner_1924 = QgsPointXY(23099.49, 20296.69) + point_soldner_1998 = QgsPointXY(23082.30, 20267.80) distance_soldner_meters = 33.617379 azimuth_soldner_1924 = 3.678339 # ST_Transform(point_soldner_1924,point_soldner_1998,4326) - point_wsg84_1924 = QgsPoint(13.37650707988041, 52.50952361017194) - point_wsg84_1998 = QgsPoint(13.37625537334001, 52.50926345498337) + point_wsg84_1924 = QgsPointXY(13.37650707988041, 52.50952361017194) + point_wsg84_1998 = QgsPointXY(13.37625537334001, 52.50926345498337) # ST_Distance(point_wsg84_1924,point_wsg84_1998,1) distance_wsg84_meters = 33.617302 # ST_Distance(point_wsg84_1924,point_wsg84_1998) @@ -100,28 +100,28 @@ class TestQgsDistanceArea(unittest.TestCase): azimuth_wsg84_1998 = 0.533282 # ST_Project(point_wsg84_1924,33.617302,3.674878) # SRID=4326;POINT(13.37625537318728 52.50926345503591) - point_soldner_1998_project = QgsPoint(13.37625537318728, 52.50926345503591) + point_soldner_1998_project = QgsPointXY(13.37625537318728, 52.50926345503591) # ST_Project(point_wsg84_1998,33.617302,0.533282) # SRID=4326;POINT(13.37650708009255 52.50952361009799) - point_soldner_1924_project = QgsPoint(13.37650708009255, 52.50952361009799) + point_soldner_1924_project = QgsPointXY(13.37650708009255, 52.50952361009799) distance_qpoint = point_soldner_1924.distance(point_soldner_1998) azimuth_qpoint = point_soldner_1924.azimuth(point_soldner_1998) point_soldner_1998_result = point_soldner_1924.project(distance_qpoint, azimuth_qpoint) - point_soldner_1924_result = QgsPoint(0, 0) - point_soldner_1998_result = QgsPoint(0, 0) + point_soldner_1924_result = QgsPointXY(0, 0) + point_soldner_1998_result = QgsPointXY(0, 0) # Test meter based projected point from point_1924 to point_1998 length_1998_mapunits, point_soldner_1998_result = da_3068.measureLineProjected(point_soldner_1924, distance_soldner_meters, azimuth_qpoint) self.assertEqual(point_soldner_1998_result.toString(6), point_soldner_1998.toString(6)) # Test degree based projected point from point_1924 1 meter due East - point_wsg84_meter_result = QgsPoint(0, 0) - point_wsg84_1927_meter = QgsPoint(13.37652180838435, 52.50952361017102) + point_wsg84_meter_result = QgsPointXY(0, 0) + point_wsg84_1927_meter = QgsPointXY(13.37652180838435, 52.50952361017102) length_meter_mapunits, point_wsg84_meter_result = da_wsg84.measureLineProjected(point_wsg84_1924, 1.0, (math.pi / 2)) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, QgsUnitTypes.DistanceDegrees, True), '0.0000147 deg') self.assertEqual(point_wsg84_meter_result.toString(7), point_wsg84_1927_meter.toString(7)) - point_wsg84_1998_result = QgsPoint(0, 0) + point_wsg84_1998_result = QgsPointXY(0, 0) length_1928_mapunits, point_wsg84_1998_result = da_wsg84.measureLineProjected(point_wsg84_1924, distance_wsg84_meters, azimuth_wsg84_1924) self.assertEqual(QgsDistanceArea.formatDistance(length_1928_mapunits, 7, QgsUnitTypes.DistanceDegrees, True), distance_wsg84_mapunits_format) self.assertEqual(point_wsg84_1998_result.toString(7), point_wsg84_1998.toString(7)) @@ -169,202 +169,202 @@ class TestQgsDistanceArea(unittest.TestCase): self.assertEqual(da_25833.sourceCrs().authid(), 'EPSG:25833') # Berlin - Brandenburg Gate - Quadriga - point_berlin_3068 = QgsPoint(23183.38449999984, 21047.3225000017) + point_berlin_3068 = QgsPointXY(23183.38449999984, 21047.3225000017) point_berlin_3068_project = point_berlin_3068.project(1, (math.pi / 2)) - point_meter_result = QgsPoint(0, 0) + point_meter_result = QgsPointXY(0, 0) length_meter_mapunits, point_meter_result = da_3068.measureLineProjected(point_berlin_3068, 1.0, (math.pi / 2)) pprint(point_meter_result) print('-I-> Berlin 3068 length_meter_mapunits[{}] point_meter_result[{}]'.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_3068.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 1, da_3068.lengthUnits(), True), '1.0 m') self.assertEqual(point_meter_result.toString(7), point_berlin_3068_project.toString(7)) - point_berlin_wsg84 = QgsPoint(13.37770458660236, 52.51627178856762) - point_berlin_wsg84_project = QgsPoint(13.37771931736259, 52.51627178856669) + point_berlin_wsg84 = QgsPointXY(13.37770458660236, 52.51627178856762) + point_berlin_wsg84_project = QgsPointXY(13.37771931736259, 52.51627178856669) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_berlin_wsg84, 1.0, (math.pi / 2)) print('-I-> Berlin Wsg84 length_meter_mapunits[{}] point_meter_result[{}] ellipsoid[{}]'.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText(), da_wsg84.ellipsoid())) # for unknown reasons, this is returning '0.00001473026 m' instead of '0.00001473026 deg' when using da_wsg84.lengthUnits() # self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits,11,da_wsg84.lengthUnits(),True), '0.00001473026 deg') self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 11, QgsUnitTypes.DistanceDegrees, True), '0.00001473026 deg') self.assertEqual(point_meter_result.toString(7), point_berlin_wsg84_project.toString(7)) - point_berlin_4314 = QgsPoint(13.37944343021465, 52.51767872437083) - point_berlin_4314_project = QgsPoint(13.37945816324759, 52.5176787243699) + point_berlin_4314 = QgsPointXY(13.37944343021465, 52.51767872437083) + point_berlin_4314_project = QgsPointXY(13.37945816324759, 52.5176787243699) length_meter_mapunits, point_meter_result = da_4314.measureLineProjected(point_berlin_4314, 1.0, (math.pi / 2)) print('-I-> Berlin 4314 length_meter_mapunits[{}] point_meter_result[{}]'.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_4314.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 9, QgsUnitTypes.DistanceDegrees, True), '0.000014733 deg') self.assertEqual(point_meter_result.toString(7), point_berlin_4314_project.toString(7)) - point_berlin_4805 = QgsPoint(31.04960570069176, 52.5174657497405) - point_berlin_4805_project = QgsPoint(31.04962043365347, 52.51746574973957) + point_berlin_4805 = QgsPointXY(31.04960570069176, 52.5174657497405) + point_berlin_4805_project = QgsPointXY(31.04962043365347, 52.51746574973957) length_meter_mapunits, point_meter_result = da_4805.measureLineProjected(point_berlin_4805, 1.0, (math.pi / 2)) print('-I-> Berlin 4805 length_meter_mapunits[{}] point_meter_result[{}]'.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_4805.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 9, QgsUnitTypes.DistanceDegrees, True), '0.000014733 deg') self.assertEqual(point_meter_result.toString(7), point_berlin_4805_project.toString(7)) - point_berlin_25833 = QgsPoint(389918.0748318382, 5819698.772194743) + point_berlin_25833 = QgsPointXY(389918.0748318382, 5819698.772194743) point_berlin_25833_project = point_berlin_25833.project(1, (math.pi / 2)) length_meter_mapunits, point_meter_result = da_25833.measureLineProjected(point_berlin_25833, 1.0, (math.pi / 2)) print('-I-> Berlin 25833 length_meter_mapunits[{}] point_meter_result[{}]'.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_25833.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_25833.lengthUnits(), True), '1.0000000 m') self.assertEqual(point_meter_result.toString(7), point_berlin_25833_project.toString(7)) - point_berlin_5665 = QgsPoint(3389996.871728864, 5822169.719727578) + point_berlin_5665 = QgsPointXY(3389996.871728864, 5822169.719727578) point_berlin_5665_project = point_berlin_5665.project(1, (math.pi / 2)) length_meter_mapunits, point_meter_result = da_5665.measureLineProjected(point_berlin_5665, 1.0, (math.pi / 2)) print('-I-> Berlin 5665 length_meter_mapunits[{}] point_meter_result[{}]'.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_5665.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 1, da_5665.lengthUnits(), True), '1.0 m') self.assertEqual(point_meter_result.toString(7), point_berlin_5665_project.toString(7)) print('\n12 points ''above over'' and on the Equator') - point_wsg84 = QgsPoint(25.7844, 71.1725) - point_wsg84_project = QgsPoint(25.78442775215388, 71.17249999999795) + point_wsg84 = QgsPointXY(25.7844, 71.1725) + point_wsg84_project = QgsPointXY(25.78442775215388, 71.17249999999795) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Nordkap, Norway - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, QgsUnitTypes.DistanceDegrees, True), '0.0000278 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(24.95995, 60.16841) - point_wsg84_project = QgsPoint(24.95996801277454, 60.16840999999877) + point_wsg84 = QgsPointXY(24.95995, 60.16841) + point_wsg84_project = QgsPointXY(24.95996801277454, 60.16840999999877) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Helsinki, Finnland - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001801 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(12.599278, 55.692861) - point_wsg84_project = QgsPoint(12.59929390161872, 55.69286099999897) + point_wsg84 = QgsPointXY(12.599278, 55.692861) + point_wsg84_project = QgsPointXY(12.59929390161872, 55.69286099999897) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Copenhagen, Denmark - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001590 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-0.001389, 51.477778) - point_wsg84_project = QgsPoint(-0.001374606184398, 51.4777779999991) + point_wsg84 = QgsPointXY(-0.001389, 51.477778) + point_wsg84_project = QgsPointXY(-0.001374606184398, 51.4777779999991) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Royal Greenwich Observatory, United Kingdom - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001439 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(7.58769, 47.55814) - point_wsg84_project = QgsPoint(7.587703287209086, 47.55813999999922) + point_wsg84 = QgsPointXY(7.58769, 47.55814) + point_wsg84_project = QgsPointXY(7.587703287209086, 47.55813999999922) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Basel, Switzerland - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001329 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(11.255278, 43.775278) - point_wsg84_project = QgsPoint(11.25529042107924, 43.77527799999933) + point_wsg84 = QgsPointXY(11.255278, 43.775278) + point_wsg84_project = QgsPointXY(11.25529042107924, 43.77527799999933) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Florenz, Italy - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001242 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(14.514722, 35.899722) - point_wsg84_project = QgsPoint(14.51473307693308, 35.89972199999949) + point_wsg84 = QgsPointXY(14.514722, 35.899722) + point_wsg84_project = QgsPointXY(14.51473307693308, 35.89972199999949) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Valletta, Malta - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001108 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-79.933333, 32.783333) - point_wsg84_project = QgsPoint(-79.93332232547254, 32.78333299999955) + point_wsg84 = QgsPointXY(-79.933333, 32.783333) + point_wsg84_project = QgsPointXY(-79.93332232547254, 32.78333299999955) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Charlston, South Carolina - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001067 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-17.6666666, 27.733333) - point_wsg84_project = QgsPoint(-17.66665645831515, 27.73333299999962) + point_wsg84 = QgsPointXY(-17.6666666, 27.733333) + point_wsg84_project = QgsPointXY(-17.66665645831515, 27.73333299999962) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Ferro, Spain - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001014 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-99.133333, 19.433333) - point_wsg84_project = QgsPoint(-99.1333234776827, 19.43333299999975) + point_wsg84 = QgsPointXY(-99.133333, 19.433333) + point_wsg84_project = QgsPointXY(-99.1333234776827, 19.43333299999975) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Mexico City, Mexico - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000952 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-79.894444, 9.341667) - point_wsg84_project = QgsPoint(-79.89443489691369, 9.341666999999882) + point_wsg84 = QgsPointXY(-79.894444, 9.341667) + point_wsg84_project = QgsPointXY(-79.89443489691369, 9.341666999999882) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Colón, Panama - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000910 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-74.075833, 4.598056) - point_wsg84_project = QgsPoint(-74.07582398803629, 4.598055999999943) + point_wsg84 = QgsPointXY(-74.075833, 4.598056) + point_wsg84_project = QgsPointXY(-74.07582398803629, 4.598055999999943) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Bogotá, Colombia - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000901 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(0, 0) - point_wsg84_project = QgsPoint(0.000008983152841, 0) + point_wsg84 = QgsPointXY(0, 0) + point_wsg84_project = QgsPointXY(0.000008983152841, 0) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Equator, Atlantic Ocean - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000898 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) print('\n12 points ''down under'' and 1 point that should be considered invalid') - point_wsg84 = QgsPoint(-78.509722, -0.218611) - point_wsg84_project = QgsPoint(-78.50971301678221, -0.218610999999997) + point_wsg84 = QgsPointXY(-78.509722, -0.218611) + point_wsg84_project = QgsPointXY(-78.50971301678221, -0.218610999999997) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Quito, Ecuador - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000898 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(106.816667, -6.2) - point_wsg84_project = QgsPoint(106.8166760356519, -6.199999999999922) + point_wsg84 = QgsPointXY(106.816667, -6.2) + point_wsg84_project = QgsPointXY(106.8166760356519, -6.199999999999922) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Jakarta, Indonesia - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000904 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-77.018611, -12.035) - point_wsg84_project = QgsPoint(-77.01860181630058, -12.03499999999985) + point_wsg84 = QgsPointXY(-77.018611, -12.035) + point_wsg84_project = QgsPointXY(-77.01860181630058, -12.03499999999985) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Lima, Peru - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000918 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(25.466667, -10.716667) - point_wsg84_project = QgsPoint(25.46667614155322, -10.71666699999986) + point_wsg84 = QgsPointXY(25.466667, -10.716667) + point_wsg84_project = QgsPointXY(25.46667614155322, -10.71666699999986) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Kolwezi, Congo - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000914 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-70.333333, -18.483333) - point_wsg84_project = QgsPoint(-70.3333235314429, -18.48333299999976) + point_wsg84 = QgsPointXY(-70.333333, -18.483333) + point_wsg84_project = QgsPointXY(-70.3333235314429, -18.48333299999976) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Arica, Chile - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00000947 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-70.666667, -33.45) - point_wsg84_project = QgsPoint(-70.66665624452817, -33.44999999999953) + point_wsg84 = QgsPointXY(-70.666667, -33.45) + point_wsg84_project = QgsPointXY(-70.66665624452817, -33.44999999999953) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Santiago, Chile - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001076 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(147.29, -42.88) - point_wsg84_project = QgsPoint(147.2900122399815, -42.87999999999934) + point_wsg84 = QgsPointXY(147.29, -42.88) + point_wsg84_project = QgsPointXY(147.2900122399815, -42.87999999999934) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Hobart City,Tasmania, Australia - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001224 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(168.101667, -46.899722) - point_wsg84_project = QgsPoint(168.101680123673, -46.89972199999923) + point_wsg84 = QgsPointXY(168.101667, -46.899722) + point_wsg84_project = QgsPointXY(168.101680123673, -46.89972199999923) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Ryan''s Creek Aerodrome, New Zealand - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001312 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-69.216667, -51.633333) - point_wsg84_project = QgsPoint(-69.21665255700216, -51.6333329999991) + point_wsg84 = QgsPointXY(-69.216667, -51.633333) + point_wsg84_project = QgsPointXY(-69.21665255700216, -51.6333329999991) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Río Gallegos, Argentina - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001444 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-68.3, -54.8) - point_wsg84_project = QgsPoint(-68.29998445081456, -54.79999999999899) + point_wsg84 = QgsPointXY(-68.3, -54.8) + point_wsg84_project = QgsPointXY(-68.29998445081456, -54.79999999999899) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Ushuaia, Tierra del Fuego, Argentina - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00001555 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-63.494444, -64.825278) - point_wsg84_project = QgsPoint(-63.49442294002932, -64.82527799999851) + point_wsg84 = QgsPointXY(-63.494444, -64.825278) + point_wsg84_project = QgsPointXY(-63.49442294002932, -64.82527799999851) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Port Lockroy, Antarctica - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00002106 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-180, -84.863272250) - point_wsg84_project = QgsPoint(-179.9999000000025, -84.8632722499922) + point_wsg84 = QgsPointXY(-180, -84.863272250) + point_wsg84_project = QgsPointXY(-179.9999000000025, -84.8632722499922) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-I-> Someware, Antarctica - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00010000 deg') self.assertEqual(point_meter_result.toString(7), point_wsg84_project.toString(7)) - point_wsg84 = QgsPoint(-180, -85.0511300) - point_wsg84_project = QgsPoint(-179.9998962142197, -85.05112999999191) + point_wsg84 = QgsPointXY(-180, -85.0511300) + point_wsg84_project = QgsPointXY(-179.9998962142197, -85.05112999999191) length_meter_mapunits, point_meter_result = da_wsg84.measureLineProjected(point_wsg84, 1.0, (math.pi / 2)) print('-W-> Mercator''s Last Stop, Antarctica - Wsg84 - length_meter_mapunits[{}] point_meter_result[{}] '.format(QgsDistanceArea.formatDistance(length_meter_mapunits, 7, da_wsg84.lengthUnits(), True), point_meter_result.wellKnownText())) self.assertEqual(QgsDistanceArea.formatDistance(length_meter_mapunits, 8, QgsUnitTypes.DistanceDegrees, True), '0.00010379 deg') @@ -376,8 +376,8 @@ class TestQgsDistanceArea(unittest.TestCase): # +-+ + + +-+ linestring = QgsGeometry.fromMultiPolyline( [ - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ], - [QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(5, 1), QgsPoint(5, 0), QgsPoint(6, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ], + [QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(5, 1), QgsPointXY(5, 0), QgsPointXY(6, 0), ] ] ) da = QgsDistanceArea() @@ -394,7 +394,7 @@ class TestQgsDistanceArea(unittest.TestCase): # +-+ polygon = QgsGeometry.fromPolygon( [[ - QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), + QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]] ) @@ -415,8 +415,8 @@ class TestQgsDistanceArea(unittest.TestCase): # +-+-+-+ polygon = QgsGeometry.fromPolygon( [ - [QgsPoint(0, 0), QgsPoint(3, 0), QgsPoint(3, 3), QgsPoint(0, 3), QgsPoint(0, 0)], - [QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)], + [QgsPointXY(0, 0), QgsPointXY(3, 0), QgsPointXY(3, 3), QgsPointXY(0, 3), QgsPointXY(0, 0)], + [QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)], ] ) da = QgsDistanceArea() @@ -435,8 +435,8 @@ class TestQgsDistanceArea(unittest.TestCase): # +-+ +-+ polygon = QgsGeometry.fromMultiPolygon( [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), ]], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0), ]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0), ]] ] ) @@ -468,7 +468,7 @@ class TestQgsDistanceArea(unittest.TestCase): # We check both the measured length AND the units, in case the logic regarding # ellipsoids and units changes in future - distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3)) + distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3)) units = da.lengthUnits() print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units)))) @@ -476,7 +476,7 @@ class TestQgsDistanceArea(unittest.TestCase): (abs(distance - 248.52) < 0.01 and units == QgsUnitTypes.DistanceMeters)) da.setEllipsoid("WGS84") - distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3)) + distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3)) units = da.lengthUnits() print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units)))) @@ -492,7 +492,7 @@ class TestQgsDistanceArea(unittest.TestCase): da.setSourceCrs(QgsCoordinateReferenceSystem.fromSrsId(27469)) da.setEllipsoid("NONE") # measurement should be in feet - distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3)) + distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3)) units = da.lengthUnits() print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units)))) self.assertAlmostEqual(distance, 2.23606797, delta=0.000001) @@ -504,7 +504,7 @@ class TestQgsDistanceArea(unittest.TestCase): da.setEllipsoid("WGS84") # now should be in Meters again - distance = da.measureLine(QgsPoint(1, 1), QgsPoint(2, 3)) + distance = da.measureLine(QgsPointXY(1, 1), QgsPointXY(2, 3)) units = da.lengthUnits() print(("measured {} in {}".format(distance, QgsUnitTypes.toString(units)))) self.assertAlmostEqual(distance, 0.67953772, delta=0.000001) @@ -525,7 +525,7 @@ class TestQgsDistanceArea(unittest.TestCase): polygon = QgsGeometry.fromPolygon( [[ - QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), + QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]] ) @@ -554,7 +554,7 @@ class TestQgsDistanceArea(unittest.TestCase): # now try with a source CRS which is in feet polygon = QgsGeometry.fromPolygon( [[ - QgsPoint(1850000, 4423000), QgsPoint(1851000, 4423000), QgsPoint(1851000, 4424000), QgsPoint(1852000, 4424000), QgsPoint(1852000, 4425000), QgsPoint(1851000, 4425000), QgsPoint(1850000, 4423000) + QgsPointXY(1850000, 4423000), QgsPointXY(1851000, 4423000), QgsPointXY(1851000, 4424000), QgsPointXY(1852000, 4424000), QgsPointXY(1852000, 4425000), QgsPointXY(1851000, 4425000), QgsPointXY(1850000, 4423000) ]] ) da.setSourceCrs(QgsCoordinateReferenceSystem.fromSrsId(27469)) diff --git a/tests/src/python/test_qgseditwidgets.py b/tests/src/python/test_qgseditwidgets.py index b3302007bd8..c5322812172 100644 --- a/tests/src/python/test_qgseditwidgets.py +++ b/tests/src/python/test_qgseditwidgets.py @@ -38,7 +38,7 @@ class TestQgsTextEditWidget(unittest.TestCase): pr = self.layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) assert pr.addFeatures([f]) assert self.layer.pendingFeatureCount() == 1 return self.layer diff --git a/tests/src/python/test_qgsfeature.py b/tests/src/python/test_qgsfeature.py index adba731acae..a5f8a18ece4 100644 --- a/tests/src/python/test_qgsfeature.py +++ b/tests/src/python/test_qgsfeature.py @@ -28,7 +28,7 @@ class TestQgsFeature(unittest.TestCase): feat = QgsFeature() feat.initAttributes(1) feat.setAttribute(0, "text") - feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(123, 456))) + feat.setGeometry(QgsGeometry.fromPoint(QgsPointXY(123, 456))) myId = feat.id() myExpectedId = 0 myMessage = '\nExpected: %s\nGot: %s' % (myExpectedId, myId) @@ -132,7 +132,7 @@ class TestQgsFeature(unittest.TestCase): def test_SetGeometry(self): feat = QgsFeature() - feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(123, 456))) + feat.setGeometry(QgsGeometry.fromPoint(QgsPointXY(123, 456))) myGeometry = feat.geometry() myExpectedGeometry = "!None" myMessage = '\nExpected: %s\nGot: %s' % (myExpectedGeometry, myGeometry) diff --git a/tests/src/python/test_qgsfeaturesink.py b/tests/src/python/test_qgsfeaturesink.py index cbf99ec487e..0d35b8f6ec2 100644 --- a/tests/src/python/test_qgsfeaturesink.py +++ b/tests/src/python/test_qgsfeaturesink.py @@ -35,19 +35,19 @@ def createLayerWithFivePoints(): pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setAttributes(["test2", 457]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(200, 200))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(200, 200))) f3 = QgsFeature() f3.setAttributes(["test2", 888]) - f3.setGeometry(QgsGeometry.fromPoint(QgsPoint(300, 200))) + f3.setGeometry(QgsGeometry.fromPoint(QgsPointXY(300, 200))) f4 = QgsFeature() f4.setAttributes(["test3", -1]) - f4.setGeometry(QgsGeometry.fromPoint(QgsPoint(400, 300))) + f4.setGeometry(QgsGeometry.fromPoint(QgsPointXY(400, 300))) f5 = QgsFeature() f5.setAttributes(["test4", 0]) - f5.setGeometry(QgsGeometry.fromPoint(QgsPoint(0, 0))) + f5.setGeometry(QgsGeometry.fromPoint(QgsPointXY(0, 0))) assert pr.addFeatures([f, f2, f3, f4, f5]) assert layer.featureCount() == 5 return layer @@ -80,17 +80,17 @@ class TestQgsFeatureSink(unittest.TestCase): f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) proxy.addFeature(f) self.assertEqual(len(store), 1) self.assertEqual(store.features()[0]['fldtxt'], 'test') f2 = QgsFeature() f2.setAttributes(["test2", 457]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(200, 200))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(200, 200))) f3 = QgsFeature() f3.setAttributes(["test3", 888]) - f3.setGeometry(QgsGeometry.fromPoint(QgsPoint(300, 200))) + f3.setGeometry(QgsGeometry.fromPoint(QgsPointXY(300, 200))) proxy.addFeatures([f2, f3]) self.assertEqual(len(store), 3) self.assertEqual(store.features()[1]['fldtxt'], 'test2') diff --git a/tests/src/python/test_qgsgeometry.py b/tests/src/python/test_qgsgeometry.py index c588648f749..a2fd93602af 100644 --- a/tests/src/python/test_qgsgeometry.py +++ b/tests/src/python/test_qgsgeometry.py @@ -106,38 +106,38 @@ class TestQgsGeometry(unittest.TestCase): self.assertEqual(geom.geometry().geometryN(1).y(), 31) def testFromPoint(self): - myPoint = QgsGeometry.fromPoint(QgsPoint(10, 10)) + myPoint = QgsGeometry.fromPoint(QgsPointXY(10, 10)) self.assertEqual(myPoint.wkbType(), QgsWkbTypes.Point) def testFromMultiPoint(self): myMultiPoint = QgsGeometry.fromMultiPoint([ - (QgsPoint(0, 0)), (QgsPoint(1, 1))]) + (QgsPointXY(0, 0)), (QgsPointXY(1, 1))]) self.assertEqual(myMultiPoint.wkbType(), QgsWkbTypes.MultiPoint) def testFromLine(self): - myLine = QgsGeometry.fromPolyline([QgsPoint(1, 1), QgsPoint(2, 2)]) + myLine = QgsGeometry.fromPolyline([QgsPointXY(1, 1), QgsPointXY(2, 2)]) self.assertEqual(myLine.wkbType(), QgsWkbTypes.LineString) def testFromMultiLine(self): myMultiPolyline = QgsGeometry.fromMultiPolyline( - [[QgsPoint(0, 0), QgsPoint(1, 1)], [QgsPoint(0, 1), QgsPoint(2, 1)]]) + [[QgsPointXY(0, 0), QgsPointXY(1, 1)], [QgsPointXY(0, 1), QgsPointXY(2, 1)]]) self.assertEqual(myMultiPolyline.wkbType(), QgsWkbTypes.MultiLineString) def testFromPolygon(self): myPolygon = QgsGeometry.fromPolygon( - [[QgsPoint(1, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)]]) + [[QgsPointXY(1, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)]]) self.assertEqual(myPolygon.wkbType(), QgsWkbTypes.Polygon) def testFromMultiPolygon(self): myMultiPolygon = QgsGeometry.fromMultiPolygon([ - [[QgsPoint(1, 1), - QgsPoint(2, 2), - QgsPoint(1, 2), - QgsPoint(1, 1)]], - [[QgsPoint(2, 2), - QgsPoint(3, 3), - QgsPoint(3, 1), - QgsPoint(2, 2)]] + [[QgsPointXY(1, 1), + QgsPointXY(2, 2), + QgsPointXY(1, 2), + QgsPointXY(1, 1)]], + [[QgsPointXY(2, 2), + QgsPointXY(3, 3), + QgsPointXY(3, 1), + QgsPointXY(2, 2)]] ]) self.assertEqual(myMultiPolygon.wkbType(), QgsWkbTypes.MultiPolygon) @@ -228,10 +228,10 @@ class TestQgsGeometry(unittest.TestCase): def testIntersection(self): myLine = QgsGeometry.fromPolyline([ - QgsPoint(0, 0), - QgsPoint(1, 1), - QgsPoint(2, 2)]) - myPoint = QgsGeometry.fromPoint(QgsPoint(1, 1)) + QgsPointXY(0, 0), + QgsPointXY(1, 1), + QgsPointXY(2, 2)]) + myPoint = QgsGeometry.fromPoint(QgsPointXY(1, 1)) intersectionGeom = QgsGeometry.intersection(myLine, myPoint) self.assertEqual(intersectionGeom.wkbType(), QgsWkbTypes.Point) @@ -247,32 +247,32 @@ class TestQgsGeometry(unittest.TestCase): self.assertEqual(layer.featureCount(), 1) def testBuffer(self): - myPoint = QgsGeometry.fromPoint(QgsPoint(1, 1)) + myPoint = QgsGeometry.fromPoint(QgsPointXY(1, 1)) bufferGeom = myPoint.buffer(10, 5) self.assertEqual(bufferGeom.wkbType(), QgsWkbTypes.Polygon) - myTestPoint = QgsGeometry.fromPoint(QgsPoint(3, 3)) + myTestPoint = QgsGeometry.fromPoint(QgsPointXY(3, 3)) self.assertTrue(bufferGeom.intersects(myTestPoint)) def testContains(self): myPoly = QgsGeometry.fromPolygon( - [[QgsPoint(0, 0), - QgsPoint(2, 0), - QgsPoint(2, 2), - QgsPoint(0, 2), - QgsPoint(0, 0)]]) - myPoint = QgsGeometry.fromPoint(QgsPoint(1, 1)) + [[QgsPointXY(0, 0), + QgsPointXY(2, 0), + QgsPointXY(2, 2), + QgsPointXY(0, 2), + QgsPointXY(0, 0)]]) + myPoint = QgsGeometry.fromPoint(QgsPointXY(1, 1)) self.assertTrue(QgsGeometry.contains(myPoly, myPoint)) def testTouches(self): myLine = QgsGeometry.fromPolyline([ - QgsPoint(0, 0), - QgsPoint(1, 1), - QgsPoint(2, 2)]) + QgsPointXY(0, 0), + QgsPointXY(1, 1), + QgsPointXY(2, 2)]) myPoly = QgsGeometry.fromPolygon([[ - QgsPoint(0, 0), - QgsPoint(1, 1), - QgsPoint(2, 0), - QgsPoint(0, 0)]]) + QgsPointXY(0, 0), + QgsPointXY(1, 1), + QgsPointXY(2, 0), + QgsPointXY(0, 0)]]) touchesGeom = QgsGeometry.touches(myLine, myPoly) myMessage = ('Expected:\n%s\nGot:\n%s\n' % ("True", touchesGeom)) @@ -280,16 +280,16 @@ class TestQgsGeometry(unittest.TestCase): def testOverlaps(self): myPolyA = QgsGeometry.fromPolygon([[ - QgsPoint(0, 0), - QgsPoint(1, 3), - QgsPoint(2, 0), - QgsPoint(0, 0)]]) + QgsPointXY(0, 0), + QgsPointXY(1, 3), + QgsPointXY(2, 0), + QgsPointXY(0, 0)]]) myPolyB = QgsGeometry.fromPolygon([[ - QgsPoint(0, 0), - QgsPoint(2, 0), - QgsPoint(2, 2), - QgsPoint(0, 2), - QgsPoint(0, 0)]]) + QgsPointXY(0, 0), + QgsPointXY(2, 0), + QgsPointXY(2, 2), + QgsPointXY(0, 2), + QgsPointXY(0, 0)]]) overlapsGeom = QgsGeometry.overlaps(myPolyA, myPolyB) myMessage = ('Expected:\n%s\nGot:\n%s\n' % ("True", overlapsGeom)) @@ -297,24 +297,24 @@ class TestQgsGeometry(unittest.TestCase): def testWithin(self): myLine = QgsGeometry.fromPolyline([ - QgsPoint(0.5, 0.5), - QgsPoint(1, 1), - QgsPoint(1.5, 1.5) + QgsPointXY(0.5, 0.5), + QgsPointXY(1, 1), + QgsPointXY(1.5, 1.5) ]) myPoly = QgsGeometry.fromPolygon([[ - QgsPoint(0, 0), - QgsPoint(2, 0), - QgsPoint(2, 2), - QgsPoint(0, 2), - QgsPoint(0, 0)]]) + QgsPointXY(0, 0), + QgsPointXY(2, 0), + QgsPointXY(2, 2), + QgsPointXY(0, 2), + QgsPointXY(0, 0)]]) withinGeom = QgsGeometry.within(myLine, myPoly) myMessage = ('Expected:\n%s\nGot:\n%s\n' % ("True", withinGeom)) assert withinGeom, myMessage def testEquals(self): - myPointA = QgsGeometry.fromPoint(QgsPoint(1, 1)) - myPointB = QgsGeometry.fromPoint(QgsPoint(1, 1)) + myPointA = QgsGeometry.fromPoint(QgsPointXY(1, 1)) + myPointB = QgsGeometry.fromPoint(QgsPointXY(1, 1)) equalsGeom = QgsGeometry.equals(myPointA, myPointB) myMessage = ('Expected:\n%s\nGot:\n%s\n' % ("True", equalsGeom)) @@ -322,15 +322,15 @@ class TestQgsGeometry(unittest.TestCase): def testCrosses(self): myLine = QgsGeometry.fromPolyline([ - QgsPoint(0, 0), - QgsPoint(1, 1), - QgsPoint(3, 3)]) + QgsPointXY(0, 0), + QgsPointXY(1, 1), + QgsPointXY(3, 3)]) myPoly = QgsGeometry.fromPolygon([[ - QgsPoint(1, 0), - QgsPoint(2, 0), - QgsPoint(2, 2), - QgsPoint(1, 2), - QgsPoint(1, 0)]]) + QgsPointXY(1, 0), + QgsPointXY(2, 0), + QgsPointXY(2, 2), + QgsPointXY(1, 2), + QgsPointXY(1, 0)]]) crossesGeom = QgsGeometry.crosses(myLine, myPoly) myMessage = ('Expected:\n%s\nGot:\n%s\n' % ("True", crossesGeom)) @@ -382,28 +382,28 @@ class TestQgsGeometry(unittest.TestCase): myFeature1 = QgsFeature() myFeature1.setGeometry(QgsGeometry.fromPolyline([ - QgsPoint(10, 10), - QgsPoint(20, 10), - QgsPoint(30, 10), - QgsPoint(40, 10), + QgsPointXY(10, 10), + QgsPointXY(20, 10), + QgsPointXY(30, 10), + QgsPointXY(40, 10), ])) myFeature1.setAttributes(['Johny']) myFeature2 = QgsFeature() myFeature2.setGeometry(QgsGeometry.fromPolyline([ - QgsPoint(10, 10), - QgsPoint(20, 20), - QgsPoint(30, 30), - QgsPoint(40, 40), + QgsPointXY(10, 10), + QgsPointXY(20, 20), + QgsPointXY(30, 30), + QgsPointXY(40, 40), ])) myFeature2.setAttributes(['Be']) myFeature3 = QgsFeature() myFeature3.setGeometry(QgsGeometry.fromPolyline([ - QgsPoint(10, 10), - QgsPoint(10, 20), - QgsPoint(10, 30), - QgsPoint(10, 40), + QgsPointXY(10, 10), + QgsPointXY(10, 20), + QgsPointXY(10, 30), + QgsPointXY(10, 40), ])) myFeature3.setAttributes(['Good']) @@ -414,11 +414,11 @@ class TestQgsGeometry(unittest.TestCase): self.assertEqual(len(myFeatures), 3) myClipPolygon = QgsGeometry.fromPolygon([[ - QgsPoint(20, 20), - QgsPoint(20, 30), - QgsPoint(30, 30), - QgsPoint(30, 20), - QgsPoint(20, 20), + QgsPointXY(20, 20), + QgsPointXY(20, 30), + QgsPointXY(30, 30), + QgsPointXY(30, 20), + QgsPointXY(20, 20), ]]) print(('Clip: %s' % myClipPolygon.exportToWkt())) writeShape(myMemoryLayer, 'clipGeometryBefore.shp') @@ -475,43 +475,43 @@ class TestQgsGeometry(unittest.TestCase): # | # 1-+-+-+-+-0 ! polyline = QgsGeometry.fromPolyline( - [QgsPoint(5, 0), QgsPoint(0, 0), QgsPoint(0, 4), QgsPoint(5, 4), QgsPoint(5, 1), QgsPoint(1, 1), QgsPoint(1, 3), QgsPoint(4, 3), QgsPoint(4, 2), QgsPoint(2, 2)] + [QgsPointXY(5, 0), QgsPointXY(0, 0), QgsPointXY(0, 4), QgsPointXY(5, 4), QgsPointXY(5, 1), QgsPointXY(1, 1), QgsPointXY(1, 3), QgsPointXY(4, 3), QgsPointXY(4, 2), QgsPointXY(2, 2)] ) - (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPoint(6, 1)) - self.assertEqual(point, QgsPoint(5, 1)) + (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPointXY(6, 1)) + self.assertEqual(point, QgsPointXY(5, 1)) self.assertEqual(beforeVertex, 3) self.assertEqual(atVertex, 4) self.assertEqual(afterVertex, 5) self.assertEqual(dist, 1) - (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPoint(6, 2)) + (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPointXY(6, 2)) self.assertEqual(dist, 1) - self.assertEqual(minDistPoint, QgsPoint(5, 2)) + self.assertEqual(minDistPoint, QgsPointXY(5, 2)) self.assertEqual(afterVertex, 4) - (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPoint(6, 0)) - self.assertEqual(point, QgsPoint(5, 0)) + (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPointXY(6, 0)) + self.assertEqual(point, QgsPointXY(5, 0)) self.assertEqual(beforeVertex, -1) self.assertEqual(atVertex, 0) self.assertEqual(afterVertex, 1) self.assertEqual(dist, 1) - (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPoint(6, 0)) + (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPointXY(6, 0)) self.assertEqual(dist, 1) - self.assertEqual(minDistPoint, QgsPoint(5, 0)) + self.assertEqual(minDistPoint, QgsPointXY(5, 0)) self.assertEqual(afterVertex, 1) - (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPoint(0, -1)) - self.assertEqual(point, QgsPoint(0, 0)) + (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPointXY(0, -1)) + self.assertEqual(point, QgsPointXY(0, 0)) self.assertEqual(beforeVertex, 0) self.assertEqual(atVertex, 1) self.assertEqual(afterVertex, 2) self.assertEqual(dist, 1) - (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPoint(0, 1)) + (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPointXY(0, 1)) self.assertEqual(dist, 0) - self.assertEqual(minDistPoint, QgsPoint(0, 1)) + self.assertEqual(minDistPoint, QgsPointXY(0, 1)) self.assertEqual(afterVertex, 2) # 2-3 6-+-7 ! @@ -519,20 +519,20 @@ class TestQgsGeometry(unittest.TestCase): # 0-1 4 5 8-9 polyline = QgsGeometry.fromMultiPolyline( [ - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ], - [QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(5, 1), QgsPoint(5, 0), QgsPoint(6, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ], + [QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(5, 1), QgsPointXY(5, 0), QgsPointXY(6, 0), ] ] ) - (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPoint(5, 2)) - self.assertEqual(point, QgsPoint(5, 1)) + (point, atVertex, beforeVertex, afterVertex, dist) = polyline.closestVertex(QgsPointXY(5, 2)) + self.assertEqual(point, QgsPointXY(5, 1)) self.assertEqual(beforeVertex, 6) self.assertEqual(atVertex, 7) self.assertEqual(afterVertex, 8) self.assertEqual(dist, 1) - (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPoint(7, 0)) + (dist, minDistPoint, afterVertex) = polyline.closestSegmentWithContext(QgsPointXY(7, 0)) self.assertEqual(dist, 1) - self.assertEqual(minDistPoint, QgsPoint(6, 0)) + self.assertEqual(minDistPoint, QgsPointXY(6, 0)) self.assertEqual(afterVertex, 9) # 5---4 @@ -542,19 +542,19 @@ class TestQgsGeometry(unittest.TestCase): # 0-1 polygon = QgsGeometry.fromPolygon( [[ - QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), + QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]] ) - (point, atVertex, beforeVertex, afterVertex, dist) = polygon.closestVertex(QgsPoint(0.7, 1.1)) - self.assertEqual(point, QgsPoint(1, 1)) + (point, atVertex, beforeVertex, afterVertex, dist) = polygon.closestVertex(QgsPointXY(0.7, 1.1)) + self.assertEqual(point, QgsPointXY(1, 1)) self.assertEqual(beforeVertex, 1) self.assertEqual(atVertex, 2) self.assertEqual(afterVertex, 3) assert abs(dist - 0.1) < 0.00001, "Expected: %f; Got:%f" % (dist, 0.1) - (dist, minDistPoint, afterVertex) = polygon.closestSegmentWithContext(QgsPoint(0.7, 1.1)) + (dist, minDistPoint, afterVertex) = polygon.closestSegmentWithContext(QgsPointXY(0.7, 1.1)) self.assertEqual(afterVertex, 2) - self.assertEqual(minDistPoint, QgsPoint(1, 1)) + self.assertEqual(minDistPoint, QgsPointXY(1, 1)) exp = 0.3 ** 2 + 0.1 ** 2 assert abs(dist - exp) < 0.00001, "Expected: %f; Got:%f" % (exp, dist) @@ -567,20 +567,20 @@ class TestQgsGeometry(unittest.TestCase): # 0-+-+-1 polygon = QgsGeometry.fromPolygon( [ - [QgsPoint(0, 0), QgsPoint(3, 0), QgsPoint(3, 3), QgsPoint(0, 3), QgsPoint(0, 0)], - [QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)], + [QgsPointXY(0, 0), QgsPointXY(3, 0), QgsPointXY(3, 3), QgsPointXY(0, 3), QgsPointXY(0, 0)], + [QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)], ] ) - (point, atVertex, beforeVertex, afterVertex, dist) = polygon.closestVertex(QgsPoint(1.1, 1.9)) - self.assertEqual(point, QgsPoint(1, 2)) + (point, atVertex, beforeVertex, afterVertex, dist) = polygon.closestVertex(QgsPointXY(1.1, 1.9)) + self.assertEqual(point, QgsPointXY(1, 2)) self.assertEqual(beforeVertex, 7) self.assertEqual(atVertex, 8) self.assertEqual(afterVertex, 9) assert abs(dist - 0.02) < 0.00001, "Expected: %f; Got:%f" % (dist, 0.02) - (dist, minDistPoint, afterVertex) = polygon.closestSegmentWithContext(QgsPoint(1.2, 1.9)) + (dist, minDistPoint, afterVertex) = polygon.closestSegmentWithContext(QgsPointXY(1.2, 1.9)) self.assertEqual(afterVertex, 8) - self.assertEqual(minDistPoint, QgsPoint(1.2, 2)) + self.assertEqual(minDistPoint, QgsPointXY(1.2, 2)) exp = 0.01 assert abs(dist - exp) < 0.00001, "Expected: %f; Got:%f" % (exp, dist) @@ -591,20 +591,20 @@ class TestQgsGeometry(unittest.TestCase): # 0-1 7-8 polygon = QgsGeometry.fromMultiPolygon( [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), ]], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0), ]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0), ]] ] ) - (point, atVertex, beforeVertex, afterVertex, dist) = polygon.closestVertex(QgsPoint(4.1, 1.1)) - self.assertEqual(point, QgsPoint(4, 1)) + (point, atVertex, beforeVertex, afterVertex, dist) = polygon.closestVertex(QgsPointXY(4.1, 1.1)) + self.assertEqual(point, QgsPointXY(4, 1)) self.assertEqual(beforeVertex, 11) self.assertEqual(atVertex, 12) self.assertEqual(afterVertex, 13) assert abs(dist - 0.02) < 0.00001, "Expected: %f; Got:%f" % (dist, 0.02) - (dist, minDistPoint, afterVertex) = polygon.closestSegmentWithContext(QgsPoint(4.1, 1.1)) + (dist, minDistPoint, afterVertex) = polygon.closestSegmentWithContext(QgsPointXY(4.1, 1.1)) self.assertEqual(afterVertex, 12) - self.assertEqual(minDistPoint, QgsPoint(4, 1)) + self.assertEqual(minDistPoint, QgsPointXY(4, 1)) exp = 0.02 assert abs(dist - exp) < 0.00001, "Expected: %f; Got:%f" % (exp, dist) @@ -619,7 +619,7 @@ class TestQgsGeometry(unittest.TestCase): # | # 1-+-+-+-+-0 ! polyline = QgsGeometry.fromPolyline( - [QgsPoint(5, 0), QgsPoint(0, 0), QgsPoint(0, 4), QgsPoint(5, 4), QgsPoint(5, 1), QgsPoint(1, 1), QgsPoint(1, 3), QgsPoint(4, 3), QgsPoint(4, 2), QgsPoint(2, 2)] + [QgsPointXY(5, 0), QgsPointXY(0, 0), QgsPointXY(0, 4), QgsPointXY(5, 4), QgsPointXY(5, 1), QgsPointXY(1, 1), QgsPointXY(1, 3), QgsPointXY(4, 3), QgsPointXY(4, 2), QgsPointXY(2, 2)] ) # don't crash @@ -643,8 +643,8 @@ class TestQgsGeometry(unittest.TestCase): # 0-1 4 5 8-9 polyline = QgsGeometry.fromMultiPolyline( [ - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ], - [QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(5, 1), QgsPoint(5, 0), QgsPoint(6, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ], + [QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(5, 1), QgsPointXY(5, 0), QgsPointXY(6, 0), ] ] ) @@ -671,7 +671,7 @@ class TestQgsGeometry(unittest.TestCase): # 0-1 polygon = QgsGeometry.fromPolygon( [[ - QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), + QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]] ) @@ -698,8 +698,8 @@ class TestQgsGeometry(unittest.TestCase): # 0-+-+-1 polygon = QgsGeometry.fromPolygon( [ - [QgsPoint(0, 0), QgsPoint(3, 0), QgsPoint(3, 3), QgsPoint(0, 3), QgsPoint(0, 0)], - [QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)], + [QgsPointXY(0, 0), QgsPointXY(3, 0), QgsPointXY(3, 3), QgsPointXY(0, 3), QgsPointXY(0, 0)], + [QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)], ] ) @@ -726,8 +726,8 @@ class TestQgsGeometry(unittest.TestCase): # 0-1 7-8 polygon = QgsGeometry.fromMultiPolygon( [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), ]], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0), ]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0), ]] ] ) @@ -757,7 +757,7 @@ class TestQgsGeometry(unittest.TestCase): # ! 5-+-+-+-4 ! # | # 1-+-+-+-+-0 ! - points = [QgsPoint(5, 0), QgsPoint(0, 0), QgsPoint(0, 4), QgsPoint(5, 4), QgsPoint(5, 1), QgsPoint(1, 1), QgsPoint(1, 3), QgsPoint(4, 3), QgsPoint(4, 2), QgsPoint(2, 2)] + points = [QgsPointXY(5, 0), QgsPointXY(0, 0), QgsPointXY(0, 4), QgsPointXY(5, 4), QgsPointXY(5, 1), QgsPointXY(1, 1), QgsPointXY(1, 3), QgsPointXY(4, 3), QgsPointXY(4, 2), QgsPointXY(2, 2)] polyline = QgsGeometry.fromPolyline(points) for i in range(0, len(points)): @@ -767,16 +767,16 @@ class TestQgsGeometry(unittest.TestCase): # | | | | # 0-1 4 5 8-9 points = [ - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ], - [QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(5, 1), QgsPoint(5, 0), QgsPoint(6, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ], + [QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(5, 1), QgsPointXY(5, 0), QgsPointXY(6, 0), ] ] polyline = QgsGeometry.fromMultiPolyline(points) p = polyline.vertexAt(-100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) p = polyline.vertexAt(100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) i = 0 for j in range(0, len(points)): @@ -790,15 +790,15 @@ class TestQgsGeometry(unittest.TestCase): # | | # 0-1 points = [[ - QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), + QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]] polygon = QgsGeometry.fromPolygon(points) p = polygon.vertexAt(-100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) p = polygon.vertexAt(100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) i = 0 for j in range(0, len(points)): @@ -814,16 +814,16 @@ class TestQgsGeometry(unittest.TestCase): # | | # 0-+-+-1 points = [ - [QgsPoint(0, 0), QgsPoint(3, 0), QgsPoint(3, 3), QgsPoint(0, 3), QgsPoint(0, 0)], - [QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)], + [QgsPointXY(0, 0), QgsPointXY(3, 0), QgsPointXY(3, 3), QgsPointXY(0, 3), QgsPointXY(0, 0)], + [QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)], ] polygon = QgsGeometry.fromPolygon(points) p = polygon.vertexAt(-100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) p = polygon.vertexAt(100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) i = 0 for j in range(0, len(points)): @@ -837,17 +837,17 @@ class TestQgsGeometry(unittest.TestCase): # | | | | # 0-1 7-8 points = [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), ]], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0), ]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0), ]] ] polygon = QgsGeometry.fromMultiPolygon(points) p = polygon.vertexAt(-100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) p = polygon.vertexAt(100) - self.assertEqual(p, QgsPoint(0, 0), "Expected 0,0, Got %s" % p.toString()) + self.assertEqual(p, QgsPointXY(0, 0), "Expected 0,0, Got %s" % p.toString()) i = 0 for j in range(0, len(points)): @@ -859,7 +859,7 @@ class TestQgsGeometry(unittest.TestCase): def testMultipoint(self): # #9423 - points = [QgsPoint(10, 30), QgsPoint(40, 20), QgsPoint(30, 10), QgsPoint(20, 10)] + points = [QgsPointXY(10, 30), QgsPointXY(40, 20), QgsPointXY(30, 10), QgsPointXY(20, 10)] wkt = "MultiPoint ((10 30),(40 20),(30 10),(20 10))" multipoint = QgsGeometry.fromWkt(wkt) assert multipoint.isMultipart(), "Expected MultiPoint to be multipart" @@ -870,7 +870,7 @@ class TestQgsGeometry(unittest.TestCase): i += 1 multipoint = QgsGeometry.fromWkt("MultiPoint ((5 5))") - self.assertEqual(multipoint.vertexAt(0), QgsPoint(5, 5), "MULTIPOINT fromWkt failed") + self.assertEqual(multipoint.vertexAt(0), QgsPointXY(5, 5), "MULTIPOINT fromWkt failed") assert multipoint.insertVertex(4, 4, 0), "MULTIPOINT insert 4,4 at 0 failed" expwkt = "MultiPoint ((4 4),(5 5))" @@ -906,7 +906,7 @@ class TestQgsGeometry(unittest.TestCase): assert compareWkt(expwkt, wkt), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt) multipoint = QgsGeometry.fromWkt("MultiPoint ((5 5))") - self.assertEqual(multipoint.vertexAt(0), QgsPoint(5, 5), "MultiPoint fromWkt failed") + self.assertEqual(multipoint.vertexAt(0), QgsPointXY(5, 5), "MultiPoint fromWkt failed") def testMoveVertex(self): multipoint = QgsGeometry.fromWkt("MultiPoint ((5 0),(0 0),(0 4),(5 4),(5 1),(1 1),(1 3),(4 3),(4 2),(2 2))") @@ -1208,12 +1208,12 @@ class TestQgsGeometry(unittest.TestCase): g = QgsGeometry() self.assertTrue(g.extrude(1, 2).isNull()) - points = [QgsPoint(1, 2), QgsPoint(3, 2), QgsPoint(4, 3)] + points = [QgsPointXY(1, 2), QgsPointXY(3, 2), QgsPointXY(4, 3)] line = QgsGeometry.fromPolyline(points) expected = QgsGeometry.fromWkt('Polygon ((1 2, 3 2, 4 3, 5 5, 4 4, 2 4, 1 2))') self.assertEqual(line.extrude(1, 2).exportToWkt(), expected.exportToWkt()) - points2 = [[QgsPoint(1, 2), QgsPoint(3, 2)], [QgsPoint(4, 3), QgsPoint(8, 3)]] + points2 = [[QgsPointXY(1, 2), QgsPointXY(3, 2)], [QgsPointXY(4, 3), QgsPointXY(8, 3)]] multiline = QgsGeometry.fromMultiPolyline(points2) expected = QgsGeometry.fromWkt('MultiPolygon (((1 2, 3 2, 4 4, 2 4, 1 2)),((4 3, 8 3, 9 5, 5 5, 4 3)))') self.assertEqual(multiline.extrude(1, 2).exportToWkt(), expected.exportToWkt()) @@ -1290,7 +1290,7 @@ class TestQgsGeometry(unittest.TestCase): # ! 5-+-+-+-4 ! # | # 1-+-+-+-+-0 ! - points = [QgsPoint(5, 0), QgsPoint(0, 0), QgsPoint(0, 4), QgsPoint(5, 4), QgsPoint(5, 1), QgsPoint(1, 1), QgsPoint(1, 3), QgsPoint(4, 3), QgsPoint(4, 2), QgsPoint(2, 2)] + points = [QgsPointXY(5, 0), QgsPointXY(0, 0), QgsPointXY(0, 4), QgsPointXY(5, 4), QgsPointXY(5, 1), QgsPointXY(1, 1), QgsPointXY(1, 3), QgsPointXY(4, 3), QgsPointXY(4, 2), QgsPointXY(2, 2)] polyline = QgsGeometry.fromPolyline(points) expbb = QgsRectangle(0, 0, 5, 4) bb = polyline.boundingBox() @@ -1300,8 +1300,8 @@ class TestQgsGeometry(unittest.TestCase): # | | | | # 0-1 4 5 8-9 points = [ - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ], - [QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(5, 1), QgsPoint(5, 0), QgsPoint(6, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ], + [QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(5, 1), QgsPointXY(5, 0), QgsPointXY(6, 0), ] ] polyline = QgsGeometry.fromMultiPolyline(points) expbb = QgsRectangle(0, 0, 6, 1) @@ -1314,7 +1314,7 @@ class TestQgsGeometry(unittest.TestCase): # | | # 0-1 points = [[ - QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), + QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]] polygon = QgsGeometry.fromPolygon(points) expbb = QgsRectangle(0, 0, 2, 2) @@ -1329,8 +1329,8 @@ class TestQgsGeometry(unittest.TestCase): # | | # 0-+-+-1 points = [ - [QgsPoint(0, 0), QgsPoint(3, 0), QgsPoint(3, 3), QgsPoint(0, 3), QgsPoint(0, 0)], - [QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)], + [QgsPointXY(0, 0), QgsPointXY(3, 0), QgsPointXY(3, 3), QgsPointXY(0, 3), QgsPointXY(0, 0)], + [QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)], ] polygon = QgsGeometry.fromPolygon(points) expbb = QgsRectangle(0, 0, 3, 3) @@ -1343,8 +1343,8 @@ class TestQgsGeometry(unittest.TestCase): # | | | | # 0-1 7-8 points = [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), ]], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0), ]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0), ]] ] polygon = QgsGeometry.fromMultiPolygon(points) @@ -1359,7 +1359,7 @@ class TestQgsGeometry(unittest.TestCase): def testCollectGeometry(self): # collect points - geometries = [QgsGeometry.fromPoint(QgsPoint(0, 0)), QgsGeometry.fromPoint(QgsPoint(1, 1))] + geometries = [QgsGeometry.fromPoint(QgsPointXY(0, 0)), QgsGeometry.fromPoint(QgsPointXY(1, 1))] geometry = QgsGeometry.collectGeometry(geometries) expwkt = "MultiPoint ((0 0), (1 1))" wkt = geometry.exportToWkt() @@ -1367,8 +1367,8 @@ class TestQgsGeometry(unittest.TestCase): # collect lines points = [ - [QgsPoint(0, 0), QgsPoint(1, 0)], - [QgsPoint(2, 0), QgsPoint(3, 0)] + [QgsPointXY(0, 0), QgsPointXY(1, 0)], + [QgsPointXY(2, 0), QgsPointXY(3, 0)] ] geometries = [QgsGeometry.fromPolyline(points[0]), QgsGeometry.fromPolyline(points[1])] geometry = QgsGeometry.collectGeometry(geometries) @@ -1378,8 +1378,8 @@ class TestQgsGeometry(unittest.TestCase): # collect polygons points = [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(0, 1), QgsPoint(0, 0)]], - [[QgsPoint(2, 0), QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(2, 1), QgsPoint(2, 0)]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(0, 1), QgsPointXY(0, 0)]], + [[QgsPointXY(2, 0), QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(2, 1), QgsPointXY(2, 0)]] ] geometries = [QgsGeometry.fromPolygon(points[0]), QgsGeometry.fromPolygon(points[1])] geometry = QgsGeometry.collectGeometry(geometries) @@ -1398,7 +1398,7 @@ class TestQgsGeometry(unittest.TestCase): def testAddPart(self): # add a part to a multipoint - points = [QgsPoint(0, 0), QgsPoint(1, 0)] + points = [QgsPointXY(0, 0), QgsPointXY(1, 0)] point = QgsGeometry.fromPoint(points[0]) self.assertEqual(point.addPoints([points[1]]), 0) @@ -1409,7 +1409,7 @@ class TestQgsGeometry(unittest.TestCase): # test adding a part with Z values point = QgsGeometry.fromPoint(points[0]) point.geometry().addZValue(4.0) - self.assertEqual(point.addPointsV2([QgsPointV2(QgsWkbTypes.PointZ, points[1][0], points[1][1], 3.0)]), 0) + self.assertEqual(point.addPointsV2([QgsPoint(QgsWkbTypes.PointZ, points[1][0], points[1][1], 3.0)]), 0) expwkt = "MultiPointZ ((0 0 4), (1 0 3))" wkt = point.exportToWkt() assert compareWkt(expwkt, wkt), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt) @@ -1418,8 +1418,8 @@ class TestQgsGeometry(unittest.TestCase): # | | | | # 0-1 4 5 8-9 points = [ - [QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 0), ], - [QgsPoint(3, 0), QgsPoint(3, 1), QgsPoint(5, 1), QgsPoint(5, 0), QgsPoint(6, 0), ] + [QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 0), ], + [QgsPointXY(3, 0), QgsPointXY(3, 1), QgsPointXY(5, 1), QgsPointXY(5, 0), QgsPointXY(6, 0), ] ] polyline = QgsGeometry.fromPolyline(points[0]) @@ -1438,7 +1438,7 @@ class TestQgsGeometry(unittest.TestCase): # test adding a part with Z values polyline = QgsGeometry.fromPolyline(points[0]) polyline.geometry().addZValue(4.0) - points2 = [QgsPointV2(QgsWkbTypes.PointZ, p[0], p[1], 3.0) for p in points[1]] + points2 = [QgsPoint(QgsWkbTypes.PointZ, p[0], p[1], 3.0) for p in points[1]] self.assertEqual(polyline.addPointsV2(points2), 0) expwkt = "MultiLineStringZ ((0 0 4, 1 0 4, 1 1 4, 2 1 4, 2 0 4),(3 0 3, 3 1 3, 5 1 3, 5 0 3, 6 0 3))" wkt = polyline.exportToWkt() @@ -1450,8 +1450,8 @@ class TestQgsGeometry(unittest.TestCase): # | | | | # 0-1 7-8 points = [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0), ]], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0), ]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0), ]], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0), ]] ] polygon = QgsGeometry.fromPolygon(points[0]) @@ -1459,7 +1459,7 @@ class TestQgsGeometry(unittest.TestCase): self.assertEqual(polygon.addPoints(points[1][0][0:1]), 2, "addPoints with one point ring unexpectedly succeeded.") self.assertEqual(polygon.addPoints(points[1][0][0:2]), 2, "addPoints with two point ring unexpectedly succeeded.") self.assertEqual(polygon.addPoints(points[1][0][0:3]), 2, "addPoints with unclosed three point ring unexpectedly succeeded.") - self.assertEqual(polygon.addPoints([QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(4, 0)]), 2, "addPoints with 'closed' three point ring unexpectedly succeeded.") + self.assertEqual(polygon.addPoints([QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(4, 0)]), 2, "addPoints with 'closed' three point ring unexpectedly succeeded.") self.assertEqual(polygon.addPoints(points[1][0]), 0, "addPoints failed") expwkt = "MultiPolygon (((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0)),((4 0, 5 0, 5 2, 3 2, 3 1, 4 1, 4 0)))" @@ -1482,7 +1482,7 @@ class TestQgsGeometry(unittest.TestCase): # test adding a part with Z values polygon = QgsGeometry.fromPolygon(points[0]) polygon.geometry().addZValue(4.0) - points2 = [QgsPointV2(QgsWkbTypes.PointZ, pi[0], pi[1], 3.0) for pi in points[1][0]] + points2 = [QgsPoint(QgsWkbTypes.PointZ, pi[0], pi[1], 3.0) for pi in points[1][0]] self.assertEqual(polygon.addPointsV2(points2), 0) expwkt = "MultiPolygonZ (((0 0 4, 1 0 4, 1 1 4, 2 1 4, 2 2 4, 0 2 4, 0 0 4)),((4 0 3, 5 0 3, 5 2 3, 3 2 3, 3 1 3, 4 1 3, 4 0 3)))" wkt = polygon.exportToWkt() @@ -1491,14 +1491,14 @@ class TestQgsGeometry(unittest.TestCase): # Test adding parts to empty geometry, should become first part empty = QgsGeometry() # if not default type specified, addPart should fail - result = empty.addPoints([QgsPoint(4, 0)]) + result = empty.addPoints([QgsPointXY(4, 0)]) assert result != 0, 'Got return code {}'.format(result) - result = empty.addPoints([QgsPoint(4, 0)], QgsWkbTypes.PointGeometry) + result = empty.addPoints([QgsPointXY(4, 0)], QgsWkbTypes.PointGeometry) self.assertEqual(result, 0, 'Got return code {}'.format(result)) wkt = empty.exportToWkt() expwkt = 'MultiPoint ((4 0))' assert compareWkt(expwkt, wkt), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt) - result = empty.addPoints([QgsPoint(5, 1)]) + result = empty.addPoints([QgsPointXY(5, 1)]) self.assertEqual(result, 0, 'Got return code {}'.format(result)) wkt = empty.exportToWkt() expwkt = 'MultiPoint ((4 0),(5 1))' @@ -1537,13 +1537,13 @@ class TestQgsGeometry(unittest.TestCase): # | | # 10-+-+-11 points = [ - [[QgsPoint(0, 0), QgsPoint(1, 0), QgsPoint(1, 1), QgsPoint(2, 1), QgsPoint(2, 2), QgsPoint(0, 2), QgsPoint(0, 0)], ], - [[QgsPoint(4, 0), QgsPoint(5, 0), QgsPoint(5, 2), QgsPoint(3, 2), QgsPoint(3, 1), QgsPoint(4, 1), QgsPoint(4, 0)], ], - [[QgsPoint(10, 0), QgsPoint(13, 0), QgsPoint(13, 3), QgsPoint(10, 3), QgsPoint(10, 0)], [QgsPoint(11, 1), QgsPoint(12, 1), QgsPoint(12, 2), QgsPoint(11, 2), QgsPoint(11, 1)]] + [[QgsPointXY(0, 0), QgsPointXY(1, 0), QgsPointXY(1, 1), QgsPointXY(2, 1), QgsPointXY(2, 2), QgsPointXY(0, 2), QgsPointXY(0, 0)], ], + [[QgsPointXY(4, 0), QgsPointXY(5, 0), QgsPointXY(5, 2), QgsPointXY(3, 2), QgsPointXY(3, 1), QgsPointXY(4, 1), QgsPointXY(4, 0)], ], + [[QgsPointXY(10, 0), QgsPointXY(13, 0), QgsPointXY(13, 3), QgsPointXY(10, 3), QgsPointXY(10, 0)], [QgsPointXY(11, 1), QgsPointXY(12, 1), QgsPointXY(12, 2), QgsPointXY(11, 2), QgsPointXY(11, 1)]] ] # ####### TO POINT ######## # POINT TO POINT - point = QgsGeometry.fromPoint(QgsPoint(1, 1)) + point = QgsGeometry.fromPoint(QgsPointXY(1, 1)) wkt = point.convertToType(QgsWkbTypes.PointGeometry, False).exportToWkt() expWkt = "Point (1 1)" assert compareWkt(expWkt, wkt), "convertToType failed: from point to point. Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) @@ -1574,7 +1574,7 @@ class TestQgsGeometry(unittest.TestCase): # ####### TO LINE ######## # POINT TO LINE - point = QgsGeometry.fromPoint(QgsPoint(1, 1)) + point = QgsGeometry.fromPoint(QgsPointXY(1, 1)) self.assertFalse(point.convertToType(QgsWkbTypes.LineGeometry, False)), "convertToType with a point should return a null geometry" # MultiPoint TO LINE multipoint = QgsGeometry.fromMultiPoint(points[0][0]) @@ -1639,10 +1639,10 @@ class TestQgsGeometry(unittest.TestCase): expWkt = "Polygon ((0 0, 1 0, 1 1, 2 1, 2 2, 0 2, 0 0))" assert compareWkt(expWkt, wkt), "convertToType failed: from line to polygon. Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) # LINE ( 3 vertices, with first = last ) TO Polygon - line = QgsGeometry.fromPolyline([QgsPoint(1, 1), QgsPoint(0, 0), QgsPoint(1, 1)]) + line = QgsGeometry.fromPolyline([QgsPointXY(1, 1), QgsPointXY(0, 0), QgsPointXY(1, 1)]) self.assertFalse(line.convertToType(QgsWkbTypes.PolygonGeometry, False), "convertToType to polygon of a 3 vertices lines with first and last vertex identical should return a null geometry") # MULTILINE ( with a part of 3 vertices, with first = last ) TO MultiPolygon - multiline = QgsGeometry.fromMultiPolyline([points[0][0], [QgsPoint(1, 1), QgsPoint(0, 0), QgsPoint(1, 1)]]) + multiline = QgsGeometry.fromMultiPolyline([points[0][0], [QgsPointXY(1, 1), QgsPointXY(0, 0), QgsPointXY(1, 1)]]) self.assertFalse(multiline.convertToType(QgsWkbTypes.PolygonGeometry, True), "convertToType to polygon of a 3 vertices lines with first and last vertex identical should return a null geometry") # LINE TO MultiPolygon line = QgsGeometry.fromPolyline(points[0][0]) @@ -1706,13 +1706,13 @@ class TestQgsGeometry(unittest.TestCase): def testReshape(self): """ Test geometry reshaping """ g = QgsGeometry.fromWkt('Polygon ((0 0, 1 0, 1 1, 0 1, 0 0))') - g.reshapeGeometry([QgsPoint(0, 1.5), QgsPoint(1.5, 0)]) + g.reshapeGeometry([QgsPointXY(0, 1.5), QgsPointXY(1.5, 0)]) expWkt = 'Polygon ((0.5 1, 0 1, 0 0, 1 0, 1 0.5, 0.5 1))' wkt = g.exportToWkt() assert compareWkt(expWkt, wkt), "testReshape failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) # Test reshape a geometry involving the first/last vertex (https://issues.qgis.org/issues/14443) - g.reshapeGeometry([QgsPoint(0.5, 1), QgsPoint(0, 0.5)]) + g.reshapeGeometry([QgsPointXY(0.5, 1), QgsPointXY(0, 0.5)]) expWkt = 'Polygon ((0 0.5, 0 0, 1 0, 1 0.5, 0.5 1, 0 0.5))' wkt = g.exportToWkt() @@ -1721,24 +1721,24 @@ class TestQgsGeometry(unittest.TestCase): # Test reshape a line from first/last vertex g = QgsGeometry.fromWkt('LineString (0 0, 5 0, 5 1)') # extend start - self.assertEqual(g.reshapeGeometry([QgsPoint(0, 0), QgsPoint(-1, 0)]), 0) + self.assertEqual(g.reshapeGeometry([QgsPointXY(0, 0), QgsPointXY(-1, 0)]), 0) expWkt = 'LineString (-1 0, 0 0, 5 0, 5 1)' wkt = g.exportToWkt() assert compareWkt(expWkt, wkt), "testReshape failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) # extend end - self.assertEqual(g.reshapeGeometry([QgsPoint(5, 1), QgsPoint(10, 1), QgsPoint(10, 2)]), 0) + self.assertEqual(g.reshapeGeometry([QgsPointXY(5, 1), QgsPointXY(10, 1), QgsPointXY(10, 2)]), 0) expWkt = 'LineString (-1 0, 0 0, 5 0, 5 1, 10 1, 10 2)' wkt = g.exportToWkt() assert compareWkt(expWkt, wkt), "testReshape failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) # test with reversed lines g = QgsGeometry.fromWkt('LineString (0 0, 5 0, 5 1)') # extend start - self.assertEqual(g.reshapeGeometry([QgsPoint(-1, 0), QgsPoint(0, 0)]), 0) + self.assertEqual(g.reshapeGeometry([QgsPointXY(-1, 0), QgsPointXY(0, 0)]), 0) expWkt = 'LineString (-1 0, 0 0, 5 0, 5 1)' wkt = g.exportToWkt() assert compareWkt(expWkt, wkt), "testReshape failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) # extend end - self.assertEqual(g.reshapeGeometry([QgsPoint(10, 2), QgsPoint(10, 1), QgsPoint(5, 1)]), 0) + self.assertEqual(g.reshapeGeometry([QgsPointXY(10, 2), QgsPointXY(10, 1), QgsPointXY(5, 1)]), 0) expWkt = 'LineString (-1 0, 0 0, 5 0, 5 1, 10 1, 10 2)' wkt = g.exportToWkt() assert compareWkt(expWkt, wkt), "testReshape failed: mismatch Expected:\n%s\nGot:\n%s\n" % (expWkt, wkt) @@ -4115,8 +4115,8 @@ class TestQgsGeometry(unittest.TestCase): "centroid: mismatch using QgsAbstractGeometry methods Input {} \n Expected:\n{}\nGot:\n{}\n".format(t[0], exp, result)) def testCompare(self): - lp = [QgsPoint(1, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)] - lp2 = [QgsPoint(1, 1.0000001), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)] + lp = [QgsPointXY(1, 1), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)] + lp2 = [QgsPointXY(1, 1.0000001), QgsPointXY(2, 2), QgsPointXY(1, 2), QgsPointXY(1, 1)] self.assertTrue(QgsGeometry.compare(lp, lp)) # line-line self.assertTrue(QgsGeometry.compare([lp], [lp])) # pylygon-polygon self.assertTrue(QgsGeometry.compare([[lp]], [[lp]])) # multipyolygon-multipolygon diff --git a/tests/src/python/test_qgsgraduatedsymbolrenderer.py b/tests/src/python/test_qgsgraduatedsymbolrenderer.py index bdd56e355e2..120272bc39f 100644 --- a/tests/src/python/test_qgsgraduatedsymbolrenderer.py +++ b/tests/src/python/test_qgsgraduatedsymbolrenderer.py @@ -58,7 +58,7 @@ def createMemoryLayer(values): feat = QgsFeature(fields) feat['id'] = id feat['value'] = value - g = QgsGeometry.fromPoint(QgsPoint(x, x)) + g = QgsGeometry.fromPoint(QgsPointXY(x, x)) feat.setGeometry(g) pr.addFeatures([feat]) ml.updateExtents() diff --git a/tests/src/python/test_qgsissue7244.py b/tests/src/python/test_qgsissue7244.py index f1ecbd4ed35..c340ead543e 100644 --- a/tests/src/python/test_qgsissue7244.py +++ b/tests/src/python/test_qgsissue7244.py @@ -97,8 +97,8 @@ class TestQgsSpatialiteProvider(unittest.TestCase): assert(layer.hasGeometryType()) layer.featureCount() == 1 or die("wrong number of features") layer.startEditing() - layer.splitFeatures([QgsPoint(0.5, -0.5), QgsPoint(0.5, 1.5)], 0) == 0 or die("error in split of one polygon of multipolygon") - layer.splitFeatures([QgsPoint(2.5, -0.5), QgsPoint(2.5, 4)], 0) == 0 or die("error in split of two polygons of multipolygon at a time") + layer.splitFeatures([QgsPointXY(0.5, -0.5), QgsPointXY(0.5, 1.5)], 0) == 0 or die("error in split of one polygon of multipolygon") + layer.splitFeatures([QgsPointXY(2.5, -0.5), QgsPointXY(2.5, 4)], 0) == 0 or die("error in split of two polygons of multipolygon at a time") layer.commitChanges() or die("this commit should work") layer.featureCount() == 7 or die("wrong number of features after 2 split") @@ -109,7 +109,7 @@ class TestQgsSpatialiteProvider(unittest.TestCase): assert(layer.hasGeometryType()) layer.featureCount() == 1 or die("wrong number of features") layer.startEditing() - layer.splitFeatures([QgsPoint(1.5, -0.5), QgsPoint(1.5, 1.5)], 0) == 0 or die("error when trying to create an invalid polygon in split") + layer.splitFeatures([QgsPointXY(1.5, -0.5), QgsPointXY(1.5, 1.5)], 0) == 0 or die("error when trying to create an invalid polygon in split") layer.commitChanges() or die("this commit should work") layer.featureCount() == 1 or die("wrong number of features, polygon should be unafected by cut") diff --git a/tests/src/python/test_qgsjsonutils.py b/tests/src/python/test_qgsjsonutils.py index 6d25666f749..ecd247f4e8d 100644 --- a/tests/src/python/test_qgsjsonutils.py +++ b/tests/src/python/test_qgsjsonutils.py @@ -138,7 +138,7 @@ class TestQgsJsonUtils(unittest.TestCase): fields.append(QgsField("population", QVariant.Int)) feature = QgsFeature(fields, 5) - feature.setGeometry(QgsGeometry(QgsPointV2(5, 6))) + feature.setGeometry(QgsGeometry(QgsPoint(5, 6))) feature.setAttributes(['Valsier Peninsula', 6.8, 198]) expected = """{"name":"Valsier Peninsula", @@ -168,7 +168,7 @@ class TestQgsJsonUtils(unittest.TestCase): fields.append(QgsField("population", QVariant.Int)) feature = QgsFeature(fields, 5) - feature.setGeometry(QgsGeometry(QgsPointV2(5, 6))) + feature.setGeometry(QgsGeometry(QgsPoint(5, 6))) feature.setAttributes(['Valsier Peninsula', 6.8, 198]) exporter = QgsJsonExporter() @@ -188,7 +188,7 @@ class TestQgsJsonUtils(unittest.TestCase): # test with linestring for bbox inclusion l = QgsLineString() - l.setPoints([QgsPointV2(5, 6), QgsPointV2(15, 16)]) + l.setPoints([QgsPoint(5, 6), QgsPoint(15, 16)]) feature.setGeometry(QgsGeometry(QgsLineString(l))) expected = """{ @@ -206,7 +206,7 @@ class TestQgsJsonUtils(unittest.TestCase): self.assertEqual(exporter.exportFeature(feature), expected) # test that precision is respected - feature.setGeometry(QgsGeometry(QgsPointV2(5.444444444, 6.333333333))) + feature.setGeometry(QgsGeometry(QgsPoint(5.444444444, 6.333333333))) exporter.setPrecision(3) self.assertEqual(exporter.precision(), 3) expected = """{ @@ -221,7 +221,7 @@ class TestQgsJsonUtils(unittest.TestCase): } }""" self.assertEqual(exporter.exportFeature(feature), expected) - feature.setGeometry(QgsGeometry(QgsPointV2(5, 6))) + feature.setGeometry(QgsGeometry(QgsPoint(5, 6))) exporter.setPrecision(17) # test that attribute subset is respected @@ -329,7 +329,7 @@ class TestQgsJsonUtils(unittest.TestCase): self.assertEqual(exporter.exportFeature(feature), expected) exporter.setIncludeGeometry(True) - feature.setGeometry(QgsGeometry(QgsPointV2(5, 6))) + feature.setGeometry(QgsGeometry(QgsPoint(5, 6))) # test excluding attributes exporter.setIncludeAttributes(False) @@ -462,7 +462,7 @@ class TestQgsJsonUtils(unittest.TestCase): # test that exported feature is reprojected feature = QgsFeature(layer.fields(), 5) - feature.setGeometry(QgsGeometry(QgsPointV2(2502577, 2403869))) + feature.setGeometry(QgsGeometry(QgsPoint(2502577, 2403869))) feature.setAttributes(['test point']) # low precision, only need rough coordinate to check and don't want to deal with rounding errors @@ -622,7 +622,7 @@ class TestQgsJsonUtils(unittest.TestCase): fields.append(QgsField("population", QVariant.Int)) feature = QgsFeature(fields, 5) - feature.setGeometry(QgsGeometry(QgsPointV2(5, 6))) + feature.setGeometry(QgsGeometry(QgsPoint(5, 6))) feature.setAttributes(['Valsier Peninsula', 6.8, 198]) exporter = QgsJsonExporter() @@ -646,7 +646,7 @@ class TestQgsJsonUtils(unittest.TestCase): # multiple features feature2 = QgsFeature(fields, 6) - feature2.setGeometry(QgsGeometry(QgsPointV2(7, 8))) + feature2.setGeometry(QgsGeometry(QgsPoint(7, 8))) feature2.setAttributes(['Henry Gale Island', 9.7, 38]) expected = """{ "type": "FeatureCollection", diff --git a/tests/src/python/test_qgsmapcanvasannotationitem.py b/tests/src/python/test_qgsmapcanvasannotationitem.py index e814e34e8bb..1da73a69d53 100644 --- a/tests/src/python/test_qgsmapcanvasannotationitem.py +++ b/tests/src/python/test_qgsmapcanvasannotationitem.py @@ -40,7 +40,7 @@ class TestQgsMapCanvasAnnotationItem(unittest.TestCase): a = QgsTextAnnotation() a.setFrameSize(QSizeF(300, 200)) a.setFrameOffsetFromReferencePoint(QPointF(40, 50)) - a.setMapPosition(QgsPoint(12, 34)) + a.setMapPosition(QgsPointXY(12, 34)) a.setMapPositionCrs(QgsCoordinateReferenceSystem(4326)) canvas = QgsMapCanvas() @@ -60,7 +60,7 @@ class TestQgsMapCanvasAnnotationItem(unittest.TestCase): self.assertAlmostEqual(i.pos().y(), 110, 1) # shift annotation map position, check that item is moved - a.setMapPosition(QgsPoint(14, 32)) + a.setMapPosition(QgsPointXY(14, 32)) self.assertAlmostEqual(i.pos().x(), 240, 1) self.assertAlmostEqual(i.pos().y(), 230, 1) @@ -126,7 +126,7 @@ class TestQgsMapCanvasAnnotationItem(unittest.TestCase): a.setFrameSize(QSizeF(300, 200)) a.setFrameOffsetFromReferencePoint(QPointF(40, 50)) a.setHasFixedMapPosition(True) - a.setMapPosition(QgsPoint(12, 34)) + a.setMapPosition(QgsPointXY(12, 34)) a.setMapPositionCrs(QgsCoordinateReferenceSystem(4326)) canvas = QgsMapCanvas() @@ -142,18 +142,18 @@ class TestQgsMapCanvasAnnotationItem(unittest.TestCase): 'test', "memory") canvas.setLayers([layer]) f = QgsFeature(layer.fields()) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(14, 31))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(14, 31))) f.setValid(True) f.setAttributes(['hurstbridge', 'somewhere']) self.assertTrue(layer.dataProvider().addFeatures([f])) a.setMapLayer(layer) self.assertFalse(a.associatedFeature().isValid()) - a.setMapPosition(QgsPoint(14, 31)) + a.setMapPosition(QgsPointXY(14, 31)) self.assertTrue(a.associatedFeature().isValid()) self.assertEqual(a.associatedFeature().attributes()[0], 'hurstbridge') - a.setMapPosition(QgsPoint(17, 31)) + a.setMapPosition(QgsPointXY(17, 31)) self.assertFalse(a.associatedFeature().isValid()) diff --git a/tests/src/python/test_qgsmaprenderer.py b/tests/src/python/test_qgsmaprenderer.py index 72ef1343b50..afe0308a942 100644 --- a/tests/src/python/test_qgsmaprenderer.py +++ b/tests/src/python/test_qgsmaprenderer.py @@ -391,7 +391,7 @@ class TestQgsMapRenderer(unittest.TestCase): for i in range(2000): x = uniform(5, 25) y = uniform(25, 45) - g = QgsGeometry.fromPoint(QgsPoint(x, y)) + g = QgsGeometry.fromPoint(QgsPointXY(x, y)) f = QgsFeature() f.setGeometry(g) f.initAttributes(1) diff --git a/tests/src/python/test_qgspoint.py b/tests/src/python/test_qgspoint.py index e1828630761..229748e220c 100644 --- a/tests/src/python/test_qgspoint.py +++ b/tests/src/python/test_qgspoint.py @@ -21,14 +21,14 @@ from qgis.testing import start_app, unittest start_app() -class TestQgsPoint(unittest.TestCase): +class TestQgsPointXY(unittest.TestCase): def __init__(self, methodName): """Run once on class initialization.""" unittest.TestCase.__init__(self, methodName) def setUp(self): - self.mPoint = QgsPoint(10.0, 10.0) + self.mPoint = QgsPointXY(10.0, 10.0) def test_Point(self): myExpectedValue = 10.0 @@ -43,11 +43,11 @@ class TestQgsPoint(unittest.TestCase): assert myExpectedValue == myActualValue, myMessage def test_hash(self): - a = QgsPoint(2.0, 1.0) - b = QgsPoint(2.0, 2.0) - c = QgsPoint(1.0, 2.0) - d = QgsPoint(1.0, 1.0) - e = QgsPoint(2.0, 1.0) + a = QgsPointXY(2.0, 1.0) + b = QgsPointXY(2.0, 2.0) + c = QgsPointXY(1.0, 2.0) + d = QgsPointXY(1.0, 1.0) + e = QgsPointXY(2.0, 1.0) assert a.__hash__() != b.__hash__() assert e.__hash__() == a.__hash__() diff --git a/tests/src/python/test_qgsrangewidgets.py b/tests/src/python/test_qgsrangewidgets.py index a19c44251e2..9e9258efafc 100644 --- a/tests/src/python/test_qgsrangewidgets.py +++ b/tests/src/python/test_qgsrangewidgets.py @@ -36,7 +36,7 @@ class TestQgsRangeWidget(unittest.TestCase): pr = self.layer.dataProvider() # NOQA f = QgsFeature() f.setAttributes(["Hello World", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(600000, 200000))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(600000, 200000))) def __createRangeWidget(self, allownull=False): """ diff --git a/tests/src/python/test_qgsrasterlayer.py b/tests/src/python/test_qgsrasterlayer.py index d5259955c47..80f91ac9ba7 100644 --- a/tests/src/python/test_qgsrasterlayer.py +++ b/tests/src/python/test_qgsrasterlayer.py @@ -55,7 +55,7 @@ class TestQgsRasterLayer(unittest.TestCase): myRasterLayer = QgsRasterLayer(myPath, myBaseName) myMessage = 'Raster not loaded: %s' % myPath assert myRasterLayer.isValid(), myMessage - myPoint = QgsPoint(786690, 3345803) + myPoint = QgsPointXY(786690, 3345803) # print 'Extents: %s' % myRasterLayer.extent().toString() #myResult, myRasterValues = myRasterLayer.identify(myPoint) #assert myResult diff --git a/tests/src/python/test_qgsrectangle.py b/tests/src/python/test_qgsrectangle.py index 241d873aafd..0cbc817df4c 100644 --- a/tests/src/python/test_qgsrectangle.py +++ b/tests/src/python/test_qgsrectangle.py @@ -64,7 +64,7 @@ class TestQgsRectangle(unittest.TestCase): myMessage = ('Expected: %s\nGot: %s\n' % ("5.0, 5.0", rect.center().toString())) - assert rect.center() == QgsPoint(5.0, 5.0), myMessage + assert rect.center() == QgsPointXY(5.0, 5.0), myMessage rect.scale(2.0) @@ -103,8 +103,8 @@ class TestQgsRectangle(unittest.TestCase): def testContains(self): rect1 = QgsRectangle(0.0, 0.0, 5.0, 5.0) rect2 = QgsRectangle(2.0, 2.0, 7.0, 7.0) - pnt1 = QgsPoint(4.0, 4.0) - pnt2 = QgsPoint(6.0, 2.0) + pnt1 = QgsPointXY(4.0, 4.0) + pnt2 = QgsPointXY(6.0, 2.0) rect3 = rect1.intersect(rect2) @@ -148,7 +148,7 @@ class TestQgsRectangle(unittest.TestCase): def testUnion(self): rect1 = QgsRectangle(0.0, 0.0, 5.0, 5.0) rect2 = QgsRectangle(2.0, 2.0, 7.0, 7.0) - pnt1 = QgsPoint(6.0, 2.0) + pnt1 = QgsPointXY(6.0, 2.0) rect1.combineExtentWith(rect2) myMessage = ('Expected: %s\nGot: %s\n' % diff --git a/tests/src/python/test_qgsrelation.py b/tests/src/python/test_qgsrelation.py index 1d506e7186e..5b3a86f60a4 100644 --- a/tests/src/python/test_qgsrelation.py +++ b/tests/src/python/test_qgsrelation.py @@ -33,11 +33,11 @@ def createReferencingLayer(): f1 = QgsFeature() f1.setFields(layer.pendingFields()) f1.setAttributes(["test1", 123]) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setFields(layer.pendingFields()) f2.setAttributes(["test2", 123]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(101, 201))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(101, 201))) assert pr.addFeatures([f1, f2]) return layer @@ -50,15 +50,15 @@ def createReferencedLayer(): f1 = QgsFeature() f1.setFields(layer.pendingFields()) f1.setAttributes(["foo", 123, 321]) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 1))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 1))) f2 = QgsFeature() f2.setFields(layer.pendingFields()) f2.setAttributes(["bar", 456, 654]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 2))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 2))) f3 = QgsFeature() f3.setFields(layer.pendingFields()) f3.setAttributes(["foobar", 789, 554]) - f3.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 3))) + f3.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 3))) assert pr.addFeatures([f1, f2, f3]) return layer diff --git a/tests/src/python/test_qgsrenderer.py b/tests/src/python/test_qgsrenderer.py index 4d07a73f90f..c0349a7cd53 100644 --- a/tests/src/python/test_qgsrenderer.py +++ b/tests/src/python/test_qgsrenderer.py @@ -33,11 +33,11 @@ def createReferencingLayer(): f1 = QgsFeature() f1.setFields(layer.pendingFields()) f1.setAttributes(["test1", 123]) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setFields(layer.pendingFields()) f2.setAttributes(["test2", 123]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(101, 201))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(101, 201))) assert pr.addFeatures([f1, f2]) return layer diff --git a/tests/src/python/test_qgsserver_wfst.py b/tests/src/python/test_qgsserver_wfst.py index 37f1268ecdc..150de6a1f4a 100644 --- a/tests/src/python/test_qgsserver_wfst.py +++ b/tests/src/python/test_qgsserver_wfst.py @@ -238,15 +238,15 @@ class TestWFST(unittest.TestCase): wfs_layer = self._getWFSLayer(layer_name) feat1 = QgsFeature(wfs_layer.pendingFields()) feat1['id'] = 11 - feat1.setGeometry(QgsGeometry.fromPoint(QgsPoint(9, 45))) + feat1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(9, 45))) feat2 = QgsFeature(wfs_layer.pendingFields()) - feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(9.5, 45.5))) + feat2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(9.5, 45.5))) feat2['id'] = 12 old_features = [feat1, feat2] # Change feat1 new_feat1 = QgsFeature(wfs_layer.pendingFields()) new_feat1['id'] = 121 - new_feat1.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 46))) + new_feat1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 46))) new_features = [new_feat1, feat2] self._testLayer(wfs_layer, layer, old_features, new_features) @@ -261,9 +261,9 @@ class TestWFST(unittest.TestCase): feat1 = QgsFeature(wfs_layer.pendingFields()) feat1['id'] = 11 feat1['name'] = 'name 11' - feat1.setGeometry(QgsGeometry.fromPoint(QgsPoint(9, 45))) + feat1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(9, 45))) feat2 = QgsFeature(wfs_layer.pendingFields()) - feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(9.5, 45.5))) + feat2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(9.5, 45.5))) feat2['id'] = 12 feat2['name'] = 'name 12' old_features = [feat1, feat2] @@ -271,11 +271,11 @@ class TestWFST(unittest.TestCase): new_feat1 = QgsFeature(wfs_layer.pendingFields()) new_feat1['id'] = 121 new_feat1['name'] = 'name 121' - new_feat1.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 46))) + new_feat1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 46))) new_feat2 = QgsFeature(wfs_layer.pendingFields()) new_feat2['id'] = 122 new_feat2['name'] = 'name 122' - new_feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(10.5, 47))) + new_feat2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10.5, 47))) new_features = [new_feat1, new_feat2] self._testLayer(wfs_layer, layer, old_features, new_features) @@ -289,9 +289,9 @@ class TestWFST(unittest.TestCase): feat1 = QgsFeature(wfs_layer.pendingFields()) feat1['id'] = 11 feat1['name'] = 'name 11' - feat1.setGeometry(QgsGeometry.fromRect(QgsRectangle(QgsPoint(9, 45), QgsPoint(10, 46)))) + feat1.setGeometry(QgsGeometry.fromRect(QgsRectangle(QgsPointXY(9, 45), QgsPointXY(10, 46)))) feat2 = QgsFeature(wfs_layer.pendingFields()) - feat2.setGeometry(QgsGeometry.fromRect(QgsRectangle(QgsPoint(9.5, 45.5), QgsPoint(10.5, 46.5)))) + feat2.setGeometry(QgsGeometry.fromRect(QgsRectangle(QgsPointXY(9.5, 45.5), QgsPointXY(10.5, 46.5)))) feat2['id'] = 12 feat2['name'] = 'name 12' old_features = [feat1, feat2] @@ -299,7 +299,7 @@ class TestWFST(unittest.TestCase): new_feat1 = QgsFeature(wfs_layer.pendingFields()) new_feat1['id'] = 121 new_feat1['name'] = 'name 121' - new_feat1.setGeometry(QgsGeometry.fromRect(QgsRectangle(QgsPoint(10, 46), QgsPoint(11.5, 47.5)))) + new_feat1.setGeometry(QgsGeometry.fromRect(QgsRectangle(QgsPointXY(10, 46), QgsPointXY(11.5, 47.5)))) new_features = [new_feat1, feat2] self._testLayer(wfs_layer, layer, old_features, new_features) @@ -313,9 +313,9 @@ class TestWFST(unittest.TestCase): feat1 = QgsFeature(wfs_layer.pendingFields()) feat1['id'] = 11 feat1['name'] = 'name 11' - feat1.setGeometry(QgsGeometry.fromPolyline([QgsPoint(9, 45), QgsPoint(10, 46)])) + feat1.setGeometry(QgsGeometry.fromPolyline([QgsPointXY(9, 45), QgsPointXY(10, 46)])) feat2 = QgsFeature(wfs_layer.pendingFields()) - feat2.setGeometry(QgsGeometry.fromPolyline([QgsPoint(9.5, 45.5), QgsPoint(10.5, 46.5)])) + feat2.setGeometry(QgsGeometry.fromPolyline([QgsPointXY(9.5, 45.5), QgsPointXY(10.5, 46.5)])) feat2['id'] = 12 feat2['name'] = 'name 12' old_features = [feat1, feat2] @@ -323,7 +323,7 @@ class TestWFST(unittest.TestCase): new_feat1 = QgsFeature(wfs_layer.pendingFields()) new_feat1['id'] = 121 new_feat1['name'] = 'name 121' - new_feat1.setGeometry(QgsGeometry.fromPolyline([QgsPoint(9.8, 45.8), QgsPoint(10.8, 46.8)])) + new_feat1.setGeometry(QgsGeometry.fromPolyline([QgsPointXY(9.8, 45.8), QgsPointXY(10.8, 46.8)])) new_features = [new_feat1, feat2] self._testLayer(wfs_layer, layer, old_features, new_features) diff --git a/tests/src/python/test_qgsspatialindex.py b/tests/src/python/test_qgsspatialindex.py index 6bb04465e37..d6a81094d38 100644 --- a/tests/src/python/test_qgsspatialindex.py +++ b/tests/src/python/test_qgsspatialindex.py @@ -34,7 +34,7 @@ class TestQgsSpatialIndex(unittest.TestCase): for x in range(5, 25, 5): ft = QgsFeature() ft.setId(fid) - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(x, y))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(x, y))) idx.insertFeature(ft) fid += 1 @@ -51,7 +51,7 @@ class TestQgsSpatialIndex(unittest.TestCase): assert fids == [1, 2, 5, 6], myMessage # nearest neighbor test - fids = idx.nearestNeighbor(QgsPoint(8.75, 6.25), 3) + fids = idx.nearestNeighbor(QgsPointXY(8.75, 6.25), 3) myExpectedValue = 0 myValue = len(fids) myMessage = 'Expected: %s Got: %s' % (myExpectedValue, myValue) diff --git a/tests/src/python/test_qgssymbollayer_readsld.py b/tests/src/python/test_qgssymbollayer_readsld.py index 70387569c23..8baeff70eae 100644 --- a/tests/src/python/test_qgssymbollayer_readsld.py +++ b/tests/src/python/test_qgssymbollayer_readsld.py @@ -58,7 +58,7 @@ def createLayerWithOneLine(): linelayer = QgsVectorLayer("LineString?crs=epsg:4326&field=gid:int&field=name:string", "simple_line", "memory") one = QgsFeature(linelayer.dataProvider().fields(), 0) one.setAttributes([1, 'one']) - one.setGeometry(QgsGeometry.fromPolyline([QgsPoint(-7, 38), QgsPoint(-8, 42)])) + one.setGeometry(QgsGeometry.fromPolyline([QgsPointXY(-7, 38), QgsPointXY(-8, 42)])) linelayer.dataProvider().addFeatures([one]) return linelayer @@ -69,7 +69,7 @@ def createLayerWithOnePoint(): pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) assert pr.addFeatures([f]) assert layer.pendingFeatureCount() == 1 return layer @@ -80,7 +80,7 @@ def createLayerWithOnePolygon(): assert layer.isValid() f1 = QgsFeature(layer.dataProvider().fields(), 1) f1.setAttribute("pk", 1) - f1.setGeometry(QgsGeometry.fromPolygon([[QgsPoint(2484588, 2425722), QgsPoint(2482767, 2398853), QgsPoint(2520109, 2397715), QgsPoint(2520792, 2425494), QgsPoint(2484588, 2425722)]])) + f1.setGeometry(QgsGeometry.fromPolygon([[QgsPointXY(2484588, 2425722), QgsPointXY(2482767, 2398853), QgsPointXY(2520109, 2397715), QgsPointXY(2520792, 2425494), QgsPointXY(2484588, 2425722)]])) assert layer.dataProvider().addFeatures([f1]) return layer diff --git a/tests/src/python/test_qgsvectorfilewriter.py b/tests/src/python/test_qgsvectorfilewriter.py index 25a9e5d1576..7d7411f8694 100755 --- a/tests/src/python/test_qgsvectorfilewriter.py +++ b/tests/src/python/test_qgsvectorfilewriter.py @@ -85,7 +85,7 @@ class TestQgsVectorFileWriter(unittest.TestCase): self.assertIsNotNone(myProvider) ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes(['Johny', 20, 0.3]) myResult, myFeatures = myProvider.addFeatures([ft]) self.assertTrue(myResult) @@ -106,7 +106,7 @@ class TestQgsVectorFileWriter(unittest.TestCase): self.assertIsNotNone(provider) ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes([1, QDate(2014, 3, 5), QTime(13, 45, 22), QDateTime(QDate(2014, 3, 5), QTime(13, 45, 22))]) res, features = provider.addFeatures([ft]) self.assertTrue(res) @@ -211,7 +211,7 @@ class TestQgsVectorFileWriter(unittest.TestCase): self.assertIsNotNone(provider) ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes([1, QDate(2014, 3, 5), QTime(13, 45, 22), QDateTime(QDate(2014, 3, 5), QTime(13, 45, 22))]) res, features = provider.addFeatures([ft]) self.assertTrue(res) diff --git a/tests/src/python/test_qgsvectorfilewritertask.py b/tests/src/python/test_qgsvectorfilewritertask.py index 14e0b635f97..9ce12e88fe6 100644 --- a/tests/src/python/test_qgsvectorfilewritertask.py +++ b/tests/src/python/test_qgsvectorfilewritertask.py @@ -58,7 +58,7 @@ class TestQgsVectorFileWriterTask(unittest.TestCase): self.assertIsNotNone(provider) ft = QgsFeature() - ft.setGeometry(QgsGeometry.fromPoint(QgsPoint(10, 10))) + ft.setGeometry(QgsGeometry.fromPoint(QgsPointXY(10, 10))) ft.setAttributes(['Johny', 20, 0.3]) provider.addFeatures([ft]) return layer diff --git a/tests/src/python/test_qgsvectorlayer.py b/tests/src/python/test_qgsvectorlayer.py index a0863a0fd56..cd3f147429c 100644 --- a/tests/src/python/test_qgsvectorlayer.py +++ b/tests/src/python/test_qgsvectorlayer.py @@ -77,7 +77,7 @@ def createLayerWithOnePoint(): pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) assert pr.addFeatures([f]) assert layer.pendingFeatureCount() == 1 return layer @@ -89,10 +89,10 @@ def createLayerWithTwoPoints(): pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setAttributes(["test2", 457]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) assert pr.addFeatures([f, f2]) assert layer.pendingFeatureCount() == 2 return layer @@ -104,19 +104,19 @@ def createLayerWithFivePoints(): pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setAttributes(["test2", 457]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(200, 200))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(200, 200))) f3 = QgsFeature() f3.setAttributes(["test2", 888]) - f3.setGeometry(QgsGeometry.fromPoint(QgsPoint(300, 200))) + f3.setGeometry(QgsGeometry.fromPoint(QgsPointXY(300, 200))) f4 = QgsFeature() f4.setAttributes(["test3", -1]) - f4.setGeometry(QgsGeometry.fromPoint(QgsPoint(400, 300))) + f4.setGeometry(QgsGeometry.fromPoint(QgsPointXY(400, 300))) f5 = QgsFeature() f5.setAttributes(["test4", 0]) - f5.setGeometry(QgsGeometry.fromPoint(QgsPoint(0, 0))) + f5.setGeometry(QgsGeometry.fromPoint(QgsPointXY(0, 0))) assert pr.addFeatures([f, f2, f3, f4, f5]) assert layer.featureCount() == 5 return layer @@ -129,16 +129,16 @@ def createJoinLayer(): pr = joinLayer.dataProvider() f1 = QgsFeature() f1.setAttributes(["foo", 123, 321]) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 1))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 1))) f2 = QgsFeature() f2.setAttributes(["bar", 456, 654]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 2))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 2))) f3 = QgsFeature() f3.setAttributes(["qar", 457, 111]) - f3.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 2))) + f3.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 2))) f4 = QgsFeature() f4.setAttributes(["a", 458, 19]) - f4.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 2))) + f4.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 2))) assert pr.addFeatures([f1, f2, f3, f4]) assert joinLayer.pendingFeatureCount() == 4 return joinLayer @@ -234,18 +234,18 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): def test_AddFeature(self): layer = createEmptyLayerWithFields() feat = QgsFeature(layer.fields()) - feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + feat.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) def checkAfter(): self.assertEqual(layer.pendingFeatureCount(), 1) # check select+nextFeature f = next(layer.getFeatures()) - self.assertEqual(f.geometry().asPoint(), QgsPoint(1, 2)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(1, 2)) # check feature at id f2 = next(layer.getFeatures(QgsFeatureRequest(f.id()))) - self.assertEqual(f2.geometry().asPoint(), QgsPoint(1, 2)) + self.assertEqual(f2.geometry().asPoint(), QgsPointXY(1, 2)) def checkBefore(): self.assertEqual(layer.pendingFeatureCount(), 0) @@ -288,9 +288,9 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): def test_AddFeatures(self): layer = createEmptyLayerWithFields() feat1 = QgsFeature(layer.fields()) - feat1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + feat1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) feat2 = QgsFeature(layer.fields()) - feat2.setGeometry(QgsGeometry.fromPoint(QgsPoint(11, 12))) + feat2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(11, 12))) def checkAfter(): self.assertEqual(layer.pendingFeatureCount(), 2) @@ -298,15 +298,15 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): # check select+nextFeature it = layer.getFeatures() f1 = next(it) - self.assertEqual(f1.geometry().asPoint(), QgsPoint(1, 2)) + self.assertEqual(f1.geometry().asPoint(), QgsPointXY(1, 2)) f2 = next(it) - self.assertEqual(f2.geometry().asPoint(), QgsPoint(11, 12)) + self.assertEqual(f2.geometry().asPoint(), QgsPointXY(11, 12)) # check feature at id f1_1 = next(layer.getFeatures(QgsFeatureRequest(f1.id()))) - self.assertEqual(f1_1.geometry().asPoint(), QgsPoint(1, 2)) + self.assertEqual(f1_1.geometry().asPoint(), QgsPointXY(1, 2)) f2_1 = next(layer.getFeatures(QgsFeatureRequest(f2.id()))) - self.assertEqual(f2_1.geometry().asPoint(), QgsPoint(11, 12)) + self.assertEqual(f2_1.geometry().asPoint(), QgsPointXY(11, 12)) def checkBefore(): self.assertEqual(layer.pendingFeatureCount(), 0) @@ -368,7 +368,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): # check select+nextFeature fi = layer.getFeatures() f = next(fi) - self.assertEqual(f.geometry().asPoint(), QgsPoint(100, 200)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(100, 200)) with self.assertRaises(StopIteration): next(fi) @@ -407,7 +407,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer = createEmptyLayer() feat = QgsFeature() - feat.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + feat.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) def checkBefore(): self.assertEqual(layer.pendingFeatureCount(), 0) @@ -493,7 +493,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.dataProvider().deleteFeatures([1]) # no need for this feature newF = QgsFeature() - newF.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 1))) + newF.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 1))) newF.setAttributes(["hello", 42]) def checkAfter(): @@ -550,25 +550,25 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): def checkAfter(): # check select+nextFeature f = next(layer.getFeatures()) - self.assertEqual(f.geometry().asPoint(), QgsPoint(300, 400)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(300, 400)) # check feature at id f2 = next(layer.getFeatures(QgsFeatureRequest(f.id()))) - self.assertEqual(f2.geometry().asPoint(), QgsPoint(300, 400)) + self.assertEqual(f2.geometry().asPoint(), QgsPointXY(300, 400)) def checkBefore(): # check select+nextFeature f = next(layer.getFeatures()) - self.assertEqual(f.geometry().asPoint(), QgsPoint(100, 200)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(100, 200)) # try to change geometry without editing mode - self.assertFalse(layer.changeGeometry(fid, QgsGeometry.fromPoint(QgsPoint(300, 400)))) + self.assertFalse(layer.changeGeometry(fid, QgsGeometry.fromPoint(QgsPointXY(300, 400)))) checkBefore() # change geometry layer.startEditing() layer.beginEditCommand("ChangeGeometry") - self.assertTrue(layer.changeGeometry(fid, QgsGeometry.fromPoint(QgsPoint(300, 400)))) + self.assertTrue(layer.changeGeometry(fid, QgsGeometry.fromPoint(QgsPointXY(300, 400)))) layer.endEditCommand() checkAfter() @@ -589,17 +589,17 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): def checkAfter(): # check select+nextFeature f = next(layer.getFeatures()) - self.assertEqual(f.geometry().asPoint(), QgsPoint(300, 400)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(300, 400)) self.assertEqual(f[0], "changed") # check feature at id f2 = next(layer.getFeatures(QgsFeatureRequest(f.id()))) - self.assertEqual(f2.geometry().asPoint(), QgsPoint(300, 400)) + self.assertEqual(f2.geometry().asPoint(), QgsPointXY(300, 400)) self.assertEqual(f2[0], "changed") def checkBefore(): # check select+nextFeature f = next(layer.getFeatures()) - self.assertEqual(f.geometry().asPoint(), QgsPoint(100, 200)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(100, 200)) self.assertEqual(f[0], "test") checkBefore() @@ -608,7 +608,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.startEditing() layer.beginEditCommand("ChangeGeometry + ChangeAttribute") self.assertTrue(layer.changeAttributeValue(fid, 0, "changed")) - self.assertTrue(layer.changeGeometry(fid, QgsGeometry.fromPoint(QgsPoint(300, 400)))) + self.assertTrue(layer.changeGeometry(fid, QgsGeometry.fromPoint(QgsPointXY(300, 400)))) layer.endEditCommand() checkAfter() @@ -627,17 +627,17 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.dataProvider().deleteFeatures([1]) # no need for this feature newF = QgsFeature() - newF.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 1))) + newF.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 1))) newF.setAttributes(["hello", 42]) def checkAfter(): self.assertEqual(len(layer.pendingFields()), 2) # check feature f = next(layer.getFeatures()) - self.assertEqual(f.geometry().asPoint(), QgsPoint(2, 2)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(2, 2)) # check feature at id f2 = next(layer.getFeatures(QgsFeatureRequest(f.id()))) - self.assertEqual(f2.geometry().asPoint(), QgsPoint(2, 2)) + self.assertEqual(f2.geometry().asPoint(), QgsPointXY(2, 2)) def checkBefore(): # check feature @@ -649,7 +649,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.startEditing() layer.beginEditCommand("AddFeature+ChangeGeometry") self.assertTrue(layer.addFeature(newF)) - self.assertTrue(layer.changeGeometry(newF.id(), QgsGeometry.fromPoint(QgsPoint(2, 2)))) + self.assertTrue(layer.changeGeometry(newF.id(), QgsGeometry.fromPoint(QgsPointXY(2, 2)))) layer.endEditCommand() checkAfter() @@ -738,7 +738,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.dataProvider().deleteFeatures([1]) # no need for this feature newF = QgsFeature() - newF.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 1))) + newF.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 1))) newF.setAttributes(["hello", 42]) fld1 = QgsField("fld1", QVariant.Int, "integer") @@ -920,7 +920,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.dataProvider().deleteFeatures([1]) # no need for this feature newF = QgsFeature() - newF.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 1))) + newF.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 1))) newF.setAttributes(["hello", 42]) def checkBefore(): @@ -1217,7 +1217,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): self.assertTrue(fi.nextFeature(f)) self.assertTrue(f.isValid()) self.assertEqual(f.id(), 1) - self.assertEqual(f.geometry().asPoint(), QgsPoint(100, 200)) + self.assertEqual(f.geometry().asPoint(), QgsPointXY(100, 200)) self.assertEqual(f["fldtxt"], "test") self.assertEqual(f["fldint"], 123) @@ -1481,7 +1481,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): # CHANGE GEOMETRY self.assertFalse(layer.changeGeometry( - -333, QgsGeometry.fromPoint(QgsPoint(1, 1)))) + -333, QgsGeometry.fromPoint(QgsPointXY(1, 1)))) # CHANGE VALUE @@ -1550,7 +1550,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): self.assertTrue(temp_layer.isValid()) f1 = QgsFeature(temp_layer.dataProvider().fields(), 1) f1.setAttribute("pk", 1) - f1.setGeometry(QgsGeometry.fromPolyline([QgsPoint(2484588, 2425722), QgsPoint(2482767, 2398853)])) + f1.setGeometry(QgsGeometry.fromPolyline([QgsPointXY(2484588, 2425722), QgsPointXY(2482767, 2398853)])) temp_layer.dataProvider().addFeatures([f1]) # set project CRS and ellipsoid @@ -1578,7 +1578,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): self.assertTrue(temp_layer.isValid()) f1 = QgsFeature(temp_layer.dataProvider().fields(), 1) f1.setAttribute("pk", 1) - f1.setGeometry(QgsGeometry.fromPolygon([[QgsPoint(2484588, 2425722), QgsPoint(2482767, 2398853), QgsPoint(2520109, 2397715), QgsPoint(2520792, 2425494), QgsPoint(2484588, 2425722)]])) + f1.setGeometry(QgsGeometry.fromPolygon([[QgsPointXY(2484588, 2425722), QgsPointXY(2482767, 2398853), QgsPointXY(2520109, 2397715), QgsPointXY(2520792, 2425494), QgsPointXY(2484588, 2425722)]])) temp_layer.dataProvider().addFeatures([f1]) # set project CRS and ellipsoid @@ -1925,7 +1925,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): # using feature geometry layer.setDefaultValueExpression(1, '$x * 2') - feature.setGeometry(QgsGeometry(QgsPointV2(6, 7))) + feature.setGeometry(QgsGeometry(QgsPoint(6, 7))) self.assertEqual(layer.defaultValue(1, feature), 12) # using contexts @@ -2118,13 +2118,13 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): f1 = QgsFeature(1) f1.setAttributes(["test", 3]) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(300, 200))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(300, 200))) f2 = QgsFeature(2) f2.setAttributes(["test", 3]) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) f3 = QgsFeature(3) f3.setAttributes(["test", 3]) - f3.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f3.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) self.assertTrue(pr.addFeatures([f1, f2, f3])) req = QgsFeatureRequest().setLimit(2) @@ -2146,7 +2146,7 @@ class TestQgsVectorLayer(unittest.TestCase, FeatureSourceTestCase): layer.startEditing() req = QgsFeatureRequest().setFilterRect(QgsRectangle(50, 100, 150, 300)).setLimit(2) - self.assertTrue(layer.changeGeometry(2, QgsGeometry.fromPoint(QgsPoint(500, 600)))) + self.assertTrue(layer.changeGeometry(2, QgsGeometry.fromPoint(QgsPointXY(500, 600)))) self.assertEqual(len(list(layer.getFeatures(req))), 2) layer.rollBack() diff --git a/tests/src/python/test_qgsvectorlayereditbuffer.py b/tests/src/python/test_qgsvectorlayereditbuffer.py index e6645001a01..45ba00b4d4b 100644 --- a/tests/src/python/test_qgsvectorlayereditbuffer.py +++ b/tests/src/python/test_qgsvectorlayereditbuffer.py @@ -38,7 +38,7 @@ def createLayerWithOnePoint(): pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) - f.setGeometry(QgsGeometry.fromPoint(QgsPoint(100, 200))) + f.setGeometry(QgsGeometry.fromPoint(QgsPointXY(100, 200))) assert pr.addFeatures([f]) assert layer.pendingFeatureCount() == 1 return layer @@ -57,12 +57,12 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): # add two features f1 = QgsFeature(layer.fields(), 1) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) f1.setAttributes(["test", 123]) self.assertTrue(layer.addFeature(f1)) f2 = QgsFeature(layer.fields(), 2) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 4))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 4))) f2.setAttributes(["test2", 246]) self.assertTrue(layer.addFeature(f2)) @@ -89,10 +89,10 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): # add two features f1 = QgsFeature(layer.fields(), 1) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) f1.setAttributes(["test", 123]) f2 = QgsFeature(layer.fields(), 2) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 4))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 4))) f2.setAttributes(["test2", 246]) self.assertTrue(layer.addFeatures([f1, f2])) @@ -117,12 +117,12 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): # add two features f1 = QgsFeature(layer.fields(), 1) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) f1.setAttributes(["test", 123]) self.assertTrue(layer.addFeature(f1)) f2 = QgsFeature(layer.fields(), 2) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 4))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 4))) f2.setAttributes(["test2", 246]) self.assertTrue(layer.addFeature(f2)) @@ -158,12 +158,12 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): # add two features f1 = QgsFeature(layer.fields(), 1) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) f1.setAttributes(["test", 123]) self.assertTrue(layer.addFeature(f1)) f2 = QgsFeature(layer.fields(), 2) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 4))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 4))) f2.setAttributes(["test2", 246]) self.assertTrue(layer.addFeature(f2)) @@ -191,12 +191,12 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): # add two features f1 = QgsFeature(layer.fields(), 1) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) f1.setAttributes(["test", 123]) self.assertTrue(layer.addFeature(f1)) f2 = QgsFeature(layer.fields(), 2) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 4))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 4))) f2.setAttributes(["test2", 246]) self.assertTrue(layer.addFeature(f2)) @@ -234,12 +234,12 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): # add two features f1 = QgsFeature(layer.fields(), 1) - f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(1, 2))) + f1.setGeometry(QgsGeometry.fromPoint(QgsPointXY(1, 2))) f1.setAttributes(["test", 123]) self.assertTrue(layer.addFeature(f1)) f2 = QgsFeature(layer.fields(), 2) - f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(2, 4))) + f2.setGeometry(QgsGeometry.fromPoint(QgsPointXY(2, 4))) f2.setAttributes(["test2", 246]) self.assertTrue(layer.addFeature(f2)) @@ -251,7 +251,7 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): self.assertFalse(layer.editBuffer().isFeatureGeometryChanged(2)) # change attribute values - layer.changeGeometry(1, QgsGeometry.fromPoint(QgsPoint(10, 20))) + layer.changeGeometry(1, QgsGeometry.fromPoint(QgsPointXY(10, 20))) # test contents of buffer self.assertEqual(list(layer.editBuffer().changedGeometries().keys()), [1]) @@ -259,7 +259,7 @@ class TestQgsVectorLayerEditBuffer(unittest.TestCase): self.assertTrue(layer.editBuffer().isFeatureGeometryChanged(1)) self.assertFalse(layer.editBuffer().isFeatureGeometryChanged(2)) - layer.changeGeometry(2, QgsGeometry.fromPoint(QgsPoint(20, 40))) + layer.changeGeometry(2, QgsGeometry.fromPoint(QgsPointXY(20, 40))) # test contents of buffer self.assertEqual(set(layer.editBuffer().changedGeometries().keys()), set([1, 2])) diff --git a/tests/src/python/test_qgsvectorlayerutils.py b/tests/src/python/test_qgsvectorlayerutils.py index ed1f0c6e1c8..73efc213cba 100644 --- a/tests/src/python/test_qgsvectorlayerutils.py +++ b/tests/src/python/test_qgsvectorlayerutils.py @@ -236,7 +236,7 @@ class TestQgsVectorLayerUtils(unittest.TestCase): self.assertEqual(f.attributes(), [NULL, NULL, NULL]) # set geometry - g = QgsGeometry.fromPoint(QgsPoint(100, 200)) + g = QgsGeometry.fromPoint(QgsPointXY(100, 200)) f = QgsVectorLayerUtils.createFeature(layer, g) self.assertTrue(f.hasGeometry()) self.assertEqual(f.geometry().exportToWkt(), g.exportToWkt())