From d9c0770b5150557823d826fdb4ed660eb973898e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 6 May 2023 21:53:40 +0200 Subject: [PATCH] Code cleanup --- src/map/map.cpp | 24 ++++++++---------------- src/map/map.h | 5 ----- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/map/map.cpp b/src/map/map.cpp index 405bed7d..fcbfc37b 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -5,34 +5,26 @@ #define SAMPLES 100 -void Map::growLeft(const QPointF &p, RectC &rect) +static void growLeft(const Coordinates &c, RectC &rect) { - Coordinates c(xy2ll(p)); - if (c.lon() < rect.left()) rect.setLeft(c.lon()); } -void Map::growRight(const QPointF &p, RectC &rect) +static void growRight(const Coordinates &c, RectC &rect) { - Coordinates c(xy2ll(p)); - if (c.lon() > rect.right()) rect.setRight(c.lon()); } -void Map::growTop(const QPointF &p, RectC &rect) +static void growTop(const Coordinates &c, RectC &rect) { - Coordinates c(xy2ll(p)); - if (c.lat() > rect.top()) rect.setTop(c.lat()); } -void Map::growBottom(const QPointF &p, RectC &rect) +static void growBottom(const Coordinates &c, RectC &rect) { - Coordinates c(xy2ll(p)); - if (c.lat() < rect.bottom()) rect.setBottom(c.lat()); } @@ -53,14 +45,14 @@ RectC Map::llBounds(const Projection &proj) for (int i = 0; i <= SAMPLES; i++) { double x = b.left() + i * dx; - growBottom(QPointF(x, b.bottom()), rect); - growTop(QPointF(x, b.top()), rect); + growBottom(xy2ll(QPointF(x, b.bottom())), rect); + growTop(xy2ll(QPointF(x, b.top())), rect); } for (int i = 0; i <= SAMPLES; i++) { double y = b.top() + i * dy; - growLeft(QPointF(b.left(), y), rect); - growRight(QPointF(b.right(), y), rect); + growLeft(xy2ll(QPointF(b.left(), y)), rect); + growRight(xy2ll(QPointF(b.right(), y)), rect); } return rect; diff --git a/src/map/map.h b/src/map/map.h index 1d1d7067..30a99be6 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -62,11 +62,6 @@ signals: void mapLoaded(); private: - void growLeft(const QPointF &p, RectC &rect); - void growRight(const QPointF &p, RectC &rect); - void growTop(const QPointF &p, RectC &rect); - void growBottom(const QPointF &p, RectC &rect); - QString _path; };