QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgstriangle.h
Go to the documentation of this file.
1/***************************************************************************
2 qgstriangle.h
3 -------------------
4 begin : January 2017
5 copyright : (C) 2017 by Loïc Bartoletti
6 email : lbartoletti at tuxfamily dot org
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSTRIANGLE_H
19#define QGSTRIANGLE_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgspolygon.h"
24#include "qgscircle.h"
25#include "qgslinestring.h"
26
32class CORE_EXPORT QgsTriangle : public QgsPolygon
33{
34 public:
35
40
47 QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) SIP_HOLDGIL;
48
55 explicit QgsTriangle( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3 ) SIP_HOLDGIL;
56
63 explicit QgsTriangle( QPointF p1, QPointF p2, QPointF p3 ) SIP_HOLDGIL;
64
65 bool operator==( const QgsAbstractGeometry &other ) const override SIP_HOLDGIL;
66 bool operator!=( const QgsAbstractGeometry &other ) const override SIP_HOLDGIL;
67
68 QString geometryType() const override SIP_HOLDGIL;
69 QgsTriangle *clone() const override SIP_FACTORY;
70 void clear() override;
71
72 bool fromWkb( QgsConstWkbPtr &wkbPtr ) override;
73
74 bool fromWkt( const QString &wkt ) override;
75
76 // inherited: QString asWkt( int precision = 17 ) const;
77 // inherited (as a polygon): QDomElement asGML2( QDomDocument &doc, int precision = 17, const QString &ns = "gml" ) const;
78 QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const override;
79
80 QgsPolygon *surfaceToPolygon() const override SIP_FACTORY;
81
82 QgsCurvePolygon *toCurveType() const override SIP_FACTORY;
83
85 void addInteriorRing( QgsCurve *ring SIP_TRANSFER ) override;
86
91 void setInteriorRings( const QVector< QgsCurve *> &rings ) = delete; // cppcheck-suppress duplInheritedMember
93 bool deleteVertex( QgsVertexId position ) override;
95 bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
96 bool moveVertex( QgsVertexId vId, const QgsPoint &newPos ) override;
97
98 void setExteriorRing( QgsCurve *ring SIP_TRANSFER ) override;
99
100 QgsCurve *boundary() const override SIP_FACTORY;
101
102 // inherited: double pointDistanceToBoundary( double x, double y ) const;
103
104
105#ifdef __clang__
106#pragma clang diagnostic push
107#pragma clang diagnostic ignored "-Woverloaded-virtual"
108#endif
109
115 QgsPoint vertexAt( int atVertex ) const SIP_HOLDGIL;
116#ifdef __clang__
117#pragma clang diagnostic pop
118#endif
119
135 QVector<double> lengths() const SIP_HOLDGIL;
136
152 QVector<double> angles() const SIP_HOLDGIL;
153
175 bool isDegenerate() const SIP_HOLDGIL;
176
195 bool isIsocele( double lengthTolerance = 0.0001 ) const SIP_HOLDGIL;
196
215 bool isEquilateral( double lengthTolerance = 0.0001 ) const SIP_HOLDGIL;
216
235 bool isRight( double angleTolerance = 0.0001 ) const SIP_HOLDGIL;
236
255 bool isScalene( double lengthTolerance = 0.0001 ) const SIP_HOLDGIL;
256
272 QVector<QgsLineString> altitudes() const SIP_HOLDGIL;
273
289 QVector<QgsLineString> medians() const SIP_HOLDGIL;
290
307 QVector<QgsLineString> bisectors( double lengthTolerance = 0.0001 ) const SIP_HOLDGIL;
308
324 QgsTriangle medial() const SIP_HOLDGIL;
325
342 QgsPoint orthocenter( double lengthTolerance = 0.0001 ) const SIP_HOLDGIL;
343
359 QgsPoint circumscribedCenter() const SIP_HOLDGIL;
360
376 double circumscribedRadius() const SIP_HOLDGIL;
377
393 QgsCircle circumscribedCircle() const SIP_HOLDGIL;
394
411 QgsPoint inscribedCenter() const SIP_HOLDGIL;
412
428 double inscribedRadius() const SIP_HOLDGIL;
429
445 QgsCircle inscribedCircle() const SIP_HOLDGIL;
446
447#ifndef SIP_RUN
448
455 inline static const QgsTriangle *cast( const QgsAbstractGeometry *geom ) // cppcheck-suppress duplInheritedMember
456 {
457 if ( geom && QgsWkbTypes::flatType( geom->wkbType() ) == Qgis::WkbType::Triangle )
458 return static_cast<const QgsTriangle *>( geom );
459 return nullptr;
460 }
461#endif
462
464
465
466};
467#endif // QGSTRIANGLE_H
@ Triangle
Triangle.
Abstract base class for all geometries.
AxisOrder
Axis order for GML generation.
@ XY
X comes before Y (or lon before lat)
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
Circle geometry type.
Definition qgscircle.h:43
A const WKB pointer.
Definition qgswkbptr.h:138
Curve polygon geometry type.
bool moveVertex(QgsVertexId position, const QgsPoint &newPos) override
Moves a vertex within the geometry.
bool operator!=(const QgsAbstractGeometry &other) const override
QgsPoint vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id.
bool insertVertex(QgsVertexId position, const QgsPoint &vertex) override
Inserts a vertex into the geometry.
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
bool deleteVertex(QgsVertexId position) override
Deletes a vertex within the geometry.
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.
bool operator==(const QgsAbstractGeometry &other) const override
Abstract base class for curved geometry type.
Definition qgscurve.h:35
Line string geometry type, with support for z-dimension and m-values.
A class to represent a 2D point.
Definition qgspointxy.h:60
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
Polygon geometry type.
Definition qgspolygon.h:33
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)
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.
QString geometryType() const override
Returns a unique string representing the geometry type.
QgsAbstractGeometry * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
QgsPolygon * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
bool fromWkb(QgsConstWkbPtr &wkb) override
Sets the geometry from a WKB string.
QgsPolygon * surfaceToPolygon() const override
Gets a polygon representation of this surface.
Triangle geometry type.
Definition qgstriangle.h:33
static const QgsTriangle * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsTriangle.
void setInteriorRings(const QVector< QgsCurve * > &rings)=delete
Inherited method not used.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_HOLDGIL
Definition qgis_sip.h:171
#define SIP_FACTORY
Definition qgis_sip.h:76
int precision
Utility class for identifying a unique vertex within a geometry.
Definition qgsvertexid.h:30