b311480e |
1 | -- Created on: 1994-07-19 |
2 | -- Created by: Guest Kernel |
3 | -- Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
973c2be1 |
8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public version 2.1 as published |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Convert from Quantity |
18 | |
19 | ---Purpose: Services to manage units conversion between Front-ends and Engines. |
20 | -- This conversion is managed by a table of correspondance between the quantities |
21 | -- and their "conversion coefficient". |
22 | -- This table is implemented like an external array (TCollection_Array1) regarding |
23 | -- to the quantities enumeration. |
24 | |
25 | uses |
26 | AsciiString from TCollection, |
27 | PhysicalQuantity from Quantity, |
28 | Coefficient from Quantity |
29 | |
30 | is |
31 | |
32 | Create returns Convert from Quantity; |
33 | ---Purpose: Creates an object; |
34 | |
35 | SetQuantity(myclass ; |
36 | aQuantity : PhysicalQuantity from Quantity ; |
37 | aCoef: Coefficient from Quantity); |
38 | ---Purpose: Updates the conversion table (correspondances between |
39 | -- Quantities and conversion coefficients). |
40 | ---C++: inline |
41 | |
42 | ConvertUserToSI(myclass ; |
43 | aQuantity : PhysicalQuantity from Quantity ; |
44 | aVal : Real from Standard) |
45 | returns Real from Standard; |
46 | ---Purpose: Converts, from the conversion table, the value <aVal> |
47 | -- from the user system to the SI system. |
48 | ---C++: inline |
49 | |
50 | ConvertSIToUser(myclass ; |
51 | aQuantity : PhysicalQuantity from Quantity ; |
52 | aVal : Real from Standard) |
53 | returns Real from Standard; |
54 | ---Purpose: Converts, from the conversion table, the value <aVal> |
55 | -- from the SI system to the user system. |
56 | ---C++: inline |
57 | |
58 | IsPhysicalQuantity(myclass; |
59 | aTypeName : AsciiString from TCollection ; |
60 | anEnum : in out AsciiString from TCollection) |
61 | returns Boolean from Standard; |
62 | ---Purpose: |
63 | -- if (aType is a physical quantity) |
64 | -- returns True and the name of the associated PhysicalQuantity . |
65 | -- else |
66 | -- returns False. |
67 | |
68 | end Convert from Quantity; |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | |
78 | |
79 | |
80 | |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | |
153 | |
154 | |
155 | |
156 | |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | |