973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <Standard_Type.hxx> |
16 | #include <Vrml_Coordinate3.hxx> |
7fd59977 |
17 | |
25e59720 |
18 | IMPLEMENT_STANDARD_RTTIEXT(Vrml_Coordinate3,Standard_Transient) |
92efcf78 |
19 | |
7fd59977 |
20 | Vrml_Coordinate3::Vrml_Coordinate3(const Handle(TColgp_HArray1OfVec)& aPoint) |
21 | { |
22 | myPoint = aPoint; |
23 | } |
24 | |
25 | Vrml_Coordinate3::Vrml_Coordinate3() |
26 | { |
27 | gp_Vec Tmp_Vec; |
28 | |
29 | myPoint = new TColgp_HArray1OfVec(1,1); |
30 | Tmp_Vec.SetX(0); Tmp_Vec.SetY(0); Tmp_Vec.SetZ(0); |
31 | myPoint->SetValue (1,Tmp_Vec); |
32 | } |
33 | |
34 | void Vrml_Coordinate3::SetPoint(const Handle(TColgp_HArray1OfVec)& aPoint) |
35 | { |
36 | myPoint = aPoint; |
37 | } |
38 | |
39 | Handle(TColgp_HArray1OfVec) Vrml_Coordinate3::Point() const |
40 | { |
41 | return myPoint; |
42 | } |
43 | |
44 | Standard_OStream& Vrml_Coordinate3::Print(Standard_OStream& anOStream) const |
45 | { |
46 | Standard_Integer i; |
47 | |
586db386 |
48 | anOStream << "Coordinate3 {\n"; |
7fd59977 |
49 | |
50 | i = myPoint->Lower(); |
51 | if ( myPoint->Length() == 1 && Abs(myPoint->Value(i).X() - 0) < 0.0001 |
52 | && Abs(myPoint->Value(i).Y() - 0) < 0.0001 |
53 | && Abs(myPoint->Value(i).Z() - 0) < 0.0001 ) |
54 | { |
586db386 |
55 | anOStream << "}\n"; |
7fd59977 |
56 | return anOStream; |
57 | } |
58 | else |
59 | { |
586db386 |
60 | anOStream << " point [\n\t"; |
7fd59977 |
61 | for ( i = myPoint->Lower(); i <= myPoint->Upper(); i++ ) |
62 | { |
63 | anOStream << myPoint->Value(i).X() << ' ' << myPoint->Value(i).Y() << ' ' << myPoint->Value(i).Z(); |
64 | if ( i < myPoint->Length() ) |
586db386 |
65 | anOStream << ",\n\t"; |
7fd59977 |
66 | } |
586db386 |
67 | anOStream << " ]\n"; |
7fd59977 |
68 | } |
586db386 |
69 | anOStream << "}\n"; |
7fd59977 |
70 | |
71 | return anOStream; |
72 | } |
73 | |