Debian Codegraph @

plugins/core/Standard/qCloudLayers/include/ccMouseCircle.h

raw
1 #pragma once
2
3 //##########################################################################
4 //# #
5 //# CLOUDCOMPARE PLUGIN: ccCompass #
6 //# #
7 //# This program is free software; you can redistribute it and/or modify #
8 //# it under the terms of the GNU General Public License as published by #
9 //# the Free Software Foundation; version 2 of the License. #
10 //# #
11 //# This program is distributed in the hope that it will be useful, #
12 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 //# GNU General Public License for more details. #
15 //# #
16 //# COPYRIGHT: Sam Thiele 2017 #
17 //# #
18 //##########################################################################
19
20 /**
21 This is a custom 2DViewportLabel which takes up the entire viewport but is entirely transparent,
22 except for a circle with radius r around the mouse.
23 */
24
25 #include <ccGLWindowInterface.h>
26 #include <cc2DViewportObject.h>
27
28 class QEvent;
29
30 //Qt
31 #include <QObject>
32
33 class ccMouseCircle : public cc2DViewportObject, public QObject
34 {
35 public:
36 //constructor
37 explicit ccMouseCircle(ccGLWindowInterface* owner, QString name = QString("MouseCircle"));
38
39 //deconstructor
40 ~ccMouseCircle() override;
41
42 //get the circle radius in px
43 inline int getRadiusPx() const { return m_radius; }
44
45 //sets whether scroll is allowed or not
46 inline void setAllowScroll(bool state) { m_allowScroll = state; }
47
48 protected:
49 //draws a circle of radius r around the mouse
50 void draw(CC_DRAW_CONTEXT& context) override;
51
52 private:
53 //event to get mouse-move updates & trigger repaint
54 bool eventFilter(QObject* obj, QEvent* event) override;
55
56 private:
57 //ccGLWindowInterface this overlay is attached to -> used to get mouse position & events
58 ccGLWindowInterface* m_owner;
59
60 float m_pixelSize;
61
62 int m_radius;
63 int m_radiusStep;
64 bool m_allowScroll;
65 };
66