1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 09:05:14 +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
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;

View File

@ -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;
};