CFx SDK Documentation  2022 SP0
GeShell.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _ODGESHELL_INCLUDED_
25 #define _ODGESHELL_INCLUDED_
27 #include "TD_PackPush.h"
28 
29 #include "Ge/GePoint3dArray.h"
30 #include "Ge/GeVector3dArray.h"
31 #include "DbStubPtrArray.h"
32 #include "Int32Array.h"
33 #include "UInt16Array.h"
34 #include "UInt8Array.h"
35 #include "CmEntityColorArray.h"
36 #include "CmTransparencyArray.h"
37 #include "GsMarkerArray.h"
38 #include "Gi/GiGeometry.h"
39 
53 class OdGeShell
54 {
55  int m_nFaceStartIndex;
56 public:
57  OdGeShell() : m_nFaceStartIndex(-1) {}
58 
63 
71 
76 
81 
86 
91 
96 
101 
106 
111 
116 
121 
126 
131 
136 
141 
146 
152  void addVertex(const OdGePoint3d& vertex)
153  {
154  vertices.push_back(vertex);
155  }
156 
160  void endFace()
161  {
162  if(m_nFaceStartIndex>=0)
163  {
164  faces[m_nFaceStartIndex] *= (faces.size()-m_nFaceStartIndex-1);
165  m_nFaceStartIndex = -1;
166  }
167  }
168 
174  void startFace(bool bHole = false)
175  {
176  ODA_ASSERT(m_nFaceStartIndex==-1); // endFace() wasn't called.
177  m_nFaceStartIndex = faces.size();
178  faces.push_back(bHole ? -1 : 1);
179  }
180 
186  void addFaceVertex(int nVertexIndex)
187  {
188  edgeVisibilities.push_back(OdUInt8(nVertexIndex > 0));
189  faces.push_back(Od_abs(nVertexIndex)-1);
190  }
191 
197  void draw(OdGiGeometry& geometry)
198  {
199  ODA_ASSERT(m_nFaceStartIndex<0 || faces[m_nFaceStartIndex]>2); // endFace() wasn't called.
200 
201  OdGiEdgeData edgeData;
202  if (!edgeColors.isEmpty())
203  edgeData.setColors(edgeColors.getPtr());
204  if (!edgeTrueColors.isEmpty())
205  edgeData.setTrueColors(edgeTrueColors.getPtr());
206  if (!edgeLayers.isEmpty())
207  edgeData.setLayers((OdDbStub**)edgeLayers.getPtr());
208  if (!edgeLinetypes.isEmpty())
209  edgeData.setLinetypes((OdDbStub**)edgeLinetypes.getPtr());
212  if (!edgeVisibilities.isEmpty())
214 
215  OdGiFaceData faceData;
216  if (!faceColors.isEmpty())
217  faceData.setColors(faceColors.getPtr());
218  if (!faceTrueColors.isEmpty())
219  faceData.setTrueColors(faceTrueColors.getPtr());
220  if (!faceLayers.isEmpty())
221  faceData.setLayers((OdDbStub**)faceLayers.getPtr());
222  if (!faceNormals.isEmpty())
223  faceData.setNormals(faceNormals.getPtr());
226  if (!faceVisibilities.isEmpty())
228  if (!faceMaterials.isEmpty())
229  faceData.setMaterials((OdDbStub**)faceMaterials.getPtr());
230  if (!faceMappers.isEmpty())
231  faceData.setMappers(faceMappers.getPtr());
232  if (!faceTransparencies.isEmpty())
234 
235  geometry.shell(vertices.size(), vertices.getPtr(), faces.size(), faces.getPtr(), &edgeData, &faceData);
236  }
237 };
238 
239 #include "TD_PackPop.h"
240 
241 
242 #endif // _ODGESHELL_INCLUDED_
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:49
#define Od_abs
Definition: OdPlatform.h:130
unsigned char OdUInt8
bool isEmpty() const
Definition: OdArray.h:1062
size_type size() const
Definition: OdArray.h:893
void push_back(const T &value)
Definition: OdArray.h:987
const T * getPtr() const
Definition: OdArray.h:1102
OdGeVector3dArray faceNormals
Definition: GeShell.h:120
void draw(OdGiGeometry &geometry)
Definition: GeShell.h:197
OdUInt8Array edgeVisibilities
Definition: GeShell.h:100
void addVertex(const OdGePoint3d &vertex)
Definition: GeShell.h:152
OdDbStubPtrArray edgeLinetypes
Definition: GeShell.h:90
OdInt32Array faces
Definition: GeShell.h:70
void endFace()
Definition: GeShell.h:160
OdCmEntityColorArray edgeTrueColors
Definition: GeShell.h:80
OdDbStubPtrArray edgeLayers
Definition: GeShell.h:85
OdUInt16Array faceColors
Definition: GeShell.h:105
OdDbStubPtrArray faceLayers
Definition: GeShell.h:115
OdGeShell()
Definition: GeShell.h:57
OdGsMarkerArray faceSelectionMarkers
Definition: GeShell.h:125
OdUInt8Array faceVisibilities
Definition: GeShell.h:130
OdArray< OdGiMapper > faceMappers
Definition: GeShell.h:140
OdGsMarkerArray edgeSelectionMarkers
Definition: GeShell.h:95
OdGePoint3dArray vertices
Definition: GeShell.h:62
void startFace(bool bHole=false)
Definition: GeShell.h:174
OdCmTransparencyArray faceTransparencies
Definition: GeShell.h:145
OdDbStubPtrArray faceMaterials
Definition: GeShell.h:135
OdUInt16Array edgeColors
Definition: GeShell.h:75
void addFaceVertex(int nVertexIndex)
Definition: GeShell.h:186
OdCmEntityColorArray faceTrueColors
Definition: GeShell.h:110
void setTrueColors(const OdCmEntityColor *colors)
Definition: GiGeometry.h:109
void setColors(const OdUInt16 *colors)
Definition: GiGeometry.h:95
void setVisibility(const OdUInt8 *visibilities)
Definition: GiGeometry.h:167
void setSelectionMarkers(const OdGsMarker *selectionMarkers)
Definition: GiGeometry.h:145
void setLayers(OdDbStub **layerIds)
Definition: GiGeometry.h:121
void setLinetypes(OdDbStub **linetypeIds)
Definition: GiGeometry.h:133
void setLayers(OdDbStub **layerIds)
Definition: GiGeometry.h:309
void setNormals(const OdGeVector3d *normals)
Definition: GiGeometry.h:333
void setSelectionMarkers(const OdGsMarker *selectionMarkers)
Definition: GiGeometry.h:321
void setMaterials(OdDbStub **materialIds)
Definition: GiGeometry.h:366
void setColors(const OdUInt16 *colors)
Definition: GiGeometry.h:283
void setTrueColors(const OdCmEntityColor *colors)
Definition: GiGeometry.h:297
void setMappers(const OdGiMapper *mappers)
Definition: GiGeometry.h:378
void setTransparency(const OdCmTransparency *transparencies)
Definition: GiGeometry.h:389
void setVisibility(const OdUInt8 *visibilities)
Definition: GiGeometry.h:354
virtual void shell(OdInt32 numVertices, const OdGePoint3d *vertexList, OdInt32 faceListSize, const OdInt32 *faceList, const OdGiEdgeData *pEdgeData=0, const OdGiFaceData *pFaceData=0, const OdGiVertexData *pVertexData=0)=0