dbpl.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // DESCRIPTION: Lightweight polyline API header file.
  12. //
  13. #ifndef AD_DBPL_H
  14. #define AD_DBPL_H 1
  15. #include "dbmain.h"
  16. #include "dbcurve.h"
  17. #include "gelnsg2d.h"
  18. #include "gelnsg3d.h"
  19. #include "gearc2d.h"
  20. #include "gearc3d.h"
  21. #include "gept2dar.h"
  22. #include "dbboiler.h"
  23. #pragma pack(push, 8)
  24. class AcDb2dPolyline;
  25. class AcDbPolyline : public AcDbCurve
  26. {
  27. public:
  28. AcDbPolyline();
  29. AcDbPolyline(unsigned int num_verts);
  30. virtual ~AcDbPolyline();
  31. ACDB_DECLARE_MEMBERS(AcDbPolyline);
  32. //**********************************************************************
  33. // AcDbPolyline methods.
  34. //**********************************************************************
  35. virtual Acad::ErrorStatus convertFrom(AcDbEntity*& pPline,
  36. Adesk::Boolean transferId = Adesk::kTrue);
  37. Acad::ErrorStatus convertTo(AcDb2dPolyline*& pPline,
  38. Adesk::Boolean transferId = Adesk::kTrue) const;
  39. Acad::ErrorStatus getPointAt(unsigned int, AcGePoint3d& pt) const;
  40. enum SegType {
  41. kLine,
  42. kArc,
  43. kCoincident,
  44. kPoint,
  45. kEmpty
  46. };
  47. SegType segType (unsigned int index) const;
  48. Acad::ErrorStatus getLineSegAt (unsigned int index,
  49. AcGeLineSeg2d& ln) const;
  50. Acad::ErrorStatus getLineSegAt (unsigned int index,
  51. AcGeLineSeg3d& ln) const;
  52. Acad::ErrorStatus getArcSegAt (unsigned int index,
  53. AcGeCircArc2d& arc) const;
  54. Acad::ErrorStatus getArcSegAt (unsigned int index,
  55. AcGeCircArc3d& arc) const;
  56. virtual Adesk::Boolean onSegAt (unsigned int index, const AcGePoint2d& pt2d,
  57. double& param) const;
  58. //**********************************************************************
  59. // AcDbPolyline methods.
  60. //**********************************************************************
  61. virtual void setClosed (Adesk::Boolean);
  62. void setPlinegen (Adesk::Boolean);
  63. virtual void setElevation (double);
  64. virtual Acad::ErrorStatus setThickness (double);
  65. virtual Acad::ErrorStatus setConstantWidth (double);
  66. virtual Acad::ErrorStatus setNormal (const AcGeVector3d&);
  67. Adesk::Boolean isOnlyLines () const;
  68. Adesk::Boolean hasPlinegen () const;
  69. double elevation () const;
  70. double thickness () const;
  71. Acad::ErrorStatus getConstantWidth(double&) const;
  72. AcGeVector3d normal () const;
  73. virtual Acad::ErrorStatus addVertexAt (unsigned int index,
  74. const AcGePoint2d& pt,
  75. double bulge = 0.,
  76. double startWidth = -1.,
  77. double endWidth = -1.,
  78. Adesk::Int32 vertexIdentifier = 0);
  79. virtual Acad::ErrorStatus removeVertexAt (unsigned int index);
  80. unsigned int numVerts () const;
  81. Acad::ErrorStatus getPointAt (unsigned int index,
  82. AcGePoint2d& pt) const;
  83. Acad::ErrorStatus getBulgeAt (unsigned int index,
  84. double& bulge) const;
  85. Acad::ErrorStatus getVertexIdentifierAt(unsigned int index,
  86. Adesk::Int32& vertexIdentifier) const;
  87. Acad::ErrorStatus getWidthsAt (unsigned int index,
  88. double& startWidth,
  89. double& endWidth) const;
  90. virtual Acad::ErrorStatus setPointAt (unsigned int index,
  91. const AcGePoint2d& pt);
  92. virtual Acad::ErrorStatus setBulgeAt (unsigned int index,
  93. double bulge);
  94. virtual Acad::ErrorStatus setVertexIdentifierAt (unsigned int index,
  95. Adesk::Int32 suggestedValue);
  96. virtual Acad::ErrorStatus setWidthsAt (unsigned int index,
  97. double startWidth,
  98. double endWidth);
  99. Acad::ErrorStatus minimizeMemory ();
  100. Acad::ErrorStatus maximizeMemory ();
  101. virtual void reset (Adesk::Boolean reuse,
  102. unsigned int numVerts);
  103. Adesk::Boolean hasBulges () const;
  104. Adesk::Boolean hasVertexIdentifiers() const;
  105. Adesk::Boolean hasWidth () const;
  106. // Does nothing and returns Acad::eOk if already closed or the start and end
  107. // vertices do not coincide
  108. //
  109. ACDB_PORT Acad::ErrorStatus makeClosedIfStartAndEndVertexCoincide(double distTol);
  110. //**********************************************************************
  111. // AcDbCurve methods.
  112. //**********************************************************************
  113. DBCURVE_METHODS
  114. //*************************************************************************
  115. // Overridden methods from AcDEntity
  116. //*************************************************************************
  117. virtual void getEcs(AcGeMatrix3d& retVal) const;
  118. virtual Acad::ErrorStatus applyPartialUndo(AcDbDwgFiler* filer,
  119. AcRxClass* classobj);
  120. //*************************************************************************
  121. // Overridden methods from AcDbObject
  122. //*************************************************************************
  123. virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* filer);
  124. virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* filer) const;
  125. virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* filer);
  126. virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* filer) const;
  127. virtual void saveAs(AcGiWorldDraw* mode,
  128. AcDb::SaveType st);
  129. protected:
  130. //*************************************************************************
  131. // Overridden methods from AcDEntity
  132. //*************************************************************************
  133. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  134. };
  135. inline Adesk::Boolean AcDbPolyline::isPlanar() const
  136. {
  137. return Adesk::kTrue;
  138. }
  139. inline Acad::ErrorStatus AcDbPolyline::getStartParam(double& startParam) const
  140. {
  141. startParam = 0.;
  142. return Acad::eOk;
  143. }
  144. inline Acad::ErrorStatus AcDbPolyline::getSpline(AcDbSpline*& spline) const
  145. {
  146. spline; // unreferenced parameter
  147. return Acad::eNotApplicable;
  148. }
  149. #pragma pack(pop)
  150. #endif /*AD_DBPL_H*/