From 500f57cf608565750cb775cba865510cf0fee300 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 31 May 2012 12:13:09 +0100 Subject: [PATCH] + make vertex() and rewind() methods const + remove unused coord_transforms + rename coord_transform2 to coord_transform --- demo/viewer/mapwidget.cpp | 2 +- include/mapnik/ctrans.hpp | 71 ++----------------- include/mapnik/metawriter.hpp | 2 +- include/mapnik/placement_finder.hpp | 4 +- include/mapnik/svg/svg_generator.hpp | 2 +- include/mapnik/svg/svg_output_grammars.hpp | 2 +- include/mapnik/svg/svg_path_iterator.hpp | 2 +- include/mapnik/vertex_converters.hpp | 2 +- src/agg/process_building_symbolizer.cpp | 2 +- src/agg/process_markers_symbolizer.cpp | 2 +- .../process_polygon_pattern_symbolizer.cpp | 2 +- src/cairo_renderer.cpp | 8 +-- src/grid/grid_renderer.cpp | 2 +- src/grid/process_building_symbolizer.cpp | 2 +- src/grid/process_line_pattern_symbolizer.cpp | 2 +- src/grid/process_line_symbolizer.cpp | 2 +- src/grid/process_markers_symbolizer.cpp | 2 +- .../process_polygon_pattern_symbolizer.cpp | 2 +- src/grid/process_polygon_symbolizer.cpp | 2 +- src/markers_placement.cpp | 4 +- src/svg/process_symbolizers.cpp | 2 +- src/symbolizer_helpers.cpp | 2 +- 22 files changed, 30 insertions(+), 93 deletions(-) diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index f9b7ae396..0ad0f28ce 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -194,7 +194,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e) boost::get<1>(*itr).to_string().c_str())); } - typedef mapnik::coord_transform2 path_type; + typedef mapnik::coord_transform path_type; for (unsigned i=0; inum_geometries();++i) { diff --git a/include/mapnik/ctrans.hpp b/include/mapnik/ctrans.hpp index 6b8917136..c1cc2f926 100644 --- a/include/mapnik/ctrans.hpp +++ b/include/mapnik/ctrans.hpp @@ -38,45 +38,20 @@ namespace mapnik typedef coord_array CoordinateArray; - template struct MAPNIK_DECL coord_transform -{ - coord_transform(Transform const& t, Geometry& geom) - : t_(t), geom_(geom) {} - - unsigned vertex(double *x, double *y) const - { - unsigned command = geom_.vertex(x, y); - t_.forward(x, y); - return command; - } - - void rewind(unsigned pos) - { - geom_.rewind(pos); - } - -private: - Transform const& t_; - Geometry& geom_; -}; - - -template -struct MAPNIK_DECL coord_transform2 { typedef std::size_t size_type; //typedef typename Geometry::value_type value_type; - coord_transform2(Transform const& t, + coord_transform(Transform const& t, Geometry & geom, proj_transform const& prj_trans) : t_(&t), geom_(geom), prj_trans_(&prj_trans) {} - explicit coord_transform2(Geometry & geom) + explicit coord_transform(Geometry & geom) : t_(0), geom_(geom), prj_trans_(0) {} @@ -91,7 +66,7 @@ struct MAPNIK_DECL coord_transform2 t_ = &t; } - unsigned vertex(double *x, double *y) + unsigned vertex(double *x, double *y) const { unsigned command = SEG_MOVETO; bool ok = false; @@ -113,7 +88,7 @@ struct MAPNIK_DECL coord_transform2 return command; } - void rewind(unsigned pos) + void rewind(unsigned pos) const { geom_.rewind(pos); } @@ -129,44 +104,6 @@ private: proj_transform const* prj_trans_; }; - -template -struct MAPNIK_DECL coord_transform3 -{ - coord_transform3(Transform const& t, - Geometry const& geom, - proj_transform const& prj_trans, - int dx, int dy) - : t_(t), - geom_(geom), - prj_trans_(prj_trans), - dx_(dx), dy_(dy) {} - - unsigned vertex(double *x, double *y) const - { - unsigned command = geom_.vertex(x, y); - double z = 0; - prj_trans_.backward(*x, *y, z); - t_.forward(x, y); - *x += dx_; - *y += dy_; - return command; - } - - void rewind(unsigned pos) - { - geom_.rewind(pos); - } - -private: - Transform const& t_; - Geometry const& geom_; - proj_transform const& prj_trans_; - int dx_; - int dy_; -}; - - class CoordTransform { private: diff --git a/include/mapnik/metawriter.hpp b/include/mapnik/metawriter.hpp index 523a71822..738137c31 100644 --- a/include/mapnik/metawriter.hpp +++ b/include/mapnik/metawriter.hpp @@ -93,7 +93,7 @@ public: class metawriter { public: - typedef coord_transform2 path_type; + typedef coord_transform path_type; metawriter(metawriter_properties dflt_properties) : dflt_properties_(dflt_properties), width_(0), diff --git a/include/mapnik/placement_finder.hpp b/include/mapnik/placement_finder.hpp index bf8844808..dcc207ade 100644 --- a/include/mapnik/placement_finder.hpp +++ b/include/mapnik/placement_finder.hpp @@ -47,8 +47,8 @@ class string_info; class text_path; typedef agg::conv_clip_polyline clipped_geometry_type; -typedef coord_transform2 ClippedPathType; -typedef coord_transform2 PathType; +typedef coord_transform ClippedPathType; +typedef coord_transform PathType; typedef label_collision_detector4 DetectorType; diff --git a/include/mapnik/svg/svg_generator.hpp b/include/mapnik/svg/svg_generator.hpp index 73cce0199..bb3eabb5f 100644 --- a/include/mapnik/svg/svg_generator.hpp +++ b/include/mapnik/svg/svg_generator.hpp @@ -44,7 +44,7 @@ namespace mapnik { namespace svg { template class svg_generator : private boost::noncopyable { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef svg::svg_root_attributes_grammar root_attributes_grammar; typedef svg::svg_rect_attributes_grammar rect_attributes_grammar; diff --git a/include/mapnik/svg/svg_output_grammars.hpp b/include/mapnik/svg/svg_output_grammars.hpp index 016d8edd0..121ca2aae 100644 --- a/include/mapnik/svg/svg_output_grammars.hpp +++ b/include/mapnik/svg/svg_output_grammars.hpp @@ -94,7 +94,7 @@ BOOST_FUSION_ADAPT_STRUCT( */ namespace boost { namespace spirit { namespace traits { - typedef mapnik::coord_transform2 path_type; + typedef mapnik::coord_transform path_type; template <> struct is_container diff --git a/include/mapnik/svg/svg_path_iterator.hpp b/include/mapnik/svg/svg_path_iterator.hpp index bd8e0c082..6132f2a84 100644 --- a/include/mapnik/svg/svg_path_iterator.hpp +++ b/include/mapnik/svg/svg_path_iterator.hpp @@ -174,7 +174,7 @@ private: * Each coordinate is stored twice to match the needs of the grammar. */ typedef path_iterator, - coord_transform2 > path_iterator_type; + coord_transform > path_iterator_type; }} diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index 23ef76c77..48282c747 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -173,7 +173,7 @@ template struct converter_traits { typedef T geometry_type; - typedef coord_transform2 conv_type; + typedef coord_transform conv_type; template static void setup(geometry_type & geom, Args const& args) diff --git a/src/agg/process_building_symbolizer.cpp b/src/agg/process_building_symbolizer.cpp index 05aced20d..435f79568 100644 --- a/src/agg/process_building_symbolizer.cpp +++ b/src/agg/process_building_symbolizer.cpp @@ -47,7 +47,7 @@ void agg_renderer::process(building_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_aa_solid renderer; diff --git a/src/agg/process_markers_symbolizer.cpp b/src/agg/process_markers_symbolizer.cpp index bced49428..9e02e2f01 100644 --- a/src/agg/process_markers_symbolizer.cpp +++ b/src/agg/process_markers_symbolizer.cpp @@ -54,7 +54,7 @@ void agg_renderer::process(markers_symbolizer const& sym, proj_transform const& prj_trans) { typedef agg::conv_clip_polyline clipped_geometry_type; - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::rgba8 color_type; typedef agg::order_rgba order_type; typedef agg::pixel32_type pixel_type; diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index 50693063a..6049a99ca 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -53,7 +53,7 @@ void agg_renderer::process(polygon_pattern_symbolizer const& sym, proj_transform const& prj_trans) { typedef agg::conv_clip_polygon clipped_geometry_type; - typedef coord_transform2 path_type; + typedef coord_transform path_type; agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4); ras_ptr->reset(); diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index 4612aa356..8b4bab54c 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -857,7 +857,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; cairo_context context(context_); context.set_operator(sym.comp_op()); @@ -1026,7 +1026,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height()); } - typedef coord_transform2 path_type; + typedef coord_transform path_type; agg::trans_affine transform; mapnik::path_ptr vmarker = *marker.get_vector_data(); using namespace mapnik::svg; @@ -1207,7 +1207,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) proj_transform const& prj_trans) { typedef agg::conv_clip_polyline clipped_geometry_type; - typedef coord_transform2 path_type; + typedef coord_transform path_type; std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature); boost::optional marker = mapnik::marker_cache::instance()->find(filename,true); @@ -1368,7 +1368,7 @@ void cairo_renderer_base::start_map_processing(Map const& map) double scale_factor_ = 1; typedef agg::conv_clip_polyline clipped_geometry_type; - typedef coord_transform2 path_type; + typedef coord_transform path_type; agg::trans_affine tr; boost::array const& m = sym.get_image_transform(); diff --git a/src/grid/grid_renderer.cpp b/src/grid/grid_renderer.cpp index 07bfeaad4..16e4c8e1c 100644 --- a/src/grid/grid_renderer.cpp +++ b/src/grid/grid_renderer.cpp @@ -104,7 +104,7 @@ void grid_renderer::render_marker(mapnik::feature_ptr const& feature, unsigne { if (marker.is_vector()) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/grid/process_building_symbolizer.cpp b/src/grid/process_building_symbolizer.cpp index cedefb5ea..52b1edd69 100644 --- a/src/grid/process_building_symbolizer.cpp +++ b/src/grid/process_building_symbolizer.cpp @@ -46,7 +46,7 @@ void grid_renderer::process(building_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/grid/process_line_pattern_symbolizer.cpp b/src/grid/process_line_pattern_symbolizer.cpp index afde3412b..2ab1ad8a5 100644 --- a/src/grid/process_line_pattern_symbolizer.cpp +++ b/src/grid/process_line_pattern_symbolizer.cpp @@ -45,7 +45,7 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/grid/process_line_symbolizer.cpp b/src/grid/process_line_symbolizer.cpp index 4a87184a1..be3519586 100644 --- a/src/grid/process_line_symbolizer.cpp +++ b/src/grid/process_line_symbolizer.cpp @@ -45,7 +45,7 @@ void grid_renderer::process(line_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/grid/process_markers_symbolizer.cpp b/src/grid/process_markers_symbolizer.cpp index 0d675f5f4..2170ff039 100644 --- a/src/grid/process_markers_symbolizer.cpp +++ b/src/grid/process_markers_symbolizer.cpp @@ -55,7 +55,7 @@ void grid_renderer::process(markers_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/grid/process_polygon_pattern_symbolizer.cpp b/src/grid/process_polygon_pattern_symbolizer.cpp index 45328b27c..855694df4 100644 --- a/src/grid/process_polygon_pattern_symbolizer.cpp +++ b/src/grid/process_polygon_pattern_symbolizer.cpp @@ -44,7 +44,7 @@ void grid_renderer::process(polygon_pattern_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/grid/process_polygon_symbolizer.cpp b/src/grid/process_polygon_symbolizer.cpp index a3e2a42d7..649366bd8 100644 --- a/src/grid/process_polygon_symbolizer.cpp +++ b/src/grid/process_polygon_symbolizer.cpp @@ -44,7 +44,7 @@ void grid_renderer::process(polygon_symbolizer const& sym, mapnik::feature_ptr const& feature, proj_transform const& prj_trans) { - typedef coord_transform2 path_type; + typedef coord_transform path_type; typedef agg::renderer_base ren_base; typedef agg::renderer_scanline_bin_solid renderer; agg::scanline_bin sl; diff --git a/src/markers_placement.cpp b/src/markers_placement.cpp index 572a0e42b..a52b2caf2 100644 --- a/src/markers_placement.cpp +++ b/src/markers_placement.cpp @@ -232,8 +232,8 @@ void markers_placement::set_spacing_left(double sl, bool allo } typedef agg::conv_clip_polyline clipped_geometry_type; -typedef coord_transform2 path_type; -typedef coord_transform2 clipped_path_type; +typedef coord_transform path_type; +typedef coord_transform clipped_path_type; template class markers_placement; template class markers_placement; diff --git a/src/svg/process_symbolizers.cpp b/src/svg/process_symbolizers.cpp index be2138e09..1619b6caa 100644 --- a/src/svg/process_symbolizers.cpp +++ b/src/svg/process_symbolizers.cpp @@ -32,7 +32,7 @@ bool svg_renderer::process(rule::symbolizers const& syms, { // svg renderer supports processing of multiple symbolizers. - typedef coord_transform2 path_type; + typedef coord_transform path_type; // process each symbolizer to collect its (path) information. // path information (attributes from line_ and polygon_ symbolizers) diff --git a/src/symbolizer_helpers.cpp b/src/symbolizer_helpers.cpp index 22e77b3f0..f2a3f2be0 100644 --- a/src/symbolizer_helpers.cpp +++ b/src/symbolizer_helpers.cpp @@ -53,7 +53,7 @@ bool text_symbolizer_helper::next_line_placement() } typedef agg::conv_clip_polyline clipped_geometry_type; - typedef coord_transform2 path_type; + typedef coord_transform path_type; clipped_geometry_type clipped(**geo_itr_); clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy()); path_type path(t_, clipped, prj_trans_);