forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.hpp
69 lines (55 loc) · 1.44 KB
/
generator.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#include "geometry/rect2d.hpp"
#include "geometry/packer.hpp"
#include "coding/writer.hpp"
#include "base/base.hpp"
#include <QtGui/QPainter>
#include <QtGui/QImage>
#include <QtCore/QFileInfo>
#include <QtCore/QSize>
#include <QtSvg/QSvgRenderer>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
class QImage;
namespace tools
{
class SkinGenerator
{
public:
struct SymbolInfo
{
QSize m_size;
QString m_fullFileName;
QString m_symbolID;
m2::Packer::handle_t m_handle = {};
SymbolInfo() {}
SymbolInfo(QSize size, QString const & fullFileName, QString const & symbolID)
: m_size(size), m_fullFileName(fullFileName), m_symbolID(symbolID)
{}
};
using TSymbols = std::vector<SymbolInfo>;
struct SkinPageInfo
{
TSymbols m_symbols;
uint32_t m_width = 0;
uint32_t m_height = 0;
std::string m_fileName;
std::string m_dir;
std::string m_suffix;
m2::Packer m_packer;
};
void ProcessSymbols(std::string const & symbolsDir, std::string const & skinName,
std::vector<QSize> const & symbolSizes,
std::vector<std::string> const & suffix);
bool RenderPages(uint32_t maxSize);
bool WriteToFileNewStyle(std::string const & skinName);
private:
QSvgRenderer m_svgRenderer;
using TSkinPages = std::vector<SkinPageInfo>;
TSkinPages m_pages;
bool m_overflowDetected;
void MarkOverflow();
};
} // namespace tools