ccBox.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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_BOX_PRIMITIVE_HEADER
  18. #define CC_BOX_PRIMITIVE_HEADER
  19. //Local
  20. #include "ccGenericPrimitive.h"
  21. //! Box (primitive)
  22. /** 3D box primitive
  23. **/
  24. class QCC_DB_LIB_API ccBox : public ccGenericPrimitive
  25. {
  26. public:
  27. //! Default constructor
  28. /** Box dimensions axis along each dimension are defined in a single 3D vector.
  29. A box is in fact composed of 6 planes (ccPlane).
  30. \param dims box dimensions
  31. \param transMat optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation)
  32. \param name name
  33. **/
  34. ccBox( const CCVector3& dims,
  35. const ccGLMatrix* transMat = nullptr,
  36. QString name = QString("Box"));
  37. //! Simplified constructor
  38. /** For ccHObject factory only!
  39. **/
  40. ccBox(QString name = QString("Box"));
  41. //! Returns class ID
  42. virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::BOX; }
  43. //inherited from ccGenericPrimitive
  44. virtual QString getTypeName() const override { return "Box"; }
  45. virtual ccGenericPrimitive* clone() const override;
  46. //! Sets box dimensions
  47. inline void setDimensions(CCVector3& dims) { m_dims = dims; updateRepresentation(); }
  48. //! Returns box dimensions
  49. const CCVector3& getDimensions() const { return m_dims; }
  50. protected:
  51. //inherited from ccGenericPrimitive
  52. bool toFile_MeOnly(QFile& out, short dataVersion) const override;
  53. bool fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) override;
  54. short minimumFileVersion_MeOnly() const override;
  55. bool buildUp() override;
  56. //! Box dimensions
  57. CCVector3 m_dims;
  58. };
  59. #endif //CC_BOX_PRIMITIVE_HEADER