Salome HOME
Update copyright information
[modules/visu.git] / src / OBJECT / VISU_PointMap3dActor.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  VISU OBJECT : interactive object for VISU entities implementation
21 //  File   : 
22 //  Author : 
23 //  Module : VISU
24 //  $Header$
25 //
26 #include "VISU_PointMap3dActor.h"
27 #include "VISU_PipeLine.hxx"
28 #include "VISU_ScalarBarActor.hxx"
29 #include "VISU_DeformedGridPL.hxx"
30
31 #include <SALOME_InteractiveObject.hxx>
32
33 #include "utilities.h"
34 #include <vtkRenderer.h>
35 #include <vtkObjectFactory.h>
36
37 #ifdef _DEBUG_
38 static int MYDEBUG = 0;
39 #else
40 static int MYDEBUG = 0;
41 #endif
42
43 vtkStandardNewMacro(VISU_PointMap3dActor);
44
45 //==================================================================
46 // function: Constructor
47 // purpose :
48 //==================================================================
49
50 VISU_PointMap3dActor
51 ::VISU_PointMap3dActor()
52 {
53   if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "<<this);
54   myScalarBar = VISU_ScalarBarActor::New();
55 }
56
57 //==================================================================
58 // function: Destructor
59 // purpose :
60 //==================================================================
61
62 VISU_PointMap3dActor
63 ::~VISU_PointMap3dActor()
64 {
65   if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::~VISU_PointMap3dActor - this = "<<this);
66   myScalarBar->Delete();
67 }
68
69 //==================================================================
70 // function: AddToRender
71 // purpose :
72 //==================================================================
73 void
74 VISU_PointMap3dActor
75 ::AddToRender(vtkRenderer* theRenderer)
76 {
77   Superclass::AddToRender(theRenderer);
78   theRenderer->AddActor2D(myScalarBar);
79 }
80
81 void
82 VISU_PointMap3dActor
83 ::RemoveFromRender(vtkRenderer* theRenderer)
84 {
85   if(myScalarBar)
86     theRenderer->RemoveActor(myScalarBar);
87
88   Superclass::RemoveFromRender(theRenderer);
89 }
90
91 //==================================================================
92 // function: Set & Get PipeLine
93 // purpose :
94 //==================================================================
95 void
96 VISU_PointMap3dActor
97 ::SetPipeLine(VISU_DeformedGridPL* thePipeLine)
98 {
99   myPipeLine = thePipeLine;
100   SetMapper(thePipeLine->GetMapper());
101   myScalarBar->SetLookupTable(thePipeLine->GetBarTable());
102 }
103
104 VISU_DeformedGridPL*
105 VISU_PointMap3dActor
106 ::GetPipeLine()
107 {
108   return myPipeLine.GetPointer();
109 }
110
111 //==================================================================
112 // function: Visibility
113 // purpose :
114 //==================================================================
115
116 void
117 VISU_PointMap3dActor
118 ::SetVisibility(int theMode)
119 {
120   Superclass::SetVisibility( theMode );
121
122   //  myPointsActor->SetVisibility( theMode );
123
124   if(myScalarBar)
125     myScalarBar->SetVisibility(theMode);
126 }
127
128 VISU_ScalarBarActor*
129 VISU_PointMap3dActor
130 ::GetScalarBar()
131 {
132   return myScalarBar;
133 }
134
135 //==================================================================
136 // function: SetIO
137 // purpose :
138 //==================================================================
139
140 void 
141 VISU_PointMap3dActor
142 ::setIO(const Handle(SALOME_InteractiveObject)& theIO)
143 {
144   Superclass::setIO(theIO); 
145   myName = theIO->getName(); 
146 }