mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Do not have a separate class/file for ENC style retrieving, move
the stuff to the ENC raster tile constructor
This commit is contained in:
parent
6f32c73684
commit
502a7b4129
@ -134,7 +134,6 @@ HEADERS += src/common/config.h \
|
|||||||
src/map/encjob.h \
|
src/map/encjob.h \
|
||||||
src/map/encmap.h \
|
src/map/encmap.h \
|
||||||
src/map/ENC/iso8211.h \
|
src/map/ENC/iso8211.h \
|
||||||
src/map/encstyle.h \
|
|
||||||
src/map/gemfmap.h \
|
src/map/gemfmap.h \
|
||||||
src/map/gmifile.h \
|
src/map/gmifile.h \
|
||||||
src/map/oruxmap.h \
|
src/map/oruxmap.h \
|
||||||
@ -350,7 +349,6 @@ SOURCES += src/main.cpp \
|
|||||||
src/map/encatlas.cpp \
|
src/map/encatlas.cpp \
|
||||||
src/map/encmap.cpp \
|
src/map/encmap.cpp \
|
||||||
src/map/ENC/iso8211.cpp \
|
src/map/ENC/iso8211.cpp \
|
||||||
src/map/encstyle.cpp \
|
|
||||||
src/map/gemfmap.cpp \
|
src/map/gemfmap.cpp \
|
||||||
src/map/gmifile.cpp \
|
src/map/gmifile.cpp \
|
||||||
src/map/oruxmap.cpp \
|
src/map/oruxmap.cpp \
|
||||||
|
@ -17,6 +17,12 @@ typedef QSet<Coordinates> PointSet;
|
|||||||
static const float C1 = 0.866025f; /* sqrt(3)/2 */
|
static const float C1 = 0.866025f; /* sqrt(3)/2 */
|
||||||
static const QColor haloColor(Qt::white);
|
static const QColor haloColor(Qt::white);
|
||||||
|
|
||||||
|
static const Style *style()
|
||||||
|
{
|
||||||
|
static ENC::Style s;
|
||||||
|
return &s;
|
||||||
|
}
|
||||||
|
|
||||||
static double area(const QVector<Coordinates> &polygon)
|
static double area(const QVector<Coordinates> &polygon)
|
||||||
{
|
{
|
||||||
double area = 0;
|
double area = 0;
|
||||||
@ -397,3 +403,23 @@ void RasterTile::render()
|
|||||||
|
|
||||||
_valid = true;
|
_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RasterTile::RasterTile(const Projection &proj, const Transform &transform,
|
||||||
|
const MapData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||||
|
qreal ratio) :
|
||||||
|
_proj(proj), _transform(transform), _map(data), _atlas(0), _zoom(zoom),
|
||||||
|
_zoomRange(zoomRange), _rect(rect), _ratio(ratio),
|
||||||
|
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false)
|
||||||
|
{
|
||||||
|
_style = style();
|
||||||
|
}
|
||||||
|
|
||||||
|
RasterTile::RasterTile(const Projection &proj, const Transform &transform,
|
||||||
|
AtlasData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||||
|
qreal ratio) :
|
||||||
|
_proj(proj), _transform(transform), _map(0), _atlas(data), _zoom(zoom),
|
||||||
|
_zoomRange(zoomRange), _rect(rect), _ratio(ratio),
|
||||||
|
_pixmap(rect.width() * ratio, rect.height() * ratio), _valid(false)
|
||||||
|
{
|
||||||
|
_style = style();
|
||||||
|
}
|
||||||
|
@ -18,17 +18,11 @@ class RasterTile
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RasterTile(const Projection &proj, const Transform &transform,
|
RasterTile(const Projection &proj, const Transform &transform,
|
||||||
const Style *style, const MapData *data, int zoom, const Range &zoomRange,
|
const MapData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||||
const QRect &rect, qreal ratio) : _proj(proj), _transform(transform),
|
qreal ratio);
|
||||||
_style(style), _map(data), _atlas(0), _zoom(zoom), _zoomRange(zoomRange),
|
|
||||||
_rect(rect), _ratio(ratio), _pixmap(rect.width() * ratio, rect.height()
|
|
||||||
* ratio), _valid(false) {}
|
|
||||||
RasterTile(const Projection &proj, const Transform &transform,
|
RasterTile(const Projection &proj, const Transform &transform,
|
||||||
const Style *style, AtlasData *data, int zoom, const Range &zoomRange,
|
AtlasData *data, int zoom, const Range &zoomRange, const QRect &rect,
|
||||||
const QRect &rect, qreal ratio) : _proj(proj), _transform(transform),
|
qreal ratio);
|
||||||
_style(style), _map(0), _atlas(data), _zoom(zoom), _zoomRange(zoomRange),
|
|
||||||
_rect(rect), _ratio(ratio), _pixmap(rect.width() * ratio, rect.height()
|
|
||||||
* ratio), _valid(false) {}
|
|
||||||
|
|
||||||
int zoom() const {return _zoom;}
|
int zoom() const {return _zoom;}
|
||||||
QPoint xy() const {return _rect.topLeft();}
|
QPoint xy() const {return _rect.topLeft();}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "rectd.h"
|
#include "rectd.h"
|
||||||
#include "pcs.h"
|
#include "pcs.h"
|
||||||
#include "encjob.h"
|
#include "encjob.h"
|
||||||
#include "encstyle.h"
|
|
||||||
#include "encatlas.h"
|
#include "encatlas.h"
|
||||||
|
|
||||||
using namespace ENC;
|
using namespace ENC;
|
||||||
@ -358,7 +357,7 @@ void ENCAtlas::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
|||||||
painter->drawPixmap(ttl, pm);
|
painter->drawPixmap(ttl, pm);
|
||||||
else
|
else
|
||||||
tiles.append(RasterTile(_projection, _transform,
|
tiles.append(RasterTile(_projection, _transform,
|
||||||
ENCStyle::style(), _data.value(_usage), _zoom, zooms(_usage),
|
_data.value(_usage), _zoom, zooms(_usage),
|
||||||
QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "rectd.h"
|
#include "rectd.h"
|
||||||
#include "pcs.h"
|
#include "pcs.h"
|
||||||
#include "encjob.h"
|
#include "encjob.h"
|
||||||
#include "encstyle.h"
|
|
||||||
#include "encmap.h"
|
#include "encmap.h"
|
||||||
|
|
||||||
|
|
||||||
@ -324,9 +323,8 @@ void ENCMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
|||||||
if (QPixmapCache::find(key(_zoom, ttl), &pm))
|
if (QPixmapCache::find(key(_zoom, ttl), &pm))
|
||||||
painter->drawPixmap(ttl, pm);
|
painter->drawPixmap(ttl, pm);
|
||||||
else
|
else
|
||||||
tiles.append(RasterTile(_projection, _transform,
|
tiles.append(RasterTile(_projection, _transform, _data, _zoom,
|
||||||
ENCStyle::style(), _data, _zoom, _zooms,
|
_zooms, QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
||||||
QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#include "encstyle.h"
|
|
||||||
|
|
||||||
const ENC::Style *ENCStyle::style()
|
|
||||||
{
|
|
||||||
static ENC::Style s;
|
|
||||||
return &s;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
#ifndef ENCSTYLE_H
|
|
||||||
#define ENCSTYLE_H
|
|
||||||
|
|
||||||
#include "ENC/style.h"
|
|
||||||
|
|
||||||
class ENCStyle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const ENC::Style *style();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ENCSTYLE_H
|
|
Loading…
Reference in New Issue
Block a user