]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_ScalarBarActor.hxx
Salome HOME
NRI : Remove dependence with KERNEL.
[modules/visu.git] / src / VISU_I / VISU_ScalarBarActor.hxx
1 // File:        VISU_ScalarBarActor.hxx
2 // Created:     Wed Feb 26 10:13:15 2003
3 // Author:      Alexey PETROV
4 //              <apo@ivanox.nnov.matra-dtv.fr>
5
6
7 #ifndef VISU_ScalarBarActor_HeaderFile
8 #define VISU_ScalarBarActor_HeaderFile
9
10 #include <vtkScalarBarActor.h>
11 #include <vtkActor2D.h>
12 #include <vtkScalarsToColors.h>
13 #include <vtkPolyDataMapper2D.h>
14 #include <vtkTextMapper.h>
15
16 class VISU_LookupTable;
17
18 #define VTK_ORIENT_HORIZONTAL 0
19 #define VTK_ORIENT_VERTICAL 1
20
21 class VTK_EXPORT VISU_ScalarBarActor : public vtkActor2D
22 {
23 public:
24   vtkTypeMacro(VISU_ScalarBarActor,vtkActor2D);
25   void PrintSelf(ostream& os, vtkIndent indent);
26
27   static VISU_ScalarBarActor *New();
28
29   int RenderOpaqueGeometry(vtkViewport* viewport);
30   int RenderTranslucentGeometry(vtkViewport*) { return 0; };
31   int RenderOverlay(vtkViewport* viewport);
32
33   virtual void ReleaseGraphicsResources(vtkWindow *);
34
35   void SetLookupTable(vtkScalarsToColors*);
36   vtkScalarsToColors* GetLookupTable();
37
38   vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
39   vtkGetMacro(MaximumNumberOfColors, int);
40
41   vtkSetClampMacro(NumberOfLabels, int, 0, 64);
42   vtkGetMacro(NumberOfLabels, int);
43   
44   vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
45   vtkGetMacro(Orientation, int);
46   void SetOrientationToHorizontal()
47        {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
48   void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
49
50   vtkSetMacro(Bold, int);
51   vtkGetMacro(Bold, int);
52   vtkBooleanMacro(Bold, int);
53
54   vtkSetMacro(Italic, int);
55   vtkGetMacro(Italic, int);
56   vtkBooleanMacro(Italic, int);
57
58   vtkSetMacro(Shadow, int);
59   vtkGetMacro(Shadow, int);
60   vtkBooleanMacro(Shadow, int);
61
62   vtkSetMacro(FontFamily, int);
63   vtkGetMacro(FontFamily, int);
64   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
65   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
66   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
67
68   vtkSetStringMacro(LabelFormat);
69   vtkGetStringMacro(LabelFormat);
70
71   vtkSetStringMacro(Title);
72   vtkGetStringMacro(Title);
73
74   void ShallowCopy(vtkProp *prop);
75
76 protected:
77   VISU_ScalarBarActor();
78   ~VISU_ScalarBarActor();
79   VISU_ScalarBarActor(const VISU_ScalarBarActor&);
80   void operator=(const VISU_ScalarBarActor&);
81
82   VISU_LookupTable* myLookupTable;
83 private:
84   int   MaximumNumberOfColors;
85   int   NumberOfLabels;
86   int   NumberOfLabelsBuilt;
87   int   Orientation;
88   char  *Title;
89
90   int   Bold;
91   int   Italic;
92   int   Shadow;
93   int   FontFamily;
94   char  *LabelFormat;
95
96 private:
97   vtkTextMapper *TitleMapper;
98   vtkActor2D    *TitleActor;
99
100   vtkTextMapper **TextMappers;
101   vtkActor2D    **TextActors;
102
103   vtkPolyData         *ScalarBar;
104   vtkPolyDataMapper2D *ScalarBarMapper;
105   vtkActor2D          *ScalarBarActor;
106
107   vtkTimeStamp  BuildTime;
108   int LastSize[2];
109   int LastOrigin[2];
110
111   void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
112   void AllocateAndSizeLabels(int *labelSize, int *size,
113                              vtkViewport *viewport, float *range);
114 };
115
116 #endif