Skip to content

Commit

Permalink
Remove Point3D
Browse files Browse the repository at this point in the history
... in favor of QgsPoint
Reference qgis/qgis4.0_api#71
  • Loading branch information
m-kuhn committed Jun 3, 2017
1 parent bf9021a commit 0f2a49d
Show file tree
Hide file tree
Showing 44 changed files with 619 additions and 808 deletions.
1 change: 0 additions & 1 deletion python/analysis/analysis.sip
Expand Up @@ -23,7 +23,6 @@
%Include interpolation/Node.sip
%Include interpolation/NormVecDecorator.sip
%Include interpolation/ParametricLine.sip
%Include interpolation/Point3D.sip
%Include interpolation/TriangleInterpolator.sip
%Include interpolation/Triangulation.sip
%Include interpolation/TriDecorator.sip
Expand Down
12 changes: 6 additions & 6 deletions python/analysis/interpolation/Bezier3D.sip
Expand Up @@ -8,7 +8,7 @@ class Bezier3D : ParametricLine
/** Default constructor*/
Bezier3D();
/** Constructor, par is a pointer to the parent, controlpoly a controlpolygon*/
Bezier3D( ParametricLine *par, QVector<Point3D*> *controlpoly );
Bezier3D( ParametricLine *par, QVector<QgsPoint*> *controlpoly );
/** Destructor*/
virtual ~Bezier3D();
/** Do not use this method, since a Bezier curve does not consist of other curves*/
Expand All @@ -17,26 +17,26 @@ class Bezier3D : ParametricLine
virtual void calcFirstDer( float t, Vector3D *v );
/** Calculates the second derivative and assigns it to v*/
virtual void calcSecDer( float t, Vector3D *v );
//virtual Point3D calcPoint(float t);
//virtual QgsPoint calcPoint(float t);
/** Calculates the point on the curve and assigns it to p*/
virtual void calcPoint( float t, Point3D *p );
virtual void calcPoint( float t, QgsPoint *p );
/** Changes the order of control points*/
virtual void changeDirection();
//virtual void draw(QPainter *p);
//virtual bool intersects(ParametricLine *pal);
/** Do not use this method, since a Bezier curve does not consist of other curves*/
virtual void remove( int i );
/** Returns a control point*/
virtual const Point3D *getControlPoint( int number ) const;
virtual const QgsPoint *getControlPoint( int number ) const;
/** Returns a pointer to the control polygon*/
virtual const QVector<Point3D*> *getControlPoly() const;
virtual const QVector<QgsPoint*> *getControlPoly() const;
/** Returns the degree of the curve*/
virtual int getDegree() const;
/** Returns the parent*/
virtual ParametricLine *getParent() const;
/** Sets the parent*/
virtual void setParent( ParametricLine *par );
/** Sets the control polygon*/
virtual void setControlPoly( QVector<Point3D*> *cp );
virtual void setControlPoly( QVector<QgsPoint*> *cp );

};
2 changes: 1 addition & 1 deletion python/analysis/interpolation/CloughTocherInterpolator.sip
Expand Up @@ -19,6 +19,6 @@ class CloughTocherInterpolator : TriangleInterpolator
/** Calculates the normal vector and assigns it to vec (not implemented at the moment)*/
virtual bool calcNormVec( double x, double y, Vector3D *result );
/** Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point*/
virtual bool calcPoint( double x, double y, Point3D *result );
virtual bool calcPoint( double x, double y, QgsPoint *result );
virtual void setTriangulation( NormVecDecorator *tin );
};
14 changes: 7 additions & 7 deletions python/analysis/interpolation/DualEdgeTriangulation.sip
Expand Up @@ -11,23 +11,23 @@ class DualEdgeTriangulation: Triangulation
/** Adds a line (e.g. a break-, structure- or an isoline) to the triangulation. The class takes ownership of the line object and its points*/
void addLine( Line3D *line /Transfer/, bool breakline );
/** Adds a point to the triangulation and returns the number of this point in case of success or -100 in case of failure*/
int addPoint( Point3D *p /Transfer/);
int addPoint( QgsPoint *p /Transfer/);
/** Performs a consistency check, remove this later*/
virtual void performConsistencyTest();
/** Calculates the normal at a point on the surface*/
virtual bool calcNormal( double x, double y, Vector3D *result );
/** Calculates x-, y and z-value of the point on the surface*/
virtual bool calcPoint( double x, double y, Point3D *result );
virtual bool calcPoint( double x, double y, QgsPoint *result );
/** Draws the points, edges and the forced lines*/
//virtual void draw(QPainter *p, double xlowleft, double ylowleft, double xupright, double yupright, double width, double height) const;
/** Returns a pointer to the point with number i*/
virtual Point3D *getPoint( unsigned int i ) const;
virtual QgsPoint *getPoint( unsigned int i ) const;
/** Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge)*/
int getOppositePoint( int p1, int p2 );
/** 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'*/
bool getTriangle( double x, double y, Point3D *p1, int *n1 /Out/, Point3D *p2 /Out/, int *n2 /Out/, Point3D *p3 /Out/, int *n3 /Out/ );
bool getTriangle( double x, double y, QgsPoint *p1, int *n1 /Out/, QgsPoint *p2 /Out/, int *n2 /Out/, QgsPoint *p3 /Out/, int *n3 /Out/ );
/** Finds out, in which triangle the point with coordinates x and y is and assigns addresses to the points at the vertices to 'p1', 'p2' and 'p3*/
bool getTriangle( double x, double y, Point3D *p1 /Out/, Point3D *p2 /Out/, Point3D *p3 /Out/ );
bool getTriangle( double x, double y, QgsPoint *p1 /Out/, QgsPoint *p2 /Out/, QgsPoint *p3 /Out/ );
/** 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. The value list has to be deleted by the code which called the method*/
QList<int> *getSurroundingTriangles( int pointno );
/** Returns the largest x-coordinate value of the bounding box*/
Expand Down Expand Up @@ -80,7 +80,7 @@ class DualEdgeTriangulation: Triangulation
/** Returns the number of an edge which points to the point with number 'point' or -1 if there is an error*/
int baseEdgeOfPoint( int point );
/** Returns the number of a HalfEdge from a triangle in which 'point' is in. If the number -10 is returned, this means, that 'point' is outside the convex hull. If -5 is returned, then numerical problems with the leftOfTest occurred (and the value of the possible edge is stored in the variable 'mUnstableEdge'. -20 means, that the inserted point is exactly on an edge (the number is stored in the variable 'mEdgeWithPoint'). -25 means, that the point is already in the triangulation (the number of the point is stored in the member 'mTwiceInsPoint'. If -100 is returned, this means that something else went wrong*/
int baseEdgeOfTriangle( Point3D *point );
int baseEdgeOfTriangle( QgsPoint *point );
/** Checks, if 'edge' has to be swapped because of the empty circle criterion. If so, doSwap(...) is called.*/
bool checkSwap( unsigned int edge, unsigned int recursiveDeep );
/** Swaps 'edge' and test recursively for other swaps (delaunay criterion)*/
Expand All @@ -100,5 +100,5 @@ class DualEdgeTriangulation: Triangulation
/** Returns true, if a half edge is on the convex hull and false otherwise*/
bool edgeOnConvexHull( int edge );
/** Function needed for the ruppert algorithm. Tests, if point is in the circle through both endpoints of edge and the endpoint of edge->dual->next->point. If so, the function calls itself recursively for edge->next and edge->next->next. Stops, if it finds a forced edge or a convex hull edge*/
void evaluateInfluenceRegion( Point3D *point, int edge, QSet<int> &set );
void evaluateInfluenceRegion( QgsPoint *point, int edge, QSet<int> &set );
};
2 changes: 1 addition & 1 deletion python/analysis/interpolation/LinTriangleInterpolator.sip
Expand Up @@ -13,7 +13,7 @@ class LinTriangleInterpolator : TriangleInterpolator
/** Calculates the normal vector and assigns it to vec*/
virtual bool calcNormVec( double x, double y, Vector3D *result );
/** Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point*/
virtual bool calcPoint( double x, double y, Point3D *result );
virtual bool calcPoint( double x, double y, QgsPoint *result );
/** Returns a pointer to the current Triangulation object*/
virtual DualEdgeTriangulation *getTriangulation() const;
/** Sets a Triangulation*/
Expand Down
6 changes: 3 additions & 3 deletions python/analysis/interpolation/Line3D.sip
Expand Up @@ -6,14 +6,14 @@ class Line3D /NoDefaultCtors/
public:
Line3D();
~Line3D();
/** Returns true, if the Line contains no Point3D, otherwise false*/
/** Returns true, if the Line contains no QgsPoint, otherwise false*/
bool empty() const;
/** Inserts a node behind the current position and sets the current position to this new node*/
void insertPoint( Point3D *p );
void insertPoint( QgsPoint *p );
/** Removes the point behind the current position*/
void removePoint();
/** Gets the point at the current position*/
Point3D *getPoint() const;
QgsPoint *getPoint() const;
/** Returns the current position*/
unsigned int getCurrent() const;
/** Returns the size of the line (the numbero of inserted Nodes without 'head' and 'z'*/
Expand Down
8 changes: 4 additions & 4 deletions python/analysis/interpolation/Node.sip
Expand Up @@ -11,10 +11,10 @@ class Node
// Node &operator=( const Node &n );
/** Returns a pointer to the next element in the linked list*/
Node *getNext() const;
/** Returns a pointer to the Point3D object associated with the node*/
Point3D *getPoint() const;
/** Returns a pointer to the QgsPoint object associated with the node*/
QgsPoint *getPoint() const;
/** Sets the pointer to the next node*/
void setNext( Node *n );
/** Sets a new pointer to an associated Point3D object*/
void setPoint( Point3D *p );
/** Sets a new pointer to an associated QgsPoint object*/
void setPoint( QgsPoint *p );
};
8 changes: 4 additions & 4 deletions python/analysis/interpolation/NormVecDecorator.sip
Expand Up @@ -11,13 +11,13 @@ class NormVecDecorator : TriDecorator
NormVecDecorator( Triangulation *tin );
virtual ~NormVecDecorator();
/** Adds a point to the triangulation*/
int addPoint( Point3D *p );
int addPoint( QgsPoint *p );
/** 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 calcNormal( double x, double y, Vector3D *result );
/** Calculates the normal of a triangle-point for the point with coordinates x and y. This is needed, if a point is on a break line and there is no unique normal stored in 'mNormVec'. Returns false, it something went wrong and true otherwise*/
bool calcNormalForPoint( double x, double y, int point, Vector3D *result );
/** 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*/
bool calcPoint( double x, double y, Point3D *result );
bool calcPoint( double x, double y, QgsPoint *result );
/** Eliminates the horizontal triangles by swapping or by insertion of new points. If alreadyestimated is true, a re-estimation of the normals will be done*/
virtual void eliminateHorizontalTriangles();
/** Estimates the first derivative a point. Return true in case of succes and false otherwise*/
Expand All @@ -27,11 +27,11 @@ class NormVecDecorator : TriDecorator
/** Returns a pointer to the normal vector for the point with the number n*/
Vector3D *getNormal( int n ) const;
/** Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p1, p2, p3 and the estimated normals to v1, v2, v3. The vectors are normally taken from 'mNormVec', except if p1, p2 or p3 is a point on a breakline. In this case, the normal is calculated on-the-fly. Returns false, if something went wrong and true otherwise*/
bool getTriangle( double x, double y, Point3D *p1 /Out/, Vector3D *v1 /Out/, Point3D *p2 /Out/, Vector3D *v2 /Out/, Point3D *p3 /Out/, Vector3D *v3 /Out/ );
bool getTriangle( double x, double y, QgsPoint *p1 /Out/, Vector3D *v1 /Out/, QgsPoint *p2 /Out/, Vector3D *v2 /Out/, QgsPoint *p3 /Out/, Vector3D *v3 /Out/ );
/** This function behaves similar to the one above. Additionally, the numbers of the points are returned (ptn1, ptn2, ptn3) as well as the PointStates of the triangle points (state1, state2, state3)
* @note not available in Python bindings
*/
//bool getTriangle( double x, double y, Point3D *p1 /Out/, int *ptn1 /Out/, Vector3D *v1 /Out/, PointState *state1 /Out/, Point3D *p2 /Out/, int *ptn2 /Out/, Vector3D *v2 /Out/, PointState *state2 /Out/, Point3D *p3 /Out/, int *ptn3 /Out/, Vector3D *v3 /Out/, PointState *state3 /Out/);
//bool getTriangle( double x, double y, QgsPoint *p1 /Out/, int *ptn1 /Out/, Vector3D *v1 /Out/, PointState *state1 /Out/, QgsPoint *p2 /Out/, int *ptn2 /Out/, Vector3D *v2 /Out/, PointState *state2 /Out/, QgsPoint *p3 /Out/, int *ptn3 /Out/, Vector3D *v3 /Out/, PointState *state3 /Out/);
/** Returns the state of the point with the number 'pointno'*/
PointState getState( int pointno ) const;
/** Sets an interpolator*/
Expand Down
12 changes: 6 additions & 6 deletions python/analysis/interpolation/ParametricLine.sip
Expand Up @@ -8,22 +8,22 @@ class ParametricLine
ParametricLine();
/** Constructor, par is a pointer to the parent object, controlpoly the controlpolygon
*/
ParametricLine( ParametricLine *par /Transfer/, QVector<Point3D*> *controlpoly );
ParametricLine( ParametricLine *par /Transfer/, QVector<QgsPoint*> *controlpoly );
/** Destructor*/
virtual ~ParametricLine();
virtual void add( ParametricLine *pl ) = 0;
virtual void calcFirstDer( float t, Vector3D *v ) = 0;
virtual void calcSecDer( float t, Vector3D *v ) = 0;
//virtual Point3D calcPoint(float t);
virtual void calcPoint( float t, Point3D* ) = 0;
//virtual QgsPoint calcPoint(float t);
virtual void calcPoint( float t, QgsPoint* ) = 0;
virtual void changeDirection() = 0;
//virtual void draw(QPainter *p);
virtual const Point3D *getControlPoint( int number ) const = 0;
virtual const QVector<Point3D*> *getControlPoly() const = 0;
virtual const QgsPoint *getControlPoint( int number ) const = 0;
virtual const QVector<QgsPoint*> *getControlPoly() const = 0;
virtual int getDegree() const = 0;
virtual ParametricLine *getParent() const = 0;
//virtual bool intersects(ParametricLine *pal);
virtual void remove( int i ) = 0;
virtual void setControlPoly( QVector<Point3D*> *cp ) = 0;
virtual void setControlPoly( QVector<QgsPoint*> *cp ) = 0;
virtual void setParent( ParametricLine *paral ) = 0;
};
29 changes: 0 additions & 29 deletions python/analysis/interpolation/Point3D.sip

