summaryrefslogtreecommitdiff
path: root/inc/Aspect_ColorScale.hxx
blob: 5cab62342913f8ceaa976a1ede2b2c337fa38fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Aspect_ColorScale_HeaderFile
#define _Aspect_ColorScale_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_Aspect_ColorScale_HeaderFile
#include <Handle_Aspect_ColorScale.hxx>
#endif

#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _TCollection_ExtendedString_HeaderFile
#include <TCollection_ExtendedString.hxx>
#endif
#ifndef _TCollection_AsciiString_HeaderFile
#include <TCollection_AsciiString.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Aspect_TypeOfColorScaleData_HeaderFile
#include <Aspect_TypeOfColorScaleData.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Aspect_SequenceOfColor_HeaderFile
#include <Aspect_SequenceOfColor.hxx>
#endif
#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
#include <TColStd_SequenceOfExtendedString.hxx>
#endif
#ifndef _Aspect_TypeOfColorScalePosition_HeaderFile
#include <Aspect_TypeOfColorScalePosition.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Handle_Aspect_ColorMap_HeaderFile
#include <Handle_Aspect_ColorMap.hxx>
#endif
class Quantity_Color;
class TCollection_ExtendedString;
class TCollection_AsciiString;
class TColStd_SequenceOfExtendedString;
class Aspect_SequenceOfColor;
class Aspect_ColorMap;



class Aspect_ColorScale : public MMgt_TShared {

public:

  //! Calculate color according passed value; returns true if value is in range or false, if isn't <br>
  Standard_EXPORT     Standard_Boolean FindColor(const Standard_Real Value,Quantity_Color& Color) const;
  
