0028832: MMgt_TShared can be replaced by Standard_Transient
[occt.git] / src / Vrml / Vrml_IndexedLineSet.cxx
CommitLineData
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_IndexedLineSet.hxx>
7fd59977 17
25e59720 18IMPLEMENT_STANDARD_RTTIEXT(Vrml_IndexedLineSet,Standard_Transient)
92efcf78 19
b311480e 20Vrml_IndexedLineSet::Vrml_IndexedLineSet(const Handle(TColStd_HArray1OfInteger)& aCoordIndex,
7fd59977 21 const Handle(TColStd_HArray1OfInteger)& aMaterialIndex,
22 const Handle(TColStd_HArray1OfInteger)& aNormalIndex,
23 const Handle(TColStd_HArray1OfInteger)& aTextureCoordIndex)
24{
25 myCoordIndex = aCoordIndex;
26 myMaterialIndex = aMaterialIndex;
27 myNormalIndex = aNormalIndex;
28 myTextureCoordIndex = aTextureCoordIndex;
29}
30
31 Vrml_IndexedLineSet::Vrml_IndexedLineSet()
32{
33 myCoordIndex = new TColStd_HArray1OfInteger(1,1, 0);
34 myMaterialIndex = new TColStd_HArray1OfInteger(1,1,-1);
35 myNormalIndex = new TColStd_HArray1OfInteger(1,1,-1);
36 myTextureCoordIndex = new TColStd_HArray1OfInteger(1,1,-1);
37}
38
39void Vrml_IndexedLineSet::SetCoordIndex(const Handle(TColStd_HArray1OfInteger)& aCoordIndex)
40{
41 myCoordIndex = aCoordIndex;
42}
43
44Handle(TColStd_HArray1OfInteger) Vrml_IndexedLineSet::CoordIndex() const
45{
46 return myCoordIndex;
47}
48
49void Vrml_IndexedLineSet::SetMaterialIndex(const Handle(TColStd_HArray1OfInteger)& aMaterialIndex)
50{
51 myMaterialIndex = aMaterialIndex;
52}
53
54Handle(TColStd_HArray1OfInteger) Vrml_IndexedLineSet::MaterialIndex() const
55{
56 return myMaterialIndex;
57}
58
59void Vrml_IndexedLineSet::SetNormalIndex(const Handle(TColStd_HArray1OfInteger)& aNormalIndex)
60{
61 myNormalIndex = aNormalIndex;
62}
63
64Handle(TColStd_HArray1OfInteger) Vrml_IndexedLineSet::NormalIndex() const
65{
66 return myNormalIndex;
67}
68
69void Vrml_IndexedLineSet::SetTextureCoordIndex(const Handle(TColStd_HArray1OfInteger)& aTextureCoordIndex)
70{
71 myTextureCoordIndex = aTextureCoordIndex;
72}
73
74Handle(TColStd_HArray1OfInteger) Vrml_IndexedLineSet::TextureCoordIndex() const
75{
76 return myTextureCoordIndex;
77}
78
79Standard_OStream& Vrml_IndexedLineSet::Print(Standard_OStream& anOStream) const
80{
81 Standard_Integer i;
82
586db386 83 anOStream << "IndexedLineSet {" << '\n';
7fd59977 84
85 if ( myCoordIndex->Length() != 1 || myCoordIndex->Value(myCoordIndex->Lower())!=0 )
86 {
586db386 87 anOStream << " coordIndex [" << '\n' << '\t';
7fd59977 88 for ( i = myCoordIndex->Lower(); i <= myCoordIndex->Upper(); i++ )
89 {
90 anOStream << myCoordIndex->Value(i);
91 if ( i < myCoordIndex->Length() )
92 anOStream << ',';
93
94 if ( myCoordIndex->Value(i) == -1 )
586db386 95 anOStream << '\n' << '\t';
7fd59977 96 }
586db386 97 anOStream << ']' << '\n';
7fd59977 98 }
99
100 if ( myMaterialIndex->Length() != 1 || myMaterialIndex->Value(myMaterialIndex->Lower())!=-1 )
101 {
586db386 102 anOStream << " materialIndex [" << '\n' << '\t';
7fd59977 103 for ( i = myMaterialIndex->Lower(); i <= myMaterialIndex->Upper(); i++ )
104 {
105 anOStream << myMaterialIndex->Value(i);
106 if ( i < myMaterialIndex->Length() )
107 anOStream << ',' ;
108
109 if ( myMaterialIndex->Value(i) == -1 )
586db386 110 anOStream << '\n' << '\t';
7fd59977 111 } // End of for
586db386 112 anOStream << ']' << '\n';
7fd59977 113 }
114
115 if ( myNormalIndex->Length() != 1 || myNormalIndex->Value(myNormalIndex->Lower())!=-1 )
116 {
586db386 117 anOStream << " normalIndex [" << '\n' << '\t';
7fd59977 118 for ( i=myNormalIndex->Lower(); i <= myNormalIndex->Upper(); i++ )
119 {
120 anOStream << myNormalIndex->Value(i);
121 if ( i < myNormalIndex->Length() )
122 anOStream << ',';
123
124 if ( myNormalIndex->Value(i) == -1 )
586db386 125 anOStream << '\n' << '\t';
7fd59977 126 } // End of for
586db386 127 anOStream << ']' << '\n';
7fd59977 128 }
129
130 if ( myTextureCoordIndex->Length() != 1 || myTextureCoordIndex->Value(myTextureCoordIndex->Lower())!=-1 )
131 {
586db386 132 anOStream << " textureCoordIndex [\n\t";
7fd59977 133 for ( i=myTextureCoordIndex->Lower(); i <= myTextureCoordIndex->Upper(); i++ )
134 {
135 anOStream << myTextureCoordIndex->Value(i);
136 if ( i < myTextureCoordIndex->Length() )
586db386 137 anOStream << ",";
7fd59977 138
139 if ( myTextureCoordIndex->Value(i) == -1 )
586db386 140 anOStream << "\n\t";
7fd59977 141 } // End of for
586db386 142 anOStream << "]\n";
7fd59977 143 }
586db386 144 anOStream << "}\n";
7fd59977 145 return anOStream;
146}