Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core, node, darwin, qt] Remove support for paint classes #8953

Merged
merged 6 commits into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions bin/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ int main(int argc, char *argv[]) {
static std::string output = "out.png";
std::string cache_file = "cache.sqlite";
std::string asset_root = ".";
std::vector<std::string> classes;
std::string token;
bool debug = false;

Expand All @@ -49,7 +48,6 @@ int main(int argc, char *argv[]) {
("width,w", po::value(&width)->value_name("pixels")->default_value(width), "Image width")
("height,h", po::value(&height)->value_name("pixels")->default_value(height), "Image height")
("ratio,r", po::value(&pixelRatio)->value_name("number")->default_value(pixelRatio), "Image scale factor")
("class,c", po::value(&classes)->value_name("name"), "Class name")
("token,t", po::value(&token)->value_name("key")->default_value(token), "Mapbox access token")
("debug", po::bool_switch(&debug)->default_value(debug), "Debug mode")
("output,o", po::value(&output)->value_name("file")->default_value(output), "Output file name")
Expand Down Expand Up @@ -95,9 +93,6 @@ int main(int argc, char *argv[]) {
}

map.setStyleURL(style_path);

map.setClasses(classes);

map.setLatLngZoom({ lat, lon }, zoom);
map.setBearing(bearing);
map.setPitch(pitch);
Expand Down
7 changes: 2 additions & 5 deletions cmake/core-files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ set(MBGL_CORE_FILES
src/mbgl/renderer/bucket.hpp
src/mbgl/renderer/bucket_parameters.cpp
src/mbgl/renderer/bucket_parameters.hpp
src/mbgl/renderer/cascade_parameters.hpp
src/mbgl/renderer/cross_faded_property_evaluator.cpp
src/mbgl/renderer/cross_faded_property_evaluator.hpp
src/mbgl/renderer/data_driven_property_evaluator.hpp
Expand Down Expand Up @@ -192,7 +191,7 @@ set(MBGL_CORE_FILES
src/mbgl/renderer/tile_parameters.hpp
src/mbgl/renderer/tile_pyramid.cpp
src/mbgl/renderer/tile_pyramid.hpp
src/mbgl/renderer/transitioning_property.hpp
src/mbgl/renderer/transition_parameters.hpp
src/mbgl/renderer/update_parameters.hpp

# renderer/buckets
Expand Down Expand Up @@ -329,8 +328,6 @@ set(MBGL_CORE_FILES
include/mbgl/style/transition_options.hpp
include/mbgl/style/types.hpp
include/mbgl/style/undefined.hpp
src/mbgl/style/class_dictionary.cpp
src/mbgl/style/class_dictionary.hpp
src/mbgl/style/image.cpp
src/mbgl/style/image_impl.cpp
src/mbgl/style/image_impl.hpp
Expand All @@ -343,11 +340,11 @@ set(MBGL_CORE_FILES
src/mbgl/style/light_impl.cpp
src/mbgl/style/light_impl.hpp
src/mbgl/style/light_observer.hpp
src/mbgl/style/light_properties.hpp
src/mbgl/style/observer.hpp
src/mbgl/style/paint_property.hpp
src/mbgl/style/parser.cpp
src/mbgl/style/parser.hpp
src/mbgl/style/properties.hpp
src/mbgl/style/rapidjson_conversion.hpp
src/mbgl/style/source.cpp
src/mbgl/style/source_impl.cpp
Expand Down
2 changes: 1 addition & 1 deletion cmake/test-files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ set(MBGL_TEST_FILES
test/style/function/source_function.test.cpp

# style
test/style/paint_property.test.cpp
test/style/properties.test.cpp
test/style/source.test.cpp
test/style/style.test.cpp
test/style/style_image.test.cpp
Expand Down
7 changes: 0 additions & 7 deletions include/mbgl/map/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,9 @@ class Map : private util::noncopyable {
void render(View&);

// Styling
void addClass(const std::string&);
void removeClass(const std::string&);
void setClasses(const std::vector<std::string>&);

style::TransitionOptions getTransitionOptions() const;
void setTransitionOptions(const style::TransitionOptions&);

bool hasClass(const std::string&) const;
std::vector<std::string> getClasses() const;

void setStyleURL(const std::string&);
void setStyleJSON(const std::string&);
std::string getStyleURL() const;
Expand Down
23 changes: 8 additions & 15 deletions include/mbgl/style/conversion/layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,23 @@ optional<Error> setLayoutProperty(Layer& layer, const std::string& name, const V
}

template <class V>
optional<Error> setPaintProperty(Layer& layer, const std::string& name, const V& value, const optional<std::string>& klass) {
optional<Error> setPaintProperty(Layer& layer, const std::string& name, const V& value) {
static const auto setters = makePaintPropertySetters<V>();
auto it = setters.find(name);
if (it == setters.end()) {
return Error { "property not found" };
}
return it->second(layer, value, klass);
return it->second(layer, value);
}

template <class V>
optional<Error> setPaintProperties(Layer& layer, const V& value) {
return eachMember(value, [&] (const std::string& paintName, const V& paintValue) -> optional<Error> {
if (paintName.compare(0, 5, "paint") != 0) {
return {};
}

optional<std::string> klass;
if (paintName.compare(0, 6, "paint.") == 0) {
klass = paintName.substr(6);
}

return eachMember(paintValue, [&] (const std::string& k, const V& v) {
return setPaintProperty(layer, k, v, klass);
});
auto paintValue = objectMember(value, "paint");
if (!paintValue) {
return {};
}
return eachMember(*paintValue, [&] (const std::string& k, const V& v) {
return setPaintProperty(layer, k, v);
});
}

Expand Down
Loading