]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROGUI/HYDROGUI_Actor.cxx
Salome HOME
Merge branch 'BR_H2018_2' of https://codev-tuleap.cea.fr/plugins/git/salome/hydro...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Actor.cxx
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
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>
29
30 HYDROGUI_Actor::HYDROGUI_Actor()
31
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() );
40
41  
42  
43 HYDROGUI_Actor::~HYDROGUI_Actor() 
44
45
46
47 HYDROGUI_Actor* HYDROGUI_Actor::New()
48 {
49   HYDROGUI_Actor* anObject = new HYDROGUI_Actor(); 
50   anObject->SetMapper( anObject->myPolyDataMapper.Get()); 
51   return anObject; 
52 }
53
54 void HYDROGUI_Actor::SetMapper( vtkMapper* theMapper )
55 {
56   SALOME_Actor::SetMapper( theMapper );
57 }
58
59 void HYDROGUI_Actor::SetTransform( VTKViewer_Transform* theTransform )
60 {
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 );
69 }
70
71 void HYDROGUI_Actor::SetShape( const TopoDS_Shape& theShape,
72                                float theDeflection,
73                                bool theIsVector )
74 {
75   GEOM_Actor::SetShape( theShape, theDeflection, theIsVector ); 
76
77   if( myIsolatedEdgeSource->IsEmpty() )
78     myIsolatedEdgeActor->GetDeviceActor()->SetInfinitive( true );
79
80   if( myOneFaceEdgeSource->IsEmpty() )
81     myOneFaceEdgeActor->GetDeviceActor()->SetInfinitive( true );
82
83   if( mySharedEdgeSource->IsEmpty() )
84     mySharedEdgeActor->GetDeviceActor()->SetInfinitive( true );
85
86   if( myWireframeFaceSource->IsEmpty() )
87     myWireframeFaceActor->GetDeviceActor()->SetInfinitive( true );
88
89   if( myShadingFaceSource->IsEmpty() )
90   {
91     myShadingFaceActor->GetDeviceActor()->SetInfinitive( true );
92   }
93   else
94   {
95     myShadingFaceSource->Update();
96   }
97 }