break out StyleSource from Source, move getActiveSources and updateSources into Map::Map
This commit is contained in:
@@ -52,6 +52,7 @@ public:
|
||||
void resize(uint16_t width, uint16_t height, float ratio, uint16_t fb_width, uint16_t fb_height);
|
||||
|
||||
// Styling
|
||||
const std::set<std::shared_ptr<Source>> getActiveSources() const;
|
||||
void setAppliedClasses(const std::vector<std::string> &classes);
|
||||
void toggleClass(const std::string &name);
|
||||
const std::vector<std::string> &getAppliedClasses() const;
|
||||
@@ -121,6 +122,9 @@ private:
|
||||
// Setup
|
||||
void setup();
|
||||
|
||||
void updateSources();
|
||||
void updateSources(const std::shared_ptr<StyleLayerGroup> &group);
|
||||
|
||||
void updateTiles();
|
||||
void updateRenderState();
|
||||
|
||||
@@ -172,6 +176,8 @@ private:
|
||||
|
||||
int indent = 0;
|
||||
|
||||
std::set<std::shared_ptr<Source>> activeSources;
|
||||
|
||||
private:
|
||||
bool async = false;
|
||||
std::shared_ptr<uv::loop> loop;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/util/time.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <llmr/style/types.hpp>
|
||||
|
||||
#include <list>
|
||||
@@ -22,6 +23,7 @@ class Texturepool;
|
||||
|
||||
class Source : public std::enable_shared_from_this<Source>, private util::noncopyable {
|
||||
public:
|
||||
Source(StyleSource style_source);
|
||||
Source(SourceType type = SourceType::Vector, const std::string &url = "",
|
||||
uint32_t tile_size = 512, uint32_t min_zoom = 0, uint32_t max_zoom = 22);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define LLMR_STYLE_STYLE
|
||||
|
||||
#include <llmr/style/property_transition.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
|
||||
#include <llmr/util/time.hpp>
|
||||
#include <llmr/util/uv.hpp>
|
||||
@@ -17,7 +18,6 @@
|
||||
namespace llmr {
|
||||
|
||||
class Sprite;
|
||||
class Source;
|
||||
class StyleLayer;
|
||||
class StyleLayerGroup;
|
||||
struct BackgroundProperties;
|
||||
@@ -36,8 +36,6 @@ public:
|
||||
|
||||
void setDefaultTransitionDuration(uint16_t duration_milliseconds = 0);
|
||||
|
||||
const std::set<std::shared_ptr<Source>> getActiveSources() const;
|
||||
|
||||
void setAppliedClasses(const std::vector<std::string> &classes);
|
||||
const std::vector<std::string> &getAppliedClasses() const;
|
||||
void toggleClass(const std::string &name);
|
||||
@@ -57,13 +55,8 @@ public:
|
||||
std::string sprite_url;
|
||||
std::string glyph_url;
|
||||
|
||||
private:
|
||||
void updateSources();
|
||||
void updateSources(const std::shared_ptr<StyleLayerGroup> &group);
|
||||
|
||||
|
||||
private:
|
||||
std::set<std::shared_ptr<Source>> activeSources;
|
||||
PropertyTransition defaultTransition;
|
||||
bool initial_render_complete = false;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <llmr/style/types.hpp>
|
||||
#include <llmr/style/filter_expression.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/util/variant.hpp>
|
||||
|
||||
@@ -11,8 +12,6 @@
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Source;
|
||||
|
||||
class StyleBucketFill {
|
||||
public:
|
||||
WindingType winding = WindingType::Default;
|
||||
@@ -74,7 +73,7 @@ public:
|
||||
StyleBucket(StyleLayerType type);
|
||||
|
||||
std::string name;
|
||||
std::shared_ptr<Source> source;
|
||||
std::shared_ptr<StyleSource> style_source;
|
||||
std::string source_layer;
|
||||
FilterExpression filter;
|
||||
StyleBucketRender render = std::false_type();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <llmr/style/style.hpp>
|
||||
#include <llmr/map/source.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <llmr/style/filter_expression.hpp>
|
||||
#include <llmr/style/class_properties.hpp>
|
||||
#include <llmr/style/rasterize_properties.hpp>
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
private:
|
||||
std::unordered_map<std::string, const rapidjson::Value *> constants;
|
||||
|
||||
std::unordered_map<std::string, const std::shared_ptr<Source>> sources;
|
||||
std::unordered_map<std::string, const std::shared_ptr<StyleSource>> sources;
|
||||
|
||||
// This stores the root layer.
|
||||
std::shared_ptr<StyleLayerGroup> root;
|
||||
|
||||
27
include/llmr/style/style_source.hpp
Normal file
27
include/llmr/style/style_source.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef LLMR_STYLE_STYLE_SOURCE
|
||||
#define LLMR_STYLE_STYLE_SOURCE
|
||||
|
||||
#include <llmr/style/types.hpp>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
struct StyleSource {
|
||||
const SourceType type;
|
||||
const std::string url;
|
||||
const uint32_t tile_size;
|
||||
const int32_t min_zoom;
|
||||
const int32_t max_zoom;
|
||||
|
||||
StyleSource(SourceType type = SourceType::Vector,
|
||||
const std::string &url = "",
|
||||
uint32_t tile_size = 512, uint32_t min_zoom = 0,
|
||||
uint32_t max_zoom = 22)
|
||||
: type(type),
|
||||
url(url),
|
||||
tile_size(tile_size),
|
||||
min_zoom(min_zoom),
|
||||
max_zoom(max_zoom) {};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user