-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a new geometry class for Triangle geometries Methods include orthocenter, bisectors, medians, medial, circumscribed (center, radius), inscribed (center, radius) Also adds make_triangle expression function for creating triangles
- Loading branch information
1 parent
0710fb5
commit fb3d07f
Showing
15 changed files
with
1,624 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
class QgsTriangle : public QgsPolygonV2 | ||
{ | ||
%TypeHeaderCode | ||
#include <qgstriangle.h> | ||
%End | ||
|
||
public: | ||
QgsTriangle(); | ||
QgsTriangle( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3 ); | ||
explicit QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ); | ||
explicit QgsTriangle( const QPointF p1, const QPointF p2, const QPointF p3 ); | ||
|
||
// inherited: bool operator==( const QgsTriangle& other ) const; | ||
// inherited: bool operator!=( const QgsTriangle& other ) const; | ||
|
||
virtual QString geometryType() const; | ||
virtual QgsTriangle* clone() const /Factory/; | ||
void clear(); | ||
|
||
virtual bool fromWkb( QgsConstWkbPtr& wkbPtr ); | ||
bool fromWkt( const QString &wkt ); | ||
// inherited: QString asWkt( int precision = 17 ) const; | ||
// inherited: QDomElement asGML2( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const; | ||
// inherited: QDomElement asGML3( QDomDocument& doc, int precision = 17, const QString& ns = "gml" ) const; | ||
// inherited: QString asJSON( int precision = 17 ) const; | ||
|
||
QgsPolygonV2* surfaceToPolygon() const /Factory/; | ||
QgsAbstractGeometry* toCurveType() const /Factory/; | ||
|
||
//overridden to handle LineString25D rings | ||
virtual void setExteriorRing( QgsCurve* ring /Transfer/ ); | ||
virtual QgsAbstractGeometry* boundary() const /Factory/; | ||
// inherited: double pointDistanceToBoundary( double x, double y ) const; | ||
QgsPointV2 vertexAt( int atVertex ) const; | ||
|
||
void addInteriorRing( QgsCurve* ring /Transfer/ ); // NOTE: no interior ring for triangle. | ||
bool deleteVertex( QgsVertexId position ); | ||
bool insertVertex( QgsVertexId position, const QgsPointV2 &vertex ); | ||
bool moveVertex( QgsVertexId vId, const QgsPointV2& newPos ); | ||
|
||
QVector<double> lengths() const; | ||
QVector<double> angles() const; | ||
|
||
bool isIsocele( double lengthTolerance = 0.0001 ) const; | ||
bool isEquilateral( double lengthTolerance = 0.0001 ) const; | ||
bool isRight( double angleTolerance = 0.0001 ) const; | ||
bool isScalene( double lengthTolerance = 0.0001 ) const; | ||
|
||
QVector<QgsLineString> altitudes( ) const; | ||
QVector<QgsLineString> medians( ) const; | ||
QVector<QgsLineString> bisectors( double lengthTolerance = 0.0001 ) const; | ||
|
||
QgsTriangle medial( ) const; | ||
QgsPointV2 orthocenter( double lengthTolerance = 0.0001 ) const; | ||
QgsPointV2 circumscribedCenter( ) const; | ||
double circumscribedRadius( ) const; | ||
// TODO: | ||
// QgsCircle circumscribedCircle ( ) const; // need QgsCircle (from CADDigitize.CADCircle) | ||
QgsPointV2 inscribedCenter( ) const; | ||
double inscribedRadius( ) const; | ||
// TODO: | ||
// QgsCircle inscribedCircle ( ) const; // need QgsCircle (from CADDigitize.CADCircle) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.