mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-20 04:09:11 +02:00
Compare commits
No commits in common. "a9572d05fe1717b242bd608f7563e09742a591d8" and "db6e891c30e3fe4d96e6a10400d1e7a273c7731c" have entirely different histories.
a9572d05fe
...
db6e891c30
@ -226,11 +226,11 @@ static QRectF lightRect(const QPointF &pos, double range)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::drawSectorLights(QPainter *painter,
|
void RasterTile::drawSectorLights(QPainter *painter,
|
||||||
const QMultiMap<Coordinates, SectorLight> &lights) const
|
const QList<SectorLight> &lights) const
|
||||||
{
|
{
|
||||||
for (auto it = lights.cbegin(); it != lights.cend(); ++it) {
|
for (int i = 0; i < lights.size(); i++) {
|
||||||
const SectorLight &l = it.value();
|
const SectorLight &l = lights.at(i);
|
||||||
QPointF pos(ll2xy(it.key()));
|
QPointF pos(ll2xy(l.pos));
|
||||||
QRectF rect(lightRect(pos, (l.range == 0) ? 6 : l.range));
|
QRectF rect(lightRect(pos, (l.range == 0) ? 6 : l.range));
|
||||||
double a1 = -(l.end + 90);
|
double a1 = -(l.end + 90);
|
||||||
double a2 = -(l.start + 90);
|
double a2 = -(l.start + 90);
|
||||||
@ -263,11 +263,12 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::processPoints(const QList<Data::Point> &points,
|
void RasterTile::processPoints(const QList<Data::Point> &points,
|
||||||
QList<TextItem*> &textItems, QList<TextItem*> &lightItems,
|
QList<TextItem*> &textItems, QList<TextItem*> &lights,
|
||||||
QMultiMap<Coordinates, SectorLight> §orLights, bool overZoom) const
|
QList<SectorLight> §orLights, bool overZoom) const
|
||||||
{
|
{
|
||||||
QMap<Coordinates, Style::Color> lights;
|
LightMap lightsMap;
|
||||||
QSet<Coordinates> sigs;
|
SignalSet signalsSet;
|
||||||
|
QSet<Coordinates> slMap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Lights & Signals */
|
/* Lights & Signals */
|
||||||
@ -281,13 +282,14 @@ void RasterTile::processPoints(const QList<Data::Point> &points,
|
|||||||
|
|
||||||
if (attr.contains(SECTR1)
|
if (attr.contains(SECTR1)
|
||||||
|| (range >= MAJOR_RANGE && !(point.type() & 0xFFFF))) {
|
|| (range >= MAJOR_RANGE && !(point.type() & 0xFFFF))) {
|
||||||
sectorLights.insert(point.pos(), SectorLight(color,
|
sectorLights.append(SectorLight(point.pos(), color,
|
||||||
attr.value(LITVIS).toUInt(), range,
|
attr.value(LITVIS).toUInt(), range,
|
||||||
attr.value(SECTR1).toDouble(), attr.value(SECTR2).toDouble()));
|
attr.value(SECTR1).toDouble(), attr.value(SECTR2).toDouble()));
|
||||||
|
slMap.insert(point.pos());
|
||||||
} else
|
} else
|
||||||
lights.insert(point.pos(), color);
|
lightsMap.insert(point.pos(), color);
|
||||||
} else if (point.type()>>16 == FOGSIG)
|
} else if (point.type()>>16 == FOGSIG)
|
||||||
sigs.insert(point.pos());
|
signalsSet.insert(point.pos());
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -314,14 +316,14 @@ void RasterTile::processPoints(const QList<Data::Point> &points,
|
|||||||
|
|
||||||
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
||||||
color, hColor, 0, 2, rotate);
|
color, hColor, 0, 2, rotate);
|
||||||
if (item->isValid() && (sectorLights.contains(point.pos())
|
if (item->isValid() && (slMap.contains(point.pos())
|
||||||
|| (point.polygon() && img) || !item->collides(textItems))) {
|
|| (point.polygon() && img) || !item->collides(textItems))) {
|
||||||
textItems.append(item);
|
textItems.append(item);
|
||||||
if (lights.contains(point.pos()))
|
if (lightsMap.contains(point.pos()))
|
||||||
lightItems.append(new TextPointItem(pos + _style->lightOffset(),
|
lights.append(new TextPointItem(pos + _style->lightOffset(),
|
||||||
0, 0, _style->light(lights.value(point.pos())), 0, 0, 0, 0));
|
0, 0, _style->light(lightsMap.value(point.pos())), 0, 0, 0, 0));
|
||||||
if (sigs.contains(point.pos()))
|
if (signalsSet.contains(point.pos()))
|
||||||
lightItems.append(new TextPointItem(pos + _style->signalOffset(),
|
lights.append(new TextPointItem(pos + _style->signalOffset(),
|
||||||
0, 0, _style->signal(), 0, 0, 0, 0));
|
0, 0, _style->signal(), 0, 0, 0, 0));
|
||||||
} else
|
} else
|
||||||
delete item;
|
delete item;
|
||||||
@ -355,23 +357,23 @@ void RasterTile::processLines(const QList<Data::Line> &lines,
|
|||||||
void RasterTile::drawLevels(QPainter *painter, const QList<Level> &levels)
|
void RasterTile::drawLevels(QPainter *painter, const QList<Level> &levels)
|
||||||
{
|
{
|
||||||
for (int i = levels.size() - 1; i >= 0; i--) {
|
for (int i = levels.size() - 1; i >= 0; i--) {
|
||||||
QList<TextItem*> textItems, lightItems;
|
QList<TextItem*> textItems, lights;
|
||||||
QMultiMap<Coordinates, SectorLight> sectorLights;
|
QList<SectorLight> sectorLights;
|
||||||
const Level &l = levels.at(i);
|
const Level &l = levels.at(i);
|
||||||
|
|
||||||
processPoints(l.points, textItems, lightItems, sectorLights, l.overZoom);
|
processPoints(l.points, textItems, lights, sectorLights, l.overZoom);
|
||||||
processLines(l.lines, textItems);
|
processLines(l.lines, textItems);
|
||||||
|
|
||||||
drawPolygons(painter, l.polygons);
|
drawPolygons(painter, l.polygons);
|
||||||
drawLines(painter, l.lines);
|
drawLines(painter, l.lines);
|
||||||
drawArrows(painter, l.points);
|
drawArrows(painter, l.points);
|
||||||
|
|
||||||
drawTextItems(painter, lightItems);
|
drawTextItems(painter, lights);
|
||||||
drawSectorLights(painter, sectorLights);
|
drawSectorLights(painter, sectorLights);
|
||||||
drawTextItems(painter, textItems);
|
drawTextItems(painter, textItems);
|
||||||
|
|
||||||
qDeleteAll(textItems);
|
qDeleteAll(textItems);
|
||||||
qDeleteAll(lightItems);
|
qDeleteAll(lights);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +418,7 @@ QList<RasterTile::Level> RasterTile::fetchLevels()
|
|||||||
if (!level.isNull())
|
if (!level.isNull())
|
||||||
list.append(level);
|
list.append(level);
|
||||||
|
|
||||||
if (_data.size() > 1 && shape(level.polygons).contains(_rect))
|
if (_data.size() > 0 && shape(level.polygons).contains(_rect))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +39,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
struct SectorLight
|
struct SectorLight
|
||||||
{
|
{
|
||||||
SectorLight(Style::Color color, uint visibility, double range,
|
SectorLight(const Coordinates &pos, Style::Color color, uint visibility,
|
||||||
double start, double end) : color(color), visibility(visibility),
|
double range, double start, double end) : pos(pos), color(color),
|
||||||
range(range), start(start), end(end) {}
|
visibility(visibility), range(range), start(start), end(end) {}
|
||||||
|
|
||||||
|
Coordinates pos;
|
||||||
Style::Color color;
|
Style::Color color;
|
||||||
uint visibility;
|
uint visibility;
|
||||||
double range;
|
double range;
|
||||||
@ -60,6 +61,9 @@ private:
|
|||||||
{return lines.isEmpty() && polygons.isEmpty() && points.isEmpty();}
|
{return lines.isEmpty() && polygons.isEmpty() && points.isEmpty();}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef QMap<Coordinates, Style::Color> LightMap;
|
||||||
|
typedef QSet<Coordinates> SignalSet;
|
||||||
|
|
||||||
QPointF ll2xy(const Coordinates &c) const
|
QPointF ll2xy(const Coordinates &c) const
|
||||||
{return _transform.proj2img(_proj.ll2xy(c));}
|
{return _transform.proj2img(_proj.ll2xy(c));}
|
||||||
QPainterPath painterPath(const Polygon &polygon) const;
|
QPainterPath painterPath(const Polygon &polygon) const;
|
||||||
@ -68,16 +72,15 @@ private:
|
|||||||
QPolygonF tsslptArrow(const QPointF &p, qreal angle) const;
|
QPolygonF tsslptArrow(const QPointF &p, qreal angle) const;
|
||||||
QPointF centroid(const QVector<Coordinates> &polygon) const;
|
QPointF centroid(const QVector<Coordinates> &polygon) const;
|
||||||
void processPoints(const QList<Data::Point> &points,
|
void processPoints(const QList<Data::Point> &points,
|
||||||
QList<TextItem*> &textItems, QList<TextItem*> &lightItems,
|
QList<TextItem*> &textItems, QList<TextItem *> &lights,
|
||||||
QMultiMap<Coordinates, SectorLight> §orLights, bool overZoom) const;
|
QList<SectorLight> §orLights, bool overZoom) const;
|
||||||
void processLines(const QList<Data::Line> &lines,
|
void processLines(const QList<Data::Line> &lines,
|
||||||
QList<TextItem*> &textItems) const;
|
QList<TextItem*> &textItems) const;
|
||||||
void drawArrows(QPainter *painter, const QList<Data::Point> &points) const;
|
void drawArrows(QPainter *painter, const QList<Data::Point> &points) const;
|
||||||
void drawPolygons(QPainter *painter, const QList<Data::Poly> &polygons) const;
|
void drawPolygons(QPainter *painter, const QList<Data::Poly> &polygons) const;
|
||||||
void drawLines(QPainter *painter, const QList<Data::Line> &lines) const;
|
void drawLines(QPainter *painter, const QList<Data::Line> &lines) const;
|
||||||
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems) const;
|
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems) const;
|
||||||
void drawSectorLights(QPainter *painter,
|
void drawSectorLights(QPainter *painter, const QList<SectorLight> &lights) const;
|
||||||
const QMultiMap<Coordinates, SectorLight> &lights) const;
|
|
||||||
bool showLabel(const QImage *img, int type) const;
|
bool showLabel(const QImage *img, int type) const;
|
||||||
void drawLevels(QPainter *painter, const QList<Level> &levels);
|
void drawLevels(QPainter *painter, const QList<Level> &levels);
|
||||||
QList<Level> fetchLevels();
|
QList<Level> fetchLevels();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user