34  const QVector< double > x { p1.
x(), p2.
x(), p3.
x(), p1.
x() };
 
   35  const QVector< double > y { p1.
y(), p2.
y(), p3.
y(), p1.
y() };
 
   39    z = { p1.
z(), p2.
z(), p3.
z(), p1.
z() };
 
   44    m = {p1.
m(), p2.
m(), p3.
m(), p1.
m() };
 
   53  const QVector< double > x { p1.
x(), p2.
x(), p3.
x(), p1.
x() };
 
   54  const QVector< double > y {p1.
y(), p2.
y(), p3.
y(), p1.
y() };
 
   63  const QVector< double > x{ p1.x(), p2.x(), p3.x(), p1.x() };
 
   64  const QVector< double > y{ p1.y(), p2.y(), p3.y(), p1.y() };
 
   71  const QgsTriangle *otherTriangle = qgsgeometry_cast< const QgsTriangle * >( &other );
 
   96  return QStringLiteral( 
"Triangle" );
 
  101  auto result = std::make_unique< QgsTriangle >();
 
  103  return result.release();
 
  157  line->fromWkbPoints( ringType, wkbPtr );
 
  174  QString secondWithoutParentheses = 
parts.second;
 
  175  secondWithoutParentheses = secondWithoutParentheses.simplified().remove( 
' ' );
 
  176  if ( ( 
parts.second.compare( QLatin1String( 
"EMPTY" ), Qt::CaseInsensitive ) == 0 ) ||
 
  177       secondWithoutParentheses.isEmpty() )
 
  180  const QString defaultChildWkbType = QStringLiteral( 
"LineString%1%2" ).arg( 
is3D() ? QStringLiteral( 
"Z" ) : QString(), 
isMeasure() ? QStringLiteral( 
"M" ) : QString() );
 
  183  for ( 
const QString &childWkt : blocks )
 
  230  QDomElement elemTriangle = doc.createElementNS( ns, QStringLiteral( 
"Triangle" ) );
 
  235  QDomElement elemExterior = doc.createElementNS( ns, QStringLiteral( 
"exterior" ) );
 
  237  if ( curveElem.tagName() == QLatin1String( 
"LineString" ) )
 
  239    curveElem.setTagName( QStringLiteral( 
"LinearRing" ) );
 
  241  elemExterior.appendChild( curveElem );
 
  242  elemTriangle.appendChild( elemExterior );
 
  254  std::unique_ptr<QgsCurvePolygon> curvePolygon( 
new QgsCurvePolygon() );
 
  257  return curvePolygon.release();
 
  294  const bool success = 
mExteriorRing->moveVertex( vId, newPos );
 
  394  const double a = l[1];
 
  395  const double b = l[2];
 
  396  const double c = l[0];
 
  398  const double a2 = a * a;
 
  399  const double b2 = b * b;
 
  400  const double c2 = 
c * 
c;
 
  402  const double alpha = acos( ( b2 + c2 - a2 ) / ( 2 * b * 
c ) );
 
  403  const double beta = acos( ( a2 + c2 - b2 ) / ( 2 * a * 
c ) );
 
  404  const double gamma = M_PI - alpha - beta; 
 
  428  const QVector<double> sides = 
lengths();
 
  429  const bool ab_bc = 
qgsDoubleNear( sides.at( 0 ), sides.at( 1 ), lengthTolerance );
 
  430  const bool bc_ca = 
qgsDoubleNear( sides.at( 1 ), sides.at( 2 ), lengthTolerance );
 
  431  const bool ca_ab = 
qgsDoubleNear( sides.at( 2 ), sides.at( 0 ), lengthTolerance );
 
  433  return ( ab_bc || bc_ca || ca_ab );
 
  440  const QVector<double> sides = 
lengths();
 
  441  const bool ab_bc = 
qgsDoubleNear( sides.at( 0 ), sides.at( 1 ), lengthTolerance );
 
  442  const bool bc_ca = 
qgsDoubleNear( sides.at( 1 ), sides.at( 2 ), lengthTolerance );
 
  443  const bool ca_ab = 
qgsDoubleNear( sides.at( 2 ), sides.at( 0 ), lengthTolerance );
 
  445  return ( ab_bc && bc_ca && ca_ab );
 
  452  QVector<double> a = 
angles();
 
  453  QVector<double>::iterator ita = a.begin();
 
  454  while ( ita != a.end() )
 
  472  QVector<QgsLineString> alt;
 
  485  QVector<QgsLineString> med;
 
  504  QVector<QgsLineString> bis;
 
  513  bool intersection = 
