summaryrefslogtreecommitdiff
path: root/src/Vrml/Vrml_AsciiText.cxx
blob: 97721c39701dde3ab931d6fdd188f5583545ff63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <Vrml_AsciiText.ixx>

 Vrml_AsciiText::Vrml_AsciiText()
{
    TCollection_AsciiString tmpS("");
    myString =  new TColStd_HArray1OfAsciiString(1,1,tmpS);

    mySpacing = 1;
    myJustification = Vrml_LEFT;
    myWidth = 0;
}

 Vrml_AsciiText::Vrml_AsciiText(const Handle(TColStd_HArray1OfAsciiString)& aString, 
				const Standard_Real aSpacing, 
				const Vrml_AsciiTextJustification aJustification, 
				const Standard_Real aWidth)
{
    myString = aString;
    mySpacing = aSpacing;
    myJustification = aJustification;
    myWidth = aWidth;
}

void Vrml_AsciiText::SetString(const  Handle(TColStd_HArray1OfAsciiString)& aString)
{
    myString = aString;
}

Handle(TColStd_HArray1OfAsciiString) Vrml_AsciiText::String() const 
{
  return myString;
}

void Vrml_AsciiText::SetSpacing(const Standard_Real aSpacing)
{
    mySpacing = aSpacing;
}

Standard_Real Vrml_AsciiText::Spacing() const 
{
  return mySpacing;
}

void Vrml_AsciiText::SetJustification(const Vrml_AsciiTextJustification aJustification)
{
    myJustification = aJustification;
}

Vrml_AsciiTextJustification Vrml_AsciiText::Justification() const 
{
  return myJustification;
}

void Vrml_AsciiText::SetWidth(const Standard_Real aWidth)
{
    myWidth = aWidth;
}

Standard_Real Vrml_AsciiText::Width() const 
{
  return myWidth;
}

Standard_OStream& Vrml_AsciiText::Print(Standard_OStream& anOStream) const 
{
 Standard_Integer i;

 anOStream  << "AsciiText {" << endl;

 i = myString->Lower();

 if ( myString->Length() != 1 || myString->Value(i) != "" )
   {
    anOStream  << "    string [" << endl << '\t';

    for ( i = myString->Lower(); i <= myString->Upper(); i++ )
	{
	 anOStream << '"' << myString->Value(i) << '"';
	 if ( i < myString->Length() )
	    anOStream  << ',' << endl << '\t';
        }
    anOStream  << " ]" << endl;
   }

 if ( Abs(mySpacing - 1 ) > 0.0001 )
   {
    anOStream  << "    spacing" << "\t\t";
    anOStream << mySpacing << endl;
   }

  switch ( myJustification )
    {
     case Vrml_LEFT: break; // anOStream  << "    justification" << "\t LEFT";
     case Vrml_CENTER:        anOStream  << "    justification" << "\tCENTER" << endl; break;
     case Vrml_RIGHT: anOStream  << "    justification" << "\tRIGHT" << endl; break; 
    }

 if ( Abs(myWidth - 0 ) > 0.0001 )
   {
    anOStream  << "    width" << "\t\t";
    anOStream << myWidth << endl;
   }

 anOStream  << '}' << endl;
 return anOStream;
}