QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
Bezier3D.h
Go to the documentation of this file.
1/***************************************************************************
2 Bezier3D.h - description
3 -------------------
4 copyright : (C) 2004 by Marco Hugentobler
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 BEZIER3D_H
18#define BEZIER3D_H
19
20#include "ParametricLine.h"
21#include "qgis_analysis.h"
22#include "qgslogger.h"
23
24#include <QString>
25
26using namespace Qt::StringLiterals;
27
28#define SIP_NO_FILE
29
37class ANALYSIS_EXPORT Bezier3D : public ParametricLine
38{
39 protected:
40 public:
41 Bezier3D() = default;
43 Bezier3D( ParametricLine *par, QVector<QgsPoint *> *controlpoly );
44
46 void add( ParametricLine *pl SIP_TRANSFER ) override;
48 void calcFirstDer( float t, Vector3D *v SIP_OUT ) override;
50 void calcSecDer( float t, Vector3D *v SIP_OUT ) override;
51 //virtual QgsPoint calcPoint(float t);
53 void calcPoint( float t, QgsPoint *p SIP_OUT ) override;
55 void changeDirection() override;
56 //virtual void draw(QPainter* p);
57 //virtual bool intersects(ParametricLine* pal);
59 void remove( int i ) override;
61 const QgsPoint *getControlPoint( int number ) const override;
63 const QVector<QgsPoint *> *getControlPoly() const override;
65 int getDegree() const override;
67 ParametricLine *getParent() const override;
69 void setParent( ParametricLine *par ) override;
71 void setControlPoly( QVector<QgsPoint *> *cp ) override;
72};
73
74#ifndef SIP_RUN
75
76//-----------------------------------------------constructors, destructor and assignment operator------------------------------
77
78inline Bezier3D::Bezier3D( ParametricLine *parent, QVector<QgsPoint *> *controlpoly )
79 : ParametricLine( parent, controlpoly )
80{
81 mDegree = mControlPoly->count() - 1;
82}
83
84//----------------------------------------------invalid methods add and remove (because of inheritance from ParametricLine)
85
86inline void Bezier3D::add( ParametricLine *pl )
87{
88 Q_UNUSED( pl )
89 QgsDebugError( u"Error!!!!! A Bezier-curve can not be parent of a ParametricLine."_s );
90}
91
92inline void Bezier3D::remove( int i )
93{
94 Q_UNUSED( i )
95 QgsDebugError( u"Error!!!!! A Bezier-curve has no children to remove."_s );
96}
97
98//-----------------------------------------------setters and getters---------------------------------------------------------------
99
100inline const QgsPoint *Bezier3D::getControlPoint( int number ) const
101{
102 return ( *mControlPoly )[number - 1];
103}
104
105inline const QVector<QgsPoint *> *Bezier3D::getControlPoly() const
106{
107 return mControlPoly;
108}
109
110inline int Bezier3D::getDegree() const
111{
112 return mDegree;
113}
114
116{
117 return mParent;
118}
119
121{
122 mParent = par;
123}
124
125inline void Bezier3D::setControlPoly( QVector<QgsPoint *> *cp )
126{
127 mControlPoly = cp;
128 mDegree = mControlPoly->count() - 1;
129}
130
131#endif
132
133#endif
void remove(int i) override
Do not use this method, since a Bezier curve does not consist of other curves.
Definition Bezier3D.h:92
void add(ParametricLine *pl) override
Do not use this method, since a Bezier curve does not consist of other curves.
Definition Bezier3D.h:86
const QgsPoint * getControlPoint(int number) const override
Returns a control point.
Definition Bezier3D.h:100
Bezier3D()=default
const QVector< QgsPoint * > * getControlPoly() const override
Returns a pointer to the control polygon.
Definition Bezier3D.h:105
ParametricLine * getParent() const override
Returns the parent.
Definition Bezier3D.h:115
void setParent(ParametricLine *par) override
Sets the parent.
Definition Bezier3D.h:120
int getDegree() const override
Returns the degree of the curve.
Definition Bezier3D.h:110
void setControlPoly(QVector< QgsPoint * > *cp) override
Sets the control polygon.
Definition Bezier3D.h:125
virtual const QVector< QgsPoint * > * getControlPoly() const =0
virtual void setParent(ParametricLine *paral)=0
virtual void remove(int i)=0
int mDegree
Degree of the parametric Line.
virtual void changeDirection()=0
virtual int getDegree() const =0
virtual void calcSecDer(float t, Vector3D *v)=0
virtual void add(ParametricLine *pl)=0
virtual const QgsPoint * getControlPoint(int number) const =0
ParametricLine * mParent
Pointer to the parent object. If there isn't one, mParent is 0.
virtual void calcFirstDer(float t, Vector3D *v)=0
virtual void setControlPoly(QVector< QgsPoint * > *cp)=0
QVector< QgsPoint * > * mControlPoly
MControlPoly stores the points of the control polygon.
virtual ParametricLine * getParent() const =0
virtual void calcPoint(float t, QgsPoint *p)=0
ParametricLine()=default
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
Represents a 3D-Vector, capable of storing x, y and z-coordinates in double values.
Definition Vector3D.h:37
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_OUT
Definition qgis_sip.h:58
#define QgsDebugError(str)
Definition qgslogger.h:59