This file was deleted.

10 changes: 5 additions & 5 deletions python/analysis/interpolation/TriDecorator.sip
Expand Up @@ -10,17 +10,17 @@ class TriDecorator : Triangulation
explicit TriDecorator( Triangulation *t );
virtual ~TriDecorator();
virtual void addLine( Line3D *line, bool breakline );
virtual int addPoint( Point3D *p );
virtual int addPoint( QgsPoint *p );
/** Adds an association to a triangulation*/
virtual void addTriangulation( Triangulation *t );
/** Performs a consistency check, remove this later*/
virtual void performConsistencyTest();
virtual bool calcNormal( double x, double y, Vector3D *result );
virtual bool calcPoint( double x, double y, Point3D *result );
virtual Point3D *getPoint( unsigned int i ) const;
virtual bool calcPoint( double x, double y, QgsPoint *result );
virtual QgsPoint *getPoint( unsigned int i ) const;
virtual int getNumberOfPoints() const;
bool getTriangle( double x, double y, Point3D *p1, int *n1 /Out/, Point3D *p2 /Out/, int *n2 /Out/, Point3D *p3 /Out/, int *n3 /Out/ );
bool getTriangle( double x, double y, Point3D *p1 /Out/, Point3D *p2 /Out/, Point3D *p3 /Out/ );
bool getTriangle( double x, double y, QgsPoint *p1, int *n1 /Out/, QgsPoint *p2 /Out/, int *n2 /Out/, QgsPoint *p3 /Out/, int *n3 /Out/ );
bool getTriangle( double x, double y, QgsPoint *p1 /Out/, QgsPoint *p2 /Out/, QgsPoint *p3 /Out/ );
virtual int getOppositePoint( int p1, int p2 );
virtual QList<int> *getSurroundingTriangles( int pointno );
virtual double getXMax() const;
Expand Down
2 changes: 1 addition & 1 deletion python/analysis/interpolation/TriangleInterpolator.sip
Expand Up @@ -8,5 +8,5 @@ class TriangleInterpolator
/** Calculates the normal vector and assigns it to vec*/
virtual bool calcNormVec( double x, double y, Vector3D *result ) = 0;
/** Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point*/
virtual bool calcPoint( double x, double y, Point3D *result ) = 0;
virtual bool calcPoint( double x, double y, QgsPoint *result ) = 0;
};
10 changes: 5 additions & 5 deletions python/analysis/interpolation/Triangulation.sip
Expand Up @@ -27,7 +27,7 @@ class Triangulation
* Adds a point to the triangulation
* Ownership is transferred to this class
*/
virtual int addPoint( Point3D *p ) = 0;
virtual int addPoint( QgsPoint *p ) = 0;

