1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2022-11-05 14:08:08 +01:00
parent fdd3613c4a
commit 3385fc86d3

View File

@ -33,6 +33,14 @@ static void warning(const ISO8211::Field &FRID, uint PRIM)
} }
} }
static void pointBounds(const Coordinates &c, double min[2], double max[2])
{
min[0] = c.lon();
min[1] = c.lat();
max[0] = c.lon();
max[1] = c.lat();
}
static void rectcBounds(const RectC &rect, double min[2], double max[2]) static void rectcBounds(const RectC &rect, double min[2], double max[2])
{ {
min[0] = rect.left(); min[0] = rect.left();
@ -598,18 +606,12 @@ void MapData::load()
QVector<Sounding> s(soundingGeometry(r)); QVector<Sounding> s(soundingGeometry(r));
for (int i = 0; i < s.size(); i++) { for (int i = 0; i < s.size(); i++) {
point = pointObject(s.at(i)); point = pointObject(s.at(i));
min[0] = point->pos().lon(); pointBounds(point->pos(), min, max);
min[1] = point->pos().lat();
max[0] = point->pos().lon();
max[1] = point->pos().lat();
_points.Insert(min, max, point); _points.Insert(min, max, point);
} }
} else { } else {
if ((point = pointObject(r, OBJL))) { if ((point = pointObject(r, OBJL))) {
min[0] = point->pos().lon(); pointBounds(point->pos(), min, max);
min[1] = point->pos().lat();
max[0] = point->pos().lon();
max[1] = point->pos().lat();
_points.Insert(min, max, point); _points.Insert(min, max, point);
} else } else
warning(f, PRIM); warning(f, PRIM);
@ -655,11 +657,7 @@ void MapData::points(const RectC &rect, QList<Point*> *points)
{ {
double min[2], max[2]; double min[2], max[2];
min[0] = rect.left(); rectcBounds(rect, min, max);
min[1] = rect.bottom();
max[0] = rect.right();
max[1] = rect.top();
_points.Search(min, max, pointCb, points); _points.Search(min, max, pointCb, points);
} }
@ -667,11 +665,7 @@ void MapData::lines(const RectC &rect, QList<Line*> *lines)
{ {
double min[2], max[2]; double min[2], max[2];
min[0] = rect.left(); rectcBounds(rect, min, max);
min[1] = rect.bottom();
max[0] = rect.right();
max[1] = rect.top();
_lines.Search(min, max, lineCb, lines); _lines.Search(min, max, lineCb, lines);
} }
@ -679,10 +673,6 @@ void MapData::polygons(const RectC &rect, QList<Poly*> *polygons)
{ {
double min[2], max[2]; double min[2], max[2];
min[0] = rect.left(); rectcBounds(rect, min, max);
min[1] = rect.bottom();
max[0] = rect.right();
max[1] = rect.top();
_areas.Search(min, max, polygonCb, polygons); _areas.Search(min, max, polygonCb, polygons);
} }