1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <HYDROGUI_Actor.h>
20 #include <GEOM_PainterPolyDataMapper.h>
21 #include <GEOM_DeviceActor.h>
22 #include <GEOM_VertexSource.h>
23 #include <GEOM_EdgeSource.h>
24 #include <GEOM_WireframeFace.h>
25 #include <GEOM_ShadingFace.h>
26 #include <VTKViewer_TransformFilter.h>
27 #include <vtkAppendPolyData.h>
28 #include <VTKViewer_Transform.h>
30 HYDROGUI_Actor::HYDROGUI_Actor()
32 myVertexActor->GetDeviceActor()->SetMapper( myVertexActor->GetDeviceActor()->GetMapper() );
33 myIsolatedEdgeActor->GetDeviceActor()->SetMapper( myIsolatedEdgeActor->GetDeviceActor()->GetMapper() );
34 myOneFaceEdgeActor->GetDeviceActor()->SetMapper( myOneFaceEdgeActor->GetDeviceActor()->GetMapper() );
35 mySharedEdgeActor->GetDeviceActor()->SetMapper( mySharedEdgeActor->GetDeviceActor()->GetMapper() );
36 myWireframeFaceActor->GetDeviceActor()->SetMapper( myWireframeFaceActor->GetDeviceActor()->GetMapper() );
37 myShadingFaceActor->SetInput(myShadingFaceSource->GetOutputPort(),false);
38 myShadingFaceActor->GetDeviceActor()->SetMapper( myShadingFaceActor->GetDeviceActor()->GetMapper() );
39 GEOM_Actor::myHighlightActor->GetDeviceActor()->SetMapper( GEOM_Actor::myHighlightActor->GetDeviceActor()->GetMapper() );
43 HYDROGUI_Actor::~HYDROGUI_Actor()
47 HYDROGUI_Actor* HYDROGUI_Actor::New()
49 HYDROGUI_Actor* anObject = new HYDROGUI_Actor();
50 anObject->SetMapper( anObject->myPolyDataMapper.Get());
54 void HYDROGUI_Actor::SetMapper( vtkMapper* theMapper )
56 SALOME_Actor::SetMapper( theMapper );
59 void HYDROGUI_Actor::SetTransform( VTKViewer_Transform* theTransform )
61 Superclass::SetTransform(theTransform);
62 myVertexActor ->GetDeviceActor()->SetTransform( theTransform );
63 myIsolatedEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
64 myOneFaceEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
65 mySharedEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
66 myWireframeFaceActor->GetDeviceActor()->SetTransform( theTransform );
67 myShadingFaceActor ->GetDeviceActor()->SetTransform( theTransform );
68 GEOM_Actor::myHighlightActor->GetDeviceActor()->SetTransform( theTransform );
71 void HYDROGUI_Actor::SetShape( const TopoDS_Shape& theShape,
75 GEOM_Actor::SetShape( theShape, theDeflection, theIsVector );
77 if( myIsolatedEdgeSource->IsEmpty() )
78 myIsolatedEdgeActor->GetDeviceActor()->SetInfinitive( true );
80 if( myOneFaceEdgeSource->IsEmpty() )
81 myOneFaceEdgeActor->GetDeviceActor()->SetInfinitive( true );
83 if( mySharedEdgeSource->IsEmpty() )
84 mySharedEdgeActor->GetDeviceActor()->SetInfinitive( true );
86 if( myWireframeFaceSource->IsEmpty() )
87 myWireframeFaceActor->GetDeviceActor()->SetInfinitive( true );
89 if( myShadingFaceSource->IsEmpty() )
91 myShadingFaceActor->GetDeviceActor()->SetInfinitive( true );
95 myShadingFaceSource->Update();