0024157: Parallelization of assembly part of BO
[occt.git] / src / Vrml / Vrml_Normal.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #include <Vrml_Normal.ixx>
19
20 Vrml_Normal::Vrml_Normal(const Handle(TColgp_HArray1OfVec)& aVector)
21 {
22  myVector = aVector;
23 }
24
25  Vrml_Normal::Vrml_Normal()
26 {
27  gp_Vec Tmp_Vec;
28  myVector = new TColgp_HArray1OfVec (1,1);
29  
30  Tmp_Vec.SetX(0); Tmp_Vec.SetY(0); Tmp_Vec.SetZ(1);
31  myVector->SetValue(1,Tmp_Vec);
32 }
33
34 void Vrml_Normal::SetVector(const Handle(TColgp_HArray1OfVec)& aVector)
35 {
36  myVector = aVector;
37 }
38
39 Handle(TColgp_HArray1OfVec) Vrml_Normal::Vector() const 
40 {
41  return myVector;
42 }
43
44 Standard_OStream& Vrml_Normal::Print(Standard_OStream& anOStream) const 
45 {
46  Standard_Integer i;
47
48  anOStream  << "Normal {" << endl;
49  i = myVector->Lower();
50  if ( myVector->Length() == 1 && 
51      Abs(myVector->Value(i).X() - 0) < 0.0001 && 
52      Abs(myVector->Value(i).Y() - 0) < 0.0001 && 
53      Abs(myVector->Value(i).Z() - 1) < 0.0001 )
54    {
55     anOStream  << '}' << endl;
56     return anOStream;
57    }
58  else 
59   {
60   anOStream  << "    vector [\n\t";
61    for ( i = myVector->Lower(); i <= myVector->Upper(); i++ )
62      {
63          anOStream << myVector->Value(i).X() << ' ' << myVector->Value(i).Y() << ' ' << myVector->Value(i).Z();
64       if ( i < myVector->Length() )
65          anOStream  << ',' << endl << '\t';
66      }
67     anOStream << " ]" << endl;
68   }  
69   anOStream  << '}' << endl;
70
71  return anOStream;
72 }
73