Split QgsVertexId out to own file, promote type to enum class

This commit is contained in:
Nyall Dawson 2021-10-12 06:59:05 +10:00
parent 8cc230d8a0
commit e733b517b3
42 changed files with 316 additions and 231 deletions

View File

@ -897,3 +897,14 @@ Qgis.RenderSubcomponentProperty.GlowSpread.__doc__ = "Glow spread size"
Qgis.RenderSubcomponentProperty.__doc__ = 'Rendering subcomponent properties.\n\n.. versionadded:: 3.22\n\n' + '* ``Generic``: ' + Qgis.RenderSubcomponentProperty.Generic.__doc__ + '\n' + '* ``ShadowOffset``: ' + Qgis.RenderSubcomponentProperty.ShadowOffset.__doc__ + '\n' + '* ``BlurSize``: ' + Qgis.RenderSubcomponentProperty.BlurSize.__doc__ + '\n' + '* ``GlowSpread``: ' + Qgis.RenderSubcomponentProperty.GlowSpread.__doc__
# --
Qgis.RenderSubcomponentProperty.baseClass = Qgis
QgsVertexId.VertexType = Qgis.VertexType
# monkey patching scoped based enum
QgsVertexId.SegmentVertex = Qgis.VertexType.Segment
QgsVertexId.SegmentVertex.is_monkey_patched = True
QgsVertexId.SegmentVertex.__doc__ = "The actual start or end point of a segment"
QgsVertexId.CurveVertex = Qgis.VertexType.Curve
QgsVertexId.CurveVertex.is_monkey_patched = True
QgsVertexId.CurveVertex.__doc__ = "An intermediate point on a segment defining the curvature of the segment"
Qgis.VertexType.__doc__ = 'Types of vertex.\n\n.. versionadded:: 3.22\n\n' + '* ``SegmentVertex``: ' + Qgis.VertexType.Segment.__doc__ + '\n' + '* ``CurveVertex``: ' + Qgis.VertexType.Curve.__doc__
# --
Qgis.VertexType.baseClass = Qgis

View File

@ -938,66 +938,6 @@ Clears any cached parameters associated with the geometry, e.g., bounding boxes
};
struct QgsVertexId
{
enum VertexType
{
SegmentVertex,
CurveVertex,
};
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex ) /HoldGIL/;
%Docstring
Constructor for :py:class:`QgsVertexId`.
%End
bool isValid() const /HoldGIL/;
%Docstring
Returns ``True`` if the vertex id is valid
%End
bool operator==( QgsVertexId other ) const /HoldGIL/;
bool operator!=( QgsVertexId other ) const /HoldGIL/;
bool partEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID belongs to the same part as another vertex ID.
%End
bool ringEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID belongs to the same ring as another vertex ID (i.e. the part
and ring number are equal).
%End
bool vertexEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID corresponds to the same vertex as another vertex ID (i.e. the part,
ring number and vertex number are equal).
%End
bool isValid( const QgsAbstractGeometry *geom ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID is valid for the specified ``geom``.
%End
int part;
int ring;
int vertex;
VertexType type;
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3%4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( sipCpp->type == QgsVertexId::CurveVertex ? QStringLiteral( " CurveVertex" ) : QString() );
sipRes = PyUnicode_FromString( str.toUtf8().data() );
%End
};
class QgsVertexIterator

View File

@ -170,7 +170,7 @@ Appends the contents of another circular ``string`` to the end of this circular
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
virtual bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const;
virtual void sumUpArea( double &sum /Out/ ) const;

View File

@ -158,7 +158,7 @@ Converts the vertex at the given position from/to circular
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
virtual bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const;
virtual void sumUpArea( double &sum /Out/ ) const;

View File

