CFx SDK Documentation  2022 SP0
GiModelerDummyGeometry.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 _ODGIMODELERDUMMYGEOM_INCLUDED_
25 #define _ODGIMODELERDUMMYGEOM_INCLUDED_
26 
27 #include "Gi/GiDummyGeometry.h"
28 
29 #include "DbBaseSubentId.h"
30 
31 #include "ModelerMarkers.h"
32 
33 #include "TD_PackPush.h"
34 
40 template<class T, class DRAW, class WR, class WRA> class OdGeomGrabber : public T
41 {
42  OdGsMarker m_curSelMarker;
43  WRA &wires;
44 
45  OdGeomGrabber();
46 protected:
47  virtual OdGsMarker getCurSelMarker() const {
48  return m_curSelMarker;
49  }
50 
51 public:
52 
53  OdGeomGrabber(WRA &pW, DRAW &pVd)
54  : T(pVd, pVd.geometry(), pVd.subEntityTraits())
55  , m_curSelMarker(0)
56  , wires(pW)
57  { }
58 
59  virtual void setSelectionMarker(OdGsMarker n) { m_curSelMarker = n; T::setSelectionMarker(n); }
60 
61  virtual WR *appendWire()
62  {
63  WR *pWire = wires.append();
64  pWire->selMarker = OdIntToGsMarker(-getFaceIndex(m_curSelMarker));
65  pWire->color = T::subEntityTraits().trueColor();
66  return pWire;
67  }
68 
69  virtual void circle(const OdGePoint3d& center, double radius, const OdGeVector3d& normal)
70  {
71  appendWire()->circle(center, radius, normal);
72  T::circle(center, radius, normal);
73  }
74 
75  virtual void circle(const OdGePoint3d& p1, const OdGePoint3d& p2, const OdGePoint3d& p3)
76  {
77  appendWire()->circle(p1, p2, p3);
78  T::circle(p1, p2, p3);
79  }
80 
81  virtual void circularArc(const OdGePoint3d& center,
82  double radius,
83  const OdGeVector3d& normal,
84  const OdGeVector3d& startVector,
85  double sweepAngle,
86  OdGiArcType arcType = kOdGiArcSimple)
87  {
88  appendWire()->circularArc(center, radius, normal, startVector, sweepAngle);
89  T::circularArc(center, radius, normal, startVector, sweepAngle, arcType);
90  }
91 
92  virtual void circularArc(const OdGePoint3d& start,
93  const OdGePoint3d& point,
94  const OdGePoint3d& end,
95  OdGiArcType arcType = kOdGiArcSimple)
96  {
97  appendWire()->circularArc(start, point, end);
98  T::circularArc(start, point, end, arcType);
99  }
100 
101  virtual void polyline(OdInt32 nbPoints,
102  const OdGePoint3d* pVertexList,
103  const OdGeVector3d* pNormal = NULL,
104  OdGsMarker lBaseSubEntMarker = -1)
105  {
106  appendWire()->polyline(nbPoints, pVertexList);
107  T::polyline(nbPoints, pVertexList, pNormal, lBaseSubEntMarker);
108  }
109 
110  virtual void nurbs(const OdGeNurbCurve3d& nurbs)
111  {
112  appendWire()->nurbs(nurbs);
113  T::nurbs(nurbs);
114  }
115 };
116 
122 template<class T, class DRAW, class WR, class WRA> class OdShellGrabber : public T
123 {
124  OdGsMarker m_curSelMarker;
125  WRA &wires;
126 
127  OdShellGrabber();
128 public:
129 
130  OdShellGrabber(WRA &pW, DRAW &pVd) : T(pVd, pVd.geometry(), pVd.subEntityTraits())
131  , m_curSelMarker(0)
132  , wires(pW)
133  { }
134 
135  virtual OdGiRegenType regenType() const { return kOdGiHideOrShadeCommand; }
136 
137  virtual void setSelectionMarker(OdGsMarker n) { m_curSelMarker = n; T::setSelectionMarker(n); }
138 
139  virtual void shell(
140  OdInt32 numVertices,
141  const OdGePoint3d* vertexList,
142  OdInt32 faceListSize,
143  const OdInt32* faceList,
144  const OdGiEdgeData* pEdgeData = 0,
145  const OdGiFaceData* pFaceData = 0,
146  const OdGiVertexData* pVertexData = 0)
147  {
148  WR *pWire = wires.append();
149  pWire->selMarker = m_curSelMarker;
150  pWire->color = T::subEntityTraits().trueColor();
151  pWire->shell(
152  numVertices,
153  vertexList,
154  faceListSize,
155  faceList,
156  pEdgeData,
157  pFaceData,
158  pVertexData);
159 
160  T::shell(
161  numVertices,
162  vertexList,
163  faceListSize,
164  faceList,
165  pEdgeData,
166  pFaceData,
167  pVertexData);
168  }
169 };
170 
171 #include "TD_PackPop.h"
172 
173 #include "ModelerMarkersUndef.h"
174 
175 #endif // #ifndef _ODGIMODELERDUMMYGEOM_INCLUDED_
OdGiRegenType
Definition: GiCommonDraw.h:50
@ kOdGiHideOrShadeCommand
Definition: GiCommonDraw.h:53
OdGiArcType
Definition: GiGeometry.h:683
@ kOdGiArcSimple
Definition: GiGeometry.h:684
#define NULL
Definition: GsProperties.h:177
#define getFaceIndex(gsMarker)
ptrdiff_t OdGsMarker
int OdInt32
#define OdIntToGsMarker(arg)
virtual void nurbs(const OdGeNurbCurve3d &nurbs)
OdGeomGrabber(WRA &pW, DRAW &pVd)
virtual void circle(const OdGePoint3d &center, double radius, const OdGeVector3d &normal)
virtual WR * appendWire()
virtual void circularArc(const OdGePoint3d &center, double radius, const OdGeVector3d &normal, const OdGeVector3d &startVector, double sweepAngle, OdGiArcType arcType=kOdGiArcSimple)
virtual OdGsMarker getCurSelMarker() const
virtual void circularArc(const OdGePoint3d &start, const OdGePoint3d &point, const OdGePoint3d &end, OdGiArcType arcType=kOdGiArcSimple)
virtual void polyline(OdInt32 nbPoints, const OdGePoint3d *pVertexList, const OdGeVector3d *pNormal=NULL, OdGsMarker lBaseSubEntMarker=-1)
virtual void circle(const OdGePoint3d &p1, const OdGePoint3d &p2, const OdGePoint3d &p3)
virtual void setSelectionMarker(OdGsMarker n)
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)
OdShellGrabber(WRA &pW, DRAW &pVd)
virtual OdGiRegenType regenType() const
virtual void setSelectionMarker(OdGsMarker n)