36 #include <vtkPolyData.h>
37 #include <vtkPolyDataMapper.h>
38 #include <vtkProperty.h>
40 #include <vtkRenderer.h>
41 #include <vtkMatrix4x4.h>
54 mMapper = vtkPolyDataMapperPtr::New();
56 mActor = vtkActorPtr::New();
72 view->getRenderer()->AddActor(
mActor);
77 view->getRenderer()->RemoveActor(
mActor);
86 disconnect(
mMesh.get(), SIGNAL(meshChanged()),
this, SLOT(meshChangedSlot()));
87 disconnect(
mMesh.get(), SIGNAL(transformChanged()),
this, SLOT(transformChangedSlot()));
92 connect(
mMesh.get(), SIGNAL(meshChanged()),
this, SLOT(meshChangedSlot()));
93 connect(
mMesh.get(), SIGNAL(transformChanged()),
this, SLOT(transformChangedSlot()));
94 this->meshChangedSlot();
95 this->transformChangedSlot();
105 return (
mMesh == mesh);
108 void GeometricRep::meshChangedSlot()
114 mMapper->ScalarVisibilityOff();
117 mActor->GetProperty()->SetColor(
mMesh->getColor().redF(),
mMesh->getColor().greenF(),
mMesh->getColor().blueF());
119 mActor->GetProperty()->SetOpacity(
mMesh->getColor().alphaF());
121 if (
mMesh->getIsWireframe())
122 mActor->GetProperty()->SetRepresentationToWireframe();
124 mActor->GetProperty()->SetRepresentationToSurface();
127 mActor->GetProperty()->SetBackfaceCulling(
mMesh->getBackfaceCulling());
128 mActor->GetProperty()->SetFrontfaceCulling(
mMesh->getFrontfaceCulling());
133 void GeometricRep::transformChangedSlot()
140 mActor->SetUserMatrix(
mMesh->get_rMd().getVtkMatrix());
void setMesh(MeshPtr mesh)
sets this reps mesh
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
boost::shared_ptr< class View > ViewPtr
bool hasMesh(MeshPtr mesh) const
checks if this rep has the give mesh
MeshPtr getMesh()
gives this reps mesh
virtual void addRepActorsToViewRenderer(ViewPtr view)
virtual void removeRepActorsFromViewRenderer(ViewPtr view)
static GeometricRepPtr New(const QString &uid="")
Default implementation of Rep.
vtkPolyDataMapperPtr mMapper
boost::shared_ptr< class Mesh > MeshPtr
boost::shared_ptr< class GeometricRep > GeometricRepPtr