Triangulation class

Interface for Triangulation classes.

Derived classes

class DualEdgeTriangulation
DualEdgeTriangulation is an implementation of a triangulation class based on the dual edge data structure.
class TriDecorator
Decorator class for Triangulations (s.

Public types

enum ForcedCrossBehavior { SnappingTypeVertex, DeleteFirst, InsertVertex }
Enumeration describing the behavior, if two forced lines cross.

Public static functions

static auto triangulationFields() -> QgsFields
Returns the fields output by features when calling saveTriangulation().

Public functions

void addLine(const QVector<QgsPoint>& points, QgsInterpolator::SourceType lineType) pure virtual
Adds a line (e.g.
auto addPoint(const QgsPoint& point) -> int pure virtual
Adds a point to the triangulation.
auto calcNormal(double x, double y, Vector3D* result) -> bool pure virtual
Calculates the normal at a point on the surface and assigns it to 'result'.
auto calcPoint(double x, double y, QgsPoint& result) -> bool pure virtual
Calculates x-, y and z-value of the point on the surface and assigns it to 'result'.
void eliminateHorizontalTriangles() pure virtual
Eliminates the horizontal triangles by swapping.
auto getNumberOfPoints() const -> int pure virtual
Returns the number of points.
auto getOppositePoint(int p1, int p2) -> int pure virtual
Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge).
auto getPoint(int i) const -> QgsPoint* pure virtual
Returns a pointer to the point with number i. Any virtual points must have the number -1.
auto getPointsAroundEdge(double x, double y) -> QList<int>* pure virtual
Returns a value list with the numbers of the four points, which would be affected by an edge swap.
auto getSurroundingTriangles(int pointno) -> QList<int> pure virtual
Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point.
auto getTriangle(double x, double y, QgsPoint& p1, int& n1, QgsPoint& p2, int& n2, QgsPoint& p3, int& n3) -> bool pure virtual
Finds out in which triangle the point with coordinates x and y is and assigns the numbers of the vertices to 'n1', 'n2' and 'n3' and the vertices to 'p1', 'p2' and 'p3'.
auto getTriangle(double x, double y, QgsPoint& p1, QgsPoint& p2, QgsPoint& p3) -> bool pure virtual
Finds out, in which triangle the point with coordinates x and y is and assigns the points at the vertices to 'p1', 'p2' and 'p3.
auto getXMax() const -> double pure virtual
Returns the largest x-coordinate value of the bounding box.
auto getXMin() const -> double pure virtual
Returns the smallest x-coordinate value of the bounding box.
auto getYMax() const -> double pure virtual
Returns the largest y-coordinate value of the bounding box.
auto getYMin() const -> double pure virtual
Returns the smallest x-coordinate value of the bounding box.
void performConsistencyTest() pure virtual
Performs a consistency check, remove this later.
auto pointInside(double x, double y) -> bool pure virtual
Returns true, if the point with coordinates x and y is inside the convex hull and false otherwise.
void ruppertRefinement() pure virtual
Adds points to make the triangles better shaped (algorithm of ruppert)
auto saveTriangulation(QgsFeatureSink* sink, QgsFeedback* feedback = nullptr) const -> bool pure virtual
Saves the triangulation features to a feature sink.
void setBreakEdgeColor(int r, int g, int b) pure virtual
Sets the color of the breaklines.
void setEdgeColor(int r, int g, int b) pure virtual
Sets the color of the normal edges.
void setForcedCrossBehavior(Triangulation::ForcedCrossBehavior b) pure virtual
Draws the points, edges and the forced lines.
void setForcedEdgeColor(int r, int g, int b) pure virtual
Sets the color of the forced edges.
void setTriangleInterpolator(TriangleInterpolator* interpolator) pure virtual
Sets an interpolator object.
auto swapEdge(double x, double y) -> bool pure virtual
Reads the content of a taff-file.

Enum documentation

enum Triangulation::ForcedCrossBehavior

Enumeration describing the behavior, if two forced lines cross.

Enumerators
SnappingTypeVertex

The second inserted forced line is snapped to the closest vertice of the first inserted forced line.

DeleteFirst

The status of the first inserted forced line is reset to that of a normal edge (so that the second inserted forced line remain and the first not)

InsertVertex

Function documentation

static QgsFields Triangulation::triangulationFields()

Returns the fields output by features when calling saveTriangulation().

These fields should be used when creating a suitable feature sink for saveTriangulation()

void Triangulation::addLine(const QVector<QgsPoint>& points, QgsInterpolator::SourceType lineType) pure virtual

Adds a line (e.g.

a break-, structure- or an isoline) to the triangulation, by specifying a list of source points.

int Triangulation::addPoint(const QgsPoint& point) pure virtual

Adds a point to the triangulation.

The point should have a z-value matching the value to interpolate.

bool Triangulation::calcNormal(double x, double y, Vector3D* result) pure virtual

Calculates the normal at a point on the surface and assigns it to 'result'.

Returns true in case of success and false in case of failure

bool Triangulation::calcPoint(double x, double y, QgsPoint& result) pure virtual

Calculates x-, y and z-value of the point on the surface and assigns it to 'result'.

Returns true in case of success and flase in case of failure

int Triangulation::getOppositePoint(int p1, int p2) pure virtual

Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge).

Returns -1 if point is a virtual point. Returns -10 if point crosses over edges.

QList<int>* Triangulation::getPointsAroundEdge(double x, double y) pure virtual

Returns a value list with the numbers of the four points, which would be affected by an edge swap.

This function is e.g. needed by NormVecDecorator to know the points, for which the normals have to be recalculated. The list has to be deleted by the code which calls this method

QList<int> Triangulation::getSurroundingTriangles(int pointno) pure virtual

Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point.

Four integer values describe a triangle, the first three are the number of the half edges of the triangle and the fourth is -10, if the third (and most counterclockwise) edge is a breakline, and -20 otherwise. Any virtual point needs to have the number -1

bool Triangulation::saveTriangulation(QgsFeatureSink* sink, QgsFeedback* feedback = nullptr) const pure virtual

Saves the triangulation features to a feature sink.

Returns true in case of success

The sink must be setup to accept LineString features, with fields matching those returned by triangulationFields().

void Triangulation::setForcedCrossBehavior(Triangulation::ForcedCrossBehavior b) pure virtual

Draws the points, edges and the forced lines.

Sets the behavior of the triangulation in case of crossing forced lines

bool Triangulation::swapEdge(double x, double y) pure virtual

Reads the content of a taff-file.

Saves the content to a taff file Swaps the edge which is closest to the point with x and y coordinates (if this is possible)