MapItemEllipse fix

This commit is contained in:
2024-08-31 22:19:26 +03:00
parent ab423e1530
commit 2eacbfbfc1
2 changed files with 15 additions and 2 deletions

View File

@@ -69,7 +69,8 @@ void MapItemEllipse::rebuild() {
} else {
if (enda < starta) qSwap(starta, enda);
}
for (double a = starta; a <= enda; a += 3.) {
const double astep = 3.;
for (double a = starta; a < enda + astep; a += astep) {
if (a > enda) a = enda;
QPointF p(sin(a * deg2rad) * w, cos(a * deg2rad) * h);
pol << (c + p);

View File

@@ -70,7 +70,19 @@ MainWindow::MainWindow(QWidget * parent): EMainWindow(parent), Ui::MainWindow()
map->addItem(ell);
map->centerTo({55.583055, 37.580008});
map->zoomTo(2);
*/
for (int i = 1; i <= 8; ++i) {
double a = i * 0.5;
auto * ei = new MapItemEllipse();
ei->setStartAngle(-a);
ei->setEndAngle(a);
ei->setEllipse(QRectF(-100, -100, 200, 200));
ei->setUnits(MapItemNonGeoGeometryBase::Meters);
ei->setPosition(55.5858, 37.5782 + i / 1000.);
ei->setBrush(QColor(0, 0, 255, 64));
ei->setPen({Qt::blue});
map->addItem(ei);
}*/
}