  Standard_EXPORT   static  Standard_Boolean FindColor(const Standard_Real Value,const Standard_Real Min,const Standard_Real Max,const Standard_Integer ColorsCount,Quantity_Color& Color) ;
  //! Returns minimal value of color scale; <br>
  Standard_EXPORT     Standard_Real GetMin() const;
  //! Returns maximal value of color scale; <br>
  Standard_EXPORT     Standard_Real GetMax() const;
  //! Returns minimal and maximal values of color scale; <br>
  Standard_EXPORT     void GetRange(Standard_Real& aMin,Standard_Real& aMax) const;
  //! Returns the type of labels; <br>
//!         Aspect_TOCSD_AUTO - labels as boundary values for intervals <br>
//!         Aspect_TOCSD_USER - user specified label is used <br>
  Standard_EXPORT     Aspect_TypeOfColorScaleData GetLabelType() const;
  //! Returns the type of colors; <br>
//!         Aspect_TOCSD_AUTO - value between Red and Blue <br>
//!         Aspect_TOCSD_USER - user specified color from color map <br>
  Standard_EXPORT     Aspect_TypeOfColorScaleData GetColorType() const;
  //! Returns the number of color scale intervals; <br>
  Standard_EXPORT     Standard_Integer GetNumberOfIntervals() const;
  //! Returns the color scale title string; <br>
  Standard_EXPORT     TCollection_ExtendedString GetTitle() const;
  //! Returns the format for numbers. <br>
//!         The same like format for function printf(). <br>
//!         Used if GetLabelType() is TOCSD_AUTO; <br>
  Standard_EXPORT     TCollection_AsciiString GetFormat() const;
  //! Returns the user specified label with index <anIndex>. <br>
//!         Returns empty string if label not defined. <br>
  Standard_EXPORT     TCollection_ExtendedString GetLabel(const Standard_Integer anIndex) const;
  //! Returns the user specified color from color map with index <anIndex>. <br>
//!         Returns default color if index out of range in color map. <br>
  Standard_EXPORT     Quantity_Color GetColor(const Standard_Integer anIndex) const;
  //! Returns the user specified labels. <br>
  Standard_EXPORT     void GetLabels(TColStd_SequenceOfExtendedString& aLabels) const;
  //! Returns the user specified colors. <br>
  Standard_EXPORT     void GetColors(Aspect_SequenceOfColor& aColors) const;
  //! Returns the position of labels concerning color filled rectangles. <br>
  Standard_EXPORT     Aspect_TypeOfColorScalePosition GetLabelPosition() const;
  //! Returns the position of color scale title. <br>
  Standard_EXPORT     Aspect_TypeOfColorScalePosition GetTitlePosition() const;
  //! Returns true if the labels and colors used in reversed order. <br>
  Standard_EXPORT     Standard_Boolean IsReversed() const;
  //! Returns true if the labels placed at border of color filled rectangles. <br>
  Standard_EXPORT     Standard_Boolean IsLabelAtBorder() const;
  //! Sets the minimal value of color scale. <br>
  Standard_EXPORT     void SetMin(const Standard_Real aMin) ;
  //! Sets the maximal value of color scale. <br>
  Standard_EXPORT     void SetMax(const Standard_Real aMax) ;
  //! Sets the minimal and maximal value of color scale. <br>
  Standard_EXPORT     void SetRange(const Standard_Real aMin,const Standard_Real aMax) ;
  //! Sets the type of labels. <br>
//!         Aspect_TOCSD_AUTO - labels as boundary values for intervals <br>
//!         Aspect_TOCSD_USER - user specified label is used <br>
  Standard_EXPORT     void SetLabelType(const Aspect_TypeOfColorScaleData aType) ;
  //! Sets the type of colors. <br>
//!         Aspect_TOCSD_AUTO - value between Red and Blue <br>
//!         Aspect_TOCSD_USER - user specified color from color map <br>
  Standard_EXPORT     void SetColorType(const Aspect_TypeOfColorScaleData aType) ;
  //! Sets the number of color scale intervals. <br>
  Standard_EXPORT     void SetNumberOfIntervals(const Standard_Integer aNum) ;
  //! Sets the color scale title string. <br>
  Standard_EXPORT     void SetTitle(const TCollection_ExtendedString& aTitle) ;
  //! Sets the color scale auto label format specification. <br>
  Standard_EXPORT     void SetFormat(const TCollection_AsciiString& aFormat) ;
  //! Sets the color scale label at index. Index started from 1. <br>
  Standard_EXPORT     void SetLabel(const TCollection_ExtendedString& aLabel,const Standard_Integer anIndex = -1) ;
  //! Sets the color scale color at index. Index started from 1. <br>
  Standard_EXPORT     void SetColor(const Quantity_Color& aColor,const Standard_Integer anIndex = -1) ;
  //! Sets the color scale labels. <br>
  Standard_EXPORT     void SetLabels(const TColStd_SequenceOfExtendedString& aSeq) ;
  //! Sets the color scale colors. <br>
  Standard_EXPORT     void SetColors(const Handle(Aspect_ColorMap)& aMap) ;
  //! Sets the color scale colors. <br>
  Standard_EXPORT     void SetColors(const Aspect_SequenceOfColor& aSeq) ;
  //! Sets the color scale labels position concerning color filled rectangles. <br>
  Standard_EXPORT     void SetLabelPosition(const Aspect_TypeOfColorScalePosition aPos) ;
  //! Sets the color scale title position. <br>
  Standard_EXPORT     void SetTitlePosition(const Aspect_TypeOfColorScalePosition aPos) ;
  //! Sets true if the labels and colors used in reversed order. <br>
  Standard_EXPORT     void SetReversed(const Standard_Boolean aReverse) ;
  //! Sets true if the labels placed at border of color filled rectangles. <br>
  Standard_EXPORT     void SetLabelAtBorder(const Standard_Boolean anOn) ;
  //! Returns the size of color scale. <br>
  Standard_EXPORT     void GetSize(Standard_Real& aWidth,Standard_Real& aHeight) const;
  //! Returns the width of color scale. <br>
  Standard_EXPORT     Standard_Real GetWidth() const;
  //! Returns the height of color scale. <br>
  Standard_EXPORT     Standard_Real GetHeight() const;
  //! Sets the size of color scale. <br>
  Standard_EXPORT     void SetSize(const Standard_Real aWidth,const Standard_Real aHeight) ;
  //! Sets the width of color scale. <br>
  Standard_EXPORT     void SetWidth(const Standard_Real aWidth) ;
  //! Sets the height of color scale. <br>
  Standard_EXPORT     void SetHeight(const Standard_Real aHeight) ;
  //! Returns the position of color scale. <br>
  Standard_EXPORT     void GetPosition(Standard_Real& aX,Standard_Real& aY) const;
  //! Returns the X position of color scale. <br>
  Standard_EXPORT     Standard_Real GetXPosition() const;
  //! Returns the height of color scale. <br>
  Standard_EXPORT     Standard_Real GetYPosition() const;
  //! Sets the position of color scale. <br>
  Standard_EXPORT     void SetPosition(const Standard_Real aX,const Standard_Real aY) ;
  //! Sets the X position of color scale. <br>
  Standard_EXPORT     void SetXPosition(const Standard_Real aX) ;
  //! Sets the Y position of color scale. <br>
  Standard_EXPORT     void SetYPosition(const Standard_Real aY) ;
  
