QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Static Public Member Functions | List of all members
QgsReferencedGeometry Class Reference

A QgsGeometry with associated coordinate reference system. More...

#include <qgsreferencedgeometry.h>

Inheritance diagram for QgsReferencedGeometry:
Inheritance graph
[legend]

Public Member Functions

 QgsReferencedGeometry ()=default
 Constructor for QgsReferencedGeometry. More...
 
 QgsReferencedGeometry (const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs)
 Constructor for QgsReferencedGeometry, with the specified initial geometry and crs. More...
 
 operator QVariant () const
 Allows direct construction of QVariants from geometry. More...
 
bool operator!= (const QgsReferencedGeometry &other) const
 
bool operator== (const QgsReferencedGeometry &other) const
 
- Public Member Functions inherited from QgsGeometry
 QgsGeometry ()
 Constructor. More...
 
 QgsGeometry (const QgsGeometry &)
 Copy constructor will prompt a deep copy of the object. More...
 
 QgsGeometry (QgsAbstractGeometry *geom)
 Creates a geometry from an abstract geometry object. More...
 
 QgsGeometry (std::unique_ptr< QgsAbstractGeometry > geom)
 Creates a geometry from an abstract geometry object. More...
 
virtual ~QgsGeometry ()
 
Qgis::GeometryOperationResult addPart (const QgsGeometry &newPart)
 Adds a new island polygon to a multipolygon feature. More...
 
