15 #include <vtkPolyData.h> 16 #include <vtkPolyDataMapper.h> 17 #include <vtkProperty.h> 19 #include <vtkRenderer.h> 20 #include <vtkMatrix4x4.h> 22 #include <vtkPolyDataNormals.h> 24 #include <vtkStripper.h> 25 #include <vtkCellArray.h> 40 mMapper = vtkPolyDataMapperPtr::New();
42 mActor = vtkActorPtr::New();
58 view->getRenderer()->AddActor(
mActor);
63 view->getRenderer()->RemoveActor(
mActor);
72 disconnect(
mMesh.get(), SIGNAL(meshChanged()),
this, SLOT(meshChangedSlot()));
73 disconnect(
mMesh.get(), SIGNAL(transformChanged()),
this, SLOT(transformChangedSlot()));
78 connect(mMesh.get(), SIGNAL(meshChanged()),
this, SLOT(meshChangedSlot()));
79 connect(mMesh.get(), SIGNAL(transformChanged()),
this, SLOT(transformChangedSlot()));
80 this->meshChangedSlot();
81 this->transformChangedSlot();
91 return (
mMesh == mesh);
98 disconnect(
mSlicer.get(), SIGNAL(transformChanged(
Transform3D)),
this, SLOT(transformChangedSlot()));
103 connect(mSlicer.get(), SIGNAL(transformChanged(
Transform3D)),
this, SLOT(transformChangedSlot()));
104 this->transformChangedSlot();
108 void GeometricRep2D::meshChangedSlot()
111 mMapper->ScalarVisibilityOff();
115 mActor->GetProperty()->SetColor(
mMesh->getColor().redF(),
mMesh->getColor().greenF(),
mMesh->getColor().blueF());
119 mActor->GetProperty()->LightingOff();
122 mActor->GetProperty()->SetLineWidth(
mMesh->getProperties().mLineWidth->getValue());
127 if(
settings()->value(
"View2D/useGPU2DRendering").toBool())
129 mActor->GetProperty()->SetOpacity(
mMesh->getColor().alphaF());
134 mActor->GetProperty()->SetOpacity(1.0);
140 void GeometricRep2D::transformChangedSlot()
149 mActor->SetUserMatrix(dMs.inv().getVtkMatrix());
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
bool hasMesh(MeshPtr mesh) const
checks if this rep has the give mesh
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
vtkPolyDataMapperPtr mMapper
MeshPtr getMesh()
gives this reps mesh
void setSliceProxy(SliceProxyPtr slicer)
boost::shared_ptr< class View > ViewPtr
virtual void addRepActorsToViewRenderer(ViewPtr view)
void setMesh(MeshPtr mesh)
sets this reps mesh
virtual ~GeometricRep2D()
virtual void removeRepActorsFromViewRenderer(ViewPtr view)
Default implementation of Rep.
Settings * settings()
Shortcut for accessing the settings instance.
static GeometricRep2DPtr New(const QString &uid="")
boost::shared_ptr< class Mesh > MeshPtr
boost::shared_ptr< class GeometricRep2D > GeometricRep2DPtr
Namespace for all CustusX production code.