ccExtru.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #ifndef CC_EXTRU_PRIMITIVE_HEADER
  18. #define CC_EXTRU_PRIMITIVE_HEADER
  19. //Local
  20. #include "ccGenericPrimitive.h"
  21. //! Profile extrusion (primitive)
  22. /** It is defined by sweeping a profile representing the extrusion's shape (polyline)
  23. through a given distance (equivalent to the extrusion thickness).
  24. **/
  25. class QCC_DB_LIB_API ccExtru : public ccGenericPrimitive
  26. {
  27. public:
  28. //! Default constructor
  29. /** Input (2D) polyline represents the profile in (X,Y) plane.
  30. Extrusion is always done ine the 'Z' dimension.
  31. \param profile 2D profile to extrude
  32. \param height extrusion thickness
  33. \param transMat optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation)
  34. \param name name
  35. **/
  36. ccExtru(const std::vector<CCVector2>& profile,
  37. PointCoordinateType height,
  38. const ccGLMatrix* transMat = nullptr,
  39. QString name = QString("Extrusion"));
  40. //! Simplified constructor
  41. /** For ccHObject factory only!
  42. **/
  43. ccExtru(QString name = QString("Extrusion"));
  44. //! Returns class ID
  45. virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::EXTRU; }
  46. //inherited from ccGenericPrimitive
  47. virtual QString getTypeName() const override { return "Extrusion"; }
  48. virtual ccGenericPrimitive* clone() const override;
  49. //! Returns extrusion thickness
  50. const PointCoordinateType getThickness() const { return m_height; }
  51. //! Returns profile
  52. const std::vector<CCVector2>& getProfile() const { return m_profile; }
  53. protected:
  54. //inherited from ccGenericPrimitive
  55. bool toFile_MeOnly(QFile& out, short dataVersion) const override;
  56. bool fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) override;
  57. short minimumFileVersion_MeOnly() const override;
  58. bool buildUp() override;
  59. //! Extrusion thickness
  60. PointCoordinateType m_height;
  61. //! Profile
  62. std::vector<CCVector2> m_profile;
  63. };
  64. #endif //CC_EXTRU_PRIMITIVE_HEADER