f09e10e8ecf153157afeafcfbdf88b66c9293723
[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; 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
35
36
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;
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; aMin : in out Real from Standard;
51                     aMax : 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; 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.
84
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.
89
90        GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
91        ---Purpose: Returns the user specified labels.
92
93        GetColors(me; aColors : 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; aMin : Real from Standard);
113        ---Purpose: Sets the minimal value of color scale.
114
115        SetMax(me : mutable; aMax : Real from Standard);
116        ---Purpose: Sets the maximal value of color scale.
117
118        SetRange(me : mutable; aMin : Real from Standard;
119                               aMax : Real from Standard);
120        ---Purpose: Sets the minimal and maximal value of color scale.
121
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
126
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
131
132        SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
133        ---Purpose: Sets the number of color scale intervals.
134
135        SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
136        ---Purpose: Sets the color scale title string.
137
138        SetFormat(me : mutable; aFormat : AsciiString from TCollection);
139        ---Purpose: Sets the color scale auto label format specification.
140
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.
144
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.
148
149        SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
150        ---Purpose: Sets the color scale labels.
151
152        SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
153        ---Purpose: Sets the color scale colors.
154
155        SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
156        ---Purpose: Sets the color scale labels position concerning color filled rectangles.
157
158        SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
159        ---Purpose: Sets the color scale title position.
160
161         SetReversed(me : mutable; aReverse : Boolean from Standard);
162         ---Purpose: Sets true if the labels and colors used in reversed order.
163
164         SetLabelAtBorder(me : mutable; anOn : 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; aWidth  : in out Real from Standard;
171                    aHeight : 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; aWidth  : Real from Standard;
183                              aHeight : Real from Standard);
184         ---Purpose: Sets the size of color scale.
185
186        SetWidth(me : mutable; aWidth : Real from Standard);
187         ---Purpose: Sets the width of color scale.
188
189        SetHeight(me : mutable; aHeight : Real from Standard);
190         ---Purpose: Sets the height of color scale.
191
192        GetPosition(me; aX : in out Real from Standard;
193                        aY : 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; aX : Real from Standard;
205                                  aY : Real from Standard);
206         ---Purpose: Sets the position of color scale.
207
208        SetXPosition(me : mutable; aX : Real from Standard);
209         ---Purpose: Sets the X position of color scale.
210
211        SetYPosition(me : mutable; aY : Real from Standard);
212         ---Purpose: Sets the Y position of color scale.
213
214         GetTextHeight(me)
215         returns Integer from Standard;
216         
217         SetTextHeight(me: mutable; aHeigh :  Integer from Standard);
218
219
220         ---Category: Protected
221
222
223         Initialize
224        returns ColorScale from Aspect
225        is protected;
226
227        SizeHint(me; aWidth  : in out Integer from Standard;
228                     aHeight : in out Integer from Standard)
229        is protected;
230
231        UpdateColorScale(me : mutable)
232        is virtual protected;
233
234        DrawScale(me : mutable; aBgColor : Color from Quantity;
235                       X, Y, W, H : Integer from Standard)
236        is protected;
237
238         BeginPaint(me : mutable)
239        returns Boolean from Standard
240        is virtual protected;
241
242         EndPaint(me : mutable)
243        returns Boolean from Standard
244        is virtual protected;
245
246        PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
247                                aColor     : Color from Quantity;
248                                aFilled    : Boolean from Standard = Standard_False)
249        is deferred;
250
251         PaintText(me : mutable; aText : ExtendedString from TCollection;
252                                X, Y : Integer from Standard;
253                                aColor : Color from Quantity)
254        is deferred;
255
256         TextWidth(me; aText : ExtendedString from TCollection)
257        returns Integer from Standard
258        is deferred;
259
260         TextHeight(me; aText : ExtendedString from TCollection)
261        returns Integer from Standard
262        is deferred;
263
264         ---Category: Private
265
266        Format(me)
267        returns AsciiString from TCollection
268        is private;
269
270        GetCurrentLabel(me; anIndex : Integer from Standard)
271        returns ExtendedString from TCollection
272        is private;
273
274        GetCurrentColor(me; anIndex : Integer from Standard)
275        returns Color from Quantity
276        is private;
277
278        GetNumber(me; anIndex : Integer from Standard)
279        returns Real from Standard
280        is private;
281
282        HueFromValue(myclass; aValue : Integer from Standard;
283                              aMin   : Integer from Standard;
284                              aMax   : Integer from Standard)
285        returns Integer from Standard
286        is private;
287
288 fields
289
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;
296
297        myAtBorder              : Boolean from Standard;
298        myReversed              : Boolean from Standard;
299
300        myColors                : SequenceOfColor          from Aspect;
301        myLabels                : SequenceOfExtendedString from TColStd;
302
303        myLabelPos              : TypeOfColorScalePosition from Aspect;
304        myTitlePos              : TypeOfColorScalePosition from Aspect;
305
306        myXPos,  myYPos         : Real from Standard;
307        myWidth, myHeight       : Real from Standard;
308
309        myTextHeight            : Integer from Standard;
310
311 end ColorScale;