32 #include <vtkActorCollection.h>
33 #include <vtkCommand.h>
34 #include <vtkPolyDataMapper.h>
35 #include <vtkDataSetMapper.h>
36 #include <vtkPolyData.h>
37 #include <vtkUnstructuredGrid.h>
38 #include <vtkProperty.h>
39 #include <vtkRenderWindowInteractor.h>
40 #include <vtkSmartPointer.h>
41 #include <vtkSphereSource.h>
42 #include <vtkVersion.h>
48 class axlActorBSplinePrivate
52 vtkSmartPointer<vtkSphereSource> sphereParam;
53 vtkSmartPointer<vtkDataSetMapper> mapperSphereParam;
54 vtkSmartPointer<vtkActor> actorSphereParam;
72 d->sphereParam = vtkSmartPointer<vtkSphereSource>::New();
73 d->sphereParam->SetPhiResolution(20);
74 d->sphereParam->SetThetaResolution(20);
75 d->sphereParam->SetRadius(0.05);
76 d->sphereParam->SetCenter(0.0, 0.0, 0.0);
78 d->mapperSphereParam = vtkSmartPointer<vtkDataSetMapper>::New();
79 #if (VTK_MAJOR_VERSION <= 5)
80 d->mapperSphereParam->SetInput(d->sphereParam->GetOutput());
82 d->mapperSphereParam->SetInputData(d->sphereParam->GetOutput());
85 d->actorSphereParam = vtkSmartPointer<vtkActor>::New();
86 d->actorSphereParam->SetMapper(d->mapperSphereParam);
87 d->actorSphereParam->SetVisibility(
false);
89 this->AddPart(d->actorSphereParam);
102 qDebug() <<
"No tet actor computed for this axlActorBSpline.";
150 #if (VTK_MAJOR_VERSION <= 5)
151 if (dynamic_cast<axlAbstractVolumeBSpline *> (this->
getObserverData())) {
154 this->
getMapper()->SetInputData(c->getCurveMapperInput());
159 if (dynamic_cast<axlAbstractVolumeBSpline *> (this->
getObserverData())) {
162 this->
getMapper()->SetInputData(c->getCurveMapperInput());
187 qDebug() <<
"No tet actor computed for this axlActorBSpline.";
196 return d->controlPoints;
201 d->controlPoints = controlPoints;
215 QColor color =
data->color();
216 this->
getActor()->GetProperty()->SetColor(color.redF(), color.greenF(), color.blueF());
227 vtkProperty *prop = this->
getActor()->GetProperty();
231 QColor color =
data->color();
232 qreal *h =
new qreal(0.0);
233 qreal *s =
new qreal(0.0);
234 qreal *l =
new qreal(0.0);
235 color.getHslF(h, s, l);
236 color.setHslF(*h, *s, *l + (1.0 - *l) / 2.0);
237 prop->SetColor(color.redF(), color.greenF(), color.blueF());
247 vtkProperty *prop = this->
getActor()->GetProperty();
250 QColor color =
data->color();
251 qreal *h =
new qreal(0.0);
252 qreal *s =
new qreal(0.0);
253 qreal *l =
new qreal(0.0);
254 color.getHslF(h, s, l);
255 color.setHslF(*h, *s, *l + (1.0 - *l)/2.0);
256 prop->SetColor(color.redF(), color.greenF(), color.blueF());
276 if(data == this->
data())
278 d->actorSphereParam->SetVisibility(
true);
279 d->actorSphereParam->Modified();
285 if(data == this->
data())
290 point = curve->eval(u);
293 point = surface->eval(u,v);
295 d->actorSphereParam->SetPosition(point.
x(), point.
y(), point.
z());
297 d->actorSphereParam->Modified();
303 if(data == this->
data())
305 d->actorSphereParam->SetVisibility(
false);
307 d->actorSphereParam->Modified();
313 this->RemoveAllObservers();
315 this->
getActor()->RemoveAllObservers();
318 actorComposite->removeActorReference(
this);
327 d->controlPoints = NULL;
virtual void initCurrentPoint(void)
Class axlPoint defines 3D points.
virtual void setDisplay(bool display)
virtual axlControlPointsWidget * getControlPoints(void)
void stateChanged(dtkAbstractData *data, int mode)
virtual void setMode(int state)
dtkAbstractData * getObserverData(void)
vtkSmartPointer< vtkPolyData > getPolyData(void)
virtual void onModeChanged(int state)
virtual void setState(int state)
virtual void setControlPolygon(bool control)
virtual dtkAbstractData * data(void)=0
virtual void setDisplay(bool display)
void deleteObserver(void)
virtual void showControlPoints(bool show)
virtual void hideCurrentPoint(double u, double v, dtkAbstractData *data)
virtual axlAbstractActor * parent(void)
virtual void moveCurrentPoint(double u, double v, dtkAbstractData *data)
virtual void onControlPointChanged()
virtual bool isShowControlPoints(void)
vtkSmartPointer< vtkUnstructuredGrid > getUnstructuredGrid(void)
vtkSmartPointer< vtkDataSetMapper > getDataSetMapper(void)
vtkSmartPointer< vtkActor > getActor(void)
vtkSmartPointer< vtkPolyDataMapper > getMapper(void)
virtual void onSamplingChanged(void)
virtual void addToObserver(int idEvent, vtkCommand *observer)
axlActorControlPolygonObserver * getObserver(void)
virtual vtkRenderWindowInteractor * getInteractor(void)
Class axlAbstractData defines an API for all type of axel data.
virtual void setControlPoints(axlControlPointsWidget *controlPoints)
virtual void showCurrentPoint(double u, double v, dtkAbstractData *data)
virtual void onRemoved(void)