Developer documentation | Axl-2.5.1

axlFieldParametricVolumeTangentVectorCreator.cpp
Go to the documentation of this file.
1 /* axlFieldParametricVolumeTangentVectorCreator.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 axlFieldParametricVolumeTangentVectorCreatorPrivate
28 {
29 public:
31  double a;
32  double b;
33  double c;
34 };
35 
37 {
38  d->input = NULL;
39  d->a = 0;
40  d->b = 0;
41  d->c = 0;
42 
43 }
44 
46 {
47  delete d;
48 
49  d = NULL;
50 }
51 
52 
53 void axlFieldParametricVolumeTangentVectorCreator::setInput(dtkAbstractData *data, int channel)
54 {
55  if(axlAbstractVolumeParametric *surface = dynamic_cast<axlAbstractVolumeParametric *>(data))
56  d->input = surface;
57 
58 }
59 
60 
62  if(channel == 0)
63  d->a = data;
64  else if(channel == 1)
65  d->b = data;
66  else if(channel == 2)
67  d->c = data;
68  else
69  qDebug()<< "only three values are possible : 0 to 2";
70 
71 }
72 
73 
75 {
76 
77  if(!d->input)
78  return 0;
79 
81 
82  QString newName = d->input->changeFieldName(field->objectName());
83  field->setObjectName(newName);
84  d->input->addField(field);
85  field->setVolume(d->input);
86  field->setParameter(d->a, 0);
87  field->setParameter(d->b, 1);
88  field->setParameter(d->c, 2);
89 
90 
91  QList<axlAbstractData *>list;
92  list << d->input;
93  emit dataSetFieldsChanged(list, field->objectName());
94 
95  return 1;
96 
97 }
98 
99 
101 {
102  return 0;
103 }
104 
105 
107 {
108  return "axlFieldParametricVolumeTangentVectorCreator created fields for input tha compute the normal vector in each parameter coordinates of the input support.";
109 }
110 
112 {
113  return "axlFieldParametricVolumeTangentVectorCreator";
114 }
115 
116 // /////////////////////////////////////////////////////////////////
117 // Type instanciation
118 // /////////////////////////////////////////////////////////////////
119 
121 {
123 }
124 
125 
void setParameter(double parameter, int channel)
Sets the direction parameter for the tangentVector.
void setVolume(axlAbstractData *data)
Sets the BSpline on which the BSpline field is applied.
void dataSetFieldsChanged(QList< axlAbstractData * > dataSet, QString fieldName)
dtkAbstractProcess * createaxlFieldParametricVolumeTangentVectorCreator(void)
Class axlFieldParametricVolumeTangentVector defines an API for field which owns a BSpline Surface as ...