@ -144,7 +144,7 @@ Sums up the area of the curve by iterating over the vertices (shoelace formula).
virtual int vertexNumberFromVertexId( QgsVertexId id ) const;
virtual bool pointAt( int node, QgsPoint &point /Out/, QgsVertexId::VertexType &type /Out/ ) const = 0;
virtual bool pointAt( int node, QgsPoint &point /Out/, Qgis::VertexType &type /Out/ ) const = 0;
%Docstring
Returns the point and vertex id of a point within the curve.

View File

@ -692,7 +692,7 @@ of the curve.
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, int *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
virtual bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const;
virtual QgsPoint centroid() const;

View File

@ -0,0 +1,72 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsvertexid.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
struct QgsVertexId
{
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, Qgis::VertexType _type = Qgis::VertexType::Segment ) /HoldGIL/;
%Docstring
Constructor for :py:class:`QgsVertexId`.
%End
bool isValid() const /HoldGIL/;
%Docstring
Returns ``True`` if the vertex id is valid
%End
bool operator==( QgsVertexId other ) const /HoldGIL/;
bool operator!=( QgsVertexId other ) const /HoldGIL/;
bool partEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID belongs to the same part as another vertex ID.
%End
bool ringEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID belongs to the same ring as another vertex ID (i.e. the part
and ring number are equal).
%End
bool vertexEqual( QgsVertexId o ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID corresponds to the same vertex as another vertex ID (i.e. the part,
ring number and vertex number are equal).
%End
bool isValid( const QgsAbstractGeometry *geom ) const /HoldGIL/;
%Docstring
Returns ``True`` if this vertex ID is valid for the specified ``geom``.
%End
int part;
int ring;
int vertex;
Qgis::VertexType type;
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3%4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( qgsEnumValueToKey( sipCpp->type ) );
sipRes = PyUnicode_FromString( str.toUtf8().data() );
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsvertexid.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -609,6 +609,12 @@ The development version
GlowSpread,
};
enum class VertexType
{
Segment,
Curve,
};
static const double DEFAULT_SEARCH_RADIUS_MM;
static const float DEFAULT_MAPTOPIXEL_THRESHOLD;

View File

@ -324,6 +324,7 @@
%Include auto_generated/geometry/qgsregularpolygon.sip
%Include auto_generated/geometry/qgssurface.sip
%Include auto_generated/geometry/qgstriangle.sip
%Include auto_generated/geometry/qgsvertexid.sip
%Include auto_generated/geometry/qgswkbptr.sip
%Include auto_generated/geometry/qgswkbtypes.sip
%Include auto_generated/geometry/qgsray3d.sip

View File

@ -295,7 +295,7 @@ bool QgsVertexEditorModel::calcR( int row, double &r, double &minRadius ) const
const QgsVertexEntry *entry = mLockedFeature->vertexMap().at( row );
const bool curvePoint = ( entry->vertexId().type == QgsVertexId::CurveVertex );
const bool curvePoint = ( entry->vertexId().type == Qgis::VertexType::Curve );
if ( !curvePoint )
return false;

View File

@ -27,6 +27,7 @@
#include "qgsdockwidget.h"
#include "qgspoint.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsvertexid.h"
class QLabel;
class QTableView;

View File

@ -122,7 +122,7 @@ int adjacentVertexIndexToEndpoint( const QgsGeometry &geom, int vertexIndex )
static bool isCircularVertex( const QgsGeometry &geom, int vertexIndex )
{
QgsVertexId vid;
return geom.vertexIdFromVertexNr( vertexIndex, vid ) && vid.type == QgsVertexId::CurveVertex;
return geom.vertexIdFromVertexNr( vertexIndex, vid ) && vid.type == Qgis::VertexType::Curve;
}

View File

