2025-02-07 09:16:22 +00:00
|
|
|
|
#include <QtCore/QEvent>
|
|
|
|
|
|
2025-02-09 18:16:07 +00:00
|
|
|
|
#include <maptoolpan.h>
|
|
|
|
|
#include <mapcanvas.h>
|
2025-02-07 09:16:22 +00:00
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
|
|
|
|
|
namespace LAMPMainWidget {
|
|
|
|
|
|
2025-04-01 10:23:24 +00:00
|
|
|
|
void
|
|
|
|
|
MapToolPan::execute(QMouseEvent* event) {
|
|
|
|
|
if (!(event->button() & Qt::LeftButton)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto type = event->type();
|
|
|
|
|
if (QEvent::MouseButtonPress == type) {
|
|
|
|
|
mDragStartPos = event->pos();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (QEvent::MouseButtonRelease == type) {
|
|
|
|
|
mDragEndPos = event->pos();
|
|
|
|
|
QRectF dragRect{ mDragStartPos, mDragEndPos };
|
|
|
|
|
mMapCanvas->mDragRect = dragRect;
|
|
|
|
|
mMapCanvas->updateViewExtent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
MapToolPan::setup() {
|
|
|
|
|
mMapCanvas->setDragMode(MapCanvas::DragMode::ScrollHandDrag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
|
MapToolPan::id() {
|
|
|
|
|
return QString{ "pan_tool" };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
MapToolPan::deSetup() {
|
|
|
|
|
mMapCanvas->setDragMode(MapCanvas::DragMode::NoDrag);
|
|
|
|
|
}
|
2025-02-07 09:16:22 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|