From bd7ad7cd3caa7f157fbd45079af87b0bfb4cde58 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 15 Jun 2012 22:17:26 -0400 Subject: [PATCH] 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) --- include/mapnik/agg_renderer.hpp | 22 ++--- include/mapnik/cairo_renderer.hpp | 22 ++--- include/mapnik/feature.hpp | 10 +++ include/mapnik/grid/grid.hpp | 41 +++++++--- include/mapnik/grid/grid_renderer.hpp | 24 +++--- src/agg/process_building_symbolizer.cpp | 10 +-- src/agg/process_line_pattern_symbolizer.cpp | 10 +-- src/agg/process_line_symbolizer.cpp | 10 +-- src/agg/process_markers_symbolizer.cpp | 20 ++--- src/agg/process_point_symbolizer.cpp | 14 ++-- .../process_polygon_pattern_symbolizer.cpp | 14 ++-- src/agg/process_polygon_symbolizer.cpp | 8 +- src/agg/process_raster_symbolizer.cpp | 8 +- src/agg/process_shield_symbolizer.cpp | 6 +- src/agg/process_text_symbolizer.cpp | 6 +- src/cairo_renderer.cpp | 80 +++++++++---------- src/feature_style_processor.cpp | 22 ++--- src/grid/grid_renderer.cpp | 8 +- src/grid/process_building_symbolizer.cpp | 16 ++-- src/grid/process_line_pattern_symbolizer.cpp | 10 +-- src/grid/process_line_symbolizer.cpp | 10 +-- src/grid/process_markers_symbolizer.cpp | 20 ++--- src/grid/process_point_symbolizer.cpp | 12 +-- .../process_polygon_pattern_symbolizer.cpp | 10 +-- src/grid/process_polygon_symbolizer.cpp | 10 +-- src/grid/process_raster_symbolizer.cpp | 4 +- src/grid/process_shield_symbolizer.cpp | 8 +- src/grid/process_text_symbolizer.cpp | 8 +- 28 files changed, 238 insertions(+), 205 deletions(-) diff --git a/include/mapnik/agg_renderer.hpp b/include/mapnik/agg_renderer.hpp index c7a718341..71401b8de 100644 --- a/include/mapnik/agg_renderer.hpp +++ b/include/mapnik/agg_renderer.hpp @@ -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. diff --git a/include/mapnik/cairo_renderer.hpp b/include/mapnik/cairo_renderer.hpp index d95c1f66f..a5fa5d8a2 100644 --- a/include/mapnik/cairo_renderer.hpp +++ b/include/mapnik/cairo_renderer.hpp @@ -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. diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index fa517101c..7100f8e65 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -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_; diff --git a/include/mapnik/grid/grid.hpp b/include/mapnik/grid/grid.hpp index 1ef265b9f..d944b3a75 100644 --- a/include/mapnik/grid/grid.hpp +++ b/include/mapnik/grid/grid.hpp @@ -32,6 +32,7 @@ #include #include #include +#include // boost #include @@ -70,6 +71,7 @@ private: std::set 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()) { // 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_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; } } diff --git a/include/mapnik/grid/grid_renderer.hpp b/include/mapnik/grid/grid_renderer.hpp index 39d3fd5d3..fe4c65a15 100644 --- a/include/mapnik/grid/grid_renderer.hpp +++ b/include/mapnik/grid/grid_renderer.hpp @@ -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. diff --git a/src/agg/process_building_symbolizer.cpp b/src/agg/process_building_symbolizer.cpp index 435f79568..99d956062 100644 --- a/src/agg/process_building_symbolizer.cpp +++ b/src/agg/process_building_symbolizer.cpp @@ -44,7 +44,7 @@ namespace mapnik template void agg_renderer::process(building_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -70,13 +70,13 @@ void agg_renderer::process(building_symbolizer const& sym, expression_ptr height_expr = sym.height(); if (height_expr) { - value_type result = boost::apply_visitor(evaluate(*feature), *height_expr); + value_type result = boost::apply_visitor(evaluate(feature), *height_expr); height = result.to_double() * scale_factor_; } - for (unsigned i=0;inum_geometries();++i) + for (unsigned i=0;iget_geometry(i); + geometry_type const& geom = feature.get_geometry(i); if (geom.num_points() > 2) { boost::scoped_ptr frame(new geometry_type(LineString)); @@ -158,7 +158,7 @@ void agg_renderer::process(building_symbolizer const& sym, } template void agg_renderer::process(building_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index 72ad65bd1..c23fb5de9 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -51,7 +51,7 @@ namespace mapnik { template void agg_renderer::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::process(line_pattern_symbolizer const& sym, typedef agg::renderer_outline_image renderer_type; typedef agg::rasterizer_outline_aa 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 mark = marker_cache::instance()->find(filename,true); if (!mark) return; @@ -95,7 +95,7 @@ void agg_renderer::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 conv_types; vertex_converter, rasterizer_type, line_pattern_symbolizer, @@ -106,7 +106,7 @@ void agg_renderer::process(line_pattern_symbolizer const& sym, converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // 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::process(line_pattern_symbolizer const& sym, } template void agg_renderer::process(line_pattern_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_line_symbolizer.cpp b/src/agg/process_line_symbolizer.cpp index 4966d4907..bfff5cbcc 100644 --- a/src/agg/process_line_symbolizer.cpp +++ b/src/agg/process_line_symbolizer.cpp @@ -50,7 +50,7 @@ namespace mapnik { template void agg_renderer::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::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::process(line_symbolizer const& sym, if (stroke_.has_dash()) converter.set(); converter.set(); //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::process(line_symbolizer const& sym, if (stroke_.has_dash()) converter.set(); converter.set(); //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::process(line_symbolizer const& sym, template void agg_renderer::process(line_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_markers_symbolizer.cpp b/src/agg/process_markers_symbolizer.cpp index cd23e8431..2c7619d12 100644 --- a/src/agg/process_markers_symbolizer.cpp +++ b/src/agg/process_markers_symbolizer.cpp @@ -50,7 +50,7 @@ namespace mapnik { template void agg_renderer::process(markers_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef agg::conv_clip_polyline clipped_geometry_type; @@ -73,9 +73,9 @@ void agg_renderer::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::process(markers_symbolizer const& sym, renderer_type, agg::pixfmt_rgba32 > svg_renderer(svg_path,(*marker)->attributes()); - for (unsigned i=0; inum_geometries(); ++i) + for (unsigned i=0; iget_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::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::process(markers_symbolizer const& sym, agg::path_storage marker; - for (unsigned i=0; inum_geometries(); ++i) + for (unsigned i=0; iget_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::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::process(markers_symbolizer const& sym, } template void agg_renderer::process(markers_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp index 28acacc44..00e61af39 100644 --- a/src/agg/process_point_symbolizer.cpp +++ b/src/agg/process_point_symbolizer.cpp @@ -46,10 +46,10 @@ namespace mapnik { template void agg_renderer::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; if ( !filename.empty() ) @@ -67,15 +67,15 @@ void agg_renderer::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 label_ext = bbox * recenter_tr; - for (unsigned i=0; inum_geometries(); ++i) + for (unsigned i=0; iget_geometry(i); + geometry_type const& geom = feature.get_geometry(i); double x; double y; double z=0; @@ -101,7 +101,7 @@ void agg_renderer::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::process(point_symbolizer const& sym, } template void agg_renderer::process(point_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index 6833c1aa3..f5355a928 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -49,7 +49,7 @@ namespace mapnik { template void agg_renderer::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 clipped_geometry_type; @@ -59,7 +59,7 @@ void agg_renderer::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 marker; if ( !filename.empty() ) { @@ -120,9 +120,9 @@ void agg_renderer::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::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 inflated_extent = query_extent_ * 1.0; typedef boost::mpl::vector conv_types; @@ -149,7 +149,7 @@ void agg_renderer::process(polygon_pattern_symbolizer const& sym, converter.set(); //always transform if (sym.smooth() > 0.0) converter.set(); // 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::process(polygon_pattern_symbolizer const& sym, template void agg_renderer::process(polygon_pattern_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_polygon_symbolizer.cpp b/src/agg/process_polygon_symbolizer.cpp index 9998cecae..f8a88ecaa 100644 --- a/src/agg/process_polygon_symbolizer.cpp +++ b/src/agg/process_polygon_symbolizer.cpp @@ -41,7 +41,7 @@ namespace mapnik { template void agg_renderer::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::process(polygon_symbolizer const& sym, box2d 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 conv_types; vertex_converter, rasterizer, polygon_symbolizer, @@ -63,7 +63,7 @@ void agg_renderer::process(polygon_symbolizer const& sym, converter.set(); if (sym.smooth() > 0.0) converter.set(); // 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::process(polygon_symbolizer const& sym, } template void agg_renderer::process(polygon_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_raster_symbolizer.cpp b/src/agg/process_raster_symbolizer.cpp index 21ef0ece1..f79aa002f 100644 --- a/src/agg/process_raster_symbolizer.cpp +++ b/src/agg/process_raster_symbolizer.cpp @@ -41,16 +41,16 @@ namespace mapnik { template void agg_renderer::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 target_ext = box2d(source->ext_); prj_trans.backward(target_ext, PROJ_ENVELOPE_POINTS); @@ -83,7 +83,7 @@ void agg_renderer::process(raster_symbolizer const& sym, } template void agg_renderer::process(raster_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_shield_symbolizer.cpp b/src/agg/process_shield_symbolizer.cpp index a8d8ccf46..f0a5695b9 100644 --- a/src/agg/process_shield_symbolizer.cpp +++ b/src/agg/process_shield_symbolizer.cpp @@ -36,12 +36,12 @@ namespace mapnik { template void agg_renderer::process(shield_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { shield_symbolizer_helper, 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::process(shield_symbolizer const& sym, template void agg_renderer::process(shield_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/agg/process_text_symbolizer.cpp b/src/agg/process_text_symbolizer.cpp index 9da346a48..bb5e9d485 100644 --- a/src/agg/process_text_symbolizer.cpp +++ b/src/agg/process_text_symbolizer.cpp @@ -29,12 +29,12 @@ namespace mapnik { template void agg_renderer::process(text_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { text_symbolizer_helper, 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::process(text_symbolizer const& sym, } template void agg_renderer::process(text_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index 958faa4ee..05afd8f7d 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -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 conv_types; vertex_converter, cairo_context, polygon_symbolizer, @@ -846,7 +846,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) converter.set(); if (sym.smooth() > 0.0) converter.set(); // 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 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), *height_expr); + value_type result = boost::apply_visitor(evaluate(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 conv_types; vertex_converter, cairo_context, line_symbolizer, @@ -999,7 +999,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) converter.set(); // optional affine transform if (sym.smooth() > 0.0) converter.set(); // 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; 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, 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 clipped_geometry_type; typedef coord_transform 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 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 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 conv_types; vertex_converter, cairo_context, polygon_pattern_symbolizer, @@ -1312,7 +1312,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) converter.set(); if (sym.smooth() > 0.0) converter.set(); // 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 target_ext = box2d(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 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 extent(x1,y1,x2,y2); using namespace mapnik::svg; - for (unsigned i=0; inum_geometries(); ++i) + for (unsigned i=0; iget_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; inum_geometries(); ++i) + for (unsigned i=0; iget_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, 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, 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()); diff --git a/src/feature_style_processor.cpp b/src/feature_style_processor.cpp index e7cff4fa7..31f955ad5 100644 --- a/src/feature_style_processor.cpp +++ b/src/feature_style_processor.cpp @@ -62,7 +62,7 @@ template struct process_impl { template - 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 { template - 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 struct feature_style_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::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 +template struct process_memfun_helper {}; template no_tag has_process_helper(...); @@ -556,12 +556,12 @@ void feature_style_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::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::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); } } } diff --git a/src/grid/grid_renderer.cpp b/src/grid/grid_renderer.cpp index 3907fcd28..6f58c9754 100644 --- a/src/grid/grid_renderer.cpp +++ b/src/grid/grid_renderer.cpp @@ -100,7 +100,7 @@ void grid_renderer::end_layer_processing(layer const&) } template -void grid_renderer::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::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::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::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::render_marker(mapnik::feature_ptr const& feature, unsigne image_data_32 target(ratio * data.width(), ratio * data.height()); mapnik::scale_image_agg(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)); } diff --git a/src/grid/process_building_symbolizer.cpp b/src/grid/process_building_symbolizer.cpp index e7203cd61..e09d17218 100644 --- a/src/grid/process_building_symbolizer.cpp +++ b/src/grid/process_building_symbolizer.cpp @@ -43,7 +43,7 @@ namespace mapnik template void grid_renderer::process(building_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -63,13 +63,13 @@ void grid_renderer::process(building_symbolizer const& sym, expression_ptr height_expr = sym.height(); if (height_expr) { - value_type result = boost::apply_visitor(evaluate(*feature), *height_expr); + value_type result = boost::apply_visitor(evaluate(feature), *height_expr); height = result.to_double() * scale_factor_; } - for (unsigned i=0;inum_geometries();++i) + for (unsigned i=0;iget_geometry(i); + geometry_type & geom = feature.get_geometry(i); if (geom.num_points() > 2) { boost::scoped_ptr frame(new geometry_type(LineString)); @@ -108,7 +108,7 @@ void grid_renderer::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::process(building_symbolizer const& sym, path_type path(t_,*frame,prj_trans); agg::conv_stroke 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::process(building_symbolizer const& sym, } template void grid_renderer::process(building_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_line_pattern_symbolizer.cpp b/src/grid/process_line_pattern_symbolizer.cpp index 92f9407a7..a4cbed5bc 100644 --- a/src/grid/process_line_pattern_symbolizer.cpp +++ b/src/grid/process_line_pattern_symbolizer.cpp @@ -42,7 +42,7 @@ namespace mapnik { template void grid_renderer::process(line_pattern_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -61,9 +61,9 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, // TODO - actually handle image dimensions int stroke_width = 2; - for (unsigned i=0;inum_geometries();++i) + for (unsigned i=0;iget_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::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::process(line_pattern_symbolizer const& sym, template void grid_renderer::process(line_pattern_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_line_symbolizer.cpp b/src/grid/process_line_symbolizer.cpp index d836ed75d..c4b81daad 100644 --- a/src/grid/process_line_symbolizer.cpp +++ b/src/grid/process_line_symbolizer.cpp @@ -42,7 +42,7 @@ namespace mapnik { template void grid_renderer::process(line_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -60,9 +60,9 @@ void grid_renderer::process(line_symbolizer const& sym, stroke const& stroke_ = sym.get_stroke(); - for (unsigned i=0;inum_geometries();++i) + for (unsigned i=0;iget_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::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::process(line_symbolizer const& sym, template void grid_renderer::process(line_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_markers_symbolizer.cpp b/src/grid/process_markers_symbolizer.cpp index 57751c717..cbcea00a7 100644 --- a/src/grid/process_markers_symbolizer.cpp +++ b/src/grid/process_markers_symbolizer.cpp @@ -52,7 +52,7 @@ namespace mapnik { template void grid_renderer::process(markers_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -69,10 +69,10 @@ void grid_renderer::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::process(markers_symbolizer const& sym, mapnik::pixfmt_gray32 > svg_renderer(svg_path,(*marker)->attributes()); bool placed = false; - for (unsigned i=0; inum_geometries(); ++i) + for (unsigned i=0; iget_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::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::process(markers_symbolizer const& sym, double y; double z=0; - for (unsigned i=0; inum_geometries(); ++i) + for (unsigned i=0; iget_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::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::process(markers_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_point_symbolizer.cpp b/src/grid/process_point_symbolizer.cpp index a17a86842..b7e60b916 100644 --- a/src/grid/process_point_symbolizer.cpp +++ b/src/grid/process_point_symbolizer.cpp @@ -38,10 +38,10 @@ namespace mapnik { template void grid_renderer::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; if ( !filename.empty() ) @@ -56,11 +56,11 @@ void grid_renderer::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; inum_geometries(); ++i) + for (unsigned i=0; iget_geometry(i); + geometry_type & geom = feature.get_geometry(i); double x; double y; double z=0; @@ -95,7 +95,7 @@ void grid_renderer::process(point_symbolizer const& sym, } template void grid_renderer::process(point_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_polygon_pattern_symbolizer.cpp b/src/grid/process_polygon_pattern_symbolizer.cpp index 3f71f0c88..154a24103 100644 --- a/src/grid/process_polygon_pattern_symbolizer.cpp +++ b/src/grid/process_polygon_pattern_symbolizer.cpp @@ -41,7 +41,7 @@ namespace mapnik { template void grid_renderer::process(polygon_pattern_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -57,9 +57,9 @@ void grid_renderer::process(polygon_pattern_symbolizer const& sym, ras_ptr->reset(); - for (unsigned i=0;inum_geometries();++i) + for (unsigned i=0;iget_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::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::process(polygon_pattern_symbolizer const& sym, template void grid_renderer::process(polygon_pattern_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_polygon_symbolizer.cpp b/src/grid/process_polygon_symbolizer.cpp index c353fdee9..68d5f1ae9 100644 --- a/src/grid/process_polygon_symbolizer.cpp +++ b/src/grid/process_polygon_symbolizer.cpp @@ -41,7 +41,7 @@ namespace mapnik { template void grid_renderer::process(polygon_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform path_type; @@ -56,9 +56,9 @@ void grid_renderer::process(polygon_symbolizer const& sym, renderer ren(renb); ras_ptr->reset(); - for (unsigned i=0;inum_geometries();++i) + for (unsigned i=0;iget_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::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::process(polygon_symbolizer const& sym, template void grid_renderer::process(polygon_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_raster_symbolizer.cpp b/src/grid/process_raster_symbolizer.cpp index 9aaf05395..939dd1153 100644 --- a/src/grid/process_raster_symbolizer.cpp +++ b/src/grid/process_raster_symbolizer.cpp @@ -29,14 +29,14 @@ namespace mapnik { template void grid_renderer::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::process(raster_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_shield_symbolizer.cpp b/src/grid/process_shield_symbolizer.cpp index bad6224c9..3a956892f 100644 --- a/src/grid/process_shield_symbolizer.cpp +++ b/src/grid/process_shield_symbolizer.cpp @@ -38,13 +38,13 @@ namespace mapnik { template void grid_renderer::process(shield_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { box2d query_extent; shield_symbolizer_helper, 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::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::process(shield_symbolizer const& sym, } template void grid_renderer::process(shield_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); } diff --git a/src/grid/process_text_symbolizer.cpp b/src/grid/process_text_symbolizer.cpp index f943746c2..2986c4665 100644 --- a/src/grid/process_text_symbolizer.cpp +++ b/src/grid/process_text_symbolizer.cpp @@ -28,13 +28,13 @@ namespace mapnik { template void grid_renderer::process(text_symbolizer const& sym, - mapnik::feature_ptr const& feature, + mapnik::feature_impl & feature, proj_transform const& prj_trans) { box2d query_extent; text_symbolizer_helper, 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::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::process(text_symbolizer const& sym, } template void grid_renderer::process(text_symbolizer const&, - mapnik::feature_ptr const&, + mapnik::feature_impl &, proj_transform const&); }