@ -765,6 +765,7 @@ set(QGIS_CORE_SRCS
geometry/qgsregularpolygon.cpp
geometry/qgssurface.cpp
geometry/qgstriangle.cpp
geometry/qgsvertexid.cpp
geometry/qgswkbptr.cpp
geometry/qgswkbtypes.cpp
geometry/qgsray3d.cpp
@ -1300,6 +1301,7 @@ set(QGIS_CORE_HDRS
geometry/qgsregularpolygon.h
geometry/qgssurface.h
geometry/qgstriangle.h
geometry/qgsvertexid.h
geometry/qgswkbptr.h
geometry/qgswkbtypes.h
geometry/qgsray3d.h

View File

@ -21,7 +21,7 @@
#include "qgis_sip.h"
#include "qgis.h"
#include "qgspointxy.h"
#include "qgsabstractgeometry.h"
#include "qgsvertexid.h"
#include "qgsgeometry.h"
/**

View File

@ -20,7 +20,7 @@
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgspointxy.h"
#include "qgsabstractgeometry.h"
#include "qgsvertexid.h"
#include "qgis.h"
/**

View File

@ -20,6 +20,7 @@ email : marco.hugentobler at sourcepole dot com
#include "qgsmaptopixel.h"
#include "qgspoint.h"
#include "qgsgeometrycollection.h"
#include "qgsvertexid.h"
#include <nlohmann/json.hpp>
#include <limits>
@ -469,7 +470,7 @@ QgsVertexId QgsAbstractGeometry::vertex_iterator::vertexId() const
}
// get the vertex type: find out from the leaf geometry
QgsVertexId::VertexType vertexType = QgsVertexId::SegmentVertex;
Qgis::VertexType vertexType = Qgis::VertexType::Segment;
if ( const QgsCurve *curve = dynamic_cast<const QgsCurve *>( levels[depth].g ) )
{
QgsPoint p;

View File

@ -1138,106 +1138,6 @@ class CORE_EXPORT QgsAbstractGeometry
};
/**
* \ingroup core
* \class QgsVertexId
* \brief Utility class for identifying a unique vertex within a geometry.
* \since QGIS 2.10
*/
struct CORE_EXPORT QgsVertexId
{
/**
* Type of vertex
*/
enum VertexType
{
SegmentVertex = 1, //!< The actual start or end point of a segment
CurveVertex, //!< An intermediate point on a segment defining the curvature of the segment
};
/**
* Constructor for QgsVertexId.
*/
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, VertexType _type = SegmentVertex ) SIP_HOLDGIL
: part( _part )
, ring( _ring )
, vertex( _vertex )
, type( _type )
{}
/**
* Returns TRUE if the vertex id is valid
*/
bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
bool operator==( QgsVertexId other ) const SIP_HOLDGIL
{
return part == other.part && ring == other.ring && vertex == other.vertex;
}
bool operator!=( QgsVertexId other ) const SIP_HOLDGIL
{
return part != other.part || ring != other.ring || vertex != other.vertex;
}
/**
* Returns TRUE if this vertex ID belongs to the same part as another vertex ID.
*/
bool partEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return part >= 0 && o.part == part;
}
/**
* Returns TRUE if this vertex ID belongs to the same ring as another vertex ID (i.e. the part
* and ring number are equal).
*/
bool ringEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return partEqual( o ) && ( ring >= 0 && o.ring == ring );
}
/**
* Returns TRUE if this vertex ID corresponds to the same vertex as another vertex ID (i.e. the part,
* ring number and vertex number are equal).
*/
bool vertexEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return ringEqual( o ) && ( vertex >= 0 && o.ring == ring );
}
/**
* Returns TRUE if this vertex ID is valid for the specified \a geom.
*/
bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL
{
return ( part >= 0 && part < geom->partCount() ) &&
( ring < geom->ringCount( part ) ) &&
( vertex < 0 || vertex < geom->vertexCount( part, ring ) );
}
//! Part number
int part = -1;
//! Ring number
int ring = -1;
//! Vertex number
int vertex = -1;
//! Vertex type
VertexType type = SegmentVertex;
#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3%4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( sipCpp->type == QgsVertexId::CurveVertex ? QStringLiteral( " CurveVertex" ) : QString() );
sipRes = PyUnicode_FromString( str.toUtf8().data() );
% End
#endif
};
#ifndef SIP_RUN
template <class T>

