Files
gcs-nf/opmap/mapwidget/geoFenceitem.cpp
T

53 lines
1.1 KiB
C++
Raw Normal View History

2022-05-10 21:38:23 +08:00
#include "geoFenceitem.h"
#include <QDateTime>
namespace mapcontrol {
geoFenceitem::geoFenceitem(int index, internals::PointLatLng const & coord, int const & altitude, QBrush color, MapGraphicItem *map) : QGraphicsItem(map), number(index) , coord(coord), m_brush(color), m_map(map)
{
//qDebug() << "geoFenceitem:" << index << coord.Lat() << coord.Lng();
this->setZValue(3);
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
//qDebug() << this->pos();
RefreshPos();
}
void geoFenceitem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
painter->setBrush(m_brush);
painter->drawPoint(0,0);
}
QRectF geoFenceitem::boundingRect() const
{
return QRectF(-2, -2, 4, 4);
}
int geoFenceitem::type() const
{
return Type;
}
void geoFenceitem::setPosSLOT()
{
//qDebug() << "virtual set pos";
setPos(m_map->FromLatLngToLocal(this->coord).X(), m_map->FromLatLngToLocal(this->coord).Y());
emit localPositionChanged(this->pos(),this);
}
void geoFenceitem::RefreshPos()
{
setPosSLOT();
}
}