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

Compare commits

..

No commits in common. "71a757983fc6779d36efb607d3715d49d4948937" and "b9fb9eece30a73705f5bd5945753d66326676387" have entirely different histories.

3 changed files with 46 additions and 27 deletions

View File

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

View File

@ -26,6 +26,31 @@ 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);
@ -234,7 +259,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);
@ -304,7 +329,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++) {
@ -514,7 +539,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

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