View File

@ -1344,14 +1344,14 @@ double QgsCircularString::closestSegment( const QgsPoint &pt, QgsPoint &segmentP
return minDist;
}
bool QgsCircularString::pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const
bool QgsCircularString::pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const
{
if ( node < 0 || node >= numPoints() )
{
return false;
}
point = pointN( node );
type = ( node % 2 == 0 ) ? QgsVertexId::SegmentVertex : QgsVertexId::CurveVertex;
type = ( node % 2 == 0 ) ? Qgis::VertexType::Segment : Qgis::VertexType::Curve;
return true;
}

View File

@ -146,7 +146,7 @@ class CORE_EXPORT QgsCircularString: public QgsCurve
bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
bool deleteVertex( QgsVertexId position ) override;
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, int *leftOf SIP_OUT = nullptr, double epsilon = 4 * std::numeric_limits<double>::epsilon() ) const override;
bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override;
bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const override;
void sumUpArea( double &sum SIP_OUT ) const override;
bool hasCurvedSegments() const override;
double vertexAngle( QgsVertexId vertex ) const override;

View File

@ -809,7 +809,7 @@ bool QgsCompoundCurve::deleteVertex( QgsVertexId position )
mCurves.at( curveIds.at( 1 ).first )->numPoints() > 3 )
{
QgsPoint intermediatePoint;
QgsVertexId::VertexType type;
Qgis::VertexType type;
mCurves.at( curveIds.at( 1 ).first ) ->pointAt( 2, intermediatePoint, type );
mCurves.at( curveIds.at( 0 ).first )->moveVertex(
QgsVertexId( 0, 0, mCurves.at( curveIds.at( 0 ).first )->numPoints() - 1 ), intermediatePoint );
@ -1013,7 +1013,7 @@ double QgsCompoundCurve::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt
return QgsGeometryUtils::closestSegmentFromComponents( mCurves, QgsGeometryUtils::Vertex, pt, segmentPt, vertexAfter, leftOf, epsilon );
}
bool QgsCompoundCurve::pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const
bool QgsCompoundCurve::pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const
{
int currentVertexId = 0;
for ( int j = 0; j < mCurves.size(); ++j )

View File

@ -135,7 +135,7 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve
bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
bool deleteVertex( QgsVertexId position ) override;
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, int *leftOf SIP_OUT = nullptr, double epsilon = 4 * std::numeric_limits<double>::epsilon() ) const override;
bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override;
bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const override;
void sumUpArea( double &sum SIP_OUT ) const override;
//! Appends first point if not already closed.

View File

