ccPointListPickingDlg.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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_POINT_PICKING_LIST_DIALOG_HEADER
  18. #define CC_POINT_PICKING_LIST_DIALOG_HEADER
  19. //GUI
  20. #include <ui_pointListPickingDlg.h>
  21. //Local
  22. #include "ccPointPickingGenericInterface.h"
  23. //qCC_db
  24. #include <ccHObject.h>
  25. class cc2DLabel;
  26. //! Dialog/interactor to graphically pick a list of points
  27. /** Options let the user export the list to an ASCII file, a new cloud, a polyline, etc.
  28. **/
  29. class ccPointListPickingDlg : public ccPointPickingGenericInterface, public Ui::PointListPickingDlg
  30. {
  31. Q_OBJECT
  32. public:
  33. //! Default constructor
  34. explicit ccPointListPickingDlg(ccPickingHub* pickingHub, QWidget* parent);
  35. //! Associates dialog with a cloud or a mesh
  36. void linkWithEntity(ccHObject* entity);
  37. protected:
  38. //! Applies changes and exit
  39. void applyAndExit();
  40. //! Cancels process and exit
  41. void cancelAndExit();
  42. //! Exports list to a new cloud
  43. void exportToNewCloud();
  44. //! Exports list to a polyline
  45. void exportToNewPolyline();
  46. //! Removes last inserted point from list
  47. void removeLastEntry();
  48. //! Exports list to an 'xyz' ASCII file
  49. inline void exportToASCII_xyz() { return exportToASCII(PLP_ASCII_EXPORT_XYZ); }
  50. //! Exports list to an 'ixyz' ASCII file
  51. inline void exportToASCII_ixyz() { return exportToASCII(PLP_ASCII_EXPORT_IXYZ); }
  52. //! Exports list to an 'gxyz' ASCII file
  53. inline void exportToASCII_gxyz() { return exportToASCII(PLP_ASCII_EXPORT_GXYZ); }
  54. //! Exports list to an 'lxyz' ASCII file
  55. inline void exportToASCII_lxyz() { return exportToASCII(PLP_ASCII_EXPORT_LXYZ); }
  56. //! Redraw window when marker size changes
  57. void markerSizeChanged(int);
  58. //! Redraw window when starting index changes
  59. void startIndexChanged(int);
  60. //! Updates point list widget
  61. void updateList();
  62. protected:
  63. //inherited from ccPointPickingGenericInterface
  64. void processPickedPoint(const PickedItem& picked) override;
  65. //! Gets current (visible) picked points from the associated cloud
  66. unsigned getPickedPoints(std::vector<cc2DLabel*>& pickedPoints);
  67. //! Export format
  68. /** See exportToASCII.
  69. **/
  70. enum ExportFormat { PLP_ASCII_EXPORT_XYZ,
  71. PLP_ASCII_EXPORT_IXYZ,
  72. PLP_ASCII_EXPORT_GXYZ,
  73. PLP_ASCII_EXPORT_LXYZ
  74. };
  75. //! Exports list to an ASCII file
  76. void exportToASCII(ExportFormat format);
  77. //! Associated cloud or mesh
  78. ccHObject* m_associatedEntity;
  79. //! Last existing label unique ID on load
  80. unsigned m_lastPreviousID;
  81. //! Ordered labels container
  82. ccHObject* m_orderedLabelsContainer;
  83. //! Existing picked points that the user wants to delete (for proper "cancel" mechanism)
  84. ccHObject::Container m_toBeDeleted;
  85. //! New picked points that the user has selected (for proper "cancel" mechanism)
  86. ccHObject::Container m_toBeAdded;
  87. };
  88. #endif