QGIS API Documentation  2.99.0-Master (19b062c)
Triangulation.h
Go to the documentation of this file.
1 /***************************************************************************
2  Triangulation.h - description
3  -------------------
4  copyright : (C) 2004 by Marco Hugentobler
5  email : [email protected]
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef TRIANGULATION_H
18 #define TRIANGULATION_H
19 
20 #include <QList>
21 #include "qgis.h"
22 #include <QPainter>
23 #include "TriangleInterpolator.h"
24 #include "qgis_analysis.h"
25 #include "qgsinterpolator.h"
26 
27 class QgsFeatureSink;
28 class QgsFields;
29 class QgsFeedback;
30 
31 #define SIP_NO_FILE
32 
38 class ANALYSIS_EXPORT Triangulation
39 {
40  public:
43  {
46  InsertVertex
47  };
48  virtual ~Triangulation() = default;
49 
54  virtual void addLine( const QVector< QgsPoint > &points, QgsInterpolator::SourceType lineType ) = 0;
55 
61  virtual int addPoint( const QgsPoint &point ) = 0;
62 
67  virtual bool calcNormal( double x, double y, Vector3D *result SIP_OUT ) = 0;
68 
70  virtual void performConsistencyTest() = 0;
71 
76  virtual bool calcPoint( double x, double y, QgsPoint &result SIP_OUT ) = 0;
77 
79  virtual QgsPoint *getPoint( int i ) const = 0;
80 
85  virtual bool getTriangle( double x, double y, QgsPoint &p1 SIP_OUT, int &n1 SIP_OUT, QgsPoint &p2 SIP_OUT, int &n2 SIP_OUT, QgsPoint &p3 SIP_OUT, int &n3 SIP_OUT ) = 0 SIP_PYNAME( getTriangleVertices );
86 
88  virtual bool getTriangle( double x, double y, QgsPoint &p1 SIP_OUT, QgsPoint &p2 SIP_OUT, QgsPoint &p3 SIP_OUT ) = 0;
89 
96  virtual int getOppositePoint( int p1, int p2 ) = 0;
97 
99  virtual double getXMax() const = 0;
100 
102  virtual double getXMin() const = 0;
103 
105  virtual double getYMax() const = 0;
106 
108  virtual double getYMin() const = 0;
109 
111  virtual int getNumberOfPoints() const = 0;
112 
119  virtual QList<int> getSurroundingTriangles( int pointno ) = 0;
120 
127  virtual QList<int> *getPointsAroundEdge( double x, double y ) = 0;
128 
130  //virtual void draw(QPainter* p, double xlowleft, double ylowleft, double xupright, double yupright, double width, double height) const=0;
131 
133  virtual void setForcedCrossBehavior( Triangulation::ForcedCrossBehavior b ) = 0;
134 
136  virtual void setEdgeColor( int r, int g, int b ) = 0;
137 
139  virtual void setForcedEdgeColor( int r, int g, int b ) = 0;
140 
142  virtual void setBreakEdgeColor( int r, int g, int b ) = 0;
143 
145  virtual void setTriangleInterpolator( TriangleInterpolator *interpolator ) = 0;
146 
148  virtual void eliminateHorizontalTriangles() = 0;
149 
151  virtual void ruppertRefinement() = 0;
152 
154  virtual bool pointInside( double x, double y ) = 0;
155 
157  //virtual bool readFromTAFF(QString fileName)=0;
158 
160  //virtual bool saveToTAFF(QString fileName) const=0;
161 
163  virtual bool swapEdge( double x, double y ) = 0;
164 
172  static QgsFields triangulationFields();
173 
185  virtual bool saveTriangulation( QgsFeatureSink *sink, QgsFeedback *feedback = nullptr ) const = 0;
186 };
187 
188 #endif
The status of the first inserted forced line is reset to that of a normal edge (so that the second in...
Definition: Triangulation.h:45
An interface for objects which accept features via addFeature(s) methods.
Container of fields for a vector layer.
Definition: qgsfields.h:42
SourceType
Describes the type of input data.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
Definition: qgsfeedback.h:44
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
Definition: Vector3D.h:33
This is an interface for interpolator classes for triangulations.
Interface for Triangulation classes.
Definition: Triangulation.h:38
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
The second inserted forced line is snapped to the closest vertice of the first inserted forced line...
Definition: Triangulation.h:44
#define SIP_OUT
Definition: qgis_sip.h:51
ForcedCrossBehavior
Enumeration describing the behavior, if two forced lines cross.
Definition: Triangulation.h:42
#define SIP_PYNAME(name)
Definition: qgis_sip.h:74