@ -22,6 +22,7 @@
#include "qgspoint.h"
#include "qgsmultipoint.h"
#include "qgsgeos.h"
#include "qgsvertexid.h"
bool QgsCurve::operator==( const QgsAbstractGeometry &other ) const
{
@ -197,7 +198,7 @@ int QgsCurve::partCount() const
QgsPoint QgsCurve::vertexAt( QgsVertexId id ) const
{
QgsPoint v;
QgsVertexId::VertexType type;
Qgis::VertexType type;
pointAt( id.vertex, v, type );
return v;
}
@ -305,7 +306,7 @@ int QgsCurve::childCount() const
QgsPoint QgsCurve::childPoint( int index ) const
{
QgsPoint point;
QgsVertexId::VertexType type;
Qgis::VertexType type;
const bool res = pointAt( index, point, type );
Q_ASSERT( res );
Q_UNUSED( res )

View File

@ -153,7 +153,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry SIP_ABSTRACT
* \param type will be set to the vertex type of the node
* \returns TRUE if node exists within the curve
*/
virtual bool pointAt( int node, QgsPoint &point SIP_OUT, QgsVertexId::VertexType &type SIP_OUT ) const = 0;
virtual bool pointAt( int node, QgsPoint &point SIP_OUT, Qgis::VertexType &type SIP_OUT ) const = 0;
/**
* Returns the index of the first vertex matching the given \a point, or -1 if a matching

View File

@ -613,7 +613,7 @@ bool QgsCurvePolygon::removeDuplicateNodes( double epsilon, bool useZValues )
if ( ring->removeDuplicateNodes( epsilon, useZValues ) )
{
QgsPoint startPoint;
QgsVertexId::VertexType type;
Qgis::VertexType type;
ring->pointAt( 0, startPoint, type );
// ensure ring is properly closed - if we removed the final node, it may no longer be properly closed
ring->moveVertex( QgsVertexId( -1, -1, ring->numPoints() - 1 ), startPoint );

View File

@ -3189,7 +3189,7 @@ bool QgsGeometry::vertexIdFromVertexNr( int nr, QgsVertexId &id ) const
return false;
}
id.type = QgsVertexId::SegmentVertex;
id.type = Qgis::VertexType::Segment;
bool res = vertexIndexInfo( d->geometry.get(), nr, id.part, id.ring, id.vertex );
if ( !res )

View File

@ -35,6 +35,7 @@ email : morb at ozemail dot com dot au
#include "qgspointxy.h"
#include "qgspoint.h"
#include "qgsfeatureid.h"
#include "qgsvertexid.h"
#ifndef SIP_RUN
#include "json_fwd.hpp"

View File

@ -21,7 +21,7 @@ email : marco.hugentobler at sourcepole dot com
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgspoint.h"
#include "qgsabstractgeometry.h"
#include "qgsvertexid.h"
#include "qgsgeometry.h"
#include "qgsvector3d.h"

View File

@ -1779,14 +1779,14 @@ double QgsLineString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt,
* See details in QEP #17
****************************************************************************/
bool QgsLineString::pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const
bool QgsLineString::pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const
{
if ( node < 0 || node >= numPoints() )
{
return false;
}
point = pointN( node );
type = QgsVertexId::SegmentVertex;
type = Qgis::VertexType::Segment;
return true;
}

View File

@ -850,7 +850,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve
QgsLineString *curveSubstring( double startDistance, double endDistance ) const override SIP_FACTORY;
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, int *leftOf SIP_OUT = nullptr, double epsilon = 4 * std::numeric_limits<double>::epsilon() ) const override;
bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override;
bool pointAt( int node, QgsPoint &point, Qgis::VertexType &type ) const override;
QgsPoint centroid() const override;

View File

@ -0,0 +1,24 @@
/***************************************************************************
qgsvertexid.cpp
-------------------------------------------------------------------
Date : 04 Sept 2014
Copyright : (C) 2014 by Marco Hugentobler
email : marco.hugentobler at sourcepole dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsvertexid.h"
#include "qgsabstractgeometry.h"
bool QgsVertexId::isValid( const QgsAbstractGeometry *geom ) const
{
return ( part >= 0 && part < geom->partCount() ) &&
( ring < geom->ringCount( part ) ) &&
( vertex < 0 || vertex < geom->vertexCount( part, ring ) );
}

View File

@ -0,0 +1,110 @@
/***************************************************************************
qgsvertexid.h
-------------------------------------------------------------------
Date : 04 Sept 2014
Copyright : (C) 2014 by Marco Hugentobler
email : marco.hugentobler at sourcepole dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSVERTEXID_H
#define QGSVERTEXID_H
#include "qgis_core.h"
#include "qgis.h"
class QgsAbstractGeometry;
/**
* \ingroup core
* \class QgsVertexId
* \brief Utility class for identifying a unique vertex within a geometry.
* \since QGIS 2.10
*/
struct CORE_EXPORT QgsVertexId
{
/**
* Constructor for QgsVertexId.
*/
explicit QgsVertexId( int _part = -1, int _ring = -1, int _vertex = -1, Qgis::VertexType _type = Qgis::VertexType::Segment ) SIP_HOLDGIL
: part( _part )
, ring( _ring )
, vertex( _vertex )
, type( _type )
{}
/**
* Returns TRUE if the vertex id is valid
*/
bool isValid() const SIP_HOLDGIL { return part >= 0 && ring >= 0 && vertex >= 0; }
bool operator==( QgsVertexId other ) const SIP_HOLDGIL
{
return part == other.part && ring == other.ring && vertex == other.vertex;
}
bool operator!=( QgsVertexId other ) const SIP_HOLDGIL
{
return part != other.part || ring != other.ring || vertex != other.vertex;
}
/**
* Returns TRUE if this vertex ID belongs to the same part as another vertex ID.
*/
bool partEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return part >= 0 && o.part == part;
}
/**
* Returns TRUE if this vertex ID belongs to the same ring as another vertex ID (i.e. the part
* and ring number are equal).
*/
bool ringEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return partEqual( o ) && ( ring >= 0 && o.ring == ring );
}
/**
* Returns TRUE if this vertex ID corresponds to the same vertex as another vertex ID (i.e. the part,
* ring number and vertex number are equal).
*/
bool vertexEqual( QgsVertexId o ) const SIP_HOLDGIL
{
return ringEqual( o ) && ( vertex >= 0 && o.ring == ring );
}
/**
* Returns TRUE if this vertex ID is valid for the specified \a geom.
*/
bool isValid( const QgsAbstractGeometry *geom ) const SIP_HOLDGIL;
//! Part number
int part = -1;
//! Ring number
int ring = -1;
//! Vertex number
int vertex = -1;
//! Vertex type
Qgis::VertexType type = Qgis::VertexType::Segment;
#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsVertexId: %1,%2,%3%4>" ).arg( sipCpp->part ).arg( sipCpp->ring ).arg( sipCpp->vertex ).arg( qgsEnumValueToKey( sipCpp->type ) );
sipRes = PyUnicode_FromString( str.toUtf8().data() );
% End
#endif
};
#endif //QGSVERTEXID_H

