0024002: Overall code and build procedure refactoring -- Mac OSX
[occt.git] / src / UnitsAPI / UnitsAPI.cxx
CommitLineData
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.
b311480e 14
42cf5bc1 15
16#include <OSD_Environment.hxx>
17#include <Resource_Manager.hxx>
18#include <Standard_NoSuchObject.hxx>
19#include <TCollection_AsciiString.hxx>
7fd59977 20#include <Units.hxx>
42cf5bc1 21#include <Units_Dimensions.hxx>
7fd59977 22#include <Units_Quantity.hxx>
42cf5bc1 23#include <Units_Unit.hxx>
7fd59977 24#include <Units_UnitsSystem.hxx>
42cf5bc1 25#include <UnitsAPI.hxx>
7fd59977 26
27static Handle(Resource_Manager) CurrentUnits,SICurrentUnits,MDTVCurrentUnits;
28static Units_UnitsSystem LocalSystemUnits,SILocalSystemUnits,MDTVLocalSystemUnits;
29static TCollection_AsciiString rstring;
30static UnitsAPI_SystemUnits localSystem = UnitsAPI_SI;
31static UnitsAPI_SystemUnits currentSystem = UnitsAPI_DEFAULT;
32static OSD_Environment env1("CSF_UnitsLexicon");
33static OSD_Environment env2("CSF_UnitsDefinition");
34#ifdef WNT
35static OSD_Environment env3("CSF_CurrentUnits");
36static OSD_Environment env4("CSF_MDTVCurrentUnits");
37#endif
38
39
40//=======================================================================
41//function : CheckLoading
42//purpose :
43//=======================================================================
44
45void UnitsAPI::CheckLoading (const UnitsAPI_SystemUnits aSystemUnits)
46{
47 if( currentSystem != aSystemUnits || CurrentUnits.IsNull()) {
48 TCollection_AsciiString slexiconfile(env1.Value());
49 if( slexiconfile.Length() > 0 )
50 Units::LexiconFile(slexiconfile.ToCString());
51 else {
52 OSD_Environment CasRootEnv("CASROOT");
53 TCollection_AsciiString CasRootString(CasRootEnv.Value());
54 if (CasRootString.Length() > 0 ) {
55 CasRootString += "/src/UnitsAPI/Lexi_Expr.dat" ;
56 Units::LexiconFile(CasRootString.ToCString());
57 }
58 else {
59 Standard_NoSuchObject::Raise("environment variable CSF_UnitsLexicon undefined");
60 }
61 }
62 TCollection_AsciiString sunitsfile(env2.Value());
63 if( sunitsfile.Length() > 0 )
64 Units::UnitsFile(sunitsfile.ToCString());
65 else {
66 OSD_Environment CasRootEnv("CASROOT");
67 TCollection_AsciiString CasRootString(CasRootEnv.Value());
68 if (CasRootString.Length() > 0 ) {
69 CasRootString += "/src/UnitsAPI/Units.dat";
70 Units::UnitsFile(CasRootString.ToCString());
71 }
72 else {
73 Standard_NoSuchObject::Raise("environment variable CSF_UnitsDefinition undefined");
74 }
75 }
76 switch (aSystemUnits) {
77 case UnitsAPI_DEFAULT :
78 if( !CurrentUnits.IsNull() ) break;
79 case UnitsAPI_SI :
80 currentSystem = UnitsAPI_SI;
81 if( SICurrentUnits.IsNull() ) {
82#ifdef WNT
83 TCollection_AsciiString csfcurrent (env3.Value());
84 if( csfcurrent.Length() > 0 )
85 SICurrentUnits = new Resource_Manager(csfcurrent.ToCString());
86 else
87 SICurrentUnits = new Resource_Manager("CurrentUnits");
88#else
89 SICurrentUnits = new Resource_Manager("CurrentUnits");
90#endif
91 }
92 CurrentUnits = SICurrentUnits;
93 LocalSystemUnits = SILocalSystemUnits;
94 break;
95 case UnitsAPI_MDTV :
96 currentSystem = UnitsAPI_MDTV;
97 if( MDTVCurrentUnits.IsNull() ) {
98#ifdef WNT
99 TCollection_AsciiString csfmdtvcurrent (env4.Value());
100 if( csfmdtvcurrent.Length() > 0 )
101 MDTVCurrentUnits = new Resource_Manager(csfmdtvcurrent.ToCString());
102 else
103 MDTVCurrentUnits = new Resource_Manager("MDTVCurrentUnits");
104#else
105 MDTVCurrentUnits = new Resource_Manager("MDTVCurrentUnits");
106#endif
107 }
108 CurrentUnits = MDTVCurrentUnits;
109 if( MDTVLocalSystemUnits.IsEmpty() ) {
110 MDTVLocalSystemUnits.Specify("LENGTH","mm");
111 MDTVLocalSystemUnits.Specify("AREA","mm\xB2");
112 MDTVLocalSystemUnits.Specify("VOLUME","mm\xB3");
113 MDTVLocalSystemUnits.Specify("INERTIA","mm**4");
114 MDTVLocalSystemUnits.Specify("SPEED","mm/s");
115 MDTVLocalSystemUnits.Specify("ACCELERATION","mm/s\xB2");
116 MDTVLocalSystemUnits.Specify("VOLUMIC MASS","kg/mm\xB3");
117 MDTVLocalSystemUnits.Specify("VOLUME FLOW","mm\xB3/s");
118 MDTVLocalSystemUnits.Specify("CONSUMPTION","mm\xB2");
119 MDTVLocalSystemUnits.Specify("QUANTITY OF MOVEMENT","kg*mm/s");
120 MDTVLocalSystemUnits.Specify("KINETIC MOMENT","kg*mm\xB2/s");
121 MDTVLocalSystemUnits.Specify("MOMENT OF INERTIA","kg*mm\xB2");
122 MDTVLocalSystemUnits.Specify("FORCE","kg*mm/s\xB2");
123 MDTVLocalSystemUnits.Specify("LINEIC FORCE","kg/s\xB2");
124 MDTVLocalSystemUnits.Specify("MOMENT OF A FORCE","kg*mm\xB2/s\xB2");
125 MDTVLocalSystemUnits.Specify("PRESSURE","kg/(mm*s\xB2)");
126 MDTVLocalSystemUnits.Specify("DYNAMIC VISCOSITY","kg/(mm*s)");
127 MDTVLocalSystemUnits.Specify("KINETIC VISCOSITY","mm\xB2/s");
128 MDTVLocalSystemUnits.Specify("TENSION SUPERFICIELLE","mm/s\xB2");
129 MDTVLocalSystemUnits.Specify("ENERGY","kg*mm\xB2/s\xB2");
130 MDTVLocalSystemUnits.Specify("POWER","kg*mm\xB2/s\xB3");
131 MDTVLocalSystemUnits.Specify("LINEIC POWER","kg*mm/s\xB3");
132 MDTVLocalSystemUnits.Specify("SURFACIC POWER","kg/s\xB3");
133 MDTVLocalSystemUnits.Specify("VOLUMIC POWER","kg/(mm*s\xB3)");
134 MDTVLocalSystemUnits.Specify("THERMICAL CONDUCTIVITY","kg*mm/(s\xB3*\xB0K)");
135 MDTVLocalSystemUnits.Specify("THERMICAL CONVECTIVITY","kg/(s\xB3*\xB0K)");
136 MDTVLocalSystemUnits.Specify("THERMICAL MASSIC CAPACITY","mm\xB2/(s\xB2*\xB0K)");
137 MDTVLocalSystemUnits.Specify("ENTROPY","kg*mm\xB2/(s\xB2*\xB0K)");
138 MDTVLocalSystemUnits.Specify("ENTHALPY","kg*mm\xB2/s\xB2");
139 MDTVLocalSystemUnits.Specify("LUMINANCE","cd/mm\xB2");
140 MDTVLocalSystemUnits.Specify("LUMINOUS EFFICACITY","s\xB3*Lu/(kg*mm\xB2)");
141 MDTVLocalSystemUnits.Specify("ELECTRIC FIELD","V/mm");
142 MDTVLocalSystemUnits.Specify("ELECTRIC CAPACITANCE","s**4*A\xB2/(kg*mm\xB2)");
143 MDTVLocalSystemUnits.Specify("MAGNETIC FIELD","A/mm");
144 MDTVLocalSystemUnits.Specify("MAGNETIC FLUX","kg*mm\xB2/(s\xB2*A)");
145 MDTVLocalSystemUnits.Specify("INDUCTANCE","kg*mm\xB2/(s\xB2*A\xB2)");
146 MDTVLocalSystemUnits.Specify("RELUCTANCE","s\xB2*A\xB2/(kg*mm\xB2)");
147 MDTVLocalSystemUnits.Specify("RESISTIVITY","O*mm");
148 MDTVLocalSystemUnits.Specify("CONDUCTIVITY","S/mm");
149 MDTVLocalSystemUnits.Specify("MOLAR MASS","kg/mol");
150 MDTVLocalSystemUnits.Specify("MOLAR VOLUME","mm\xB3/mol");
151 MDTVLocalSystemUnits.Specify("CONCENTRATION","kg/mm\xB3");
152 MDTVLocalSystemUnits.Specify("MOLAR CONCENTRATION","mol/mm\xB3");
153 MDTVLocalSystemUnits.Specify("ACCOUSTIC INTENSITY","mm/A\xB2");
154 MDTVLocalSystemUnits.Specify("DOSE EQUIVALENT","mm\xB2/s\xB2");
155 MDTVLocalSystemUnits.Specify("ABSORBED DOSE","mm\xB2/s\xB2");
156 MDTVLocalSystemUnits.Specify("FLUX OF MAGNETIC INDUCTION","kg*mm\xB2/(s\xB2*A)");
157 MDTVLocalSystemUnits.Specify("ROTATION ACCELERATION","rad/s\xB2");
158 MDTVLocalSystemUnits.Specify("TRANSLATION STIFFNESS","kg/s\xB2");
159 MDTVLocalSystemUnits.Specify("ROTATION STIFFNESS","kg*mm\xB2/(s\xB2*rad)");
160 MDTVLocalSystemUnits.Activates();
161 }
162 LocalSystemUnits = MDTVLocalSystemUnits;
163 break;
164 }
165 }
166}
167
168
169//=======================================================================
170//function : CurrentToLS
171//purpose :
172//=======================================================================
173
174Standard_Real UnitsAPI::CurrentToLS(const Standard_Real aData,
175 const Standard_CString aQuantity)
176{
177 Standard_Real aValue = aData;
178 CheckLoading (localSystem);
179 if( CurrentUnits->Find(aQuantity) ) {
180 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
181 aValue = Units::ToSI(aData,current.ToCString());
182 aValue = LocalSystemUnits.ConvertSIValueToUserSystem(aQuantity,aValue);
183 }
0797d9d3 184#ifdef OCCT_DEBUG
7fd59977 185 else {
186 cout <<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
187 }
63c629aa 188#endif
7fd59977 189
190 return aValue;
191}
192
193
194//=======================================================================
195//function : CurrentToSI
196//purpose :
197//=======================================================================
198
199Standard_Real UnitsAPI::CurrentToSI(const Standard_Real aData,
200 const Standard_CString aQuantity)
201{
202 Standard_Real aValue = aData;
203 CheckLoading (UnitsAPI_DEFAULT);
204 if( CurrentUnits->Find(aQuantity) ) {
205 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
206 aValue = Units::ToSI(aData,current.ToCString());
207 }
0797d9d3 208#ifdef OCCT_DEBUG
7fd59977 209 else {
210 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
211 }
63c629aa 212#endif
7fd59977 213
214 return aValue;
215}
216
217
218//=======================================================================
219//function : CurrentFromLS
220//purpose :
221//=======================================================================
222
223Standard_Real UnitsAPI::CurrentFromLS(const Standard_Real aData,
224 const Standard_CString aQuantity)
225{
226 Standard_Real aValue = aData;
227 CheckLoading (localSystem);
228 if( CurrentUnits->Find(aQuantity) ) {
229 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
230 aValue = LocalSystemUnits.ConvertUserSystemValueToSI(aQuantity,aData);
231 aValue = Units::FromSI(aValue,current.ToCString());
232 }
0797d9d3 233#ifdef OCCT_DEBUG
7fd59977 234 else {
235 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
236 }
63c629aa 237#endif
7fd59977 238
239 return aValue;
240}
241
242
243//=======================================================================
244//function : CurrentFromSI
245//purpose :
246//=======================================================================
247
248Standard_Real UnitsAPI::CurrentFromSI(const Standard_Real aData,
249 const Standard_CString aQuantity)
250{
251 Standard_Real aValue = aData;
252 CheckLoading (UnitsAPI_DEFAULT);
253 if( CurrentUnits->Find(aQuantity) ) {
254 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
255 aValue = Units::FromSI(aData,current.ToCString());
256 }
0797d9d3 257#ifdef OCCT_DEBUG
7fd59977 258 else {
259 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
260 }
63c629aa 261#endif
7fd59977 262
263 return aValue;
264}
265
266
267//=======================================================================
268//function : CurrentToAny
269//purpose :
270//=======================================================================
271
272Standard_Real UnitsAPI::CurrentToAny(const Standard_Real aData,
273 const Standard_CString aQuantity,
274 const Standard_CString aUnit) {
275 Standard_Real aValue = aData;
276 CheckLoading (UnitsAPI_DEFAULT);
277 if( CurrentUnits->Find(aQuantity) ) {
278 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
279 aValue = AnyToAny(aData,current.ToCString(),aUnit);
280 }
0797d9d3 281#ifdef OCCT_DEBUG
7fd59977 282 else {
283 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
284 }
63c629aa 285#endif
7fd59977 286
287 return aValue;
288}
289
290
291//=======================================================================
292//function : CurrentFromAny
293//purpose :
294//=======================================================================
295
296Standard_Real UnitsAPI::CurrentFromAny(const Standard_Real aData,
297 const Standard_CString aQuantity,
298 const Standard_CString aUnit)
299{
300 Standard_Real aValue = aData;
301 CheckLoading (UnitsAPI_DEFAULT);
302 if( CurrentUnits->Find(aQuantity) ) {
303 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
304 aValue = AnyToAny(aData,aUnit,current.ToCString());
305 }
0797d9d3 306#ifdef OCCT_DEBUG
7fd59977 307 else {
308 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
309 }
63c629aa 310#endif
7fd59977 311
312 return aValue;
313}
314
315
316//=======================================================================
317//function : AnyToLS
318//purpose :
319//=======================================================================
320
321Standard_Real UnitsAPI::AnyToLS(const Standard_Real aData,
322 const Standard_CString aUnit)
323{
324 Standard_Real aValue = aData;
325 CheckLoading (localSystem);
326 Handle(Units_Dimensions) aDim;
327 aValue = Units::ToSI(aValue,aUnit,aDim);
328 if(aDim.IsNull())
329 return aValue;
330 Standard_CString quantity = aDim->Quantity();
331 if( quantity ) {
332 aValue = LocalSystemUnits.ConvertSIValueToUserSystem(quantity,aValue);
333 }
0797d9d3 334#ifdef OCCT_DEBUG
7fd59977 335 else
336 cout<<"Warning: BAD Quantity returns in UnitsAPI::AnyToLS(" << aData << "," << aUnit << ")" << endl;
63c629aa 337#endif
7fd59977 338 return aValue;
339}
340
341
342//=======================================================================
343//function : AnyToLS
344//purpose :
345//=======================================================================
346
347Standard_Real UnitsAPI::AnyToLS(const Standard_Real aData,
348 const Standard_CString aUnit,
349 Handle(Units_Dimensions) &aDim)
350{
351 Standard_Real aValue = aData;
352 CheckLoading (localSystem);
353 aValue = Units::ToSI(aValue,aUnit,aDim);
354 Standard_CString quantity = aDim->Quantity();
355 if(aDim.IsNull())
356 return aValue;
357 if( quantity ) {
358 aValue = LocalSystemUnits.ConvertSIValueToUserSystem(quantity,aValue);
359 }
0797d9d3 360#ifdef OCCT_DEBUG
7fd59977 361 else
362 cout<<"Warning: BAD Quantity returns in UnitsAPI::AnyToLS(" << aData << "," << aUnit << "," << aDim << ")" << endl;
63c629aa 363#endif
7fd59977 364 return aValue;
365}
366
367
368//=======================================================================
369//function : AnyToSI
370//purpose :
371//=======================================================================
372
373Standard_Real UnitsAPI::AnyToSI(const Standard_Real aData,
374 const Standard_CString aUnit)
375{
376 Standard_Real aValue;
377 CheckLoading (UnitsAPI_DEFAULT);
378 aValue = Units::ToSI(aData,aUnit);
379 return aValue;
380}
381
382
383//=======================================================================
384//function : AnyToSI
385//purpose :
386//=======================================================================
387
388Standard_Real UnitsAPI::AnyToSI(const Standard_Real aData,
389 const Standard_CString aUnit,
390 Handle(Units_Dimensions) &aDim)
391{
392 Standard_Real aValue;
393 CheckLoading (UnitsAPI_DEFAULT);
394 aValue = Units::ToSI(aData,aUnit,aDim);
395 return aValue;
396}
397
398
399//=======================================================================
400//function : AnyFromLS
401//purpose :
402//=======================================================================
403
404Standard_Real UnitsAPI::AnyFromLS(const Standard_Real aData,
405 const Standard_CString aUnit)
406{
407 Standard_Real aValue = aData;
408 CheckLoading (localSystem);
409 Handle(Units_Dimensions) aDim;
410 aValue = Units::FromSI(aValue,aUnit,aDim);
411 Standard_CString quantity = aDim->Quantity();
412 if( quantity ) {
413 aValue = LocalSystemUnits.ConvertUserSystemValueToSI(quantity,aValue);
414 }
0797d9d3 415#ifdef OCCT_DEBUG
7fd59977 416 else
417 cout<<"Warning: BAD Quantity returns in UnitsAPI::AnyToLS(" << aData << "," << aUnit << ")" << endl;
63c629aa 418#endif
7fd59977 419
420 return aValue;
421}
422
423
424//=======================================================================
425//function : AnyFromSI
426//purpose :
427//=======================================================================
428
429Standard_Real UnitsAPI::AnyFromSI(const Standard_Real aData,
430 const Standard_CString aUnit)
431{
432 Standard_Real aValue;
433 CheckLoading (UnitsAPI_DEFAULT);
434 aValue = Units::FromSI(aData,aUnit);
435 return aValue;
436}
437
438
439//=======================================================================
440//function : AnyToAny
441//purpose :
442//=======================================================================
443
444Standard_Real UnitsAPI::AnyToAny(const Standard_Real aData,
445 const Standard_CString aUnit1,
446 const Standard_CString aUnit2)
447{
448 Standard_Real aValue = aData;
449 CheckLoading (UnitsAPI_DEFAULT);
450 aValue = Units::Convert(aValue,aUnit1,aUnit2);
451 return aValue;
452}
453
454
455//=======================================================================
456//function : LSToSI
457//purpose :
458//=======================================================================
459
460Standard_Real UnitsAPI::LSToSI(const Standard_Real aData,
461 const Standard_CString aQuantity)
462{
463 Standard_Real aValue = aData;
464 CheckLoading (localSystem);
465 if( CurrentUnits->Find(aQuantity) ) {
466 aValue = LocalSystemUnits.ConvertUserSystemValueToSI(aQuantity,aData);
467 }
0797d9d3 468#ifdef OCCT_DEBUG
7fd59977 469 else {
470 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
471 }
63c629aa 472#endif
7fd59977 473
474 return aValue;
475}
476
477
478//=======================================================================
479//function : SIToLS
480//purpose :
481//=======================================================================
482
483Standard_Real UnitsAPI::SIToLS(const Standard_Real aData,
484 const Standard_CString aQuantity)
485{
486 Standard_Real aValue = aData;
487 CheckLoading (localSystem);
488 if( CurrentUnits->Find(aQuantity) ) {
489 aValue = LocalSystemUnits.ConvertSIValueToUserSystem(aQuantity,aValue);
490 }
0797d9d3 491#ifdef OCCT_DEBUG
7fd59977 492 else {
493 cout<<"Warning: UnitsAPI,the quantity '" << aQuantity << "' does not exist in the current units system" << endl;
494 }
63c629aa 495#endif
7fd59977 496
497 return aValue;
498}
499
500
501//=======================================================================
502//function : SetLocalSystem
503//purpose :
504//=======================================================================
505
506void UnitsAPI::SetLocalSystem(const UnitsAPI_SystemUnits aSystemUnits)
507{
508 CheckLoading (aSystemUnits);
509 localSystem = currentSystem;
510}
511
512
513//=======================================================================
514//function : LocalSystem
515//purpose :
516//=======================================================================
517
518UnitsAPI_SystemUnits UnitsAPI::LocalSystem()
519{
520 return localSystem;
521}
522
523
524//=======================================================================
525//function : SetCurrentUnit
526//purpose :
527//=======================================================================
528
529void UnitsAPI::SetCurrentUnit(const Standard_CString aQuantity,
530 const Standard_CString anUnit)
531{
532 CheckLoading(localSystem);
533 CurrentUnits->SetResource(aQuantity,anUnit);
534}
535
536
537//=======================================================================
538//function : Save
539//purpose :
540//=======================================================================
541
542void UnitsAPI::Save()
543{
544 CheckLoading(localSystem);
545 CurrentUnits->Save();
546}
547
548
549//=======================================================================
550//function : Reload
551//purpose :
552//=======================================================================
553
554void UnitsAPI::Reload()
555{
556 currentSystem = UnitsAPI_DEFAULT;
557 CheckLoading(localSystem);
558}
559
560
561//=======================================================================
562//function : CurrentUnit
563//purpose :
564//=======================================================================
565
566static TCollection_AsciiString astring;
567Standard_CString UnitsAPI::CurrentUnit(const Standard_CString aQuantity)
568{
569 CheckLoading(localSystem);
570 astring = CurrentUnits->Value(aQuantity);
571 return astring.ToCString();
572}
573
574
575//=======================================================================
576//function : Dimensions
577//purpose :
578//=======================================================================
579
580Handle(Units_Dimensions) UnitsAPI::Dimensions(const Standard_CString aType)
581{
582 return Units::Dimensions(aType);
583}
584
585
586//=======================================================================
587//function : DimensionLess
588//purpose :
589//=======================================================================
590
591Handle(Units_Dimensions) UnitsAPI::DimensionLess()
592{
593 return Units_Dimensions::ALess();
594}
595
596
597//=======================================================================
598//function : DimensionMass
599//purpose :
600//=======================================================================
601
602Handle(Units_Dimensions) UnitsAPI::DimensionMass()
603{
604 return Units_Dimensions::AMass();
605}
606
607
608//=======================================================================
609//function : DimensionLength
610//purpose :
611//=======================================================================
612
613Handle(Units_Dimensions) UnitsAPI::DimensionLength()
614{
615 return Units_Dimensions::ALength();
616}
617
618
619//=======================================================================
620//function : DimensionTime
621//purpose :
622//=======================================================================
623
624Handle(Units_Dimensions) UnitsAPI::DimensionTime()
625{
626 return Units_Dimensions::ATime() ;
627}
628
629
630//=======================================================================
631//function : DimensionElectricCurrent
632//purpose :
633//=======================================================================
634
635Handle(Units_Dimensions) UnitsAPI::DimensionElectricCurrent()
636{
637 return Units_Dimensions::AElectricCurrent() ;
638}
639
640
641//=======================================================================
642//function : DimensionThermodynamicTemperature
643//purpose :
644//=======================================================================
645
646Handle(Units_Dimensions) UnitsAPI::DimensionThermodynamicTemperature()
647{
648 return Units_Dimensions::AThermodynamicTemperature();
649}
650
651
652//=======================================================================
653//function : DimensionAmountOfSubstance
654//purpose :
655//=======================================================================
656
657Handle(Units_Dimensions) UnitsAPI::DimensionAmountOfSubstance()
658{
659 return Units_Dimensions::AAmountOfSubstance();
660}
661
662
663//=======================================================================
664//function : DimensionLuminousIntensity
665//purpose :
666//=======================================================================
667
668Handle(Units_Dimensions) UnitsAPI::DimensionLuminousIntensity()
669{
670 return Units_Dimensions::ALuminousIntensity();
671}
672
673
674//=======================================================================
675//function : DimensionPlaneAngle
676//purpose :
677//=======================================================================
678
679Handle(Units_Dimensions) UnitsAPI::DimensionPlaneAngle()
680{
681 return Units_Dimensions::APlaneAngle();
682}
683
684
685//=======================================================================
686//function : DimensionSolidAngle
687//purpose :
688//=======================================================================
689
690Handle(Units_Dimensions) UnitsAPI::DimensionSolidAngle()
691{
692 return Units_Dimensions::ASolidAngle();
693}
694
695
696//=======================================================================
697//function : Check
698//purpose :
699//=======================================================================
700
701Standard_Boolean UnitsAPI::Check(const Standard_CString aQuantity,
702 const Standard_CString /*aUnit*/)
703{
704 Standard_Boolean status = Standard_False;
705 CheckLoading (UnitsAPI_DEFAULT);
706 if( CurrentUnits->Find(aQuantity) ) {
707 TCollection_AsciiString current(CurrentUnits->Value(aQuantity));
708// aValue = AnyToAny(aData,current.ToCString(),aUnit);
709// aValue = Units::Convert(aValue,aUnit1,aUnit2);
710 }
711
712 return status;
713}