From 2eacbfbfc15ed8806d8e0dea290126fd38b5f60b Mon Sep 17 00:00:00 2001 From: peri4 Date: Sat, 31 Aug 2024 22:19:26 +0300 Subject: [PATCH] MapItemEllipse fix --- libs/map/mapitemellipse.cpp | 3 ++- utils/mapviewer/mainwindow.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libs/map/mapitemellipse.cpp b/libs/map/mapitemellipse.cpp index 2fd2b35..0883f7a 100644 --- a/libs/map/mapitemellipse.cpp +++ b/libs/map/mapitemellipse.cpp @@ -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); diff --git a/utils/mapviewer/mainwindow.cpp b/utils/mapviewer/mainwindow.cpp index c835c25..12b4983 100644 --- a/utils/mapviewer/mainwindow.cpp +++ b/utils/mapviewer/mainwindow.cpp @@ -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); + }*/ }