1 // File: VrmlData_IndexedLineSet.hxx
2 // Created: 01.08.07 09:06
3 // Author: Alexander GRIGORIEV
4 // Copyright: Open Cascade 2007
7 #ifndef VrmlData_IndexedLineSet_HeaderFile
8 #define VrmlData_IndexedLineSet_HeaderFile
10 #include <VrmlData_Geometry.hxx>
11 #include <VrmlData_Coordinate.hxx>
12 #include <VrmlData_Color.hxx>
13 //#include <Quantity_Color.hxx>
16 * Data type to store a set of polygons.
19 class VrmlData_IndexedLineSet : public VrmlData_Geometry
22 // ---------- PUBLIC METHODS ----------
28 inline VrmlData_IndexedLineSet ()
33 myColorPerVertex (Standard_True)
39 inline VrmlData_IndexedLineSet (const VrmlData_Scene& theScene,
41 const Standard_Boolean isColorPerVertex
43 : VrmlData_Geometry (theScene, theName),
48 myColorPerVertex (isColorPerVertex)
52 * Query the Coordinates.
54 inline const Handle(VrmlData_Coordinate)&
55 Coordinates () const { return myCoords; }
60 inline void SetCoordinates (const Handle(VrmlData_Coordinate)& theCoord)
61 { myCoords = theCoord; }
66 inline const Handle(VrmlData_Color)&
67 Colors () const { return myColors; }
72 inline void SetColors (const Handle(VrmlData_Color)& theColors)
73 { myColors = theColors; }
75 // ========================================================================
76 // =========================== POLYLINES =================================
78 * Query the array of polygons
80 inline size_t Polygons (const Standard_Integer**& arrPolygons) const
81 { arrPolygons = myArrPolygons; return myNbPolygons; }
86 * rank of the polygon [0 .. N-1]
88 * <tt>[out]</tt> array of vertex indice
90 * number of vertice in the polygon - the dimension of outIndice array
92 inline Standard_Integer
93 Polygon (const Standard_Integer iPolygon,
94 const Standard_Integer *& outIndice)
95 { return * (outIndice = myArrPolygons[iPolygon])++; }
100 inline void SetPolygons (const Standard_Integer nPolygons,
101 const Standard_Integer ** thePolygons)
102 { myNbPolygons = nPolygons; myArrPolygons = thePolygons; }
104 // ========================================================================
105 // ================================ COLORS ================================
107 * Query the array of color indice
109 * <tt>[out]</tt> array of colorIndex as it is described in VRML2.0 spec
111 * Number of integers in the array arrColorInd.
113 inline size_t ArrayColorInd (const Standard_Integer**& arrColorInd) const
114 { arrColorInd = myArrColorInd; return myNbColors; }
117 * Query a color for one node in the given element. The color is
118 * interpreted according to fields myColors, myArrColorInd,
119 * myColorPerVertex, as defined in VRML 2.0.
121 * rank of the polygon [0 .. N-1]
123 * rank of the vertex in the polygon [0 .. M-1]. This parameter is ignored
124 * if (myColorPerVertex == False)
126 * Color value (RGB); if the color is indefinite then returns (0., 0., 0.)
128 Standard_EXPORT Quantity_Color
129 GetColor (const Standard_Integer iFace,
130 const Standard_Integer iVertex);
133 * Set the colors array of indice
135 inline void SetColorInd (const Standard_Integer nIndice,
136 const Standard_Integer ** theIndice)
137 { myNbColors = nIndice; myArrColorInd = theIndice; }
140 * Set the boolean value "colorPerVertex"
142 inline void SetColorPerVertex (const Standard_Boolean isColorPerVertex)
143 { myColorPerVertex = isColorPerVertex; }
146 * Query the shape. This method checks the flag myIsModified; if True it
147 * should rebuild the shape presentation.
149 Standard_EXPORT virtual const Handle(TopoDS_TShape)&
153 * Create a copy of this node.
154 * If the parameter is null, a new copied node is created. Otherwise new node
155 * is not created, but rather the given one is modified.
157 Standard_EXPORT virtual Handle(VrmlData_Node)
158 Clone (const Handle(VrmlData_Node)& theOther)const;
161 * Read the Node from input stream.
163 Standard_EXPORT virtual VrmlData_ErrorStatus
164 Read (VrmlData_InBuffer& theBuffer);
167 * Write the Node to output stream.
169 Standard_EXPORT virtual VrmlData_ErrorStatus
170 Write (const char * thePrefix) const;
173 * Returns True if the node is default, so that it should not be written.
175 Standard_EXPORT virtual Standard_Boolean
180 // ---------- PRIVATE FIELDS ----------
181 Handle(VrmlData_Coordinate) myCoords;
182 Handle(VrmlData_Color) myColors;
183 const Standard_Integer ** myArrPolygons;
184 const Standard_Integer ** myArrColorInd;
185 Standard_Size myNbPolygons;
186 Standard_Size myNbColors;
187 Standard_Boolean myColorPerVertex;
190 // Declaration of CASCADE RTTI
191 DEFINE_STANDARD_RTTI (VrmlData_IndexedLineSet)
194 // Definition of HANDLE object using Standard_DefineHandle.hxx
195 DEFINE_STANDARD_HANDLE (VrmlData_IndexedLineSet, VrmlData_Geometry)