Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/visu.git] / src / OBJECT / VISU_PointMap3dActor.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU OBJECT : interactive object for VISU entities implementation
23 //  File   : 
24 //  Author : 
25 //  Module : VISU
26 //  $Header$
27 //
28 #include "VISU_PointMap3dActor.h"
29 #include "VISU_PipeLine.hxx"
30 #include "VISU_ScalarBarActor.hxx"
31 #include "VISU_DeformedGridPL.hxx"
32
33 #include <SALOME_InteractiveObject.hxx>
34
35 #include "utilities.h"
36 #include <vtkRenderer.h>
37 #include <vtkObjectFactory.h>
38
39 #ifdef _DEBUG_
40 static int MYDEBUG = 0;
41 #else
42 static int MYDEBUG = 0;
43 #endif
44
45 vtkStandardNewMacro(VISU_PointMap3dActor);
46
47 //==================================================================
48 // function: Constructor
49 // purpose :
50 //==================================================================
51
52 VISU_PointMap3dActor
53 ::VISU_PointMap3dActor()
54 {
55   if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "<<this);
56   myScalarBar = VISU_ScalarBarActor::New();
57 }
58
59 //==================================================================
60 // function: Destructor
61 // purpose :
62 //==================================================================
63
64 VISU_PointMap3dActor
65 ::~VISU_PointMap3dActor()
66 {
67   if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::~VISU_PointMap3dActor - this = "<<this);
68   myScalarBar->Delete();
69 }
70
71 //==================================================================
72 // function: AddToRender
73 // purpose :
74 //==================================================================
75 void
76 VISU_PointMap3dActor
77 ::AddToRender(vtkRenderer* theRenderer)
78 {
79   Superclass::AddToRender(theRenderer);
80   theRenderer->AddActor2D(myScalarBar);
81 }
82
83 void
84 VISU_PointMap3dActor
85 ::RemoveFromRender(vtkRenderer* theRenderer)
86 {
87   if(myScalarBar)
88     theRenderer->RemoveActor(myScalarBar);
89
90   Superclass::RemoveFromRender(theRenderer);
91 }
92
93 //==================================================================
94 // function: Set & Get PipeLine
95 // purpose :
96 //==================================================================
97 void
98 VISU_PointMap3dActor
99 ::SetPipeLine(VISU_DeformedGridPL* thePipeLine)
100 {
101   myPipeLine = thePipeLine;
102   SetMapper(thePipeLine->GetMapper());
103   myScalarBar->SetLookupTable(thePipeLine->GetBarTable());
104 }
105
106 VISU_DeformedGridPL*
107 VISU_PointMap3dActor
108 ::GetPipeLine()
109 {
110   return myPipeLine.GetPointer();
111 }
112
113 //==================================================================
114 // function: Visibility
115 // purpose :
116 //==================================================================
117
118 void
119 VISU_PointMap3dActor
120 ::SetVisibility(int theMode)
121 {
122   Superclass::SetVisibility( theMode );
123
124   //  myPointsActor->SetVisibility( theMode );
125
126   if(myScalarBar)
127     myScalarBar->SetVisibility(theMode);
128 }
129
130 VISU_ScalarBarActor*
131 VISU_PointMap3dActor
132 ::GetScalarBar()
133 {
134   return myScalarBar;
135 }
136
137 //==================================================================
138 // function: SetIO
139 // purpose :
140 //==================================================================
141
142 void 
143 VISU_PointMap3dActor
144 ::setIO(const Handle(SALOME_InteractiveObject)& theIO)
145 {
146   Superclass::setIO(theIO); 
147   myName = theIO->getName(); 
148 }