b311480e |
1 | -- Created on: 2004-06-22 |
2 | -- Created by: STV |
3 | -- Copyright (c) 2004-2012 OPEN CASCADE SAS |
7fd59977 |
4 | -- |
b311480e |
5 | -- The content of this file is subject to the Open CASCADE Technology Public |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file |
7 | -- except in compliance with the License. Please obtain a copy of the License |
8 | -- at http://www.opencascade.org and read it completely before using this file. |
7fd59977 |
9 | -- |
b311480e |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | -- |
13 | -- The Original Code and all software distributed under the License is |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | -- Initial Developer hereby disclaims all such warranties, including without |
16 | -- limitation, any warranties of merchantability, fitness for a particular |
17 | -- purpose or non-infringement. Please see the License for the specific terms |
18 | -- and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | deferred class ColorScale from Aspect inherits TShared from MMgt |
22 | |
23 | uses |
24 | |
25 | TypeOfColorScaleData from Aspect, |
26 | TypeOfColorScalePosition from Aspect, |
27 | ColorMap from Aspect, |
28 | SequenceOfColor from Aspect, |
29 | View from Viewer, |
30 | Color from Quantity, |
31 | AsciiString from TCollection, |
32 | ExtendedString from TCollection, |
33 | SequenceOfExtendedString from TColStd |
34 | |
35 | is |
36 | |
37 | ---Category: Public |
38 | |
39 | FindColor( me; Value : Real from Standard; |
40 | Color : in out Color from Quantity ) returns Boolean from Standard; |
41 | ---Purpose: Calculate color according passed value; returns true if value is in range or false, if isn't |
42 | |
43 | |
44 | FindColor( myclass; Value : Real from Standard; |
45 | Min, Max : Real from Standard; |
46 | ColorsCount : Integer from Standard; |
47 | Color : in out Color from Quantity ) returns Boolean from Standard; |
48 | |
49 | GetMin(me) |
50 | returns Real from Standard; |
51 | ---Purpose: Returns minimal value of color scale; |
52 | |
53 | GetMax(me) |
54 | returns Real from Standard; |
55 | ---Purpose: Returns maximal value of color scale; |
56 | |
57 | GetRange(me; aMin : in out Real from Standard; |
58 | aMax : in out Real from Standard); |
59 | ---Purpose: Returns minimal and maximal values of color scale; |
60 | |
61 | GetLabelType(me) |
62 | returns TypeOfColorScaleData from Aspect; |
63 | ---Purpose: Returns the type of labels; |
64 | --- Aspect_TOCSD_AUTO - labels as boundary values for intervals |
65 | --- Aspect_TOCSD_USER - user specified label is used |
66 | |
67 | GetColorType(me) |
68 | returns TypeOfColorScaleData from Aspect; |
69 | ---Purpose: Returns the type of colors; |
70 | --- Aspect_TOCSD_AUTO - value between Red and Blue |
71 | --- Aspect_TOCSD_USER - user specified color from color map |
72 | |
73 | GetNumberOfIntervals(me) |
74 | returns Integer from Standard; |
75 | ---Purpose: Returns the number of color scale intervals; |
76 | |
77 | GetTitle(me) |
78 | returns ExtendedString from TCollection; |
79 | ---Purpose: Returns the color scale title string; |
80 | |
81 | GetFormat(me) |
82 | returns AsciiString from TCollection; |
83 | ---Purpose: Returns the format for numbers. |
84 | -- The same like format for function printf(). |
85 | -- Used if GetLabelType() is TOCSD_AUTO; |
86 | |
87 | GetLabel(me; anIndex : Integer from Standard) |
88 | returns ExtendedString from TCollection; |
89 | ---Purpose: Returns the user specified label with index <anIndex>. |
90 | -- Returns empty string if label not defined. |
91 | |
92 | GetColor(me; anIndex : Integer from Standard) |
93 | returns Color from Quantity; |
94 | ---Purpose: Returns the user specified color from color map with index <anIndex>. |
95 | -- Returns default color if index out of range in color map. |
96 | |
97 | GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd); |
98 | ---Purpose: Returns the user specified labels. |
99 | |
100 | GetColors(me; aColors : in out SequenceOfColor from Aspect); |
101 | ---Purpose: Returns the user specified colors. |
102 | |
103 | GetLabelPosition(me) |
104 | returns TypeOfColorScalePosition from Aspect; |
105 | ---Purpose: Returns the position of labels concerning color filled rectangles. |
106 | |
107 | GetTitlePosition(me) |
108 | returns TypeOfColorScalePosition from Aspect; |
109 | ---Purpose: Returns the position of color scale title. |
110 | |
111 | IsReversed(me) |
112 | returns Boolean from Standard; |
113 | ---Purpose: Returns true if the labels and colors used in reversed order. |
114 | |
115 | IsLabelAtBorder(me) |
116 | returns Boolean from Standard; |
117 | ---Purpose: Returns true if the labels placed at border of color filled rectangles. |
118 | |
119 | SetMin(me : mutable; aMin : Real from Standard); |
120 | ---Purpose: Sets the minimal value of color scale. |
121 | |
122 | SetMax(me : mutable; aMax : Real from Standard); |
123 | ---Purpose: Sets the maximal value of color scale. |
124 | |
125 | SetRange(me : mutable; aMin : Real from Standard; |
126 | aMax : Real from Standard); |
127 | ---Purpose: Sets the minimal and maximal value of color scale. |
128 | |
129 | SetLabelType(me : mutable; aType : TypeOfColorScaleData from Aspect); |
130 | ---Purpose: Sets the type of labels. |
131 | -- Aspect_TOCSD_AUTO - labels as boundary values for intervals |
132 | -- Aspect_TOCSD_USER - user specified label is used |
133 | |
134 | SetColorType(me : mutable; aType : TypeOfColorScaleData from Aspect); |
135 | ---Purpose: Sets the type of colors. |
136 | -- Aspect_TOCSD_AUTO - value between Red and Blue |
137 | -- Aspect_TOCSD_USER - user specified color from color map |
138 | |
139 | SetNumberOfIntervals(me : mutable; aNum : Integer from Standard); |
140 | ---Purpose: Sets the number of color scale intervals. |
141 | |
142 | SetTitle(me : mutable; aTitle : ExtendedString from TCollection); |
143 | ---Purpose: Sets the color scale title string. |
144 | |
145 | SetFormat(me : mutable; aFormat : AsciiString from TCollection); |
146 | ---Purpose: Sets the color scale auto label format specification. |
147 | |
148 | SetLabel(me : mutable; aLabel : ExtendedString from TCollection; |
149 | anIndex : Integer from Standard = -1); |
150 | ---Purpose: Sets the color scale label at index. Index started from 1. |
151 | |
152 | SetColor(me : mutable; aColor : Color from Quantity; |
153 | anIndex : Integer from Standard = -1); |
154 | ---Purpose: Sets the color scale color at index. Index started from 1. |
155 | |
156 | SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd); |
157 | ---Purpose: Sets the color scale labels. |
158 | |
159 | SetColors(me : mutable; aMap : ColorMap from Aspect); |
160 | ---Purpose: Sets the color scale colors. |
161 | |
162 | SetColors(me : mutable; aSeq : SequenceOfColor from Aspect); |
163 | ---Purpose: Sets the color scale colors. |
164 | |
165 | SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect); |
166 | ---Purpose: Sets the color scale labels position concerning color filled rectangles. |
167 | |
168 | SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect); |
169 | ---Purpose: Sets the color scale title position. |
170 | |
171 | SetReversed(me : mutable; aReverse : Boolean from Standard); |
172 | ---Purpose: Sets true if the labels and colors used in reversed order. |
173 | |
174 | SetLabelAtBorder(me : mutable; anOn : Boolean from Standard); |
175 | ---Purpose: Sets true if the labels placed at border of color filled rectangles. |
176 | |
177 | --- Size and position management |
178 | --- Size and position are values relative to view size (between 0 and 1) |
179 | |
180 | GetSize(me; aWidth : in out Real from Standard; |
181 | aHeight : in out Real from Standard); |
182 | ---Purpose: Returns the size of color scale. |
183 | |
184 | GetWidth(me) |
185 | returns Real from Standard; |
186 | ---Purpose: Returns the width of color scale. |
187 | |
188 | GetHeight(me) |
189 | returns Real from Standard; |
190 | ---Purpose: Returns the height of color scale. |
191 | |
192 | SetSize(me : mutable; aWidth : Real from Standard; |
193 | aHeight : Real from Standard); |
194 | ---Purpose: Sets the size of color scale. |
195 | |
196 | SetWidth(me : mutable; aWidth : Real from Standard); |
197 | ---Purpose: Sets the width of color scale. |
198 | |
199 | SetHeight(me : mutable; aHeight : Real from Standard); |
200 | ---Purpose: Sets the height of color scale. |
201 | |
202 | GetPosition(me; aX : in out Real from Standard; |
203 | aY : in out Real from Standard); |
204 | ---Purpose: Returns the position of color scale. |
205 | |
206 | GetXPosition(me) |
207 | returns Real from Standard; |
208 | ---Purpose: Returns the X position of color scale. |
209 | |
210 | GetYPosition(me) |
211 | returns Real from Standard; |
212 | ---Purpose: Returns the height of color scale. |
213 | |
214 | SetPosition(me : mutable; aX : Real from Standard; |
215 | aY : Real from Standard); |
216 | ---Purpose: Sets the position of color scale. |
217 | |
218 | SetXPosition(me : mutable; aX : Real from Standard); |
219 | ---Purpose: Sets the X position of color scale. |
220 | |
221 | SetYPosition(me : mutable; aY : Real from Standard); |
222 | ---Purpose: Sets the Y position of color scale. |
223 | |
224 | GetTextHeight(me) |
225 | returns Integer from Standard; |
226 | |
227 | SetTextHeight(me: mutable; aHeigh : Integer from Standard); |
228 | |
229 | |
230 | ---Category: Protected |
231 | |
232 | |
233 | Initialize |
234 | returns ColorScale from Aspect |
235 | is protected; |
236 | |
237 | SizeHint(me; aWidth : in out Integer from Standard; |
238 | aHeight : in out Integer from Standard) |
239 | is protected; |
240 | |
241 | UpdateColorScale(me : mutable) |
242 | is virtual protected; |
243 | |
244 | DrawScale(me : mutable; aBgColor : Color from Quantity; |
245 | X, Y, W, H : Integer from Standard) |
246 | is protected; |
247 | |
248 | BeginPaint(me : mutable) |
249 | returns Boolean from Standard |
250 | is virtual protected; |
251 | |
252 | EndPaint(me : mutable) |
253 | returns Boolean from Standard |
254 | is virtual protected; |
255 | |
256 | PaintRect(me : mutable; X, Y, W, H : Integer from Standard; |
257 | aColor : Color from Quantity; |
258 | aFilled : Boolean from Standard = Standard_False) |
259 | is deferred; |
260 | |
261 | PaintText(me : mutable; aText : ExtendedString from TCollection; |
262 | X, Y : Integer from Standard; |
263 | aColor : Color from Quantity) |
264 | is deferred; |
265 | |
266 | TextWidth(me; aText : ExtendedString from TCollection) |
267 | returns Integer from Standard |
268 | is deferred; |
269 | |
270 | TextHeight(me; aText : ExtendedString from TCollection) |
271 | returns Integer from Standard |
272 | is deferred; |
273 | |
274 | ---Category: Private |
275 | |
276 | Format(me) |
277 | returns AsciiString from TCollection |
278 | is private; |
279 | |
280 | GetCurrentLabel(me; anIndex : Integer from Standard) |
281 | returns ExtendedString from TCollection |
282 | is private; |
283 | |
284 | GetCurrentColor(me; anIndex : Integer from Standard) |
285 | returns Color from Quantity |
286 | is private; |
287 | |
288 | GetNumber(me; anIndex : Integer from Standard) |
289 | returns Real from Standard |
290 | is private; |
291 | |
292 | HueFromValue(myclass; aValue : Integer from Standard; |
293 | aMin : Integer from Standard; |
294 | aMax : Integer from Standard) |
295 | returns Integer from Standard |
296 | is private; |
297 | |
298 | fields |
299 | |
300 | myMin, myMax : Real from Standard; |
301 | myTitle : ExtendedString from TCollection; |
302 | myFormat : AsciiString from TCollection; |
303 | myInterval : Integer from Standard; |
304 | myColorType : TypeOfColorScaleData from Aspect; |
305 | myLabelType : TypeOfColorScaleData from Aspect; |
306 | |
307 | myAtBorder : Boolean from Standard; |
308 | myReversed : Boolean from Standard; |
309 | |
310 | myColors : SequenceOfColor from Aspect; |
311 | myLabels : SequenceOfExtendedString from TColStd; |
312 | |
313 | myLabelPos : TypeOfColorScalePosition from Aspect; |
314 | myTitlePos : TypeOfColorScalePosition from Aspect; |
315 | |
316 | myXPos, myYPos : Real from Standard; |
317 | myWidth, myHeight : Real from Standard; |
318 | |
319 | myTextHeight : Integer from Standard; |
320 | |
321 | end ColorScale; |