1 -- Created on: 2004-06-22
3 -- Copyright (c) 2004-2012 OPEN CASCADE SAS
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.
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.
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.
21 deferred class ColorScale from Aspect inherits TShared from MMgt
25 TypeOfColorScaleData from Aspect,
26 TypeOfColorScalePosition from Aspect,
28 SequenceOfColor from Aspect,
31 AsciiString from TCollection,
32 ExtendedString from TCollection,
33 SequenceOfExtendedString from TColStd
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
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;
50 returns Real from Standard;
51 ---Purpose: Returns minimal value of color scale;
54 returns Real from Standard;
55 ---Purpose: Returns maximal value of color scale;
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;
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
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
73 GetNumberOfIntervals(me)
74 returns Integer from Standard;
75 ---Purpose: Returns the number of color scale intervals;
78 returns ExtendedString from TCollection;
79 ---Purpose: Returns the color scale title string;
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;
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.
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.
97 GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
98 ---Purpose: Returns the user specified labels.
100 GetColors(me; aColors : in out SequenceOfColor from Aspect);
101 ---Purpose: Returns the user specified colors.
104 returns TypeOfColorScalePosition from Aspect;
105 ---Purpose: Returns the position of labels concerning color filled rectangles.
108 returns TypeOfColorScalePosition from Aspect;
109 ---Purpose: Returns the position of color scale title.
112 returns Boolean from Standard;
113 ---Purpose: Returns true if the labels and colors used in reversed order.
116 returns Boolean from Standard;
117 ---Purpose: Returns true if the labels placed at border of color filled rectangles.
119 SetMin(me : mutable; aMin : Real from Standard);
120 ---Purpose: Sets the minimal value of color scale.
122 SetMax(me : mutable; aMax : Real from Standard);
123 ---Purpose: Sets the maximal value of color scale.
125 SetRange(me : mutable; aMin : Real from Standard;
126 aMax : Real from Standard);
127 ---Purpose: Sets the minimal and maximal value of color scale.
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
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
139 SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
140 ---Purpose: Sets the number of color scale intervals.
142 SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
143 ---Purpose: Sets the color scale title string.
145 SetFormat(me : mutable; aFormat : AsciiString from TCollection);
146 ---Purpose: Sets the color scale auto label format specification.
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.
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.
156 SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
157 ---Purpose: Sets the color scale labels.
159 SetColors(me : mutable; aMap : ColorMap from Aspect);
160 ---Purpose: Sets the color scale colors.
162 SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
163 ---Purpose: Sets the color scale colors.
165 SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
166 ---Purpose: Sets the color scale labels position concerning color filled rectangles.
168 SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
169 ---Purpose: Sets the color scale title position.
171 SetReversed(me : mutable; aReverse : Boolean from Standard);
172 ---Purpose: Sets true if the labels and colors used in reversed order.
174 SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
175 ---Purpose: Sets true if the labels placed at border of color filled rectangles.
177 --- Size and position management
178 --- Size and position are values relative to view size (between 0 and 1)
180 GetSize(me; aWidth : in out Real from Standard;
181 aHeight : in out Real from Standard);
182 ---Purpose: Returns the size of color scale.
185 returns Real from Standard;
186 ---Purpose: Returns the width of color scale.
189 returns Real from Standard;
190 ---Purpose: Returns the height of color scale.
192 SetSize(me : mutable; aWidth : Real from Standard;
193 aHeight : Real from Standard);
194 ---Purpose: Sets the size of color scale.
196 SetWidth(me : mutable; aWidth : Real from Standard);
197 ---Purpose: Sets the width of color scale.
199 SetHeight(me : mutable; aHeight : Real from Standard);
200 ---Purpose: Sets the height of color scale.
202 GetPosition(me; aX : in out Real from Standard;
203 aY : in out Real from Standard);
204 ---Purpose: Returns the position of color scale.
207 returns Real from Standard;
208 ---Purpose: Returns the X position of color scale.
211 returns Real from Standard;
212 ---Purpose: Returns the height of color scale.
214 SetPosition(me : mutable; aX : Real from Standard;
215 aY : Real from Standard);
216 ---Purpose: Sets the position of color scale.
218 SetXPosition(me : mutable; aX : Real from Standard);
219 ---Purpose: Sets the X position of color scale.
221 SetYPosition(me : mutable; aY : Real from Standard);
222 ---Purpose: Sets the Y position of color scale.
225 returns Integer from Standard;
227 SetTextHeight(me: mutable; aHeigh : Integer from Standard);
230 ---Category: Protected
234 returns ColorScale from Aspect
237 SizeHint(me; aWidth : in out Integer from Standard;
238 aHeight : in out Integer from Standard)
241 UpdateColorScale(me : mutable)
242 is virtual protected;
244 DrawScale(me : mutable; aBgColor : Color from Quantity;
245 X, Y, W, H : Integer from Standard)
248 BeginPaint(me : mutable)
249 returns Boolean from Standard
250 is virtual protected;
252 EndPaint(me : mutable)
253 returns Boolean from Standard
254 is virtual protected;
256 PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
257 aColor : Color from Quantity;
258 aFilled : Boolean from Standard = Standard_False)
261 PaintText(me : mutable; aText : ExtendedString from TCollection;
262 X, Y : Integer from Standard;
263 aColor : Color from Quantity)
266 TextWidth(me; aText : ExtendedString from TCollection)
267 returns Integer from Standard
270 TextHeight(me; aText : ExtendedString from TCollection)
271 returns Integer from Standard
277 returns AsciiString from TCollection
280 GetCurrentLabel(me; anIndex : Integer from Standard)
281 returns ExtendedString from TCollection
284 GetCurrentColor(me; anIndex : Integer from Standard)
285 returns Color from Quantity
288 GetNumber(me; anIndex : Integer from Standard)
289 returns Real from Standard
292 HueFromValue(myclass; aValue : Integer from Standard;
293 aMin : Integer from Standard;
294 aMax : Integer from Standard)
295 returns Integer from Standard
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;
307 myAtBorder : Boolean from Standard;
308 myReversed : Boolean from Standard;
310 myColors : SequenceOfColor from Aspect;
311 myLabels : SequenceOfExtendedString from TColStd;
313 myLabelPos : TypeOfColorScalePosition from Aspect;
314 myTitlePos : TypeOfColorScalePosition from Aspect;
316 myXPos, myYPos : Real from Standard;
317 myWidth, myHeight : Real from Standard;
319 myTextHeight : Integer from Standard;