QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
17 #ifndef DUALEDGETRIANGULATION_H
18 #define DUALEDGETRIANGULATION_H
25 #include <QTextStream>
26 #include <QMessageBox>
28 #include <QStringList>
34 #include "qgis_analysis.h"
70 double getXMax()
const override {
return xMax; }
72 double getXMin()
const override {
return xMin; }
74 double getYMax()
const override {
return yMax; }
76 double getYMin()
const override {
return yMin; }
100 bool swapEdge(
double x,
double y )
override;
116 static const unsigned int DEFAULT_STORAGE_FOR_POINTS = 100000;
120 static const unsigned int DEFAULT_STORAGE_FOR_HALF_EDGES = 300006;
136 unsigned int insertEdge(
int dual,
int next,
int point,
bool mbreak,
bool forced );
142 static const int MAX_BASE_ITERATIONS = 300000;
144 int baseEdgeOfPoint(
int point );
146 int baseEdgeOfTriangle(
const QgsPoint &point );
148 bool checkSwap(
unsigned int edge,
unsigned int recursiveDeep );
150 void doSwap(
unsigned int edge,
unsigned int recursiveDeep );
152 void doOnlySwap(
unsigned int edge );
154 unsigned int mEdgeInside = 0;
156 unsigned int mEdgeOutside = 0;
158 unsigned int mEdgeWithPoint = 0;
160 unsigned int mUnstableEdge = 0;
162 int mTwiceInsPoint = 0;
164 bool swapPossible(
unsigned int edge );
166 void triangulatePolygon( QList<int> *poly, QList<int> *free,
int mainedge );
168 bool halfEdgeBBoxTest(
int edge,
double xlowleft,
double ylowleft,
double xupright,
double yupright )
const;
170 double swapMinAngle(
int edge )
const;
172 int splitHalfEdge(
int edge,
float position );
174 bool edgeOnConvexHull(
int edge );
176 void evaluateInfluenceRegion(
QgsPoint *point,
int edge, QSet<int> &set );
178 friend class TestQgsInterpolator;
184 : mEdgeColor( 0, 255, 0 )
185 , mForcedEdgeColor( 0, 0, 255 )
186 , mBreakEdgeColor( 100, 100, 0 )
194 : mEdgeColor( 0, 255, 0 )
195 , mForcedEdgeColor( 0, 0, 255 )
196 , mBreakEdgeColor( 100, 100, 0 )
197 , mDecorator( decorator ? decorator : this )
virtual bool pointInside(double x, double y)=0
Returns true, if the point with coordinates x and y is inside the convex hull and false otherwise.
virtual void performConsistencyTest()=0
Performs a consistency check, remove this later.
virtual bool saveTriangulation(QgsFeatureSink *sink, QgsFeedback *feedback=nullptr) const =0
Saves the triangulation features to a feature sink.
virtual void ruppertRefinement()=0
Adds points to make the triangles better shaped (algorithm of ruppert)
virtual bool calcNormal(double x, double y, Vector3D *result)=0
Calculates the normal at a point on the surface and assigns it to 'result'.
virtual void addLine(const QVector< QgsPoint > &points, QgsInterpolator::SourceType lineType)=0
Adds a line (e.g.
void setDecorator(Triangulation *d)
static const unsigned int DEFAULT_STORAGE_FOR_HALF_EDGES
Default value for the number of storable HalfEdges at the beginning.
virtual int getNumberOfPoints() const =0
Returns the number of points.
Point geometry type, with support for z-dimension and m-values.
virtual void setForcedCrossBehavior(Triangulation::ForcedCrossBehavior b)=0
Draws the points, edges and the forced lines.
bool halfEdgeBBoxTest(int edge, double xlowleft, double ylowleft, double xupright, double yupright) const
Tests, if the bounding box of the halfedge with index i intersects the specified bounding box....
virtual void setForcedEdgeColor(int r, int g, int b)=0
Sets the color of the forced edges.
virtual QgsPoint * getPoint(int i) const =0
Returns a pointer to the point with number i. Any virtual points must have the number -1.
@ DeleteFirst
The status of the first inserted forced line is reset to that of a normal edge (so that the second in...
double getYMin() const override
Returns the smallest x-coordinate value of the bounding box.
virtual void setBreakEdgeColor(int r, int g, int b)=0
Sets the color of the breaklines.
double getXMax() const override
Returns the largest x-coordinate value of the bounding box.
virtual QList< int > * getPointsAroundEdge(double x, double y)=0
Returns a value list with the numbers of the four points, which would be affected by an edge swap.
static const unsigned int DEFAULT_STORAGE_FOR_POINTS
Default value for the number of storable points at the beginning.
double getXMin() const override
Returns the smallest x-coordinate value of the bounding box.
QColor mEdgeColor
Color to paint the normal edges.
int getNumberOfPoints() const override
Returns the number of points.
double getYMax() const override
Returns the largest y-coordinate value of the bounding box.
QVector< HalfEdge * > mHalfEdge
Stores pointers to the HalfEdges.
ForcedCrossBehavior
Enumeration describing the behavior, if two forced lines cross.
virtual int getOppositePoint(int p1, int p2)=0
Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedg...
QColor mForcedEdgeColor
Color to paint the forced edges.
virtual void setTriangleInterpolator(TriangleInterpolator *interpolator)=0
Sets an interpolator object.
virtual bool getTriangle(double x, double y, QgsPoint &p1, int &n1, QgsPoint &p2, int &n2, QgsPoint &p3, int &n3)=0
Finds out in which triangle the point with coordinates x and y is and assigns the numbers of the vert...
virtual QList< int > getSurroundingTriangles(int pointno)=0
Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise...
virtual int addPoint(const QgsPoint &point)=0
Adds a point to the triangulation.
QgsPoint * getPoint(int i) const override
Draws the points, edges and the forced lines.
SourceType
Describes the type of input data.
virtual void setEdgeColor(int r, int g, int b)=0
Sets the color of the normal edges.
virtual bool swapEdge(double x, double y)=0
Reads the content of a taff-file.
virtual bool calcPoint(double x, double y, QgsPoint &result)=0
Calculates x-, y and z-value of the point on the surface and assigns it to 'result'.
virtual void eliminateHorizontalTriangles()=0
Eliminates the horizontal triangles by swapping.
QVector< QgsPoint * > mPointVector
Stores pointers to all points in the triangulations (including the points contained in the lines)
QColor mBreakEdgeColor
Color to paint the breaklines.