Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+102
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* MouseMoveOverlay
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "mouse_move_overlay.h"
|
||||
|
||||
// Own
|
||||
#include <MapImpl/map_impl.h>
|
||||
|
||||
// ESRI
|
||||
#include <arcgis/Map.h>
|
||||
#include <arcgis/CoordinateConversion.h>
|
||||
#include <arcgis/GeometryEngine.h>
|
||||
|
||||
// Qt
|
||||
#include <QDebug>
|
||||
#include <QGraphicsSceneHoverEvent>
|
||||
|
||||
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
class MouseMoveOverlay::Private
|
||||
{
|
||||
public:
|
||||
Private() = default;
|
||||
~Private() = default;
|
||||
|
||||
// ESRI data:
|
||||
EsriRuntimeQt::Map *m_map = nullptr;
|
||||
|
||||
// OWN data:
|
||||
SituationMap::MapImpl *m_mapImpl = nullptr;
|
||||
|
||||
}; // class MouseMoveOverlay::Private
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
MouseMoveOverlay::MouseMoveOverlay(MapImpl *mapImpl)
|
||||
: QGraphicsItem()
|
||||
, d(new Private)
|
||||
{
|
||||
qDebug() << LOGFUNCTION;
|
||||
|
||||
// object to be called:
|
||||
d->m_mapImpl = mapImpl;
|
||||
|
||||
if (d->m_mapImpl)
|
||||
d->m_map = d->m_mapImpl->getEsriMap();
|
||||
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
MouseMoveOverlay::~MouseMoveOverlay()
|
||||
{
|
||||
qDebug() << LOGFUNCTION;
|
||||
delete d;
|
||||
}
|
||||
|
||||
QRectF MouseMoveOverlay::boundingRect() const
|
||||
{
|
||||
if (d->m_map)
|
||||
return QRect(0, 0, d->m_map->width(), d->m_map->height());
|
||||
return QRect(); // fallback
|
||||
}
|
||||
|
||||
void MouseMoveOverlay::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
// No need to paint
|
||||
Q_UNUSED(painter)
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
}
|
||||
|
||||
|
||||
void MouseMoveOverlay::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
// qDebug() << LOGFUNCTION;
|
||||
|
||||
if (d->m_map)
|
||||
{
|
||||
if (!d->m_map->isReady())
|
||||
return;
|
||||
|
||||
QPointF scenePoint = event->scenePos();
|
||||
int scenePointX = scenePoint.x();
|
||||
int scenePointY = scenePoint.y();
|
||||
if (scenePointX < 0 || scenePointY < 0)
|
||||
return;
|
||||
|
||||
d->m_mapImpl->onHandleMouseMove(scenePointX, scenePointY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace SituationMap
|
||||
Reference in new issue
Block a user