AcPointCloudExtractor.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include "AcDbPointCloudEx.h"
  13. #include "AcPointCloudExtractProfileCurve.h"
  14. /// <summary>
  15. /// Option to do point cloud line extraction
  16. /// </summary>
  17. ///
  18. class ACDB_PORT ExtractOption
  19. {
  20. public:
  21. /// <summary>
  22. /// Extraction type, outline or floorplan
  23. /// </summary>
  24. ///
  25. enum ExtractionType
  26. {
  27. kOutLine,
  28. kAllLine,
  29. };
  30. public:
  31. /// <summary>
  32. /// Extract type, out line or floorplan.
  33. /// </summary>
  34. ///
  35. ExtractionType m_extractionType;
  36. /// <summary>
  37. /// Maxium points to process. it should be bigger than 0.
  38. /// Usually 5000 -2000000 is reasonable.
  39. /// </summary>
  40. ///
  41. unsigned int m_processPoints;
  42. /// <summary>
  43. /// Collect line tolerance. It should be bigger than 0.
  44. /// </summary>
  45. ///
  46. double m_fillGap;
  47. /// <summary>
  48. /// Collect line within this angle if distance is within fillgap.
  49. /// Usually 0-10 is reasonable.
  50. /// </summary>
  51. ///
  52. unsigned int m_snapAngle;
  53. /// <summary>
  54. /// Minium segment length. It should be bigger than 0.
  55. /// </summary>
  56. ///
  57. double m_minSegLength;
  58. /// <summary>
  59. /// If use line segments only or include arcs
  60. /// </summary>
  61. ///
  62. bool m_useLineSegmentOnly;
  63. ExtractOption();
  64. };
  65. /// <summary>
  66. /// Point cloud line extraction process callback
  67. /// </summary>
  68. ///
  69. class ACDB_PORT IPointCloudExtracProgressCallback
  70. {
  71. public:
  72. IPointCloudExtracProgressCallback(void){}
  73. virtual ~IPointCloudExtracProgressCallback(void){}
  74. /// <summary>
  75. /// Update progressing, from 0 ~ 99.
  76. /// </summary>
  77. ///
  78. virtual void updateProgress(int progress) = 0;
  79. /// <summary>
  80. /// Update caption displayed in the progress dialog if there's any
  81. /// </summary>
  82. ///
  83. virtual void updateCaption(const AcString& caption) = 0;
  84. /// <summary>
  85. /// Whether or not the callback is cancelled.
  86. /// return true if cancelled.
  87. /// </summary>
  88. ///
  89. virtual bool cancelled() const = 0;
  90. /// <summary>
  91. /// Cancel the progress.
  92. /// </summary>
  93. ///
  94. virtual void cancel() = 0;
  95. /// <summary>
  96. /// Update the remaining time of the progress. In seconds.
  97. /// </summary>
  98. ///
  99. virtual void updateRemainTime(double remainTime) = 0;
  100. /// <summary>
  101. /// End the process.
  102. /// </summary>
  103. ///
  104. virtual void end() = 0;
  105. };
  106. /// <summary>
  107. /// Utility class to do point cloud line extraction and line output.
  108. /// </summary>
  109. ///
  110. class ACDB_PORT AcPointCloudExtractor
  111. {
  112. public:
  113. /// <summary>
  114. /// Extract point cloud in a plane and give result.
  115. /// </summary>
  116. /// <param name="pointCloud">The pointcloud to be extracted.</param>
  117. /// <param name="planeZDirection">Z direction of extraction plan, in drawing space.</param>
  118. /// <param name="planeXDirection">X direction of extraction plan, in drawing space.</param>
  119. /// <param name="pointPlane">A point on extraction plan.</param>
  120. /// <param name="extractOption">Extract option.</param>
  121. /// <param name="outlineResult">Out line result.</param>
  122. /// <param name="progress">The call back function for the progress.</param>
  123. /// <return> Return Acad::eOk if success, otherwise return Acad::eNotApplicable.</return>
  124. ///
  125. static Acad::ErrorStatus extract(AcDbPointCloudEx *pointCloud,
  126. const AcGeVector3d& planeZDirection,
  127. const AcGeVector3d& planeXDirection,
  128. const AcGePoint3d pointPlane,
  129. const ExtractOption& extractOption,
  130. AcPointCloudExtractResult& outlineResult,
  131. IPointCloudExtracProgressCallback* progress = 0);
  132. /// <summary>
  133. /// append line from extraction result.
  134. /// <return> Return the line's object ids appended.</return>
  135. /// </summary>
  136. /// <param name="profile">The extracted line result generated by extract method. The lines are 2d and in ecs size.</param>
  137. /// <param name="spaceId">The work space id you want to add the linework.</param>
  138. /// <param name="layer">The layer you want to add the linework.</param>
  139. /// <param name="color">The color you want set for the linework.</param>
  140. /// <return> Return the object ids for the linework.</return>
  141. ///
  142. static AcDbObjectIdArray appendLineProfile(const AcPointCloudExtractResult& profile,
  143. AcDbObjectId spaceId,
  144. AcString layer,
  145. AcCmColor color);
  146. /// <summary>
  147. /// append poly line from extraction result.
  148. /// <return> Return the pline's object ids appended.</return>
  149. /// </summary>
  150. /// <param name="profile">The extracted line result generated by extract method. The lines are 2d and in ecs size.</param>
  151. /// <param name="spaceId">The work space id you want to add the plines.</param>
  152. /// <param name="layer">The layer you want to add the plines.</param>
  153. /// <param name="color">The color you want set for the plines.</param>
  154. /// <return> Return the object ids for the plines.</return>
  155. ///
  156. static AcDbObjectIdArray appendPolylineProfile(const AcPointCloudExtractResult& profile,
  157. AcDbObjectId spaceId,
  158. AcString layer,
  159. AcCmColor color,
  160. double polylineWidth);
  161. };