View File

@ -981,6 +981,17 @@ class CORE_EXPORT Qgis
};
Q_ENUM( RenderSubcomponentProperty )
/**
* Types of vertex.
* \since QGIS 3.22
*/
enum class VertexType SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsVertexId, VertexType ) : int
{
Segment SIP_MONKEYPATCH_COMPAT_NAME( SegmentVertex ) = 1, //!< The actual start or end point of a segment
Curve SIP_MONKEYPATCH_COMPAT_NAME( CurveVertex ) = 2, //!< An intermediate point on a segment defining the curvature of the segment
};
Q_ENUM( VertexType )
/**
* Identify search radius in mm
* \since QGIS 2.3

View File

@ -22,6 +22,7 @@ email : jef at norbit dot de
#include "qgspolygon.h"
#include "qgscurvepolygon.h"
#include "qgscurve.h"
#include "qgsvertexid.h"
QgsGeometryValidator::QgsGeometryValidator( const QgsGeometry &geometry, QVector<QgsGeometry::Error> *errors, Qgis::GeometryValidationEngine method )
: mGeometry( geometry )

View File

@ -26,6 +26,7 @@
#include "qgslinestring.h"
#include "qgspolygon.h"
#include "qgsgeometrycollection.h"
#include "qgsvertexid.h"
QgsMapToPixelSimplifier::QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm )
: mSimplifyFlags( simplifyFlags )

View File

@ -206,7 +206,7 @@ static bool _isRingCounterClockWise( const QgsCurve &ring )
{
double a = 0;
const int count = ring.numPoints();
QgsVertexId::VertexType vt;
Qgis::VertexType vt;
QgsPoint pt, ptPrev;
ring.pointAt( 0, ptPrev, vt );
for ( int i = 1; i < count + 1; ++i )

View File

@ -1802,8 +1802,8 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
scope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, ++pointNum, true ) );
if ( ( placement == QgsTemplatedLineSymbolLayerBase::Vertex && vId.type == QgsVertexId::SegmentVertex )
|| ( placement == QgsTemplatedLineSymbolLayerBase::CurvePoint && vId.type == QgsVertexId::CurveVertex ) )
if ( ( placement == QgsTemplatedLineSymbolLayerBase::Vertex && vId.type == Qgis::VertexType::Segment )
|| ( placement == QgsTemplatedLineSymbolLayerBase::CurvePoint && vId.type == Qgis::VertexType::Curve ) )
{
//transform
x = vPoint.x();

View File

@ -709,7 +709,7 @@ void QgsMapToolIdentify::closestVertexAttributes( const QgsAbstractGeometry &geo
derivedAttributes.insert( tr( "Closest vertex M" ), str );
}
if ( vId.type == QgsVertexId::CurveVertex )
if ( vId.type == Qgis::VertexType::Curve )
{
double radius, centerX, centerY;
QgsVertexId vIdBefore = vId;

View File

@ -1139,7 +1139,7 @@ void TestQgsCircularString::circularString()
QgsCircularString l33;
l33.vertexAt( QgsVertexId( 0, 0, -10 ) ); //out of bounds, check for no crash
l33.vertexAt( QgsVertexId( 0, 0, 10 ) ); //out of bounds, check for no crash
QgsVertexId::VertexType type;
Qgis::VertexType type;
QVERIFY( !l33.pointAt( -10, p, type ) );
QVERIFY( !l33.pointAt( 10, p, type ) );
//CircularString
@ -1153,13 +1153,13 @@ void TestQgsCircularString::circularString()
QVERIFY( !l33.pointAt( 10, p, type ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( 1, 2 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( 11, 12 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( l33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( 1, 22 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//CircularStringZ
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) << QgsPoint( QgsWkbTypes::PointZ, 1, 22, 23 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) );
@ -1167,13 +1167,13 @@ void TestQgsCircularString::circularString()
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointZ, 1, 22, 23 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( l33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( 1, 22, 23 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//CircularStringM
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) << QgsPoint( QgsWkbTypes::PointM, 1, 22, 0, 24 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) );
@ -1181,13 +1181,13 @@ void TestQgsCircularString::circularString()
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointM, 1, 22, 0, 24 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( l33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 22, 0, 24 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//CircularStringZM
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 23, 24 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) );
@ -1195,13 +1195,13 @@ void TestQgsCircularString::circularString()
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointZM, 1, 22, 23, 24 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( l33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 22, 23, 24 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//centroid
QgsCircularString l34;

View File

@ -453,25 +453,25 @@ void TestQgsCompoundCurve::compoundCurve()
c9.moveVertex( QgsVertexId( 0, 0, 11 ), QgsPoint( 71.0, 2 ) ); //out of range
QgsPoint p;
QgsVertexId::VertexType type;
Qgis::VertexType type;
QVERIFY( !c9.pointAt( -1, p, type ) );
QVERIFY( !c9.pointAt( 11, p, type ) );
QVERIFY( c9.pointAt( 0, p, type ) );
QCOMPARE( p.z(), 3.0 );
QCOMPARE( p.m(), 4.0 );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( c9.pointAt( 1, p, type ) );
QCOMPARE( p.z(), 13.0 );
QCOMPARE( p.m(), 14.0 );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( c9.pointAt( 2, p, type ) );
QCOMPARE( p.z(), 23.0 );
QCOMPARE( p.m(), 24.0 );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( c9.pointAt( 3, p, type ) );
QCOMPARE( p.z(), 13.0 );
QCOMPARE( p.m(), 14.0 );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//equality
QgsCompoundCurve e1;
@ -893,7 +893,7 @@ void TestQgsCompoundCurve::compoundCurve()
c22.addCurve( ls21.clone() );
c22.transform( tr, Qgis::TransformDirection::Forward );
QgsPoint pt;
QgsVertexId::VertexType v;
Qgis::VertexType v;
c22.pointAt( 0, pt, v );
QGSCOMPARENEAR( pt.x(), 175.771, 0.001 );
QGSCOMPARENEAR( pt.y(), -39.724, 0.001 );
@ -1567,19 +1567,19 @@ void TestQgsCompoundCurve::compoundCurve()
QVERIFY( !c33.pointAt( 10, p, type ) );
QVERIFY( c33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( 1, 2 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( c33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( 11, 12 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( c33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( 1, 22 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QgsLineString ls33;
ls33.setPoints( QgsPointSequence() << QgsPoint( 1, 22 ) << QgsPoint( 3, 34 ) );
c33.addCurve( ls33.clone() );
QVERIFY( c33.pointAt( 3, p, type ) );
QCOMPARE( p, QgsPoint( 3, 34 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
c33.clear();
//CircularStringZ
@ -1590,13 +1590,13 @@ void TestQgsCompoundCurve::compoundCurve()
QCOMPARE( c33.vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointZ, 1, 22, 23 ) );
QVERIFY( c33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( c33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( c33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( 1, 22, 23 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//CircularStringM
c33.clear();
@ -1607,13 +1607,13 @@ void TestQgsCompoundCurve::compoundCurve()
QCOMPARE( c33.vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointM, 1, 22, 0, 24 ) );
QVERIFY( c33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( c33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( c33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 22, 0, 24 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//CircularStringZM
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) << QgsPoint( QgsWkbTypes::PointZM, 1, 22, 23, 24 ) );
c33.clear();
@ -1623,13 +1623,13 @@ void TestQgsCompoundCurve::compoundCurve()
QCOMPARE( c33.vertexAt( QgsVertexId( 0, 0, 2 ) ), QgsPoint( QgsWkbTypes::PointZM, 1, 22, 23, 24 ) );
QVERIFY( c33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( c33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
QCOMPARE( type, QgsVertexId::CurveVertex );
QCOMPARE( type, Qgis::VertexType::Curve );
QVERIFY( c33.pointAt( 2, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 22, 23, 24 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//centroid
QgsCircularString l34;

View File

@ -25,6 +25,7 @@
#include "qgsmulticurve.h"
#include "qgspoint.h"
#include "qgspolygon.h"
#include "qgsvertexid.h"
#include "testgeometryutils.h"

View File

@ -1581,7 +1581,7 @@ void TestQgsLineString::lineString()
QgsLineString l33;
l33.vertexAt( QgsVertexId( 0, 0, -10 ) ); //out of bounds, check for no crash
l33.vertexAt( QgsVertexId( 0, 0, 10 ) ); //out of bounds, check for no crash
QgsVertexId::VertexType type;
Qgis::VertexType type;
QVERIFY( !l33.pointAt( -10, p, type ) );
QVERIFY( !l33.pointAt( 10, p, type ) );
//LineString
@ -1594,50 +1594,50 @@ void TestQgsLineString::lineString()
QVERIFY( !l33.pointAt( 10, p, type ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( 1, 2 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( 11, 12 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//LineStringZ
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 1, 2, 3 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZ, 11, 12, 13 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//LineStringM
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) << QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 4 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointM, 11, 12, 0, 14 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//LineStringZM
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//LineString25D
l33.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) << QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 0 ) ), QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) );
QCOMPARE( l33.vertexAt( QgsVertexId( 0, 0, 1 ) ), QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) );
QVERIFY( l33.pointAt( 0, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::Point25D, 1, 2, 3 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
QVERIFY( l33.pointAt( 1, p, type ) );
QCOMPARE( p, QgsPoint( QgsWkbTypes::Point25D, 11, 12, 13 ) );
QCOMPARE( type, QgsVertexId::SegmentVertex );
QCOMPARE( type, Qgis::VertexType::Segment );
//centroid
QgsLineString l34;

View File

@ -19,6 +19,7 @@
#include "qgslinestring.h"
#include "qgsmultipoint.h"
#include "qgspoint.h"
#include "qgsvertexid.h"
#include "testgeometryutils.h"