Permalink
Browse files

add method off style to check for active rules

  • Loading branch information...
1 parent 9b5189a commit 1b3dcda87d8408c4351cfa32e605f0b4b207051f Dane Springmeyer committed Sep 14, 2012
Showing with 18 additions and 3 deletions.
  1. +3 −3 include/mapnik/feature_type_style.hpp
  2. +15 −0 src/feature_type_style.cpp
@@ -72,17 +72,17 @@ class MAPNIK_DECL feature_type_style
feature_type_style& operator=(feature_type_style const& rhs);
void add_rule(rule const& rule);
-
rules const& get_rules() const;
rule_ptrs const& get_if_rules(double scale_denom);
rule_ptrs const& get_else_rules(double scale_denom);
rule_ptrs const& get_also_rules(double scale_denom);
-
rules& get_rules_nonconst();
- void set_filter_mode(filter_mode_e mode);
+ bool active(double scale_denom) const;
+ void set_filter_mode(filter_mode_e mode);
filter_mode_e get_filter_mode() const;
+
// filters
std::vector<filter::filter_type> const& image_filters() const;
std::vector<filter::filter_type> & image_filters();
View
@@ -22,6 +22,9 @@
#include <mapnik/feature_type_style.hpp>
+// boost
+#include <boost/foreach.hpp>
+
namespace mapnik
{
@@ -89,6 +92,18 @@ rules& feature_type_style::get_rules_nonconst()
return rules_;
}
+bool feature_type_style::active(double scale_denom) const
+{
+ BOOST_FOREACH(rule const& r, rules_)
+ {
+ if (r.active(scale_denom))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
void feature_type_style::set_filter_mode(filter_mode_e mode)
{
filter_mode_ = mode;

0 comments on commit 1b3dcda

Please sign in to comment.