mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-03-13 18:47:45 +01:00
Refactoring
This commit is contained in:
parent
39ed798a48
commit
fdd5d46c03
@ -263,11 +263,11 @@ 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*> &lights,
|
QList<TextItem*> &textItems, QList<TextItem*> &lightItems,
|
||||||
QMap<Coordinates, SectorLight> §orLights, bool overZoom) const
|
QMap<Coordinates, SectorLight> §orLights, bool overZoom) const
|
||||||
{
|
{
|
||||||
QMap<Coordinates, Style::Color> lightsMap;
|
QMap<Coordinates, Style::Color> lights;
|
||||||
QSet<Coordinates> signalsSet;
|
QSet<Coordinates> sigs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Lights & Signals */
|
/* Lights & Signals */
|
||||||
@ -285,9 +285,9 @@ void RasterTile::processPoints(const QList<Data::Point> &points,
|
|||||||
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()));
|
||||||
} else
|
} else
|
||||||
lightsMap.insert(point.pos(), color);
|
lights.insert(point.pos(), color);
|
||||||
} else if (point.type()>>16 == FOGSIG)
|
} else if (point.type()>>16 == FOGSIG)
|
||||||
signalsSet.insert(point.pos());
|
sigs.insert(point.pos());
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -317,11 +317,11 @@ void RasterTile::processPoints(const QList<Data::Point> &points,
|
|||||||
if (item->isValid() && (sectorLights.contains(point.pos())
|
if (item->isValid() && (sectorLights.contains(point.pos())
|
||||||
|| (point.polygon() && img) || !item->collides(textItems))) {
|
|| (point.polygon() && img) || !item->collides(textItems))) {
|
||||||
textItems.append(item);
|
textItems.append(item);
|
||||||
if (lightsMap.contains(point.pos()))
|
if (lights.contains(point.pos()))
|
||||||
lights.append(new TextPointItem(pos + _style->lightOffset(),
|
lightItems.append(new TextPointItem(pos + _style->lightOffset(),
|
||||||
0, 0, _style->light(lightsMap.value(point.pos())), 0, 0, 0, 0));
|
0, 0, _style->light(lights.value(point.pos())), 0, 0, 0, 0));
|
||||||
if (signalsSet.contains(point.pos()))
|
if (sigs.contains(point.pos()))
|
||||||
lights.append(new TextPointItem(pos + _style->signalOffset(),
|
lightItems.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 +355,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, lights;
|
QList<TextItem*> textItems, lightItems;
|
||||||
QMap<Coordinates, SectorLight> sectorLights;
|
QMap<Coordinates, SectorLight> sectorLights;
|
||||||
const Level &l = levels.at(i);
|
const Level &l = levels.at(i);
|
||||||
|
|
||||||
processPoints(l.points, textItems, lights, sectorLights, l.overZoom);
|
processPoints(l.points, textItems, lightItems, 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, lights);
|
drawTextItems(painter, lightItems);
|
||||||
drawSectorLights(painter, sectorLights);
|
drawSectorLights(painter, sectorLights);
|
||||||
drawTextItems(painter, textItems);
|
drawTextItems(painter, textItems);
|
||||||
|
|
||||||
qDeleteAll(textItems);
|
qDeleteAll(textItems);
|
||||||
qDeleteAll(lights);
|
qDeleteAll(lightItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ 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 *> &lights,
|
QList<TextItem*> &textItems, QList<TextItem*> &lightItems,
|
||||||
QMap<Coordinates, SectorLight> §orLights, bool overZoom) const;
|
QMap<Coordinates, 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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user