1 -- Created on: 2004-06-22
3 -- Copyright (c) 2004-2014 OPEN CASCADE SAS
5 -- This file is part of Open CASCADE Technology software library.
7 -- This library is free software; you can redistribute it and/or modify it under
8 -- the terms of the GNU Lesser General Public License version 2.1 as published
9 -- by the Free Software Foundation, with special exception defined in the file
10 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 -- distribution for complete text of the license and disclaimer of any warranty.
13 -- Alternatively, this file may be used under the terms of Open CASCADE
14 -- commercial license or contractual agreement.
16 deferred class ColorScale from Aspect inherits TShared from MMgt
17 ---Purpose: Defines a color scale for viewer.
20 TypeOfColorScaleData from Aspect,
21 TypeOfColorScalePosition from Aspect,
22 SequenceOfColor from Aspect,
24 AsciiString from TCollection,
25 ExtendedString from TCollection,
26 SequenceOfExtendedString from TColStd
32 FindColor( me; Value : Real from Standard;
33 Color : in out Color from Quantity ) returns Boolean from Standard;
34 ---Purpose: Calculate color according passed value; returns true if value is in range or false, if isn't
37 FindColor( myclass; Value : Real from Standard;
38 Min, Max : Real from Standard;
39 ColorsCount : Integer from Standard;
40 Color : in out Color from Quantity ) returns Boolean from Standard;
43 returns Real from Standard;
44 ---Purpose: Returns minimal value of color scale;
47 returns Real from Standard;
48 ---Purpose: Returns maximal value of color scale;
50 GetRange(me; aMin : in out Real from Standard;
51 aMax : in out Real from Standard);
52 ---Purpose: Returns minimal and maximal values of color scale;
55 returns TypeOfColorScaleData from Aspect;
56 ---Purpose: Returns the type of labels;
57 --- Aspect_TOCSD_AUTO - labels as boundary values for intervals
58 --- Aspect_TOCSD_USER - user specified label is used
61 returns TypeOfColorScaleData from Aspect;
62 ---Purpose: Returns the type of colors;
63 --- Aspect_TOCSD_AUTO - value between Red and Blue
64 --- Aspect_TOCSD_USER - user specified color from color map
66 GetNumberOfIntervals(me)
67 returns Integer from Standard;
68 ---Purpose: Returns the number of color scale intervals;
71 returns ExtendedString from TCollection;
72 ---Purpose: Returns the color scale title string;
75 returns AsciiString from TCollection;
76 ---Purpose: Returns the format for numbers.
77 -- The same like format for function printf().
78 -- Used if GetLabelType() is TOCSD_AUTO;
80 GetLabel(me; anIndex : Integer from Standard)
81 returns ExtendedString from TCollection;
82 ---Purpose: Returns the user specified label with index <anIndex>.
83 -- Returns empty string if label not defined.
85 GetColor(me; anIndex : Integer from Standard)
86 returns Color from Quantity;
87 ---Purpose: Returns the user specified color from color map with index <anIndex>.
88 -- Returns default color if index out of range in color map.
90 GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
91 ---Purpose: Returns the user specified labels.
93 GetColors(me; aColors : in out SequenceOfColor from Aspect);
94 ---Purpose: Returns the user specified colors.
97 returns TypeOfColorScalePosition from Aspect;
98 ---Purpose: Returns the position of labels concerning color filled rectangles.
101 returns TypeOfColorScalePosition from Aspect;
102 ---Purpose: Returns the position of color scale title.
105 returns Boolean from Standard;
106 ---Purpose: Returns true if the labels and colors used in reversed order.
109 returns Boolean from Standard;
110 ---Purpose: Returns true if the labels placed at border of color filled rectangles.
112 SetMin(me : mutable; aMin : Real from Standard);
113 ---Purpose: Sets the minimal value of color scale.
115 SetMax(me : mutable; aMax : Real from Standard);
116 ---Purpose: Sets the maximal value of color scale.
118 SetRange(me : mutable; aMin : Real from Standard;
119 aMax : Real from Standard);
120 ---Purpose: Sets the minimal and maximal value of color scale.
122 SetLabelType(me : mutable; aType : TypeOfColorScaleData from Aspect);
123 ---Purpose: Sets the type of labels.
124 -- Aspect_TOCSD_AUTO - labels as boundary values for intervals
125 -- Aspect_TOCSD_USER - user specified label is used
127 SetColorType(me : mutable; aType : TypeOfColorScaleData from Aspect);
128 ---Purpose: Sets the type of colors.
129 -- Aspect_TOCSD_AUTO - value between Red and Blue
130 -- Aspect_TOCSD_USER - user specified color from color map
132 SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
133 ---Purpose: Sets the number of color scale intervals.
135 SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
136 ---Purpose: Sets the color scale title string.
138 SetFormat(me : mutable; aFormat : AsciiString from TCollection);
139 ---Purpose: Sets the color scale auto label format specification.
141 SetLabel(me : mutable; aLabel : ExtendedString from TCollection;
142 anIndex : Integer from Standard = -1);
143 ---Purpose: Sets the color scale label at index. Index started from 1.
145 SetColor(me : mutable; aColor : Color from Quantity;
146 anIndex : Integer from Standard = -1);
147 ---Purpose: Sets the color scale color at index. Index started from 1.
149 SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
150 ---Purpose: Sets the color scale labels.
152 SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
153 ---Purpose: Sets the color scale colors.
155 SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
156 ---Purpose: Sets the color scale labels position concerning color filled rectangles.
158 SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
159 ---Purpose: Sets the color scale title position.
161 SetReversed(me : mutable; aReverse : Boolean from Standard);
162 ---Purpose: Sets true if the labels and colors used in reversed order.
164 SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
165 ---Purpose: Sets true if the labels placed at border of color filled rectangles.
167 --- Size and position management
168 --- Size and position are values relative to view size (between 0 and 1)
170 GetSize(me; aWidth : in out Real from Standard;
171 aHeight : in out Real from Standard);
172 ---Purpose: Returns the size of color scale.
175 returns Real from Standard;
176 ---Purpose: Returns the width of color scale.
179 returns Real from Standard;
180 ---Purpose: Returns the height of color scale.
182 SetSize(me : mutable; aWidth : Real from Standard;
183 aHeight : Real from Standard);
184 ---Purpose: Sets the size of color scale.
186 SetWidth(me : mutable; aWidth : Real from Standard);
187 ---Purpose: Sets the width of color scale.
189 SetHeight(me : mutable; aHeight : Real from Standard);
190 ---Purpose: Sets the height of color scale.
192 GetPosition(me; aX : in out Real from Standard;
193 aY : in out Real from Standard);
194 ---Purpose: Returns the position of color scale.
197 returns Real from Standard;
198 ---Purpose: Returns the X position of color scale.
201 returns Real from Standard;
202 ---Purpose: Returns the height of color scale.
204 SetPosition(me : mutable; aX : Real from Standard;
205 aY : Real from Standard);
206 ---Purpose: Sets the position of color scale.
208 SetXPosition(me : mutable; aX : Real from Standard);
209 ---Purpose: Sets the X position of color scale.
211 SetYPosition(me : mutable; aY : Real from Standard);
212 ---Purpose: Sets the Y position of color scale.
215 returns Integer from Standard;
217 SetTextHeight(me: mutable; aHeigh : Integer from Standard);
220 ---Category: Protected
224 returns ColorScale from Aspect
227 SizeHint(me; aWidth : in out Integer from Standard;
228 aHeight : in out Integer from Standard)
231 UpdateColorScale(me : mutable)
232 is virtual protected;
234 DrawScale(me : mutable; aBgColor : Color from Quantity;
235 X, Y, W, H : Integer from Standard)
238 BeginPaint(me : mutable)
239 returns Boolean from Standard
240 is virtual protected;
242 EndPaint(me : mutable)
243 returns Boolean from Standard
244 is virtual protected;
246 PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
247 aColor : Color from Quantity;
248 aFilled : Boolean from Standard = Standard_False)
251 PaintText(me : mutable; aText : ExtendedString from TCollection;
252 X, Y : Integer from Standard;
253 aColor : Color from Quantity)
256 TextWidth(me; aText : ExtendedString from TCollection)
257 returns Integer from Standard
260 TextHeight(me; aText : ExtendedString from TCollection)
261 returns Integer from Standard
267 returns AsciiString from TCollection
270 GetCurrentLabel(me; anIndex : Integer from Standard)
271 returns ExtendedString from TCollection
274 GetCurrentColor(me; anIndex : Integer from Standard)
275 returns Color from Quantity
278 GetNumber(me; anIndex : Integer from Standard)
279 returns Real from Standard
282 HueFromValue(myclass; aValue : Integer from Standard;
283 aMin : Integer from Standard;
284 aMax : Integer from Standard)
285 returns Integer from Standard
290 myMin, myMax : Real from Standard;
291 myTitle : ExtendedString from TCollection;
292 myFormat : AsciiString from TCollection;
293 myInterval : Integer from Standard;
294 myColorType : TypeOfColorScaleData from Aspect;
295 myLabelType : TypeOfColorScaleData from Aspect;
297 myAtBorder : Boolean from Standard;
298 myReversed : Boolean from Standard;
300 myColors : SequenceOfColor from Aspect;
301 myLabels : SequenceOfExtendedString from TColStd;
303 myLabelPos : TypeOfColorScalePosition from Aspect;
304 myTitlePos : TypeOfColorScalePosition from Aspect;
306 myXPos, myYPos : Real from Standard;
307 myWidth, myHeight : Real from Standard;
309 myTextHeight : Integer from Standard;