MapItemBase visible API

MapItemEllipse::rebuild fix
This commit is contained in:
2024-07-10 12:55:42 +03:00
parent 5bc7d7cf06
commit 083dc3edf5
3 changed files with 13 additions and 8 deletions

View File

@@ -57,19 +57,20 @@ void MapItemEllipse::draw(QPainter * p) {
void MapItemEllipse::rebuild() {
pol.clear();
QPointF c = rct.center();
bool full = sa == ea;
QPointF c = rct.center();
double starta = sa, enda = ea;
bool full = qFuzzyCompare(starta, enda);
if (!full) pol << c;
double w = rct.width() / 2., h = rct.height() / 2.;
static double deg2rad = M_PI / 180.;
if (full) {
sa = 0.;
ea = 360.;
starta = 0.;
enda = 360.;
} else {
if (ea < sa) qSwap(sa, ea);
if (enda < starta) qSwap(starta, enda);
}
for (double a = sa; a <= ea; a += 3.) {
if (a > ea) a = ea;
for (double a = starta; a <= enda; a += 3.) {
if (a > enda) a = enda;
QPointF p(sin(a * deg2rad) * w, cos(a * deg2rad) * h);
pol << (c + p);
}