Use QVector where possible in geometry classes

This commit is contained in:
Nyall Dawson 2017-11-14 16:07:39 +10:00
parent 507a93c69b
commit 5d476e51df
77 changed files with 336 additions and 350 deletions

View File

@ -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
{

View File

@ -100,7 +100,7 @@ class QgsCurvePolygon: QgsSurface
.. seealso:: exteriorRing()
%End
void setInteriorRings( const QList<QgsCurve *> &rings /Transfer/ );
void setInteriorRings( const QVector<QgsCurve *> &rings /Transfer/ );
%Docstring
Sets all interior rings (takes ownership)
%End

View File

@ -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<QgsGeometry> &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<QgsPointXY> &ring );
OperationResult addRing( const QVector<QgsPointXY> &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<QgsPointXY> &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) /PyName=addPointsXY/;
OperationResult addPart( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, QList<QgsGeometry> &newGeometries /Out/, bool topological, QList<QgsPointXY> &topologyTestPoints /Out/ );
OperationResult splitGeometry( const QVector<QgsPointXY> &splitLine, QVector<QgsGeometry> &newGeometries /Out/, bool topological, QVector<QgsPointXY> &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<QgsGeometry> asGeometryCollection() const;
QVector<QgsGeometry> 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<QgsGeometry::Error> &errors /Out/, ValidationMethod method = ValidatorQgisInternal ) const;
void validateGeometry( QVector<QgsGeometry::Error> &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<QgsGeometry> &geometries );
static QgsGeometry unaryUnion( const QVector<QgsGeometry> &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<QgsGeometry> &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<QgsPointXY> &input, QgsPointSequence &output );
static void convertPointList( const QVector<QgsPointXY> &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<QgsPointXY> &output );
static void convertPointList( const QgsPointSequence &input, QVector<QgsPointXY> &output );
%Docstring
Downgrades a point list from QgsPoint to QgsPointXY
\param input list of QgsPoint objects to be downgraded

View File

@ -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<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
bool fromCollectionWkt( const QString &wkt, const QVector<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
%Docstring
Reads a collection from a WKT string.
:rtype: bool

View File

@ -77,7 +77,7 @@ class QgsGeometryEngine
:rtype: QgsAbstractGeometry
%End
virtual QgsAbstractGeometry *combine( const QList<QgsAbstractGeometry *> &geomList, QString *errorMsg ) const = 0 /Factory/;
virtual QgsAbstractGeometry *combine( const QVector<QgsAbstractGeometry *> &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<QgsGeometry > &newGeometries /Out/,
QVector<QgsGeometry > &newGeometries /Out/,
bool topological,
QgsPointSequence &topologyTestPoints, QString *errorMsg = 0 ) const;
%Docstring

View File

@ -23,7 +23,7 @@ class QgsGeometryUtils
%End
public:
static QList<QgsLineString *> extractLineStrings( const QgsAbstractGeometry *geom ) /Factory/;
static QVector<QgsLineString *> 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<QgsPoint> &points /Out/, double tolerance = M_PI_2 / 90,
QVector<QgsPoint> &points /Out/, double tolerance = M_PI_2 / 90,
QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle,
bool hasZ = false, bool hasM = false );
%Docstring

View File

@ -45,7 +45,7 @@ class QgsLineString: QgsCurve
.. versionadded:: 3.0
%End
QgsLineString( const QList<QgsPointXY> &points );
QgsLineString( const QVector<QgsPointXY> &points );
%Docstring
Construct a linestring from list of points.
This constructor is more efficient then calling setPoints()

View File

@ -164,7 +164,7 @@ A regular polygon is empty if radius equal to 0 or number of sides < 3
:rtype: QgsTriangle
%End
QList<QgsTriangle> triangulate() const;
QVector<QgsTriangle> 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.

View File

@ -160,7 +160,7 @@ Constructor
:rtype: float
%End
double measureLine( const QList<QgsPointXY> &points ) const;
double measureLine( const QVector<QgsPointXY> &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<QgsPointXY> &points ) const;
double measurePolygon( const QVector<QgsPointXY> &points ) const;
%Docstring
Measures the area of the polygon described by a set of points.
:rtype: float

View File

@ -16,7 +16,7 @@ class QgsGeometryValidator : QThread
%End
public:
QgsGeometryValidator( const QgsGeometry &geoemtry, QList<QgsGeometry::Error> *errors = 0, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );
QgsGeometryValidator( const QgsGeometry &geoemtry, QVector<QgsGeometry::Error> *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<QgsGeometry::Error> &errors /Out/, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );
static void validateGeometry( const QgsGeometry &geometry, QVector<QgsGeometry::Error> &errors /Out/, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );
%Docstring
Validate geometry and produce a list of geometry errors
%End

View File

@ -1043,7 +1043,7 @@ Return the provider type for this layer
:rtype: bool
%End
int addRing( const QList<QgsPointXY> &ring, QgsFeatureId *featureId = 0 );
int addRing( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
int splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
%Docstring
:rtype: int
%End
int splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing = false );
int splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
%Docstring
:rtype: int
%End

View File

@ -62,7 +62,7 @@ class QgsVectorLayerEditUtils
:rtype: QgsVectorLayer.EditResult
%End
QgsGeometry::OperationResult addRing( const QList<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = 0 );
QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
%Docstring
Splits features cut by the given line
\param splitLine line that splits the layer features

View File

@ -151,14 +151,14 @@ Removes the last vertex from mRubberBand and mCaptureList
:rtype: int
%End
QList<QgsPointXY> points();
QVector<QgsPointXY> points();
%Docstring
List of digitized points
:return: List of points
:rtype: list of QgsPointXY
%End
void setPoints( const QList<QgsPointXY> &pointList );
void setPoints( const QVector<QgsPointXY> &pointList );
%Docstring
Set the points on which to work

View File

@ -69,7 +69,7 @@ Returns the current vector layer of the map canvas or 0
:rtype: QgsVectorLayer
%End
int addTopologicalPoints( const QList<QgsPointXY> &geom );
int addTopologicalPoints( const QVector<QgsPointXY> &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)

View File

@ -96,7 +96,7 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap &parameters,
double step = count > 0 ? 100.0 / count : 1;
int current = 0;
QList< QgsGeometry > bufferedGeometriesForDissolve;
QVector< QgsGeometry > bufferedGeometriesForDissolve;
QgsAttributes dissolveAttrs;
while ( it.nextFeature( f ) )

View File

@ -79,7 +79,7 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap &parameters, 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 ) )

