Skip to content

Commit

Permalink
Add fields_to_exclude to start_tile_feature()
Browse files Browse the repository at this point in the history
  • Loading branch information
Leith Bade committed Feb 5, 2015
1 parent ed514bf commit 4765a7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/vector_tile_backend_pbf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ namespace mapnik { namespace vector_tile_impl {
}
}

void start_tile_feature(mapnik::feature_impl const& feature)
{
void start_tile_feature(mapnik::feature_impl const& feature, std::vector<std::string> const& fields_to_exclude=std::vector<std::string>()) {
current_feature_ = current_layer_->add_features();
x_ = y_ = 0;

Expand All @@ -121,6 +120,11 @@ namespace mapnik { namespace vector_tile_impl {
mapnik::value const& val = MAPNIK_GET<1>(*itr);
if (!val.is_null())
{
// Skip if name is in fields_to_exclude
if (std::find(std::begin(fields_to_exclude), std::end(fields_to_exclude), name) != std::end(fields_to_exclude)) {
continue;
}

// Insert the key index
keys_container::const_iterator key_itr = keys_.find(name);
if (key_itr == keys_.end())
Expand Down
15 changes: 9 additions & 6 deletions src/vector_tile_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class processor : private MAPNIK_NONCOPYABLE
std::string image_format_;
scaling_method_e scaling_method_;
bool painted_;
std::vector<std::string> const& fields_to_exclude_;
public:
processor(T & backend,
mapnik::Map const& map,
Expand All @@ -87,17 +88,19 @@ class processor : private MAPNIK_NONCOPYABLE
unsigned offset_y=0,
unsigned tolerance=1,
std::string const& image_format="jpeg",
scaling_method_e scaling_method=SCALING_NEAR
scaling_method_e scaling_method=SCALING_NEAR,
std::vector<std::string> const& fields_to_exclude=std::vector<std::string>()
)
: backend_(backend),
m_(map),
m_req_(m_req),
scale_factor_(scale_factor),
t_(m_req.width(),m_req.height(),m_req.extent(),offset_x,offset_y),
tolerance_(tolerance),
image_format_(image_format),
scaling_method_(scaling_method),
painted_(false) {}
tolerance_(tolerance),
image_format_(image_format),
scaling_method_(scaling_method),
painted_(false),
fields_to_exclude_(fields_to_exclude) {}

void apply(double scale_denom=0.0)
{
Expand Down Expand Up @@ -358,7 +361,7 @@ class processor : private MAPNIK_NONCOPYABLE
feature = features->next();
continue;
}
backend_.start_tile_feature(*feature);
backend_.start_tile_feature(*feature, fields_to_exclude_);
BOOST_FOREACH( mapnik::geometry_type & geom, paths)
{
mapnik::box2d<double> geom_box = geom.envelope();
Expand Down

0 comments on commit 4765a7a

Please sign in to comment.