Skip to content

Commit

Permalink
add method off style to check for active rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Sep 14, 2012
1 parent 9b5189a commit 1b3dcda
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/mapnik/feature_type_style.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 15 additions & 0 deletions src/feature_type_style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#include <mapnik/feature_type_style.hpp>

// boost
#include <boost/foreach.hpp>

namespace mapnik
{

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1b3dcda

Please sign in to comment.