CFx SDK Documentation  2023 SP0
DbMPolygon.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 _DBMPOLYGON_H_INCLUDED_
25 #define _DBMPOLYGON_H_INCLUDED_
26 
27 #include "DbHatch.h"
28 
29 class OdDbCircle;
30 class OdDb2dPolyline;
31 class OdDbPolyline;
32 class OdDbMPolygonCrossing;
34 class OdDbMPolygonNode;
35 
36 const double OdDbMPolygonCrossingFuzz = 1E-6;
37 
47 public:
49  virtual ~OdDbMPolygon();
50 
52 
53  virtual OdDbHatchPtr hatch();
54 
55  virtual double elevation() const;
56  virtual void setElevation(double elevation);
57 
58  virtual OdGeVector3d normal() const;
59  virtual void setNormal(const OdGeVector3d& normal);
60 
61  virtual OdResult evaluateHatch(bool bUnderestimateNumLines = false);
62 
64 
65  virtual const OdString& patternName() const;
66 
68  const OdString& patName);
69 
70  virtual double patternAngle() const;
71  virtual void setPatternAngle(double angle);
72 
73  virtual double patternSpace() const;
74  virtual void setPatternSpace(double space);
75 
76  virtual double patternScale() const;
77  virtual void setPatternScale(double scale);
78 
79  virtual bool patternDouble() const;
80  virtual void setPatternDouble(bool isDouble);
81 
82  virtual int numPatternDefinitions() const;
83  virtual void getPatternDefinitionAt(int index,
84  double& angle,
85  double& baseX,
86  double& baseY,
87  double& offsetX,
88  double& offsetY,
89  OdGeDoubleArray& dashes)
90  const;
91 
92  void setGradientAngle(double angle);
93  void setGradientShift( float shiftValue );
94  void setGradientOneColorMode( bool oneColorMode );
95  void setGradientColors( unsigned int count,
96  const OdCmColor* colors,
97  const double* values );
99  const OdString& gradName);
100 
101 
102  virtual OdCmColor patternColor() const;
103  virtual void setPatternColor(const OdCmColor& pc);
104 
112  virtual OdResult getArea(double& area) const;
113 
114  virtual OdGeVector2d getOffsetVector() const;
115 
117  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz);
119  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz);
121  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz);
122 
126  virtual int numMPolygonLoops() const;
127 
128  virtual OdResult getMPolygonLoopAt(int loopIndex, OdGePoint2dArray& vertices,
129  OdGeDoubleArray& bulges) const;
130 
132  const OdGeDoubleArray& bulges, bool excludeCrossing = true,
133  double tol = OdDbMPolygonCrossingFuzz);
134 
135  virtual OdResult insertMPolygonLoopAt(int loopIndex,
136  const OdGePoint2dArray& vertices, const OdGeDoubleArray& bulges,
137  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz);
138 
139  virtual OdResult removeMPolygonLoopAt(int loopIndex);
140 
144  enum loopDir {
145  kExterior = 0, // Loop direction is counter-clockwise
146  kInterior = 1, // Loop direction is clockwise
147  kAnnotation = 2 // Text
148  };
149 
157  virtual OdResult getLoopDirection(int lindex, OdDbMPolygon::loopDir& dir) const;
158 
167 
168  virtual bool isPointOnLoopBoundary(const OdGePoint3d& worldPt, int loop,
169  double tol = OdDbMPolygonCrossingFuzz) const;
170  virtual int isPointInsideMPolygon(const OdGePoint3d& worldPt, OdGeIntArray& loopsArray,
171  double tol = OdDbMPolygonCrossingFuzz) const;
172 
173  //FELIX_CHANGE_BEGIN
174  double getPerimeter() const;
175  int getClosestLoopTo( const OdGePoint3d& worldPt ) const;
177  OdIntArray &rejectedObjs,
178  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz );
180  const OdArray<OdGeDoubleArray> &bulges, OdIntArray &rejectedObjs,
181  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz );
182  //FELIX_CHANGE_END
183 
184 //FELIX_CHANGE_BEGIN
185 // from 21.1
195  int getParentLoop(int curLoop) const;
196 //FELIX_CHANGE_END
197  /* Not implemented
198 
199 
200  virtual OdResult getMPolygonTree(OdDbMPolygonNode*& loopNode) const;
201  virtual void deleteMPolygonTree(OdDbMPolygonNode* loopNode) const;
202 
203  virtual double getPerimeter() const;
204  virtual bool isBalanced() const;
205 
206  virtual OdResult balanceTree();
207  virtual OdResult balanceDisplay();
208 
209  //virtual OdResult getLoopAtGsMarker(OdGsMarker gsMark, int &loop) const;
210  virtual void getChildLoops(int curLoop, OdGeIntArray& selectedLoopIndexes) const;
211  virtual int getParentLoop(int curLoop) const;
212  virtual int getClosestLoopTo(const OdGePoint3d& worldPt) const;
213 
214  // Mpolyon loop crossing and inside methods.
215  //
216 
217  virtual OdResult loopCrossesItself(bool& crosses, bool findAll,
218  OdDbMPolygonCrossingArray& crossingsArray,
219  const OdGePoint2dArray& vertexPts,
220  const OdGeDoubleArray& vertexBulges,
221  double tol = OdDbMPolygonCrossingFuzz) const;
222 
223  virtual bool loopCrossesItself(const OdGePoint2dArray& vertexPts,
224  const OdGeDoubleArray& vertexBulges,
225  double tol = OdDbMPolygonCrossingFuzz) const;
226 
227  virtual OdResult loopCrossesMPolygon(bool& crosses, bool findAll,
228  OdDbMPolygonCrossingArray& crossingsArray,
229  const OdGePoint2dArray& testVertexPts,
230  const OdGeDoubleArray& testVertexBulges,
231  double tol = OdDbMPolygonCrossingFuzz) const;
232 
233  virtual bool selfCrosses(const OdGePoint2dArray& vertexPts,
234  const OdGeDoubleArray& vertexBulges,
235  double tol = OdDbMPolygonCrossingFuzz) const;
236 
237  virtual bool includesTouchingLoops(double tol = OdDbMPolygonCrossingFuzz) const;
238 
239  //virtual OdResult subGetClassID(void* pClsid) const;
240 
241  virtual OdResult intersectWith(
242  const OdDbEntity* ent,
243  OdDb::Intersect intType,
244  OdGePoint3dArray& points,
245  OdGsMarker thisGsMarker = 0,
246  OdGsMarker otherGsMarker = 0)
247  const;
248 
249  virtual OdResult intersectWith(
250  const OdDbEntity* ent,
251  OdDb::Intersect intType,
252  const OdGePlane& projPlane,
253  OdGePoint3dArray& points,
254  OdGsMarker thisGsMarker = 0,
255  OdGsMarker otherGsMarker = 0)
256  const;
257 
258  virtual OdResult getOsnapPoints(
259  OdDb::OsnapMode osnapMode,
260  OdGsMarker gsSelectionMark,
261  const OdGePoint3d& pickPoint,
262  const OdGePoint3d& lastPoint,
263  const OdGeMatrix3d& viewXform,
264  OdGePoint3dArray& snapPoints,
265  OdDbIntArray& geomIds) const;
266 
267  virtual OdResult getGripPoints(OdGePoint3dArray& gripPoints,
268  OdDbIntArray& osnapModes,
269  OdDbIntArray& geomIds) const;
270 
271  virtual OdResult moveGripPointsAt(const OdDbIntArray& indices,
272  const OdGeVector3d& offset);
273 
274  virtual OdResult getStretchPoints(OdGePoint3dArray& stretchPoints) const;
275 
276  virtual OdResult moveStretchPointsAt( const OdDbIntArray& indices,
277  const OdGeVector3d& offset);
278 
279  virtual OdResult createLoopsFromBoundaries (const OdDbObjectIdArray &ids,
280  OdIntArray &rejectedObjs,
281  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz);
282 
283  virtual OdResult createLoops (const OdGePoint2dArrayArray &vertices,
284  const OdArray<OdGeDoubleArray> &bulges, OdIntArray &rejectedObjs,
285  bool excludeCrossing = true, double tol = OdDbMPolygonCrossingFuzz);
286  */
288  OdRxObjectPtrArray& entitySet) const;
289 
291  const OdGeMatrix3d& xfn );
292 
294  OdDbDwgFiler* pFiler);
295 
296  virtual void dwgOutFields(
297  OdDbDwgFiler* pFiler) const;
298 
300  OdDbDxfFiler* pFiler);
301 
302  virtual void dxfOutFields(
303  OdDbDxfFiler* pFiler) const;
304 
305  virtual bool subWorldDraw(
306  OdGiWorldDraw* pWd) const;
307 
309  OdDbDatabase* pDb,
310  bool doSubents);
311 
312  virtual void saveAs(
313  OdGiWorldDraw* pWd,
314  OdDb::DwgVersion ver ) const;
315 };
316 
318 
319 //FELIX_CHANGE_BEGIN
321 public:
323 public:
327 };
328 //FELIX_CHANGE_END
329 
330 #endif // _DBMPOLYGON_H_INCLUDED_
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
const double OdDbMPolygonCrossingFuzz
Definition: DbMPolygon.h:36
OdSmartPtr< OdDbMPolygon > OdDbMPolygonPtr
Definition: DbMPolygon.h:317
OdArray< OdDbMPolygonCrossing, OdPlainObjectsAllocator< OdDbMPolygonCrossing > > OdDbMPolygonCrossingArray
Definition: DbMPolygon.h:32
tol
Definition: DimVarDefs.h:2287
scale
Definition: DimVarDefs.h:1684
OdResult
Definition: OdResult.h:29
E
Definition: SysVarDefs.h:422
HatchPatternType
Definition: DbHatch.h:102
GradientPatternType
Definition: DbHatch.h:122
void setGradientOneColorMode(bool oneColorMode)
virtual OdResult subTransformBy(const OdGeMatrix3d &xfn)
virtual OdResult getArea(double &area) const
double getPerimeter() const
virtual bool patternDouble() const
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const
virtual OdResult getMPolygonLoopAt(int loopIndex, OdGePoint2dArray &vertices, OdGeDoubleArray &bulges) const
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler)
virtual int numMPolygonLoops() const
OdResult createLoops(const OdArray< OdGePoint2dArray > &vertices, const OdArray< OdGeDoubleArray > &bulges, OdIntArray &rejectedObjs, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
virtual OdResult appendLoopFromBoundary(const OdDb2dPolyline *pPoly, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
virtual double patternScale() const
virtual double elevation() const
void setGradientAngle(double angle)
virtual bool isPointOnLoopBoundary(const OdGePoint3d &worldPt, int loop, double tol=OdDbMPolygonCrossingFuzz) const
void setGradient(OdDbHatch::GradientPatternType gradType, const OdString &gradName)
virtual OdResult appendLoopFromBoundary(const OdDbPolyline *pPoly, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
virtual void setPatternScale(double scale)
virtual OdResult appendMPolygonLoop(const OdGePoint2dArray &vertices, const OdGeDoubleArray &bulges, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
virtual void setPatternAngle(double angle)
virtual int numPatternDefinitions() const
virtual OdResult setLoopDirection(int lindex, OdDbMPolygon::loopDir dir)
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler)
virtual void setPatternColor(const OdCmColor &pc)
virtual void setElevation(double elevation)
void setGradientColors(unsigned int count, const OdCmColor *colors, const double *values)
virtual void getPatternDefinitionAt(int index, double &angle, double &baseX, double &baseY, double &offsetX, double &offsetY, OdGeDoubleArray &dashes) const
virtual OdGeVector3d normal() const
OdResult createLoopsFromBoundaries(const OdDbObjectIdArray &ids, OdIntArray &rejectedObjs, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
virtual void setPattern(OdDbHatch::HatchPatternType patType, const OdString &patName)
virtual void setPatternDouble(bool isDouble)
virtual OdResult appendLoopFromBoundary(const OdDbCircle *pCircle, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
virtual OdResult insertMPolygonLoopAt(int loopIndex, const OdGePoint2dArray &vertices, const OdGeDoubleArray &bulges, bool excludeCrossing=true, double tol=OdDbMPolygonCrossingFuzz)
int getParentLoop(int curLoop) const
virtual OdResult removeMPolygonLoopAt(int loopIndex)
virtual OdResult getLoopDirection(int lindex, OdDbMPolygon::loopDir &dir) const
virtual OdGeVector2d getOffsetVector() const
virtual double patternSpace() const
ODDB_DECLARE_MEMBERS(OdDbMPolygon)
virtual ~OdDbMPolygon()
virtual const OdString & patternName() const
virtual OdDbHatchPtr hatch()
virtual OdCmColor patternColor() const
virtual OdResult evaluateHatch(bool bUnderestimateNumLines=false)
virtual OdDbHatch::HatchPatternType patternType() const
virtual void setNormal(const OdGeVector3d &normal)
void setGradientShift(float shiftValue)
virtual bool subWorldDraw(OdGiWorldDraw *pWd) const
virtual double patternAngle() const
virtual OdResult subExplode(OdRxObjectPtrArray &entitySet) const
virtual void saveAs(OdGiWorldDraw *pWd, OdDb::DwgVersion ver) const
int getClosestLoopTo(const OdGePoint3d &worldPt) const
virtual void setPatternSpace(double space)
virtual void subSetDatabaseDefaults(OdDbDatabase *pDb, bool doSubents)
virtual int isPointInsideMPolygon(const OdGePoint3d &worldPt, OdGeIntArray &loopsArray, double tol=OdDbMPolygonCrossingFuzz) const
OdArray< OdDbMPolygonNode * > mChildren
Definition: DbMPolygon.h:325
OdDbMPolygonNode * mParent
Definition: DbMPolygon.h:324
GLuint index
Definition: gles2_ext.h:265
GLsizei GLsizei * count
Definition: gles2_ext.h:276
DwgVersion
Definition: OdaDefs.h:46