7fd59977 |
1 | #include <Vrml_AsciiText.ixx> |
2 | |
3 | Vrml_AsciiText::Vrml_AsciiText() |
4 | { |
5 | TCollection_AsciiString tmpS(""); |
6 | myString = new TColStd_HArray1OfAsciiString(1,1,tmpS); |
7 | |
8 | mySpacing = 1; |
9 | myJustification = Vrml_LEFT; |
10 | myWidth = 0; |
11 | } |
12 | |
13 | Vrml_AsciiText::Vrml_AsciiText(const Handle(TColStd_HArray1OfAsciiString)& aString, |
14 | const Standard_Real aSpacing, |
15 | const Vrml_AsciiTextJustification aJustification, |
16 | const Standard_Real aWidth) |
17 | { |
18 | myString = aString; |
19 | mySpacing = aSpacing; |
20 | myJustification = aJustification; |
21 | myWidth = aWidth; |
22 | } |
23 | |
24 | void Vrml_AsciiText::SetString(const Handle(TColStd_HArray1OfAsciiString)& aString) |
25 | { |
26 | myString = aString; |
27 | } |
28 | |
29 | Handle(TColStd_HArray1OfAsciiString) Vrml_AsciiText::String() const |
30 | { |
31 | return myString; |
32 | } |
33 | |
34 | void Vrml_AsciiText::SetSpacing(const Standard_Real aSpacing) |
35 | { |
36 | mySpacing = aSpacing; |
37 | } |
38 | |
39 | Standard_Real Vrml_AsciiText::Spacing() const |
40 | { |
41 | return mySpacing; |
42 | } |
43 | |
44 | void Vrml_AsciiText::SetJustification(const Vrml_AsciiTextJustification aJustification) |
45 | { |
46 | myJustification = aJustification; |
47 | } |
48 | |
49 | Vrml_AsciiTextJustification Vrml_AsciiText::Justification() const |
50 | { |
51 | return myJustification; |
52 | } |
53 | |
54 | void Vrml_AsciiText::SetWidth(const Standard_Real aWidth) |
55 | { |
56 | myWidth = aWidth; |
57 | } |
58 | |
59 | Standard_Real Vrml_AsciiText::Width() const |
60 | { |
61 | return myWidth; |
62 | } |
63 | |
64 | Standard_OStream& Vrml_AsciiText::Print(Standard_OStream& anOStream) const |
65 | { |
66 | Standard_Integer i; |
67 | |
68 | anOStream << "AsciiText {" << endl; |
69 | |
70 | i = myString->Lower(); |
71 | |
72 | if ( myString->Length() != 1 || myString->Value(i) != "" ) |
73 | { |
74 | anOStream << " string [" << endl << '\t'; |
75 | |
76 | for ( i = myString->Lower(); i <= myString->Upper(); i++ ) |
77 | { |
78 | anOStream << '"' << myString->Value(i) << '"'; |
79 | if ( i < myString->Length() ) |
80 | anOStream << ',' << endl << '\t'; |
81 | } |
82 | anOStream << " ]" << endl; |
83 | } |
84 | |
85 | if ( Abs(mySpacing - 1 ) > 0.0001 ) |
86 | { |
87 | anOStream << " spacing" << "\t\t"; |
88 | anOStream << mySpacing << endl; |
89 | } |
90 | |
91 | switch ( myJustification ) |
92 | { |
93 | case Vrml_LEFT: break; // anOStream << " justification" << "\t LEFT"; |
94 | case Vrml_CENTER: anOStream << " justification" << "\tCENTER" << endl; break; |
95 | case Vrml_RIGHT: anOStream << " justification" << "\tRIGHT" << endl; break; |
96 | } |
97 | |
98 | if ( Abs(myWidth - 0 ) > 0.0001 ) |
99 | { |
100 | anOStream << " width" << "\t\t"; |
101 | anOStream << myWidth << endl; |
102 | } |
103 | |
104 | anOStream << '}' << endl; |
105 | return anOStream; |
106 | } |