#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());
}
