1 // Copyright (C) 2007-2022 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, or (at your option) any later version.
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 <vtkRenderer.h>
32 #include <VTKViewer_Actor.h>
33 #include <VTKViewer_Transform.h>
34 #include <VTKViewer_TransformFilter.h>
37 vtkStandardNewMacro(GEOM_DeviceActor)
39 GEOM_DeviceActor::GEOM_DeviceActor() :
40 myPolyDataNormals(vtkPolyDataNormals::New(), true),
41 myPolyDataMapper(vtkPolyDataMapper::New(), true),
42 myStripper(vtkStripper::New(), true),
43 myActor(VTKViewer_Actor::New(), true),
44 myTransformFilter(VTKViewer_TransformFilter::New())
46 myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
47 myTransformFilter->SetInputConnection(myStripper->GetOutputPort());
48 myPolyDataMapper->SetInputConnection(myTransformFilter->GetOutputPort());
50 myActor->SetMapper(myPolyDataMapper.Get());
51 myActor->PickableOff();
54 GEOM_DeviceActor::~GEOM_DeviceActor()
60 SetInput(vtkAlgorithmOutput* thePolyData, bool theUseStripper)
64 myPolyDataNormals->SetInputConnection(thePolyData);
65 myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
66 myTransformFilter->SetInputConnection(myStripper->GetOutputPort());
67 myPolyDataMapper->SetInputConnection(myTransformFilter->GetOutputPort());
70 myTransformFilter->SetInputConnection(thePolyData);
71 myPolyDataMapper->SetInputConnection(myTransformFilter->GetOutputPort());
77 SetProperty(vtkProperty* theProperty)
79 myActor->SetProperty(theProperty);
86 return myActor->GetProperty();
91 SetBackfaceProperty(vtkProperty* theProperty)
93 myActor->SetBackfaceProperty(theProperty);
100 return myActor->GetBackfaceProperty();
105 SetVisibility(int theVisibility)
107 myActor->SetVisibility(theVisibility);
114 return myActor->GetVisibility();
119 AddToRender(vtkRenderer* theRenderer)
121 theRenderer->AddActor(myActor.GetPointer());
126 RemoveFromRender(vtkRenderer* theRenderer)
128 theRenderer->RemoveActor(myActor.GetPointer());
133 ::SetTransform(VTKViewer_Transform* theTransform)
135 myTransformFilter->SetTransform(theTransform);