Salome HOME
Fix for the bug #255: VTK viewer is not updated after modification of objects.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Actor.cxx
1
2 #include <HYDROGUI_Actor.h>
3 #include <GEOM_PainterPolyDataMapper.h>
4 #include <GEOM_DeviceActor.h>
5 #include <GEOM_VertexSource.h>
6 #include <GEOM_EdgeSource.h>
7 #include <GEOM_WireframeFace.h>
8 #include <GEOM_ShadingFace.h>
9 #include <VTKViewer_TransformFilter.h>
10 #include <vtkAppendPolyData.h>
11 #include <VTKViewer_Transform.h>
12
13 HYDROGUI_Actor::HYDROGUI_Actor()
14
15   myVertexActor->GetDeviceActor()->SetMapper( myVertexActor->GetDeviceActor()->GetMapper() );
16   myIsolatedEdgeActor->GetDeviceActor()->SetMapper( myIsolatedEdgeActor->GetDeviceActor()->GetMapper() );
17   myOneFaceEdgeActor->GetDeviceActor()->SetMapper( myOneFaceEdgeActor->GetDeviceActor()->GetMapper() );
18   mySharedEdgeActor->GetDeviceActor()->SetMapper( mySharedEdgeActor->GetDeviceActor()->GetMapper() );
19   myWireframeFaceActor->GetDeviceActor()->SetMapper( myWireframeFaceActor->GetDeviceActor()->GetMapper() );
20   myShadingFaceActor->GetDeviceActor()->SetMapper( myShadingFaceActor->GetDeviceActor()->GetMapper() );
21   GEOM_Actor::myHighlightActor->GetDeviceActor()->SetMapper( GEOM_Actor::myHighlightActor->GetDeviceActor()->GetMapper() );
22
23  
24  
25 HYDROGUI_Actor::~HYDROGUI_Actor() 
26
27
28
29 HYDROGUI_Actor* HYDROGUI_Actor::New()
30 {
31   HYDROGUI_Actor* anObject = new HYDROGUI_Actor(); 
32   anObject->SetMapper( anObject->myPolyDataMapper.Get()); 
33   return anObject; 
34 }
35
36 void HYDROGUI_Actor::SetMapper( vtkMapper* theMapper )
37 {
38   SALOME_Actor::SetMapper( theMapper );
39 }
40
41 void HYDROGUI_Actor::SetTransform( VTKViewer_Transform* theTransform )
42 {
43   Superclass::SetTransform(theTransform);
44   myVertexActor       ->GetDeviceActor()->SetTransform( theTransform );
45   myIsolatedEdgeActor ->GetDeviceActor()->SetTransform( theTransform );
46   myOneFaceEdgeActor  ->GetDeviceActor()->SetTransform( theTransform );
47   mySharedEdgeActor   ->GetDeviceActor()->SetTransform( theTransform );
48   myWireframeFaceActor->GetDeviceActor()->SetTransform( theTransform );
49   myShadingFaceActor  ->GetDeviceActor()->SetTransform( theTransform );
50   GEOM_Actor::myHighlightActor->GetDeviceActor()->SetTransform( theTransform );
51 }
52
53 void HYDROGUI_Actor::SetShape( const TopoDS_Shape& theShape,
54                                float theDeflection,
55                                bool theIsVector )
56 {
57   GEOM_Actor::SetShape( theShape, theDeflection, theIsVector ); 
58
59   if( myIsolatedEdgeSource->IsEmpty() )
60     myIsolatedEdgeActor->GetDeviceActor()->SetInfinitive( true );
61
62   if( myOneFaceEdgeSource->IsEmpty() )
63     myOneFaceEdgeActor->GetDeviceActor()->SetInfinitive( true );
64
65   if( mySharedEdgeSource->IsEmpty() )
66     mySharedEdgeActor->GetDeviceActor()->SetInfinitive( true );
67
68   if( myWireframeFaceSource->IsEmpty() )
69     myWireframeFaceActor->GetDeviceActor()->SetInfinitive( true );
70
71   if( myShadingFaceSource->IsEmpty() )
72     myShadingFaceActor->GetDeviceActor()->SetInfinitive( true );
73 }