ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccMouseCircle.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
14 #include <ecv2DViewportObject.h>
15 #include <qevent.h>
16 
17 #include <QObject>
18 #include <QPoint>
19 
20 #include "ecvStdPluginInterface.h"
21 
22 class ccMouseCircle : public cc2DViewportObject, public QObject {
23 public:
24  // constructor
25  explicit ccMouseCircle(QWidget* owner,
26  QString name = QString("MouseCircle"));
27 
28  // deconstructor
29  virtual ~ccMouseCircle() override;
30 
31  // get the circle radius in px
32  int getRadiusPx();
33 
34  // get the circle radius in world coordinates
35  float getRadiusWorld();
36 
37  // removes the link with the owner (no cleanup)
38  void ownerIsDead() { m_owner = nullptr; }
39 
40 protected:
41  // draws a circle of radius r around the mouse
42  void draw(CC_DRAW_CONTEXT& context) override;
43 
44 private:
45  // QWidget this overlay is attached to -> used to get mouse position &
46  // events
47  QWidget* m_owner;
48  float m_winTotalZoom;
49 
50  // event to get mouse-move updates & trigger repaint
51  bool eventFilter(QObject* obj, QEvent* event) override;
52 
53 public:
54  static const int RESOLUTION = 100;
55  int RADIUS = 50;
56  int RADIUS_STEP = 4;
58 };
MouseEvent event
std::string name
2D viewport object
void ownerIsDead()
Definition: ccMouseCircle.h:38
float UNIT_CIRCLE[RESOLUTION][2]
Definition: ccMouseCircle.h:57
void draw(CC_DRAW_CONTEXT &context) override
Draws entity and its children.
ccMouseCircle(ecvMainAppInterface *appInterface, QWidget *owner, QString name=QString("MouseCircle"))
static const int RESOLUTION
Definition: ccMouseCircle.h:54
float getRadiusWorld()
int getRadiusPx() const
Definition: ccMouseCircle.h:35
virtual ~ccMouseCircle() override
ImGuiContext * context
Definition: Window.cpp:76
Display context.