1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-19 19:59:11 +02:00

Compare commits

..

4 Commits

Author SHA1 Message Date
71a757983f Some more obsolete stuff cleanup 2025-02-20 08:57:50 +01:00
cc7209ad70 Removed obsolete stuff 2025-02-20 08:53:04 +01:00
ba49497608 Code cleanup 2025-02-20 08:50:17 +01:00
48404ea43b Limit the sector lights ranges 2025-02-20 07:34:47 +01:00
3 changed files with 27 additions and 46 deletions

View File

@ -216,8 +216,8 @@ void RasterTile::drawTextItems(QPainter *painter,
static QRectF lightRect(const QPointF &pos, double range)
{
return QRectF(pos.x() - range * RANGE_FACTOR, pos.y() - range * RANGE_FACTOR,
2*range * RANGE_FACTOR, 2*range * RANGE_FACTOR);
double r = qMin(range * RANGE_FACTOR, (double)TEXT_EXTENT);
return QRect(pos.x() - r, pos.y() - r, 2 * r, 2 * r);
}
void RasterTile::drawSectorLights(QPainter *painter,

View File

@ -26,31 +26,6 @@ using namespace IMG;
#define AREA(rect) \
(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 haloColor(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,
const QList<const MapData::Point *> &lights) const
const QList<const MapData::Point*> &lights) const
{
for (int i = 0; i < lights.size(); 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)
{
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,
QList<TextItem*> &textItems, QList<TextItem *> &lights,
QList<TextItem*> &textItems, QList<TextItem*> &lights,
QList<const MapData::Point*> &sectorLights)
{
std::sort(points.begin(), points.end());

View File

@ -9,7 +9,6 @@
#include "style.h"
class QPainter;
class IMGMap;
class TextItem;
namespace IMG {
@ -32,23 +31,30 @@ public:
void render();
private:
typedef RTree<const MapData::Elevation*, double, 2> DEMTRee;
struct ElevationCTX
struct Sector
{
ElevationCTX(const DEMTRee &tree, const Coordinates &c, double &ele)
: tree(tree), c(c), ele(ele) {}
Sector(Light::Color color, quint32 start, quint32 end)
: color(color), start(start), end(end) {}
const DEMTRee &tree;
const Coordinates &c;
double &ele;
};
struct EdgeCTX
bool operator==(const Sector &other) const
{
EdgeCTX(const Coordinates &c, double &ele) : c(c), ele(ele) {}
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;
}
const Coordinates &c;
double &ele;
Light::Color color;
quint32 start;
quint32 end;
};
void fetchData(QList<MapData::Poly> &polygons, QList<MapData::Poly> &lines,
@ -70,7 +76,7 @@ private:
const QList<const MapData::Point*> &lights) const;
void processPolygons(const QList<MapData::Poly> &polygons,
QList<TextItem *> &textItems);
QList<TextItem*> &textItems);
void processLines(QList<MapData::Poly> &lines, QList<TextItem*> &textItems,
const QImage (&arrows)[2]);
void processPoints(QList<MapData::Point> &points,