summaryrefslogtreecommitdiff
path: root/src/style/style.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-12-04 18:29:42 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-12-04 20:02:50 +0100
commitabafb52f37beb5659efc2105ccd1568e1f754898 (patch)
tree6a60636d3497560ca61e5aae5f6d7061c4f18553 /src/style/style.cpp
parentbff6aeb4da41dee1f5f1cfa0be81b6c257257253 (diff)
downloadqtlocation-mapboxgl-abafb52f37beb5659efc2105ccd1568e1f754898.tar.gz
make most headers private
Diffstat (limited to 'src/style/style.cpp')
-rw-r--r--src/style/style.cpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/src/style/style.cpp b/src/style/style.cpp
deleted file mode 100644
index 15ca4e14fb..0000000000
--- a/src/style/style.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-#include <mbgl/style/style.hpp>
-#include <mbgl/map/sprite.hpp>
-#include <mbgl/style/style_layer_group.hpp>
-#include <mbgl/style/style_parser.hpp>
-#include <mbgl/style/style_bucket.hpp>
-#include <mbgl/util/constants.hpp>
-#include <mbgl/util/time.hpp>
-#include <mbgl/util/error.hpp>
-#include <mbgl/util/std.hpp>
-#include <mbgl/util/uv_detail.hpp>
-#include <csscolorparser/csscolorparser.hpp>
-
-#include <rapidjson/document.h>
-
-#include <algorithm>
-
-namespace mbgl {
-
-Style::Style()
- : mtx(util::make_unique<uv::rwlock>()) {
-}
-
-// Note: This constructor is seemingly empty, but we need to declare it anyway
-// because this file includes uv_detail.hpp, which has the declarations necessary
-// for deleting the std::unique_ptr<uv::rwlock>.
-Style::~Style() {}
-
-void Style::updateProperties(float z, timestamp now) {
- uv::writelock lock(mtx);
-
- if (layers) {
- layers->updateProperties(z, now);
- }
-
- // Apply transitions after the first time.
- if (!initial_render_complete) {
- initial_render_complete = true;
- return;
- }
-}
-
-const std::string &Style::getSpriteURL() const {
- return sprite_url;
-}
-
-void Style::setDefaultTransitionDuration(uint16_t duration_milliseconds) {
- defaultTransition.duration = duration_milliseconds;
-}
-
-const std::vector<std::string> &Style::getAppliedClasses() const {
- return appliedClasses;
-}
-
-void Style::setAppliedClasses(const std::vector<std::string> &class_names) {
- appliedClasses = class_names;
- updateClasses();
-}
-
-void Style::toggleClass(const std::string &name) {
- if (name.length()) {
- auto it = std::find(appliedClasses.begin(), appliedClasses.end(), name);
- if (it == appliedClasses.end()) {
- appliedClasses.push_back(name);
- } else {
- appliedClasses.erase(it);
- }
- }
-
- updateClasses();
-}
-
-void Style::updateClasses() {
- if (layers) {
- layers->setClasses(appliedClasses, util::now(), defaultTransition);
- }
-}
-
-bool Style::hasTransitions() const {
- if (layers) {
- if (layers->hasTransitions()) {
- return true;
- }
- }
- return false;
-}
-
-
-void Style::loadJSON(const uint8_t *const data) {
- uv::writelock lock(mtx);
-
- rapidjson::Document doc;
- doc.Parse<0>((const char *const)data);
- if (doc.HasParseError()) {
- throw error::style_parse(doc.GetErrorOffset(), doc.GetParseError());
- }
-
- StyleParser parser;
- parser.parse(doc);
-
- layers = parser.getLayers();
- sprite_url = parser.getSprite();
- glyph_url = parser.getGlyphURL();
-
- updateClasses();
-}
-
-}