Skip to content

Commit

Permalink
+ support attribute collection policy accross renderer backends
Browse files Browse the repository at this point in the history
  • Loading branch information
artemp committed Dec 13, 2012
1 parent dd32714 commit 7ded35e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
4 changes: 4 additions & 0 deletions include/mapnik/agg_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T>
};

void painted(bool painted);
inline eAttributeCollectionPolicy attribute_collection_policy() const
{
return DEFAULT;
}

protected:
template <typename R>
Expand Down
5 changes: 5 additions & 0 deletions include/mapnik/cairo_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ class MAPNIK_DECL cairo_renderer_base : private boost::noncopyable
// nothing to do
}

inline eAttributeCollectionPolicy attribute_collection_policy() const
{
return DEFAULT;
}

void render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & mtx, double opacity=1.0, bool recenter=true);
void render_box(box2d<double> const& b);
protected:
Expand Down
23 changes: 15 additions & 8 deletions include/mapnik/feature_style_processor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,20 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
// Don't even try to do more work if there are no active styles.
if (active_styles.size() > 0)
{
// push all property names
BOOST_FOREACH(std::string const& name, names)
if (p.attribute_collection_policy() == COLLECT_ALL)
{
q.add_property_name(name);
layer_descriptor lay_desc = ds->get_descriptor();
BOOST_FOREACH(attribute_descriptor const& desc, lay_desc.get_descriptors())
{
q.add_property_name(desc.get_name());
}
}
else
{
BOOST_FOREACH(std::string const& name, names)
{
q.add_property_name(name);
}
}

// Update filter_factor for all enabled raster layers.
Expand All @@ -397,14 +407,11 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
ds->type() == datasource::Raster &&
ds->params().get<double>("filter_factor",0.0) == 0.0)
{
rule::symbolizers const& symbols = r.get_symbolizers();
rule::symbolizers::const_iterator symIter = symbols.begin();
rule::symbolizers::const_iterator symEnd = symbols.end();
while (symIter != symEnd)
BOOST_FOREACH (rule::symbolizers::value_type sym, r.get_symbolizers())
{
// if multiple raster symbolizers, last will be respected
// should we warn or throw?
boost::apply_visitor(d_collector,*symIter++);
boost::apply_visitor(d_collector,sym);
}
q.set_filter_factor(filt_factor);
}
Expand Down
4 changes: 4 additions & 0 deletions include/mapnik/grid/grid_renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class MAPNIK_DECL grid_renderer : public feature_style_processor<grid_renderer<T
{
pixmap_.painted(painted);
}
inline eAttributeCollectionPolicy attribute_collection_policy() const
{
return DEFAULT;
}

private:
buffer_type & pixmap_;
Expand Down

0 comments on commit 7ded35e

Please sign in to comment.