1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-07 20:15:13 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2023-05-06 21:53:40 +02:00
parent ca6c7247c0
commit d9c0770b51
2 changed files with 8 additions and 21 deletions

View File

@ -5,34 +5,26 @@
#define SAMPLES 100 #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()) if (c.lon() < rect.left())
rect.setLeft(c.lon()); 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()) if (c.lon() > rect.right())
rect.setRight(c.lon()); 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()) if (c.lat() > rect.top())
rect.setTop(c.lat()); 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()) if (c.lat() < rect.bottom())
rect.setBottom(c.lat()); rect.setBottom(c.lat());
} }
@ -53,14 +45,14 @@ RectC Map::llBounds(const Projection &proj)
for (int i = 0; i <= SAMPLES; i++) { for (int i = 0; i <= SAMPLES; i++) {
double x = b.left() + i * dx; double x = b.left() + i * dx;
growBottom(QPointF(x, b.bottom()), rect); growBottom(xy2ll(QPointF(x, b.bottom())), rect);
growTop(QPointF(x, b.top()), rect); growTop(xy2ll(QPointF(x, b.top())), rect);
} }
for (int i = 0; i <= SAMPLES; i++) { for (int i = 0; i <= SAMPLES; i++) {
double y = b.top() + i * dy; double y = b.top() + i * dy;
growLeft(QPointF(b.left(), y), rect); growLeft(xy2ll(QPointF(b.left(), y)), rect);
growRight(QPointF(b.right(), y), rect); growRight(xy2ll(QPointF(b.right(), y)), rect);
} }
return rect; return rect;

View File

@ -62,11 +62,6 @@ signals:
void mapLoaded(); void mapLoaded();
private: 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; QString _path;
}; };