1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <Quantity_Array1OfCoefficient.hxx>
17 #include <Quantity_Convert.hxx>
18 #include <TCollection_AsciiString.hxx>
20 Standard_EXPORT Quantity_Array1OfCoefficient ConvertTable(1,68);
21 static Standard_CString theEnums[] = { // En attendant la methode "Elements" de Standard_Type
23 "Quantity_PLANEANGLE",
24 "Quantity_SOLIDANGLE",
30 "Quantity_ACCELERATION",
31 "Quantity_ANGULARVELOCITY",
33 "Quantity_TEMPERATURE",
34 "Quantity_AMOUNTOFSUBSTANCE",
37 "Quantity_VOLUMEFLOW",
38 "Quantity_CONSUMPTION",
40 "Quantity_KINETICMOMENT",
41 "Quantity_MOMENTOFINERTIA",
43 "Quantity_MOMENTOFAFORCE",
48 "Quantity_KINEMATICVISCOSITY",
52 "Quantity_SURFACETENSION",
53 "Quantity_COEFFICIENTOFEXPANSION",
54 "Quantity_THERMALCONDUCTIVITY",
55 "Quantity_SPECIFICHEATCAPACITY",
58 "Quantity_LUMINOUSINTENSITY",
59 "Quantity_LUMINOUSFLUX",
61 "Quantity_ILLUMINANCE",
62 "Quantity_LUMINOUSEXPOSITION",
63 "Quantity_LUMINOUSEFFICACITY",
64 "Quantity_ELECTRICCHARGE",
65 "Quantity_ELECTRICCURRENT",
66 "Quantity_ELECTRICFIELDSTRENGTH",
67 "Quantity_ELECTRICPOTENTIAL",
68 "Quantity_ELECTRICCAPACITANCE",
69 "Quantity_MAGNETICFLUX",
70 "Quantity_MAGNETICFLUXDENSITY",
71 "Quantity_MAGNETICFIELDSTRENGTH",
72 "Quantity_RELUCTANCE",
73 "Quantity_RESISTANCE",
74 "Quantity_INDUCTANCE",
75 "Quantity_CAPACITANCE",
77 "Quantity_ADMITTANCE",
78 "Quantity_RESISTIVITY",
79 "Quantity_CONDUCTIVITY",
81 "Quantity_MOLARVOLUME",
82 "Quantity_CONCENTRATION",
83 "Quantity_MOLARCONCENTRATION",
85 "Quantity_SOUNDINTENSITY",
86 "Quantity_ACOUSTICINTENSITY",
88 "Quantity_ABSORBEDDOSE",
89 "Quantity_DOSEEQUIVALENT" };
91 //----------------------------------------------------------------------------
93 //----------------------------------------------------------------------------
94 Quantity_Convert::Quantity_Convert () {
95 // ...On se fixe sur un nombre de grandeurs physiques egal a 68 (temporaire)
96 // ...Initialisation de la table de correspondance a 1 (Coefficient de conversion
98 for (Standard_Integer i = 1 ; i <= 68 ; i++) ConvertTable(i) = 1;
102 //----------------------------------------------------------------------------
103 // IsPhysicalQuantity
104 //----------------------------------------------------------------------------
105 Standard_Boolean Quantity_Convert::IsPhysicalQuantity
106 (const TCollection_AsciiString& aTypeName, TCollection_AsciiString& anEnum)
108 // ... Fabriquer le nom de l'enumeration (Quantity_LENGTH par exemple).
109 TCollection_AsciiString aPrefixe("Quantity_");
112 anEnum.Prepend(aPrefixe);
113 // ... Rechercher si il existe existe une valeur d'enum correspondante a <aTypeName>
114 Standard_Integer i = 1;
115 Standard_Boolean Find = Standard_False;
116 while (i <= 68 && !Find)
118 if (IsEqual(anEnum.ToCString(),theEnums[i-1]))
119 Find = Standard_True;