View File

@ -24,7 +24,7 @@
//
QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback,
const std::function<QgsGeometry( const QList< QgsGeometry >& )> &collector, int maxQueueLength )
const std::function<QgsGeometry( const QVector< QgsGeometry >& )> &collector, int maxQueueLength )
{
std::unique_ptr< QgsFeatureSource > source( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) );
if ( !source )
@ -51,7 +51,7 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &paramet
// 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 &paramet
}
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 &parameters, 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 &parameters, 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 );
} );

View File

@ -33,7 +33,7 @@ class QgsCollectorAlgorithm : public QgsProcessingAlgorithm
protected:
QVariantMap processCollection( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback,
const std::function<QgsGeometry( const QList<QgsGeometry>& )> &collector, int maxQueueLength = 0 );
const std::function<QgsGeometry( const QVector<QgsGeometry>& )> &collector, int maxQueueLength = 0 );
};
/**

View File

@ -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() )

View File

@ -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<QgsPointXY> splitterPList;
QList< QgsGeometry > outGeoms;
QVector<QgsPointXY> 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<QgsPointXY> topologyTestPoints;
QVector< QgsGeometry > newGeometries;
QVector<QgsPointXY> 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() )

View File

@ -22,7 +22,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError *> &errors,
{
if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
QList<QgsAbstractGeometry *> geomList;
QVector<QgsAbstractGeometry *> geomList;
QMap<QString, QgsFeatureIds> featureIds = ids.isEmpty() ? allLayerFeatureIds() : ids;
QgsGeometryCheckerUtils::LayerFeatures layerFeatures( mContext->featurePools, featureIds, mCompatibleGeometryTypes, 0, true );

View File

@ -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
{

View File

@ -149,14 +149,14 @@ void QgsMeasureDialog::mouseMove( const QgsPointXY &point )
// and adding moving point at the end
if ( mMeasureArea && mTool->points().size() >= 2 )
{
QList<QgsPointXY> tmpPoints = mTool->points();
QVector<QgsPointXY> 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<QgsPointXY> tmpPoints = mTool->points();
QVector<QgsPointXY> 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<QgsPointXY>::const_iterator it;
QVector<QgsPointXY>::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;

View File

@ -63,7 +63,7 @@ QgsMeasureTool::~QgsMeasureTool()
}
QList<QgsPointXY> QgsMeasureTool::points()
QVector<QgsPointXY> 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<QgsPointXY> points = mPoints;
QVector<QgsPointXY> points = mPoints;
bool lastDone = mDone;
mDialog->restart();

View File

@ -52,7 +52,7 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool
void addPoint( const QgsPointXY &point );
//! Returns reference to array of the points
QList<QgsPointXY> points();
QVector<QgsPointXY> points();
// Inherited from QgsMapTool
@ -79,7 +79,7 @@ class APP_EXPORT QgsMeasureTool : public QgsMapTool
protected:
QList<QgsPointXY> mPoints;
QVector<QgsPointXY> mPoints;
QgsMeasureDialog *mDialog = nullptr;

View File

@ -2391,10 +2391,10 @@ QList<QPolygonF> QgsComposerMapGrid::trimLinesToMap( const QPolygonF &line, cons
QgsGeometry rectGeom = QgsGeometry::fromRect( rect );
QgsGeometry intersected = lineGeom.intersection( rectGeom );
QList<QgsGeometry> intersectedParts = intersected.asGeometryCollection();
QVector<QgsGeometry> intersectedParts = intersected.asGeometryCollection();
QList<QPolygonF> trimmedLines;
QList<QgsGeometry>::const_iterator geomIt = intersectedParts.constBegin();
QVector<QgsGeometry>::const_iterator geomIt = intersectedParts.constBegin();
for ( ; geomIt != intersectedParts.constEnd(); ++geomIt )
{
trimmedLines << ( *geomIt ).asQPolygonF();

View File

@ -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();

View File

@ -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
/**

View File

@ -225,7 +225,7 @@ bool QgsCompoundCurve::fromWkt( const QString &wkt )
QByteArray QgsCompoundCurve::asWkb() const
{
int binarySize = sizeof( char ) + sizeof( quint32 ) + sizeof( quint32 );
QList<QByteArray> wkbForCurves;
QVector<QByteArray> 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<int, QgsVertexId> > curveIds = curveVertexId( position );
QVector< QPair<int, QgsVertexId> > 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<int, QgsVertexId> > curveIds = curveVertexId( position );
QList< QPair<int, QgsVertexId> >::const_iterator idIt = curveIds.constBegin();
QVector< QPair<int, QgsVertexId> > curveIds = curveVertexId( position );
QVector< QPair<int, QgsVertexId> >::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<int, QgsVertexId> > curveIds = curveVertexId( position );
QVector< QPair<int, QgsVertexId> > 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<int, QgsVertexId> > QgsCompoundCurve::curveVertexId( QgsVertexId id ) const
QVector< QPair<int, QgsVertexId> > QgsCompoundCurve::curveVertexId( QgsVertexId id ) const
{
QList< QPair<int, QgsVertexId> > curveIds;
QVector< QPair<int, QgsVertexId> > 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<int, QgsVertexId> > curveIds = curveVertexId( vertex );
QVector< QPair<int, QgsVertexId> > curveIds = curveVertexId( vertex );
if ( curveIds.size() == 1 )
{
QgsCurve *curve = mCurves[curveIds.at( 0 ).first];

View File

@ -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<int, QgsVertexId> > curveVertexId( QgsVertexId id ) const;
QVector< QPair<int, QgsVertexId> > curveVertexId( QgsVertexId id ) const;
};

View File

@ -277,7 +277,7 @@ QgsRectangle QgsCurvePolygon::calculateBoundingBox() const
QByteArray QgsCurvePolygon::asWkb() const
{
int binarySize = sizeof( char ) + sizeof( quint32 ) + sizeof( quint32 );
QList<QByteArray> wkbForRings;
QVector<QByteArray> wkbForRings;
if ( mExteriorRing )
{
QByteArray wkb( mExteriorRing->asWkb() );
@ -434,13 +434,12 @@ double QgsCurvePolygon::area() const
totalArea += std::fabs( area );
}
QList<QgsCurve *>::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<QgsCurve *>::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<QgsCurve *> interiors;
QVector<QgsCurve *> 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<QgsCurve *> rings;
QList<QgsCurve *>::const_iterator it = mInteriorRings.constBegin();
for ( ; it != mInteriorRings.constEnd(); ++it )
QVector<QgsCurve *> 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<QgsCurve *> &rings )
void QgsCurvePolygon::setInteriorRings( const QVector<QgsCurve *> &rings )
{
qDeleteAll( mInteriorRings );
mInteriorRings.clear();
@ -685,10 +682,9 @@ void QgsCurvePolygon::draw( QPainter &p ) const
QPainterPath path;
mExteriorRing->addToPainterPath( path );
QList<QgsCurve *>::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<QgsCurve *>::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<QgsCurve *>::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<QgsCurve *> segmentList;
QVector<QgsCurve *> 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<QgsCurve *>::const_iterator it = mInteriorRings.constBegin();
for ( ; it != mInteriorRings.constEnd(); ++it )
for ( const QgsCurve *ring : mInteriorRings )
{
if ( ( *it )->hasCurvedSegments() )
if ( ring->hasCurvedSegments() )
{
return true;
}

View File

@ -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<QgsCurve *> &rings SIP_TRANSFER );
void setInteriorRings( const QVector<QgsCurve *> &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<QgsCurve *> mInteriorRings;
QVector<QgsCurve *> mInteriorRings;
QgsRectangle calculateBoundingBox() const override;
};

View File

@ -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<QgsPointXY> &ring )
QgsGeometry::OperationResult QgsGeometry::addRing( const QVector<QgsPointXY> &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<QgsPointXY> &points, QgsWkbTypes::GeometryType geomType )
QgsGeometry::OperationResult QgsGeometry::addPart( const QVector<QgsPointXY> &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<QgsGeometry> parts = asGeometryCollection();
QList<QgsGeometry> results;
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> 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<QgsPointXY> &splitLine, QList<QgsGeometry> &newGeometries, bool topological, QList<QgsPointXY> &topologyTestPoints )
QgsGeometry::OperationResult QgsGeometry::splitGeometry( const QVector<QgsPointXY> &splitLine, QVector<QgsGeometry> &newGeometries, bool topological, QVector<QgsPointXY> &topologyTestPoints )
{
if ( !d->geometry )
{
return InvalidBaseGeometry;
}
QList<QgsGeometry > newGeoms;
QVector<QgsGeometry > 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<QgsGeometry> parts = asGeometryCollection();
QList<QgsGeometry> results;
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> 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<QgsGeometry> parts = asGeometryCollection();
QList<QgsGeometry> results;
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> 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<QgsGeometry> parts = asGeometryCollection();
QList<QgsGeometry> results;
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> 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> QgsGeometry::asGeometryCollection() const
QVector<QgsGeometry> QgsGeometry::asGeometryCollection() const
{
QList<QgsGeometry> geometryList;
QVector<QgsGeometry> geometryList;
if ( !d->geometry )
{
return geometryList;
@ -2206,7 +2206,7 @@ QgsGeometry QgsGeometry::makeValid() const
}
void QgsGeometry::validateGeometry( QList<QgsGeometry::Error> &errors, ValidationMethod method ) const
void QgsGeometry::validateGeometry( QVector<QgsGeometry::Error> &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<QgsGeometry> &geometries )
QgsGeometry QgsGeometry::unaryUnion( const QVector<QgsGeometry> &geometries )
{
QgsGeos geos( nullptr );
@ -2256,11 +2256,11 @@ QgsGeometry QgsGeometry::unaryUnion( const QList<QgsGeometry> &geometries )
return result;
}
QgsGeometry QgsGeometry::polygonize( const QList<QgsGeometry> &geometryList )
QgsGeometry QgsGeometry::polygonize( const QVector<QgsGeometry> &geometryList )
{
QgsGeos geos( nullptr );
QList<const QgsAbstractGeometry *> geomV2List;
QVector<const QgsAbstractGeometry *> geomV2List;
for ( const QgsGeometry &g : geometryList )
{
if ( !( g.isNull() ) )
@ -2483,7 +2483,7 @@ QString QgsGeometry::lastError() const
return mLastError;
}
void QgsGeometry::convertPointList( const QList<QgsPointXY> &input, QgsPointSequence &output )
void QgsGeometry::convertPointList( const QVector<QgsPointXY> &input, QgsPointSequence &output )
{
output.clear();
for ( const QgsPointXY &p : input )
@ -2492,7 +2492,7 @@ void QgsGeometry::convertPointList( const QList<QgsPointXY> &input, QgsPointSequ
}
}
void QgsGeometry::convertPointList( const QgsPointSequence &input, QList<QgsPointXY> &output )
void QgsGeometry::convertPointList( const QgsPointSequence &input, QVector<QgsPointXY> &output )
{
output.clear();
for ( const QgsPoint &p : input )

View File

@ -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<QgsGeometry> &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<QgsPointXY> &ring );
OperationResult addRing( const QVector<QgsPointXY> &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<QgsPointXY> &points, QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry ) SIP_PYNAME( addPointsXY );
OperationResult addPart( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, QList<QgsGeometry> &newGeometries SIP_OUT, bool topological, QList<QgsPointXY> &topologyTestPoints SIP_OUT );
OperationResult splitGeometry( const QVector<QgsPointXY> &splitLine, QVector<QgsGeometry> &newGeometries SIP_OUT, bool topological, QVector<QgsPointXY> &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<QgsGeometry> asGeometryCollection() const;
QVector<QgsGeometry> 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<QgsGeometry::Error> &errors SIP_OUT, ValidationMethod method = ValidatorQgisInternal ) const;
void validateGeometry( QVector<QgsGeometry::Error> &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<QgsGeometry> &geometries );
static QgsGeometry unaryUnion( const QVector<QgsGeometry> &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<QgsGeometry> &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<QgsPointXY> &input, QgsPointSequence &output );
static void convertPointList( const QVector<QgsPointXY> &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<QgsPointXY> &output );
static void convertPointList( const QgsPointSequence &input, QVector<QgsPointXY> &output );
//! Allows direct construction of QVariants from geometry.
operator QVariant() const

View File

@ -299,7 +299,7 @@ bool QgsGeometryCollection::fromWkb( QgsConstWkbPtr &wkbPtr )
bool QgsGeometryCollection::fromWkt( const QString &wkt )
{
return fromCollectionWkt( wkt, QList<QgsAbstractGeometry *>() << new QgsPoint << new QgsLineString << new QgsPolygon
return fromCollectionWkt( wkt, QVector<QgsAbstractGeometry *>() << 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<QByteArray> wkbForGeometries;
QVector<QByteArray> 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<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType )
bool QgsGeometryCollection::fromCollectionWkt( const QString &wkt, const QVector<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType )
{
clear();

View File

@ -177,7 +177,7 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry
/**
* Reads a collection from a WKT string.
*/
bool fromCollectionWkt( const QString &wkt, const QList<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
bool fromCollectionWkt( const QString &wkt, const QVector<QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType = QString() );
QgsRectangle calculateBoundingBox() const override;
void clearCache() const override;

View File

@ -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<QgsAbstractGeometry> 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 )

View File

@ -20,7 +20,7 @@ email : marco.hugentobler at sourcepole dot com
#include "qgslinestring.h"
#include "qgsgeometry.h"
#include <QList>
#include <QVector>
class QgsAbstractGeometry;
@ -96,14 +96,14 @@ class CORE_EXPORT QgsGeometryEngine
*
* \since QGIS 3.0 \a geom is a pointer
*/
virtual QgsAbstractGeometry *combine( const QList<QgsAbstractGeometry *> &geomList, QString *errorMsg ) const = 0 SIP_FACTORY;
virtual QgsAbstractGeometry *combine( const QVector<QgsAbstractGeometry *> &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<QgsGeometry > &newGeometries SIP_OUT,
QVector<QgsGeometry > &newGeometries SIP_OUT,
bool topological,
QgsPointSequence &topologyTestPoints, QString *errorMsg = nullptr ) const
{

View File

@ -168,7 +168,7 @@ std::unique_ptr<QgsPolygon> QgsGeometryFactory::fromPolygonXY( const QgsPolygonX
{
std::unique_ptr< QgsPolygon > poly = qgis::make_unique< QgsPolygon >();
QList<QgsCurve *> holes;
QVector<QgsCurve *> holes;
for ( int i = 0; i < polygon.size(); ++i )
{
std::unique_ptr< QgsLineString > l = linestringFromPolyline( polygon.at( i ) );

View File

@ -27,13 +27,13 @@ email : marco.hugentobler at sourcepole dot com
#include <QVector>
#include <QRegularExpression>
QList<QgsLineString *> QgsGeometryUtils::extractLineStrings( const QgsAbstractGeometry *geom )
QVector<QgsLineString *> 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::SelfIntersection> QgsGeometryUtils::getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance )
QVector<QgsGeometryUtils::SelfIntersection> QgsGeometryUtils::getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance )
{
QList<SelfIntersection> intersections;
QVector<SelfIntersection> 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<QgsPoint> stringPoints;
QVector<QgsPoint> stringPoints;
stringPoints.insert( 0, circlePoint1 );
if ( circlePoint2 != circlePoint3 && circlePoint1 != circlePoint2 ) //draw straight line segment if two points have the same position
{

View File

@ -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<QgsLineString *> extractLineStrings( const QgsAbstractGeometry *geom ) SIP_FACTORY;
static QVector<QgsLineString *> 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<SelfIntersection> getSelfIntersections( const QgsAbstractGeometry *geom, int part, int ring, double tolerance ) SIP_SKIP;
static QVector<SelfIntersection> 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<QgsPoint> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
QgsPointSequence SIP_PYALTERNATIVETYPE( QVector<QgsPoint> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle,
bool hasZ = false, bool hasM = false );

View File

@ -308,7 +308,7 @@ QgsAbstractGeometry *QgsGeos::combine( const QgsAbstractGeometry *geom, QString
return overlay( geom, OverlayUnion, errorMsg ).release();
}
QgsAbstractGeometry *QgsGeos::combine( const QList<QgsAbstractGeometry *> &geomList, QString *errorMsg ) const
QgsAbstractGeometry *QgsGeos::combine( const QVector<QgsAbstractGeometry *> &geomList, QString *errorMsg ) const
{
QVector< GEOSGeometry * > geosGeometries;
geosGeometries.reserve( geomList.size() );
@ -332,7 +332,7 @@ QgsAbstractGeometry *QgsGeos::combine( const QList<QgsAbstractGeometry *> &geomL
return result.release();
}
QgsAbstractGeometry *QgsGeos::combine( const QList<QgsGeometry> &geomList, QString *errorMsg ) const
QgsAbstractGeometry *QgsGeos::combine( const QVector<QgsGeometry> &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<QgsGeometry> &newGeometries,
QVector<QgsGeometry> &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<QgsGeometry> &newGeometries ) const
QgsGeometryEngine::EngineOperationResult QgsGeos::splitLinearGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry> &newGeometries ) const
{
if ( !splitLine )
return InvalidInput;
@ -817,7 +817,7 @@ QgsGeometryEngine::EngineOperationResult QgsGeos::splitLinearGeometry( GEOSGeome
return Success;
}
QgsGeometryEngine::EngineOperationResult QgsGeos::splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry> &newGeometries ) const
QgsGeometryEngine::EngineOperationResult QgsGeos::splitPolygonGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry> &newGeometries ) const
{
if ( !splitLine )
return InvalidInput;
@ -1129,7 +1129,7 @@ std::unique_ptr<QgsPolygon> QgsGeos::fromGeosPolygon( const GEOSGeometry *geos )
polygon->setExteriorRing( sequenceToLinestring( ring, hasZ, hasM ).release() );
}
QList<QgsCurve *> interiorRings;
QVector<QgsCurve *> 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<const QgsAbstractGeometry *> &geometries, QString *errorMsg )
QgsGeometry QgsGeos::polygonize( const QVector<const QgsAbstractGeometry *> &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<GEOSGeometry *> resultLineParts; //collection with the line segments that will be contained in result
QList<GEOSGeometry *> probableParts; //parts where we can decide on inclusion only after going through all the candidates
QVector<GEOSGeometry *> resultLineParts; //collection with the line segments that will be contained in result
QVector<GEOSGeometry *> 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<GEOSGeometry *> ringList;
QVector<GEOSGeometry *> ringList;
if ( nRings > 0 )
{
GEOSGeometry *outerRingPoly = GEOSGeom_createPolygon_r( geosinit.ctxt, GEOSGeom_clone_r( geosinit.ctxt, newOuterRing ), nullptr, 0 );

View File

@ -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<QgsAbstractGeometry *> &geomList, QString *errorMsg ) const override;
QgsAbstractGeometry *combine( const QList< QgsGeometry > &, QString *errorMsg = nullptr ) const override;
QgsAbstractGeometry *combine( const QVector<QgsAbstractGeometry *> &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<QgsGeometry> &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<const QgsAbstractGeometry *> &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<QgsGeometry > &newGeometries ) const;
EngineOperationResult splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry > &newGeometries ) const;
EngineOperationResult splitLinearGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry > &newGeometries ) const;
EngineOperationResult splitPolygonGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry > &newGeometries ) const;
//utils for reshape
static geos::unique_ptr reshapeLine( const GEOSGeometry *line, const GEOSGeometry *reshapeLineGeos, double precision );

