CFx SDK Documentation  2020SP3
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_
OdGeShell::faceVisibilities
OdUInt8Array faceVisibilities
Definition: GeShell.h:130
OdGeShell::addVertex
void addVertex(const OdGePoint3d &vertex)
Definition: GeShell.h:152
OdGeShell::edgeTrueColors
OdCmEntityColorArray edgeTrueColors
Definition: GeShell.h:80
OdGeShell::vertices
OdGePoint3dArray vertices
Definition: GeShell.h:62
OdUInt8
unsigned char OdUInt8
Definition: OdPlatformSettings.h:759
OdGiFaceData::setVisibility
void setVisibility(const OdUInt8 *visibilities)
Definition: GiGeometry.h:354
Int32Array.h
OdGeShell::edgeVisibilities
OdUInt8Array edgeVisibilities
Definition: GeShell.h:100
OdGiFaceData::setMappers
void setMappers(const OdGiMapper *mappers)
Definition: GiGeometry.h:378
GePoint3dArray.h
OdArray< OdGePoint3d, OdMemoryAllocator< OdGePoint3d > >
TD_PackPop.h
OdGiFaceData::setTrueColors
void setTrueColors(const OdCmEntityColor *colors)
Definition: GiGeometry.h:297
OdGiEdgeData::setLayers
void setLayers(OdDbStub **layerIds)
Definition: GiGeometry.h:121
OdGiFaceData::setMaterials
void setMaterials(OdDbStub **materialIds)
Definition: GiGeometry.h:366
OdArray::getPtr
const T * getPtr() const
Definition: OdArray.h:1102
OdGeShell::faceMaterials
OdDbStubPtrArray faceMaterials
Definition: GeShell.h:135
OdGeShell::edgeColors
OdUInt16Array edgeColors
Definition: GeShell.h:75
OdGeShell::edgeLinetypes
OdDbStubPtrArray edgeLinetypes
Definition: GeShell.h:90
OdGiFaceData
Definition: GiGeometry.h:245
OdGeShell::edgeSelectionMarkers
OdGsMarkerArray edgeSelectionMarkers
Definition: GeShell.h:95
OdGiFaceData::setTransparency
void setTransparency(const OdCmTransparency *transparencies)
Definition: GiGeometry.h:389
OdGePoint3d
Definition: GePoint3d.h:55
OdGeShell::faceNormals
OdGeVector3dArray faceNormals
Definition: GeShell.h:120
OdGeShell
Definition: GeShell.h:54
OdGeShell::edgeLayers
OdDbStubPtrArray edgeLayers
Definition: GeShell.h:85
OdArray::size
size_type size() const
Definition: OdArray.h:893
GiGeometry.h
OdGeShell::addFaceVertex
void addFaceVertex(int nVertexIndex)
Definition: GeShell.h:186
OdGiEdgeData::setVisibility
void setVisibility(const OdUInt8 *visibilities)
Definition: GiGeometry.h:167
OdGeShell::faceSelectionMarkers
OdGsMarkerArray faceSelectionMarkers
Definition: GeShell.h:125
OdGiEdgeData::setTrueColors
void setTrueColors(const OdCmEntityColor *colors)
Definition: GiGeometry.h:109
OdGeShell::startFace
void startFace(bool bHole=false)
Definition: GeShell.h:174
OdGiEdgeData
Definition: GiGeometry.h:67
OdGiEdgeData::setLinetypes
void setLinetypes(OdDbStub **linetypeIds)
Definition: GiGeometry.h:133
OdGeShell::faceColors
OdUInt16Array faceColors
Definition: GeShell.h:105
UInt16Array.h
CmEntityColorArray.h
OdGeShell::endFace
void endFace()
Definition: GeShell.h:160
OdGiEdgeData::setColors
void setColors(const OdUInt16 *colors)
Definition: GiGeometry.h:95
OdGeShell::draw
void draw(OdGiGeometry &geometry)
Definition: GeShell.h:197
GsMarkerArray.h
CmTransparencyArray.h
OdGiFaceData::setSelectionMarkers
void setSelectionMarkers(const OdGsMarker *selectionMarkers)
Definition: GiGeometry.h:321
OdGeShell::faceMappers
OdArray< OdGiMapper > faceMappers
Definition: GeShell.h:140
OdGeShell::faceLayers
OdDbStubPtrArray faceLayers
Definition: GeShell.h:115
ODA_ASSERT
#define ODA_ASSERT(exp)
Definition: DebugStuff.h:49
UInt8Array.h
OdGiGeometry
Definition: GiGeometry.h:698
OdArray::push_back
void push_back(const T &value)
Definition: OdArray.h:987
OdGiEdgeData::setSelectionMarkers
void setSelectionMarkers(const OdGsMarker *selectionMarkers)
Definition: GiGeometry.h:145
OdGeShell::faceTransparencies
OdCmTransparencyArray faceTransparencies
Definition: GeShell.h:145
OdGiGeometry::shell
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
OdGiFaceData::setNormals
void setNormals(const OdGeVector3d *normals)
Definition: GiGeometry.h:333
OdGeShell::faceTrueColors
OdCmEntityColorArray faceTrueColors
Definition: GeShell.h:110
DbStubPtrArray.h
OdGeShell::OdGeShell
OdGeShell()
Definition: GeShell.h:57
OdGiFaceData::setColors
void setColors(const OdUInt16 *colors)
Definition: GiGeometry.h:283
OdGiFaceData::setLayers
void setLayers(OdDbStub **layerIds)
Definition: GiGeometry.h:309
GeVector3dArray.h
OdGeShell::faces
OdInt32Array faces
Definition: GeShell.h:70
Od_abs
#define Od_abs
Definition: OdPlatform.h:130
OdArray::isEmpty
bool isEmpty() const
Definition: OdArray.h:1062