This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
IndoorMap/mapview/2D/tools/Tool.h
kazu 076c0e9157 changed 3D rendering
added pan/zoom gesture
2018-02-04 17:02:14 +01:00

66 lines
1.7 KiB
C++

#ifndef TOOL_H
#define TOOL_H
#include <QKeyEvent>
#include <QMouseEvent>
#include <QObject>
#include "../../../fixC11.h"
#include "../Painter.h"
class QPinchGesture;
class QPanGesture;
class MapView2D;
/**
* interface for every MapView tool.
* a tool may be a background tool (e.g. a ruler-display, grid, ..)
* or a foreground (active) one, which e.g. selects nodes, creates a new element, ...
*/
class Tool : public QObject {
Q_OBJECT
public:
Tool() {;}
virtual ~Tool() {;}
/** the tool must return its name here */
virtual const std::string getName() const = 0;
/** the tool was activated (by user or by code) */
virtual void becomesActive() {;}
/** the tool was deactivated (by user or by code) */
virtual void becomesInactive() {;}
/** events: return TRUE when you consumed the event */
virtual bool mousePressEvent(MapView2D* m, QMouseEvent* e) { (void) m; (void) e; return false; }
virtual bool mouseMoveEvent(MapView2D* m, QMouseEvent* e) { (void) m; (void) e; return false; }
virtual bool mouseReleaseEvent(MapView2D* m, QMouseEvent* e) { (void) m; (void) e; return false; }
virtual bool wheelEvent(MapView2D* m, QWheelEvent* e) { (void) m; (void) e; return false; }
virtual bool keyPressEvent(MapView2D* m, QKeyEvent* e) { (void) m; (void) e; return false; }
virtual bool pinchTriggered(MapView2D* m, QPinchGesture* g) { (void) m; (void) g; return false; }
virtual bool panTriggered(MapView2D* m, QPanGesture* g) { (void) m; (void) g; return false; }
virtual void paintBefore(MapView2D* m, Painter& p) { (void) m; (void) p; }
virtual void paintAfter(MapView2D* m, Painter& p) { (void) m; (void) p; }
virtual void layerChange(MapView2D* m) { (void) m; }
signals:
void onHelpTextChange(QString str);
};
#endif // TOOL_H