mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-28 12:09:15 +02:00
Process all the ll2xy operations in parallel
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include <QFont>
|
||||
#include <QPainter>
|
||||
#include "map/imgmap.h"
|
||||
#include "textpathitem.h"
|
||||
#include "textpointitem.h"
|
||||
#include "bitmapline.h"
|
||||
@ -166,6 +167,10 @@ void RasterTile::render()
|
||||
{
|
||||
QList<TextItem*> textItems;
|
||||
|
||||
ll2xy(_polygons);
|
||||
ll2xy(_lines);
|
||||
ll2xy(_points);
|
||||
|
||||
processPoints(textItems);
|
||||
processPolygons(textItems);
|
||||
processLines(textItems);
|
||||
@ -186,6 +191,25 @@ void RasterTile::render()
|
||||
qDeleteAll(textItems);
|
||||
}
|
||||
|
||||
void RasterTile::ll2xy(QList<MapData::Poly> &polys)
|
||||
{
|
||||
for (int i = 0; i < polys.size(); i++) {
|
||||
MapData::Poly &poly = polys[i];
|
||||
for (int j = 0; j < poly.points.size(); j++) {
|
||||
QPointF &p = poly.points[j];
|
||||
p = _map->ll2xy(Coordinates(p.x(), p.y()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTile::ll2xy(QList<MapData::Point> &points)
|
||||
{
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
QPointF p(_map->ll2xy(points.at(i).coordinates));
|
||||
points[i].coordinates = Coordinates(p.x(), p.y());
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTile::drawPolygons(QPainter *painter)
|
||||
{
|
||||
for (int n = 0; n < _style->drawOrder().size(); n++) {
|
||||
|
@ -7,14 +7,15 @@
|
||||
class QPainter;
|
||||
class TextItem;
|
||||
class Style;
|
||||
class IMGMap;
|
||||
|
||||
class RasterTile
|
||||
{
|
||||
public:
|
||||
RasterTile(const Style *style, int zoom, const QRect &rect,
|
||||
RasterTile(IMGMap *map, const Style *style, int zoom, const QRect &rect,
|
||||
const QString &key, const QList<MapData::Poly> &polygons,
|
||||
const QList<MapData::Poly> &lines, QList<MapData::Point> &points)
|
||||
: _style(style), _zoom(zoom), _xy(rect.topLeft()),
|
||||
: _map(map), _style(style), _zoom(zoom), _xy(rect.topLeft()),
|
||||
_key(key), _img(rect.size(), QImage::Format_ARGB32_Premultiplied),
|
||||
_polygons(polygons), _lines(lines), _points(points) {}
|
||||
|
||||
@ -25,6 +26,9 @@ public:
|
||||
void render();
|
||||
|
||||
private:
|
||||
void ll2xy(QList<MapData::Poly> &polys);
|
||||
void ll2xy(QList<MapData::Point> &points);
|
||||
|
||||
void drawPolygons(QPainter *painter);
|
||||
void drawLines(QPainter *painter);
|
||||
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
|
||||
@ -35,6 +39,7 @@ private:
|
||||
void processShields(const QRect &tileRect, QList<TextItem*> &textItems);
|
||||
void processStreetNames(const QRect &tileRect, QList<TextItem*> &textItems);
|
||||
|
||||
IMGMap *_map;
|
||||
const Style *_style;
|
||||
int _zoom;
|
||||
QPoint _xy;
|
||||
|
Reference in New Issue
Block a user