| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #pragma once
- //##########################################################################
- //# #
- //# CLOUDCOMPARE #
- //# #
- //# This program is free software; you can redistribute it and/or modify #
- //# it under the terms of the GNU General Public License as published by #
- //# the Free Software Foundation; version 2 or later of the License. #
- //# #
- //# This program is distributed in the hope that it will be useful, #
- //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
- //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
- //# GNU General Public License for more details. #
- //# #
- //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
- //# #
- //##########################################################################
- //Local
- #include "ccOverlayDialog.h"
- #include "ccPickingListener.h"
- //qCC_db
- #include <ccGenericGLDisplay.h>
- //system
- #include <vector>
- class ccPolyline;
- class ccPointCloud;
- class ccGLWindowInterface;
- class ccPickingHub;
- namespace Ui
- {
- class TracePolyLineDlg;
- }
- //! Graphical Polyline Tracing tool
- class ccTracePolylineTool : public ccOverlayDialog, public ccPickingListener
- {
- Q_OBJECT
- public:
- //! Default constructor
- explicit ccTracePolylineTool(ccPickingHub* pickingHub, QWidget* parent);
- //! Destructor
- virtual ~ccTracePolylineTool();
- //inherited from ccOverlayDialog
- virtual bool linkWith(ccGLWindowInterface* win) override;
- virtual bool start() override;
- virtual void stop(bool accepted) override;
- protected:
- void apply();
- void cancel();
- void exportLine();
- inline void continueEdition() { restart(false); }
- inline void resetLine() { restart(true); }
- void closePolyLine(int x = 0, int y = 0); //arguments for compatibility with ccGlWindow::rightButtonClicked signal
- void updatePolyLineTip(int x, int y, Qt::MouseButtons buttons);
- void onWidthSizeChanged(int);
- //! To capture overridden shortcuts (pause button, etc.)
- void onShortcutTriggered(int);
- //! Inherited from ccPickingListener
- virtual void onItemPicked(const PickedItem& pi) override;
- protected:
- //! Restarts the edition mode
- void restart(bool reset);
- //! Viewport parameters (used for picking)
- struct SegmentGLParams
- {
- SegmentGLParams() {}
- SegmentGLParams(ccGenericGLDisplay* display, int x, int y);
- ccGLCameraParameters params;
- CCVector2d clickPos;
- };
- //! Oversamples the active 3D polyline
- ccPolyline* polylineOverSampling(unsigned steps) const;
- //! 2D polyline (for the currently edited part)
- ccPolyline* m_polyTip;
- //! 2D polyline vertices
- ccPointCloud* m_polyTipVertices;
- //! 3D polyline
- ccPolyline* m_poly3D;
- //! 3D polyline vertices
- ccPointCloud* m_poly3DVertices;
- //! Viewport parameters use to draw each segment of the polyline
- std::vector<SegmentGLParams> m_segmentParams;
- //! Current process state
- bool m_done;
- //! Picking hub
- ccPickingHub* m_pickingHub;
- Ui::TracePolyLineDlg* m_ui;
- };
|