Merge branch 'master' into stylesource
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
13
test/fixtures/styles/line-color.info.json
vendored
Normal file
13
test/fixtures/styles/line-color.info.json
vendored
Normal 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"]
|
||||
}
|
||||
}
|
||||
33
test/fixtures/styles/line-color.style.json
vendored
Normal file
33
test/fixtures/styles/line-color.style.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
test/fixtures/styles/line-color/colored.expected.png
vendored
Normal file
BIN
test/fixtures/styles/line-color/colored.expected.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
BIN
test/fixtures/styles/line-color/default.expected.png
vendored
Normal file
BIN
test/fixtures/styles/line-color/default.expected.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user