Qgis::GeometryOperationResult addPart (const QgsPointSequence &points, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
 Adds a new part to a the geometry. More...
 
Qgis::GeometryOperationResult addPart (const QVector< QgsPointXY > &points, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
 Adds a new part to a the geometry. More...
 
Qgis::GeometryOperationResult addPart (QgsAbstractGeometry *part, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
 Adds a new part to this geometry. More...
 
Qgis::GeometryOperationResult addRing (const QVector< QgsPointXY > &ring)
 Adds a new ring to this geometry. More...
 
Qgis::GeometryOperationResult addRing (QgsCurve *ring)
 Adds a new ring to this geometry. More...
 
bool addTopologicalPoint (const QgsPoint &point, double snappingTolerance=1e-8, double segmentSearchEpsilon=1e-12)
 Adds a vertex to the segment which intersect point but don't already have a vertex there. More...
 
void adjacentVertices (int atVertex, int &beforeVertex, int &afterVertex) const
 Returns the indexes of the vertices before and after the given vertex index. More...
 
double angleAtVertex (int vertex) const
 Returns the bisector angle for this geometry at the specified vertex. More...
 
QgsGeometry applyDashPattern (const QVector< double > &pattern, Qgis::DashPatternLineEndingRule startRule=Qgis::DashPatternLineEndingRule::NoRule, Qgis::DashPatternLineEndingRule endRule=Qgis::DashPatternLineEndingRule::NoRule, Qgis::DashPatternSizeAdjustment adjustment=Qgis::DashPatternSizeAdjustment::ScaleBothDashAndGap, double patternOffset=0) const
 Applies a dash pattern to a geometry, returning a MultiLineString geometry which is the input geometry stroked along each line/ring with the specified pattern. More...
 
double area () const
 Returns the planar, 2-dimensional area of the geometry. More...
 
QVector< QgsGeometryasGeometryCollection () const
 Returns contents of the geometry as a list of geometries. More...
 
QString asJson (int precision=17) const
 Exports the geometry to a GeoJSON string. More...
 
virtual json asJsonObject (int precision=17) const
 Exports the geometry to a json object. More...
 
QgsMultiPointXY asMultiPoint () const
 Returns the contents of the geometry as a multi-point. More...
 
QgsMultiPolygonXY asMultiPolygon () const
 Returns the contents of the geometry as a multi-polygon. More...
 
QgsMultiPolylineXY asMultiPolyline () const
 Returns the contents of the geometry as a multi-linestring. More...
 
QgsPointXY asPoint () const
 Returns the contents of the geometry as a 2-dimensional point. More...
 
QgsPolygonXY asPolygon () const
 Returns the contents of the geometry as a polygon. More...
 
QgsPolylineXY asPolyline () const
 Returns the contents of the geometry as a polyline. More...
 
QPointF asQPointF () const
 Returns contents of the geometry as a QPointF if wkbType is WKBPoint, otherwise returns a null QPointF. More...
 
QPolygonF asQPolygonF () const
 Returns contents of the geometry as a QPolygonF. More...
 
QByteArray asWkb (QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const
 Export the geometry to WKB. More...
 
QString asWkt (int precision=17) const
 Exports the geometry to WKT. More...
 
Q_DECL_DEPRECATED int avoidIntersections (const QList< QgsVectorLayer * > &avoidIntersectionsLayers, const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &ignoreFeatures=(QHash< QgsVectorLayer *, QSet< QgsFeatureId > >()))
 Modifies geometry to avoid intersections with the layers specified in project properties. More...
 
Qgis::GeometryOperationResult avoidIntersectionsV2 (const QList< QgsVectorLayer * > &avoidIntersectionsLayers, const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &ignoreFeatures=(QHash< QgsVectorLayer *, QSet< QgsFeatureId > >()))
 Modifies geometry to avoid intersections with the layers specified in project properties. More...
 
QgsRectangle boundingBox () const
 Returns the bounding box of the geometry. More...
 
QgsBox3D boundingBox3D () const
 Returns the 3D bounding box of the geometry. More...
 
bool boundingBoxIntersects (const QgsGeometry &geometry) const
 Returns true if the bounding box of this geometry intersects with the bounding box of another geometry. More...
 
bool boundingBoxIntersects (const QgsRectangle &rectangle) const
 Returns true if the bounding box of this geometry intersects with a rectangle. More...
 
QgsGeometry buffer (double distance, int segments) const
 Returns a buffer region around this geometry having the given width and with a specified number of segments used to approximate curves. More...
 
QgsGeometry buffer (double distance, int segments, Qgis::EndCapStyle endCapStyle, Qgis::JoinStyle joinStyle, double miterLimit) const
 Returns a buffer region around the geometry, with additional style options. More...
 
QgsGeometry centroid () const
 Returns the center of mass of a geometry. More...
 
QgsGeometry clipped (const QgsRectangle &rectangle)
 Clips the geometry using the specified rectangle. More...
 
double closestSegmentWithContext (const QgsPointXY &point, QgsPointXY &minDistPoint, int &nextVertexIndex, int *leftOrRightOfSegment=nullptr, double epsilon=DEFAULT_SEGMENT_EPSILON) const
 Searches for the closest segment of geometry to the given point. More...
 
QgsPointXY closestVertex (const QgsPointXY &point, int &closestVertexIndex, int &previousVertexIndex, int &nextVertexIndex, double &sqrDist) const
 Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target point and the indices of the vertices before and after the closest vertex. More...
 
double closestVertexWithContext (const QgsPointXY &point, int &atVertex) const
 Searches for the closest vertex in this geometry to the given point. More...
 
QVector< QgsGeometrycoerceToType (Qgis::WkbType type, double defaultZ=0, double defaultM=0) const
 Attempts to coerce this geometry into the specified destination type. More...
 
QgsGeometry combine (const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Returns a geometry representing all the points in this geometry and other (a union geometry operation). More...
 
QgsGeometry concaveHull (double targetPercent, bool allowHoles=false) const
 Returns a possibly concave polygon that contains all the points in the geometry. More...
 
QgsAbstractGeometry::const_part_iterator const_parts_begin () const
 Returns STL-style const iterator pointing to the first part of the geometry. More...
 
QgsAbstractGeometry::const_part_iterator const_parts_end () const
 Returns STL-style iterator pointing to the imaginary part after the last part of the geometry. More...
 
const QgsAbstractGeometryconstGet () const
 Returns a non-modifiable (const) reference to the underlying abstract geometry primitive. More...
 
QgsGeometryConstPartIterator constParts () const
 Returns Java-style iterator for traversal of parts of the geometry. More...
 
QgsGeometry constrainedDelaunayTriangulation () const
 Returns a constrained Delaunay triangulation for the vertices of the geometry. More...
 
bool contains (const QgsGeometry &geometry) const
 Returns true if the geometry completely contains another geometry. More...
 
bool contains (const QgsPointXY *p) const
 Returns true if the geometry contains the point p. More...
 
bool convertGeometryCollectionToSubclass (Qgis::GeometryType geomType)
 Converts geometry collection to a the desired geometry type subclass (multi-point, multi-linestring or multi-polygon). More...
 
bool convertToCurvedMultiType ()
 Converts a geometry into a multitype geometry of curve kind (when there is a corresponding curve type). More...
 
QgsGeometry convertToCurves (double distanceTolerance=1e-8, double angleTolerance=1e-8) const
 Attempts to convert a non-curved geometry into a curved geometry type (e.g. More...
 
bool convertToMultiType ()
 Converts single type geometry into multitype geometry e.g. More...
 
bool convertToSingleType ()
 Converts multi type geometry into single type geometry e.g. More...
 
void convertToStraightSegment (double tolerance=M_PI/180., QgsAbstractGeometry::SegmentationToleranceType toleranceType=QgsAbstractGeometry::MaximumAngle)
 Converts the geometry to straight line segments, if it is a curved geometry type. More...
 
QgsGeometry convertToType (Qgis::GeometryType destType, bool destMultipart=false) const
 Try to convert the geometry to the requested type. More...
 
QgsGeometry convexHull () const
 Returns the smallest convex polygon that contains all the points in the geometry. More...
 
bool crosses (const QgsGeometry &geometry) const
 Returns true if the geometry crosses another geometry. More...
 
QgsGeometry delaunayTriangulation (double tolerance=0.0, bool edgesOnly=false) const
 Returns the Delaunay triangulation for the vertices of the geometry. More...
 
bool deletePart (int partNum)
 Deletes part identified by the part number. More...
 
bool deleteRing (int ringNum, int partNum=0)
 Deletes a ring in polygon or multipolygon. More...
 
bool deleteVertex (int atVertex)
 Deletes the vertex at the given position number and item (first number is index 0) More...
 
QgsGeometry densifyByCount (int extraNodesPerSegment) const
 Returns a copy of the geometry which has been densified by adding the specified number of extra nodes within each segment of the geometry. More...
 
QgsGeometry densifyByDistance (double distance) const
 Densifies the geometry by adding regularly placed extra nodes inside each segment so that the maximum distance between any two nodes does not exceed the specified distance. More...
 
QgsGeometry difference (const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Returns a geometry representing the points making up this geometry that do not make up other. More...
 
bool disjoint (const QgsGeometry &geometry) const
 Returns true if the geometry is disjoint of another geometry. More...
 
double distance (const QgsGeometry &geom) const
 Returns the minimum distance between this geometry and another geometry. More...
 
double distanceToVertex (int vertex) const
 Returns the distance along this geometry from its first vertex to the specified vertex. More...
 
void draw (QPainter &p) const
 Draws the geometry onto a QPainter. More...
 
bool equals (const QgsGeometry &geometry) const
 Test if this geometry is exactly equal to another geometry. More...
 
QgsGeometry extendLine (double startDistance, double endDistance) const
 Extends a (multi)line geometry by extrapolating out the start or end of the line by a specified distance. More...
 
QgsGeometry extrude (double x, double y)
 Returns an extruded version of this geometry. More...
 
void filterVertices (const std::function< bool(const QgsPoint &) > &filter)
 Filters the vertices from the geometry in place, removing any which do not return true for the filter function check. More...
 
QgsGeometry forcePolygonClockwise () const
 Forces geometries to respect the exterior ring is clockwise, interior rings are counter-clockwise convention. More...
 
QgsGeometry forcePolygonCounterClockwise () const
 Forces geometries to respect the exterior ring is counter-clockwise, interior rings are clockwise convention. More...
 
QgsGeometry forceRHR () const
 Forces geometries to respect the Right-Hand-Rule, in which the area that is bounded by a polygon is to the right of the boundary. More...
 
double frechetDistance (const QgsGeometry &geom) const
 Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries. More...
 
double frechetDistanceDensify (const QgsGeometry &geom, double densifyFraction) const
 Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries. More...
 
void fromWkb (const QByteArray &wkb)
 Set the geometry, feeding in the buffer containing OGC Well-Known Binary. More...
 
void fromWkb (unsigned char *wkb, int length)
 Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length. More...
 
QgsAbstractGeometryget ()
 Returns a modifiable (non-const) reference to the underlying abstract geometry primitive. More...
 
double hausdorffDistance (const QgsGeometry &geom) const
 Returns the Hausdorff distance between this geometry and geom. More...
 
double hausdorffDistanceDensify (const QgsGeometry &geom, double densifyFraction) const
 Returns the Hausdorff distance between this geometry and geom. More...
 
bool insertVertex (const QgsPoint &point, int beforeVertex)
 Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted. More...
 
bool insertVertex (double x, double y, int beforeVertex)
 Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted. More...
 
QgsGeometry interpolate (double distance) const
 Returns an interpolated point on the geometry at the specified distance. More...
 
double interpolateAngle (double distance) const
 Returns the angle parallel to the linestring or polygon boundary at the specified distance along the geometry. More...
 
QgsGeometry intersection (const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Returns a geometry representing the points shared by this geometry and other. More...
 
bool intersects (const QgsGeometry &geometry) const
 Returns true if this geometry exactly intersects with another geometry. More...
 
bool intersects (const QgsRectangle &rectangle) const
 Returns true if this geometry exactly intersects with a rectangle. More...
 
bool isAxisParallelRectangle (double maximumDeviation, bool simpleRectanglesOnly=false) const
 Returns true if the geometry is a polygon that is almost an axis-parallel rectangle. More...
 
bool isEmpty () const
 Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geometries). More...
 
bool isGeosEqual (const QgsGeometry &) const
 Compares the geometry with another geometry using GEOS. More...
 
bool isGeosValid (Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const
 Checks validity of the geometry using GEOS. More...
 
bool isMultipart () const
 Returns true if WKB of the geometry is of WKBMulti* type. More...
 
bool isNull () const
 Returns true if the geometry is null (ie, contains no underlying geometry accessible via get() or constGet() ). More...
 
bool isPolygonClockwise () const
 Returns True if the Polygon is clockwise. More...
 
bool isPolygonCounterClockwise () const
 Returns True if the Polygon is counter-clockwise. More...
 
bool isSimple () const
 Determines whether the geometry is simple (according to OGC definition), i.e. More...
 
QgsGeometry largestEmptyCircle (double tolerance, const QgsGeometry &boundary=QgsGeometry()) const
 Constructs the Largest Empty Circle for a set of obstacle geometries, up to a specified tolerance. More...
 
QString lastError () const
 Returns an error string referring to the last error encountered either when this geometry was created or when an operation was performed on the geometry. More...
 
double length () const
 Returns the planar, 2-dimensional length of geometry. More...
 
double lineLocatePoint (const QgsGeometry &point) const
 Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the specified point. More...
 
QgsGeometry makeDifference (const QgsGeometry &other) const
 Returns the geometry formed by modifying this geometry such that it does not intersect the other geometry. More...
 
int makeDifferenceInPlace (const QgsGeometry &other)
 Changes this geometry such that it does not intersect the other geometry. More...
 
QgsGeometry makeValid (Qgis::MakeValidMethod method=Qgis::MakeValidMethod::Linework, bool keepCollapsed=false) const
 Attempts to make an invalid geometry valid without losing vertices. More...
 
void mapToPixel (const QgsMapToPixel &mtp)
 Transforms the geometry from map units to pixels in place. More...
 
QgsGeometry mergeLines () const
 Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings. More...
 
QgsGeometry minimalEnclosingCircle (QgsPointXY &center, double &radius, unsigned int segments=36) const
 Returns the minimal enclosing circle for the geometry. More...
 
QgsGeometry minimalEnclosingCircle (unsigned int segments=36) const
 Returns the minimal enclosing circle for the geometry. More...
 
double minimumClearance () const
 Computes the minimum clearance of a geometry. More...
 
QgsGeometry minimumClearanceLine () const
 Returns a LineString whose endpoints define the minimum clearance of a geometry. More...
 
QgsGeometry minimumWidth () const
 Returns a linestring geometry which represents the minimum diameter of the geometry. More...
 
bool moveVertex (const QgsPoint &p, int atVertex)
 Moves the vertex at the given position number and item (first number is index 0) to the given coordinates. More...
 
bool moveVertex (double x, double y, int atVertex)
 Moves the vertex at the given position number and item (first number is index 0) to the given coordinates. More...
 
QgsGeometry nearestPoint (const QgsGeometry &other) const
 Returns the nearest (closest) point on this geometry to another geometry. More...
 
QgsGeometry node () const
 Returns a (Multi)LineString representing the fully noded version of a collection of linestrings. More...
 
void normalize ()
 Reorganizes the geometry into a normalized form (or "canonical" form). More...
 
QgsGeometry offsetCurve (double distance, int segments, Qgis::JoinStyle joinStyle, double miterLimit) const
 Returns an offset line at a given distance and side from an input line. More...
 
 operator QVariant () const
 Allows direct construction of QVariants from geometry. More...
 
QgsGeometryoperator= (QgsGeometry const &rhs)
 Creates a deep copy of the object. More...
 
QgsGeometry orientedMinimumBoundingBox () const
 Returns the oriented minimum bounding box for the geometry, which is the smallest (by area) rotated rectangle which fully encompasses the geometry. More...
 
QgsGeometry orientedMinimumBoundingBox (double &area, double &angle, double &width, double &height) const
 Returns the oriented minimum bounding box for the geometry, which is the smallest (by area) rotated rectangle which fully encompasses the geometry. More...
 
QgsGeometry orthogonalize (double tolerance=1.0E-8, int maxIterations=1000, double angleThreshold=15.0) const
 Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries angles either right angles or flat lines. More...
 
bool overlaps (const QgsGeometry &geometry) const
 Returns true if the geometry overlaps another geometry. More...
 
QgsGeometryPartIterator parts ()
 Returns Java-style iterator for traversal of parts of the geometry. More...
 
QgsAbstractGeometry::part_iterator parts_begin ()
 Returns STL-style iterator pointing to the first part of the geometry. More...
 
QgsAbstractGeometry::part_iterator parts_end ()
 Returns STL-style iterator pointing to the imaginary part after the last part of the geometry. More...
 
QgsGeometry pointOnSurface () const
 Returns a point guaranteed to lie on the surface of a geometry. More...
 
QgsGeometry poleOfInaccessibility (double precision, double *distanceToBoundary=nullptr) const
 Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface. More...
 
Qgis::AngularDirection polygonOrientation () const
 Returns the orientation of the polygon. More...
 
QVector< QgsPointXYrandomPointsInPolygon (int count, const std::function< bool(const QgsPointXY &) > &acceptPoint, unsigned long seed=0, QgsFeedback *feedback=nullptr, int maxTriesPerPoint=0) const
 Returns a list of count random points generated inside a (multi)polygon geometry (if acceptPoint is specified, and restrictive, the number of points returned may be less than count). More...
 
QVector< QgsPointXYrandomPointsInPolygon (int count, unsigned long seed=0, QgsFeedback *feedback=nullptr) const
 Returns a list of count random points generated inside a (multi)polygon geometry. More...
 
bool removeDuplicateNodes (double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)
 Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerate geometry. More...
 
QgsGeometry removeInteriorRings (double minimumAllowedArea=-1) const
 Removes the interior rings from a (multi)polygon geometry. More...
 
bool requiresConversionToStraightSegments () const
 Returns true if the geometry is a curved geometry type which requires conversion to display as straight line segments. More...
 
Qgis::GeometryOperationResult reshapeGeometry (const QgsLineString &reshapeLineString)
 Replaces a part of this geometry with another line. More...
 
Qgis::GeometryOperationResult rotate (double rotation, const QgsPointXY &center)
 Rotate this geometry around the Z axis. More...
 
QgsGeometry roundWaves (double wavelength, double amplitude, bool strictWavelength=false) const
 Constructs rounded (sine-like) waves along the boundary of the geometry, with the specified wavelength and amplitude. More...
 
QgsGeometry roundWavesRandomized (double minimumWavelength, double maximumWavelength, double minimumAmplitude, double maximumAmplitude, unsigned long seed=0) const
 Constructs randomized rounded (sine-like) waves along the boundary of the geometry, with the specified wavelength and amplitude ranges. More...
 
void set (QgsAbstractGeometry *geometry)
 Sets the underlying geometry store. More...
 
QgsGeometry sharedPaths (const QgsGeometry &other) const
 Find paths shared between the two given lineal geometries (this and other). More...
 
QgsGeometry shortestLine (const QgsGeometry &other) const
 Returns the shortest line joining this geometry to another geometry. More...
 
QgsGeometry simplify (double tolerance) const
 Returns a simplified version of this geometry using a specified tolerance value. More...
 
QgsGeometry simplifyCoverageVW (double tolerance, bool preserveBoundary) const
 Operates on a coverage (represented as a list of polygonal geometry with exactly matching edge geometry) to apply a Visvalingam–Whyatt simplification to the edges, reducing complexity in proportion with the provided tolerance, while retaining a valid coverage (no edges will cross or touch after the simplification). More...
 
QgsGeometry singleSidedBuffer (double distance, int segments, Qgis::BufferSide side, Qgis::JoinStyle joinStyle=Qgis::JoinStyle::Round, double miterLimit=2.0) const
 Returns a single sided buffer for a (multi)line geometry. More...
 
QgsGeometry smooth (unsigned int iterations=1, double offset=0.25, double minimumDistance=-1.0, double maxAngle=180.0) const
 Smooths a geometry by rounding off corners using the Chaikin algorithm. More...
 
QgsGeometry snappedToGrid (double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0) const
 Returns a new geometry with all points or vertices snapped to the closest point of the grid. More...
 
Qgis::GeometryOperationResult splitGeometry (const QgsCurve *curve, QVector< QgsGeometry > &newGeometries, bool preserveCircular, bool topological, QgsPointSequence &topologyTestPoints, bool splitFeature=true)
 Splits this geometry according to a given curve. More...
 
Qgis::GeometryOperationResult splitGeometry (const QgsPointSequence &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, bool splitFeature=true, bool skipIntersectionTest=false)
 Splits this geometry according to a given line. More...
 
Q_DECL_DEPRECATED Qgis::GeometryOperationResult splitGeometry (const QVector< QgsPointXY > &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QVector< QgsPointXY > &topologyTestPoints, bool splitFeature=true)
 Splits this geometry according to a given line. More...
 
double sqrDistToVertexAt (QgsPointXY &point, int atVertex) const
 Returns the squared Cartesian distance between the given point to the given vertex index (vertex at the given position number, ring and item (first number is index 0)) More...
 
QgsGeometry squareWaves (double wavelength, double amplitude, bool strictWavelength=false) const
 Constructs square waves along the boundary of the geometry, with the specified wavelength and amplitude. More...
 
QgsGeometry squareWavesRandomized (double minimumWavelength, double maximumWavelength, double minimumAmplitude, double maximumAmplitude, unsigned long seed=0) const
 Constructs randomized square waves along the boundary of the geometry, with the specified wavelength and amplitude ranges. More...
 
QgsGeometry subdivide (int maxNodes=256, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Subdivides the geometry. More...
 
QgsGeometry symDifference (const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Returns a geometry representing the points making up this geometry that do not make up other. More...
 
QgsGeometry taperedBuffer (double startWidth, double endWidth, int segments) const
 Calculates a variable width buffer ("tapered buffer") for a (multi)curve geometry. More...
 
bool toggleCircularAtVertex (int atVertex)
 Converts the vertex at the given position from/to circular. More...
 
bool touches (const QgsGeometry &geometry) const
 Returns true if the geometry touches another geometry. More...
 
Qgis::GeometryOperationResult transform (const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
 Transforms this geometry as described by the coordinate transform ct. More...
 
Qgis::GeometryOperationResult transform (const QTransform &t, double zTranslate=0.0, double zScale=1.0, double mTranslate=0.0, double mScale=1.0)
 Transforms the x and y components of the geometry using a QTransform object t. More...
 
void transformVertices (const std::function< QgsPoint(const QgsPoint &) > &transform)
 Transforms the vertices from the geometry in place, applying the transform function to every vertex. More...
 
Qgis::GeometryOperationResult translate (double dx, double dy, double dz=0.0, double dm=0.0)
 Translates this geometry by dx, dy, dz and dm. More...
 
QgsGeometry triangularWaves (double wavelength, double amplitude, bool strictWavelength=false) const
 Constructs triangular waves along the boundary of the geometry, with the specified wavelength and amplitude. More...
 
QgsGeometry triangularWavesRandomized (double minimumWavelength, double maximumWavelength, double minimumAmplitude, double maximumAmplitude, unsigned long seed=0) const
 Constructs randomized triangular waves along the boundary of the geometry, with the specified wavelength and amplitude ranges. More...
 
Qgis::GeometryType type () const
 Returns type of the geometry as a Qgis::GeometryType. More...
 
QgsGeometry unionCoverage () const
 Optimized union algorithm for polygonal inputs that are correctly noded and do not overlap. More...
 
Qgis::CoverageValidityResult validateCoverage (double gapWidth, QgsGeometry *invalidEdges=nullptr) const
 Analyze a coverage (represented as a collection of polygonal geometry with exactly matching edge geometry) to find places where the assumption of exactly matching edges is not met. More...
 
void validateGeometry (QVector< QgsGeometry::Error > &errors, Qgis::GeometryValidationEngine method=Qgis::GeometryValidationEngine::QgisInternal, Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const
 Validates geometry and produces a list of geometry errors. More...
 
QgsGeometry variableWidthBufferByM (int segments) const
 Calculates a variable width buffer for a (multi)linestring geometry, where the width at each node is taken from the linestring m values. More...
 
QgsPoint vertexAt (int atVertex) const
 Returns coordinates of a vertex. More...
 
bool vertexIdFromVertexNr (int number, QgsVertexId &id) const
 Calculates the vertex ID from a vertex number. More...
 
int vertexNrFromVertexId (QgsVertexId id) const
 Returns the vertex number corresponding to a vertex id. More...
 
QgsVertexIterator vertices () const
 Returns a read-only, Java-style iterator for traversal of vertices of all the geometry, including all geometry parts and rings. More...
 
QgsAbstractGeometry::vertex_iterator vertices_begin () const
 Returns STL-style iterator pointing to the first vertex of the geometry. More...
 
QgsAbstractGeometry::vertex_iterator vertices_end () const
 Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry. More...
 
QgsGeometry voronoiDiagram (const QgsGeometry &extent=QgsGeometry(), double tolerance=0.0, bool edgesOnly=false) const
 Creates a Voronoi diagram for the nodes contained within the geometry. More...
 
bool within (const QgsGeometry &geometry) const
 Returns true if the geometry is completely within another geometry. More...
 
int wkbSize (QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const
 Returns the length of the QByteArray returned by asWkb() More...
 
Qgis::WkbType wkbType () const
 Returns type of the geometry as a WKB type (point / linestring / polygon etc.) More...
 
- Public Member Functions inherited from QgsReferencedGeometryBase
 QgsReferencedGeometryBase (const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Constructor for QgsReferencedGeometryBase, with the specified crs. More...
 
QgsCoordinateReferenceSystem crs () const
 Returns the associated coordinate reference system, or an invalid CRS if no reference system is set. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the associated crs. More...
 

Static Public Member Functions

static QgsReferencedGeometry fromReferencedPointXY (const QgsReferencedPointXY &point)
 Construct a new QgsReferencedGeometry from referenced point. More...
 
static QgsReferencedGeometry fromReferencedRect (const QgsReferencedRectangle &rectangle)
 Construct a new QgsReferencedGeometry from referenced rectangle. More...
 
- Static Public Member Functions inherited from QgsGeometry
static QgsGeometry collectGeometry (const QVector< QgsGeometry > &geometries)
 Creates a new multipart geometry from a list of QgsGeometry objects. More...
 
static bool compare (const QgsMultiPolygonXY &p1, const QgsMultiPolygonXY &p2, double epsilon=4 *std::numeric_limits< double >::epsilon())
 Compares two multipolygons for equality within a specified tolerance. More...
 
static bool compare (const QgsPolygonXY &p1, const QgsPolygonXY &p2, double epsilon=4 *std::numeric_limits< double >::epsilon())
 Compares two polygons for equality within a specified tolerance. More...
 
static bool compare (const QgsPolylineXY &p1, const QgsPolylineXY &p2, double epsilon=4 *std::numeric_limits< double >::epsilon())
 Compares two polylines for equality within a specified tolerance. More...
 
static void convertPointList (const QgsPointSequence &input, QVector< QgsPointXY > &output)
 Downgrades a point list from QgsPoint to QgsPointXY. More...
 
static void convertPointList (const QVector< QgsPointXY > &input, QgsPointSequence &output)
 Upgrades a point list from QgsPointXY to QgsPoint. More...
 
static QgsGeometryEnginecreateGeometryEngine (const QgsAbstractGeometry *geometry, double precision=0.0)
 Creates and returns a new geometry engine representing the specified geometry using precision on a grid. More...
 
static Q_DECL_DEPRECATED QgsPolygonXY createPolygonFromQPolygonF (const QPolygonF &polygon)
 Creates a QgsPolygonXYfrom a QPolygonF. More...
 
static Q_DECL_DEPRECATED QgsPolylineXY createPolylineFromQPolygonF (const QPolygonF &polygon)
 Creates a QgsPolylineXY from a QPolygonF. More...
 
static QgsGeometry createWedgeBuffer (const QgsPoint &center, double azimuth, double angularWidth, double outerRadius, double innerRadius=0)
 Creates a wedge shaped buffer from a center point. More...
 
static QgsGeometry fromBox3D (const QgsBox3D &box)
 Creates a new geometry from a QgsBox3D object. More...
 
static QgsGeometry fromMultiPointXY (const QgsMultiPointXY &multipoint)
 Creates a new geometry from a QgsMultiPointXY object. More...
 
static QgsGeometry fromMultiPolygonXY (const QgsMultiPolygonXY &multipoly)
 Creates a new geometry from a QgsMultiPolygonXY. More...
 
static QgsGeometry fromMultiPolylineXY (const QgsMultiPolylineXY &multiline)
 Creates a new geometry from a QgsMultiPolylineXY object. More...
 
static QgsGeometry fromPoint (const QgsPoint &point)
 Creates a new geometry from a QgsPoint object. More...
 
static QgsGeometry fromPointXY (const QgsPointXY &point)
 Creates a new geometry from a QgsPointXY object. More...
 
static QgsGeometry fromPolygonXY (const QgsPolygonXY &polygon)
 Creates a new geometry from a QgsPolygonXY. More...
 
static QgsGeometry fromPolyline (const QgsPolyline &polyline)
 Creates a new LineString geometry from a list of QgsPoint points. More...
 
static QgsGeometry fromPolylineXY (const QgsPolylineXY &polyline)
 Creates a new LineString geometry from a list of QgsPointXY points. More...
 
static QgsGeometry fromQPointF (QPointF point)
 Construct geometry from a QPointF. More...
 
static QgsGeometry fromQPolygonF (const QPolygonF &polygon)
 Construct geometry from a QPolygonF. More...
 
static QgsGeometry fromRect (const QgsRectangle &rect)
 Creates a new geometry from a QgsRectangle. More...
 
static QgsGeometry fromWkt (const QString &wkt)
 Creates a new geometry from a WKT string. More...
 
static QgsGeometry polygonize (const QVector< QgsGeometry > &geometries)
 Creates a GeometryCollection geometry containing possible polygons formed from the constituent linework of a set of geometries. More...
 
static QgsGeometry unaryUnion (const QVector< QgsGeometry > &geometries, const QgsGeometryParameters &parameters=QgsGeometryParameters())
 Compute the unary union on a list of geometries. More...
 

Additional Inherited Members

- Properties inherited from QgsGeometry
Q_GADGET bool isNull
 
Qgis::GeometryType type
 

Detailed Description

A QgsGeometry with associated coordinate reference system.

Since
QGIS 3.16

Definition at line 152 of file qgsreferencedgeometry.h.

Constructor & Destructor Documentation

◆ QgsReferencedGeometry() [1/2]

QgsReferencedGeometry::QgsReferencedGeometry ( const QgsGeometry geometry,
const QgsCoordinateReferenceSystem crs 
)

Constructor for QgsReferencedGeometry, with the specified initial geometry and crs.

Definition at line 54 of file qgsreferencedgeometry.cpp.

◆ QgsReferencedGeometry() [2/2]

QgsReferencedGeometry::QgsReferencedGeometry ( )
default

Constructor for QgsReferencedGeometry.

Member Function Documentation

◆ fromReferencedPointXY()

QgsReferencedGeometry QgsReferencedGeometry::fromReferencedPointXY ( const QgsReferencedPointXY point)
static

Construct a new QgsReferencedGeometry from referenced point.

Definition at line 69 of file qgsreferencedgeometry.cpp.

◆ fromReferencedRect()

QgsReferencedGeometry QgsReferencedGeometry::fromReferencedRect ( const QgsReferencedRectangle rectangle)
static

Construct a new QgsReferencedGeometry from referenced rectangle.

Definition at line 74 of file qgsreferencedgeometry.cpp.

◆ operator QVariant()

QgsReferencedGeometry::operator QVariant ( ) const
inline

Allows direct construction of QVariants from geometry.

Definition at line 168 of file qgsreferencedgeometry.h.

◆ operator!=()

bool QgsReferencedGeometry::operator!= ( const QgsReferencedGeometry other) const

Definition at line 64 of file qgsreferencedgeometry.cpp.

◆ operator==()

bool QgsReferencedGeometry::operator== ( const QgsReferencedGeometry other) const

Definition at line 59 of file qgsreferencedgeometry.cpp.


The documentation for this class was generated from the following files: