b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
7fd59977 |
14 | |
42cf5bc1 |
15 | #include <Quantity_Convert.hxx> |
16 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
17 | |
09324e85 |
18 | Standard_EXPORT NCollection_Array1<Standard_Real> ConvertTable(1,68); |
7fd59977 |
19 | static Standard_CString theEnums[] = { // En attendant la methode "Elements" de Standard_Type |
20 | "Quantity_MASS", |
21 | "Quantity_PLANEANGLE", |
22 | "Quantity_SOLIDANGLE", |
23 | "Quantity_LENGTH", |
24 | "Quantity_AREA", |
25 | "Quantity_VOLUME", |
26 | "Quantity_SPEED", |
27 | "Quantity_VELOCITY", |
28 | "Quantity_ACCELERATION", |
29 | "Quantity_ANGULARVELOCITY", |
30 | "Quantity_FREQUENCY", |
31 | "Quantity_TEMPERATURE", |
32 | "Quantity_AMOUNTOFSUBSTANCE", |
33 | "Quantity_DENSITY", |
34 | "Quantity_MASSFLOW", |
35 | "Quantity_VOLUMEFLOW", |
36 | "Quantity_CONSUMPTION", |
37 | "Quantity_MOMENTUM", |
38 | "Quantity_KINETICMOMENT", |
39 | "Quantity_MOMENTOFINERTIA", |
40 | "Quantity_FORCE", |
41 | "Quantity_MOMENTOFAFORCE", |
42 | "Quantity_TORQUE", |
43 | "Quantity_WEIGHT", |
44 | "Quantity_PRESSURE", |
45 | "Quantity_VISCOSITY", |
46 | "Quantity_KINEMATICVISCOSITY", |
47 | "Quantity_ENERGY", |
48 | "Quantity_WORK", |
49 | "Quantity_POWER", |
50 | "Quantity_SURFACETENSION", |
51 | "Quantity_COEFFICIENTOFEXPANSION", |
52 | "Quantity_THERMALCONDUCTIVITY", |
53 | "Quantity_SPECIFICHEATCAPACITY", |
54 | "Quantity_ENTROPY", |
55 | "Quantity_ENTHALPY", |
56 | "Quantity_LUMINOUSINTENSITY", |
57 | "Quantity_LUMINOUSFLUX", |
58 | "Quantity_LUMINANCE", |
59 | "Quantity_ILLUMINANCE", |
60 | "Quantity_LUMINOUSEXPOSITION", |
61 | "Quantity_LUMINOUSEFFICACITY", |
62 | "Quantity_ELECTRICCHARGE", |
63 | "Quantity_ELECTRICCURRENT", |
64 | "Quantity_ELECTRICFIELDSTRENGTH", |
65 | "Quantity_ELECTRICPOTENTIAL", |
66 | "Quantity_ELECTRICCAPACITANCE", |
67 | "Quantity_MAGNETICFLUX", |
68 | "Quantity_MAGNETICFLUXDENSITY", |
69 | "Quantity_MAGNETICFIELDSTRENGTH", |
70 | "Quantity_RELUCTANCE", |
71 | "Quantity_RESISTANCE", |
72 | "Quantity_INDUCTANCE", |
73 | "Quantity_CAPACITANCE", |
74 | "Quantity_IMPEDANCE", |
75 | "Quantity_ADMITTANCE", |
76 | "Quantity_RESISTIVITY", |
77 | "Quantity_CONDUCTIVITY", |
78 | "Quantity_MOLARMASS", |
79 | "Quantity_MOLARVOLUME", |
80 | "Quantity_CONCENTRATION", |
81 | "Quantity_MOLARCONCENTRATION", |
82 | "Quantity_MOLARITY", |
83 | "Quantity_SOUNDINTENSITY", |
84 | "Quantity_ACOUSTICINTENSITY", |
85 | "Quantity_ACTIVITY", |
86 | "Quantity_ABSORBEDDOSE", |
87 | "Quantity_DOSEEQUIVALENT" }; |
88 | |
89 | //---------------------------------------------------------------------------- |
90 | // Create |
91 | //---------------------------------------------------------------------------- |
92 | Quantity_Convert::Quantity_Convert () { |
93 | // ...On se fixe sur un nombre de grandeurs physiques egal a 68 (temporaire) |
94 | // ...Initialisation de la table de correspondance a 1 (Coefficient de conversion |
95 | // ...par defaut) |
96 | for (Standard_Integer i = 1 ; i <= 68 ; i++) ConvertTable(i) = 1; |
97 | } |
98 | |
7fd59977 |
99 | //---------------------------------------------------------------------------- |
100 | // IsPhysicalQuantity |
101 | //---------------------------------------------------------------------------- |
102 | Standard_Boolean Quantity_Convert::IsPhysicalQuantity |
103 | (const TCollection_AsciiString& aTypeName, TCollection_AsciiString& anEnum) |
104 | { |
105 | // ... Fabriquer le nom de l'enumeration (Quantity_LENGTH par exemple). |
106 | TCollection_AsciiString aPrefixe("Quantity_"); |
107 | anEnum = aTypeName; |
108 | anEnum.UpperCase(); |
109 | anEnum.Prepend(aPrefixe); |
110 | // ... Rechercher si il existe existe une valeur d'enum correspondante a <aTypeName> |
111 | Standard_Integer i = 1; |
112 | Standard_Boolean Find = Standard_False; |
113 | while (i <= 68 && !Find) |
114 | { |
42a9dcfc |
115 | if (IsEqual(anEnum.ToCString(),theEnums[i-1])) |
7fd59977 |
116 | Find = Standard_True; |
117 | else |
118 | i++; |
119 | } |
120 | return Find; |
121 | |
122 | } |