44  return QStringLiteral( 
"Polygon" );
 
   49  auto result = std::make_unique< QgsPolygon >();
 
   51  return result.release();
 
  102  for ( 
int i = 0; i < nRings; ++i )
 
  104    std::unique_ptr< QgsLineString > line( 
new QgsLineString() );
 
  105    line->fromWkbPoints( ringType, wkbPtr );
 
  126  int binarySize = 
sizeof( char ) + 
sizeof( quint32 ) + 
sizeof( quint32 );
 
  135    binarySize += 
sizeof( quint32 ) + curve->numPoints() * ( 2 + curve->is3D() + curve->isMeasure() ) * 
sizeof( 
double );
 
  169  wkb << static_cast<quint32>( type );
 
  181    curve->points( pts );
 
  201  QgsLineString *lineString = qgsgeometry_cast< QgsLineString *>( ring );
 
  202  if ( lineString && !lineString->
isClosed() )
 
  234  QgsLineString *lineString = qgsgeometry_cast< QgsLineString *>( ring );
 
  235  if ( lineString && !lineString->
isClosed() )
 
  267    multiLine->
reserve( nInteriorRings + 1 );
 
  269    for ( 
int i = 0; i < nInteriorRings; ++i )
 
  280    return std::numeric_limits< double >::quiet_NaN();
 
  283  double minimumDistance = std::numeric_limits<double>::max();
 
  284  double minDistX = 0.0;
 
  285  double minDistY = 0.0;
 
  288  for ( 
int ringIndex = 0; ringIndex < numRings; ++ringIndex )
 
  293    for ( 
int i = 0, j = len - 1; i < len; j = i++ )
 
  295      double aX = ring->
xAt( i );
 
  296      double aY = ring->
yAt( i );
 
  297      double bX = ring->
xAt( j );
 
  298      double bY = ring->
yAt( j );
 
  300      if ( ( ( aY > y ) != ( bY > y ) ) &&
 
  301           ( x < ( bX - aX ) * ( y - aY ) / ( bY - aY ) + aX ) )
 
  304      minimumDistance = std::min( minimumDistance, 
QgsGeometryUtils::sqrDistToLine( x, y, aX, aY, bX, bY, minDistX, minDistY, 4 * std::numeric_limits<double>::epsilon() ) );
 
  308  return ( inside ? 1 : -1 ) * std::sqrt( minimumDistance );
 
  323    for ( 
int i = 0; i < nInteriorRings; ++i )
 
Abstract base class for all geometries.
 
virtual bool convertTo(QgsWkbTypes::Type type)
Converts the geometry to a specified type.
 
virtual bool hasCurvedSegments() const
Returns true if the geometry contains curved segments.
 
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns the WKB type of the geometry.
 
@ FlagExportTrianglesAsPolygons
Triangles should be exported as polygon geometries.
 
QgsWkbTypes::Type mWkbType
 
void setZMTypeFromSubGeometry(const QgsAbstractGeometry *subggeom, QgsWkbTypes::Type baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values.
 
static endian_t endian()
Returns whether this machine uses big or little endian.
 
QgsWkbTypes::Type readHeader() const
readHeader
 
Curve polygon geometry type.
 
QVector< QgsCurve * > mInteriorRings
 
void clear() override
Clears the geometry, ie reset it to a null geometry.
 
virtual void setExteriorRing(QgsCurve *ring)
Sets the exterior ring of the polygon.
 
virtual void addInteriorRing(QgsCurve *ring)
Adds an interior ring to the geometry (takes ownership)
 
std::unique_ptr< QgsCurve > mExteriorRing
 
Abstract base class for curved geometry type.
 
QgsCurve * segmentize(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a geometry without curves.
 
virtual QgsLineString * curveToLine(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const =0
Returns a new line string geometry corresponding to a segmentized approximation of the curve.
 
void reserve(int size) SIP_HOLDGIL
Attempts to allocate memory for at least size geometries.
 
static void pointsToWKB(QgsWkbPtr &wkb, const QgsPointSequence &points, bool is3D, bool isMeasure)
Returns a LinearRing { uint32 numPoints; Point points[numPoints]; }.
 
static double sqrDistToLine(double ptX, double ptY, double x1, double y1, double x2, double y2, double &minDistX, double &minDistY, double epsilon) SIP_HOLDGIL
Returns the squared distance between a point and a line.
 
Line string geometry type, with support for z-dimension and m-values.
 
bool isClosed() const override SIP_HOLDGIL
Returns true if the curve is closed.
 
int numPoints() const override SIP_HOLDGIL
Returns the number of points in the curve.
 
double yAt(int index) const override
Returns the y-coordinate of the specified node in the line string.
 
void close()
Closes the line string by appending the first point to the end of the line, if it is not already clos...
 
double xAt(int index) const override
Returns the x-coordinate of the specified node in the line string.
 
Multi line string geometry collection.
 
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success.
 
QgsCurvePolygon * toCurveType() const override
Returns the geometry converted to the more generic curve type QgsCurvePolygon.
 
void setExteriorRing(QgsCurve *ring) override
Sets the exterior ring of the polygon.
 
void addInteriorRing(QgsCurve *ring) override
Adds an interior ring to the geometry (takes ownership)
 
int wkbSize(QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const override
Returns the length of the QByteArray returned by asWkb()
 
QgsPolygon() SIP_HOLDGIL
Constructor for an empty polygon geometry.
 
QByteArray asWkb(QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const override
 
QgsPolygon * clone() const override
Clones the geometry by performing a deep copy.
 
void clear() override
Clears the geometry, ie reset it to a null geometry.
 
double pointDistanceToBoundary(double x, double y) const
Returns the distance from a point to the boundary of the polygon (either the exterior ring or any clo...
 
QgsAbstractGeometry * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
 
friend class QgsCurvePolygon
 
QgsPolygon * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
 
QString geometryType() const override SIP_HOLDGIL
Returns a unique string representing the geometry type.
 
bool fromWkb(QgsConstWkbPtr &wkb) override
Sets the geometry from a WKB string.
 
QgsPolygon * surfaceToPolygon() const override
Gets a polygon representation of this surface.
 
void clearCache() const override
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
 
Type
The WKB type describes the number of dimensions a geometry has.
 
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.
 
QVector< QgsPoint > QgsPointSequence