QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
 
 QgsReferencedGeometry (const QgsGeometry &geometry, const QgsCoordinateReferenceSystem &crs)
 Constructor for QgsReferencedGeometry, with the specified initial geometry and crs.
 
 operator QVariant () const
 Allows direct construction of QVariants from geometry.
 
bool operator!= (const QgsReferencedGeometry &other) const
 
bool operator== (const QgsReferencedGeometry &other) const
 
- Public Member Functions inherited from QgsGeometry
 QgsGeometry ()
 
 QgsGeometry (const QgsGeometry &)
 Copy constructor will prompt a shallow copy of the geometry.
 
 QgsGeometry (QgsAbstractGeometry *geom)
 Creates a geometry from an abstract geometry object.
 
 QgsGeometry (std::unique_ptr< QgsAbstractGeometry > geom)
 Creates a geometry from an abstract geometry object.
 
virtual ~QgsGeometry ()
 
Qgis::GeometryOperationResult addPart (const QgsGeometry &newPart)
 Adds a new island polygon to a multipolygon feature.
 
Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart (const QgsPointSequence &points, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
 Adds a new part to a the geometry.
 
Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart (const QVector< QgsPointXY > &points, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
 Adds a new part to a the geometry.
 
Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart (QgsAbstractGeometry *part, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
 Adds a new part to this geometry.
 
Qgis::GeometryOperationResult addPartV2 (const QgsPointSequence &points, Qgis::WkbType wkbType=Qgis::WkbType::Unknown)
 Adds a new part to a the geometry.
 
Qgis::GeometryOperationResult addPartV2 (const QVector< QgsPointXY > &points, Qgis::WkbType wkbType=Qgis::WkbType::Unknown)
 Adds a new part to a the geometry.
 
Qgis::GeometryOperationResult addPartV2 (QgsAbstractGeometry *part, Qgis::WkbType wkbType=Qgis::WkbType::Unknown)
 Adds a new part to this geometry.
 
Qgis::GeometryOperationResult addRing (const QVector< QgsPointXY > &ring)
 Adds a new ring to this geometry.
 
Qgis::GeometryOperationResult addRing (QgsCurve *ring)
 Adds a new ring to this geometry.
 
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.
 
void adjacentVertices (int atVertex, int &beforeVertex, int &afterVertex) const
 Returns the indexes of the vertices before and after the given vertex index.
 
double angleAtVertex (int vertex) const
 Returns the bisector angle for this geometry at the specified vertex.
 
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.
 
double area () const
 Returns the planar, 2-dimensional area of the geometry.
 
QVector< QgsGeometryasGeometryCollection () const
 Returns contents of the geometry as a list of geometries.
 
QString asJson (int precision=17) const
 Exports the geometry to a GeoJSON string.
 
virtual json asJsonObject (int precision=17) const
 Exports the geometry to a json object.
 
QgsMultiPointXY asMultiPoint () const
 Returns the contents of the geometry as a multi-point.
 
QgsMultiPolygonXY asMultiPolygon () const
 Returns the contents of the geometry as a multi-polygon.
 
QgsMultiPolylineXY asMultiPolyline () const
 Returns the contents of the geometry as a multi-linestring.
 
QgsPointXY asPoint () const
 Returns the contents of the geometry as a 2-dimensional point.
 
QgsPolygonXY asPolygon () const
 Returns the contents of the geometry as a polygon.
 
QgsPolylineXY asPolyline () const
 Returns the contents of the geometry as a polyline.
 
QPointF asQPointF () const
 Returns contents of the geometry as a QPointF if wkbType is WKBPoint, otherwise returns a null QPointF.
 
QPolygonF asQPolygonF () const
 Returns contents of the geometry as a QPolygonF.
 
QByteArray asWkb (QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const
 Export the geometry to WKB.
 
Q_INVOKABLE QString asWkt (int precision=17) const
 Exports the geometry to WKT.
 
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.
 
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.
 
QgsRectangle boundingBox () const
 Returns the bounding box of the geometry.
 
QgsBox3D boundingBox3D () const
 Returns the 3D bounding box of the geometry.
 
bool boundingBoxIntersects (const QgsGeometry &geometry) const
 Returns true if the bounding box of this geometry intersects with the bounding box of another geometry.
 
bool boundingBoxIntersects (const QgsRectangle &rectangle) const
 Returns true if the bounding box of this geometry intersects with a rectangle.
 
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.
 
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.
 
QgsGeometry centroid () const
 Returns the center of mass of a geometry.
 
QgsGeometry clipped (const QgsRectangle &rectangle)
 Clips the geometry using the specified rectangle.
 
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.
 
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.
 
double closestVertexWithContext (const QgsPointXY &point, int &atVertex) const
 Searches for the closest vertex in this geometry to the given point.
 
QVector< QgsGeometrycoerceToType (Qgis::WkbType type, double defaultZ=0, double defaultM=0) const
 Attempts to coerce this geometry into the specified destination type.
 
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).
 
QgsGeometry concaveHull (double targetPercent, bool allowHoles=false) const
 Returns a possibly concave polygon that contains all the points in the geometry.
 
QgsAbstractGeometry::const_part_iterator const_parts_begin () const
 Returns STL-style const iterator pointing to the first part of the geometry.
 
QgsAbstractGeometry::const_part_iterator const_parts_end () const
 Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
 
const QgsAbstractGeometryconstGet () const
 Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
QgsGeometryConstPartIterator constParts () const
 Returns Java-style iterator for traversal of parts of the geometry.
 
QgsGeometry constrainedDelaunayTriangulation () const
 Returns a constrained Delaunay triangulation for the vertices of the geometry.
 
bool contains (const QgsGeometry &geometry) const
 Returns true if the geometry completely contains another geometry.
 
bool contains (const QgsPointXY *p) const
 Returns true if the geometry contains the point p.
 
bool contains (double x, double y) const
 Returns true if the geometry contains the point at (x, y).
 
bool convertGeometryCollectionToSubclass (Qgis::GeometryType geomType)
 Converts geometry collection to a the desired geometry type subclass (multi-point, multi-linestring or multi-polygon).
 
bool convertToCurvedMultiType ()
 Converts a geometry into a multitype geometry of curve kind (when there is a corresponding curve type).
 
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.
 
bool convertToMultiType ()
 Converts single type geometry into multitype geometry e.g.
 
bool convertToSingleType ()
 Converts multi type geometry into single type geometry e.g.
 
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.
 
QgsGeometry convertToType (Qgis::GeometryType destType, bool destMultipart=false) const
 Try to convert the geometry to the requested type.
 
QgsGeometry convexHull () const
 Returns the smallest convex polygon that contains all the points in the geometry.
 
bool crosses (const QgsGeometry &geometry) const
 Returns true if the geometry crosses another geometry.
 
QgsGeometry delaunayTriangulation (double tolerance=0.0, bool edgesOnly=false) const
 Returns the Delaunay triangulation for the vertices of the geometry.
 
bool deletePart (int partNum)
 Deletes part identified by the part number.
 
bool deleteRing (int ringNum, int partNum=0)
 Deletes a ring in polygon or multipolygon.
 
bool deleteVertex (int atVertex)
 Deletes the vertex at the given position number and item (first number is index 0)
 
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.
 
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.
 
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.
 
bool disjoint (const QgsGeometry &geometry) const
 Returns true if the geometry is disjoint of another geometry.
 
double distance (const QgsGeometry &geom) const
 Returns the minimum distance between this geometry and another geometry.
 
double distanceToVertex (int vertex) const
 Returns the distance along this geometry from its first vertex to the specified vertex.
 
void draw (QPainter &p) const
 Draws the geometry onto a QPainter.
 
bool equals (const QgsGeometry &geometry) const
 Test if this geometry is exactly equal to another geometry.
 
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.
 
QgsGeometry extrude (double x, double y)
 Returns an extruded version of this geometry.
 
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.
 
QgsGeometry forcePolygonClockwise () const
 Forces geometries to respect the exterior ring is clockwise, interior rings are counter-clockwise convention.
 
QgsGeometry forcePolygonCounterClockwise () const
 Forces geometries to respect the exterior ring is counter-clockwise, interior rings are clockwise convention.
 
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.
 
double frechetDistance (const QgsGeometry &geom) const
 Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries.
 
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.
 
void fromWkb (const QByteArray &wkb)
 Set the geometry, feeding in the buffer containing OGC Well-Known Binary.
 
void fromWkb (unsigned char *wkb, int length)
 Set the geometry, feeding in the buffer containing OGC Well-Known Binary and the buffer's length.
 
QgsAbstractGeometryget ()
 Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
 
double hausdorffDistance (const QgsGeometry &geom) const
 Returns the Hausdorff distance between this geometry and geom.
 
double hausdorffDistanceDensify (const QgsGeometry &geom, double densifyFraction) const
 Returns the Hausdorff distance between this geometry and geom.
 
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.
 
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.
 
QgsGeometry interpolate (double distance) const
 Returns an interpolated point on the geometry at the specified distance.
 
double interpolateAngle (double distance) const
 Returns the angle parallel to the linestring or polygon boundary at the specified distance along the geometry.
 
QgsGeometry intersection (const QgsGeometry &geometry, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Returns a geometry representing the points shared by this geometry and other.
 
bool intersects (const QgsGeometry &geometry) const
 Returns true if this geometry exactly intersects with another geometry.
 
bool intersects (const QgsRectangle &rectangle) const
 Returns true if this geometry exactly intersects with a rectangle.
 
bool isAxisParallelRectangle (double maximumDeviation, bool simpleRectanglesOnly=false) const
 Returns true if the geometry is a polygon that is almost an axis-parallel rectangle.
 
bool isEmpty () const
 Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geometries).
 
bool isGeosEqual (const QgsGeometry &) const
 Compares the geometry with another geometry using GEOS.
 
bool isGeosValid (Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const
 Checks validity of the geometry using GEOS.
 
bool isMultipart () const
 Returns true if WKB of the geometry is of WKBMulti* type.
 
bool isNull () const
 Returns true if the geometry is null (ie, contains no underlying geometry accessible via get() or constGet() ).
 
bool isPolygonClockwise () const
 Returns True if the Polygon is clockwise.
 
bool isPolygonCounterClockwise () const
 Returns True if the Polygon is counter-clockwise.
 
bool isSimple () const
 Determines whether the geometry is simple (according to OGC definition), i.e.
 
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.
 
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.
 
double length () const
 Returns the planar, 2-dimensional length of geometry.
 
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.
 
QgsGeometry makeDifference (const QgsGeometry &other) const
 Returns the geometry formed by modifying this geometry such that it does not intersect the other geometry.
 
int makeDifferenceInPlace (const QgsGeometry &other)
 Changes this geometry such that it does not intersect the other geometry.
 
QgsGeometry makeValid (Qgis::MakeValidMethod method=Qgis::MakeValidMethod::Linework, bool keepCollapsed=false) const
 Attempts to make an invalid geometry valid without losing vertices.
 
void mapToPixel (const QgsMapToPixel &mtp)
 Transforms the geometry from map units to pixels in place.
 
QgsGeometry mergeLines () const
 Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings.
 
QgsGeometry minimalEnclosingCircle (QgsPointXY &center, double &radius, unsigned int segments=36) const
 Returns the minimal enclosing circle for the geometry.
 
QgsGeometry minimalEnclosingCircle (unsigned int segments=36) const
 Returns the minimal enclosing circle for the geometry.
 
double minimumClearance () const
 Computes the minimum clearance of a geometry.
 
QgsGeometry minimumClearanceLine () const
 Returns a LineString whose endpoints define the minimum clearance of a geometry.
 
QgsGeometry minimumWidth () const
 Returns a linestring geometry which represents the minimum diameter of the geometry.
 
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.
 
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.
 
QgsGeometry nearestPoint (const QgsGeometry &other) const
 Returns the nearest (closest) point on this geometry to another geometry.
 
QgsGeometry node () const
 Returns a (Multi)LineString representing the fully noded version of a collection of linestrings.
 
void normalize ()
 Reorganizes the geometry into a normalized form (or "canonical" form).
 
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.
 
 operator QVariant () const
 Allows direct construction of QVariants from geometry.
 
QgsGeometryoperator= (QgsGeometry const &rhs)
 Creates a shallow copy of the geometry.
 
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.
 
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.
 
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.
 
bool overlaps (const QgsGeometry &geometry) const
 Returns true if the geometry overlaps another geometry.
 
QgsGeometryPartIterator parts ()
 Returns Java-style iterator for traversal of parts of the geometry.
 
QgsAbstractGeometry::part_iterator parts_begin ()
 Returns STL-style iterator pointing to the first part of the geometry.
 
QgsAbstractGeometry::part_iterator parts_end ()
 Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
 
QgsGeometry pointOnSurface () const
 Returns a point guaranteed to lie on the surface of a geometry.
 
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.
 
Qgis::AngularDirection polygonOrientation () const
 Returns the orientation of the polygon.
 
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).
 
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.
 
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.
 
QgsGeometry removeInteriorRings (double minimumAllowedArea=-1) const
 Removes the interior rings from a (multi)polygon geometry.
 
bool requiresConversionToStraightSegments () const
 Returns true if the geometry is a curved geometry type which requires conversion to display as straight line segments.
 
Qgis::GeometryOperationResult reshapeGeometry (const QgsLineString &reshapeLineString)
 Replaces a part of this geometry with another line.
 
Qgis::GeometryOperationResult rotate (double rotation, const QgsPointXY &center)
 Rotate this geometry around the Z axis.
 
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.
 
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.
 
void set (QgsAbstractGeometry *geometry)
 Sets the underlying geometry store.
 
QgsGeometry sharedPaths (const QgsGeometry &other) const
 Find paths shared between the two given lineal geometries (this and other).
 
QgsGeometry shortestLine (const QgsGeometry &other) const
 Returns the shortest line joining this geometry to another geometry.
 
QgsGeometry simplify (double tolerance) const
 Returns a simplified version of this geometry using a specified tolerance value.
 
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).
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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))
 
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.
 
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.
 
