1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "GEOM_DeviceActor.h"
22 #include <vtkObjectFactory.h>
24 #include <vtkPoints.h>
25 #include <vtkPolyData.h>
26 #include <vtkStripper.h>
27 #include <vtkPolyDataMapper.h>
28 #include <vtkPolyDataNormals.h>
30 #include <VTKViewer_Actor.h>
31 #include <vtkRenderer.h>
33 vtkStandardNewMacro(GEOM_DeviceActor);
35 GEOM_DeviceActor::GEOM_DeviceActor():
36 myStripper(vtkStripper::New(),true),
37 myPolyDataMapper(vtkPolyDataMapper::New(),true),
38 myPolyDataNormals(vtkPolyDataNormals::New(),true),
39 myActor(VTKViewer_Actor::New(),true)
41 myStripper->SetInput(myPolyDataNormals->GetOutput());
42 myPolyDataMapper->SetInput(myStripper->GetOutput());
44 myActor->SetMapper(myPolyDataMapper.Get());
45 myActor->PickableOff();
48 GEOM_DeviceActor::~GEOM_DeviceActor()
54 SetInput(vtkPolyData* thePolyData, bool theUseStripper)
57 myPolyDataNormals->SetInput(thePolyData);
59 myPolyDataMapper->SetInput(thePolyData);
64 SetProperty(vtkProperty* theProperty)
66 myActor->SetProperty(theProperty);
73 return myActor->GetProperty();
78 SetVisibility(int theVisibility)
80 myActor->SetVisibility(theVisibility);
87 return myActor->GetVisibility();
92 AddToRender(vtkRenderer* theRenderer)
94 theRenderer->AddActor(myActor.GetPointer());
99 RemoveFromRender(vtkRenderer* theRenderer)
101 theRenderer->RemoveActor(myActor.GetPointer());