From 5d476e51dfcbf9a2d3634cf6b7a6d5b12e93f406 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 14 Nov 2017 16:07:39 +1000 Subject: [PATCH] Use QVector where possible in geometry classes --- python/core/geometry/qgsabstractgeometry.sip | 6 +- python/core/geometry/qgscurvepolygon.sip | 2 +- python/core/geometry/qgsgeometry.sip | 20 +-- .../core/geometry/qgsgeometrycollection.sip | 2 +- python/core/geometry/qgsgeometryengine.sip | 6 +- python/core/geometry/qgsgeometryutils.sip | 4 +- python/core/geometry/qgslinestring.sip | 2 +- python/core/geometry/qgsregularpolygon.sip | 2 +- python/core/qgsdistancearea.sip | 4 +- python/core/qgsgeometryvalidator.sip | 4 +- python/core/qgsvectorlayer.sip | 6 +- python/core/qgsvectorlayereditutils.sip | 6 +- python/gui/qgsmaptoolcapture.sip | 4 +- python/gui/qgsmaptooledit.sip | 2 +- .../processing/qgsalgorithmbuffer.cpp | 2 +- src/analysis/processing/qgsalgorithmclip.cpp | 2 +- .../processing/qgsalgorithmdissolve.cpp | 10 +- .../processing/qgsalgorithmdissolve.h | 2 +- .../processing/qgsalgorithmfixgeometries.cpp | 4 +- .../processing/qgsalgorithmsplitwithlines.cpp | 16 +-- .../geometry_checker/qgsgeometrygapcheck.cpp | 2 +- src/app/qgsmaptoolfillring.cpp | 4 +- src/app/qgsmeasuredialog.cpp | 12 +- src/app/qgsmeasuretool.cpp | 4 +- src/app/qgsmeasuretool.h | 4 +- src/core/composer/qgscomposermapgrid.cpp | 4 +- src/core/expression/qgsexpressionfunction.cpp | 2 +- src/core/geometry/qgsabstractgeometry.h | 10 +- src/core/geometry/qgscompoundcurve.cpp | 51 +++---- src/core/geometry/qgscompoundcurve.h | 4 +- src/core/geometry/qgscurvepolygon.cpp | 47 +++---- src/core/geometry/qgscurvepolygon.h | 4 +- src/core/geometry/qgsgeometry.cpp | 42 +++--- src/core/geometry/qgsgeometry.h | 20 +-- src/core/geometry/qgsgeometrycollection.cpp | 6 +- src/core/geometry/qgsgeometrycollection.h | 2 +- src/core/geometry/qgsgeometryeditutils.cpp | 6 +- src/core/geometry/qgsgeometryengine.h | 8 +- src/core/geometry/qgsgeometryfactory.cpp | 2 +- src/core/geometry/qgsgeometryutils.cpp | 12 +- src/core/geometry/qgsgeometryutils.h | 6 +- src/core/geometry/qgsgeos.cpp | 20 +-- src/core/geometry/qgsgeos.h | 12 +- .../geometry/qgsinternalgeometryengine.cpp | 8 +- src/core/geometry/qgslinestring.cpp | 2 +- src/core/geometry/qgslinestring.h | 2 +- src/core/geometry/qgsmulticurve.cpp | 2 +- src/core/geometry/qgsmultilinestring.cpp | 2 +- src/core/geometry/qgsmultipoint.cpp | 2 +- src/core/geometry/qgsmultipolygon.cpp | 2 +- src/core/geometry/qgsmultisurface.cpp | 2 +- src/core/geometry/qgsregularpolygon.cpp | 4 +- src/core/geometry/qgsregularpolygon.h | 2 +- src/core/geometry/qgstriangle.h | 2 +- src/core/layout/qgslayoutitemmapgrid.cpp | 4 +- src/core/qgsaggregatecalculator.cpp | 2 +- src/core/qgsdistancearea.cpp | 22 +-- src/core/qgsdistancearea.h | 10 +- src/core/qgsgeometryvalidator.cpp | 4 +- src/core/qgsgeometryvalidator.h | 6 +- src/core/qgssnappingutils.cpp | 2 +- src/core/qgstracer.cpp | 2 +- src/core/qgsvectorlayer.cpp | 6 +- src/core/qgsvectorlayer.h | 6 +- src/core/qgsvectorlayereditutils.cpp | 22 +-- src/core/qgsvectorlayereditutils.h | 8 +- .../symbology/qgsinvertedpolygonrenderer.h | 2 +- src/gui/qgsmaptoolcapture.cpp | 6 +- src/gui/qgsmaptoolcapture.h | 4 +- src/gui/qgsmaptooledit.cpp | 4 +- src/gui/qgsmaptooledit.h | 2 +- src/plugins/topology/topolTest.cpp | 2 +- .../arcgisrest/qgsarcgisrestutils.cpp | 2 +- tests/src/core/testqgsdistancearea.cpp | 2 +- tests/src/core/testqgsgeometry.cpp | 130 +++++++++--------- tests/src/core/testqgsgeometryutils.cpp | 16 +-- .../providers/grass/testqgsgrassprovider.cpp | 2 +- 77 files changed, 336 insertions(+), 350 deletions(-) diff --git a/python/core/geometry/qgsabstractgeometry.sip b/python/core/geometry/qgsabstractgeometry.sip index 9a9f6936527..9a3713096e6 100644 --- a/python/core/geometry/qgsabstractgeometry.sip +++ b/python/core/geometry/qgsabstractgeometry.sip @@ -10,9 +10,9 @@ -typedef QList< QgsPoint > QgsPointSequence; -typedef QList< QList< QgsPoint > > QgsRingSequence; -typedef QList< QList< QList< QgsPoint > > > QgsCoordinateSequence; +typedef QVector< QgsPoint > QgsPointSequence; +typedef QVector< QVector< QgsPoint > > QgsRingSequence; +typedef QVector< QVector< QVector< QgsPoint > > > QgsCoordinateSequence; class QgsAbstractGeometry { diff --git a/python/core/geometry/qgscurvepolygon.sip b/python/core/geometry/qgscurvepolygon.sip index e53ddbe4da2..f608d19f369 100644 --- a/python/core/geometry/qgscurvepolygon.sip +++ b/python/core/geometry/qgscurvepolygon.sip @@ -100,7 +100,7 @@ class QgsCurvePolygon: QgsSurface .. seealso:: exteriorRing() %End - void setInteriorRings( const QList &rings /Transfer/ ); + void setInteriorRings( const QVector &rings /Transfer/ ); %Docstring Sets all interior rings (takes ownership) %End diff --git a/python/core/geometry/qgsgeometry.sip b/python/core/geometry/qgsgeometry.sip index 6959c58eb2e..6533802c3e4 100644 --- a/python/core/geometry/qgsgeometry.sip +++ b/python/core/geometry/qgsgeometry.sip @@ -204,7 +204,7 @@ Creates a new geometry from a QgsMultiPolygon Creates a new geometry from a QgsRectangle :rtype: QgsGeometry %End - static QgsGeometry collectGeometry( const QList< QgsGeometry > &geometries ); + static QgsGeometry collectGeometry( const QVector &geometries ); %Docstring Creates a new multipart geometry from a list of QgsGeometry objects :rtype: QgsGeometry @@ -503,7 +503,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: float %End - OperationResult addRing( const QList &ring ); + OperationResult addRing( const QVector &ring ); %Docstring Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. \param ring The ring to be added @@ -519,7 +519,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: OperationResult %End - OperationResult addPart( const QList &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) /PyName=addPointsXY/; + OperationResult addPart( const QVector &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) /PyName=addPointsXY/; %Docstring Adds a new part to a the geometry. \param points points describing part to add @@ -596,7 +596,7 @@ Returns true if WKB of the geometry is of WKBMulti* type :rtype: OperationResult %End - OperationResult splitGeometry( const QList &splitLine, QList &newGeometries /Out/, bool topological, QList &topologyTestPoints /Out/ ); + OperationResult splitGeometry( const QVector &splitLine, QVector &newGeometries /Out/, bool topological, QVector &topologyTestPoints /Out/ ); %Docstring Splits this geometry according to a given line. \param splitLine the line that splits the geometry @@ -1172,7 +1172,7 @@ Returns an extruded version of this geometry. :rtype: QgsMultiPolygonXY %End - QList asGeometryCollection() const; + QVector asGeometryCollection() const; %Docstring Return contents of the geometry as a list of geometries .. versionadded:: 1.1 @@ -1305,7 +1305,7 @@ Returns an extruded version of this geometry. ValidatorGeos, }; - void validateGeometry( QList &errors /Out/, ValidationMethod method = ValidatorQgisInternal ) const; + void validateGeometry( QVector &errors /Out/, ValidationMethod method = ValidatorQgisInternal ) const; %Docstring Validates geometry and produces a list of geometry errors. The ``method`` argument dictates which validator to utilize. @@ -1316,7 +1316,7 @@ Returns an extruded version of this geometry. * %End - static QgsGeometry unaryUnion( const QList &geometries ); + static QgsGeometry unaryUnion( const QVector &geometries ); %Docstring Compute the unary union on a list of ``geometries``. May be faster than an iterative union on a set of geometries. The returned geometry will be fully noded, i.e. a node will be created at every common intersection of the @@ -1324,7 +1324,7 @@ Returns an extruded version of this geometry. :rtype: QgsGeometry %End - static QgsGeometry polygonize( const QList< QgsGeometry> &geometries ); + static QgsGeometry polygonize( const QVector &geometries ); %Docstring Creates a GeometryCollection geometry containing possible polygons formed from the constituent linework of a set of ``geometries``. The input geometries must be fully noded (i.e. nodes exist @@ -1579,14 +1579,14 @@ Returns an extruded version of this geometry. :rtype: QgsGeometryEngine %End - static void convertPointList( const QList &input, QgsPointSequence &output ); + static void convertPointList( const QVector &input, QgsPointSequence &output ); %Docstring Upgrades a point list from QgsPointXY to QgsPoint \param input list of QgsPointXY objects to be upgraded \param output destination for list of points converted to QgsPoint %End - static void convertPointList( const QgsPointSequence &input, QList &output ); + static void convertPointList( const QgsPointSequence &input, QVector &output ); %Docstring Downgrades a point list from QgsPoint to QgsPointXY \param input list of QgsPoint objects to be downgraded diff --git a/python/core/geometry/qgsgeometrycollection.sip b/python/core/geometry/qgsgeometrycollection.sip index a68b87b0506..1e19a015c1f 100644 --- a/python/core/geometry/qgsgeometrycollection.sip +++ b/python/core/geometry/qgsgeometrycollection.sip @@ -190,7 +190,7 @@ Adds a geometry and takes ownership. Returns true in case of success. :rtype: bool %End - bool fromCollectionWkt( const QString &wkt, const QList &subtypes, const QString &defaultChildWkbType = QString() ); + bool fromCollectionWkt( const QString &wkt, const QVector &subtypes, const QString &defaultChildWkbType = QString() ); %Docstring Reads a collection from a WKT string. :rtype: bool diff --git a/python/core/geometry/qgsgeometryengine.sip b/python/core/geometry/qgsgeometryengine.sip index c9d58092878..e0d4496a413 100644 --- a/python/core/geometry/qgsgeometryengine.sip +++ b/python/core/geometry/qgsgeometryengine.sip @@ -77,7 +77,7 @@ class QgsGeometryEngine :rtype: QgsAbstractGeometry %End - virtual QgsAbstractGeometry *combine( const QList &geomList, QString *errorMsg ) const = 0 /Factory/; + virtual QgsAbstractGeometry *combine( const QVector &geomList, QString *errorMsg ) const = 0 /Factory/; %Docstring Calculate the combination of this and ``geometries``. @@ -85,7 +85,7 @@ class QgsGeometryEngine :rtype: QgsAbstractGeometry %End - virtual QgsAbstractGeometry *combine( const QList< QgsGeometry > &geometries, QString *errorMsg = 0 ) const = 0 /Factory/; + virtual QgsAbstractGeometry *combine( const QVector< QgsGeometry > &geometries, QString *errorMsg = 0 ) const = 0 /Factory/; %Docstring Calculate the combination of this and ``geometries``. @@ -266,7 +266,7 @@ class QgsGeometryEngine %End virtual QgsGeometryEngine::EngineOperationResult splitGeometry( const QgsLineString &splitLine, - QList &newGeometries /Out/, + QVector &newGeometries /Out/, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg = 0 ) const; %Docstring diff --git a/python/core/geometry/qgsgeometryutils.sip b/python/core/geometry/qgsgeometryutils.sip index 98a425d3ec8..520f20ca8aa 100644 --- a/python/core/geometry/qgsgeometryutils.sip +++ b/python/core/geometry/qgsgeometryutils.sip @@ -23,7 +23,7 @@ class QgsGeometryUtils %End public: - static QList extractLineStrings( const QgsAbstractGeometry *geom ) /Factory/; + static QVector extractLineStrings( const QgsAbstractGeometry *geom ) /Factory/; %Docstring Returns list of linestrings extracted from the passed geometry. The returned objects have to be deleted by the caller. @@ -191,7 +191,7 @@ Calculates the direction angle of a circle tangent (clockwise from north in radi %End static void segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, - QList &points /Out/, double tolerance = M_PI_2 / 90, + QVector &points /Out/, double tolerance = M_PI_2 / 90, QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle, bool hasZ = false, bool hasM = false ); %Docstring diff --git a/python/core/geometry/qgslinestring.sip b/python/core/geometry/qgslinestring.sip index 071b4fac11a..fe43fc3429a 100644 --- a/python/core/geometry/qgslinestring.sip +++ b/python/core/geometry/qgslinestring.sip @@ -45,7 +45,7 @@ class QgsLineString: QgsCurve .. versionadded:: 3.0 %End - QgsLineString( const QList &points ); + QgsLineString( const QVector &points ); %Docstring Construct a linestring from list of points. This constructor is more efficient then calling setPoints() diff --git a/python/core/geometry/qgsregularpolygon.sip b/python/core/geometry/qgsregularpolygon.sip index b02d0420ef6..9bee0479521 100644 --- a/python/core/geometry/qgsregularpolygon.sip +++ b/python/core/geometry/qgsregularpolygon.sip @@ -164,7 +164,7 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3 :rtype: QgsTriangle %End - QList triangulate() const; + QVector triangulate() const; %Docstring Returns a triangulation (vertices from sides to the center) of the regular polygon. An empty list is returned if the regular polygon is empty. diff --git a/python/core/qgsdistancearea.sip b/python/core/qgsdistancearea.sip index 58757c6942d..c7845bd953e 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 QVector &points ) const; %Docstring Measures the length of a line with multiple segments. \param points list of points in line @@ -213,7 +213,7 @@ Constructor :rtype: QgsUnitTypes.AreaUnit %End - double measurePolygon( const QList &points ) const; + double measurePolygon( const QVector &points ) const; %Docstring Measures the area of the polygon described by a set of points. :rtype: float diff --git a/python/core/qgsgeometryvalidator.sip b/python/core/qgsgeometryvalidator.sip index c7e0978dee2..4d81a5edd01 100644 --- a/python/core/qgsgeometryvalidator.sip +++ b/python/core/qgsgeometryvalidator.sip @@ -16,7 +16,7 @@ class QgsGeometryValidator : QThread %End public: - QgsGeometryValidator( const QgsGeometry &geoemtry, QList *errors = 0, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); + QgsGeometryValidator( const QgsGeometry &geoemtry, QVector *errors = 0, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); %Docstring Constructor for QgsGeometryValidator. %End @@ -26,7 +26,7 @@ class QgsGeometryValidator : QThread void stop(); - static void validateGeometry( const QgsGeometry &geometry, QList &errors /Out/, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); + static void validateGeometry( const QgsGeometry &geometry, QVector &errors /Out/, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); %Docstring Validate geometry and produce a list of geometry errors %End diff --git a/python/core/qgsvectorlayer.sip b/python/core/qgsvectorlayer.sip index ec7193bb57b..74e3bead1ef 100644 --- a/python/core/qgsvectorlayer.sip +++ b/python/core/qgsvectorlayer.sip @@ -1043,7 +1043,7 @@ Return the provider type for this layer :rtype: bool %End - int addRing( const QList &ring, QgsFeatureId *featureId = 0 ); + int addRing( const QVector &ring, QgsFeatureId *featureId = 0 ); %Docstring :rtype: int %End @@ -1081,12 +1081,12 @@ Return the provider type for this layer :rtype: int %End - int splitParts( const QList &splitLine, bool topologicalEditing = false ); + int splitParts( const QVector &splitLine, bool topologicalEditing = false ); %Docstring :rtype: int %End - int splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + int splitFeatures( const QVector &splitLine, bool topologicalEditing = false ); %Docstring :rtype: int %End diff --git a/python/core/qgsvectorlayereditutils.sip b/python/core/qgsvectorlayereditutils.sip index d03191a5bdd..9109723f2ce 100644 --- a/python/core/qgsvectorlayereditutils.sip +++ b/python/core/qgsvectorlayereditutils.sip @@ -62,7 +62,7 @@ class QgsVectorLayerEditUtils :rtype: QgsVectorLayer.EditResult %End - QgsGeometry::OperationResult addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 ); + QgsGeometry::OperationResult addRing( const QVector &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 ); %Docstring Adds a ring to polygon/multipolygon features \param ring ring to add @@ -142,7 +142,7 @@ class QgsVectorLayerEditUtils :rtype: int %End - QgsGeometry::OperationResult splitParts( const QList &splitLine, bool topologicalEditing = false ); + QgsGeometry::OperationResult splitParts( const QVector &splitLine, bool topologicalEditing = false ); %Docstring Splits parts cut by the given line \param splitLine line that splits the layer feature parts @@ -158,7 +158,7 @@ class QgsVectorLayerEditUtils :rtype: QgsGeometry.OperationResult %End - QgsGeometry::OperationResult splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + QgsGeometry::OperationResult splitFeatures( const QVector &splitLine, bool topologicalEditing = false ); %Docstring Splits features cut by the given line \param splitLine line that splits the layer features diff --git a/python/gui/qgsmaptoolcapture.sip b/python/gui/qgsmaptoolcapture.sip index 92b8841a67e..70ead2ee725 100644 --- a/python/gui/qgsmaptoolcapture.sip +++ b/python/gui/qgsmaptoolcapture.sip @@ -151,14 +151,14 @@ Removes the last vertex from mRubberBand and mCaptureList :rtype: int %End - QList points(); + QVector points(); %Docstring List of digitized points :return: List of points :rtype: list of QgsPointXY %End - void setPoints( const QList &pointList ); + void setPoints( const QVector &pointList ); %Docstring Set the points on which to work diff --git a/python/gui/qgsmaptooledit.sip b/python/gui/qgsmaptooledit.sip index a76e057086f..9591e62ded4 100644 --- a/python/gui/qgsmaptooledit.sip +++ b/python/gui/qgsmaptooledit.sip @@ -69,7 +69,7 @@ Returns the current vector layer of the map canvas or 0 :rtype: QgsVectorLayer %End - int addTopologicalPoints( const QList &geom ); + int addTopologicalPoints( const QVector &geom ); %Docstring Adds vertices to other features to keep topology up to date, e.g. to neighbouring polygons. \param geom list of points (in layer coordinate system) diff --git a/src/analysis/processing/qgsalgorithmbuffer.cpp b/src/analysis/processing/qgsalgorithmbuffer.cpp index 5578e52b5ac..98ed4d018a0 100644 --- a/src/analysis/processing/qgsalgorithmbuffer.cpp +++ b/src/analysis/processing/qgsalgorithmbuffer.cpp @@ -96,7 +96,7 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap ¶meters, double step = count > 0 ? 100.0 / count : 1; int current = 0; - QList< QgsGeometry > bufferedGeometriesForDissolve; + QVector< QgsGeometry > bufferedGeometriesForDissolve; QgsAttributes dissolveAttrs; while ( it.nextFeature( f ) ) diff --git a/src/analysis/processing/qgsalgorithmclip.cpp b/src/analysis/processing/qgsalgorithmclip.cpp index 0e1766ad647..428d303f6f2 100644 --- a/src/analysis/processing/qgsalgorithmclip.cpp +++ b/src/analysis/processing/qgsalgorithmclip.cpp @@ -79,7 +79,7 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap ¶meters, Q return QVariantMap(); // first build up a list of clip geometries - QList< QgsGeometry > clipGeoms; + QVector< QgsGeometry > clipGeoms; QgsFeatureIterator it = maskSource->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QList< int >() ).setDestinationCrs( featureSource->sourceCrs() ) ); QgsFeature f; while ( it.nextFeature( f ) ) diff --git a/src/analysis/processing/qgsalgorithmdissolve.cpp b/src/analysis/processing/qgsalgorithmdissolve.cpp index 39f6d1c1826..5f68f71dc62 100644 --- a/src/analysis/processing/qgsalgorithmdissolve.cpp +++ b/src/analysis/processing/qgsalgorithmdissolve.cpp @@ -24,7 +24,7 @@ // QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, - const std::function& )> &collector, int maxQueueLength ) + const std::function& )> &collector, int maxQueueLength ) { std::unique_ptr< QgsFeatureSource > source( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) ); if ( !source ) @@ -51,7 +51,7 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap ¶met // dissolve all - not using fields bool firstFeature = true; // we dissolve geometries in blocks using unaryUnion - QList< QgsGeometry > geomQueue; + QVector< QgsGeometry > geomQueue; QgsFeature outputFeature; while ( it.nextFeature( f ) ) @@ -97,7 +97,7 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap ¶met } QHash< QVariant, QgsAttributes > attributeHash; - QHash< QVariant, QList< QgsGeometry > > geometryHash; + QHash< QVariant, QVector< QgsGeometry > > geometryHash; while ( it.nextFeature( f ) ) { @@ -207,7 +207,7 @@ QgsDissolveAlgorithm *QgsDissolveAlgorithm::createInstance() const QVariantMap QgsDissolveAlgorithm::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) { - return processCollection( parameters, context, feedback, []( const QList< QgsGeometry > &parts )->QgsGeometry + return processCollection( parameters, context, feedback, []( const QVector< QgsGeometry > &parts )->QgsGeometry { return QgsGeometry::unaryUnion( parts ); }, 10000 ); @@ -239,7 +239,7 @@ QString QgsCollectAlgorithm::group() const QVariantMap QgsCollectAlgorithm::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) { - return processCollection( parameters, context, feedback, []( const QList< QgsGeometry > &parts )->QgsGeometry + return processCollection( parameters, context, feedback, []( const QVector< QgsGeometry > &parts )->QgsGeometry { return QgsGeometry::collectGeometry( parts ); } ); diff --git a/src/analysis/processing/qgsalgorithmdissolve.h b/src/analysis/processing/qgsalgorithmdissolve.h index 85478354e01..21c3da7d0bc 100644 --- a/src/analysis/processing/qgsalgorithmdissolve.h +++ b/src/analysis/processing/qgsalgorithmdissolve.h @@ -33,7 +33,7 @@ class QgsCollectorAlgorithm : public QgsProcessingAlgorithm protected: QVariantMap processCollection( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, - const std::function& )> &collector, int maxQueueLength = 0 ); + const std::function& )> &collector, int maxQueueLength = 0 ); }; /** diff --git a/src/analysis/processing/qgsalgorithmfixgeometries.cpp b/src/analysis/processing/qgsalgorithmfixgeometries.cpp index 290694ab745..d581a51bd2c 100644 --- a/src/analysis/processing/qgsalgorithmfixgeometries.cpp +++ b/src/analysis/processing/qgsalgorithmfixgeometries.cpp @@ -86,8 +86,8 @@ QgsFeature QgsFixGeometriesAlgorithm::processFeature( const QgsFeature &feature, QgsWkbTypes::flatType( outputGeometry.wkbType() ) == QgsWkbTypes::GeometryCollection ) { // keep only the parts of the geometry collection with correct type - const QList< QgsGeometry > tmpGeometries = outputGeometry.asGeometryCollection(); - QList< QgsGeometry > matchingParts; + const QVector< QgsGeometry > tmpGeometries = outputGeometry.asGeometryCollection(); + QVector< QgsGeometry > matchingParts; for ( const QgsGeometry &g : tmpGeometries ) { if ( g.type() == feature.geometry().type() ) diff --git a/src/analysis/processing/qgsalgorithmsplitwithlines.cpp b/src/analysis/processing/qgsalgorithmsplitwithlines.cpp index cbd02163d90..7155c9bdfef 100644 --- a/src/analysis/processing/qgsalgorithmsplitwithlines.cpp +++ b/src/analysis/processing/qgsalgorithmsplitwithlines.cpp @@ -121,12 +121,12 @@ QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap &par QgsGeometry inGeom = inFeatureA.geometry(); outFeat.setAttributes( inFeatureA.attributes() ); - QList< QgsGeometry > inGeoms = inGeom.asGeometryCollection(); + QVector< QgsGeometry > inGeoms = inGeom.asGeometryCollection(); const QgsFeatureIds lines = spatialIndex.intersects( inGeom.boundingBox() ).toSet(); if ( !lines.empty() ) // has intersection of bounding boxes { - QList< QgsGeometry > splittingLines; + QVector< QgsGeometry > splittingLines; // use prepared geometries for faster intersection tests std::unique_ptr< QgsGeometryEngine > engine; @@ -146,7 +146,7 @@ QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap &par if ( engine->intersects( splitGeom.constGet() ) ) { - QList< QgsGeometry > splitGeomParts = splitGeom.asGeometryCollection(); + QVector< QgsGeometry > splitGeomParts = splitGeom.asGeometryCollection(); splittingLines.append( splitGeomParts ); } } @@ -155,8 +155,8 @@ QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap &par { for ( const QgsGeometry &splitGeom : qgis::as_const( splittingLines ) ) { - QList splitterPList; - QList< QgsGeometry > outGeoms; + QVector splitterPList; + QVector< QgsGeometry > outGeoms; // use prepared geometries for faster intersection tests std::unique_ptr< QgsGeometryEngine > splitGeomEngine( QgsGeometry::createGeometryEngine( splitGeom.constGet() ) ); @@ -190,8 +190,8 @@ QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap &par } } - QList< QgsGeometry > newGeometries; - QList topologyTestPoints; + QVector< QgsGeometry > newGeometries; + QVector topologyTestPoints; QgsGeometry::OperationResult result = inGeom.splitGeometry( splitterPList, newGeometries, false, topologyTestPoints ); // splitGeometry: If there are several intersections @@ -226,7 +226,7 @@ QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap &par } } - QList< QgsGeometry > parts; + QVector< QgsGeometry > parts; for ( const QgsGeometry &aGeom : qgis::as_const( inGeoms ) ) { if ( feedback->isCanceled() ) diff --git a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp index 3ad84ce83e0..81c2ba17601 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp @@ -22,7 +22,7 @@ void QgsGeometryGapCheck::collectErrors( QList &errors, { if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 ); - QList geomList; + QVector geomList; QMap featureIds = ids.isEmpty() ? allLayerFeatureIds() : ids; QgsGeometryCheckerUtils::LayerFeatures layerFeatures( mContext->featurePools, featureIds, mCompatibleGeometryTypes, 0, true ); diff --git a/src/app/qgsmaptoolfillring.cpp b/src/app/qgsmaptoolfillring.cpp index 2bc3a985533..d199ea8d94f 100644 --- a/src/app/qgsmaptoolfillring.cpp +++ b/src/app/qgsmaptoolfillring.cpp @@ -88,7 +88,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) vlayer->beginEditCommand( tr( "Ring added and filled" ) ); - QList< QgsPointXY > pointList = points(); + QVector< QgsPointXY > pointList = points(); int addRingReturnCode = vlayer->addRing( pointList, &fid ); if ( addRingReturnCode != 0 ) @@ -125,7 +125,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent *e ) return; } - g = QgsGeometry::fromPolygonXY( QgsPolygonXY() << pointList.toVector() ); + g = QgsGeometry::fromPolygonXY( QgsPolygonXY() << pointList ); } else { diff --git a/src/app/qgsmeasuredialog.cpp b/src/app/qgsmeasuredialog.cpp index 6aea9782c43..7e44a864a87 100644 --- a/src/app/qgsmeasuredialog.cpp +++ b/src/app/qgsmeasuredialog.cpp @@ -149,14 +149,14 @@ void QgsMeasureDialog::mouseMove( const QgsPointXY &point ) // and adding moving point at the end if ( mMeasureArea && mTool->points().size() >= 2 ) { - QList tmpPoints = mTool->points(); + QVector tmpPoints = mTool->points(); tmpPoints.append( point ); double area = mDa.measurePolygon( tmpPoints ); editTotal->setText( formatArea( area ) ); } else if ( !mMeasureArea && !mTool->points().empty() ) { - QList< QgsPointXY > tmpPoints = mTool->points(); + QVector< QgsPointXY > tmpPoints = mTool->points(); QgsPointXY p1( tmpPoints.at( tmpPoints.size() - 1 ) ), p2( point ); double d = mDa.measureLine( p1, p2 ); @@ -205,7 +205,7 @@ void QgsMeasureDialog::removeLastPoint() { if ( numPoints > 1 ) { - QList tmpPoints = mTool->points(); + QVector tmpPoints = mTool->points(); tmpPoints.append( mLastMousePoint ); double area = mDa.measurePolygon( tmpPoints ); editTotal->setText( formatArea( area ) ); @@ -225,7 +225,7 @@ void QgsMeasureDialog::removeLastPoint() if ( !mTool->done() ) { // need to add the distance for the temporary mouse cursor point - QList< QgsPointXY > tmpPoints = mTool->points(); + QVector< QgsPointXY > tmpPoints = mTool->points(); QgsPointXY p1( tmpPoints.at( tmpPoints.size() - 1 ) ); double d = mDa.measureLine( p1, mLastMousePoint ); @@ -478,12 +478,12 @@ void QgsMeasureDialog::updateUi() } else { - QList::const_iterator it; + QVector::const_iterator it; bool b = true; // first point QgsPointXY p1, p2; mTotal = 0; - QList< QgsPointXY > tmpPoints = mTool->points(); + QVector< QgsPointXY > tmpPoints = mTool->points(); for ( it = tmpPoints.constBegin(); it != tmpPoints.constEnd(); ++it ) { p2 = *it; diff --git a/src/app/qgsmeasuretool.cpp b/src/app/qgsmeasuretool.cpp index 729788ee170..185f2944ff2 100644 --- a/src/app/qgsmeasuretool.cpp +++ b/src/app/qgsmeasuretool.cpp @@ -63,7 +63,7 @@ QgsMeasureTool::~QgsMeasureTool() } -QList QgsMeasureTool::points() +QVector QgsMeasureTool::points() { return mPoints; } @@ -130,7 +130,7 @@ 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; + QVector points = mPoints; bool lastDone = mDone; mDialog->restart(); diff --git a/src/app/qgsmeasuretool.h b/src/app/qgsmeasuretool.h index 7cd9d3095ac..b0cab045174 100644 --- a/src/app/qgsmeasuretool.h +++ b/src/app/qgsmeasuretool.h @@ -52,7 +52,7 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool void addPoint( const QgsPointXY &point ); //! Returns reference to array of the points - QList points(); + QVector points(); // Inherited from QgsMapTool @@ -79,7 +79,7 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool protected: - QList mPoints; + QVector mPoints; QgsMeasureDialog *mDialog = nullptr; diff --git a/src/core/composer/qgscomposermapgrid.cpp b/src/core/composer/qgscomposermapgrid.cpp index ba8c86b6031..5812ff6de7f 100644 --- a/src/core/composer/qgscomposermapgrid.cpp +++ b/src/core/composer/qgscomposermapgrid.cpp @@ -2391,10 +2391,10 @@ QList QgsComposerMapGrid::trimLinesToMap( const QPolygonF &line, cons QgsGeometry rectGeom = QgsGeometry::fromRect( rect ); QgsGeometry intersected = lineGeom.intersection( rectGeom ); - QList intersectedParts = intersected.asGeometryCollection(); + QVector intersectedParts = intersected.asGeometryCollection(); QList trimmedLines; - QList::const_iterator geomIt = intersectedParts.constBegin(); + QVector::const_iterator geomIt = intersectedParts.constBegin(); for ( ; geomIt != intersectedParts.constEnd(); ++geomIt ) { trimmedLines << ( *geomIt ).asQPolygonF(); diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index 6db01e8fd98..e52ea09a76d 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -1755,7 +1755,7 @@ static QVariant fcnSegmentsToLines( const QVariantList &values, const QgsExpress if ( geom.isNull() ) return QVariant(); - const QList< QgsLineString * > linesToProcess = QgsGeometryUtils::extractLineStrings( geom.constGet() ); + const QVector< QgsLineString * > linesToProcess = QgsGeometryUtils::extractLineStrings( geom.constGet() ); //OK, now we have a complete list of segmentized lines from the geometry QgsMultiLineString *ml = new QgsMultiLineString(); diff --git a/src/core/geometry/qgsabstractgeometry.h b/src/core/geometry/qgsabstractgeometry.h index 60879ff70c5..88b2f6dcfae 100644 --- a/src/core/geometry/qgsabstractgeometry.h +++ b/src/core/geometry/qgsabstractgeometry.h @@ -35,13 +35,13 @@ class QPainter; class QDomDocument; class QDomElement; -typedef QList< QgsPoint > QgsPointSequence; +typedef QVector< QgsPoint > QgsPointSequence; #ifndef SIP_RUN -typedef QList< QgsPointSequence > QgsRingSequence; -typedef QList< QgsRingSequence > QgsCoordinateSequence; +typedef QVector< QgsPointSequence > QgsRingSequence; +typedef QVector< QgsRingSequence > QgsCoordinateSequence; #else -typedef QList< QList< QgsPoint > > QgsRingSequence; -typedef QList< QList< QList< QgsPoint > > > QgsCoordinateSequence; +typedef QVector< QVector< QgsPoint > > QgsRingSequence; +typedef QVector< QVector< QVector< QgsPoint > > > QgsCoordinateSequence; #endif /** diff --git a/src/core/geometry/qgscompoundcurve.cpp b/src/core/geometry/qgscompoundcurve.cpp index ba5dee661a3..e0792d6e728 100644 --- a/src/core/geometry/qgscompoundcurve.cpp +++ b/src/core/geometry/qgscompoundcurve.cpp @@ -225,7 +225,7 @@ bool QgsCompoundCurve::fromWkt( const QString &wkt ) QByteArray QgsCompoundCurve::asWkb() const { int binarySize = sizeof( char ) + sizeof( quint32 ) + sizeof( quint32 ); - QList wkbForCurves; + QVector wkbForCurves; for ( const QgsCurve *curve : mCurves ) { QByteArray wkbForCurve = curve->asWkb(); @@ -304,10 +304,9 @@ QString QgsCompoundCurve::asJSON( int precision ) const double QgsCompoundCurve::length() const { double length = 0; - QList< QgsCurve * >::const_iterator curveIt = mCurves.constBegin(); - for ( ; curveIt != mCurves.constEnd(); ++curveIt ) + for ( const QgsCurve *curve : mCurves ) { - length += ( *curveIt )->length(); + length += curve->length(); } return length; } @@ -380,12 +379,11 @@ bool QgsCompoundCurve::isEmpty() const QgsLineString *QgsCompoundCurve::curveToLine( double tolerance, SegmentationToleranceType toleranceType ) const { - QList< QgsCurve * >::const_iterator curveIt = mCurves.constBegin(); QgsLineString *line = new QgsLineString(); std::unique_ptr< QgsLineString > currentLine; - for ( ; curveIt != mCurves.constEnd(); ++curveIt ) + for ( const QgsCurve *curve : mCurves ) { - currentLine.reset( ( *curveIt )->curveToLine( tolerance, toleranceType ) ); + currentLine.reset( curve->curveToLine( tolerance, toleranceType ) ); line->append( currentLine.get() ); } return line; @@ -496,10 +494,9 @@ void QgsCompoundCurve::addVertex( const QgsPoint &pt ) void QgsCompoundCurve::draw( QPainter &p ) const { - QList< QgsCurve * >::const_iterator it = mCurves.constBegin(); - for ( ; it != mCurves.constEnd(); ++it ) + for ( const QgsCurve *curve : mCurves ) { - ( *it )->draw( p ); + curve->draw( p ); } } @@ -524,10 +521,9 @@ void QgsCompoundCurve::transform( const QTransform &t ) void QgsCompoundCurve::addToPainterPath( QPainterPath &path ) const { QPainterPath pp; - QList< QgsCurve * >::const_iterator it = mCurves.constBegin(); - for ( ; it != mCurves.constEnd(); ++it ) + for ( const QgsCurve *curve : mCurves ) { - ( *it )->addToPainterPath( pp ); + curve->addToPainterPath( pp ); } path.addPath( pp ); } @@ -535,17 +531,16 @@ void QgsCompoundCurve::addToPainterPath( QPainterPath &path ) const void QgsCompoundCurve::drawAsPolygon( QPainter &p ) const { QPainterPath pp; - QList< QgsCurve * >::const_iterator it = mCurves.constBegin(); - for ( ; it != mCurves.constEnd(); ++it ) + for ( const QgsCurve *curve : mCurves ) { - ( *it )->addToPainterPath( pp ); + curve->addToPainterPath( pp ); } p.drawPath( pp ); } bool QgsCompoundCurve::insertVertex( QgsVertexId position, const QgsPoint &vertex ) { - QList< QPair > curveIds = curveVertexId( position ); + QVector< QPair > curveIds = curveVertexId( position ); if ( curveIds.empty() ) { return false; @@ -566,8 +561,8 @@ bool QgsCompoundCurve::insertVertex( QgsVertexId position, const QgsPoint &verte bool QgsCompoundCurve::moveVertex( QgsVertexId position, const QgsPoint &newPos ) { - QList< QPair > curveIds = curveVertexId( position ); - QList< QPair >::const_iterator idIt = curveIds.constBegin(); + QVector< QPair > curveIds = curveVertexId( position ); + QVector< QPair >::const_iterator idIt = curveIds.constBegin(); for ( ; idIt != curveIds.constEnd(); ++idIt ) { mCurves.at( idIt->first )->moveVertex( idIt->second, newPos ); @@ -583,7 +578,7 @@ bool QgsCompoundCurve::moveVertex( QgsVertexId position, const QgsPoint &newPos bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) { - QList< QPair > curveIds = curveVertexId( position ); + QVector< QPair > curveIds = curveVertexId( position ); if ( curveIds.size() == 1 ) { if ( !mCurves.at( curveIds.at( 0 ).first )->deleteVertex( curveIds.at( 0 ).second ) ) @@ -675,9 +670,9 @@ bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) return success; } -QList< QPair > QgsCompoundCurve::curveVertexId( QgsVertexId id ) const +QVector< QPair > QgsCompoundCurve::curveVertexId( QgsVertexId id ) const { - QList< QPair > curveIds; + QVector< QPair > curveIds; int currentVertexIndex = 0; for ( int i = 0; i < mCurves.size(); ++i ) @@ -756,10 +751,9 @@ double QgsCompoundCurve::yAt( int index ) const void QgsCompoundCurve::sumUpArea( double &sum ) const { - QList< QgsCurve * >::const_iterator curveIt = mCurves.constBegin(); - for ( ; curveIt != mCurves.constEnd(); ++curveIt ) + for ( const QgsCurve *curve : mCurves ) { - ( *curveIt )->sumUpArea( sum ); + curve->sumUpArea( sum ); } } @@ -774,10 +768,9 @@ void QgsCompoundCurve::close() bool QgsCompoundCurve::hasCurvedSegments() const { - QList< QgsCurve * >::const_iterator curveIt = mCurves.constBegin(); - for ( ; curveIt != mCurves.constEnd(); ++curveIt ) + for ( const QgsCurve *curve : mCurves ) { - if ( ( *curveIt )->hasCurvedSegments() ) + if ( curve->hasCurvedSegments() ) { return true; } @@ -787,7 +780,7 @@ bool QgsCompoundCurve::hasCurvedSegments() const double QgsCompoundCurve::vertexAngle( QgsVertexId vertex ) const { - QList< QPair > curveIds = curveVertexId( vertex ); + QVector< QPair > curveIds = curveVertexId( vertex ); if ( curveIds.size() == 1 ) { QgsCurve *curve = mCurves[curveIds.at( 0 ).first]; diff --git a/src/core/geometry/qgscompoundcurve.h b/src/core/geometry/qgscompoundcurve.h index c30958df6be..68dc254a052 100644 --- a/src/core/geometry/qgscompoundcurve.h +++ b/src/core/geometry/qgscompoundcurve.h @@ -153,12 +153,12 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve QgsCompoundCurve *createEmptyWithSameType() const override SIP_FACTORY; private: - QList< QgsCurve * > mCurves; + QVector< QgsCurve * > mCurves; /** * Turns a vertex id for the compound curve into one or more ids for the subcurves \returns the index of the subcurve or -1 in case of error*/ - QList< QPair > curveVertexId( QgsVertexId id ) const; + QVector< QPair > curveVertexId( QgsVertexId id ) const; }; diff --git a/src/core/geometry/qgscurvepolygon.cpp b/src/core/geometry/qgscurvepolygon.cpp index 20793126687..35d03c44f1d 100644 --- a/src/core/geometry/qgscurvepolygon.cpp +++ b/src/core/geometry/qgscurvepolygon.cpp @@ -277,7 +277,7 @@ QgsRectangle QgsCurvePolygon::calculateBoundingBox() const QByteArray QgsCurvePolygon::asWkb() const { int binarySize = sizeof( char ) + sizeof( quint32 ) + sizeof( quint32 ); - QList wkbForRings; + QVector wkbForRings; if ( mExteriorRing ) { QByteArray wkb( mExteriorRing->asWkb() ); @@ -434,13 +434,12 @@ double QgsCurvePolygon::area() const totalArea += std::fabs( area ); } - QList::const_iterator ringIt = mInteriorRings.constBegin(); - for ( ; ringIt != mInteriorRings.constEnd(); ++ringIt ) + for ( const QgsCurve *ring : mInteriorRings ) { double area = 0.0; - if ( ( *ringIt )->isRing() ) + if ( ring->isRing() ) { - ( *ringIt )->sumUpArea( area ); + ring->sumUpArea( area ); totalArea -= std::fabs( area ); } } @@ -454,10 +453,9 @@ double QgsCurvePolygon::perimeter() const //sum perimeter of rings double perimeter = mExteriorRing->length(); - QList::const_iterator ringIt = mInteriorRings.constBegin(); - for ( ; ringIt != mInteriorRings.constEnd(); ++ringIt ) + for ( const QgsCurve *ring : mInteriorRings ) { - perimeter += ( *ringIt )->length(); + perimeter += ring->length(); } return perimeter; } @@ -469,7 +467,7 @@ QgsPolygon *QgsCurvePolygon::surfaceToPolygon() const return polygon.release(); polygon->setExteriorRing( exteriorRing()->curveToLine() ); - QList interiors; + QVector interiors; int n = numInteriorRings(); interiors.reserve( n ); for ( int i = 0; i < n; ++i ) @@ -546,11 +544,10 @@ QgsPolygon *QgsCurvePolygon::toPolygon( double tolerance, SegmentationToleranceT poly->setExteriorRing( mExteriorRing->curveToLine( tolerance, toleranceType ) ); - QList rings; - QList::const_iterator it = mInteriorRings.constBegin(); - for ( ; it != mInteriorRings.constEnd(); ++it ) + QVector rings; + for ( const QgsCurve *ring : mInteriorRings ) { - rings.push_back( ( *it )->curveToLine( tolerance, toleranceType ) ); + rings.push_back( ring->curveToLine( tolerance, toleranceType ) ); } poly->setInteriorRings( rings ); return poly.release(); @@ -609,7 +606,7 @@ void QgsCurvePolygon::setExteriorRing( QgsCurve *ring ) clearCache(); } -void QgsCurvePolygon::setInteriorRings( const QList &rings ) +void QgsCurvePolygon::setInteriorRings( const QVector &rings ) { qDeleteAll( mInteriorRings ); mInteriorRings.clear(); @@ -685,10 +682,9 @@ void QgsCurvePolygon::draw( QPainter &p ) const QPainterPath path; mExteriorRing->addToPainterPath( path ); - QList::const_iterator it = mInteriorRings.constBegin(); - for ( ; it != mInteriorRings.constEnd(); ++it ) + for ( const QgsCurve *ring : mInteriorRings ) { - ( *it )->addToPainterPath( path ); + ring->addToPainterPath( path ); } p.drawPath( path ); } @@ -733,11 +729,10 @@ QgsCoordinateSequence QgsCurvePolygon::coordinateSequence() const mExteriorRing->points( sequence.back().back() ); } - QList::const_iterator it = mInteriorRings.constBegin(); - for ( ; it != mInteriorRings.constEnd(); ++it ) + for ( const QgsCurve *ring : mInteriorRings ) { sequence.back().append( QgsPointSequence() ); - ( *it )->points( sequence.back().back() ); + ring->points( sequence.back().back() ); } return sequence; @@ -752,10 +747,9 @@ int QgsCurvePolygon::nCoordinates() const count += mExteriorRing->nCoordinates(); } - QList::const_iterator it = mInteriorRings.constBegin(); - for ( ; it != mInteriorRings.constEnd(); ++it ) + for ( const QgsCurve *ring : mInteriorRings ) { - count += ( *it )->nCoordinates(); + count += ring->nCoordinates(); } return count; @@ -810,7 +804,7 @@ double QgsCurvePolygon::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, { return -1; } - QList segmentList; + QVector segmentList; segmentList.append( mExteriorRing.get() ); segmentList.append( mInteriorRings ); return QgsGeometryUtils::closestSegmentFromComponents( segmentList, QgsGeometryUtils::Ring, pt, segmentPt, vertexAfter, leftOf, epsilon ); @@ -1005,10 +999,9 @@ bool QgsCurvePolygon::hasCurvedSegments() const return true; } - QList::const_iterator it = mInteriorRings.constBegin(); - for ( ; it != mInteriorRings.constEnd(); ++it ) + for ( const QgsCurve *ring : mInteriorRings ) { - if ( ( *it )->hasCurvedSegments() ) + if ( ring->hasCurvedSegments() ) { return true; } diff --git a/src/core/geometry/qgscurvepolygon.h b/src/core/geometry/qgscurvepolygon.h index 7b600f19b7f..8981f28471f 100644 --- a/src/core/geometry/qgscurvepolygon.h +++ b/src/core/geometry/qgscurvepolygon.h @@ -87,7 +87,7 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface virtual void setExteriorRing( QgsCurve *ring SIP_TRANSFER ); //! Sets all interior rings (takes ownership) - void setInteriorRings( const QList &rings SIP_TRANSFER ); + void setInteriorRings( const QVector &rings SIP_TRANSFER ); //! Adds an interior ring to the geometry (takes ownership) virtual void addInteriorRing( QgsCurve *ring SIP_TRANSFER ); @@ -181,7 +181,7 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface protected: std::unique_ptr< QgsCurve > mExteriorRing; - QList mInteriorRings; + QVector mInteriorRings; QgsRectangle calculateBoundingBox() const override; }; diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index 0a7317fde6f..cb49244e9ad 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -236,7 +236,7 @@ QgsGeometry QgsGeometry::fromRect( const QgsRectangle &rect ) return fromPolygonXY( polygon ); } -QgsGeometry QgsGeometry::collectGeometry( const QList< QgsGeometry > &geometries ) +QgsGeometry QgsGeometry::collectGeometry( const QVector< QgsGeometry > &geometries ) { QgsGeometry collected; @@ -614,7 +614,7 @@ double QgsGeometry::closestSegmentWithContext( return sqrDist; } -QgsGeometry::OperationResult QgsGeometry::addRing( const QList &ring ) +QgsGeometry::OperationResult QgsGeometry::addRing( const QVector &ring ) { std::unique_ptr< QgsLineString > ringLine = qgis::make_unique< QgsLineString >( ring ); return addRing( ringLine.release() ); @@ -633,7 +633,7 @@ QgsGeometry::OperationResult QgsGeometry::addRing( QgsCurve *ring ) return QgsGeometryEditUtils::addRing( d->geometry.get(), std::move( r ) ); } -QgsGeometry::OperationResult QgsGeometry::addPart( const QList &points, QgsWkbTypes::GeometryType geomType ) +QgsGeometry::OperationResult QgsGeometry::addPart( const QVector &points, QgsWkbTypes::GeometryType geomType ) { QgsPointSequence l; convertPointList( points, l ); @@ -709,8 +709,8 @@ QgsGeometry QgsGeometry::removeInteriorRings( double minimumRingArea ) const if ( QgsWkbTypes::isMultiType( d->geometry->wkbType() ) ) { - const QList parts = asGeometryCollection(); - QList results; + const QVector parts = asGeometryCollection(); + QVector results; for ( const QgsGeometry &part : parts ) { QgsGeometry result = part.removeInteriorRings( minimumRingArea ); @@ -781,14 +781,14 @@ QgsGeometry::OperationResult QgsGeometry::rotate( double rotation, const QgsPoin return QgsGeometry::Success; } -QgsGeometry::OperationResult QgsGeometry::splitGeometry( const QList &splitLine, QList &newGeometries, bool topological, QList &topologyTestPoints ) +QgsGeometry::OperationResult QgsGeometry::splitGeometry( const QVector &splitLine, QVector &newGeometries, bool topological, QVector &topologyTestPoints ) { if ( !d->geometry ) { return InvalidBaseGeometry; } - QList newGeoms; + QVector newGeoms; QgsLineString splitLineString( splitLine ); QgsPointSequence tp; @@ -1619,8 +1619,8 @@ QgsGeometry QgsGeometry::offsetCurve( double distance, int segments, JoinStyle j if ( QgsWkbTypes::isMultiType( d->geometry->wkbType() ) ) { - const QList parts = asGeometryCollection(); - QList results; + const QVector parts = asGeometryCollection(); + QVector results; for ( const QgsGeometry &part : parts ) { QgsGeometry result = part.offsetCurve( distance, segments, joinStyle, miterLimit ); @@ -1661,8 +1661,8 @@ QgsGeometry QgsGeometry::singleSidedBuffer( double distance, int segments, Buffe if ( QgsWkbTypes::isMultiType( d->geometry->wkbType() ) ) { - const QList parts = asGeometryCollection(); - QList results; + const QVector parts = asGeometryCollection(); + QVector results; for ( const QgsGeometry &part : parts ) { QgsGeometry result = part.singleSidedBuffer( distance, segments, side, joinStyle, miterLimit ); @@ -1704,8 +1704,8 @@ QgsGeometry QgsGeometry::extendLine( double startDistance, double endDistance ) if ( QgsWkbTypes::isMultiType( d->geometry->wkbType() ) ) { - const QList parts = asGeometryCollection(); - QList results; + const QVector parts = asGeometryCollection(); + QVector results; for ( const QgsGeometry &part : parts ) { QgsGeometry result = part.extendLine( startDistance, endDistance ); @@ -2086,9 +2086,9 @@ QByteArray QgsGeometry::exportToWkb() const return d->geometry ? d->geometry->asWkb() : QByteArray(); } -QList QgsGeometry::asGeometryCollection() const +QVector QgsGeometry::asGeometryCollection() const { - QList geometryList; + QVector geometryList; if ( !d->geometry ) { return geometryList; @@ -2206,7 +2206,7 @@ QgsGeometry QgsGeometry::makeValid() const } -void QgsGeometry::validateGeometry( QList &errors, ValidationMethod method ) const +void QgsGeometry::validateGeometry( QVector &errors, ValidationMethod method ) const { QgsGeometryValidator::validateGeometry( *this, errors, method ); } @@ -2245,7 +2245,7 @@ bool QgsGeometry::isGeosEqual( const QgsGeometry &g ) const return geos.isEqual( g.d->geometry.get(), &mLastError ); } -QgsGeometry QgsGeometry::unaryUnion( const QList &geometries ) +QgsGeometry QgsGeometry::unaryUnion( const QVector &geometries ) { QgsGeos geos( nullptr ); @@ -2256,11 +2256,11 @@ QgsGeometry QgsGeometry::unaryUnion( const QList &geometries ) return result; } -QgsGeometry QgsGeometry::polygonize( const QList &geometryList ) +QgsGeometry QgsGeometry::polygonize( const QVector &geometryList ) { QgsGeos geos( nullptr ); - QList geomV2List; + QVector geomV2List; for ( const QgsGeometry &g : geometryList ) { if ( !( g.isNull() ) ) @@ -2483,7 +2483,7 @@ QString QgsGeometry::lastError() const return mLastError; } -void QgsGeometry::convertPointList( const QList &input, QgsPointSequence &output ) +void QgsGeometry::convertPointList( const QVector &input, QgsPointSequence &output ) { output.clear(); for ( const QgsPointXY &p : input ) @@ -2492,7 +2492,7 @@ void QgsGeometry::convertPointList( const QList &input, QgsPointSequ } } -void QgsGeometry::convertPointList( const QgsPointSequence &input, QList &output ) +void QgsGeometry::convertPointList( const QgsPointSequence &input, QVector &output ) { output.clear(); for ( const QgsPoint &p : input ) diff --git a/src/core/geometry/qgsgeometry.h b/src/core/geometry/qgsgeometry.h index dd7ca015156..6fdafeb03c4 100644 --- a/src/core/geometry/qgsgeometry.h +++ b/src/core/geometry/qgsgeometry.h @@ -250,7 +250,7 @@ class CORE_EXPORT QgsGeometry //! Creates a new geometry from a QgsRectangle static QgsGeometry fromRect( const QgsRectangle &rect ); //! Creates a new multipart geometry from a list of QgsGeometry objects - static QgsGeometry collectGeometry( const QList< QgsGeometry > &geometries ); + static QgsGeometry collectGeometry( const QVector &geometries ); /** * Set the geometry, feeding in a geometry in GEOS format. @@ -567,7 +567,7 @@ class CORE_EXPORT QgsGeometry * \param ring The ring to be added * \returns OperationResult a result code: success or reason of failure */ - OperationResult addRing( const QList &ring ); + OperationResult addRing( const QVector &ring ); /** * Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. @@ -582,7 +582,7 @@ class CORE_EXPORT QgsGeometry * \param geomType default geometry type to create if no existing geometry * \returns OperationResult a result code: success or reason of failure */ - OperationResult addPart( const QList &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPointsXY ); + OperationResult addPart( const QVector &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPointsXY ); /** * Adds a new part to a the geometry. @@ -657,7 +657,7 @@ class CORE_EXPORT QgsGeometry * \param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset * \returns OperationResult a result code: success or reason of failure */ - OperationResult splitGeometry( const QList &splitLine, QList &newGeometries SIP_OUT, bool topological, QList &topologyTestPoints SIP_OUT ); + OperationResult splitGeometry( const QVector &splitLine, QVector &newGeometries SIP_OUT, bool topological, QVector &topologyTestPoints SIP_OUT ); /** * Replaces a part of this geometry with another line @@ -1176,7 +1176,7 @@ class CORE_EXPORT QgsGeometry * Return contents of the geometry as a list of geometries * \since QGIS 1.1 */ - QList asGeometryCollection() const; + QVector asGeometryCollection() const; /** * Returns contents of the geometry as a QPointF if wkbType is WKBPoint, @@ -1306,14 +1306,14 @@ class CORE_EXPORT QgsGeometry * \since QGIS 1.5 * \note Available in Python bindings since QGIS 1.6 **/ - void validateGeometry( QList &errors SIP_OUT, ValidationMethod method = ValidatorQgisInternal ) const; + void validateGeometry( QVector &errors SIP_OUT, ValidationMethod method = ValidatorQgisInternal ) const; /** * Compute the unary union on a list of \a geometries. May be faster than an iterative union on a set of geometries. * The returned geometry will be fully noded, i.e. a node will be created at every common intersection of the * input geometries. An empty geometry will be returned in the case of errors. */ - static QgsGeometry unaryUnion( const QList &geometries ); + static QgsGeometry unaryUnion( const QVector &geometries ); /** * Creates a GeometryCollection geometry containing possible polygons formed from the constituent @@ -1323,7 +1323,7 @@ class CORE_EXPORT QgsGeometry * An empty geometry will be returned in the case of errors. * \since QGIS 3.0 */ - static QgsGeometry polygonize( const QList< QgsGeometry> &geometries ); + static QgsGeometry polygonize( const QVector &geometries ); /** * Converts the geometry to straight line segments, if it is a curved geometry type. @@ -1609,14 +1609,14 @@ class CORE_EXPORT QgsGeometry * \param input list of QgsPointXY objects to be upgraded * \param output destination for list of points converted to QgsPoint */ - static void convertPointList( const QList &input, QgsPointSequence &output ); + static void convertPointList( const QVector &input, QgsPointSequence &output ); /** * Downgrades a point list from QgsPoint to QgsPointXY * \param input list of QgsPoint objects to be downgraded * \param output destination for list of points converted to QgsPointXY */ - static void convertPointList( const QgsPointSequence &input, QList &output ); + static void convertPointList( const QgsPointSequence &input, QVector &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 94fe651291f..3dd354d05ee 100644 --- a/src/core/geometry/qgsgeometrycollection.cpp +++ b/src/core/geometry/qgsgeometrycollection.cpp @@ -299,7 +299,7 @@ bool QgsGeometryCollection::fromWkb( QgsConstWkbPtr &wkbPtr ) bool QgsGeometryCollection::fromWkt( const QString &wkt ) { - return fromCollectionWkt( wkt, QList() << new QgsPoint << new QgsLineString << new QgsPolygon + return fromCollectionWkt( wkt, QVector() << new QgsPoint << new QgsLineString << new QgsPolygon << new QgsCircularString << new QgsCompoundCurve << new QgsCurvePolygon << new QgsMultiPoint << new QgsMultiLineString @@ -310,7 +310,7 @@ bool QgsGeometryCollection::fromWkt( const QString &wkt ) QByteArray QgsGeometryCollection::asWkb() const { int binarySize = sizeof( char ) + sizeof( quint32 ) + sizeof( quint32 ); - QList wkbForGeometries; + QVector wkbForGeometries; for ( const QgsAbstractGeometry *geom : mGeometries ) { if ( geom ) @@ -582,7 +582,7 @@ double QgsGeometryCollection::perimeter() const return perimeter; } -bool QgsGeometryCollection::fromCollectionWkt( const QString &wkt, const QList &subtypes, const QString &defaultChildWkbType ) +bool QgsGeometryCollection::fromCollectionWkt( const QString &wkt, const QVector &subtypes, const QString &defaultChildWkbType ) { clear(); diff --git a/src/core/geometry/qgsgeometrycollection.h b/src/core/geometry/qgsgeometrycollection.h index 3b88ca59cb2..e6642c084ec 100644 --- a/src/core/geometry/qgsgeometrycollection.h +++ b/src/core/geometry/qgsgeometrycollection.h @@ -177,7 +177,7 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry /** * Reads a collection from a WKT string. */ - bool fromCollectionWkt( const QString &wkt, const QList &subtypes, const QString &defaultChildWkbType = QString() ); + bool fromCollectionWkt( const QString &wkt, const QVector &subtypes, const QString &defaultChildWkbType = QString() ); QgsRectangle calculateBoundingBox() const override; void clearCache() const override; diff --git a/src/core/geometry/qgsgeometryeditutils.cpp b/src/core/geometry/qgsgeometryeditutils.cpp index 1fd8853f21b..d92fc042387 100644 --- a/src/core/geometry/qgsgeometryeditutils.cpp +++ b/src/core/geometry/qgsgeometryeditutils.cpp @@ -33,7 +33,7 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addRing( QgsAbstractGeometry return QgsGeometry::InvalidInput; } - QList< QgsCurvePolygon * > polygonList; + QVector< QgsCurvePolygon * > polygonList; QgsCurvePolygon *curvePoly = qgsgeometry_cast< QgsCurvePolygon * >( geom ); QgsGeometryCollection *multiGeom = qgsgeometry_cast< QgsGeometryCollection * >( geom ); if ( curvePoly ) @@ -67,7 +67,7 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addRing( QgsAbstractGeometry ringGeom->prepareGeometry(); //for each polygon, test if inside outer ring and no intersection with other interior ring - QList< QgsCurvePolygon * >::const_iterator polyIter = polygonList.constBegin(); + QVector< QgsCurvePolygon * >::const_iterator polyIter = polygonList.constBegin(); for ( ; polyIter != polygonList.constEnd(); ++polyIter ) { if ( ringGeom->within( *polyIter ) ) @@ -240,7 +240,7 @@ std::unique_ptr QgsGeometryEditUtils::avoidIntersections( c if ( avoidIntersectionsLayers.isEmpty() ) return nullptr; //no intersections stored in project does not mean error - QList< QgsGeometry > nearGeometries; + QVector< QgsGeometry > nearGeometries; //go through list, convert each layer to vector layer and call QgsVectorLayer::removePolygonIntersections for each for ( QgsVectorLayer *currentLayer : avoidIntersectionsLayers ) diff --git a/src/core/geometry/qgsgeometryengine.h b/src/core/geometry/qgsgeometryengine.h index a3c8516c167..952169adcd8 100644 --- a/src/core/geometry/qgsgeometryengine.h +++ b/src/core/geometry/qgsgeometryengine.h @@ -20,7 +20,7 @@ email : marco.hugentobler at sourcepole dot com #include "qgslinestring.h" #include "qgsgeometry.h" -#include +#include class QgsAbstractGeometry; @@ -96,14 +96,14 @@ class CORE_EXPORT QgsGeometryEngine * * \since QGIS 3.0 \a geom is a pointer */ - virtual QgsAbstractGeometry *combine( const QList &geomList, QString *errorMsg ) const = 0 SIP_FACTORY; + virtual QgsAbstractGeometry *combine( const QVector &geomList, QString *errorMsg ) const = 0 SIP_FACTORY; /** * Calculate the combination of this and \a geometries. * * \since QGIS 3.0 \a geom is a pointer */ - virtual QgsAbstractGeometry *combine( const QList< QgsGeometry > &geometries, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY; + virtual QgsAbstractGeometry *combine( const QVector< QgsGeometry > &geometries, QString *errorMsg = nullptr ) const = 0 SIP_FACTORY; /** * Calculate the symmetric difference of this and \a geom. @@ -244,7 +244,7 @@ class CORE_EXPORT QgsGeometryEngine * \returns 0 in case of success, 1 if geometry has not been split, error else */ virtual QgsGeometryEngine::EngineOperationResult splitGeometry( const QgsLineString &splitLine, - QList &newGeometries SIP_OUT, + QVector &newGeometries SIP_OUT, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg = nullptr ) const { diff --git a/src/core/geometry/qgsgeometryfactory.cpp b/src/core/geometry/qgsgeometryfactory.cpp index dc40da2af5b..f35be49f949 100644 --- a/src/core/geometry/qgsgeometryfactory.cpp +++ b/src/core/geometry/qgsgeometryfactory.cpp @@ -168,7 +168,7 @@ std::unique_ptr QgsGeometryFactory::fromPolygonXY( const QgsPolygonX { std::unique_ptr< QgsPolygon > poly = qgis::make_unique< QgsPolygon >(); - QList holes; + QVector holes; for ( int i = 0; i < polygon.size(); ++i ) { std::unique_ptr< QgsLineString > l = linestringFromPolyline( polygon.at( i ) ); diff --git a/src/core/geometry/qgsgeometryutils.cpp b/src/core/geometry/qgsgeometryutils.cpp index c5867ec2f1c..f025336518c 100644 --- a/src/core/geometry/qgsgeometryutils.cpp +++ b/src/core/geometry/qgsgeometryutils.cpp @@ -27,13 +27,13 @@ email : marco.hugentobler at sourcepole dot com #include #include -QList QgsGeometryUtils::extractLineStrings( const QgsAbstractGeometry *geom ) +QVector QgsGeometryUtils::extractLineStrings( const QgsAbstractGeometry *geom ) { - QList< QgsLineString * > linestrings; + QVector< QgsLineString * > linestrings; if ( !geom ) return linestrings; - QList< const QgsAbstractGeometry * > geometries; + QVector< const QgsAbstractGeometry * > geometries; geometries << geom; while ( ! geometries.isEmpty() ) { @@ -287,9 +287,9 @@ bool QgsGeometryUtils::segmentIntersection( const QgsPoint &p1, const QgsPoint & return !( lambdaw < 0. + tolerance || lambdaw >= wl - tolerance ); } -QList QgsGeometryUtils::getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) +QVector QgsGeometryUtils::getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) { - QList intersections; + QVector intersections; int n = geom->vertexCount( part, ring ); bool isClosed = geom->vertexAt( QgsVertexId( part, ring, 0 ) ) == geom->vertexAt( QgsVertexId( part, ring, n - 1 ) ); @@ -626,7 +626,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, co double z = 0; double m = 0; - QList stringPoints; + QVector stringPoints; stringPoints.insert( 0, circlePoint1 ); if ( circlePoint2 != circlePoint3 && circlePoint1 != circlePoint2 ) //draw straight line segment if two points have the same position { diff --git a/src/core/geometry/qgsgeometryutils.h b/src/core/geometry/qgsgeometryutils.h index 38972366624..d6a046c918e 100644 --- a/src/core/geometry/qgsgeometryutils.h +++ b/src/core/geometry/qgsgeometryutils.h @@ -39,7 +39,7 @@ class CORE_EXPORT QgsGeometryUtils * Returns list of linestrings extracted from the passed geometry. The returned objects * have to be deleted by the caller. */ - static QList extractLineStrings( const QgsAbstractGeometry *geom ) SIP_FACTORY; + static QVector extractLineStrings( const QgsAbstractGeometry *geom ) SIP_FACTORY; /** * Returns the closest vertex to a geometry for a specified point. @@ -145,7 +145,7 @@ class CORE_EXPORT QgsGeometryUtils * \note not available in Python bindings * \since QGIS 2.12 */ - static QList getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) SIP_SKIP; + static QVector getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) SIP_SKIP; //! Returns < 0 if point(x/y) is left of the line x1,y1 -> x2,y2 static double leftOfLine( double x, double y, double x1, double y1, double x2, double y2 ); @@ -191,7 +191,7 @@ class CORE_EXPORT QgsGeometryUtils * \since 3.0 */ static void segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3, - QgsPointSequence SIP_PYALTERNATIVETYPE( QList ) &points SIP_OUT, double tolerance = M_PI_2 / 90, + QgsPointSequence SIP_PYALTERNATIVETYPE( QVector ) &points SIP_OUT, double tolerance = M_PI_2 / 90, QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle, bool hasZ = false, bool hasM = false ); diff --git a/src/core/geometry/qgsgeos.cpp b/src/core/geometry/qgsgeos.cpp index 0b042483cb5..5154ce9c921 100644 --- a/src/core/geometry/qgsgeos.cpp +++ b/src/core/geometry/qgsgeos.cpp @@ -308,7 +308,7 @@ QgsAbstractGeometry *QgsGeos::combine( const QgsAbstractGeometry *geom, QString return overlay( geom, OverlayUnion, errorMsg ).release(); } -QgsAbstractGeometry *QgsGeos::combine( const QList &geomList, QString *errorMsg ) const +QgsAbstractGeometry *QgsGeos::combine( const QVector &geomList, QString *errorMsg ) const { QVector< GEOSGeometry * > geosGeometries; geosGeometries.reserve( geomList.size() ); @@ -332,7 +332,7 @@ QgsAbstractGeometry *QgsGeos::combine( const QList &geomL return result.release(); } -QgsAbstractGeometry *QgsGeos::combine( const QList &geomList, QString *errorMsg ) const +QgsAbstractGeometry *QgsGeos::combine( const QVector &geomList, QString *errorMsg ) const { QVector< GEOSGeometry * > geosGeometries; geosGeometries.reserve( geomList.size() ); @@ -562,7 +562,7 @@ double QgsGeos::length( QString *errorMsg ) const } QgsGeometryEngine::EngineOperationResult QgsGeos::splitGeometry( const QgsLineString &splitLine, - QList &newGeometries, + QVector &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg ) const @@ -762,7 +762,7 @@ geos::unique_ptr QgsGeos::linePointDifference( GEOSGeometry *GEOSsplitPoint ) co return asGeos( &lines, mPrecision ); } -QgsGeometryEngine::EngineOperationResult QgsGeos::splitLinearGeometry( GEOSGeometry *splitLine, QList &newGeometries ) const +QgsGeometryEngine::EngineOperationResult QgsGeos::splitLinearGeometry( GEOSGeometry *splitLine, QVector &newGeometries ) const { if ( !splitLine ) return InvalidInput; @@ -817,7 +817,7 @@ QgsGeometryEngine::EngineOperationResult QgsGeos::splitLinearGeometry( GEOSGeome return Success; } -QgsGeometryEngine::EngineOperationResult QgsGeos::splitPolygonGeometry( GEOSGeometry *splitLine, QList &newGeometries ) const +QgsGeometryEngine::EngineOperationResult QgsGeos::splitPolygonGeometry( GEOSGeometry *splitLine, QVector &newGeometries ) const { if ( !splitLine ) return InvalidInput; @@ -1129,7 +1129,7 @@ std::unique_ptr QgsGeos::fromGeosPolygon( const GEOSGeometry *geos ) polygon->setExteriorRing( sequenceToLinestring( ring, hasZ, hasM ).release() ); } - QList interiorRings; + QVector interiorRings; for ( int i = 0; i < GEOSGetNumInteriorRings_r( geosinit.ctxt, geos ); ++i ) { ring = GEOSGetInteriorRingN_r( geosinit.ctxt, geos, i ); @@ -2141,7 +2141,7 @@ double QgsGeos::lineLocatePoint( const QgsPoint &point, QString *errorMsg ) cons return distance; } -QgsGeometry QgsGeos::polygonize( const QList &geometries, QString *errorMsg ) +QgsGeometry QgsGeos::polygonize( const QVector &geometries, QString *errorMsg ) { GEOSGeometry **const lineGeosGeometries = new GEOSGeometry*[ geometries.size()]; int validLines = 0; @@ -2371,8 +2371,8 @@ geos::unique_ptr QgsGeos::reshapeLine( const GEOSGeometry *line, const GEOSGeome return nullptr; } - QList resultLineParts; //collection with the line segments that will be contained in result - QList probableParts; //parts where we can decide on inclusion only after going through all the candidates + QVector resultLineParts; //collection with the line segments that will be contained in result + QVector probableParts; //parts where we can decide on inclusion only after going through all the candidates for ( int i = 0; i < numMergedLines; ++i ) { @@ -2579,7 +2579,7 @@ geos::unique_ptr QgsGeos::reshapePolygon( const GEOSGeometry *polygon, const GEO newOuterRing = GEOSGeom_clone_r( geosinit.ctxt, outerRing ); //check if all the rings are still inside the outer boundary - QList ringList; + QVector ringList; if ( nRings > 0 ) { GEOSGeometry *outerRingPoly = GEOSGeom_createPolygon_r( geosinit.ctxt, GEOSGeom_clone_r( geosinit.ctxt, newOuterRing ), nullptr, 0 ); diff --git a/src/core/geometry/qgsgeos.h b/src/core/geometry/qgsgeos.h index 5289c463a66..d7ed68261cf 100644 --- a/src/core/geometry/qgsgeos.h +++ b/src/core/geometry/qgsgeos.h @@ -135,8 +135,8 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine std::unique_ptr< QgsAbstractGeometry > subdivide( int maxNodes, QString *errorMsg = nullptr ) const; QgsAbstractGeometry *combine( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const override; - QgsAbstractGeometry *combine( const QList &geomList, QString *errorMsg ) const override; - QgsAbstractGeometry *combine( const QList< QgsGeometry > &, QString *errorMsg = nullptr ) const override; + QgsAbstractGeometry *combine( const QVector &geomList, QString *errorMsg ) const override; + QgsAbstractGeometry *combine( const QVector< QgsGeometry > &, QString *errorMsg = nullptr ) const override; QgsAbstractGeometry *symDifference( const QgsAbstractGeometry *geom, QString *errorMsg = nullptr ) const override; QgsAbstractGeometry *buffer( double distance, int segments, QString *errorMsg = nullptr ) const override; QgsAbstractGeometry *buffer( double distance, int segments, int endCapStyle, int joinStyle, double miterLimit, QString *errorMsg = nullptr ) const override; @@ -200,7 +200,7 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine bool isSimple( QString *errorMsg = nullptr ) const override; EngineOperationResult splitGeometry( const QgsLineString &splitLine, - QList< QgsGeometry > &newGeometries, + QVector &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg = nullptr ) const override; @@ -279,7 +279,7 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine * An empty geometry will be returned in the case of errors. * \since QGIS 3.0 */ - static QgsGeometry polygonize( const QList< const QgsAbstractGeometry *> &geometries, QString *errorMsg = nullptr ); + static QgsGeometry polygonize( const QVector &geometries, QString *errorMsg = nullptr ); /** * Creates a Voronoi diagram for the nodes contained within the geometry. @@ -368,8 +368,8 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine //utils for geometry split bool topologicalTestPointsSplit( const GEOSGeometry *splitLine, QgsPointSequence &testPoints, QString *errorMsg = nullptr ) const; geos::unique_ptr linePointDifference( GEOSGeometry *GEOSsplitPoint ) const; - EngineOperationResult splitLinearGeometry( GEOSGeometry *splitLine, QList &newGeometries ) const; - EngineOperationResult splitPolygonGeometry( GEOSGeometry *splitLine, QList &newGeometries ) const; + EngineOperationResult splitLinearGeometry( GEOSGeometry *splitLine, QVector &newGeometries ) const; + EngineOperationResult splitPolygonGeometry( GEOSGeometry *splitLine, QVector &newGeometries ) const; //utils for reshape static geos::unique_ptr reshapeLine( const GEOSGeometry *line, const GEOSGeometry *reshapeLineGeos, double precision ); diff --git a/src/core/geometry/qgsinternalgeometryengine.cpp b/src/core/geometry/qgsinternalgeometryengine.cpp index 3d0fed6d953..13fcee503b8 100644 --- a/src/core/geometry/qgsinternalgeometryengine.cpp +++ b/src/core/geometry/qgsinternalgeometryengine.cpp @@ -42,7 +42,7 @@ QgsInternalGeometryEngine::QgsInternalGeometryEngine( const QgsGeometry &geometr QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const { - QList linesToProcess; + QVector linesToProcess; const QgsMultiCurve *multiCurve = qgsgeometry_cast< const QgsMultiCurve * >( mGeometry ); if ( multiCurve ) @@ -496,7 +496,7 @@ QgsGeometry QgsInternalGeometryEngine::orthogonalize( double tolerance, int maxI if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) ) { int numGeom = gc->numGeometries(); - QList< QgsAbstractGeometry * > geometryList; + QVector< QgsAbstractGeometry * > geometryList; geometryList.reserve( numGeom ); for ( int i = 0; i < numGeom; ++i ) { @@ -654,7 +654,7 @@ QgsGeometry QgsInternalGeometryEngine::densifyByCount( int extraNodesPerSegment if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) ) { int numGeom = gc->numGeometries(); - QList< QgsAbstractGeometry * > geometryList; + QVector< QgsAbstractGeometry * > geometryList; geometryList.reserve( numGeom ); for ( int i = 0; i < numGeom; ++i ) { @@ -689,7 +689,7 @@ QgsGeometry QgsInternalGeometryEngine::densifyByDistance( double distance ) cons if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) ) { int numGeom = gc->numGeometries(); - QList< QgsAbstractGeometry * > geometryList; + QVector< QgsAbstractGeometry * > geometryList; geometryList.reserve( numGeom ); for ( int i = 0; i < numGeom; ++i ) { diff --git a/src/core/geometry/qgslinestring.cpp b/src/core/geometry/qgslinestring.cpp index a6a52270bff..d70000a2a8d 100644 --- a/src/core/geometry/qgslinestring.cpp +++ b/src/core/geometry/qgslinestring.cpp @@ -124,7 +124,7 @@ QgsLineString::QgsLineString( const QVector &x, const QVector &y } } -QgsLineString::QgsLineString( const QList &points ) +QgsLineString::QgsLineString( const QVector &points ) { mWkbType = QgsWkbTypes::LineString; mX.reserve( points.size() ); diff --git a/src/core/geometry/qgslinestring.h b/src/core/geometry/qgslinestring.h index 2fde2e3dee6..3b56ab039c3 100644 --- a/src/core/geometry/qgslinestring.h +++ b/src/core/geometry/qgslinestring.h @@ -69,7 +69,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve * or repeatedly calling addVertex() * \since QGIS 3.0 */ - QgsLineString( const QList &points ); + QgsLineString( const QVector &points ); bool operator==( const QgsCurve &other ) const override; bool operator!=( const QgsCurve &other ) const override; diff --git a/src/core/geometry/qgsmulticurve.cpp b/src/core/geometry/qgsmulticurve.cpp index 1b97ed04fc7..d9e867b9438 100644 --- a/src/core/geometry/qgsmulticurve.cpp +++ b/src/core/geometry/qgsmulticurve.cpp @@ -59,7 +59,7 @@ QgsMultiCurve *QgsMultiCurve::toCurveType() const bool QgsMultiCurve::fromWkt( const QString &wkt ) { return fromCollectionWkt( wkt, - QList() << new QgsLineString << new QgsCircularString << new QgsCompoundCurve, + QVector() << new QgsLineString << new QgsCircularString << new QgsCompoundCurve, QStringLiteral( "LineString" ) ); } diff --git a/src/core/geometry/qgsmultilinestring.cpp b/src/core/geometry/qgsmultilinestring.cpp index 6fedc2b30a7..f96bade3743 100644 --- a/src/core/geometry/qgsmultilinestring.cpp +++ b/src/core/geometry/qgsmultilinestring.cpp @@ -52,7 +52,7 @@ void QgsMultiLineString::clear() bool QgsMultiLineString::fromWkt( const QString &wkt ) { - return fromCollectionWkt( wkt, QList() << new QgsLineString, QStringLiteral( "LineString" ) ); + return fromCollectionWkt( wkt, QVector() << new QgsLineString, QStringLiteral( "LineString" ) ); } QDomElement QgsMultiLineString::asGML2( QDomDocument &doc, int precision, const QString &ns ) const diff --git a/src/core/geometry/qgsmultipoint.cpp b/src/core/geometry/qgsmultipoint.cpp index f534283e8b7..f195af0da3b 100644 --- a/src/core/geometry/qgsmultipoint.cpp +++ b/src/core/geometry/qgsmultipoint.cpp @@ -58,7 +58,7 @@ bool QgsMultiPoint::fromWkt( const QString &wkt ) collectionWkt.replace( '(', QLatin1String( "((" ) ).replace( ')', QLatin1String( "))" ) ).replace( ',', QLatin1String( "),(" ) ); } - return fromCollectionWkt( collectionWkt, QList() << new QgsPoint, QStringLiteral( "Point" ) ); + return fromCollectionWkt( collectionWkt, QVector() << new QgsPoint, QStringLiteral( "Point" ) ); } void QgsMultiPoint::clear() diff --git a/src/core/geometry/qgsmultipolygon.cpp b/src/core/geometry/qgsmultipolygon.cpp index 2bb9698ac03..312a9c59967 100644 --- a/src/core/geometry/qgsmultipolygon.cpp +++ b/src/core/geometry/qgsmultipolygon.cpp @@ -52,7 +52,7 @@ QgsMultiPolygon *QgsMultiPolygon::clone() const bool QgsMultiPolygon::fromWkt( const QString &wkt ) { - return fromCollectionWkt( wkt, QList() << new QgsPolygon, QStringLiteral( "Polygon" ) ); + return fromCollectionWkt( wkt, QVector() << new QgsPolygon, QStringLiteral( "Polygon" ) ); } QDomElement QgsMultiPolygon::asGML2( QDomDocument &doc, int precision, const QString &ns ) const diff --git a/src/core/geometry/qgsmultisurface.cpp b/src/core/geometry/qgsmultisurface.cpp index ba220288add..93251d75711 100644 --- a/src/core/geometry/qgsmultisurface.cpp +++ b/src/core/geometry/qgsmultisurface.cpp @@ -59,7 +59,7 @@ QgsMultiSurface *QgsMultiSurface::toCurveType() const bool QgsMultiSurface::fromWkt( const QString &wkt ) { return fromCollectionWkt( wkt, - QList() << new QgsPolygon << new QgsCurvePolygon, + QVector() << new QgsPolygon << new QgsCurvePolygon, QStringLiteral( "Polygon" ) ); } diff --git a/src/core/geometry/qgsregularpolygon.cpp b/src/core/geometry/qgsregularpolygon.cpp index 2045e626884..51522716727 100644 --- a/src/core/geometry/qgsregularpolygon.cpp +++ b/src/core/geometry/qgsregularpolygon.cpp @@ -221,9 +221,9 @@ QgsTriangle QgsRegularPolygon::toTriangle() const return QgsTriangle( pts.at( 0 ), pts.at( 1 ), pts.at( 2 ) ); } -QList QgsRegularPolygon::triangulate() const +QVector QgsRegularPolygon::triangulate() const { - QList l_tri; + QVector l_tri; if ( isEmpty() ) { return l_tri; diff --git a/src/core/geometry/qgsregularpolygon.h b/src/core/geometry/qgsregularpolygon.h index 4e58ca00669..49b5865e66d 100644 --- a/src/core/geometry/qgsregularpolygon.h +++ b/src/core/geometry/qgsregularpolygon.h @@ -176,7 +176,7 @@ class CORE_EXPORT QgsRegularPolygon * Returns a triangulation (vertices from sides to the center) of the regular polygon. * An empty list is returned if the regular polygon is empty. */ - QList triangulate() const; + QVector triangulate() const; /** * Returns the inscribed circle diff --git a/src/core/geometry/qgstriangle.h b/src/core/geometry/qgstriangle.h index b8b054f569c..41482a4a9e0 100644 --- a/src/core/geometry/qgstriangle.h +++ b/src/core/geometry/qgstriangle.h @@ -86,7 +86,7 @@ class CORE_EXPORT QgsTriangle : public QgsPolygon * Inherited method not used. You cannot add an interior ring into a triangle. * \note not available in Python bindings */ - void setInteriorRings( const QList< QgsCurve *> &rings ) = delete; + void setInteriorRings( const QVector< QgsCurve *> &rings ) = delete; //! 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. diff --git a/src/core/layout/qgslayoutitemmapgrid.cpp b/src/core/layout/qgslayoutitemmapgrid.cpp index 337dda8f044..f11bef92786 100644 --- a/src/core/layout/qgslayoutitemmapgrid.cpp +++ b/src/core/layout/qgslayoutitemmapgrid.cpp @@ -2335,10 +2335,10 @@ QList QgsLayoutItemMapGrid::trimLinesToMap( const QPolygonF &line, co QgsGeometry rectGeom = QgsGeometry::fromRect( rect ); QgsGeometry intersected = lineGeom.intersection( rectGeom ); - QList intersectedParts = intersected.asGeometryCollection(); + QVector intersectedParts = intersected.asGeometryCollection(); QList trimmedLines; - QList::const_iterator geomIt = intersectedParts.constBegin(); + QVector::const_iterator geomIt = intersectedParts.constBegin(); for ( ; geomIt != intersectedParts.constEnd(); ++geomIt ) { trimmedLines << ( *geomIt ).asQPolygonF(); diff --git a/src/core/qgsaggregatecalculator.cpp b/src/core/qgsaggregatecalculator.cpp index 00ad14f8de8..9632347c41d 100644 --- a/src/core/qgsaggregatecalculator.cpp +++ b/src/core/qgsaggregatecalculator.cpp @@ -468,7 +468,7 @@ QVariant QgsAggregateCalculator::calculateGeometryAggregate( QgsFeatureIterator Q_ASSERT( expression ); QgsFeature f; - QList< QgsGeometry > geometries; + QVector< QgsGeometry > geometries; while ( fit.nextFeature( f ) ) { Q_ASSERT( context ); diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index 5756f9593b3..0d97aa0f052 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -210,7 +210,7 @@ double QgsDistanceArea::measurePerimeter( const QgsGeometry &geometry ) const } //create list with (single) surfaces - QList< const QgsSurface * > surfaces; + QVector< const QgsSurface * > surfaces; const QgsSurface *surf = qgsgeometry_cast( geomV2 ); if ( surf ) { @@ -227,7 +227,7 @@ double QgsDistanceArea::measurePerimeter( const QgsGeometry &geometry ) const } double length = 0; - QList::const_iterator surfaceIt = surfaces.constBegin(); + QVector::const_iterator surfaceIt = surfaces.constBegin(); for ( ; surfaceIt != surfaces.constEnd(); ++surfaceIt ) { if ( !*surfaceIt ) @@ -259,13 +259,13 @@ double QgsDistanceArea::measureLine( const QgsCurve *curve ) const } QgsPointSequence linePointsV2; - QList linePoints; + QVector linePoints; curve->points( linePointsV2 ); QgsGeometry::convertPointList( linePointsV2, linePoints ); return measureLine( linePoints ); } -double QgsDistanceArea::measureLine( const QList &points ) const +double QgsDistanceArea::measureLine( const QVector &points ) const { if ( points.size() < 2 ) return 0; @@ -280,7 +280,7 @@ double QgsDistanceArea::measureLine( const QList &points ) const else p1 = points[0]; - for ( QList::const_iterator i = points.begin(); i != points.end(); ++i ) + for ( QVector::const_iterator i = points.constBegin(); i != points.constEnd(); ++i ) { if ( willUseEllipsoid() ) { @@ -472,20 +472,20 @@ double QgsDistanceArea::measurePolygon( const QgsCurve *curve ) const QgsPointSequence linePointsV2; curve->points( linePointsV2 ); - QList linePoints; + QVector linePoints; QgsGeometry::convertPointList( linePointsV2, linePoints ); return measurePolygon( linePoints ); } -double QgsDistanceArea::measurePolygon( const QList &points ) const +double QgsDistanceArea::measurePolygon( const QVector &points ) const { try { if ( willUseEllipsoid() ) { - QList pts; - for ( QList::const_iterator i = points.begin(); i != points.end(); ++i ) + QVector pts; + for ( QVector::const_iterator i = points.constBegin(); i != points.constEnd(); ++i ) { pts.append( mCoordTransform.transform( *i ) ); } @@ -685,7 +685,7 @@ void QgsDistanceArea::setFromParams( const QgsEllipsoidUtils::EllipsoidParameter } } -double QgsDistanceArea::computePolygonArea( const QList &points ) const +double QgsDistanceArea::computePolygonArea( const QVector &points ) const { if ( points.isEmpty() ) { @@ -774,7 +774,7 @@ double QgsDistanceArea::computePolygonArea( const QList &points ) co return area; } -double QgsDistanceArea::computePolygonFlatArea( const QList &points ) const +double QgsDistanceArea::computePolygonFlatArea( const QVector &points ) const { // Normal plane area calculations. double area = 0.0; diff --git a/src/core/qgsdistancearea.h b/src/core/qgsdistancearea.h index 05ee7cbbe54..c022a75bc29 100644 --- a/src/core/qgsdistancearea.h +++ b/src/core/qgsdistancearea.h @@ -17,7 +17,7 @@ #define QGSDISTANCEAREA_H #include "qgis_core.h" -#include +#include #include #include "qgscoordinatetransform.h" #include "qgsunittypes.h" @@ -168,7 +168,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 QVector &points ) const; /** * Measures the distance between two points. @@ -213,7 +213,7 @@ 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 QVector &points ) const; /** * Computes the bearing (in radians) between two points. @@ -308,9 +308,9 @@ class CORE_EXPORT QgsDistanceArea * 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 QVector &points ) const; - double computePolygonFlatArea( const QList &points ) const; + double computePolygonFlatArea( const QVector &points ) const; /** * Precalculates some values diff --git a/src/core/qgsgeometryvalidator.cpp b/src/core/qgsgeometryvalidator.cpp index 642a1a87b0e..fe4f277a035 100644 --- a/src/core/qgsgeometryvalidator.cpp +++ b/src/core/qgsgeometryvalidator.cpp @@ -19,7 +19,7 @@ email : jef at norbit dot de #include "qgslogger.h" #include "qgsgeos.h" -QgsGeometryValidator::QgsGeometryValidator( const QgsGeometry &geometry, QList *errors, QgsGeometry::ValidationMethod method ) +QgsGeometryValidator::QgsGeometryValidator( const QgsGeometry &geometry, QVector *errors, QgsGeometry::ValidationMethod method ) : mGeometry( geometry ) , mErrors( errors ) , mStop( false ) @@ -354,7 +354,7 @@ void QgsGeometryValidator::addError( const QgsGeometry::Error &e ) *mErrors << e; } -void QgsGeometryValidator::validateGeometry( const QgsGeometry &geometry, QList &errors, QgsGeometry::ValidationMethod method ) +void QgsGeometryValidator::validateGeometry( const QgsGeometry &geometry, QVector &errors, QgsGeometry::ValidationMethod method ) { QgsGeometryValidator *gv = new QgsGeometryValidator( geometry, &errors, method ); connect( gv, &QgsGeometryValidator::errorFound, gv, &QgsGeometryValidator::addError ); diff --git a/src/core/qgsgeometryvalidator.h b/src/core/qgsgeometryvalidator.h index fccbfa96210..8a819ff2fbd 100644 --- a/src/core/qgsgeometryvalidator.h +++ b/src/core/qgsgeometryvalidator.h @@ -34,14 +34,14 @@ class CORE_EXPORT QgsGeometryValidator : public QThread /** * Constructor for QgsGeometryValidator. */ - QgsGeometryValidator( const QgsGeometry &geoemtry, QList *errors = nullptr, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); + QgsGeometryValidator( const QgsGeometry &geoemtry, QVector *errors = nullptr, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); ~QgsGeometryValidator(); void run() override; void stop(); //! Validate geometry and produce a list of geometry errors - static void validateGeometry( const QgsGeometry &geometry, QList &errors SIP_OUT, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); + static void validateGeometry( const QgsGeometry &geometry, QVector &errors SIP_OUT, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal ); signals: void errorFound( const QgsGeometry::Error & ); @@ -59,7 +59,7 @@ class CORE_EXPORT QgsGeometryValidator : public QThread bool pointInRing( const QgsPolylineXY &ring, const QgsPointXY &p ); QgsGeometry mGeometry; - QList *mErrors; + QVector *mErrors; bool mStop; int mErrorCount; QgsGeometry::ValidationMethod mMethod = QgsGeometry::ValidatorQgisInternal; diff --git a/src/core/qgssnappingutils.cpp b/src/core/qgssnappingutils.cpp index bea458f6e06..4dacfd57225 100644 --- a/src/core/qgssnappingutils.cpp +++ b/src/core/qgssnappingutils.cpp @@ -101,7 +101,7 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPointXY QSet endpoints; // make a geometry - QList geoms; + QVector geoms; Q_FOREACH ( const QgsPointLocator::Match &m, segments ) { if ( m.hasEdge() ) diff --git a/src/core/qgstracer.cpp b/src/core/qgstracer.cpp index 18017da7492..059c5dab66d 100644 --- a/src/core/qgstracer.cpp +++ b/src/core/qgstracer.cpp @@ -713,7 +713,7 @@ QVector QgsTracer::findShortestPath( const QgsPointXY &p1, const Qgs if ( !points.isEmpty() && mOffset != 0 ) { - QList pointsInput( points.toList() ); + QVector pointsInput( points ); QgsLineString linestring( pointsInput ); std::unique_ptr linestringEngine( QgsGeometry::createGeometryEngine( &linestring ) ); std::unique_ptr linestringOffset( linestringEngine->offsetCurve( mOffset, mOffsetSegments, mOffsetJoinStyle, mOffsetMiterLimit ) ); diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 767c1a792ca..d0ba0597f3a 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -1116,7 +1116,7 @@ bool QgsVectorLayer::deleteSelectedFeatures( int *deletedCount ) return deleted == count; } -int QgsVectorLayer::addRing( const QList &ring, QgsFeatureId *featureId ) +int QgsVectorLayer::addRing( const QVector &ring, QgsFeatureId *featureId ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return 6; @@ -1268,7 +1268,7 @@ int QgsVectorLayer::translateFeature( QgsFeatureId featureId, double dx, double return result; } -int QgsVectorLayer::splitParts( const QList &splitLine, bool topologicalEditing ) +int QgsVectorLayer::splitParts( const QVector &splitLine, bool topologicalEditing ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return -1; @@ -1277,7 +1277,7 @@ int QgsVectorLayer::splitParts( const QList &splitLine, bool topolog return utils.splitParts( splitLine, topologicalEditing ); } -int QgsVectorLayer::splitFeatures( const QList &splitLine, bool topologicalEditing ) +int QgsVectorLayer::splitFeatures( const QVector &splitLine, bool topologicalEditing ) { if ( !mValid || !mEditBuffer || !mDataProvider ) return -1; diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h index 8382b09d4a7..ac872767e68 100644 --- a/src/core/qgsvectorlayer.h +++ b/src/core/qgsvectorlayer.h @@ -1059,7 +1059,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 QVector &ring, QgsFeatureId *featureId = nullptr ); /** * Adds a ring to polygon/multipolygon features (takes ownership) @@ -1127,7 +1127,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 QVector &splitLine, bool topologicalEditing = false ); /** * Splits features cut by the given line @@ -1138,7 +1138,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 QVector &splitLine, bool topologicalEditing = false ); /** * Adds topological points for every vertex of the geometry. diff --git a/src/core/qgsvectorlayereditutils.cpp b/src/core/qgsvectorlayereditutils.cpp index 98d7c5a9242..cd2c772b49d 100644 --- a/src/core/qgsvectorlayereditutils.cpp +++ b/src/core/qgsvectorlayereditutils.cpp @@ -115,7 +115,7 @@ QgsVectorLayer::EditResult QgsVectorLayerEditUtils::deleteVertex( QgsFeatureId f return !geometry.isNull() ? QgsVectorLayer::Success : QgsVectorLayer::EmptyGeometry; } -QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId ) +QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing( const QVector &ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId ) { QgsLineString *ringLine = new QgsLineString( ring ); return addRing( ringLine, targetFeatureIds, modifiedFeatureId ); @@ -272,7 +272,7 @@ int QgsVectorLayerEditUtils::translateFeature( QgsFeatureId featureId, double dx } -QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QList &splitLine, bool topologicalEditing ) +QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QVector &splitLine, bool topologicalEditing ) { if ( !mLayer->isSpatial() ) return QgsGeometry::InvalidBaseGeometry; @@ -340,8 +340,8 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QList { continue; } - QList newGeometries; - QList topologyTestPoints; + QVector newGeometries; + QVector topologyTestPoints; QgsGeometry featureGeom = feat.geometry(); splitFunctionReturn = featureGeom.splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints ); if ( splitFunctionReturn == QgsGeometry::Success ) @@ -358,7 +358,7 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QList if ( topologicalEditing ) { - QList::const_iterator topol_it = topologyTestPoints.constBegin(); + QVector::const_iterator topol_it = topologyTestPoints.constBegin(); for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it ) { addTopologicalPoints( *topol_it ); @@ -382,7 +382,7 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QList return returnCode; } -QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList &splitLine, bool topologicalEditing ) +QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QVector &splitLine, bool topologicalEditing ) { if ( !mLayer->isSpatial() ) return QgsGeometry::InvalidBaseGeometry; @@ -447,8 +447,8 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList newGeometries; - QList topologyTestPoints; + QVector newGeometries; + QVector topologyTestPoints; QgsGeometry featureGeom = feat.geometry(); splitFunctionReturn = featureGeom.splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints ); if ( splitFunctionReturn == 0 ) @@ -474,7 +474,7 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList::const_iterator topol_it = topologyTestPoints.constBegin(); + QVector::const_iterator topol_it = topologyTestPoints.constBegin(); for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it ) { addTopologicalPoints( *topol_it ); @@ -676,7 +676,7 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPointXY &p ) } -bool QgsVectorLayerEditUtils::boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const +bool QgsVectorLayerEditUtils::boundingBoxFromPointList( const QVector &list, double &xmin, double &ymin, double &xmax, double &ymax ) const { if ( list.empty() ) { @@ -688,7 +688,7 @@ bool QgsVectorLayerEditUtils::boundingBoxFromPointList( const QList ymin = std::numeric_limits::max(); ymax = -std::numeric_limits::max(); - for ( QList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it ) + for ( QVector::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 7b28d651d73..b30e416efc4 100644 --- a/src/core/qgsvectorlayereditutils.h +++ b/src/core/qgsvectorlayereditutils.h @@ -78,7 +78,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * \param modifiedFeatureId if specified, feature ID for feature that ring was added to will be stored in this parameter * \return OperationResult result code: success or reason of failure */ - QgsGeometry::OperationResult addRing( const QList &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ); + QgsGeometry::OperationResult addRing( const QVector &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr ); /** * Adds a ring to polygon/multipolygon features @@ -151,7 +151,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * - QgsGeometry::GeometryEngineError * - QgsGeometry::SplitCannotSplitPoint */ - QgsGeometry::OperationResult splitParts( const QList &splitLine, bool topologicalEditing = false ); + QgsGeometry::OperationResult splitParts( const QVector &splitLine, bool topologicalEditing = false ); /** * Splits features cut by the given line @@ -161,7 +161,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * 0 in case of success, * 4 if there is a selection but no feature split */ - QgsGeometry::OperationResult splitFeatures( const QList &splitLine, bool topologicalEditing = false ); + QgsGeometry::OperationResult splitFeatures( const QVector &splitLine, bool topologicalEditing = false ); /** * Adds topological points for every vertex of the geometry. @@ -187,7 +187,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils * Little helper function that gives bounding box from a list of points. * \returns True in case of success */ - bool boundingBoxFromPointList( const QList &list, double &xmin, double &ymin, double &xmax, double &ymax ) const; + bool boundingBoxFromPointList( const QVector &list, double &xmin, double &ymin, double &xmax, double &ymax ) const; QgsVectorLayer *mLayer = nullptr; }; diff --git a/src/core/symbology/qgsinvertedpolygonrenderer.h b/src/core/symbology/qgsinvertedpolygonrenderer.h index bbf7e5cf821..a10a02dba60 100644 --- a/src/core/symbology/qgsinvertedpolygonrenderer.h +++ b/src/core/symbology/qgsinvertedpolygonrenderer.h @@ -157,7 +157,7 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer //! Structure where the reversed geometry is built during renderFeature struct CombinedFeature { - QList geometries; //< list of geometries + QVector geometries; //< list of geometries QgsFeature feature; //< one feature (for attriute-based rendering) }; typedef QVector FeatureCategoryVector; diff --git a/src/gui/qgsmaptoolcapture.cpp b/src/gui/qgsmaptoolcapture.cpp index c4a2ff3e9bd..20782efdf0a 100644 --- a/src/gui/qgsmaptoolcapture.cpp +++ b/src/gui/qgsmaptoolcapture.cpp @@ -765,16 +765,16 @@ int QgsMapToolCapture::size() return mCaptureCurve.numPoints(); } -QList QgsMapToolCapture::points() +QVector QgsMapToolCapture::points() { QgsPointSequence pts; - QList points; + QVector points; mCaptureCurve.points( pts ); QgsGeometry::convertPointList( pts, points ); return points; } -void QgsMapToolCapture::setPoints( const QList &pointList ) +void QgsMapToolCapture::setPoints( const QVector &pointList ) { QgsLineString *line = new QgsLineString( pointList ); mCaptureCurve.clear(); diff --git a/src/gui/qgsmaptoolcapture.h b/src/gui/qgsmaptoolcapture.h index 4daa7647699..de9416def13 100644 --- a/src/gui/qgsmaptoolcapture.h +++ b/src/gui/qgsmaptoolcapture.h @@ -192,14 +192,14 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing * List of digitized points * \returns List of points */ - QList points(); + QVector points(); /** * Set the points on which to work * * \param pointList A list of points */ - void setPoints( const QList &pointList ); + void setPoints( const QVector &pointList ); /** * Close an open polygon diff --git a/src/gui/qgsmaptooledit.cpp b/src/gui/qgsmaptooledit.cpp index d86e05c5752..3376ddcdb31 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 QVector &geom ) { if ( !mCanvas ) { @@ -107,7 +107,7 @@ int QgsMapToolEdit::addTopologicalPoints( const QList &geom ) return 2; } - QList::const_iterator list_it = geom.constBegin(); + QVector::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 17abd6cab14..097c37cccb6 100644 --- a/src/gui/qgsmaptooledit.h +++ b/src/gui/qgsmaptooledit.h @@ -72,7 +72,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 QVector &geom ); //! Display a timed message bar noting the active layer is not vector. void notifyNotVectorLayer(); diff --git a/src/plugins/topology/topolTest.cpp b/src/plugins/topology/topolTest.cpp index c7ae7f1703e..05786dfcdac 100644 --- a/src/plugins/topology/topolTest.cpp +++ b/src/plugins/topology/topolTest.cpp @@ -695,7 +695,7 @@ ErrorList topolTest::checkGaps( double tolerance, QgsVectorLayer *layer1, QgsVec //qDebug() << "difference gometry - " << diffGeoms->exportToWkt(); - QList geomColl = diffGeoms.asGeometryCollection(); + QVector geomColl = diffGeoms.asGeometryCollection(); QgsGeometry canvasExtentPoly = QgsGeometry::fromWkt( qgsInterface->mapCanvas()->extent().asWktPolygon() ); diff --git a/src/providers/arcgisrest/qgsarcgisrestutils.cpp b/src/providers/arcgisrest/qgsarcgisrestutils.cpp index 8e5511ea6bd..90162c779c1 100644 --- a/src/providers/arcgisrest/qgsarcgisrestutils.cpp +++ b/src/providers/arcgisrest/qgsarcgisrestutils.cpp @@ -120,7 +120,7 @@ static QgsCircularString *parseCircularString( const QVariantMap &curveData, Qgs QVariantList coordsList = curveData[QStringLiteral( "c" )].toList(); if ( coordsList.isEmpty() ) return nullptr; - QList points; + QVector points; points.append( startPoint ); foreach ( const QVariant &coordData, coordsList ) { diff --git a/tests/src/core/testqgsdistancearea.cpp b/tests/src/core/testqgsdistancearea.cpp index 07c028e6653..9dd6db30e65 100644 --- a/tests/src/core/testqgsdistancearea.cpp +++ b/tests/src/core/testqgsdistancearea.cpp @@ -365,7 +365,7 @@ void TestQgsDistanceArea::emptyPolygon() da.setEllipsoid( QStringLiteral( "WGS84" ) ); //test that measuring an empty polygon doesn't crash - da.measurePolygon( QList< QgsPointXY >() ); + da.measurePolygon( QVector< QgsPointXY >() ); } void TestQgsDistanceArea::regression14675() diff --git a/tests/src/core/testqgsgeometry.cpp b/tests/src/core/testqgsgeometry.cpp index de8dca4f90d..9386299e626 100644 --- a/tests/src/core/testqgsgeometry.cpp +++ b/tests/src/core/testqgsgeometry.cpp @@ -2258,7 +2258,7 @@ void TestQgsGeometry::circularString() //removing a vertex from a 3 point circular string should remove the whole line QgsCircularString l39; - l39.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) ); + l39.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) ); QCOMPARE( l39.numPoints(), 3 ); l39.deleteVertex( QgsVertexId( 0, 0, 2 ) ); QCOMPARE( l39.numPoints(), 0 ); @@ -2266,7 +2266,7 @@ void TestQgsGeometry::circularString() //boundary QgsCircularString boundary1; QVERIFY( !boundary1.boundary() ); - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); QgsAbstractGeometry *boundary = boundary1.boundary(); QgsMultiPoint *mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); QVERIFY( mpBoundary ); @@ -2277,11 +2277,11 @@ void TestQgsGeometry::circularString() delete boundary; // closed string = no boundary - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QVERIFY( !boundary1.boundary() ); //boundary with z - boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundary1.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); boundary = boundary1.boundary(); mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); QVERIFY( mpBoundary ); @@ -2494,7 +2494,7 @@ void TestQgsGeometry::lineString() QCOMPARE( fromPtsA.numPoints(), 1 ); QCOMPARE( fromPtsA.wkbType(), QgsWkbTypes::LineStringM ); - QList ptsA; + QVector ptsA; ptsA << QgsPointXY( 1, 2 ) << QgsPointXY( 11, 12 ) << QgsPointXY( 21, 22 ); QgsLineString fromPts( ptsA ); QCOMPARE( fromPts.wkbType(), QgsWkbTypes::LineString ); @@ -3930,7 +3930,7 @@ void TestQgsGeometry::lineString() //removing the second to last vertex should remove the whole line QgsLineString l39; - l39.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) ); + l39.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) ); QVERIFY( l39.numPoints() == 2 ); l39.deleteVertex( QgsVertexId( 0, 0, 1 ) ); QVERIFY( l39.numPoints() == 0 ); @@ -3938,7 +3938,7 @@ void TestQgsGeometry::lineString() //boundary QgsLineString boundary1; QVERIFY( !boundary1.boundary() ); - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); QgsAbstractGeometry *boundary = boundary1.boundary(); QgsMultiPoint *mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); QVERIFY( mpBoundary ); @@ -3949,12 +3949,12 @@ void TestQgsGeometry::lineString() delete boundary; // closed string = no boundary - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QVERIFY( !boundary1.boundary() ); \ //boundary with z - boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundary1.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); boundary = boundary1.boundary(); mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); QVERIFY( mpBoundary ); @@ -3971,7 +3971,7 @@ void TestQgsGeometry::lineString() //extend QgsLineString extend1; extend1.extend( 10, 10 ); //test no crash - extend1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); + extend1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); extend1.extend( 1, 2 ); QCOMPARE( extend1.pointN( 0 ), QgsPoint( QgsWkbTypes::Point, -1, 0 ) ); QCOMPARE( extend1.pointN( 1 ), QgsPoint( QgsWkbTypes::Point, 1, 0 ) ); @@ -4337,7 +4337,7 @@ void TestQgsGeometry::polygon() << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p7.setExteriorRing( ext ); //add a list of rings with mixed types - QList< QgsCurve * > rings; + QVector< QgsCurve * > rings; rings << new QgsLineString(); 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 ) @@ -4810,7 +4810,7 @@ void TestQgsGeometry::polygon() //removing the fourth to last vertex removes the whole ring QgsPolygon p20; QgsLineString *p20ExteriorRing = new QgsLineString(); - p20ExteriorRing->setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + p20ExteriorRing->setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); p20.setExteriorRing( p20ExteriorRing ); QVERIFY( p20.exteriorRing() ); p20.deleteVertex( QgsVertexId( 0, 0, 2 ) ); @@ -4818,7 +4818,7 @@ void TestQgsGeometry::polygon() //boundary QgsLineString boundary1; - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygon boundaryPolygon; QVERIFY( !boundaryPolygon.boundary() ); @@ -4839,10 +4839,10 @@ void TestQgsGeometry::polygon() // add interior rings QgsLineString boundaryRing1; - boundaryRing1.setPoints( QList() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) ); + boundaryRing1.setPoints( QVector() << 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() << 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() ); + boundaryRing2.setPoints( QVector() << QgsPoint( 0.8, 0.8 ) << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.9, 0.9 ) << QgsPoint( 0.8, 0.8 ) ); + boundaryPolygon.setInteriorRings( QVector< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() ); boundary = boundaryPolygon.boundary(); QgsMultiLineString *multiLineBoundary = dynamic_cast< QgsMultiLineString * >( boundary ); QVERIFY( multiLineBoundary ); @@ -4874,11 +4874,11 @@ void TestQgsGeometry::polygon() QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 2 ) )->yAt( 1 ), 0.8 ); QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 2 ) )->yAt( 2 ), 0.9 ); QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 2 ) )->yAt( 3 ), 0.8 ); - boundaryPolygon.setInteriorRings( QList< QgsCurve * >() ); + boundaryPolygon.setInteriorRings( QVector< QgsCurve * >() ); delete boundary; //test boundary with z - boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) + boundary1.setPoints( QVector() << 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(); @@ -4895,7 +4895,7 @@ void TestQgsGeometry::polygon() // point distance to boundary QgsLineString pd1; - pd1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 1 ) << QgsPoint( 0, 0 ) ); + pd1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygon pd; // no meaning, but let's not crash ( void )pd.pointDistanceToBoundary( 0, 0 ); @@ -4906,8 +4906,8 @@ void TestQgsGeometry::polygon() QGSCOMPARENEAR( pd.pointDistanceToBoundary( -0.1, 0.5 ), -0.1, 0.0000000001 ); // with a ring QgsLineString pdRing1; - 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() ); + pdRing1.setPoints( QVector() << 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( QVector< QgsCurve * >() << pdRing1.clone() ); QGSCOMPARENEAR( pd.pointDistanceToBoundary( 0, 0.5 ), 0.0, 0.0000000001 ); QGSCOMPARENEAR( pd.pointDistanceToBoundary( 0.1, 0.5 ), 0.0, 0.0000000001 ); QGSCOMPARENEAR( pd.pointDistanceToBoundary( 0.01, 0.5 ), 0.01, 0.0000000001 ); @@ -4917,7 +4917,7 @@ void TestQgsGeometry::polygon() // remove interior rings QgsLineString removeRingsExt; - removeRingsExt.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + removeRingsExt.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygon removeRings1; removeRings1.removeInteriorRings(); @@ -4927,10 +4927,10 @@ void TestQgsGeometry::polygon() // add interior rings QgsLineString removeRingsRing1; - removeRingsRing1.setPoints( QList() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) ); + removeRingsRing1.setPoints( QVector() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) ); QgsLineString removeRingsRing2; - removeRingsRing2.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() ); + removeRingsRing2.setPoints( QVector() << QgsPoint( 0.6, 0.8 ) << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.9, 0.9 ) << QgsPoint( 0.6, 0.8 ) ); + removeRings1.setInteriorRings( QVector< QgsCurve * >() << removeRingsRing1.clone() << removeRingsRing2.clone() ); // remove ring with size filter removeRings1.removeInteriorRings( 0.0075 ); @@ -5616,7 +5616,7 @@ void TestQgsGeometry::polygon() // test adjacent vertices - should wrap around! QgsLineString *closedRing1 = new QgsLineString(); - closedRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); + closedRing1->setPoints( QVector() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QgsPolygon p28; QgsVertexId previous( 1, 2, 3 ); QgsVertexId next( 4, 5, 6 ); @@ -5680,7 +5680,7 @@ void TestQgsGeometry::polygon() QCOMPARE( vertexLine2.vertexNumberFromVertexId( QgsVertexId( -1, 0, 0 ) ), -1 ); QgsLineString *closedRing2 = new QgsLineString(); - closedRing2->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); + closedRing2->setPoints( QVector() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QgsPolygon p29; QCOMPARE( p29.vertexNumberFromVertexId( QgsVertexId( -1, 0, 0 ) ), -1 ); QCOMPARE( p29.vertexNumberFromVertexId( QgsVertexId( 1, 0, 0 ) ), -1 ); @@ -6969,7 +6969,7 @@ void TestQgsGeometry::regularPolygon() QVERIFY( QgsCircle( QgsPoint( 0, 0 ), 5 ) == rp9.toTriangle().circumscribedCircle() ); QgsRegularPolygon rp10 = QgsRegularPolygon( QgsPoint( 0, 0 ), QgsPoint( 0, 4 ), 4 ); - QList rp10_tri = rp10.triangulate(); + QVector rp10_tri = rp10.triangulate(); QCOMPARE( rp10_tri.length(), static_cast< int >( rp10.numberSides() ) ); 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() ) ); @@ -7219,7 +7219,7 @@ void TestQgsGeometry::curvePolygon() << QgsPoint( 10, 0 ) << QgsPoint( 0, 0 ) ); p7.setExteriorRing( ext ); //add a list of rings with mixed types - QList< QgsCurve * > rings; + QVector< QgsCurve * > rings; rings << new QgsCircularString(); static_cast< QgsCircularString *>( 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 ) @@ -7744,7 +7744,7 @@ void TestQgsGeometry::curvePolygon() //removing the fourth to last vertex removes the whole ring QgsCurvePolygon p20; QgsCircularString *p20ExteriorRing = new QgsCircularString(); - p20ExteriorRing->setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + p20ExteriorRing->setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); p20.setExteriorRing( p20ExteriorRing ); QVERIFY( p20.exteriorRing() ); p20.deleteVertex( QgsVertexId( 0, 0, 2 ) ); @@ -7776,10 +7776,10 @@ void TestQgsGeometry::curvePolygon() // add interior rings QgsCircularString boundaryRing1; - boundaryRing1.setPoints( QList() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) ); + boundaryRing1.setPoints( QVector() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) ); QgsCircularString boundaryRing2; - boundaryRing2.setPoints( QList() << QgsPoint( 0.8, 0.8 ) << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.9, 0.9 ) ); - boundaryPolygon.setInteriorRings( QList< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() ); + boundaryRing2.setPoints( QVector() << QgsPoint( 0.8, 0.8 ) << QgsPoint( 0.9, 0.8 ) << QgsPoint( 0.9, 0.9 ) ); + boundaryPolygon.setInteriorRings( QVector< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() ); boundary = boundaryPolygon.boundary(); QgsMultiCurve *multiLineBoundary = dynamic_cast< QgsMultiCurve * >( boundary ); QVERIFY( multiLineBoundary ); @@ -7809,11 +7809,11 @@ void TestQgsGeometry::curvePolygon() QCOMPARE( dynamic_cast< QgsCircularString * >( multiLineBoundary->geometryN( 2 ) )->yAt( 0 ), 0.8 ); QCOMPARE( dynamic_cast< QgsCircularString * >( multiLineBoundary->geometryN( 2 ) )->yAt( 1 ), 0.8 ); QCOMPARE( dynamic_cast< QgsCircularString * >( multiLineBoundary->geometryN( 2 ) )->yAt( 2 ), 0.9 ); - boundaryPolygon.setInteriorRings( QList< QgsCurve * >() ); + boundaryPolygon.setInteriorRings( QVector< QgsCurve * >() ); delete boundary; //test boundary with z - boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) + boundary1.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); boundaryPolygon.setExteriorRing( boundary1.clone() ); boundary = boundaryPolygon.boundary(); @@ -7828,7 +7828,7 @@ void TestQgsGeometry::curvePolygon() // remove interior rings QgsCircularString removeRingsExt; - removeRingsExt.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + removeRingsExt.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsCurvePolygon removeRings1; removeRings1.removeInteriorRings(); @@ -7843,7 +7843,7 @@ void TestQgsGeometry::curvePolygon() QgsCircularString removeRingsRing2; removeRingsRing2.setPoints( QgsPointSequence() << QgsPoint( 0, 0, 1 ) << QgsPoint( 0.01, 0.1, 2 ) << QgsPoint( 0, 0.2, 3 ) << QgsPoint( -0.01, 0.12, 4 ) << QgsPoint( 0, 0, 1 ) ); - removeRings1.setInteriorRings( QList< QgsCurve * >() << removeRingsRing1.clone() << removeRingsRing2.clone() ); + removeRings1.setInteriorRings( QVector< QgsCurve * >() << removeRingsRing1.clone() << removeRingsRing2.clone() ); // remove ring with size filter removeRings1.removeInteriorRings( 0.05 ); @@ -10106,7 +10106,7 @@ void TestQgsGeometry::compoundCurve() //removing a vertex from a 3 point comound curveshould remove the whole line QgsCircularString l39; QgsCompoundCurve c39; - l39.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) ); + l39.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) ); c39.addCurve( l39.clone() ); QCOMPARE( c39.numPoints(), 3 ); c39.deleteVertex( QgsVertexId( 0, 0, 2 ) ); @@ -10116,7 +10116,7 @@ void TestQgsGeometry::compoundCurve() QgsCompoundCurve cBoundary1; QgsCircularString boundary1; QVERIFY( !cBoundary1.boundary() ); - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); cBoundary1.addCurve( boundary1.clone() ); QgsAbstractGeometry *boundary = cBoundary1.boundary(); QgsMultiPoint *mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -10128,13 +10128,13 @@ void TestQgsGeometry::compoundCurve() delete boundary; // closed string = no boundary - boundary1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + boundary1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); cBoundary1.clear(); cBoundary1.addCurve( boundary1.clone() ); QVERIFY( !cBoundary1.boundary() ); //boundary with z - boundary1.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundary1.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); cBoundary1.clear(); cBoundary1.addCurve( boundary1.clone() ); boundary = cBoundary1.boundary(); @@ -11256,7 +11256,7 @@ void TestQgsGeometry::multiLineString() QgsMultiLineString multiLine1; QVERIFY( !multiLine1.boundary() ); QgsLineString boundaryLine1; - boundaryLine1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); + boundaryLine1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); multiLine1.addGeometry( boundaryLine1.clone() ); QgsAbstractGeometry *boundary = multiLine1.boundary(); QgsMultiPoint *mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -11269,7 +11269,7 @@ void TestQgsGeometry::multiLineString() delete boundary; // add another linestring QgsLineString boundaryLine2; - boundaryLine2.setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) ); + boundaryLine2.setPoints( QVector() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) ); multiLine1.addGeometry( boundaryLine2.clone() ); boundary = multiLine1.boundary(); mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -11326,7 +11326,7 @@ void TestQgsGeometry::multiLineString() // add a closed string = no boundary QgsLineString boundaryLine3; - boundaryLine3.setPoints( QList() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 21, 21 ) << QgsPoint( 20, 20 ) ); + boundaryLine3.setPoints( QVector() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 21, 21 ) << QgsPoint( 20, 20 ) ); multiLine1.addGeometry( boundaryLine3.clone() ); boundary = multiLine1.boundary(); mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -11344,9 +11344,9 @@ void TestQgsGeometry::multiLineString() //boundary with z QgsLineString boundaryLine4; - boundaryLine4.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundaryLine4.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); QgsLineString boundaryLine5; - boundaryLine5.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 20, 20, 200 ) ); + boundaryLine5.setPoints( QVector() << 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() ); @@ -11865,7 +11865,7 @@ void TestQgsGeometry::multiCurve() QgsMultiCurve multiLine1; QVERIFY( !multiLine1.boundary() ); QgsCircularString boundaryLine1; - boundaryLine1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); + boundaryLine1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) ); multiLine1.addGeometry( boundaryLine1.clone() ); QgsAbstractGeometry *boundary = multiLine1.boundary(); QgsMultiPoint *mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -11878,7 +11878,7 @@ void TestQgsGeometry::multiCurve() delete boundary; // add another QgsCircularString QgsCircularString boundaryLine2; - boundaryLine2.setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) ); + boundaryLine2.setPoints( QVector() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) ); multiLine1.addGeometry( boundaryLine2.clone() ); boundary = multiLine1.boundary(); mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -11896,7 +11896,7 @@ void TestQgsGeometry::multiCurve() // add a closed string = no boundary QgsCircularString boundaryLine3; - boundaryLine3.setPoints( QList() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 20, 20 ) ); + boundaryLine3.setPoints( QVector() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 20, 20 ) ); multiLine1.addGeometry( boundaryLine3.clone() ); boundary = multiLine1.boundary(); mpBoundary = dynamic_cast< QgsMultiPoint * >( boundary ); @@ -11914,9 +11914,9 @@ void TestQgsGeometry::multiCurve() //boundary with z QgsCircularString boundaryLine4; - boundaryLine4.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); + boundaryLine4.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) ); QgsCircularString boundaryLine5; - boundaryLine5.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 20, 20, 200 ) ); + boundaryLine5.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 20, 20, 200 ) ); QgsMultiCurve multiLine2; multiLine2.addGeometry( boundaryLine4.clone() ); multiLine2.addGeometry( boundaryLine5.clone() ); @@ -12526,7 +12526,7 @@ void TestQgsGeometry::multiSurface() QgsMultiSurface multiSurface; QVERIFY( !multiSurface.boundary() ); QgsCircularString boundaryLine1; - boundaryLine1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 0, 0 ) ); + boundaryLine1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 0, 0 ) ); part.clear(); part.setExteriorRing( boundaryLine1.clone() ); multiSurface.addGeometry( part.clone() ); @@ -12538,7 +12538,7 @@ void TestQgsGeometry::multiSurface() delete boundary; // add another QgsCircularString QgsCircularString boundaryLine2; - boundaryLine2.setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 10, 10 ) ); + boundaryLine2.setPoints( QVector() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 10, 10 ) ); QgsCurvePolygon part2; part2.setExteriorRing( boundaryLine2.clone() ); multiSurface.addGeometry( part2.clone() ); @@ -12552,11 +12552,11 @@ void TestQgsGeometry::multiSurface() //boundary with z QgsCircularString boundaryLine4; - boundaryLine4.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) ); + boundaryLine4.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) ); part.clear(); part.setExteriorRing( boundaryLine4.clone() ); QgsCircularString boundaryLine5; - boundaryLine5.setPoints( QList() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) ); + boundaryLine5.setPoints( QVector() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) ); part2.clear(); part2.setExteriorRing( boundaryLine5.clone() ); QgsMultiSurface multiSurface2; @@ -13160,7 +13160,7 @@ void TestQgsGeometry::multiPolygon() QVERIFY( !multiPolygon1.boundary() ); QgsLineString ring1; - ring1.setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); + ring1.setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) ); QgsPolygon polygon1; polygon1.setExteriorRing( ring1.clone() ); multiPolygon1.addGeometry( polygon1.clone() ); @@ -13181,14 +13181,14 @@ void TestQgsGeometry::multiPolygon() // add polygon with interior rings QgsLineString ring2; - ring2.setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) << QgsPoint( 10, 10 ) ); + ring2.setPoints( QVector() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) << QgsPoint( 10, 10 ) ); QgsPolygon polygon2; polygon2.setExteriorRing( ring2.clone() ); QgsLineString boundaryRing1; - boundaryRing1.setPoints( QList() << QgsPoint( 10.1, 10.1 ) << QgsPoint( 10.2, 10.1 ) << QgsPoint( 10.2, 10.2 ) << QgsPoint( 10.1, 10.1 ) ); + boundaryRing1.setPoints( QVector() << 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() << 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() ); + boundaryRing2.setPoints( QVector() << QgsPoint( 10.8, 10.8 ) << QgsPoint( 10.9, 10.8 ) << QgsPoint( 10.9, 10.9 ) << QgsPoint( 10.8, 10.8 ) ); + polygon2.setInteriorRings( QVector< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() ); multiPolygon1.addGeometry( polygon2.clone() ); boundary.reset( multiPolygon1.boundary() ); @@ -14462,7 +14462,7 @@ void TestQgsGeometry::geometryCollection() QVERIFY( !boundaryCollection.boundary() ); // add a geometry and retest, should still be undefined QgsLineString *lineBoundary = new QgsLineString(); - lineBoundary->setPoints( QList() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) ); + lineBoundary->setPoints( QVector() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) ); boundaryCollection.addGeometry( lineBoundary ); QVERIFY( !boundaryCollection.boundary() ); @@ -15114,7 +15114,7 @@ void TestQgsGeometry::unaryUnion() QgsGeometry geom1( QgsGeometry::fromWkt( wkt1 ) ); QgsGeometry geom2( QgsGeometry::fromWkt( wkt2 ) ); QgsGeometry empty; - QList< QgsGeometry > list; + QVector< QgsGeometry > list; list << geom1 << empty << geom2; QgsGeometry result( QgsGeometry::unaryUnion( list ) ); @@ -15660,9 +15660,9 @@ void TestQgsGeometry::minimalEnclosingCircle() void TestQgsGeometry::splitGeometry() { QgsGeometry g1 = QgsGeometry::fromWkt( QStringLiteral( "Polygon ((492980.38648063864093274 7082334.45244149677455425, 493082.65415841294452548 7082319.87918917648494244, 492980.38648063858272508 7082334.45244149677455425, 492980.38648063864093274 7082334.45244149677455425))" ) ); - QList newGeoms; - QList testPoints; - QCOMPARE( g1.splitGeometry( QList< QgsPointXY >() << QgsPointXY( 493825.46541286131832749, 7082214.02779923938214779 ) << QgsPointXY( 492955.04876351181883365, 7082338.06309300474822521 ), + QVector newGeoms; + QVector testPoints; + QCOMPARE( g1.splitGeometry( QVector< QgsPointXY >() << QgsPointXY( 493825.46541286131832749, 7082214.02779923938214779 ) << QgsPointXY( 492955.04876351181883365, 7082338.06309300474822521 ), newGeoms, false, testPoints ), QgsGeometry::NothingHappened ); QVERIFY( newGeoms.isEmpty() ); } diff --git a/tests/src/core/testqgsgeometryutils.cpp b/tests/src/core/testqgsgeometryutils.cpp index 84121bf8638..7aa03b65185 100644 --- a/tests/src/core/testqgsgeometryutils.cpp +++ b/tests/src/core/testqgsgeometryutils.cpp @@ -60,24 +60,24 @@ class TestQgsGeometryUtils: public QObject void TestQgsGeometryUtils::testExtractLinestrings() { QgsLineString *outerRing1 = new QgsLineString(); - outerRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); + outerRing1->setPoints( QVector() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); QgsPolygon *polygon1 = new QgsPolygon(); polygon1->setExteriorRing( outerRing1 ); QgsLineString *outerRing2 = new QgsLineString(); - outerRing2->setPoints( QList() << QgsPoint( 10, 10 ) << QgsPoint( 10, 20 ) << QgsPoint( 20, 20 ) << QgsPoint( 20, 10 ) << QgsPoint( 10, 10 ) ); + outerRing2->setPoints( QVector() << QgsPoint( 10, 10 ) << QgsPoint( 10, 20 ) << QgsPoint( 20, 20 ) << QgsPoint( 20, 10 ) << QgsPoint( 10, 10 ) ); QgsPolygon *polygon2 = new QgsPolygon(); polygon2->setExteriorRing( outerRing2 ); QgsLineString *innerRing2 = new QgsLineString(); - innerRing2->setPoints( QList() << QgsPoint( 14, 14 ) << QgsPoint( 14, 16 ) << QgsPoint( 16, 16 ) << QgsPoint( 16, 14 ) << QgsPoint( 14, 14 ) ); - polygon2->setInteriorRings( QList() << innerRing2 ); + innerRing2->setPoints( QVector() << QgsPoint( 14, 14 ) << QgsPoint( 14, 16 ) << QgsPoint( 16, 16 ) << QgsPoint( 16, 14 ) << QgsPoint( 14, 14 ) ); + polygon2->setInteriorRings( QVector() << innerRing2 ); QgsMultiPolygon mpg; mpg.addGeometry( polygon1 ); mpg.addGeometry( polygon2 ); - QList linestrings = QgsGeometryUtils::extractLineStrings( &mpg ); + QVector linestrings = QgsGeometryUtils::extractLineStrings( &mpg ); QCOMPARE( linestrings.count(), 3 ); qDeleteAll( linestrings ); } @@ -345,7 +345,7 @@ void TestQgsGeometryUtils::testDistanceToVertex() { //test with linestring QgsLineString *outerRing1 = new QgsLineString(); - outerRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); + outerRing1->setPoints( QVector() << 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 ); @@ -379,7 +379,7 @@ void TestQgsGeometryUtils::testVerticesAtDistance() QgsVertexId next; QVERIFY( !QgsGeometryUtils::verticesAtDistance( *outerRing1, .5, previous, next ) ); - outerRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 3, 1 ) ); + outerRing1->setPoints( QVector() << 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 ) ); @@ -414,7 +414,7 @@ void TestQgsGeometryUtils::testVerticesAtDistance() // test closed line QgsLineString *closedRing1 = new QgsLineString(); - closedRing1->setPoints( QList() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) ); + closedRing1->setPoints( QVector() << 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 ) ); diff --git a/tests/src/providers/grass/testqgsgrassprovider.cpp b/tests/src/providers/grass/testqgsgrassprovider.cpp index 26f41272112..40592e5334d 100644 --- a/tests/src/providers/grass/testqgsgrassprovider.cpp +++ b/tests/src/providers/grass/testqgsgrassprovider.cpp @@ -910,7 +910,7 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands() TestQgsGrassFeature grassFeature; QgsLineString *line = nullptr; QgsGeometry *geometry = nullptr; - QList pointList; + QVector pointList; // Start editing command = TestQgsGrassCommand( TestQgsGrassCommand::StartEditing );