Developer documentation | Axl-2.5.1

axlFieldParametricCurve.cpp
Go to the documentation of this file.
1 /* axlFieldParametricCurve.cpp ---
2  *
3  * Author: Anais Ducoffe
4  * Copyright (C) 2013 - Anais Ducoffe, Inria.
5  */
6 
7 /* Commentary:
8  *
9  */
10 
11 /* Change log:
12  *
13  */
14 #include <sstream>
15 
17 #include "axlAbstractProcess.h"
18 
19 #include <dtkCoreSupport/dtkGlobal.h>
20 
21 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
22 #include <dtkCoreSupport/dtkAbstractProcessFactory.h>
23 
26 
27 class axlFieldParametricCurvePrivate
28 {
29 public:
33 
36 };
37 
38 // /////////////////////////////////////////////////////////////////
39 // axlFieldParametricCurve implementation
40 // /////////////////////////////////////////////////////////////////
41 
43 
47 {
48  d->input = NULL;
49  d->function = NULL;
50  this->setObjectName(this->identifier());
51 }
52 
53 
54 
56 
60 {
61  delete d;
62 
63  d = NULL;
64 }
65 
66 
67 
70 // *
71 // */
72 //void axlFieldParametricCurve::setType(axlFieldParametricCurve::Type type)
73 //{
74 
75 // d->type = type;
76 //}
77 
80 // *
81 // */
82 //void axlFieldParametricCurve::setKind(axlFieldParametricCurve::Kind kind)
83 //{
84 
85 // d->kind = kind;
86 //}
87 
90 // *
91 // */
92 //void axlFieldParametricCurve::setSupport(axlFieldParametricCurve::Support support)
93 //{
94 // d->support = support;
95 //}
96 
97 
98 //axlFieldParametricCurve::Type axlFieldParametricCurve::type(void)
99 //{
100 // return d->type;
101 //}
102 
103 //axlFieldParametricCurve::Kind axlFieldParametricCurve::kind(void)
104 //{
105 // return d->kind;
106 //}
107 
108 //axlFieldParametricCurve::Support axlFieldParametricCurve::support(void)
109 //{
110 // return d->support;
111 //}
112 
114 
117 double axlFieldParametricCurve::scalar(double u, double v, double w)
118 {
119  if(!(this->kind() == Scalar)) {
120  qDebug() << "Getting scalar value on non scalar field.";
121  return 0;
122  }
123  return d->function->eval(u).x();
124 
125 
126 
127 }
128 
130 
133 double *axlFieldParametricCurve::vector(double u, double v, double w)
134 {
135  if(!(this->kind() == Vector)) {
136  qDebug() << "Getting vector value on non vector field.";
137  return NULL;
138  }
139  return d->function->eval(u).coordinates();
140 
141 }
142 
144 
147 double *axlFieldParametricCurve::tensor(double u, double v, double w)
148 {
149  if(!(this->kind() == Tensor)) {
150  qDebug() << "Getting tensor value on non tensor field.";
151  return NULL;
152  }
153  return NULL;
154 }
155 
158 // *
159 // */
160 //QString axlFieldParametricCurve::name(void)
161 //{
162 // return this->name() ;
163 //}
164 
167 // *
168 // */
169 //void axlFieldParametricCurve::setName(QString name)
170 //{
171 // this->setObjectName(name);
172 
173 //}
174 
176 
181 {
182  QString qstr;
183 
184  qstr.append("axlFieldParametricCurve : \n");
185 
186  switch(d->type){
188  qstr.append("Type : integer");
189  break;
191  qstr.append("Type : Float");
192  break;
194  qstr.append("Type : Double");
195  break;
196  default:
197  qDebug() << "Unsupported field type";
198  }
199 
200 
201  switch(d->kind) {
203  qstr.append(";Kind : Scalar");
204  break;
206  qstr.append(";Kind : Vector");
207  break;
209  qstr.append(";Kind : Tensor");
210  break;
211  default:
212  qDebug() << ";Unsupported field kind";
213  }
214 
215  switch(d->support) {
217  qstr.append(";Support : Point");
218  break;
220  qstr.append(";Support : Cell");
221  break;
223  qstr.append(";Support : Custom");
224  break;
225  default:
226  qDebug() << ";No support";
227  }
228 
229  return qstr;
230 
231 }
232 
233 
235 
240 {
241  return "axlFieldParametricCurve";
242 }
243 
245 
249  if(dynamic_cast<axlAbstractCurveParametric*>(data))
250  d->function = dynamic_cast<axlAbstractCurveParametric*>(data);
251 }
252 
254 
258  return d->function;
259 
260 }
261 
263 
267  if(dynamic_cast<axlAbstractCurveParametric *>(data))
268  d->input = dynamic_cast<axlAbstractCurveParametric *>(data);
269 }
270 
271 
273 
277  return d->input->startParam();
278 }
279 
280 
281 
283 
287  return d->input->endParam();
288 }
289 
290 
291 
293 
297  return d->input->numSamples();
298 }
299 
300 
302 
306  return d->input->numSamples();
307 }
308 
309 
310 
313 
317 {
318  emit updated();
319 }
320 
321 // /////////////////////////////////////////////////////////////////
322 // axlFieldBSpline documentation
323 // /////////////////////////////////////////////////////////////////
324 
331 // /////////////////////////////////////////////////////////////////
332 // Type instanciation
333 // /////////////////////////////////////////////////////////////////
334 
335 dtkAbstractData *createaxlFieldParametricCurve(void)
336 {
337  return new axlFieldParametricCurve();
338 }
339 
340 
virtual double * vector(double u, double v=0., double w=0.)
Returns the value of the spatial field at the coordinates point entered.
double start_u(void)
Returns the first parameter value of the field.
virtual ~axlFieldParametricCurve(void)
Destroys a Bspline field.
dtkAbstractData * createaxlFieldParametricCurve(void)
virtual QString identifier(void) const
Returns the identifier of the field "axlFieldParametricCurve".
virtual double scalar(double u, double v=0., double w=0.)
Returns the value of the spatial field at the coordinates point entered.
Class axlFieldParametricCurve defines an API for field which owns a BSpline curve.
Class axlAbstractFieldParametricCurve defines an API for parametric field.
virtual QString description(void) const
Returns the description of the field.
virtual Kind kind(void)
Generic interface for parametric curve.
double numbersample_u(void)
Returns the number of parameters.
void setFunction(axlAbstractData *data)
Sets the Bspline function which determines the values of the BSpline field.
void setCurve(axlAbstractData *data)
Sets the curve on which the parametric field is applied.
double end_u(void)
Returns the last parameter value of the field.
axlAbstractData * getFunction(void)
Returns the Bspline function which determines the values of the BSpline field.
Class axlAbstractData defines an API for all type of axel data.
int size(void)
Returns the number of values evaluated for this parametric field on each samples of the input curve...
virtual double * tensor(double u, double v=0., double w=0.)
Returns the value of the spatial field at the coordinates point entered.