1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include <HYDROGUI_Actor.h>
24 #include <GEOM_PainterPolyDataMapper.h>
25 #include <GEOM_DeviceActor.h>
26 #include <GEOM_VertexSource.h>
27 #include <GEOM_EdgeSource.h>
28 #include <GEOM_WireframeFace.h>
29 #include <GEOM_ShadingFace.h>
30 #include <VTKViewer_TransformFilter.h>
31 #include <vtkAppendPolyData.h>
32 #include <VTKViewer_Transform.h>
34 HYDROGUI_Actor::HYDROGUI_Actor()
36 myVertexActor->GetDeviceActor()->SetMapper( myVertexActor->GetDeviceActor()->GetMapper() );
37 myIsolatedEdgeActor->GetDeviceActor()->SetMapper( myIsolatedEdgeActor->GetDeviceActor()->GetMapper() );
38 myOneFaceEdgeActor->GetDeviceActor()->SetMapper( myOneFaceEdgeActor->GetDeviceActor()->GetMapper() );
39 mySharedEdgeActor->GetDeviceActor()->SetMapper( mySharedEdgeActor->GetDeviceActor()->GetMapper() );
40 myWireframeFaceActor->GetDeviceActor()->SetMapper( myWireframeFaceActor->GetDeviceActor()->GetMapper() );
41 myShadingFaceActor->SetInput(myShadingFaceSource->GetOutputPort(),false);
42 myShadingFaceActor->GetDeviceActor()->SetMapper( myShadingFaceActor->GetDeviceActor()->GetMapper() );
43 GEOM_Actor::myHighlightActor->GetDeviceActor()->SetMapper( GEOM_Actor::myHighlightActor->GetDeviceActor()->GetMapper() );
47 HYDROGUI_Actor::~HYDROGUI_Actor()
51 HYDROGUI_Actor* HYDROGUI_Actor::New()
53 HYDROGUI_Actor* anObject = new HYDROGUI_Actor();
54 anObject->SetMapper( anObject->myPolyDataMapper.Get());
58 void HYDROGUI_Actor::SetMapper( vtkMapper* theMapper )
60 SALOME_Actor::SetMapper( theMapper );
63 void HYDROGUI_Actor::SetTransform( VTKViewer_Transform* theTransform )
65 Superclass::SetTransform(theTransform);
66 myVertexActor ->GetDeviceActor()->SetTransform( theTransform );
67 myIsolatedEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
68 myOneFaceEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
69 mySharedEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
70 myWireframeFaceActor->GetDeviceActor()->SetTransform( theTransform );
71 myShadingFaceActor ->GetDeviceActor()->SetTransform( theTransform );
72 GEOM_Actor::myHighlightActor->GetDeviceActor()->SetTransform( theTransform );
75 void HYDROGUI_Actor::SetShape( const TopoDS_Shape& theShape,
79 GEOM_Actor::SetShape( theShape, theDeflection, theIsVector );
81 if( myIsolatedEdgeSource->IsEmpty() )
82 myIsolatedEdgeActor->GetDeviceActor()->SetInfinitive( true );
84 if( myOneFaceEdgeSource->IsEmpty() )
85 myOneFaceEdgeActor->GetDeviceActor()->SetInfinitive( true );
87 if( mySharedEdgeSource->IsEmpty() )
88 mySharedEdgeActor->GetDeviceActor()->SetInfinitive( true );
90 if( myWireframeFaceSource->IsEmpty() )
91 myWireframeFaceActor->GetDeviceActor()->SetInfinitive( true );
93 if( myShadingFaceSource->IsEmpty() )
95 myShadingFaceActor->GetDeviceActor()->SetInfinitive( true );
99 myShadingFaceSource->Update();