address #1198 by moving away from caching grid features and (back) to copying attributes - also roll back to passing feature_impl& rather than feature_ptr (which is now unneeded)

This commit is contained in:
Dane Springmeyer 2012-06-15 22:17:26 -04:00
parent 7da01b9605
commit bd7ad7cd3c
28 changed files with 238 additions and 205 deletions

View file

@ -75,38 +75,38 @@ public:
double opacity, composite_mode_e comp_op);
void process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(line_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(line_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(polygon_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(polygon_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(raster_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(shield_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(text_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(building_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(markers_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
inline bool process(rule::symbolizers const& /*syms*/,
mapnik::feature_ptr const& /*feature*/,
mapnik::feature_impl & /*feature*/,
proj_transform const& /*prj_trans*/)
{
// agg renderer doesn't support processing of multiple symbolizers.

View file

@ -83,37 +83,37 @@ public:
void start_style_processing(feature_type_style const& st);
void end_style_processing(feature_type_style const& st);
void process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(line_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(line_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(polygon_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(polygon_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(raster_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(shield_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(text_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(building_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(markers_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
inline bool process(rule::symbolizers const& /*syms*/,
mapnik::feature_ptr const& /*feature*/,
mapnik::feature_impl & /*feature*/,
proj_transform const& /*prj_trans*/)
{
// cairo renderer doesn't support processing of multiple symbolizers.

View file

@ -187,6 +187,16 @@ public:
return data_.size();
}
cont_type const& get_data() const
{
return data_;
}
void set_data(cont_type const& data)
{
data_ = data;
}
context_ptr context()
{
return ctx_;

View file

@ -32,6 +32,7 @@
#include <mapnik/global.hpp>
#include <mapnik/value.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
// boost
#include <boost/cstdint.hpp>
@ -70,6 +71,7 @@ private:
std::set<std::string> names_;
feature_key_type f_keys_;
feature_type features_;
mapnik::context_ptr ctx_;
public:
@ -83,7 +85,8 @@ public:
painted_(false),
names_(),
f_keys_(),
features_()
features_(),
ctx_(boost::make_shared<mapnik::context_type>())
{
// this only works if each datasource's
// feature count starts at 1
@ -100,7 +103,8 @@ public:
painted_(rhs.painted_),
names_(rhs.names_),
f_keys_(rhs.f_keys_),
features_(rhs.features_)
features_(rhs.features_),
ctx_(rhs.ctx_)
{
f_keys_[0] = "";
}
@ -122,23 +126,37 @@ public:
return id_name_;
}
inline void add_feature(mapnik::feature_ptr const& feature)
inline void add_feature(mapnik::feature_impl & feature)
{
// avoid adding duplicate features (e.g. in the case of both a line symbolizer and a polygon symbolizer)
typename feature_key_type::const_iterator feature_pos = f_keys_.find(feature.id());
if (feature_pos != f_keys_.end())
{
return;
}
if (ctx_->size() == 0) {
mapnik::feature_impl::iterator itr = feature.begin();
mapnik::feature_impl::iterator end = feature.end();
for ( ;itr!=end; ++itr)
{
ctx_->push(boost::get<0>(*itr));
}
}
// NOTE: currently lookup keys must be strings,
// but this should be revisited
boost::optional<lookup_type> lookup_value;
if (key_ == id_name_)
{
std::stringstream s;
s << feature->id();
s << feature.id();
lookup_value = s.str();
}
else
{
if (feature->has_key(key_))
if (feature.has_key(key_))
{
lookup_value = feature->get(key_).to_string();
lookup_value = feature.get(key_).to_string();
}
else
{
@ -150,16 +168,21 @@ public:
{
// TODO - consider shortcutting f_keys if feature_id == lookup_value
// create a mapping between the pixel id and the feature key
f_keys_.insert(std::make_pair(feature->id(),*lookup_value));
f_keys_.insert(std::make_pair(feature.id(),*lookup_value));
// if extra fields have been supplied, push them into grid memory
if (!names_.empty())
{
features_.insert(std::make_pair(*lookup_value,feature));
// it is ~ 2x faster to copy feature attributes compared
// to building up a in-memory cache of feature_ptrs
// https://github.com/mapnik/mapnik/issues/1198
mapnik::feature_ptr feature2(mapnik::feature_factory::create(ctx_,feature.id()));
feature2->set_data(feature.get_data());
features_.insert(std::make_pair(*lookup_value,feature2));
}
}
else
{
MAPNIK_LOG_DEBUG(grid) << "hit_grid: Warning - key '" << key_ << "' was blank for " << *feature;
MAPNIK_LOG_DEBUG(grid) << "hit_grid: Warning - key '" << key_ << "' was blank for " << feature;
}
}

View file

@ -65,40 +65,40 @@ public:
void end_layer_processing(layer const& lay);
void start_style_processing(feature_type_style const& st) {}
void end_style_processing(feature_type_style const& st) {}
void render_marker(mapnik::feature_ptr const& feature, unsigned int step, pixel_position const& pos, marker const& marker, const agg::trans_affine & tr, double opacity);
void render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, const agg::trans_affine & tr, double opacity);
void process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(line_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(line_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(polygon_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(polygon_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(raster_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(shield_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(text_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(building_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
void process(markers_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans);
inline bool process(rule::symbolizers const& /*syms*/,
mapnik::feature_ptr const& /*feature*/,
mapnik::feature_impl & /*feature*/,
proj_transform const& /*prj_trans*/)
{
// grid renderer doesn't support processing of multiple symbolizers.

View file

@ -44,7 +44,7 @@ namespace mapnik
template <typename T>
void agg_renderer<T>::process(building_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -70,13 +70,13 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
expression_ptr height_expr = sym.height();
if (height_expr)
{
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature), *height_expr);
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr);
height = result.to_double() * scale_factor_;
}
for (unsigned i=0;i<feature->num_geometries();++i)
for (unsigned i=0;i<feature.num_geometries();++i)
{
geometry_type const& geom = feature->get_geometry(i);
geometry_type const& geom = feature.get_geometry(i);
if (geom.num_points() > 2)
{
boost::scoped_ptr<geometry_type> frame(new geometry_type(LineString));
@ -158,7 +158,7 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(building_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -51,7 +51,7 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::rgba8 color;
@ -65,7 +65,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
typedef agg::renderer_outline_image<renderer_base, pattern_type> renderer_type;
typedef agg::rasterizer_outline_aa<renderer_type> rasterizer_type;
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
boost::optional<marker_ptr> mark = marker_cache::instance()->find(filename,true);
if (!mark) return;
@ -95,7 +95,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
rasterizer_type ras(ren);
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
typedef boost::mpl::vector<clip_line_tag,transform_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, rasterizer_type, line_pattern_symbolizer,
@ -106,7 +106,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
converter.set<transform_tag>(); //always transform
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH(geometry_type & geom, feature->paths())
BOOST_FOREACH(geometry_type & geom, feature.paths())
{
if (geom.num_points() > 1)
{
@ -116,7 +116,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(line_pattern_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -50,7 +50,7 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(line_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
@ -77,7 +77,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
renderer_base renb(pixf);
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
if (sym.get_rasterizer() == RASTERIZER_FAST)
{
@ -104,7 +104,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
if (stroke_.has_dash()) converter.set<dash_tag>();
converter.set<stroke_tag>(); //always stroke
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 1)
{
@ -127,7 +127,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
if (stroke_.has_dash()) converter.set<dash_tag>();
converter.set<stroke_tag>(); //always stroke
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 1)
{
@ -147,7 +147,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
template void agg_renderer<image_32>::process(line_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -50,7 +50,7 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(markers_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
@ -73,9 +73,9 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
renderer_base renb(pixf);
renderer_type ren(renb);
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_image_transform());
evaluate_transform(tr, feature, sym.get_image_transform());
tr = agg::trans_affine_scaling(scale_factor_) * tr;
std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
marker_placement_e placement_method = sym.get_marker_placement();
marker_type_e marker_type = sym.get_marker_type();
metawriter_with_properties writer = sym.get_metawriter();
@ -108,9 +108,9 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
renderer_type,
agg::pixfmt_rgba32 > svg_renderer(svg_path,(*marker)->attributes());
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
// TODO - merge this code with point_symbolizer rendering
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
{
@ -136,7 +136,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
//if (!sym.get_ignore_placement())
// detector_->insert(label_ext);
metawriter_with_properties writer = sym.get_metawriter();
if (writer.first) writer.first->add_box(extent, *feature, t_, writer.second);
if (writer.first) writer.first->add_box(extent, feature, t_, writer.second);
}
}
else
@ -237,9 +237,9 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
agg::path_storage marker;
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
//if (geom.num_points() <= 1) continue;
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
{
@ -274,7 +274,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
}
if (!sym.get_ignore_placement())
detector_->insert(label_ext);
if (writer.first) writer.first->add_box(label_ext, *feature, t_, writer.second);
if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second);
}
}
else
@ -347,6 +347,6 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(markers_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -46,10 +46,10 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
boost::optional<mapnik::marker_ptr> marker;
if ( !filename.empty() )
@ -67,15 +67,15 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
coord2d const center = bbox.center();
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_image_transform());
evaluate_transform(tr, feature, sym.get_image_transform());
agg::trans_affine_translation const recenter(-center.x, -center.y);
agg::trans_affine const recenter_tr = recenter * tr;
box2d<double> label_ext = bbox * recenter_tr;
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type const& geom = feature->get_geometry(i);
geometry_type const& geom = feature.get_geometry(i);
double x;
double y;
double z=0;
@ -101,7 +101,7 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
if (!sym.get_ignore_placement())
detector_->insert(label_ext);
metawriter_with_properties writer = sym.get_metawriter();
if (writer.first) writer.first->add_box(label_ext, *feature, t_, writer.second);
if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second);
}
}
}
@ -109,7 +109,7 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(point_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -49,7 +49,7 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
@ -59,7 +59,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
ras_ptr->reset();
set_gamma_method(sym,ras_ptr);
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
boost::optional<mapnik::marker_ptr> marker;
if ( !filename.empty() )
{
@ -120,9 +120,9 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
{
double x0 = 0;
double y0 = 0;
if (feature->num_geometries() > 0)
if (feature.num_geometries() > 0)
{
clipped_geometry_type clipped(feature->get_geometry(0));
clipped_geometry_type clipped(feature.get_geometry(0));
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
path_type path(t_,clipped,prj_trans);
path.vertex(&x0,&y0);
@ -137,7 +137,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
renderer_type rp(renb,sa, sg);
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
box2d<double> inflated_extent = query_extent_ * 1.0;
typedef boost::mpl::vector<clip_poly_tag,transform_tag,smooth_tag> conv_types;
@ -149,7 +149,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
converter.set<transform_tag>(); //always transform
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 2)
{
@ -162,7 +162,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
template void agg_renderer<image_32>::process(polygon_pattern_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -41,7 +41,7 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(polygon_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
@ -51,7 +51,7 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
box2d<double> inflated_extent = query_extent_ * 1.0;
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, rasterizer, polygon_symbolizer,
@ -63,7 +63,7 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
converter.set<affine_transform_tag>();
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 2)
{
@ -97,7 +97,7 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(polygon_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -41,16 +41,16 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(raster_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
raster_ptr const& source=feature->get_raster();
raster_ptr const& source=feature.get_raster();
if (source)
{
// If there's a colorizer defined, use it to color the raster in-place
raster_colorizer_ptr colorizer = sym.get_colorizer();
if (colorizer)
colorizer->colorize(source,*feature);
colorizer->colorize(source,feature);
box2d<double> target_ext = box2d<double>(source->ext_);
prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS);
@ -83,7 +83,7 @@ void agg_renderer<T>::process(raster_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(raster_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -36,12 +36,12 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(shield_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
shield_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, *feature, prj_trans,
sym, feature, prj_trans,
width_, height_,
scale_factor_,
t_, font_manager_, *detector_, query_extent_);
@ -74,7 +74,7 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
template void agg_renderer<image_32>::process(shield_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -29,12 +29,12 @@ namespace mapnik {
template <typename T>
void agg_renderer<T>::process(text_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
text_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, *feature, prj_trans,
sym, feature, prj_trans,
detector_->extent().width(), detector_->extent().height(),
scale_factor_,
t_, font_manager_, *detector_, query_extent_);
@ -53,7 +53,7 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
}
template void agg_renderer<image_32>::process(text_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -826,7 +826,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(polygon_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
cairo_context context(context_);
@ -834,7 +834,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
context.set_color(sym.get_fill(), sym.get_opacity());
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, cairo_context, polygon_symbolizer,
@ -846,7 +846,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
converter.set<affine_transform_tag>();
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 2)
{
@ -858,7 +858,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(building_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -870,13 +870,13 @@ void cairo_renderer_base::start_map_processing(Map const& map)
expression_ptr height_expr = sym.height();
if (height_expr)
{
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature), *height_expr);
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr);
height = result.to_double(); //scale_factor is always 1.0 atm
}
for (unsigned i = 0; i < feature->num_geometries(); ++i)
for (unsigned i = 0; i < feature.num_geometries(); ++i)
{
geometry_type const& geom = feature->get_geometry(i);
geometry_type const& geom = feature.get_geometry(i);
if (geom.num_points() > 2)
{
@ -967,7 +967,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(line_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
cairo_context context(context_);
@ -985,7 +985,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
typedef boost::mpl::vector<clip_line_tag,transform_tag, offset_transform_tag, affine_transform_tag, smooth_tag> conv_types;
vertex_converter<box2d<double>, cairo_context, line_symbolizer,
@ -999,7 +999,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
converter.set<affine_transform_tag>(); // optional affine transform
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 1)
{
@ -1123,10 +1123,10 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
boost::optional<marker_ptr> marker;
if ( !filename.empty() )
@ -1139,13 +1139,13 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
agg::trans_affine mtx;
evaluate_transform(mtx, *feature, sym.get_image_transform());
evaluate_transform(mtx, feature, sym.get_image_transform());
if (marker)
{
for (unsigned i = 0; i < feature->num_geometries(); ++i)
for (unsigned i = 0; i < feature.num_geometries(); ++i)
{
geometry_type const& geom = feature->get_geometry(i);
geometry_type const& geom = feature.get_geometry(i);
double x;
double y;
double z = 0;
@ -1174,7 +1174,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
metawriter_with_properties writer = sym.get_metawriter();
if (writer.first)
{
writer.first->add_box(label_ext, *feature, t_, writer.second);
writer.first->add_box(label_ext, feature, t_, writer.second);
}
}
}
@ -1182,12 +1182,12 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(shield_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
shield_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, *feature, prj_trans,
sym, feature, prj_trans,
detector_.extent().width(), detector_.extent().height(),
1.0 /*scale_factor*/,
t_, font_manager_, detector_, query_extent_);
@ -1209,13 +1209,13 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(line_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance()->find(filename,true);
if (!marker && !(*marker)->is_bitmap()) return;
@ -1230,9 +1230,9 @@ void cairo_renderer_base::start_map_processing(Map const& map)
pattern.set_filter(Cairo::FILTER_BILINEAR);
context.set_line_width(height);
for (unsigned i = 0; i < feature->num_geometries(); ++i)
for (unsigned i = 0; i < feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (geom.num_points() > 1)
{
@ -1283,13 +1283,13 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
cairo_context context(context_);
context.set_operator(sym.comp_op());
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance()->find(filename,true);
if (!marker && !(*marker)->is_bitmap()) return;
@ -1300,7 +1300,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
context.set_pattern(pattern);
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_transform());
evaluate_transform(tr, feature, sym.get_transform());
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, cairo_context, polygon_pattern_symbolizer,
@ -1312,7 +1312,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
converter.set<affine_transform_tag>();
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
BOOST_FOREACH( geometry_type & geom, feature->paths())
BOOST_FOREACH( geometry_type & geom, feature.paths())
{
if (geom.num_points() > 2)
{
@ -1325,16 +1325,16 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(raster_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
raster_ptr const& source = feature->get_raster();
raster_ptr const& source = feature.get_raster();
if (source)
{
// If there's a colorizer defined, use it to color the raster in-place
raster_colorizer_ptr colorizer = sym.get_colorizer();
if (colorizer)
colorizer->colorize(source,*feature);
colorizer->colorize(source,feature);
box2d<double> target_ext = box2d<double>(source->ext_);
prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS);
@ -1370,7 +1370,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(markers_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
cairo_context context(context_);
@ -1381,11 +1381,11 @@ void cairo_renderer_base::start_map_processing(Map const& map)
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_image_transform());
evaluate_transform(tr, feature, sym.get_image_transform());
// TODO - use this?
//tr = agg::trans_affine_scaling(scale_factor_) * tr;
std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
marker_placement_e placement_method = sym.get_marker_placement();
marker_type_e marker_type = sym.get_marker_type();
metawriter_with_properties writer = sym.get_metawriter();
@ -1416,9 +1416,9 @@ void cairo_renderer_base::start_map_processing(Map const& map)
box2d<double> extent(x1,y1,x2,y2);
using namespace mapnik::svg;
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
// TODO - merge this code with point_symbolizer rendering
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
{
@ -1439,7 +1439,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
//if (!sym.get_ignore_placement())
// detector_.insert(label_ext);
metawriter_with_properties writer = sym.get_metawriter();
if (writer.first) writer.first->add_box(extent, *feature, t_, writer.second);
if (writer.first) writer.first->add_box(extent, feature, t_, writer.second);
}
}
else
@ -1514,9 +1514,9 @@ void cairo_renderer_base::start_map_processing(Map const& map)
agg::path_storage marker;
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
{
geom.label_position(&x,&y);
@ -1548,7 +1548,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
if (!sym.get_ignore_placement())
detector_.insert(label_ext);
if (writer.first) writer.first->add_box(label_ext, *feature, t_, writer.second);
if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second);
}
}
else
@ -1614,10 +1614,10 @@ void cairo_renderer_base::start_map_processing(Map const& map)
}
void cairo_renderer_base::process(text_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
text_symbolizer_helper<face_manager<freetype_engine>, label_collision_detector4> helper(sym, *feature, prj_trans, detector_.extent().width(), detector_.extent().height(), 1.0 /*scale_factor*/, t_, font_manager_, detector_, query_extent_);
text_symbolizer_helper<face_manager<freetype_engine>, label_collision_detector4> helper(sym, feature, prj_trans, detector_.extent().width(), detector_.extent().height(), 1.0 /*scale_factor*/, t_, font_manager_, detector_, query_extent_);
cairo_context context(context_);
context.set_operator(sym.comp_op());

View file

@ -62,7 +62,7 @@ template <bool>
struct process_impl
{
template <typename T0, typename T1, typename T2, typename T3>
static void process(T0 & ren, T1 const& sym, T2 const& f, T3 const& tr)
static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr)
{
ren.process(sym,f,tr);
}
@ -72,7 +72,7 @@ template <> // No-op specialization
struct process_impl<false>
{
template <typename T0, typename T1, typename T2, typename T3>
static void process(T0 & ren, T1 const& sym, T2 const& f, T3 const& tr)
static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr)
{
boost::ignore_unused_variable_warning(ren);
boost::ignore_unused_variable_warning(f);
@ -93,7 +93,7 @@ template <typename Processor>
struct feature_style_processor<Processor>::symbol_dispatch : public boost::static_visitor<>
{
symbol_dispatch (Processor & output,
mapnik::feature_ptr const& f,
mapnik::feature_impl & f,
proj_transform const& prj_trans)
: output_(output),
f_(f),
@ -106,14 +106,14 @@ struct feature_style_processor<Processor>::symbol_dispatch : public boost::stati
}
Processor & output_;
mapnik::feature_ptr const& f_;
mapnik::feature_impl & f_;
proj_transform const& prj_trans_;
};
typedef char (&no_tag)[1];
typedef char (&yes_tag)[2];
template <typename T0, typename T1, void (T0::*)(T1 const&, mapnik::feature_ptr const&, proj_transform const&) >
template <typename T0, typename T1, void (T0::*)(T1 const&, mapnik::feature_impl &, proj_transform const&) >
struct process_memfun_helper {};
template <typename T0, typename T1> no_tag has_process_helper(...);
@ -556,12 +556,12 @@ void feature_style_processor<Processor>::render_style(
// if the underlying renderer is not able to process the complete set of symbolizers,
// process one by one.
if(!p.process(symbols,feature,prj_trans))
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
{
boost::apply_visitor(symbol_dispatch(p,feature,prj_trans),sym);
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
}
if (style->get_filter_mode() == FILTER_FIRST)
@ -584,11 +584,11 @@ void feature_style_processor<Processor>::render_style(
rule::symbolizers const& symbols = r->get_symbolizers();
// if the underlying renderer is not able to process the complete set of symbolizers,
// process one by one.
if(!p.process(symbols,feature,prj_trans))
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
{
boost::apply_visitor(symbol_dispatch(p,feature,prj_trans),sym);
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
}
}
@ -606,11 +606,11 @@ void feature_style_processor<Processor>::render_style(
rule::symbolizers const& symbols = r->get_symbolizers();
// if the underlying renderer is not able to process the complete set of symbolizers,
// process one by one.
if(!p.process(symbols,feature,prj_trans))
if(!p.process(symbols,*feature,prj_trans))
{
BOOST_FOREACH (symbolizer const& sym, symbols)
{
boost::apply_visitor(symbol_dispatch(p,feature,prj_trans),sym);
boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym);
}
}
}

View file

@ -100,7 +100,7 @@ void grid_renderer<T>::end_layer_processing(layer const&)
}
template <typename T>
void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigned int step, pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity)
void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity)
{
if (marker.is_vector())
{
@ -135,7 +135,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigne
mapnik::pixfmt_gray32> svg_renderer(svg_path,
(*marker.get_vector_data())->attributes());
svg_renderer.render_id(*ras_ptr, sl, renb, feature->id(), mtx, opacity, bbox);
svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), mtx, opacity, bbox);
}
else
@ -143,7 +143,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigne
image_data_32 const& data = **marker.get_bitmap_data();
if (step == 1 && scale_factor_ == 1.0)
{
pixmap_.set_rectangle(feature->id(), data,
pixmap_.set_rectangle(feature.id(), data,
boost::math::iround(pos.x),
boost::math::iround(pos.y));
}
@ -153,7 +153,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigne
image_data_32 target(ratio * data.width(), ratio * data.height());
mapnik::scale_image_agg<image_data_32>(target,data, SCALING_NEAR,
scale_factor_, 0.0, 0.0, 1.0, ratio);
pixmap_.set_rectangle(feature->id(), target,
pixmap_.set_rectangle(feature.id(), target,
boost::math::iround(pos.x),
boost::math::iround(pos.y));
}

View file

@ -43,7 +43,7 @@ namespace mapnik
template <typename T>
void grid_renderer<T>::process(building_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -63,13 +63,13 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
expression_ptr height_expr = sym.height();
if (height_expr)
{
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature), *height_expr);
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr);
height = result.to_double() * scale_factor_;
}
for (unsigned i=0;i<feature->num_geometries();++i)
for (unsigned i=0;i<feature.num_geometries();++i)
{
geometry_type const& geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (geom.num_points() > 2)
{
boost::scoped_ptr<geometry_type> frame(new geometry_type(LineString));
@ -108,7 +108,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
path_type faces_path (t_,*faces,prj_trans);
ras_ptr->add_path(faces_path);
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
ras_ptr->reset();
@ -135,13 +135,13 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
path_type path(t_,*frame,prj_trans);
agg::conv_stroke<path_type> stroke(path);
ras_ptr->add_path(stroke);
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
ras_ptr->reset();
path_type roof_path (t_,*roof,prj_trans);
ras_ptr->add_path(roof_path);
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
}
}
@ -149,7 +149,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
}
template void grid_renderer<grid>::process(building_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -42,7 +42,7 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -61,9 +61,9 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
// TODO - actually handle image dimensions
int stroke_width = 2;
for (unsigned i=0;i<feature->num_geometries();++i)
for (unsigned i=0;i<feature.num_geometries();++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (geom.num_points() > 1)
{
path_type path(t_,geom,prj_trans);
@ -75,7 +75,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
}
// render id
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
@ -85,7 +85,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
template void grid_renderer<grid>::process(line_pattern_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -42,7 +42,7 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(line_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -60,9 +60,9 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
stroke const& stroke_ = sym.get_stroke();
for (unsigned i=0;i<feature->num_geometries();++i)
for (unsigned i=0;i<feature.num_geometries();++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (geom.num_points() > 1)
{
path_type path(t_,geom,prj_trans);
@ -134,7 +134,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
}
// render id
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
@ -144,7 +144,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
template void grid_renderer<grid>::process(line_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -52,7 +52,7 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(markers_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -69,10 +69,10 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
ras_ptr->reset();
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_image_transform());
evaluate_transform(tr, feature, sym.get_image_transform());
unsigned int res = pixmap_.get_resolution();
tr = agg::trans_affine_scaling(scale_factor_*(1.0/res)) * tr;
std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
marker_placement_e placement_method = sym.get_marker_placement();
marker_type_e marker_type = sym.get_marker_type();
@ -106,9 +106,9 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
mapnik::pixfmt_gray32 > svg_renderer(svg_path,(*marker)->attributes());
bool placed = false;
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
{
double x;
@ -143,7 +143,7 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
{
placed = true;
agg::trans_affine matrix = recenter * tr *agg::trans_affine_rotation(angle) * agg::trans_affine_translation(x, y);
svg_renderer.render_id(*ras_ptr, sl, renb, feature->id(), matrix, sym.get_opacity(),bbox);
svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), matrix, sym.get_opacity(),bbox);
}
}
if (placed)
@ -203,9 +203,9 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
double y;
double z=0;
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1)
{
geom.label_position(&x,&y);
@ -284,13 +284,13 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
}
}
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
pixmap_.add_feature(feature);
}
}
template void grid_renderer<grid>::process(markers_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -38,10 +38,10 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
std::string filename = path_processor_type::evaluate(*sym.get_filename(), *feature);
std::string filename = path_processor_type::evaluate(*sym.get_filename(), feature);
boost::optional<mapnik::marker_ptr> marker;
if ( !filename.empty() )
@ -56,11 +56,11 @@ void grid_renderer<T>::process(point_symbolizer const& sym,
if (marker)
{
agg::trans_affine tr;
evaluate_transform(tr, *feature, sym.get_image_transform());
evaluate_transform(tr, feature, sym.get_image_transform());
for (unsigned i=0; i<feature->num_geometries(); ++i)
for (unsigned i=0; i<feature.num_geometries(); ++i)
{
geometry_type const& geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
double x;
double y;
double z=0;
@ -95,7 +95,7 @@ void grid_renderer<T>::process(point_symbolizer const& sym,
}
template void grid_renderer<grid>::process(point_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -41,7 +41,7 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -57,9 +57,9 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
ras_ptr->reset();
for (unsigned i=0;i<feature->num_geometries();++i)
for (unsigned i=0;i<feature.num_geometries();++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (geom.num_points() > 2)
{
path_type path(t_,geom,prj_trans);
@ -68,7 +68,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
}
// render id
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
@ -77,7 +77,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
template void grid_renderer<grid>::process(polygon_pattern_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -41,7 +41,7 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(polygon_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
@ -56,9 +56,9 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
renderer ren(renb);
ras_ptr->reset();
for (unsigned i=0;i<feature->num_geometries();++i)
for (unsigned i=0;i<feature.num_geometries();++i)
{
geometry_type & geom = feature->get_geometry(i);
geometry_type & geom = feature.get_geometry(i);
if (geom.num_points() > 2)
{
path_type path(t_,geom,prj_trans);
@ -67,7 +67,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
}
// render id
ren.color(mapnik::gray32(feature->id()));
ren.color(mapnik::gray32(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache
@ -76,7 +76,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
template void grid_renderer<grid>::process(polygon_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -29,14 +29,14 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(raster_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
MAPNIK_LOG_WARN(grid_renderer) << "grid_renderer: raster_symbolizer is not yet supported";
}
template void grid_renderer<grid>::process(raster_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -38,13 +38,13 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(shield_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
box2d<double> query_extent;
shield_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, *feature, prj_trans,
sym, feature, prj_trans,
width_, height_,
scale_factor_,
t_, font_manager_, detector_, query_extent);
@ -65,7 +65,7 @@ void grid_renderer<T>::process(shield_symbolizer const& sym,
sym.get_opacity());
ren.prepare_glyphs(&(placements[ii]));
ren.render_id(feature->id(), placements[ii].center, 2);
ren.render_id(feature.id(), placements[ii].center, 2);
}
}
if (placement_found)
@ -73,7 +73,7 @@ void grid_renderer<T>::process(shield_symbolizer const& sym,
}
template void grid_renderer<grid>::process(shield_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}

View file

@ -28,13 +28,13 @@ namespace mapnik {
template <typename T>
void grid_renderer<T>::process(text_symbolizer const& sym,
mapnik::feature_ptr const& feature,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
box2d<double> query_extent;
text_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, *feature, prj_trans,
sym, feature, prj_trans,
detector_.extent().width(), detector_.extent().height(),
scale_factor_ * (1.0/pixmap_.get_resolution()),
t_, font_manager_, detector_,
@ -49,7 +49,7 @@ void grid_renderer<T>::process(text_symbolizer const& sym,
for (unsigned int ii = 0; ii < placements.size(); ++ii)
{
ren.prepare_glyphs(&(placements[ii]));
ren.render_id(feature->id(), placements[ii].center, 2);
ren.render_id(feature.id(), placements[ii].center, 2);
}
}
if (placement_found) pixmap_.add_feature(feature);
@ -57,7 +57,7 @@ void grid_renderer<T>::process(text_symbolizer const& sym,
}
template void grid_renderer<grid>::process(text_symbolizer const&,
mapnik::feature_ptr const&,
mapnik::feature_impl &,
proj_transform const&);
}