false;
 
  546  const QVector<QgsLineString> alt = 
altitudes();
 
  584  const QVector<double> l = 
lengths();
 
  585  const double x = ( l.at( 0 ) * 
vertexAt( 2 ).
x() +
 
  588  const double y = ( l.at( 0 ) * 
vertexAt( 2 ).
y() +
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ LineStringM
LineStringM.
 
@ LineStringZM
LineStringZM.
 
@ LineStringZ
LineStringZ.
 
Abstract base class for all geometries.
 
bool is3D() const SIP_HOLDGIL
Returns true if the geometry is 3D and contains a z-value.
 
AxisOrder
Axis order for GML generation.
 
void setZMTypeFromSubGeometry(const QgsAbstractGeometry *subggeom, Qgis::WkbType baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values.
 
virtual QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML3 representation of the geometry.
 
virtual bool hasCurvedSegments() const
Returns true if the geometry contains curved segments.
 
QgsGeometryConstPartIterator parts() const
Returns Java-style iterator for traversal of parts of the geometry.
 
bool isMeasure() const SIP_HOLDGIL
Returns true if the geometry contains m values.
 
Qgis::WkbType readHeader() const
readHeader
 
Curve polygon geometry type.
 
bool isEmpty() const override SIP_HOLDGIL
Returns true if the geometry is empty.
 
bool addZValue(double zValue=0) override
Adds a z-dimension to the geometry, initialized to a preset value.
 
virtual QgsPolygon * toPolygon(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a new polygon geometry corresponding to a segmentized approximation of the curve.
 
QVector< QgsCurve * > mInteriorRings
 
const QgsCurve * exteriorRing() const SIP_HOLDGIL
Returns the curve polygon's exterior ring.
 
bool addMValue(double mValue=0) override
Adds a measure to the geometry, initialized to a preset value.
 
double area() const override SIP_HOLDGIL
Returns the planar, 2-dimensional area of the geometry.
 
double perimeter() const override SIP_HOLDGIL
Returns the planar, 2-dimensional perimeter of the geometry.
 
std::unique_ptr< QgsCurve > mExteriorRing
 
Abstract base class for curved geometry type.
 
virtual int numPoints() const =0
Returns the number of points in the curve.
 
QgsCurve * segmentize(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a geometry without curves.
 
virtual bool isClosed() const SIP_HOLDGIL
Returns true if the curve is closed.
 
static QgsPoint midpoint(const QgsPoint &pt1, const QgsPoint &pt2) SIP_HOLDGIL
Returns a middle point between points pt1 and pt2.
 
static QStringList wktGetChildBlocks(const QString &wkt, const QString &defaultType=QString())
Parses a WKT string and returns of list of blocks contained in the WKT.
 
static bool segmentIntersection(const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint, bool &isIntersection, double tolerance=1e-8, bool acceptImproperIntersection=false) SIP_HOLDGIL
Compute the intersection between two segments.
 
static void circleCenterRadius(const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double &radius, double ¢erX, double ¢erY) SIP_HOLDGIL
Returns radius and center of the circle through pt1, pt2, pt3.
 
static QPair< Qgis::WkbType, QString > wktReadBlock(const QString &wkt)
Parses a WKT block of the format "TYPE( contents )" and returns a pair of geometry type to contents (...
 
static QgsLineString perpendicularSegment(const QgsPoint &p, const QgsPoint &s1, const QgsPoint &s2) SIP_HOLDGIL
Create a perpendicular line segment from p to segment [s1, s2].
 
static bool transferFirstZOrMValueToPoint(Iterator verticesBegin, Iterator verticesEnd, QgsPoint &point)
A Z or M dimension is added to point if one of the points in the list points contains Z or M value.
 
static int leftOfLine(const double x, const double y, const double x1, const double y1, const double x2, const double y2) SIP_HOLDGIL
Returns a value < 0 if the point (x, y) is left of the line from (x1, y1) -> (x2, y2).
 
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.
 
void setPoints(size_t size, const double *x, const double *y, const double *z=nullptr, const double *m=nullptr)
Resets the line string to match the specified point data.
 
void close()
Closes the line string by appending the first point to the end of the line, if it is not already clos...
 
A class to represent a 2D point.
 
Point geometry type, with support for z-dimension and m-values.
 
void clear() override
Clears the geometry, ie reset it to a null geometry.
 
friend class QgsCurvePolygon
 
void clearCache() const override
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
 
QgsTriangle medial() const SIP_HOLDGIL
Medial (or midpoint) triangle of a triangle ABC is the triangle with vertices at the midpoints of the...
 
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
 
QgsPolygon * surfaceToPolygon() const override
Gets a polygon representation of this surface.
 
bool isEquilateral(double lengthTolerance=0.0001) const SIP_HOLDGIL
Is the triangle equilateral (three sides with the same length)?
 
void clear() override
Clears the geometry, ie reset it to a null geometry.
 
void setExteriorRing(QgsCurve *ring) override
Sets the exterior ring of the polygon.
 
QgsCurve * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
 
QVector< double > angles() const SIP_HOLDGIL
Returns the three angles of the triangle.
 
QgsPoint circumscribedCenter() const SIP_HOLDGIL
Center of the circumscribed circle of the triangle.
 
QgsTriangle * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
 
bool deleteVertex(QgsVertexId position) override
Inherited method not used. You cannot delete or insert a vertex directly. Returns always false.
 
QgsTriangle * clone() const override
Clones the geometry by performing a deep copy.
 
QgsCircle circumscribedCircle() const SIP_HOLDGIL
Circumscribed circle of the triangle.
 
bool operator!=(const QgsAbstractGeometry &other) const override SIP_HOLDGIL
 
bool isRight(double angleTolerance=0.0001) const SIP_HOLDGIL
Is the triangle right-angled?
 
bool moveVertex(QgsVertexId vId, const QgsPoint &newPos) override
Moves a vertex within the geometry.
 
QgsCircle inscribedCircle() const SIP_HOLDGIL
Inscribed circle of the triangle.
 
QgsCurvePolygon * toCurveType() const override
Returns the geometry converted to the more generic curve type QgsCurvePolygon.
 
bool isScalene(double lengthTolerance=0.0001) const SIP_HOLDGIL
Is the triangle scalene (all sides have different lengths)?
 
bool operator==(const QgsAbstractGeometry &other) const override SIP_HOLDGIL
 
void addInteriorRing(QgsCurve *ring) override
Inherited method not used. You cannot add an interior ring into a triangle.
 
QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", QgsAbstractGeometry::AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const override
Returns a GML3 representation of the geometry.
 
QgsPoint vertexAt(int atVertex) const SIP_HOLDGIL
Returns coordinates of a vertex.
 
bool insertVertex(QgsVertexId position, const QgsPoint &vertex) override
Inherited method not used. You cannot delete or insert a vertex directly. Returns always false.
 
QVector< QgsLineString > bisectors(double lengthTolerance=0.0001) const SIP_HOLDGIL
The segment (defined by a QgsLineString) returned bisect the angle of a vertex to the opposite side.
 
QgsPoint orthocenter(double lengthTolerance=0.0001) const SIP_HOLDGIL
An orthocenter is the point of intersection of the altitudes of a triangle.
 
bool isDegenerate() const SIP_HOLDGIL
Convenient method checking if the geometry is degenerate (have duplicate or colinear point(s)).
 
double inscribedRadius() const SIP_HOLDGIL
Radius of the inscribed circle of the triangle.
 
QString geometryType() const override SIP_HOLDGIL
Returns a unique string representing the geometry type.
 
QgsPoint inscribedCenter() const SIP_HOLDGIL
Center of the inscribed circle of the triangle.
 
QVector< QgsLineString > altitudes() const SIP_HOLDGIL
An altitude is a segment (defined by a QgsLineString) from a vertex to the opposite side (or,...
 
double circumscribedRadius() const SIP_HOLDGIL
Radius of the circumscribed circle of the triangle.
 
QgsTriangle() SIP_HOLDGIL
Constructor for an empty triangle geometry.
 
QVector< double > lengths() const SIP_HOLDGIL
Returns the three lengths of the triangle.
 
QVector< QgsLineString > medians() const SIP_HOLDGIL
A median is a segment (defined by a QgsLineString) from a vertex to the midpoint of the opposite side...
 
bool isIsocele(double lengthTolerance=0.0001) const SIP_HOLDGIL
Is the triangle isocele (two sides with the same length)?
 
bool fromWkb(QgsConstWkbPtr &wkbPtr) override
Sets the geometry from a WKB string.
 
static Qgis::GeometryType geometryType(Qgis::WkbType type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
 
static Qgis::WkbType flatType(Qgis::WkbType type) SIP_HOLDGIL
Returns the flat type for a WKB type.
 
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
QVector< QgsPoint > QgsPointSequence
 
Utility class for identifying a unique vertex within a geometry.