mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-10 03:53:02 +02:00
Compare commits
No commits in common. "6ccfe0eb21d7586c261ff12aeba7ad4d0a5edfaa" and "f7a81cafd5899eceb11995cb090180b15446a6fe" have entirely different histories.
6ccfe0eb21
...
f7a81cafd5
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,12 +12,13 @@
|
||||
*/
|
||||
|
||||
#include <QtEndian>
|
||||
#include <QtMath>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QLocale>
|
||||
#include <private/qzipreader_p.h>
|
||||
#include "rectc.h"
|
||||
#include "common/rectc.h"
|
||||
#include "dem.h"
|
||||
|
||||
#define SRTM3_SAMPLES 1201
|
||||
@ -130,7 +131,7 @@ double DEM::elevation(const Coordinates &c)
|
||||
if (_dir.isEmpty())
|
||||
return NAN;
|
||||
|
||||
Tile tile(floor(c.lon()), floor(c.lat()));
|
||||
Tile tile(qFloor(c.lon()), qFloor(c.lat()));
|
||||
QByteArray *ba = _data.object(tile);
|
||||
double ele;
|
||||
|
||||
|
@ -365,15 +365,13 @@ 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;
|
||||
|
||||
img.setDevicePixelRatio(_ratio);
|
||||
img.fill(Qt::transparent);
|
||||
_pixmap.setDevicePixelRatio(_ratio);
|
||||
_pixmap.fill(Qt::transparent);
|
||||
|
||||
fetchData(polygons, lines, points);
|
||||
|
||||
@ -381,7 +379,7 @@ void RasterTile::render()
|
||||
processPoints(points, textItems, lights);
|
||||
processLines(lines, textItems);
|
||||
|
||||
QPainter painter(&img);
|
||||
QPainter painter(&_pixmap);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.translate(-_rect.x(), -_rect.y());
|
||||
@ -401,5 +399,23 @@ void RasterTile::render()
|
||||
//painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
//painter.drawRect(QRect(_rect.topLeft(), _pixmap.size()));
|
||||
|
||||
_pixmap.convertFromImage(img);
|
||||
_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)
|
||||
{
|
||||
}
|
||||
|
@ -18,18 +18,15 @@ 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) :
|
||||
_proj(proj), _transform(transform), _style(style), _map(data), _atlas(0),
|
||||
_zoom(zoom), _zoomRange(zoomRange), _rect(rect), _ratio(ratio) {}
|
||||
const QRect &rect, qreal ratio);
|
||||
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) {}
|
||||
const QRect &rect, qreal 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();
|
||||
|
||||
@ -68,6 +65,7 @@ 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.pixmap().isNull())
|
||||
if (mt.isValid())
|
||||
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.pixmap().isNull())
|
||||
if (mt.isValid())
|
||||
QPixmapCache::insert(key(mt.zoom(), mt.xy()), mt.pixmap());
|
||||
}
|
||||
|
||||
|
@ -529,5 +529,5 @@ void RasterTile::render()
|
||||
|
||||
qDeleteAll(textItems);
|
||||
|
||||
_pixmap.convertFromImage(img);
|
||||
_pixmap = QPixmap::fromImage(img);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user