mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-17 16:20:48 +01:00
Compare commits
4 Commits
f7a81cafd5
...
6ccfe0eb21
Author | SHA1 | Date | |
---|---|---|---|
6ccfe0eb21 | |||
d42c6831df | |||
dc0178279d | |||
e0ff4529b6 |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -12,13 +12,12 @@
|
||||
*/
|
||||
|
||||
#include <QtEndian>
|
||||
#include <QtMath>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QLocale>
|
||||
#include <private/qzipreader_p.h>
|
||||
#include "common/rectc.h"
|
||||
#include "rectc.h"
|
||||
#include "dem.h"
|
||||
|
||||
#define SRTM3_SAMPLES 1201
|
||||
@ -131,7 +130,7 @@ double DEM::elevation(const Coordinates &c)
|
||||
if (_dir.isEmpty())
|
||||
return NAN;
|
||||
|
||||
Tile tile(qFloor(c.lon()), qFloor(c.lat()));
|
||||
Tile tile(floor(c.lon()), floor(c.lat()));
|
||||
QByteArray *ba = _data.object(tile);
|
||||
double ele;
|
||||
|
||||
|
@ -365,13 +365,15 @@ void RasterTile::fetchData(QList<MapData::Poly> &polygons,
|
||||
|
||||
void RasterTile::render()
|
||||
{
|
||||
QImage img(_rect.width() * _ratio, _rect.height() * _ratio,
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
QList<MapData::Line> lines;
|
||||
QList<MapData::Poly> polygons;
|
||||
QList<MapData::Point> points;
|
||||
QList<TextItem*> textItems, lights;
|
||||
|
||||
_pixmap.setDevicePixelRatio(_ratio);
|
||||
_pixmap.fill(Qt::transparent);
|
||||
img.setDevicePixelRatio(_ratio);
|
||||
img.fill(Qt::transparent);
|
||||
|
||||
fetchData(polygons, lines, points);
|
||||
|
||||
@ -379,7 +381,7 @@ void RasterTile::render()
|
||||
processPoints(points, textItems, lights);
|
||||
processLines(lines, textItems);
|
||||
|
||||
QPainter painter(&_pixmap);
|
||||
QPainter painter(&img);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.translate(-_rect.x(), -_rect.y());
|
||||
@ -399,23 +401,5 @@ void RasterTile::render()
|
||||
//painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
//painter.drawRect(QRect(_rect.topLeft(), _pixmap.size()));
|
||||
|
||||
_valid = true;
|
||||
}
|
||||
|
||||
RasterTile::RasterTile(const Projection &proj, const Transform &transform,
|
||||
const Style *style, const MapData *data, int zoom, const Range &zoomRange,
|
||||
const QRect &rect, qreal ratio) :
|
||||
_proj(proj), _transform(transform), _style(style), _map(data), _atlas(0),
|
||||
_zoom(zoom), _zoomRange(zoomRange), _rect(rect), _ratio(ratio),
|
||||
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false)
|
||||
{
|
||||
}
|
||||
|
||||
RasterTile::RasterTile(const Projection &proj, const Transform &transform,
|
||||
const Style *style, AtlasData *data, int zoom, const Range &zoomRange,
|
||||
const QRect &rect, qreal ratio) :
|
||||
_proj(proj), _transform(transform), _style(style), _map(0), _atlas(data),
|
||||
_zoom(zoom), _zoomRange(zoomRange), _rect(rect), _ratio(ratio),
|
||||
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false)
|
||||
{
|
||||
_pixmap.convertFromImage(img);
|
||||
}
|
||||
|
@ -18,15 +18,18 @@ class RasterTile
|
||||
public:
|
||||
RasterTile(const Projection &proj, const Transform &transform,
|
||||
const Style *style, const MapData *data, int zoom, const Range &zoomRange,
|
||||
const QRect &rect, qreal ratio);
|
||||
const QRect &rect, qreal ratio) :
|
||||
_proj(proj), _transform(transform), _style(style), _map(data), _atlas(0),
|
||||
_zoom(zoom), _zoomRange(zoomRange), _rect(rect), _ratio(ratio) {}
|
||||
RasterTile(const Projection &proj, const Transform &transform,
|
||||
const Style *style, AtlasData *data, int zoom, const Range &zoomRange,
|
||||
const QRect &rect, qreal ratio);
|
||||
const QRect &rect, qreal ratio) :
|
||||
_proj(proj), _transform(transform), _style(style), _map(0), _atlas(data),
|
||||
_zoom(zoom), _zoomRange(zoomRange), _rect(rect), _ratio(ratio) {}
|
||||
|
||||
int zoom() const {return _zoom;}
|
||||
QPoint xy() const {return _rect.topLeft();}
|
||||
const QPixmap &pixmap() const {return _pixmap;}
|
||||
bool isValid() const {return _valid;}
|
||||
|
||||
void render();
|
||||
|
||||
@ -65,7 +68,6 @@ private:
|
||||
QRect _rect;
|
||||
qreal _ratio;
|
||||
QPixmap _pixmap;
|
||||
bool _valid;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -507,9 +507,9 @@ void RasterTile::render()
|
||||
|
||||
qDeleteAll(textItems);
|
||||
|
||||
_pixmap = QPixmap::fromImage(img);
|
||||
|
||||
//painter.setPen(Qt::red);
|
||||
//painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
//painter.drawRect(_rect);
|
||||
|
||||
_pixmap.convertFromImage(img);
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ void ENCAtlas::jobFinished(ENCJob *job)
|
||||
|
||||
for (int i = 0; i < tiles.size(); i++) {
|
||||
const ENC::RasterTile &mt = tiles.at(i);
|
||||
if (mt.isValid())
|
||||
if (!mt.pixmap().isNull())
|
||||
QPixmapCache::insert(key(mt.zoom(), mt.xy()), mt.pixmap());
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ void ENCMap::jobFinished(ENCJob *job)
|
||||
|
||||
for (int i = 0; i < tiles.size(); i++) {
|
||||
const ENC::RasterTile &mt = tiles.at(i);
|
||||
if (mt.isValid())
|
||||
if (!mt.pixmap().isNull())
|
||||
QPixmapCache::insert(key(mt.zoom(), mt.xy()), mt.pixmap());
|
||||
}
|
||||
|
||||
|
@ -529,5 +529,5 @@ void RasterTile::render()
|
||||
|
||||
qDeleteAll(textItems);
|
||||
|
||||
_pixmap = QPixmap::fromImage(img);
|
||||
_pixmap.convertFromImage(img);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user