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,
30 AsciiString from TCollection,
31 ExtendedString from TCollection,
32 SequenceOfExtendedString from TColStd
38 FindColor( me; Value : Real from Standard;
39 Color : in out Color from Quantity ) returns Boolean from Standard;
40 ---Purpose: Calculate color according passed value; returns true if value is in range or false, if isn't
43 FindColor( myclass; Value : Real from Standard;
44 Min, Max : Real from Standard;
45 ColorsCount : Integer from Standard;
46 Color : in out Color from Quantity ) returns Boolean from Standard;
49 returns Real from Standard;
50 ---Purpose: Returns minimal value of color scale;
53 returns Real from Standard;
54 ---Purpose: Returns maximal value of color scale;
56 GetRange(me; aMin : in out Real from Standard;
57 aMax : in out Real from Standard);
58 ---Purpose: Returns minimal and maximal values of color scale;
61 returns TypeOfColorScaleData from Aspect;
62 ---Purpose: Returns the type of labels;
63 --- Aspect_TOCSD_AUTO - labels as boundary values for intervals
64 --- Aspect_TOCSD_USER - user specified label is used
67 returns TypeOfColorScaleData from Aspect;
68 ---Purpose: Returns the type of colors;
69 --- Aspect_TOCSD_AUTO - value between Red and Blue
70 --- Aspect_TOCSD_USER - user specified color from color map
72 GetNumberOfIntervals(me)
73 returns Integer from Standard;
74 ---Purpose: Returns the number of color scale intervals;
77 returns ExtendedString from TCollection;
78 ---Purpose: Returns the color scale title string;
81 returns AsciiString from TCollection;
82 ---Purpose: Returns the format for numbers.
83 -- The same like format for function printf().
84 -- Used if GetLabelType() is TOCSD_AUTO;
86 GetLabel(me; anIndex : Integer from Standard)
87 returns ExtendedString from TCollection;
88 ---Purpose: Returns the user specified label with index <anIndex>.
89 -- Returns empty string if label not defined.
91 GetColor(me; anIndex : Integer from Standard)
92 returns Color from Quantity;
93 ---Purpose: Returns the user specified color from color map with index <anIndex>.
94 -- Returns default color if index out of range in color map.
96 GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
97 ---Purpose: Returns the user specified labels.
99 GetColors(me; aColors : in out SequenceOfColor from Aspect);
100 ---Purpose: Returns the user specified colors.
103 returns TypeOfColorScalePosition from Aspect;
104 ---Purpose: Returns the position of labels concerning color filled rectangles.
107 returns TypeOfColorScalePosition from Aspect;
108 ---Purpose: Returns the position of color scale title.
111 returns Boolean from Standard;
112 ---Purpose: Returns true if the labels and colors used in reversed order.
115 returns Boolean from Standard;
116 ---Purpose: Returns true if the labels placed at border of color filled rectangles.
118 SetMin(me : mutable; aMin : Real from Standard);
119 ---Purpose: Sets the minimal value of color scale.
121 SetMax(me : mutable; aMax : Real from Standard);
122 ---Purpose: Sets the maximal value of color scale.
124 SetRange(me : mutable; aMin : Real from Standard;
125 aMax : Real from Standard);
126 ---Purpose: Sets the minimal and maximal value of color scale.
128 SetLabelType(me : mutable; aType : TypeOfColorScaleData from Aspect);
129 ---Purpose: Sets the type of labels.
130 -- Aspect_TOCSD_AUTO - labels as boundary values for intervals
131 -- Aspect_TOCSD_USER - user specified label is used
133 SetColorType(me : mutable; aType : TypeOfColorScaleData from Aspect);
134 ---Purpose: Sets the type of colors.
135 -- Aspect_TOCSD_AUTO - value between Red and Blue
136 -- Aspect_TOCSD_USER - user specified color from color map
138 SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
139 ---Purpose: Sets the number of color scale intervals.
141 SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
142 ---Purpose: Sets the color scale title string.
144 SetFormat(me : mutable; aFormat : AsciiString from TCollection);
145 ---Purpose: Sets the color scale auto label format specification.
147 SetLabel(me : mutable; aLabel : ExtendedString from TCollection;
148 anIndex : Integer from Standard = -1);
149 ---Purpose: Sets the color scale label at index. Index started from 1.
151 SetColor(me : mutable; aColor : Color from Quantity;
152 anIndex : Integer from Standard = -1);
153 ---Purpose: Sets the color scale color at index. Index started from 1.
155 SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
156 ---Purpose: Sets the color scale labels.
158 SetColors(me : mutable; aMap : ColorMap from Aspect);
159 ---Purpose: Sets the color scale colors.
161 SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
162 ---Purpose: Sets the color scale colors.
164 SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
165 ---Purpose: Sets the color scale labels position concerning color filled rectangles.
167 SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
168 ---Purpose: Sets the color scale title position.
170 SetReversed(me : mutable; aReverse : Boolean from Standard);
171 ---Purpose: Sets true if the labels and colors used in reversed order.
173 SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
174 ---Purpose: Sets true if the labels placed at border of color filled rectangles.
176 --- Size and position management
177 --- Size and position are values relative to view size (between 0 and 1)
179 GetSize(me; aWidth : in out Real from Standard;
180 aHeight : in out Real from Standard);
181 ---Purpose: Returns the size of color scale.
184 returns Real from Standard;
185 ---Purpose: Returns the width of color scale.
188 returns Real from Standard;
189 ---Purpose: Returns the height of color scale.
191 SetSize(me : mutable; aWidth : Real from Standard;
192 aHeight : Real from Standard);
193 ---Purpose: Sets the size of color scale.
195 SetWidth(me : mutable; aWidth : Real from Standard);
196 ---Purpose: Sets the width of color scale.
198 SetHeight(me : mutable; aHeight : Real from Standard);
199 ---Purpose: Sets the height of color scale.
201 GetPosition(me; aX : in out Real from Standard;
202 aY : in out Real from Standard);
203 ---Purpose: Returns the position of color scale.
206 returns Real from Standard;
207 ---Purpose: Returns the X position of color scale.
210 returns Real from Standard;
211 ---Purpose: Returns the height of color scale.
213 SetPosition(me : mutable; aX : Real from Standard;
214 aY : Real from Standard);
215 ---Purpose: Sets the position of color scale.
217 SetXPosition(me : mutable; aX : Real from Standard);
218 ---Purpose: Sets the X position of color scale.
220 SetYPosition(me : mutable; aY : Real from Standard);
221 ---Purpose: Sets the Y position of color scale.
224 returns Integer from Standard;
226 SetTextHeight(me: mutable; aHeigh : Integer from Standard);
229 ---Category: Protected
233 returns ColorScale from Aspect
236 SizeHint(me; aWidth : in out Integer from Standard;
237 aHeight : in out Integer from Standard)
240 UpdateColorScale(me : mutable)
241 is virtual protected;
243 DrawScale(me : mutable; aBgColor : Color from Quantity;
244 X, Y, W, H : Integer from Standard)
247 BeginPaint(me : mutable)
248 returns Boolean from Standard
249 is virtual protected;
251 EndPaint(me : mutable)
252 returns Boolean from Standard
253 is virtual protected;
255 PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
256 aColor : Color from Quantity;
257 aFilled : Boolean from Standard = Standard_False)
260 PaintText(me : mutable; aText : ExtendedString from TCollection;
261 X, Y : Integer from Standard;
262 aColor : Color from Quantity)
265 TextWidth(me; aText : ExtendedString from TCollection)
266 returns Integer from Standard
269 TextHeight(me; aText : ExtendedString from TCollection)
270 returns Integer from Standard
276 returns AsciiString from TCollection
279 GetCurrentLabel(me; anIndex : Integer from Standard)
280 returns ExtendedString from TCollection
283 GetCurrentColor(me; anIndex : Integer from Standard)
284 returns Color from Quantity
287 GetNumber(me; anIndex : Integer from Standard)
288 returns Real from Standard
291 HueFromValue(myclass; aValue : Integer from Standard;
292 aMin : Integer from Standard;
293 aMax : Integer from Standard)
294 returns Integer from Standard
299 myMin, myMax : Real from Standard;
300 myTitle : ExtendedString from TCollection;
301 myFormat : AsciiString from TCollection;
302 myInterval : Integer from Standard;
303 myColorType : TypeOfColorScaleData from Aspect;
304 myLabelType : TypeOfColorScaleData from Aspect;
306 myAtBorder : Boolean from Standard;
307 myReversed : Boolean from Standard;
309 myColors : SequenceOfColor from Aspect;
310 myLabels : SequenceOfExtendedString from TColStd;
312 myLabelPos : TypeOfColorScalePosition from Aspect;
313 myTitlePos : TypeOfColorScalePosition from Aspect;
315 myXPos, myYPos : Real from Standard;
316 myWidth, myHeight : Real from Standard;
318 myTextHeight : Integer from Standard;