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