View File

@ -42,7 +42,7 @@ QgsInternalGeometryEngine::QgsInternalGeometryEngine( const QgsGeometry &geometr
QgsGeometry QgsInternalGeometryEngine::extrude( double x, double y ) const
{
QList<QgsLineString *> linesToProcess;
QVector<QgsLineString *> 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 )
{

View File

@ -124,7 +124,7 @@ QgsLineString::QgsLineString( const QVector<double> &x, const QVector<double> &y
}
}
QgsLineString::QgsLineString( const QList<QgsPointXY> &points )
QgsLineString::QgsLineString( const QVector<QgsPointXY> &points )
{
mWkbType = QgsWkbTypes::LineString;
mX.reserve( points.size() );

View File

@ -69,7 +69,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve
* or repeatedly calling addVertex()
* \since QGIS 3.0
*/
QgsLineString( const QList<QgsPointXY> &points );
QgsLineString( const QVector<QgsPointXY> &points );
bool operator==( const QgsCurve &other ) const override;
bool operator!=( const QgsCurve &other ) const override;

View File

@ -59,7 +59,7 @@ QgsMultiCurve *QgsMultiCurve::toCurveType() const
bool QgsMultiCurve::fromWkt( const QString &wkt )
{
return fromCollectionWkt( wkt,
QList<QgsAbstractGeometry *>() << new QgsLineString << new QgsCircularString << new QgsCompoundCurve,
QVector<QgsAbstractGeometry *>() << new QgsLineString << new QgsCircularString << new QgsCompoundCurve,
QStringLiteral( "LineString" ) );
}

View File

@ -52,7 +52,7 @@ void QgsMultiLineString::clear()
bool QgsMultiLineString::fromWkt( const QString &wkt )
{
return fromCollectionWkt( wkt, QList<QgsAbstractGeometry *>() << new QgsLineString, QStringLiteral( "LineString" ) );
return fromCollectionWkt( wkt, QVector<QgsAbstractGeometry *>() << new QgsLineString, QStringLiteral( "LineString" ) );
}
QDomElement QgsMultiLineString::asGML2( QDomDocument &doc, int precision, const QString &ns ) const

View File

@ -58,7 +58,7 @@ bool QgsMultiPoint::fromWkt( const QString &wkt )
collectionWkt.replace( '(', QLatin1String( "((" ) ).replace( ')', QLatin1String( "))" ) ).replace( ',', QLatin1String( "),(" ) );
}
return fromCollectionWkt( collectionWkt, QList<QgsAbstractGeometry *>() << new QgsPoint, QStringLiteral( "Point" ) );
return fromCollectionWkt( collectionWkt, QVector<QgsAbstractGeometry *>() << new QgsPoint, QStringLiteral( "Point" ) );
}
void QgsMultiPoint::clear()

