0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / Aspect / Aspect_ColorScale.cdl
1 -- Created on: 2004-06-22
2 -- Created by: STV
3 -- Copyright (c) 2004-2014 OPEN CASCADE SAS
4 --
5 -- This file is part of Open CASCADE Technology software library.
6 --
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.
12 --
13 -- Alternatively, this file may be used under the terms of Open CASCADE
14 -- commercial license or contractual agreement.
15
16 deferred class ColorScale from Aspect inherits TShared from MMgt
17         ---Purpose: Defines a color scale for viewer.
18 uses
19
20        TypeOfColorScaleData     from Aspect,
21        TypeOfColorScalePosition from Aspect,
22        SequenceOfColor          from Aspect,
23        Color                    from Quantity,
24        AsciiString              from TCollection,
25        ExtendedString           from TCollection,
26        SequenceOfExtendedString from TColStd
27
28 is
29
30         ---Category: Public
31
32        FindColor( me; theValue : Real from Standard;
33                       theColor : 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
35
36
37        FindColor( myclass; theValue : Real from Standard;
38                            theMin, theMax : Real from Standard;
39                            theColorsCount : Integer from Standard;
40                            theColor : in out Color from Quantity ) returns Boolean from Standard;
41
42        GetMin(me)
43        returns Real from Standard;
44        ---Purpose: Returns minimal value of color scale;
45
46        GetMax(me)
47        returns Real from Standard;
48        ---Purpose: Returns maximal value of color scale;
49
50        GetRange(me; theMin : in out Real from Standard;
51                     theMax : in out Real from Standard);
52        ---Purpose: Returns minimal and maximal values of color scale;
53
54        GetLabelType(me)
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
59
60         GetColorType(me)
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
65
66        GetNumberOfIntervals(me)
67        returns Integer from Standard;
68        ---Purpose: Returns the number of color scale intervals;
69
70        GetTitle(me)
71        returns ExtendedString from TCollection;
72        ---Purpose: Returns the color scale title string;
73
74        GetFormat(me)
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;
79
80         GetLabel(me; theIndex : 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.
84
85         GetColor(me; theIndex : 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.
89
90        GetLabels(me; theLabels : in out SequenceOfExtendedString from TColStd);
91        ---Purpose: Returns the user specified labels.
92
93        GetColors(me; theColors : in out SequenceOfColor from Aspect);
94        ---Purpose: Returns the user specified colors.
95
96        GetLabelPosition(me)
97        returns TypeOfColorScalePosition from Aspect;
98        ---Purpose: Returns the position of labels concerning color filled rectangles.
99
100         GetTitlePosition(me)
101        returns TypeOfColorScalePosition from Aspect;
102        ---Purpose: Returns the position of color scale title.
103
104         IsReversed(me)
105        returns Boolean from Standard;
106         ---Purpose: Returns true if the labels and colors used in reversed order.
107
108         IsLabelAtBorder(me)
109        returns Boolean from Standard;
110         ---Purpose: Returns true if the labels placed at border of color filled rectangles.
111
112        SetMin(me : mutable; theMin : Real from Standard);
113        ---Purpose: Sets the minimal value of color scale.
114
115        SetMax(me : mutable; theMax : Real from Standard);
116        ---Purpose: Sets the maximal value of color scale.
117
118        SetRange(me : mutable; theMin : Real from Standard;
119                               theMax : Real from Standard);
120        ---Purpose: Sets the minimal and maximal value of color scale.
121
122        SetLabelType(me : mutable; theType : 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
126
127        SetColorType(me : mutable; theType : 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
131
132        SetNumberOfIntervals(me : mutable; theNum : Integer from Standard);
133        ---Purpose: Sets the number of color scale intervals.
134
135        SetTitle(me : mutable; theTitle : ExtendedString from TCollection);
136        ---Purpose: Sets the color scale title string.
137
138        SetFormat(me : mutable; theFormat : AsciiString from TCollection);
139        ---Purpose: Sets the color scale auto label format specification.
140
141        SetLabel(me : mutable; theLabel  : ExtendedString from TCollection;
142                               anIndex : Integer from Standard = -1);
143        ---Purpose: Sets the color scale label at index. Index started from 1.
144
145        SetColor(me : mutable; theColor  : Color from Quantity;
146                               theIndex : Integer from Standard = -1);
147        ---Purpose: Sets the color scale color at index. Index started from 1.
148
149        SetLabels(me : mutable; theSeq : SequenceOfExtendedString from TColStd);
150        ---Purpose: Sets the color scale labels.
151
152        SetColors(me : mutable; theSeq : SequenceOfColor from Aspect);
153        ---Purpose: Sets the color scale colors.
154
155        SetLabelPosition(me : mutable; thePos : TypeOfColorScalePosition from Aspect);
156        ---Purpose: Sets the color scale labels position concerning color filled rectangles.
157
158        SetTitlePosition(me : mutable; thePos : TypeOfColorScalePosition from Aspect);
159        ---Purpose: Sets the color scale title position.
160
161         SetReversed(me : mutable; theReverse : Boolean from Standard);
162         ---Purpose: Sets true if the labels and colors used in reversed order.
163
164         SetLabelAtBorder(me : mutable; theOn : Boolean from Standard);
165         ---Purpose: Sets true if the labels placed at border of color filled rectangles.
166
167        --- Size and position management
168        --- Size and position are values relative to view size (between 0 and 1)
169
170        GetSize(me; theWidth  : in out Real from Standard;
171                    theHeight : in out Real from Standard);
172         ---Purpose: Returns the size of color scale.
173
174        GetWidth(me)
175        returns Real from Standard;
176         ---Purpose: Returns the width of color scale.
177
178        GetHeight(me)
179        returns Real from Standard;
180         ---Purpose: Returns the height of color scale.
181
182        SetSize(me : mutable; theWidth  : Real from Standard;
183                              theHeight : Real from Standard);
184         ---Purpose: Sets the size of color scale.
185
186        SetWidth(me : mutable; theWidth : Real from Standard);
187         ---Purpose: Sets the width of color scale.
188
189        SetHeight(me : mutable; theHeight : Real from Standard);
190         ---Purpose: Sets the height of color scale.
191
192        GetPosition(me; theX : in out Real from Standard;
193                        theY : in out Real from Standard);
194         ---Purpose: Returns the position of color scale.
195
196        GetXPosition(me)
197        returns Real from Standard;
198         ---Purpose: Returns the X position of color scale.
199
200        GetYPosition(me)
201        returns Real from Standard;
202         ---Purpose: Returns the height of color scale.
203
204        SetPosition(me : mutable; theX : Real from Standard;
205                                  theY : Real from Standard);
206         ---Purpose: Sets the position of color scale.
207
208        SetXPosition(me : mutable; theX : Real from Standard);
209         ---Purpose: Sets the X position of color scale.
210
211        SetYPosition(me : mutable; theY : Real from Standard);
212         ---Purpose: Sets the Y position of color scale.
213
214         GetTextHeight(me)
215         returns Integer from Standard;
216  ---Purpose: Returns the height of text of color scale.
217
218         SetTextHeight(me: mutable; theHeight :  Integer from Standard);
219  ---Purpose: Sets the height of text of color scale.
220
221         ---Category: Protected
222
223
224         Initialize
225        returns ColorScale from Aspect
226        is protected;
227         ---Purpose: Default constructor.
228
229        SizeHint(me; theWidth  : in out Integer from Standard;
230                     theHeight : in out Integer from Standard)
231        is protected;
232         ---Purpose: Returns the size of color scale.
233     -- @param theWidth [out] the width of color scale.
234     -- @param theHeight [out] the height of color scale.
235
236
237        UpdateColorScale(me : mutable)
238        is virtual protected;
239         ---Purpose: updates color scale parameters.
240
241        DrawScale(me : mutable; theBgColor : Color from Quantity;
242                       theX, theY, theWidth, theHeight : Integer from Standard)
243        is protected;
244         ---Purpose: Draws color scale.
245     -- @param theBgColor [in] background color
246     -- @param theX [in] the X coordinate of color scale position.
247     -- @param theY [in] the Y coordinate of color scale position.
248     -- @param theWidth [in] the width of color scale.
249     -- @param theHeight [in] the height of color scale.
250
251         BeginPaint(me : mutable)
252        returns Boolean from Standard
253        is virtual protected;
254
255         EndPaint(me : mutable)
256        returns Boolean from Standard
257        is virtual protected;
258
259        PaintRect(me : mutable; theX, theY, theWidth, theHeight : Integer from Standard;
260                                theColor     : Color from Quantity;
261                                theFilled    : Boolean from Standard = Standard_False)
262        is deferred;
263     ---Purpose: Draws a rectangle.
264     -- @param theX [in] the X coordinate of rectangle position.
265     -- @param theY [in] the Y coordinate of rectangle position.
266     -- @param theWidth [in] the width of rectangle.
267     -- @param theHeight [in] the height of rectangle.
268     -- @param theColor [in] the color of rectangle.
269     -- @param theFilled [in] defines if rectangle must be filled.
270
271         PaintText(me : mutable; theText : ExtendedString from TCollection;
272                                theX, theY : Integer from Standard;
273                                theColor : Color from Quantity)
274        is deferred;
275     ---Purpose: Draws a text.
276     -- @param theText [in] the text to draw.
277     -- @param theX [in] the X coordinate of text position.
278     -- @param theY [in] the Y coordinate of text position.
279     -- @param theColor [in] the color of text.
280
281         TextWidth(me; theText : ExtendedString from TCollection)
282        returns Integer from Standard
283        is deferred;
284     ---Purpose: Returns the width of text.
285     -- @param theText [in] the text of which to calculate width.
286
287         TextHeight(me; theText : ExtendedString from TCollection)
288        returns Integer from Standard
289        is deferred;
290     ---Purpose: Returns the height of text.
291     -- @param theText [in] the text of which to calculate height.
292
293         ---Category: Private
294
295        Format(me)
296        returns AsciiString from TCollection
297        is private;
298     ---Purpose: Returns the format of text.
299
300        GetNumber(me; theIndex : Integer from Standard)
301        returns Real from Standard
302        is private;
303     ---Purpose: Returns the value of given interval.
304
305        HueFromValue(myclass; theValue : Integer from Standard;
306                              theMin   : Integer from Standard;
307                              theMax   : Integer from Standard)
308        returns Integer from Standard
309        is private;
310     ---Purpose: Returns the color's hue for the given value in the given interval.
311     -- @param theValue [in] the current value of interval.
312     -- @param theMin [in] the min value of interval.
313     -- @param theMax [in] the max value of interval.
314
315 fields
316
317        myMin, myMax            : Real from Standard;
318        myTitle                 : ExtendedString from TCollection;
319        myFormat                : AsciiString from TCollection;
320        myInterval              : Integer from Standard;
321        myColorType             : TypeOfColorScaleData from Aspect;
322        myLabelType             : TypeOfColorScaleData from Aspect;
323
324        myAtBorder              : Boolean from Standard;
325        myReversed              : Boolean from Standard;
326
327        myColors                : SequenceOfColor          from Aspect;
328        myLabels                : SequenceOfExtendedString from TColStd;
329
330        myLabelPos              : TypeOfColorScalePosition from Aspect;
331        myTitlePos              : TypeOfColorScalePosition from Aspect;
332
333        myXPos,  myYPos         : Real from Standard;
334        myWidth, myHeight       : Real from Standard;
335
336        myTextHeight            : Integer from Standard;
337
338 end ColorScale;