QgsGeometry subdivide (int maxNodes=256, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Subdivides the geometry.
 
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.
 
QgsGeometry taperedBuffer (double startWidth, double endWidth, int segments) const
 Calculates a variable width buffer ("tapered buffer") for a (multi)curve geometry.
 
bool toggleCircularAtVertex (int atVertex)
 Converts the vertex at the given position from/to circular.
 
bool touches (const QgsGeometry &geometry) const
 Returns true if the geometry touches another geometry.
 
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.
 
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.
 
void transformVertices (const std::function< QgsPoint(const QgsPoint &) > &transform)
 Transforms the vertices from the geometry in place, applying the transform function to every vertex.
 
Qgis::GeometryOperationResult translate (double dx, double dy, double dz=0.0, double dm=0.0)
 Translates this geometry by dx, dy, dz and dm.
 
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.
 
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.
 
Qgis::GeometryType type () const
 Returns type of the geometry as a Qgis::GeometryType.
 
QgsGeometry unionCoverage () const
 Optimized union algorithm for polygonal inputs that are correctly noded and do not overlap.
 
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.
 
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.
 
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.
 
QgsPoint vertexAt (int atVertex) const
 Returns coordinates of a vertex.
 
bool vertexIdFromVertexNr (int number, QgsVertexId &id) const
 Calculates the vertex ID from a vertex number.
 
int vertexNrFromVertexId (QgsVertexId id) const
 Returns the vertex number corresponding to a vertex id.
 
QgsVertexIterator vertices () const
 Returns a read-only, Java-style iterator for traversal of vertices of all the geometry, including all geometry parts and rings.
 
QgsAbstractGeometry::vertex_iterator vertices_begin () const
 Returns STL-style iterator pointing to the first vertex of the geometry.
 
QgsAbstractGeometry::vertex_iterator vertices_end () const
 Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry.
 
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.
 
bool within (const QgsGeometry &geometry) const
 Returns true if the geometry is completely within another geometry.
 
int wkbSize (QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const
 Returns the length of the QByteArray returned by asWkb()
 
Qgis::WkbType wkbType () const
 Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
 
- Public Member Functions inherited from QgsReferencedGeometryBase
 QgsReferencedGeometryBase (const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Constructor for QgsReferencedGeometryBase, with the specified crs.
 
QgsCoordinateReferenceSystem crs () const
 Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the associated crs.
 

Static Public Member Functions

static QgsReferencedGeometry fromReferencedPointXY (const QgsReferencedPointXY &point)
 Construct a new QgsReferencedGeometry from referenced point.
 
static QgsReferencedGeometry fromReferencedRect (const QgsReferencedRectangle &rectangle)
 Construct a new QgsReferencedGeometry from referenced rectangle.
 
- 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.
 
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.
 
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.
 
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.
 
static void convertPointList (const QgsPointSequence &input, QVector< QgsPointXY > &output)
 Downgrades a point list from QgsPoint to QgsPointXY.
 
static void convertPointList (const QVector< QgsPointXY > &input, QgsPointSequence &output)
 Upgrades a point list from QgsPointXY to QgsPoint.
 
static QgsGeometryEnginecreateGeometryEngine (const QgsAbstractGeometry *geometry, double precision=0.0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlag::SkipEmptyInteriorRings)
 Creates and returns a new geometry engine representing the specified geometry using precision on a grid.
 
static Q_DECL_DEPRECATED QgsPolygonXY createPolygonFromQPolygonF (const QPolygonF &polygon)
 Creates a QgsPolygonXYfrom a QPolygonF.
 
static Q_DECL_DEPRECATED QgsPolylineXY createPolylineFromQPolygonF (const QPolygonF &polygon)
 Creates a QgsPolylineXY from a QPolygonF.
 
static QgsGeometry createWedgeBuffer (const QgsPoint &center, double azimuth, double angularWidth, double outerRadius, double innerRadius=0)
 Creates a wedge shaped buffer from a center point.
 
static QgsGeometry createWedgeBufferFromAngles (const QgsPoint &center, double startAngle, double endAngle, double outerRadius, double innerRadius=0)
 Creates a wedge shaped buffer from a center point.
 
static QgsGeometry fromBox3D (const QgsBox3D &box)
 Creates a new geometry from a QgsBox3D object Returns a 2D polygon geometry if the box is purely 2d, otherwise returns a polyhedral surface geometry.
 
static QgsGeometry fromMultiPointXY (const QgsMultiPointXY &multipoint)
 Creates a new geometry from a QgsMultiPointXY object.
 
static QgsGeometry fromMultiPolygonXY (const QgsMultiPolygonXY &multipoly)
 Creates a new geometry from a QgsMultiPolygonXY.
 
static QgsGeometry fromMultiPolylineXY (const QgsMultiPolylineXY &multiline)
 Creates a new geometry from a QgsMultiPolylineXY object.
 
static QgsGeometry fromPoint (const QgsPoint &point)
 Creates a new geometry from a QgsPoint object.
 
static QgsGeometry fromPointXY (const QgsPointXY &point)
 Creates a new geometry from a QgsPointXY object.
 
static QgsGeometry fromPolygonXY (const QgsPolygonXY &polygon)
 Creates a new geometry from a QgsPolygonXY.
 
static QgsGeometry fromPolyline (const QgsPolyline &polyline)
 Creates a new LineString geometry from a list of QgsPoint points.
 
static QgsGeometry fromPolylineXY (const QgsPolylineXY &polyline)
 Creates a new LineString geometry from a list of QgsPointXY points.
 
static QgsGeometry fromQPointF (QPointF point)
 Construct geometry from a QPointF.
 
static QgsGeometry fromQPolygonF (const QPolygonF &polygon)
 Construct geometry from a QPolygonF.
 
static QgsGeometry fromRect (const QgsRectangle &rect)
 Creates a new geometry from a QgsRectangle.
 
static Q_INVOKABLE QgsGeometry fromWkt (const QString &wkt)
 Creates a new geometry from a WKT string.
 
static QgsGeometry polygonize (const QVector< QgsGeometry > &geometries)
 Creates a GeometryCollection geometry containing possible polygons formed from the constituent linework of a set of geometries.
 
static QgsGeometry unaryUnion (const QVector< QgsGeometry > &geometries, const QgsGeometryParameters &parameters=QgsGeometryParameters())
 Compute the unary union on a list of geometries.
 

Additional Inherited Members

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

Detailed Description

A QgsGeometry with associated coordinate reference system.

Since
QGIS 3.16

Definition at line 148 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 55 of file qgsreferencedgeometry.cpp.

◆ QgsReferencedGeometry() [2/2]

QgsReferencedGeometry::QgsReferencedGeometry ( )
default

Member Function Documentation

◆ fromReferencedPointXY()

QgsReferencedGeometry QgsReferencedGeometry::fromReferencedPointXY ( const QgsReferencedPointXY point)
static

Construct a new QgsReferencedGeometry from referenced point.

Definition at line 70 of file qgsreferencedgeometry.cpp.

◆ fromReferencedRect()

QgsReferencedGeometry QgsReferencedGeometry::fromReferencedRect ( const QgsReferencedRectangle rectangle)
static

Construct a new QgsReferencedGeometry from referenced rectangle.

Definition at line 75 of file qgsreferencedgeometry.cpp.

◆ operator QVariant()

QgsReferencedGeometry::operator QVariant ( ) const
inline

Allows direct construction of QVariants from geometry.

Definition at line 161 of file qgsreferencedgeometry.h.

◆ operator!=()

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

Definition at line 65 of file qgsreferencedgeometry.cpp.

◆ operator==()

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

Definition at line 60 of file qgsreferencedgeometry.cpp.


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