Developer documentation | Axl-2.5.1

axlFieldParametricSurfaceTangentVectorCreator.cpp
Go to the documentation of this file.
1 /* axlFieldParametricSurfaceTangentVectorCreator.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 
16 
21 
22 #include <dtkCoreSupport/dtkAbstractProcessFactory.h>
23 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
24 #include <dtkCoreSupport/dtkGlobal.h>
25 #include <QtGui>
26 
27 class axlFieldParametricSurfaceTangentVectorCreatorPrivate
28 {
29 public:
31  double a;
32  double b;
33 };
34 
36 {
37  d->input = NULL;
38  d->a = 0;
39  d->b = 0;
40 
41 }
42 
44 {
45  delete d;
46 
47  d = NULL;
48 }
49 
50 
51 void axlFieldParametricSurfaceTangentVectorCreator::setInput(dtkAbstractData *data, int channel)
52 {
53  if(axlAbstractSurfaceParametric *surface = dynamic_cast<axlAbstractSurfaceParametric *>(data))
54  d->input = surface;
55 
56 }
57 
58 
60  if(channel == 0)
61  d->a = data;
62  else if(channel == 1)
63  d->b = data;
64  else
65  qDebug()<< "only two values are possible ; 0 to 1";
66 
67 }
68 
69 
71 {
72 
73  if(!d->input)
74  return 0;
75 
77 
78  QString newName = d->input->changeFieldName(field->objectName());
79  field->setObjectName(newName);
80  d->input->addField(field);
81  field->setSurface(d->input);
82  field->setParameter(d->a, 0);
83  field->setParameter(d->b, 1);
84 
85 
86  QList<axlAbstractData *>list;
87  list << d->input;
88  emit dataSetFieldsChanged(list, field->objectName());
89 
90  return 1;
91 
92 }
93 
94 
96 {
97  return 0;
98 }
99 
100 
102 {
103  return "axlFieldParametricSurfaceTangentVectorCreator created fields for input tha compute the normal vector in each parameter coordinates of the input support.";
104 }
105 
107 {
108  return "axlFieldParametricSurfaceTangentVectorCreator";
109 }
110 
111 // /////////////////////////////////////////////////////////////////
112 // Type instanciation
113 // /////////////////////////////////////////////////////////////////
114 
116 {
118 }
119 
120 
dtkAbstractProcess * createaxlFieldParametricSurfaceTangentVectorCreator(void)
void dataSetFieldsChanged(QList< axlAbstractData * > dataSet, QString fieldName)
Class axlFieldParametricSurfaceTangentVector defines an API for field which owns a BSpline Surface as...
void setSurface(axlAbstractData *data)
Sets the BSpline on which the BSpline field is applied.
void setParameter(double parameter, int channel)
Sets the direction parameter for the tangentVector.