  Standard_EXPORT     Standard_Integer GetTextHeight() const;
  
  Standard_EXPORT     void SetTextHeight(const Standard_Integer aHeigh) ;
  
  Standard_EXPORT   virtual  void PaintRect(const Standard_Integer X,const Standard_Integer Y,const Standard_Integer W,const Standard_Integer H,const Quantity_Color& aColor,const Standard_Boolean aFilled = Standard_False)  = 0;
  
  Standard_EXPORT   virtual  void PaintText(const TCollection_ExtendedString& aText,const Standard_Integer X,const Standard_Integer Y,const Quantity_Color& aColor)  = 0;
  
  Standard_EXPORT   virtual  Standard_Integer TextWidth(const TCollection_ExtendedString& aText) const = 0;
  
  Standard_EXPORT   virtual  Standard_Integer TextHeight(const TCollection_ExtendedString& aText) const = 0;




  DEFINE_STANDARD_RTTI(Aspect_ColorScale)

protected:

  
  Standard_EXPORT   Aspect_ColorScale();
  
  Standard_EXPORT     void SizeHint(Standard_Integer& aWidth,Standard_Integer& aHeight) const;
  
  Standard_EXPORT   virtual  void UpdateColorScale() ;
  
  Standard_EXPORT     void DrawScale(const Quantity_Color& aBgColor,const Standard_Integer X,const Standard_Integer Y,const Standard_Integer W,const Standard_Integer H) ;
  
  Standard_EXPORT   virtual  Standard_Boolean BeginPaint() ;
  
  Standard_EXPORT   virtual  Standard_Boolean EndPaint() ;



private: 

  
  Standard_EXPORT     TCollection_AsciiString Format() const;
  
  Standard_EXPORT     TCollection_ExtendedString GetCurrentLabel(const Standard_Integer anIndex) const;
  
  Standard_EXPORT     Quantity_Color GetCurrentColor(const Standard_Integer anIndex) const;
  
  Standard_EXPORT     Standard_Real GetNumber(const Standard_Integer anIndex) const;
  
  Standard_EXPORT   static  Standard_Integer HueFromValue(const Standard_Integer aValue,const Standard_Integer aMin,const Standard_Integer aMax) ;

Standard_Real myMin;
Standard_Real myMax;
TCollection_ExtendedString myTitle;
TCollection_AsciiString myFormat;
Standard_Integer myInterval;
Aspect_TypeOfColorScaleData myColorType;
Aspect_TypeOfColorScaleData myLabelType;
Standard_Boolean myAtBorder;
Standard_Boolean myReversed;
Aspect_SequenceOfColor myColors;
TColStd_SequenceOfExtendedString myLabels;
Aspect_TypeOfColorScalePosition myLabelPos;
Aspect_TypeOfColorScalePosition myTitlePos;
Standard_Real myXPos;
Standard_Real myYPos;
Standard_Real myWidth;
Standard_Real myHeight;
Standard_Integer myTextHeight;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif