Merge branch 'master' into stylesource

This commit is contained in:
Mike Morris
2014-07-10 17:21:20 -07:00
7 changed files with 57 additions and 5 deletions

View File

@@ -56,7 +56,6 @@ public:
void setAppliedClasses(const std::vector<std::string> &classes);
void toggleClass(const std::string &name);
const std::vector<std::string> &getAppliedClasses() const;
void setAppliedClasses(std::vector<std::string> &class_names);
void setDefaultTransitionDuration(uint64_t duration_milliseconds = 0);
void setStyleJSON(std::string newStyleJSON);
std::string getStyleJSON() const;

View File

@@ -405,10 +405,6 @@ const std::vector<std::string> &Map::getAppliedClasses() const {
return style->getAppliedClasses();
}
void Map::setAppliedClasses(std::vector<std::string> &class_names) {
style->setAppliedClasses(class_names);
}
void Map::setDefaultTransitionDuration(uint64_t duration_milliseconds) {
style->setDefaultTransitionDuration(duration_milliseconds);
}

View File

@@ -0,0 +1,13 @@
{
"default": {
"zoom": 14,
"center": [52.499167, 13.418056],
"height": 256
},
"colored": {
"zoom": 14,
"center": [52.499167, 13.418056],
"height": 256,
"classes": ["colored"]
}
}

View File

@@ -0,0 +1,33 @@
{
"version": 3,
"sources": {
"mapbox": {
"type": "vector",
"url": "tiles/{z}-{x}-{y}.vector.pbf",
"tileSize": 512,
"maxZoom": 14
}
},
"layers": [
{
"id": "background",
"type": "background",
"style": {
"background-color": "white"
}
},
{
"id": "road",
"source": "mapbox",
"source-layer": "road",
"type": "line",
"style": {
"line-width": 2,
"line-color": "#3590db"
},
"style.colored": {
"line-color": "#222222"
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -49,8 +49,19 @@ TEST_P(HeadlessTest, render) {
const double longitude = value.HasMember("center") ? value["center"][rapidjson::SizeType(1)].GetDouble() : 0;
const unsigned int width = value.HasMember("width") ? value["width"].GetUint() : 512;
const unsigned int height = value.HasMember("height") ? value["height"].GetUint() : 512;
std::vector<std::string> classes;
if (value.HasMember("classes")) {
const rapidjson::Value &js_classes = value["classes"];
ASSERT_EQ(true, js_classes.IsArray());
for (rapidjson::SizeType i = 0; i < js_classes.Size(); i++) {
const rapidjson::Value &js_class = js_classes[i];
ASSERT_EQ(true, js_class.IsString());
classes.push_back({ js_class.GetString(), js_class.GetStringLength() });
}
}
map.setStyleJSON(style);
map.setAppliedClasses(classes);
view.resize(width, height);
map.resize(width, height);