b311480e |
1 | // Created on: 1992-11-04 |
2 | // Created by: Gilles DEBARBOUILLE |
3 | // Copyright (c) 1992-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 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
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 | |
42cf5bc1 |
17 | |
18 | #include <Standard_Type.hxx> |
7fd59977 |
19 | #include <TCollection_AsciiString.hxx> |
20 | #include <TColStd_HSequenceOfHAsciiString.hxx> |
42cf5bc1 |
21 | #include <Units_Quantity.hxx> |
22 | #include <Units_ShiftedToken.hxx> |
23 | #include <Units_ShiftedUnit.hxx> |
24 | #include <Units_Token.hxx> |
7fd59977 |
25 | |
92efcf78 |
26 | IMPLEMENT_STANDARD_RTTIEXT(Units_ShiftedUnit,Units_Unit) |
27 | |
7fd59977 |
28 | //======================================================================= |
29 | //function : Units_ShiftedUnit |
30 | //purpose : |
31 | //======================================================================= |
7fd59977 |
32 | Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname, |
33 | const Standard_CString asymbol, |
34 | const Standard_Real avalue, |
35 | const Standard_Real amove, |
36 | const Handle(Units_Quantity)& aquantity) |
37 | : Units_Unit(aname,asymbol,avalue,aquantity) |
38 | { |
39 | themove = amove; |
40 | } |
41 | |
42 | //======================================================================= |
43 | //function : Units_ShiftedUnit |
44 | //purpose : |
45 | //======================================================================= |
46 | |
47 | Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname, |
48 | const Standard_CString asymbol) |
d533dafb |
49 | : Units_Unit(aname,asymbol), |
50 | themove(0.0) |
7fd59977 |
51 | {} |
52 | |
53 | //======================================================================= |
54 | //function : Units_ShiftedUnit |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname) |
d533dafb |
59 | : Units_Unit(aname), |
60 | themove(0.0) |
7fd59977 |
61 | {} |
62 | |
63 | //======================================================================= |
64 | //function : Move |
65 | //purpose : |
66 | //======================================================================= |
67 | |
68 | void Units_ShiftedUnit::Move(const Standard_Real amove) |
69 | { |
70 | themove = amove; |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : Move |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | Standard_Real Units_ShiftedUnit::Move() const |
79 | { |
80 | return themove; |
81 | } |
82 | |
83 | //======================================================================= |
84 | //function : Token |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | Handle(Units_Token) Units_ShiftedUnit::Token() const |
89 | { |
90 | TCollection_AsciiString string = SymbolsSequence()->Value(1)->String(); |
91 | return new Units_ShiftedToken(string.ToCString()," ",Value(),themove,Quantity()->Dimensions()); |
92 | } |
93 | |
94 | //======================================================================= |
95 | //function : Dump |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | //void Units_ShiftedUnit::Dump(const Standard_Integer ashift, |
100 | // const Standard_Integer alevel) const |
101 | void Units_ShiftedUnit::Dump(const Standard_Integer , |
102 | const Standard_Integer ) const |
103 | { |
104 | Standard_Integer index; |
105 | TCollection_AsciiString string; |
106 | |
107 | // int i; |
04232180 |
108 | // for(i=0; i<ashift; i++)std::cout<<" "; |
7fd59977 |
109 | for(index=1;index<=thesymbolssequence->Length();index++) |
110 | { |
111 | string = thesymbolssequence->Value(index)->String(); |
04232180 |
112 | if(index != 1) std::cout << " or " ; |
113 | std::cout<<"\""<<string.ToCString()<<"\""; |
7fd59977 |
114 | } |
04232180 |
115 | std::cout<< " Name: " <<Name().ToCString()<<" (= *" << thevalue << " SI + " << themove << ")"<<std::endl; |
7fd59977 |
116 | } |
117 | |