even more refactoring

This commit is contained in:
Konstantin Käfer
2014-06-27 16:42:44 +02:00
parent 3d18b84deb
commit d75f0075f3
22 changed files with 76 additions and 40 deletions

View File

@@ -20,6 +20,7 @@
namespace llmr {
class Source;
class SpriteAtlas;
class Map : private util::noncopyable {
public:

View File

@@ -6,7 +6,7 @@
#include <llmr/text/glyph_store.hpp>
#include <llmr/text/glyph.hpp>
#include <llmr/util/utf.hpp>
#include <llmr/map/filter_expression.hpp>
#include <llmr/style/filter_expression.hpp>
namespace llmr {

View File

@@ -5,7 +5,7 @@
#include <llmr/util/vec.hpp>
#include <llmr/style/value.hpp>
#include <llmr/text/glyph.hpp>
#include <llmr/map/filter_expression.hpp>
#include <llmr/style/filter_expression.hpp>
#include <vector>
#include <map>
#include <unordered_map>

View File

@@ -1,5 +1,5 @@
#ifndef LLMR_MAP_FILTER_EXPRESSION
#define LLMR_MAP_FILTER_EXPRESSION
#ifndef LLMR_STYLE_FILTER_EXPRESSION
#define LLMR_STYLE_FILTER_EXPRESSION
#include <llmr/style/value.hpp>
#include <llmr/util/recursive_wrapper.hpp>

View File

@@ -3,15 +3,8 @@
#include <cstdint>
#include <llmr/style/style_bucket.hpp>
#include <llmr/util/pbf.hpp>
#include <llmr/geometry/sprite_atlas.hpp>
#include <llmr/util/transition.hpp>
#include <llmr/util/time.hpp>
#include <llmr/util/uv.hpp>
#include <llmr/style/class_dictionary.hpp>
#include <llmr/style/class_properties.hpp>
#include <llmr/style/style_properties.hpp>
#include <llmr/style/rasterize_properties.hpp>
#include <map>
#include <unordered_map>
@@ -22,34 +15,10 @@
namespace llmr {
class Sprite;
class Source;
class StyleLayer;
typedef std::vector<std::shared_ptr<StyleLayer>> StyleLayerGroup;
class StyleLayer {
public:
typedef std::shared_ptr<StyleLayer> Ptr;
public:
template <typename T> const T &getProperties() {
if (style.is<T>()) {
return style.get<T>();
} else {
return defaultStyleProperties<T>();
}
}
public:
std::string id;
StyleBucket::Ptr bucket;
std::map<ClassID, ClassProperties> styles;
StyleProperties style;
std::unique_ptr<RasterizeProperties> rasterize;
std::shared_ptr<StyleLayerGroup> layers;
};
class Style {
public:
struct exception : std::runtime_error { exception(const char *msg) : std::runtime_error(msg) {} };

View File

@@ -2,7 +2,7 @@
#define LLMR_STYLE_STYLE_BUCKET
#include <llmr/style/types.hpp>
#include <llmr/map/filter_expression.hpp>
#include <llmr/style/filter_expression.hpp>
#include <llmr/util/vec.hpp>
#include <llmr/util/variant.hpp>

View File

@@ -0,0 +1,46 @@
#ifndef LLMR_STYLE_STYLE_LAYER
#define LLMR_STYLE_STYLE_LAYER
#include <llmr/style/class_dictionary.hpp>
#include <llmr/style/class_properties.hpp>
#include <llmr/style/style_properties.hpp>
#include <vector>
#include <memory>
#include <string>
#include <map>
namespace llmr {
class StyleBucket;
class RasterizeProperties;
class StyleLayer;
typedef std::vector<std::shared_ptr<StyleLayer>> StyleLayerGroup;
class StyleLayer {
public:
typedef std::shared_ptr<StyleLayer> Ptr;
public:
template <typename T> const T &getProperties() {
if (style.is<T>()) {
return style.get<T>();
} else {
return defaultStyleProperties<T>();
}
}
public:
std::string id;
std::shared_ptr<StyleBucket> bucket;
std::map<ClassID, ClassProperties> styles;
StyleProperties style;
std::unique_ptr<RasterizeProperties> rasterize;
std::shared_ptr<StyleLayerGroup> layers;
};
}
#endif

View File

@@ -4,6 +4,9 @@
#include <rapidjson/document.h>
#include <llmr/style/style.hpp>
#include <llmr/map/source.hpp>
#include <llmr/style/filter_expression.hpp>
#include <llmr/style/class_properties.hpp>
#include <llmr/style/style_bucket.hpp>
#include <unordered_map>
#include <forward_list>

View File

@@ -9,6 +9,9 @@
#include <llmr/util/string.hpp>
#include <llmr/util/constants.hpp>
#include <llmr/util/uv.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/style/style_bucket.hpp>
#include <llmr/geometry/sprite_atlas.hpp>
#include <algorithm>
#include <memory>

View File

@@ -9,6 +9,7 @@
#include <llmr/util/vec.hpp>
#include <llmr/util/std.hpp>
#include <llmr/geometry/glyph_atlas.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/map/vector_tile_data.hpp>

View File

@@ -2,6 +2,7 @@
#include <llmr/map/vector_tile_data.hpp>
#include <llmr/style/style.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/renderer/fill_bucket.hpp>
#include <llmr/renderer/line_bucket.hpp>
#include <llmr/renderer/icon_bucket.hpp>

View File

@@ -1,6 +1,8 @@
#include <llmr/map/vector_tile_data.hpp>
#include <llmr/util/std.hpp>
#include <llmr/map/map.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/style/style_bucket.hpp>
using namespace llmr;

View File

@@ -2,6 +2,7 @@
#include <llmr/geometry/icon_buffer.hpp>
#include <llmr/geometry/elements_buffer.hpp>
#include <llmr/geometry/geometry.hpp>
#include <llmr/geometry/sprite_atlas.hpp>
#include <llmr/renderer/painter.hpp>
#include <llmr/style/style.hpp>

View File

@@ -1,5 +1,6 @@
#include <llmr/renderer/painter.hpp>
#include <llmr/map/map.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/util/std.hpp>
#include <llmr/util/string.hpp>
#include <llmr/util/time.hpp>

View File

@@ -1,5 +1,6 @@
#include <llmr/renderer/painter.hpp>
#include <llmr/renderer/fill_bucket.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/map/map.hpp>
#include <llmr/style/sprite.hpp>
#include <llmr/geometry/sprite_atlas.hpp>

View File

@@ -2,6 +2,8 @@
#include <llmr/renderer/icon_bucket.hpp>
#include <llmr/map/map.hpp>
#include <llmr/style/sprite.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/geometry/sprite_atlas.hpp>
#include <llmr/util/math.hpp>
using namespace llmr;

View File

@@ -1,5 +1,6 @@
#include <llmr/renderer/painter.hpp>
#include <llmr/renderer/line_bucket.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/map/map.hpp>
using namespace llmr;

View File

@@ -1,5 +1,6 @@
#include <llmr/renderer/painter.hpp>
#include <llmr/renderer/raster_bucket.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/map/map.hpp>
using namespace llmr;

View File

@@ -1,5 +1,6 @@
#include <llmr/renderer/painter.hpp>
#include <llmr/renderer/text_bucket.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/map/map.hpp>
#include <cmath>

View File

@@ -1,4 +1,4 @@
#include <llmr/map/filter_expression.hpp>
#include <llmr/style/filter_expression.hpp>
#include <llmr/map/vector_tile.hpp>
namespace llmr {

View File

@@ -1,5 +1,7 @@
#include <llmr/style/style.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/style/style_parser.hpp>
#include <llmr/style/style_bucket.hpp>
#include <llmr/util/constants.hpp>
#include <csscolorparser/csscolorparser.hpp>
@@ -194,7 +196,6 @@ void Style::cascade(float z) {
}
}
bool Style::needsTransition() const {
uv::readlock lock(mtx);

View File

@@ -1,4 +1,5 @@
#include <llmr/style/style_parser.hpp>
#include <llmr/style/style_layer.hpp>
#include <llmr/util/constants.hpp>
#include <llmr/util/std.hpp>
#include <csscolorparser/csscolorparser.hpp>