0026922: Huge performance issue writing data to the output stream
[occt.git] / src / Vrml / Vrml_WWWInline.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <gp_Vec.hxx>
16 #include <TCollection_AsciiString.hxx>
17 #include <Vrml_WWWInline.hxx>
18
19 Vrml_WWWInline::Vrml_WWWInline()
20 {
21   myName = "";
22   gp_Vec tmpVec(0,0,0);
23   myBboxSize = tmpVec;
24   myBboxCenter = tmpVec;
25 }
26
27 Vrml_WWWInline::Vrml_WWWInline(const TCollection_AsciiString& aName,
28                                const gp_Vec& aBboxSize,
29                                const gp_Vec& aBboxCenter)
30 {
31   myName = aName;
32   myBboxSize = aBboxSize;
33   myBboxCenter = aBboxCenter;
34 }
35
36 void Vrml_WWWInline::SetName(const TCollection_AsciiString& aName) 
37 {
38   myName = aName;
39 }
40
41 TCollection_AsciiString Vrml_WWWInline::Name() const
42 {
43   return myName;
44 }
45
46 void Vrml_WWWInline::SetBboxSize(const gp_Vec& aBboxSize) 
47 {
48   myBboxSize = aBboxSize;
49 }
50
51 gp_Vec Vrml_WWWInline::BboxSize() const
52 {
53   return myBboxSize;
54 }
55
56 void Vrml_WWWInline::SetBboxCenter(const gp_Vec& aBboxCenter) 
57 {
58   myBboxCenter = aBboxCenter;
59 }
60
61 gp_Vec Vrml_WWWInline::BboxCenter() const
62 {
63   return myBboxCenter;
64 }
65
66 Standard_OStream& Vrml_WWWInline::Print(Standard_OStream& anOStream) const
67 {
68  anOStream  << "WWWInline {\n";
69
70  if ( !(myName.IsEqual ("") ) )
71    {
72     anOStream  << "    name\t";
73     anOStream << '"' << myName << '"' << "\n";
74    }
75
76  if ( Abs(myBboxSize.X() - 0) > 0.0001 || 
77      Abs(myBboxSize.Y() - 0) > 0.0001 || 
78      Abs(myBboxSize.Z() - 0) > 0.0001 ) 
79    {
80     anOStream  << "    bboxSize\t";
81     anOStream << myBboxSize.X() << " " << myBboxSize.Y() << " " << myBboxSize.Z() << "\n";
82    }
83
84  if ( Abs(myBboxCenter.X() - 0) > 0.0001 || 
85      Abs(myBboxCenter.Y() - 0) > 0.0001 || 
86      Abs(myBboxCenter.Z() - 0) > 0.0001 ) 
87    {
88     anOStream  << "    bboxCenter\t";
89     anOStream << myBboxCenter.X() << " " << myBboxCenter.Y() << " " << myBboxCenter.Z() << "\n";
90    }
91
92  anOStream  << "}\n";
93  return anOStream;
94 }