version 2.13.0
add Map library (MapView with OSM maps and items) and mapviewer util
This commit is contained in:
24
libs/map/mapitempolygon.cpp
Normal file
24
libs/map/mapitempolygon.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "mapitempolygon.h"
|
||||
|
||||
|
||||
MapItemPolygon::MapItemPolygon(const QPolygonF & p) {
|
||||
setPolygon(p);
|
||||
}
|
||||
|
||||
|
||||
void MapItemPolygon::setPolygon(const QPolygonF & p) {
|
||||
pol = p;
|
||||
updateParent();
|
||||
}
|
||||
|
||||
|
||||
void MapItemPolygon::draw(QPainter * p) {
|
||||
p->setPen(pen());
|
||||
p->setBrush(brush());
|
||||
QPolygonF dp(pol);
|
||||
double us = unitScale();
|
||||
for (auto & i: dp)
|
||||
i = QPointF(i.x(), -i.y()) / us;
|
||||
p->drawPolygon(dp);
|
||||
setBoundingRect(dp.boundingRect());
|
||||
}
|
||||
Reference in New Issue
Block a user