/**
* Calculates the normal at a point on the surface and assigns it to 'result'.
Expand All @@ -42,18 +42,18 @@ class Triangulation
* 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
*/
virtual bool calcPoint( double x, double y, Point3D *result ) = 0;
virtual bool calcPoint( double x, double y, QgsPoint *result ) = 0;

/** Returns a pointer to the point with number i. Any virtual points must have the number -1*/
virtual Point3D *getPoint( unsigned int i ) const = 0;
virtual QgsPoint *getPoint( unsigned int i ) const = 0;

/** 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'
*/
virtual bool getTriangle( double x, double y, Point3D *p1, int *n1 /Out/, Point3D *p2 /Out/, int *n2 /Out/, Point3D *p3 /Out/, int *n3 /Out/ ) = 0;
virtual bool getTriangle( double x, double y, QgsPoint *p1, int *n1 /Out/, QgsPoint *p2 /Out/, int *n2 /Out/, QgsPoint *p3 /Out/, int *n3 /Out/ ) = 0;

/** 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*/
virtual bool getTriangle( double x, double y, Point3D *p1 /Out/, Point3D *p2 /Out/, Point3D *p3 /Out/ ) = 0;
virtual bool getTriangle( double x, double y, QgsPoint *p1 /Out/, QgsPoint *p2 /Out/, QgsPoint *p3 /Out/ ) = 0;

/** Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge)*/
virtual int getOppositePoint( int p1, int p2 ) = 0;
Expand Down
1 change: 0 additions & 1 deletion python/auto_sip.blacklist
Expand Up @@ -212,7 +212,6 @@ analysis/interpolation/Line3D.sip
analysis/interpolation/Node.sip
analysis/interpolation/NormVecDecorator.sip
analysis/interpolation/ParametricLine.sip
analysis/interpolation/Point3D.sip
analysis/interpolation/TriangleInterpolator.sip
analysis/interpolation/Triangulation.sip
analysis/interpolation/TriDecorator.sip
Expand Down
2 changes: 0 additions & 2 deletions src/analysis/CMakeLists.txt
Expand Up @@ -16,7 +16,6 @@ SET(QGIS_ANALYSIS_SRCS
interpolation/NormVecDecorator.cc
interpolation/Node.cc
interpolation/ParametricLine.cc
interpolation/Point3D.cc
interpolation/TriangleInterpolator.cc
interpolation/Triangulation.cc
interpolation/TriDecorator.cc
Expand Down Expand Up @@ -129,7 +128,6 @@ SET(QGIS_ANALYSIS_HDRS
interpolation/ParametricLine.h
interpolation/CloughTocherInterpolator.h
interpolation/TriangleInterpolator.h
interpolation/Point3D.h
interpolation/Vector3D.h
interpolation/DualEdgeTriangulation.h
interpolation/Node.h
Expand Down

0 comments on commit 0f2a49d

Please sign in to comment.