Developer documentation | Axl-2.5.1

axlSurfaceRevolution.cpp
Go to the documentation of this file.
1 //Author: Hung NGUYEN 9:17 AM 20/05/2014
2 
3 
4 
5 #include "axlSurfaceRevolution.h"
6 
7 
8 
9 #include <dtkCoreSupport/dtkGlobal.h>
10 
11 
12 
13 class axlSurfaceRevolutionPrivate
14 
15 {
16 
17 public:
18 
19  axlLine *axe;
20 
21  QList<axlAbstractCurve *> curves;
22 
23  double theta1;
24 
25  double theta2;
26 
27 
28 
29 };
30 
31 axlSurfaceRevolution::axlSurfaceRevolution(QObject *parent) : axlAbstractSurface(), d(new axlSurfaceRevolutionPrivate)
32 {
33 
34  /*this->setObjectName(this->identifier());
35 
36 
37 
38  d->axe = new axlLine(new axlLine);
39 
40  d->p2 = new axlPoint(1.0, 0.0, 0.0);
41 
42  d->radius = 1.0;*/
43 
44 };
45 axlSurfaceRevolution::axlSurfaceRevolution(axlLine *axe,QList<axlAbstractCurve *> curves,double theta1, double theta2, QObject *parent) : axlAbstractSurface(), d(new axlSurfaceRevolutionPrivate)
46 {
47  /*qDebug()<<"create a object axlSurfacerevolution";*/
48  this->setObjectName(this->identifier());
49 
50  d->axe = new axlLine(*axe);
51 
52  for(int i = 0; i<curves.size(); i++)
53  {
54  d->curves.append(curves.value(i));
55  }
56 
57  d->theta1 = theta1;
58  d->theta2 = theta2;
59 }
60 
62 
63 {
64 
65  delete d;
66 
67 d = NULL;
68 
69 }
70 
71 
72 
74 
75 {
76 
77 this->setObjectName(this->identifier());
78 
79 this->setParent(other.parent());
80 
81 d->axe = other.d->axe;
82 
83 d->curves = other.d->curves;
84 
85 
86 d->theta1 = other.d->theta1;
87 
88 d->theta2 = other.d->theta2;
89 
90 return (*this);
91 
92 }
93 
94 
95 
97 
98 {
99 
100 QString result = "axlSurfaceRevolution";
101 
102 result.append("\nAxe : "+d->axe->description() + "\nCurves : ");
103 for(int i = 0; i<d->curves.size(); i++)
104 {
105  result.append( "curve "+ QString::number(i) + " : " + d->curves.at(i)->identifier());
106 }
107 
108 result.append( "\nStart Angle : "+ QString::number(d->theta1)+"\nEnd Angle : "+ QString::number(d->theta2) /*+ "\nReference Point : "+ d->referencePoint->description()*/);
109 
110 return result;
111 
112 }
113 
114 
115 
117 
118 {
119 
120 return "axlSurfaceRevolution";
121 
122 }
123 
124 
125 
127 
128 {
129 
130 return d->axe;
131 
132 }
133 
134 
135 
136 QList<axlAbstractCurve *> axlSurfaceRevolution::getCurves()
137 
138 {
139 
140 return d->curves;
141 
142 }
143 
145 
146 {
147 
148 return d->theta1;
149 
150 }
151 
153 
154 {
155 
156 return d->theta2;
157 
158 }
159 
160 
161 
162 
163 
165 
166 {
167 
168  d->axe = new axlLine(*line);
169 
170 }
171 
173 {
174  d->axe = new axlLine(point1,point2);
175 }
176 
178 {
179  return d->curves.size();
180 }
181 
182 void axlSurfaceRevolution::setCurves(QList<axlAbstractCurve *> curves)
183 
184 {
185  for(int i = 0; i<curves.size() ; i++)
186  {
187  d->curves.append(curves.value(i));
188  }
189 }
190 
192 {
193  return d->curves.value(id);
194 }
195 
197 
198 {
199 
200  d->theta1 = ang;
201 
202 }
203 
204 
205 
207 
208 {
209 
210  d->theta2 = ang;
211 
212 }
213 
214 
215 
216 void axlSurfaceRevolution::setAngle(double startAngle,double endAngle)
217 
218 {
219 
220  d->theta1 = startAngle;
221 
222  d->theta2 = endAngle;
223 
224 }
225 
226 
227 dtkAbstractData *createaxlSurfaceRevolution(void)
228 
229 {
230 
231 return new axlSurfaceRevolution;
232 
233 }
234 
235 
236 
Class axlPoint defines 3D points.
Definition: axlPoint.h:34
Class axlLine defines 3D lines.
Definition: axlLine.h:35
void setStartAngle(double ang)
axlSurfaceRevolution & operator=(const axlSurfaceRevolution &other)
QList< axlAbstractCurve * > getCurves()
axlSurfaceRevolution(QObject *parent=0)
void setAxe(axlLine *line)
void setCurves(QList< axlAbstractCurve * > curves)
void setAngle(double startAngle, double endAngle)
virtual QString description(void) const
dtkAbstractData * createaxlSurfaceRevolution(void)
axlAbstractCurve * getCurve(int id)
virtual QString identifier(void) const