mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-07 12:05:14 +01:00
Code cleanup
This commit is contained in:
parent
ecda5103c8
commit
1746eddb8d
@ -100,7 +100,7 @@ static QPainterPath parallelPath(const QPainterPath &p, double dy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::processPointLabels(const QList<MapData::Point> &points,
|
void RasterTile::processPointLabels(const QList<MapData::Point> &points,
|
||||||
QList<TextItem*> &textItems)
|
QList<TextItem*> &textItems) const
|
||||||
{
|
{
|
||||||
QList<const Style::TextRender*> labels(_style->pointLabels(_zoom));
|
QList<const Style::TextRender*> labels(_style->pointLabels(_zoom));
|
||||||
QList<const Style::Symbol*> symbols(_style->pointSymbols(_zoom));
|
QList<const Style::Symbol*> symbols(_style->pointSymbols(_zoom));
|
||||||
@ -152,14 +152,14 @@ void RasterTile::processPointLabels(const QList<MapData::Point> &points,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::processAreaLabels(QList<TextItem*> &textItems,
|
void RasterTile::processAreaLabels(const QVector<PainterPath> &paths,
|
||||||
QVector<PainterPath> &paths)
|
QList<TextItem*> &textItems) const
|
||||||
{
|
{
|
||||||
QList<const Style::TextRender*> labels(_style->areaLabels(_zoom));
|
QList<const Style::TextRender*> labels(_style->areaLabels(_zoom));
|
||||||
QList<const Style::Symbol*> symbols(_style->areaSymbols(_zoom));
|
QList<const Style::Symbol*> symbols(_style->areaSymbols(_zoom));
|
||||||
|
|
||||||
for (int i = 0; i < paths.size(); i++) {
|
for (int i = 0; i < paths.size(); i++) {
|
||||||
PainterPath &path = paths[i];
|
const PainterPath &path = paths.at(i);
|
||||||
const Style::TextRender *ti = 0;
|
const Style::TextRender *ti = 0;
|
||||||
const Style::Symbol *si = 0;
|
const Style::Symbol *si = 0;
|
||||||
const QByteArray *lbl = 0;
|
const QByteArray *lbl = 0;
|
||||||
@ -204,8 +204,8 @@ void RasterTile::processAreaLabels(QList<TextItem*> &textItems,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::processLineLabels(QList<TextItem*> &textItems,
|
void RasterTile::processLineLabels(const QVector<PainterPath> &paths,
|
||||||
QVector<PainterPath> &paths)
|
QList<TextItem*> &textItems) const
|
||||||
{
|
{
|
||||||
QList<const Style::TextRender*> instructions(_style->pathLabels(_zoom));
|
QList<const Style::TextRender*> instructions(_style->pathLabels(_zoom));
|
||||||
QSet<QByteArray> set;
|
QSet<QByteArray> set;
|
||||||
@ -214,7 +214,7 @@ void RasterTile::processLineLabels(QList<TextItem*> &textItems,
|
|||||||
const Style::TextRender *ri = instructions.at(i);
|
const Style::TextRender *ri = instructions.at(i);
|
||||||
|
|
||||||
for (int i = 0; i < paths.size(); i++) {
|
for (int i = 0; i < paths.size(); i++) {
|
||||||
PainterPath &path = paths[i];
|
const PainterPath &path = paths.at(i);
|
||||||
const QByteArray *lbl = label(ri->key(), path.path->tags);
|
const QByteArray *lbl = label(ri->key(), path.path->tags);
|
||||||
|
|
||||||
if (!lbl)
|
if (!lbl)
|
||||||
@ -288,7 +288,7 @@ QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const
|
|||||||
|
|
||||||
void RasterTile::pathInstructions(const QList<MapData::Path> &paths,
|
void RasterTile::pathInstructions(const QList<MapData::Path> &paths,
|
||||||
QVector<PainterPath> &painterPaths,
|
QVector<PainterPath> &painterPaths,
|
||||||
QVector<RasterTile::RenderInstruction> &instructions)
|
QVector<RasterTile::RenderInstruction> &instructions) const
|
||||||
{
|
{
|
||||||
QCache<PathKey, QList<const Style::PathRender *> > cache(8192);
|
QCache<PathKey, QList<const Style::PathRender *> > cache(8192);
|
||||||
QList<const Style::PathRender*> *ri;
|
QList<const Style::PathRender*> *ri;
|
||||||
@ -314,7 +314,7 @@ void RasterTile::pathInstructions(const QList<MapData::Path> &paths,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::circleInstructions(const QList<MapData::Point> &points,
|
void RasterTile::circleInstructions(const QList<MapData::Point> &points,
|
||||||
QVector<RasterTile::RenderInstruction> &instructions)
|
QVector<RasterTile::RenderInstruction> &instructions) const
|
||||||
{
|
{
|
||||||
QCache<PointKey, QList<const Style::CircleRender *> > cache(8192);
|
QCache<PointKey, QList<const Style::CircleRender *> > cache(8192);
|
||||||
QList<const Style::CircleRender*> *ri;
|
QList<const Style::CircleRender*> *ri;
|
||||||
@ -373,7 +373,7 @@ void RasterTile::drawPaths(QPainter *painter, const QList<MapData::Path> &paths,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::fetchData(QList<MapData::Path> &paths,
|
void RasterTile::fetchData(QList<MapData::Path> &paths,
|
||||||
QList<MapData::Point> &points)
|
QList<MapData::Point> &points) const
|
||||||
{
|
{
|
||||||
QPoint ttl(_rect.topLeft());
|
QPoint ttl(_rect.topLeft());
|
||||||
|
|
||||||
@ -414,8 +414,8 @@ void RasterTile::render()
|
|||||||
drawPaths(&painter, paths, points, renderPaths);
|
drawPaths(&painter, paths, points, renderPaths);
|
||||||
|
|
||||||
processPointLabels(points, textItems);
|
processPointLabels(points, textItems);
|
||||||
processAreaLabels(textItems, renderPaths);
|
processAreaLabels(renderPaths, textItems);
|
||||||
processLineLabels(textItems, renderPaths);
|
processLineLabels(renderPaths, textItems);
|
||||||
drawTextItems(&painter, textItems);
|
drawTextItems(&painter, textItems);
|
||||||
|
|
||||||
//painter.setPen(Qt::red);
|
//painter.setPen(Qt::red);
|
||||||
|
@ -146,20 +146,21 @@ private:
|
|||||||
friend HASH_T qHash(const RasterTile::PathKey &key);
|
friend HASH_T qHash(const RasterTile::PathKey &key);
|
||||||
friend HASH_T qHash(const RasterTile::PointKey &key);
|
friend HASH_T qHash(const RasterTile::PointKey &key);
|
||||||
|
|
||||||
void fetchData(QList<MapData::Path> &paths, QList<MapData::Point> &points);
|
void fetchData(QList<MapData::Path> &paths,
|
||||||
|
QList<MapData::Point> &points) const;
|
||||||
void pathInstructions(const QList<MapData::Path> &paths,
|
void pathInstructions(const QList<MapData::Path> &paths,
|
||||||
QVector<PainterPath> &painterPaths,
|
QVector<PainterPath> &painterPaths,
|
||||||
QVector<RasterTile::RenderInstruction> &instructions);
|
QVector<RasterTile::RenderInstruction> &instructions) const;
|
||||||
void circleInstructions(const QList<MapData::Point> &points,
|
void circleInstructions(const QList<MapData::Point> &points,
|
||||||
QVector<RasterTile::RenderInstruction> &instructions);
|
QVector<RasterTile::RenderInstruction> &instructions) const;
|
||||||
QPointF ll2xy(const Coordinates &c) const
|
QPointF ll2xy(const Coordinates &c) const
|
||||||
{return _transform.proj2img(_proj.ll2xy(c));}
|
{return _transform.proj2img(_proj.ll2xy(c));}
|
||||||
void processPointLabels(const QList<MapData::Point> &points,
|
void processPointLabels(const QList<MapData::Point> &points,
|
||||||
QList<TextItem*> &textItems);
|
QList<TextItem*> &textItems) const;
|
||||||
void processAreaLabels(QList<TextItem*> &textItems,
|
void processAreaLabels(const QVector<PainterPath> &paths,
|
||||||
QVector<PainterPath> &paths);
|
QList<TextItem*> &textItems) const;
|
||||||
void processLineLabels(QList<TextItem*> &textItems,
|
void processLineLabels(const QVector<PainterPath> &paths,
|
||||||
QVector<PainterPath> &paths);
|
QList<TextItem*> &textItems) const;
|
||||||
QPainterPath painterPath(const Polygon &polygon, bool curve) const;
|
QPainterPath painterPath(const Polygon &polygon, bool curve) const;
|
||||||
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
|
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
|
||||||
void drawPaths(QPainter *painter, const QList<MapData::Path> &paths,
|
void drawPaths(QPainter *painter, const QList<MapData::Path> &paths,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user