1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-22 10:20:47 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2025-02-20 08:50:17 +01:00
parent 48404ea43b
commit ba49497608
2 changed files with 30 additions and 29 deletions

View File

@ -26,31 +26,6 @@ using namespace IMG;
#define AREA(rect) \ #define AREA(rect) \
(rect.size().width() * rect.size().height()) (rect.size().width() * rect.size().height())
struct Sector
{
Sector(Light::Color color, quint32 start, quint32 end)
: color(color), start(start), end(end) {}
bool operator==(const Sector &other) const
{
return (color == other.color && start == other.start && end == other.end);
}
bool operator<(const Sector &other) const
{
if (color == other.color) {
if (start == other.start)
return end < other.end;
else
return start < other.start;
} else
return color < other.color;
}
Light::Color color;
quint32 start;
quint32 end;
};
static const QColor textColor(Qt::black); static const QColor textColor(Qt::black);
static const QColor haloColor(Qt::white); static const QColor haloColor(Qt::white);
static const QColor shieldColor(Qt::white); static const QColor shieldColor(Qt::white);
@ -259,7 +234,7 @@ static QRect lightRect(const QPoint &pos, quint32 range)
} }
void RasterTile::drawSectorLights(QPainter *painter, void RasterTile::drawSectorLights(QPainter *painter,
const QList<const MapData::Point *> &lights) const const QList<const MapData::Point*> &lights) const
{ {
for (int i = 0; i < lights.size(); i++) { for (int i = 0; i < lights.size(); i++) {
const MapData::Point *p = lights.at(i); const MapData::Point *p = lights.at(i);
@ -329,7 +304,7 @@ void RasterTile::drawSectorLights(QPainter *painter,
} }
} }
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text, static void removeDuplicitLabel(QList<TextItem*> &labels, const QString &text,
const QRectF &tileRect) const QRectF &tileRect)
{ {
for (int i = 0; i < labels.size(); i++) { for (int i = 0; i < labels.size(); i++) {
@ -539,7 +514,7 @@ static Light::Color ordinaryLight(const QVector<Light> &lights)
} }
void RasterTile::processPoints(QList<MapData::Point> &points, void RasterTile::processPoints(QList<MapData::Point> &points,
QList<TextItem*> &textItems, QList<TextItem *> &lights, QList<TextItem*> &textItems, QList<TextItem*> &lights,
QList<const MapData::Point*> &sectorLights) QList<const MapData::Point*> &sectorLights)
{ {
std::sort(points.begin(), points.end()); std::sort(points.begin(), points.end());

View File

@ -51,6 +51,32 @@ private:
double &ele; double &ele;
}; };
struct Sector
{
Sector(Light::Color color, quint32 start, quint32 end)
: color(color), start(start), end(end) {}
bool operator==(const Sector &other) const
{
return (color == other.color && start == other.start
&& end == other.end);
}
bool operator<(const Sector &other) const
{
if (color == other.color) {
if (start == other.start)
return end < other.end;
else
return start < other.start;
} else
return color < other.color;
}
Light::Color color;
quint32 start;
quint32 end;
};
void fetchData(QList<MapData::Poly> &polygons, QList<MapData::Poly> &lines, void fetchData(QList<MapData::Poly> &polygons, QList<MapData::Poly> &lines,
QList<MapData::Point> &points); QList<MapData::Point> &points);
QPointF ll2xy(const Coordinates &c) const QPointF ll2xy(const Coordinates &c) const
@ -70,7 +96,7 @@ private:
const QList<const MapData::Point*> &lights) const; const QList<const MapData::Point*> &lights) const;
void processPolygons(const QList<MapData::Poly> &polygons, void processPolygons(const QList<MapData::Poly> &polygons,
QList<TextItem *> &textItems); QList<TextItem*> &textItems);
void processLines(QList<MapData::Poly> &lines, QList<TextItem*> &textItems, void processLines(QList<MapData::Poly> &lines, QList<TextItem*> &textItems,
const QImage (&arrows)[2]); const QImage (&arrows)[2]);
void processPoints(QList<MapData::Point> &points, void processPoints(QList<MapData::Point> &points,