Code cleanup

This commit is contained in:
Martin Tůma 2018-12-07 00:50:11 +01:00
parent a83d4909ed
commit a3d555bb6a
8 changed files with 27 additions and 19 deletions

View File

@ -1,4 +1,5 @@
#include <QByteArray>
#include <QImage>
#include <QPainter>
#include <QDebug>
#include <QVariantHash>
@ -70,7 +71,7 @@ private:
const vector_tile::Tile_Feature *_data;
};
bool cmp(const Feature &f1, const Feature &f2)
static bool cmp(const Feature &f1, const Feature &f2)
{
return f1.data()->id() < f2.data()->id();
}
@ -113,8 +114,8 @@ static inline QPoint parameters(quint32 v1, quint32 v2)
return QPoint(zigzag32decode(v1), zigzag32decode(v2));
}
static void drawFeature(const Feature &feature, Style *style, int styleLayer,
const QSizeF &factor, Tile &tile)
static void drawFeature(const Feature &feature, const Style *style,
int styleLayer, const QSizeF &factor, Tile &tile)
{
if (!style->match(tile.zoom(), styleLayer, feature.tags()))
return;
@ -155,7 +156,7 @@ static void drawFeature(const Feature &feature, Style *style, int styleLayer,
style->drawFeature(tile, styleLayer, path, feature.tags());
}
static void drawLayer(const Layer &layer, Style *style, int styleLayer,
static void drawLayer(const Layer &layer, const Style *style, int styleLayer,
Tile &tile)
{
if (layer.data()->version() > 2)
@ -172,7 +173,7 @@ static void drawLayer(const Layer &layer, Style *style, int styleLayer,
tile.painter().restore();
}
bool PBF::render(const QByteArray &data, int zoom, Style *style,
bool PBF::render(const QByteArray &data, int zoom, const Style *style,
const QPointF &scale, QImage *image)
{
vector_tile::Tile tile;

View File

@ -1,14 +1,14 @@
#ifndef PBF_H
#define PBF_H
#include <QImage>
class QByteArray;
class QImage;
class Style;
class QPointF;
namespace PBF
{
bool render(const QByteArray &data, int zoom, Style *style,
bool render(const QByteArray &data, int zoom, const Style *style,
const QPointF &scale, QImage *render);
}

View File

@ -2,16 +2,16 @@
#define PBFHANDLER_H
#include <QImageIOHandler>
#include <QImage>
#include <QVariant>
#include <QSize>
class QImage;
class Style;
class PBFHandler : public QImageIOHandler
{
public:
PBFHandler(Style *style) : _style(style) {}
PBFHandler(const Style *style) : _style(style) {}
~PBFHandler() {}
bool canRead() const;
@ -19,12 +19,12 @@ public:
QVariant option(ImageOption option) const;
bool supportsOption(ImageOption option) const;
void setOption(QImageIOHandler::ImageOption option, const QVariant &value);
void setOption(ImageOption option, const QVariant &value);
static bool canRead(QIODevice *device);
private:
Style *_style;
const Style *_style;
QSize _scaledSize;
};

View File

@ -4,6 +4,9 @@
#include <QRect>
#include <QMap>
#include <QImage>
#include <QString>
class QJsonObject;
class Sprites
{

View File

@ -3,6 +3,8 @@
#include <QObject>
#include <QString>
#include <QVector>
#include <QPair>
#include <QVariantHash>
#include <QStringList>
#include <QSet>
@ -16,6 +18,8 @@
class QPainter;
class QPainterPath;
class QJsonArray;
class QJsonObject;
class Tile;
class Style : public QObject

View File

@ -1,8 +1,13 @@
#ifndef TEXTITEM_H
#define TEXTITEM_H
#include <QString>
#include <QPainterPath>
#include <QPen>
#include <QFont>
#include <QRectF>
class QPainter;
class TextItem
{

View File

@ -1,10 +1,7 @@
#ifndef TEXTPATHITEM_H
#define TEXTPATHITEM_H
#include <QFont>
#include <QString>
#include "textitem.h"
#include "text.h"
class TextPathItem : public TextItem
{

View File

@ -1,11 +1,9 @@
#ifndef TEXTPOINTITEM_H
#define TEXTPOINTITEM_H
#include <QPen>
#include <QFont>
#include <QString>
#include "textitem.h"
#include <QImage>
#include "text.h"
#include "textitem.h"
class TextPointItem : public TextItem
{