0023810: Cyclic dependency detected between the several OCCT units
[occt.git] / src / Aspect / Aspect_ColorScale.cdl
1 -- Created on: 2004-06-22
2 -- Created by: STV
3 -- Copyright (c) 2004-2012 OPEN CASCADE SAS
4 --
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.
9 --
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
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        Color                    from Quantity,
30        AsciiString              from TCollection,
31        ExtendedString           from TCollection,
32        SequenceOfExtendedString from TColStd
33
34 is
35
36         ---Category: Public
37
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
41
42
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;
47
48        GetMin(me)
49        returns Real from Standard;
50        ---Purpose: Returns minimal value of color scale;
51
52        GetMax(me)
53        returns Real from Standard;
54        ---Purpose: Returns maximal value of color scale;
55
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;
59
60        GetLabelType(me)
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
65
66         GetColorType(me)
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
71
72        GetNumberOfIntervals(me)
73        returns Integer from Standard;
74        ---Purpose: Returns the number of color scale intervals;
75
76        GetTitle(me)
77        returns ExtendedString from TCollection;
78        ---Purpose: Returns the color scale title string;
79
80        GetFormat(me)
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;
85
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.
90
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.
95
96        GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
97        ---Purpose: Returns the user specified labels.
98
99        GetColors(me; aColors : in out SequenceOfColor from Aspect);
100        ---Purpose: Returns the user specified colors.
101
102        GetLabelPosition(me)
103        returns TypeOfColorScalePosition from Aspect;
104        ---Purpose: Returns the position of labels concerning color filled rectangles.
105
106         GetTitlePosition(me)
107        returns TypeOfColorScalePosition from Aspect;
108        ---Purpose: Returns the position of color scale title.
109
110         IsReversed(me)
111        returns Boolean from Standard;
112         ---Purpose: Returns true if the labels and colors used in reversed order.
113
114         IsLabelAtBorder(me)
115        returns Boolean from Standard;
116         ---Purpose: Returns true if the labels placed at border of color filled rectangles.
117
118        SetMin(me : mutable; aMin : Real from Standard);
119        ---Purpose: Sets the minimal value of color scale.
120
121        SetMax(me : mutable; aMax : Real from Standard);
122        ---Purpose: Sets the maximal value of color scale.
123
124        SetRange(me : mutable; aMin : Real from Standard;
125                               aMax : Real from Standard);
126        ---Purpose: Sets the minimal and maximal value of color scale.
127
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
132
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
137
138        SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
139        ---Purpose: Sets the number of color scale intervals.
140
141        SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
142        ---Purpose: Sets the color scale title string.
143
144        SetFormat(me : mutable; aFormat : AsciiString from TCollection);
145        ---Purpose: Sets the color scale auto label format specification.
146
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.
150
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.
154
155        SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
156        ---Purpose: Sets the color scale labels.
157
158        SetColors(me : mutable; aMap : ColorMap from Aspect);
159        ---Purpose: Sets the color scale colors.
160
161        SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
162        ---Purpose: Sets the color scale colors.
163
164        SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
165        ---Purpose: Sets the color scale labels position concerning color filled rectangles.
166
167        SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
168        ---Purpose: Sets the color scale title position.
169
170         SetReversed(me : mutable; aReverse : Boolean from Standard);
171         ---Purpose: Sets true if the labels and colors used in reversed order.
172
173         SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
174         ---Purpose: Sets true if the labels placed at border of color filled rectangles.
175
176        --- Size and position management
177        --- Size and position are values relative to view size (between 0 and 1)
178
179        GetSize(me; aWidth  : in out Real from Standard;
180                    aHeight : in out Real from Standard);
181         ---Purpose: Returns the size of color scale.
182
183        GetWidth(me)
184        returns Real from Standard;
185         ---Purpose: Returns the width of color scale.
186
187        GetHeight(me)
188        returns Real from Standard;
189         ---Purpose: Returns the height of color scale.
190
191        SetSize(me : mutable; aWidth  : Real from Standard;
192                              aHeight : Real from Standard);
193         ---Purpose: Sets the size of color scale.
194
195        SetWidth(me : mutable; aWidth : Real from Standard);
196         ---Purpose: Sets the width of color scale.
197
198        SetHeight(me : mutable; aHeight : Real from Standard);
199         ---Purpose: Sets the height of color scale.
200
201        GetPosition(me; aX : in out Real from Standard;
202                        aY : in out Real from Standard);
203         ---Purpose: Returns the position of color scale.
204
205        GetXPosition(me)
206        returns Real from Standard;
207         ---Purpose: Returns the X position of color scale.
208
209        GetYPosition(me)
210        returns Real from Standard;
211         ---Purpose: Returns the height of color scale.
212
213        SetPosition(me : mutable; aX : Real from Standard;
214                                  aY : Real from Standard);
215         ---Purpose: Sets the position of color scale.
216
217        SetXPosition(me : mutable; aX : Real from Standard);
218         ---Purpose: Sets the X position of color scale.
219
220        SetYPosition(me : mutable; aY : Real from Standard);
221         ---Purpose: Sets the Y position of color scale.
222
223         GetTextHeight(me)
224         returns Integer from Standard;
225         
226         SetTextHeight(me: mutable; aHeigh :  Integer from Standard);
227
228
229         ---Category: Protected
230
231
232         Initialize
233        returns ColorScale from Aspect
234        is protected;
235
236        SizeHint(me; aWidth  : in out Integer from Standard;
237                     aHeight : in out Integer from Standard)
238        is protected;
239
240        UpdateColorScale(me : mutable)
241        is virtual protected;
242
243        DrawScale(me : mutable; aBgColor : Color from Quantity;
244                       X, Y, W, H : Integer from Standard)
245        is protected;
246
247         BeginPaint(me : mutable)
248        returns Boolean from Standard
249        is virtual protected;
250
251         EndPaint(me : mutable)
252        returns Boolean from Standard
253        is virtual protected;
254
255        PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
256                                aColor     : Color from Quantity;
257                                aFilled    : Boolean from Standard = Standard_False)
258        is deferred;
259
260         PaintText(me : mutable; aText : ExtendedString from TCollection;
261                                X, Y : Integer from Standard;
262                                aColor : Color from Quantity)
263        is deferred;
264
265         TextWidth(me; aText : ExtendedString from TCollection)
266        returns Integer from Standard
267        is deferred;
268
269         TextHeight(me; aText : ExtendedString from TCollection)
270        returns Integer from Standard
271        is deferred;
272
273         ---Category: Private
274
275        Format(me)
276        returns AsciiString from TCollection
277        is private;
278
279        GetCurrentLabel(me; anIndex : Integer from Standard)
280        returns ExtendedString from TCollection
281        is private;
282
283        GetCurrentColor(me; anIndex : Integer from Standard)
284        returns Color from Quantity
285        is private;
286
287        GetNumber(me; anIndex : Integer from Standard)
288        returns Real from Standard
289        is private;
290
291        HueFromValue(myclass; aValue : Integer from Standard;
292                              aMin   : Integer from Standard;
293                              aMax   : Integer from Standard)
294        returns Integer from Standard
295        is private;
296
297 fields
298
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;
305
306        myAtBorder              : Boolean from Standard;
307        myReversed              : Boolean from Standard;
308
309        myColors                : SequenceOfColor          from Aspect;
310        myLabels                : SequenceOfExtendedString from TColStd;
311
312        myLabelPos              : TypeOfColorScalePosition from Aspect;
313        myTitlePos              : TypeOfColorScalePosition from Aspect;
314
315        myXPos,  myYPos         : Real from Standard;
316        myWidth, myHeight       : Real from Standard;
317
318        myTextHeight            : Integer from Standard;
319
320 end ColorScale;