]> SALOME platform Git repositories - modules/visu.git/blob - src/PIPELINE/VISU_ScalarBarCtrl.hxx
Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / PIPELINE / VISU_ScalarBarCtrl.hxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 // File:    VISU_ScalarBarCtrl.hxx
24 // Author:  Peter KURNEV
25 // Module : VISU
26
27 #ifndef VISU_ScalarBarCtrl_HeaderFile
28 #define VISU_ScalarBarCtrl_HeaderFile
29
30 #include <vtkObject.h>
31
32 #include "VTKViewer.h"
33
34 class vtkRenderer;
35 class vtkLookupTable;
36 class vtkScalarBarActor;
37
38 class VISU_ScalarBarCtrl :  public vtkObject
39 {
40 public:
41   vtkTypeMacro(VISU_ScalarBarCtrl, vtkObject);
42   static
43   VISU_ScalarBarCtrl* 
44   New();
45
46   enum EMode {eSimple, eGlobal, eLocal};
47
48   // Mode
49   void
50   SetMode(EMode theMode);
51
52   EMode 
53   GetMode() const;
54
55   // Ranges
56   void
57   SetRangeGlobal(vtkFloatingPointType theMin,
58                  vtkFloatingPointType theMax);
59   void 
60   SetRangeGlobal(vtkFloatingPointType *theRange);
61
62   void
63   SetGlobalRangeIsDefined(bool theIsDefined);
64   
65   void
66   SetRangeLocal(vtkFloatingPointType theMin,
67                 vtkFloatingPointType theMax);
68   void 
69   SetRangeLocal(vtkFloatingPointType *theRange);
70   
71   // Selectors
72   vtkScalarBarActor* 
73   GetLocalBar();
74
75   vtkLookupTable* 
76   GetLocalTable();
77
78   vtkScalarBarActor* 
79   GetGlobalBar();
80
81   vtkLookupTable* 
82   GetGlobalTable();
83   //
84   // Renderer
85   void
86   AddToRender(vtkRenderer* theRenderer); 
87
88   void
89   RemoveFromRender(vtkRenderer* theRenderer);
90   //
91   // Visibility
92   void
93   SetVisibility(int theFlag);
94
95   int
96   GetVisibility() const;
97
98   // Visibility
99   void
100   SetCtrlVisibility(int theFlag);
101
102   int
103   GetCtrlVisibility() const;
104
105   // Build
106   void Update();
107
108   // Position
109   void
110   SetWidth(const vtkFloatingPointType theWidth);
111
112   vtkFloatingPointType
113   GetWidth() const;
114
115   void  
116   SetHeight(const vtkFloatingPointType theHeight);
117
118   vtkFloatingPointType
119   GetHeight() const;
120
121   void
122   SetPosition(const vtkFloatingPointType* thePosition);
123   
124   const vtkFloatingPointType* 
125   GetPosition() const;
126   //
127   // Spacing
128   void
129   SetSpacing(const vtkFloatingPointType theSpacing);
130
131   vtkFloatingPointType
132   GetSpacing() const;
133   //
134   // Rainbow/bicolor
135   bool
136   GetBicolor() const;
137
138   void
139   SetBicolor(const bool theBicolor);
140   //
141   // Misc
142   void  
143   SetMarkValue(const vtkFloatingPointType theValue);
144
145   vtkFloatingPointType
146   GetMarkValue() const;
147
148   void
149   SetIsMarked(const bool theFlag);
150
151   bool
152   GetIsMarked()const;
153   //
154 protected:
155   VISU_ScalarBarCtrl();
156
157   virtual
158   ~VISU_ScalarBarCtrl();
159   
160   void
161   UpdateForBicolor();
162
163   void
164   UpdateForColor();
165
166   void
167   UpdateMarkValue();
168
169   void
170   PrepareTables();
171   
172   void
173   PrepareTables(vtkScalarBarActor* theScalarBarActor,
174                 vtkLookupTable *theLookupTable,
175                 vtkIdType theId);
176   
177 protected:
178   EMode myMode;
179   bool myGlobalRangeIsDefined;
180
181   vtkFloatingPointType myDistance;
182   vtkFloatingPointType myPosition[2];
183   bool  myBicolor;
184   int   myCtrlVisibility;
185
186   unsigned char myBlack[3];
187   unsigned char myGrey[3];
188   //
189   bool  myMarked;
190   vtkFloatingPointType myMarkedValue;
191   //
192   vtkScalarBarActor *myGlobalScalarBar;
193   vtkLookupTable *myGlobalLookupTable; 
194
195   vtkScalarBarActor *myLocalScalarBar;
196   vtkLookupTable *myLocalLookupTable; 
197 };
198
199 #endif