1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-09 19:43:03 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
3d27b4ea00 The codec is always set in load(), use the default constructor 2023-12-21 17:27:27 +01:00
502a7b4129 Do not have a separate class/file for ENC style retrieving, move
the stuff to the ENC raster tile constructor
2023-12-21 16:57:11 +01:00
6f32c73684 Added infinitive recursion assert 2023-12-21 16:55:42 +01:00
9 changed files with 40 additions and 42 deletions

View File

@ -134,7 +134,6 @@ HEADERS += src/common/config.h \
src/map/encjob.h \
src/map/encmap.h \
src/map/ENC/iso8211.h \
src/map/encstyle.h \
src/map/gemfmap.h \
src/map/gmifile.h \
src/map/oruxmap.h \
@ -350,7 +349,6 @@ SOURCES += src/main.cpp \
src/map/encatlas.cpp \
src/map/encmap.cpp \
src/map/ENC/iso8211.cpp \
src/map/encstyle.cpp \
src/map/gemfmap.cpp \
src/map/gmifile.cpp \
src/map/oruxmap.cpp \

View File

@ -17,6 +17,12 @@ typedef QSet<Coordinates> PointSet;
static const float C1 = 0.866025f; /* sqrt(3)/2 */
static const QColor haloColor(Qt::white);
static const Style *style()
{
static ENC::Style s;
return &s;
}
static double area(const QVector<Coordinates> &polygon)
{
double area = 0;
@ -397,3 +403,23 @@ void RasterTile::render()
_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();
}

View File

@ -18,17 +18,11 @@ 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), _pixmap(rect.width() * ratio, rect.height()
* ratio), _valid(false) {}
const MapData *data, int zoom, const Range &zoomRange, 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), _pixmap(rect.width() * ratio, rect.height()
* ratio), _valid(false) {}
AtlasData *data, int zoom, const Range &zoomRange, const QRect &rect,
qreal ratio);
int zoom() const {return _zoom;}
QPoint xy() const {return _rect.topLeft();}

View File

@ -16,14 +16,14 @@ class LBLFile : public SubFile
{
public:
LBLFile(const IMGData *img)
: SubFile(img), _huffmanText(0), _table(0), _rasters(0), _codec(1252),
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
: SubFile(img), _huffmanText(0), _table(0), _rasters(0), _imgIdSize(0),
_poiShift(0), _shift(0), _encoding(0) {}
LBLFile(const QString *path)
: SubFile(path), _huffmanText(0), _table(0), _rasters(0), _codec(1252),
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
: SubFile(path), _huffmanText(0), _table(0), _rasters(0), _imgIdSize(0),
_poiShift(0), _shift(0), _encoding(0) {}
LBLFile(const SubFile *gmp, quint32 offset)
: SubFile(gmp, offset), _huffmanText(0), _table(0), _rasters(0),
_codec(1252), _imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
~LBLFile();
bool load(Handle &hdl, const RGNFile *rgn, Handle &rgnHdl);

View File

@ -1272,6 +1272,8 @@ const Style::Point &Style::point(quint32 type) const
const QFont *Style::font(Style::FontSize size, Style::FontSize defaultSize) const
{
Q_ASSERT(defaultSize != Style::NotSet);
switch (size) {
case Style::None:
return 0;

View File

@ -5,7 +5,6 @@
#include "rectd.h"
#include "pcs.h"
#include "encjob.h"
#include "encstyle.h"
#include "encatlas.h"
using namespace ENC;
@ -358,7 +357,7 @@ void ENCAtlas::draw(QPainter *painter, const QRectF &rect, Flags flags)
painter->drawPixmap(ttl, pm);
else
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));
}
}

View File

@ -5,7 +5,6 @@
#include "rectd.h"
#include "pcs.h"
#include "encjob.h"
#include "encstyle.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))
painter->drawPixmap(ttl, pm);
else
tiles.append(RasterTile(_projection, _transform,
ENCStyle::style(), _data, _zoom, _zooms,
QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
tiles.append(RasterTile(_projection, _transform, _data, _zoom,
_zooms, QRect(ttl, QSize(TILE_SIZE, TILE_SIZE)), _tileRatio));
}
}

View File

@ -1,7 +0,0 @@
#include "encstyle.h"
const ENC::Style *ENCStyle::style()
{
static ENC::Style s;
return &s;
}

View File

@ -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