1 // Copyright (C) 2007-2020 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 <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->SetInputConnection(myPolyDataNormals->GetOutputPort());
42 myPolyDataMapper->SetInputConnection(myStripper->GetOutputPort());
44 myActor->SetMapper(myPolyDataMapper.Get());
45 myActor->PickableOff();
48 GEOM_DeviceActor::~GEOM_DeviceActor()
54 SetInput(vtkAlgorithmOutput* thePolyData, bool theUseStripper)
58 myPolyDataNormals->SetInputConnection(thePolyData);
59 myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
60 myPolyDataMapper->SetInputConnection(myStripper->GetOutputPort());
63 myPolyDataMapper->SetInputConnection(thePolyData);
68 SetProperty(vtkProperty* theProperty)
70 myActor->SetProperty(theProperty);
77 return myActor->GetProperty();
82 SetBackfaceProperty(vtkProperty* theProperty)
84 myActor->SetBackfaceProperty(theProperty);
91 return myActor->GetBackfaceProperty();
96 SetVisibility(int theVisibility)
98 myActor->SetVisibility(theVisibility);
105 return myActor->GetVisibility();
110 AddToRender(vtkRenderer* theRenderer)
112 theRenderer->AddActor(myActor.GetPointer());
117 RemoveFromRender(vtkRenderer* theRenderer)
119 theRenderer->RemoveActor(myActor.GetPointer());