View File

@ -52,7 +52,7 @@ QgsMultiPolygon *QgsMultiPolygon::clone() const
bool QgsMultiPolygon::fromWkt( const QString &wkt )
{
return fromCollectionWkt( wkt, QList<QgsAbstractGeometry *>() << new QgsPolygon, QStringLiteral( "Polygon" ) );
return fromCollectionWkt( wkt, QVector<QgsAbstractGeometry *>() << new QgsPolygon, QStringLiteral( "Polygon" ) );
}
QDomElement QgsMultiPolygon::asGML2( QDomDocument &doc, int precision, const QString &ns ) const

View File

@ -59,7 +59,7 @@ QgsMultiSurface *QgsMultiSurface::toCurveType() const
bool QgsMultiSurface::fromWkt( const QString &wkt )
{
return fromCollectionWkt( wkt,
QList<QgsAbstractGeometry *>() << new QgsPolygon << new QgsCurvePolygon,
QVector<QgsAbstractGeometry *>() << new QgsPolygon << new QgsCurvePolygon,
QStringLiteral( "Polygon" ) );
}

View File

@ -221,9 +221,9 @@ QgsTriangle QgsRegularPolygon::toTriangle() const
return QgsTriangle( pts.at( 0 ), pts.at( 1 ), pts.at( 2 ) );
}
QList<QgsTriangle> QgsRegularPolygon::triangulate() const
QVector<QgsTriangle> QgsRegularPolygon::triangulate() const
{
QList<QgsTriangle> l_tri;
QVector<QgsTriangle> l_tri;
if ( isEmpty() )
{
return l_tri;

View File

@ -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<QgsTriangle> triangulate() const;
QVector<QgsTriangle> triangulate() const;
/**
* Returns the inscribed circle

View File

@ -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.

View File

@ -2335,10 +2335,10 @@ QList<QPolygonF> QgsLayoutItemMapGrid::trimLinesToMap( const QPolygonF &line, co
QgsGeometry rectGeom = QgsGeometry::fromRect( rect );
QgsGeometry intersected = lineGeom.intersection( rectGeom );
QList<QgsGeometry> intersectedParts = intersected.asGeometryCollection();
QVector<QgsGeometry> intersectedParts = intersected.asGeometryCollection();
QList<QPolygonF> trimmedLines;
QList<QgsGeometry>::const_iterator geomIt = intersectedParts.constBegin();
QVector<QgsGeometry>::const_iterator geomIt = intersectedParts.constBegin();
for ( ; geomIt != intersectedParts.constEnd(); ++geomIt )
{
trimmedLines << ( *geomIt ).asQPolygonF();

View File

@ -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 );

View File

@ -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<const QgsSurface *>( geomV2 );
if ( surf )
{
@ -227,7 +227,7 @@ double QgsDistanceArea::measurePerimeter( const QgsGeometry &geometry ) const
}
double length = 0;
QList<const QgsSurface *>::const_iterator surfaceIt = surfaces.constBegin();
QVector<const QgsSurface *>::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<QgsPointXY> linePoints;
QVector<QgsPointXY> linePoints;
curve->points( linePointsV2 );
QgsGeometry::convertPointList( linePointsV2, linePoints );
return measureLine( linePoints );
}
double QgsDistanceArea::measureLine( const QList<QgsPointXY> &points ) const
double QgsDistanceArea::measureLine( const QVector<QgsPointXY> &points ) const
{
if ( points.size() < 2 )
return 0;
@ -280,7 +280,7 @@ double QgsDistanceArea::measureLine( const QList<QgsPointXY> &points ) const
else
p1 = points[0];
for ( QList<QgsPointXY>::const_iterator i = points.begin(); i != points.end(); ++i )
for ( QVector<QgsPointXY>::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<QgsPointXY> linePoints;
QVector<QgsPointXY> linePoints;
QgsGeometry::convertPointList( linePointsV2, linePoints );
return measurePolygon( linePoints );
}
double QgsDistanceArea::measurePolygon( const QList<QgsPointXY> &points ) const
double QgsDistanceArea::measurePolygon( const QVector<QgsPointXY> &points ) const
{
try
{
if ( willUseEllipsoid() )
{
QList<QgsPointXY> pts;
for ( QList<QgsPointXY>::const_iterator i = points.begin(); i != points.end(); ++i )
QVector<QgsPointXY> pts;
for ( QVector<QgsPointXY>::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<QgsPointXY> &points ) const
double QgsDistanceArea::computePolygonArea( const QVector<QgsPointXY> &points ) const
{
if ( points.isEmpty() )
{
@ -774,7 +774,7 @@ double QgsDistanceArea::computePolygonArea( const QList<QgsPointXY> &points ) co
return area;
}
double QgsDistanceArea::computePolygonFlatArea( const QList<QgsPointXY> &points ) const
double QgsDistanceArea::computePolygonFlatArea( const QVector<QgsPointXY> &points ) const
{
// Normal plane area calculations.
double area = 0.0;

View File

@ -17,7 +17,7 @@
#define QGSDISTANCEAREA_H
#include "qgis_core.h"
#include <QList>
#include <QVector>
#include <QReadWriteLock>
#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<QgsPointXY> &points ) const;
double measureLine( const QVector<QgsPointXY> &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<QgsPointXY> &points ) const;
double measurePolygon( const QVector<QgsPointXY> &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<QgsPointXY> &points ) const;
double computePolygonArea( const QVector<QgsPointXY> &points ) const;
double computePolygonFlatArea( const QList<QgsPointXY> &points ) const;
double computePolygonFlatArea( const QVector<QgsPointXY> &points ) const;
/**
* Precalculates some values

View File

@ -19,7 +19,7 @@ email : jef at norbit dot de
#include "qgslogger.h"
#include "qgsgeos.h"
QgsGeometryValidator::QgsGeometryValidator( const QgsGeometry &geometry, QList<QgsGeometry::Error> *errors, QgsGeometry::ValidationMethod method )
QgsGeometryValidator::QgsGeometryValidator( const QgsGeometry &geometry, QVector<QgsGeometry::Error> *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<QgsGeometry::Error> &errors, QgsGeometry::ValidationMethod method )
void QgsGeometryValidator::validateGeometry( const QgsGeometry &geometry, QVector<QgsGeometry::Error> &errors, QgsGeometry::ValidationMethod method )
{
QgsGeometryValidator *gv = new QgsGeometryValidator( geometry, &errors, method );
connect( gv, &QgsGeometryValidator::errorFound, gv, &QgsGeometryValidator::addError );

View File

@ -34,14 +34,14 @@ class CORE_EXPORT QgsGeometryValidator : public QThread
/**
* Constructor for QgsGeometryValidator.
*/
QgsGeometryValidator( const QgsGeometry &geoemtry, QList<QgsGeometry::Error> *errors = nullptr, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );
QgsGeometryValidator( const QgsGeometry &geoemtry, QVector<QgsGeometry::Error> *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<QgsGeometry::Error> &errors SIP_OUT, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );
static void validateGeometry( const QgsGeometry &geometry, QVector<QgsGeometry::Error> &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<QgsGeometry::Error> *mErrors;
QVector<QgsGeometry::Error> *mErrors;
bool mStop;
int mErrorCount;
QgsGeometry::ValidationMethod mMethod = QgsGeometry::ValidatorQgisInternal;

View File

@ -101,7 +101,7 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPointXY
QSet<QgsPointXY> endpoints;
// make a geometry
QList<QgsGeometry> geoms;
QVector<QgsGeometry> geoms;
Q_FOREACH ( const QgsPointLocator::Match &m, segments )
{
if ( m.hasEdge() )

View File

@ -713,7 +713,7 @@ QVector<QgsPointXY> QgsTracer::findShortestPath( const QgsPointXY &p1, const Qgs
if ( !points.isEmpty() && mOffset != 0 )
{
QList<QgsPointXY> pointsInput( points.toList() );
QVector<QgsPointXY> pointsInput( points );
QgsLineString linestring( pointsInput );
std::unique_ptr<QgsGeometryEngine> linestringEngine( QgsGeometry::createGeometryEngine( &linestring ) );
std::unique_ptr<QgsAbstractGeometry> linestringOffset( linestringEngine->offsetCurve( mOffset, mOffsetSegments, mOffsetJoinStyle, mOffsetMiterLimit ) );

View File

@ -1116,7 +1116,7 @@ bool QgsVectorLayer::deleteSelectedFeatures( int *deletedCount )
return deleted == count;
}
int QgsVectorLayer::addRing( const QList<QgsPointXY> &ring, QgsFeatureId *featureId )
int QgsVectorLayer::addRing( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing )
int QgsVectorLayer::splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing )
{
if ( !mValid || !mEditBuffer || !mDataProvider )
return -1;
@ -1277,7 +1277,7 @@ int QgsVectorLayer::splitParts( const QList<QgsPointXY> &splitLine, bool topolog
return utils.splitParts( splitLine, topologicalEditing );
}
int QgsVectorLayer::splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing )
int QgsVectorLayer::splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing )
{
if ( !mValid || !mEditBuffer || !mDataProvider )
return -1;

View File

@ -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<QgsPointXY> &ring, QgsFeatureId *featureId = nullptr );
int addRing( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
int splitParts( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
int splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing = false );
/**
* Adds topological points for every vertex of the geometry.

View File

@ -115,7 +115,7 @@ QgsVectorLayer::EditResult QgsVectorLayerEditUtils::deleteVertex( QgsFeatureId f
return !geometry.isNull() ? QgsVectorLayer::Success : QgsVectorLayer::EmptyGeometry;
}
QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing( const QList<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId )
QgsGeometry::OperationResult QgsVectorLayerEditUtils::addRing( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing )
QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QVector<QgsPointXY> &splitLine, bool topologicalEditing )
{
if ( !mLayer->isSpatial() )
return QgsGeometry::InvalidBaseGeometry;
@ -340,8 +340,8 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitFeatures( const QList
{
continue;
}
QList<QgsGeometry> newGeometries;
QList<QgsPointXY> topologyTestPoints;
QVector<QgsGeometry> newGeometries;
QVector<QgsPointXY> 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<QgsPointXY>::const_iterator topol_it = topologyTestPoints.constBegin();
QVector<QgsPointXY>::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<QgsPointXY> &splitLine, bool topologicalEditing )
QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QVector<QgsPointXY> &splitLine, bool topologicalEditing )
{
if ( !mLayer->isSpatial() )
return QgsGeometry::InvalidBaseGeometry;
@ -447,8 +447,8 @@ QgsGeometry::OperationResult QgsVectorLayerEditUtils::splitParts( const QList<Qg
QgsFeature feat;
while ( fit.nextFeature( feat ) )
{
QList<QgsGeometry> newGeometries;
QList<QgsPointXY> topologyTestPoints;
QVector<QgsGeometry> newGeometries;
QVector<QgsPointXY> 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<Qg
if ( topologicalEditing )
{
QList<QgsPointXY>::const_iterator topol_it = topologyTestPoints.constBegin();
QVector<QgsPointXY>::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<QgsPointXY> &list, double &xmin, double &ymin, double &xmax, double &ymax ) const
bool QgsVectorLayerEditUtils::boundingBoxFromPointList( const QVector<QgsPointXY> &list, double &xmin, double &ymin, double &xmax, double &ymax ) const
{
if ( list.empty() )
{
@ -688,7 +688,7 @@ bool QgsVectorLayerEditUtils::boundingBoxFromPointList( const QList<QgsPointXY>
ymin = std::numeric_limits<double>::max();
ymax = -std::numeric_limits<double>::max();
for ( QList<QgsPointXY>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
for ( QVector<QgsPointXY>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
{
if ( it->x() < xmin )
{

View File

@ -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<QgsPointXY> &ring, const QgsFeatureIds &targetFeatureIds = QgsFeatureIds(), QgsFeatureId *modifiedFeatureId = nullptr );
QgsGeometry::OperationResult addRing( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
QgsGeometry::OperationResult splitParts( const QVector<QgsPointXY> &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<QgsPointXY> &splitLine, bool topologicalEditing = false );
QgsGeometry::OperationResult splitFeatures( const QVector<QgsPointXY> &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<QgsPointXY> &list, double &xmin, double &ymin, double &xmax, double &ymax ) const;
bool boundingBoxFromPointList( const QVector<QgsPointXY> &list, double &xmin, double &ymin, double &xmax, double &ymax ) const;
QgsVectorLayer *mLayer = nullptr;
};

View File

@ -157,7 +157,7 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRenderer
//! Structure where the reversed geometry is built during renderFeature
struct CombinedFeature
{
QList<QgsGeometry> geometries; //< list of geometries
QVector<QgsGeometry> geometries; //< list of geometries
QgsFeature feature; //< one feature (for attriute-based rendering)
};
typedef QVector<CombinedFeature> FeatureCategoryVector;

View File

@ -765,16 +765,16 @@ int QgsMapToolCapture::size()
return mCaptureCurve.numPoints();
}
QList<QgsPointXY> QgsMapToolCapture::points()
QVector<QgsPointXY> QgsMapToolCapture::points()
{
QgsPointSequence pts;
QList<QgsPointXY> points;
QVector<QgsPointXY> points;
mCaptureCurve.points( pts );
QgsGeometry::convertPointList( pts, points );
return points;
}
void QgsMapToolCapture::setPoints( const QList<QgsPointXY> &pointList )
void QgsMapToolCapture::setPoints( const QVector<QgsPointXY> &pointList )
{
QgsLineString *line = new QgsLineString( pointList );
mCaptureCurve.clear();

View File

@ -192,14 +192,14 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
* List of digitized points
* \returns List of points
*/
QList<QgsPointXY> points();
QVector<QgsPointXY> points();
/**
* Set the points on which to work
*
* \param pointList A list of points
*/
void setPoints( const QList<QgsPointXY> &pointList );
void setPoints( const QVector<QgsPointXY> &pointList );
/**
* Close an open polygon

View File

@ -92,7 +92,7 @@ QgsVectorLayer *QgsMapToolEdit::currentVectorLayer()
}
int QgsMapToolEdit::addTopologicalPoints( const QList<QgsPointXY> &geom )
int QgsMapToolEdit::addTopologicalPoints( const QVector<QgsPointXY> &geom )
{
if ( !mCanvas )
{
@ -107,7 +107,7 @@ int QgsMapToolEdit::addTopologicalPoints( const QList<QgsPointXY> &geom )
return 2;
}
QList<QgsPointXY>::const_iterator list_it = geom.constBegin();
QVector<QgsPointXY>::const_iterator list_it = geom.constBegin();
for ( ; list_it != geom.constEnd(); ++list_it )
{
vlayer->addTopologicalPoints( *list_it );

View File

@ -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<QgsPointXY> &geom );
int addTopologicalPoints( const QVector<QgsPointXY> &geom );
//! Display a timed message bar noting the active layer is not vector.
void notifyNotVectorLayer();

View File

@ -695,7 +695,7 @@ ErrorList topolTest::checkGaps( double tolerance, QgsVectorLayer *layer1, QgsVec
//qDebug() << "difference gometry - " << diffGeoms->exportToWkt();
QList<QgsGeometry> geomColl = diffGeoms.asGeometryCollection();
QVector<QgsGeometry> geomColl = diffGeoms.asGeometryCollection();
QgsGeometry canvasExtentPoly = QgsGeometry::fromWkt( qgsInterface->mapCanvas()->extent().asWktPolygon() );

View File

@ -120,7 +120,7 @@ static QgsCircularString *parseCircularString( const QVariantMap &curveData, Qgs
QVariantList coordsList = curveData[QStringLiteral( "c" )].toList();
if ( coordsList.isEmpty() )
return nullptr;
QList<QgsPoint> points;
QVector<QgsPoint> points;
points.append( startPoint );
foreach ( const QVariant &coordData, coordsList )
{

View File

@ -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()

View File

@ -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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) );
l39.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
boundary1.setPoints( QVector<QgsPoint>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
QVERIFY( !boundary1.boundary() );
//boundary with z
boundary1.setPoints( QList<QgsPoint>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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<QgsPointXY> ptsA;
QVector<QgsPointXY> 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) );
l39.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
boundary1.setPoints( QVector<QgsPoint>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
QVERIFY( !boundary1.boundary() );
\
//boundary with z
boundary1.setPoints( QList<QgsPoint>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) );
extend1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
p20ExteriorRing->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) );
boundaryRing1.setPoints( QVector<QgsPoint>() << 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>() << 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>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 )
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 1 ) << QgsPoint( 0, 0 ) );
pd1.setPoints( QVector<QgsPoint>() << 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>() << 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>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
removeRingsExt.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) << QgsPoint( 0.1, 0.1 ) );
removeRingsRing1.setPoints( QVector<QgsPoint>() << 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>() << 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>() << 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>() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) );
closedRing1->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) );
closedRing2->setPoints( QVector<QgsPoint>() << 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<QgsTriangle> rp10_tri = rp10.triangulate();
QVector<QgsTriangle> 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
p20ExteriorRing->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) );
boundaryRing1.setPoints( QVector<QgsPoint>() << QgsPoint( 0.1, 0.1 ) << QgsPoint( 0.2, 0.1 ) << QgsPoint( 0.2, 0.2 ) );
QgsCircularString boundaryRing2;
boundaryRing2.setPoints( QList<QgsPoint>() << 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>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 )
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
removeRingsExt.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 2 ) );
l39.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
boundary1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) );
boundaryLine1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) );
boundaryLine2.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 21, 21 ) << QgsPoint( 20, 20 ) );
boundaryLine3.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
boundaryLine4.setPoints( QVector<QgsPoint>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
QgsLineString boundaryLine5;
boundaryLine5.setPoints( QList<QgsPoint>() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 20, 20, 200 ) );
boundaryLine5.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) );
boundaryLine1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) );
boundaryLine2.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 20, 20 ) << QgsPoint( 21, 20 ) << QgsPoint( 20, 20 ) );
boundaryLine3.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
boundaryLine4.setPoints( QVector<QgsPoint>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 1, 20 ) );
QgsCircularString boundaryLine5;
boundaryLine5.setPoints( QList<QgsPoint>() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 20, 20, 200 ) );
boundaryLine5.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 0, 0 ) );
boundaryLine1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 10, 10 ) );
boundaryLine2.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 0, 15 ) << QgsPoint( QgsWkbTypes::PointZ, 0, 0, 10 ) );
boundaryLine4.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 20, 150 ) << QgsPoint( QgsWkbTypes::PointZ, 10, 10, 100 ) );
boundaryLine5.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) << QgsPoint( 1, 1 ) << QgsPoint( 0, 0 ) );
ring1.setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) << QgsPoint( 10, 10 ) );
ring2.setPoints( QVector<QgsPoint>() << QgsPoint( 10, 10 ) << QgsPoint( 11, 10 ) << QgsPoint( 11, 11 ) << QgsPoint( 10, 10 ) );
QgsPolygon polygon2;
polygon2.setExteriorRing( ring2.clone() );
QgsLineString boundaryRing1;
boundaryRing1.setPoints( QList<QgsPoint>() << QgsPoint( 10.1, 10.1 ) << QgsPoint( 10.2, 10.1 ) << QgsPoint( 10.2, 10.2 ) << QgsPoint( 10.1, 10.1 ) );
boundaryRing1.setPoints( QVector<QgsPoint>() << 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>() << 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>() << 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>() << QgsPoint( 0, 0 ) << QgsPoint( 1, 0 ) );
lineBoundary->setPoints( QVector<QgsPoint>() << 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<QgsGeometry> newGeoms;
QList<QgsPointXY> testPoints;
QCOMPARE( g1.splitGeometry( QList< QgsPointXY >() << QgsPointXY( 493825.46541286131832749, 7082214.02779923938214779 ) << QgsPointXY( 492955.04876351181883365, 7082338.06309300474822521 ),
QVector<QgsGeometry> newGeoms;
QVector<QgsPointXY> testPoints;
QCOMPARE( g1.splitGeometry( QVector< QgsPointXY >() << QgsPointXY( 493825.46541286131832749, 7082214.02779923938214779 ) << QgsPointXY( 492955.04876351181883365, 7082338.06309300474822521 ),
newGeoms, false, testPoints ), QgsGeometry::NothingHappened );
QVERIFY( newGeoms.isEmpty() );
}

View File

@ -60,24 +60,24 @@ class TestQgsGeometryUtils: public QObject
void TestQgsGeometryUtils::testExtractLinestrings()
{
QgsLineString *outerRing1 = new QgsLineString();
outerRing1->setPoints( QList<QgsPoint>() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) );
outerRing1->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 10, 10 ) << QgsPoint( 10, 20 ) << QgsPoint( 20, 20 ) << QgsPoint( 20, 10 ) << QgsPoint( 10, 10 ) );
outerRing2->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 14, 14 ) << QgsPoint( 14, 16 ) << QgsPoint( 16, 16 ) << QgsPoint( 16, 14 ) << QgsPoint( 14, 14 ) );
polygon2->setInteriorRings( QList<QgsCurve *>() << innerRing2 );
innerRing2->setPoints( QVector<QgsPoint>() << QgsPoint( 14, 14 ) << QgsPoint( 14, 16 ) << QgsPoint( 16, 16 ) << QgsPoint( 16, 14 ) << QgsPoint( 14, 14 ) );
polygon2->setInteriorRings( QVector<QgsCurve *>() << innerRing2 );
QgsMultiPolygon mpg;
mpg.addGeometry( polygon1 );
mpg.addGeometry( polygon2 );
QList<QgsLineString *> linestrings = QgsGeometryUtils::extractLineStrings( &mpg );
QVector<QgsLineString *> 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>() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) );
outerRing1->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 3, 1 ) );
outerRing1->setPoints( QVector<QgsPoint>() << 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>() << QgsPoint( 1, 1 ) << QgsPoint( 1, 2 ) << QgsPoint( 2, 2 ) << QgsPoint( 2, 1 ) << QgsPoint( 1, 1 ) );
closedRing1->setPoints( QVector<QgsPoint>() << 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 ) );

View File

@ -910,7 +910,7 @@ QList< TestQgsGrassCommandGroup > TestQgsGrassProvider::createCommands()
TestQgsGrassFeature grassFeature;
QgsLineString *line = nullptr;
QgsGeometry *geometry = nullptr;
QList<QgsPoint> pointList;
QVector<QgsPoint> pointList;
// Start editing
command = TestQgsGrassCommand( TestQgsGrassCommand::StartEditing );