summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-04-27 15:57:48 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-02 14:51:39 -0700
commit67ee51360c1bf72d54544cecb8d8fd638ad4df14 (patch)
treebb6275dc6e667e2b14d97e9fd640bcc9240a6a6a /include
parentcadc617c762d453cca2c9bac41f9c1db984c5fac (diff)
downloadqtlocation-mapboxgl-67ee51360c1bf72d54544cecb8d8fd638ad4df14.tar.gz
[core] Add Filter accessors
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/layer/background_layer.hpp1
-rw-r--r--include/mbgl/layer/circle_layer.hpp4
-rw-r--r--include/mbgl/layer/fill_layer.hpp4
-rw-r--r--include/mbgl/layer/line_layer.hpp4
-rw-r--r--include/mbgl/layer/raster_layer.hpp1
-rw-r--r--include/mbgl/layer/symbol_layer.hpp4
-rw-r--r--include/mbgl/style/filter.hpp103
-rw-r--r--include/mbgl/util/variant.hpp10
8 files changed, 131 insertions, 0 deletions
diff --git a/include/mbgl/layer/background_layer.hpp b/include/mbgl/layer/background_layer.hpp
index 211597f6ea..bba16d3839 100644
--- a/include/mbgl/layer/background_layer.hpp
+++ b/include/mbgl/layer/background_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
namespace mbgl {
diff --git a/include/mbgl/layer/circle_layer.hpp b/include/mbgl/layer/circle_layer.hpp
index 28e5c2fa7a..81f84d36a8 100644
--- a/include/mbgl/layer/circle_layer.hpp
+++ b/include/mbgl/layer/circle_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
namespace mbgl {
@@ -18,6 +19,9 @@ public:
const std::string& getSourceID() const;
const std::string& getSourceLayer() const;
+ void setFilter(const Filter&);
+ const Filter& getFilter() const;
+
// Paint properties
PropertyValue<float> getCircleRadius() const;
diff --git a/include/mbgl/layer/fill_layer.hpp b/include/mbgl/layer/fill_layer.hpp
index 76c043957d..10cf4f3bbd 100644
--- a/include/mbgl/layer/fill_layer.hpp
+++ b/include/mbgl/layer/fill_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
namespace mbgl {
@@ -18,6 +19,9 @@ public:
const std::string& getSourceID() const;
const std::string& getSourceLayer() const;
+ void setFilter(const Filter&);
+ const Filter& getFilter() const;
+
// Paint properties
PropertyValue<bool> getFillAntialias() const;
diff --git a/include/mbgl/layer/line_layer.hpp b/include/mbgl/layer/line_layer.hpp
index b438799116..aeec363281 100644
--- a/include/mbgl/layer/line_layer.hpp
+++ b/include/mbgl/layer/line_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
#include <vector>
@@ -20,6 +21,9 @@ public:
const std::string& getSourceID() const;
const std::string& getSourceLayer() const;
+ void setFilter(const Filter&);
+ const Filter& getFilter() const;
+
// Layout properties
PropertyValue<LineCapType> getLineCap() const;
diff --git a/include/mbgl/layer/raster_layer.hpp b/include/mbgl/layer/raster_layer.hpp
index 5d747737c0..7dc2532a2f 100644
--- a/include/mbgl/layer/raster_layer.hpp
+++ b/include/mbgl/layer/raster_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
namespace mbgl {
diff --git a/include/mbgl/layer/symbol_layer.hpp b/include/mbgl/layer/symbol_layer.hpp
index 2339515201..006506b3d8 100644
--- a/include/mbgl/layer/symbol_layer.hpp
+++ b/include/mbgl/layer/symbol_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
#include <vector>
@@ -20,6 +21,9 @@ public:
const std::string& getSourceID() const;
const std::string& getSourceLayer() const;
+ void setFilter(const Filter&);
+ const Filter& getFilter() const;
+
// Layout properties
PropertyValue<SymbolPlacementType> getSymbolPlacement() const;
diff --git a/include/mbgl/style/filter.hpp b/include/mbgl/style/filter.hpp
new file mode 100644
index 0000000000..6ad6969fbf
--- /dev/null
+++ b/include/mbgl/style/filter.hpp
@@ -0,0 +1,103 @@
+#pragma once
+
+#include <mbgl/util/variant.hpp>
+#include <mbgl/util/feature.hpp>
+
+#include <string>
+#include <vector>
+
+namespace mbgl {
+
+typedef variant<
+ class NullFilter,
+ class EqualsFilter,
+ class NotEqualsFilter,
+ class LessThanFilter,
+ class LessThanEqualsFilter,
+ class GreaterThanFilter,
+ class GreaterThanEqualsFilter,
+ class InFilter,
+ class NotInFilter,
+ class AnyFilter,
+ class AllFilter,
+ class NoneFilter,
+ class HasFilter,
+ class NotHasFilter
+ > Filter;
+
+class NullFilter {};
+
+class EqualsFilter {
+public:
+ std::string key;
+ Value value;
+};
+
+class NotEqualsFilter {
+public:
+ std::string key;
+ Value value;
+};
+
+class LessThanFilter {
+public:
+ std::string key;
+ Value value;
+};
+
+class LessThanEqualsFilter {
+public:
+ std::string key;
+ Value value;
+};
+
+class GreaterThanFilter {
+public:
+ std::string key;
+ Value value;
+};
+
+class GreaterThanEqualsFilter {
+public:
+ std::string key;
+ Value value;
+};
+
+class InFilter {
+public:
+ std::string key;
+ std::vector<Value> values;
+};
+
+class NotInFilter {
+public:
+ std::string key;
+ std::vector<Value> values;
+};
+
+class AnyFilter {
+public:
+ std::vector<Filter> filters;
+};
+
+class AllFilter {
+public:
+ std::vector<Filter> filters;
+};
+
+class NoneFilter {
+public:
+ std::vector<Filter> filters;
+};
+
+class HasFilter {
+public:
+ std::string key;
+};
+
+class NotHasFilter {
+public:
+ std::string key;
+};
+
+} // namespace mbgl
diff --git a/include/mbgl/util/variant.hpp b/include/mbgl/util/variant.hpp
new file mode 100644
index 0000000000..68a1208a17
--- /dev/null
+++ b/include/mbgl/util/variant.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <mapbox/variant.hpp>
+
+namespace mbgl {
+
+template <typename... T>
+using variant = mapbox::util::variant<T...>;
+
+} // namespace mbgl