diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index 218115548..eb57adce9 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -200,13 +200,13 @@ void MapWidget::mousePressEvent(QMouseEvent* e) { mapnik::geometry_type & geom = feat->get_geometry(i); path_type path(t,geom,prj_trans); - if (geom.num_points() > 0) + if (geom.size() > 0) { QPainterPath qpath; double x,y; path.vertex(&x,&y); qpath.moveTo(x,y); - for (unsigned j = 1; j < geom.num_points(); ++j) + for (unsigned j = 1; j < geom.size(); ++j) { path.vertex(&x,&y); qpath.lineTo(x,y); diff --git a/include/mapnik/hit_test_filter.hpp b/include/mapnik/hit_test_filter.hpp index 461c7daba..483450506 100644 --- a/include/mapnik/hit_test_filter.hpp +++ b/include/mapnik/hit_test_filter.hpp @@ -25,6 +25,9 @@ // mapnik #include +#include +// boost +#include namespace mapnik { class hit_test_filter @@ -35,12 +38,11 @@ public: y_(y), tol_(tol) {} - bool pass(Feature const& feature) + bool pass(Feature & feature) { - for (unsigned i=0;i(coord) = geom.get_vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); + boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); return coord; } }; diff --git a/include/mapnik/util/geometry_svg_generator.hpp b/include/mapnik/util/geometry_svg_generator.hpp index 5b1a285bc..7dc8ef120 100644 --- a/include/mapnik/util/geometry_svg_generator.hpp +++ b/include/mapnik/util/geometry_svg_generator.hpp @@ -66,7 +66,7 @@ namespace mapnik { namespace util { geometry_type::value_type const operator() (geometry_type const& geom) const { geometry_type::value_type coord; - boost::get<0>(coord) = geom.get_vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); + boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); return coord; } }; diff --git a/include/mapnik/util/geometry_to_wkb.hpp b/include/mapnik/util/geometry_to_wkb.hpp index 4f793bc0b..1252479dc 100644 --- a/include/mapnik/util/geometry_to_wkb.hpp +++ b/include/mapnik/util/geometry_to_wkb.hpp @@ -119,7 +119,7 @@ namespace mapnik { namespace util { wkb_buffer_ptr to_point_wkb( geometry_type const& g, wkbByteOrder byte_order) { - assert(g.num_points() == 1); + assert(g.size() == 1); std::size_t size = 1 + 4 + 8*2 ; // byteOrder + wkbType + Point wkb_buffer_ptr wkb = boost::make_shared(size); boost::interprocess::bufferstream ss(wkb->buffer(), wkb->size(), std::ios::out | std::ios::binary); @@ -127,7 +127,7 @@ namespace mapnik { namespace util { int type = static_cast(mapnik::Point); write(ss,type,4,byte_order); double x,y; - g.get_vertex(0,&x,&y); + g.vertex(0,&x,&y); write(ss,x,8,byte_order); write(ss,y,8,byte_order); assert(ss.good()); @@ -136,7 +136,7 @@ namespace mapnik { namespace util { wkb_buffer_ptr to_line_string_wkb( geometry_type const& g, wkbByteOrder byte_order) { - unsigned num_points = g.num_points(); + unsigned num_points = g.size(); assert(num_points > 1); std::size_t size = 1 + 4 + 4 + 8*2*num_points ; // byteOrder + wkbType + numPoints + Point*numPoints wkb_buffer_ptr wkb = boost::make_shared(size); @@ -148,7 +148,7 @@ namespace mapnik { namespace util { double x,y; for (unsigned i=0; i< num_points; ++i) { - g.get_vertex(i,&x,&y); + g.vertex(i,&x,&y); write(ss,x,8,byte_order); write(ss,y,8,byte_order); } @@ -158,7 +158,7 @@ namespace mapnik { namespace util { wkb_buffer_ptr to_polygon_wkb( geometry_type const& g, wkbByteOrder byte_order) { - unsigned num_points = g.num_points(); + unsigned num_points = g.size(); assert(num_points > 1); typedef std::pair point_type; @@ -169,7 +169,7 @@ namespace mapnik { namespace util { std::size_t size = 1 + 4 + 4 ; // byteOrder + wkbType + numRings for (unsigned i=0; i< num_points; ++i) { - unsigned command = g.get_vertex(i,&x,&y); + unsigned command = g.vertex(i,&x,&y); if (command == SEG_MOVETO) { rings.push_back(new linear_ring); // start new loop diff --git a/include/mapnik/util/geometry_wkt_generator.hpp b/include/mapnik/util/geometry_wkt_generator.hpp index 0318a050d..46780e5fd 100644 --- a/include/mapnik/util/geometry_wkt_generator.hpp +++ b/include/mapnik/util/geometry_wkt_generator.hpp @@ -79,7 +79,7 @@ namespace mapnik { namespace util { geometry_type::value_type const operator() (geometry_type const& geom) const { geometry_type::value_type coord; - boost::get<0>(coord) = geom.get_vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); + boost::get<0>(coord) = geom.vertex(0,&boost::get<1>(coord),&boost::get<2>(coord)); return coord; } }; diff --git a/include/mapnik/util/vertex_iterator.hpp b/include/mapnik/util/vertex_iterator.hpp index 5cc794078..2d957ef33 100644 --- a/include/mapnik/util/vertex_iterator.hpp +++ b/include/mapnik/util/vertex_iterator.hpp @@ -63,7 +63,7 @@ namespace mapnik { namespace util { void increment() { - boost::get<0>(v_) = vertices_->get_vertex(pos_++, &boost::get<1>(v_), &boost::get<2>(v_)); + boost::get<0>(v_) = vertices_->vertex(pos_++, &boost::get<1>(v_), &boost::get<2>(v_)); } bool equal( vertex_iterator const& other) const diff --git a/include/mapnik/vertex_vector.hpp b/include/mapnik/vertex_vector.hpp index 85bcd8857..97139941b 100644 --- a/include/mapnik/vertex_vector.hpp +++ b/include/mapnik/vertex_vector.hpp @@ -105,7 +105,7 @@ public: *vertex = y; ++pos_; } - unsigned get_vertex(unsigned pos,coord_type* x,coord_type* y) const + unsigned vertex(unsigned pos,coord_type* x,coord_type* y) const { if (pos >= pos_) return SEG_END; unsigned block = pos >> block_shift; diff --git a/src/agg/process_building_symbolizer.cpp b/src/agg/process_building_symbolizer.cpp index 7863fd566..8f82ca2b8 100644 --- a/src/agg/process_building_symbolizer.cpp +++ b/src/agg/process_building_symbolizer.cpp @@ -77,7 +77,7 @@ void agg_renderer::process(building_symbolizer const& sym, for (unsigned i=0;i 2) + if (geom.size() > 2) { boost::scoped_ptr frame(new geometry_type(LineString)); boost::scoped_ptr roof(new geometry_type(Polygon)); @@ -87,7 +87,7 @@ void agg_renderer::process(building_symbolizer const& sym, geom.rewind(0); unsigned cm = geom.vertex(&x0,&y0); - for (unsigned j=1;j::process(building_symbolizer const& sym, } geom.rewind(0); - for (unsigned j=0;j::process(line_pattern_symbolizer const& sym, BOOST_FOREACH(geometry_type & geom, feature.paths()) { - if (geom.num_points() > 1) + if (geom.size() > 1) { converter.apply(geom); } diff --git a/src/agg/process_line_symbolizer.cpp b/src/agg/process_line_symbolizer.cpp index 9edf59b4a..1d5388aa3 100644 --- a/src/agg/process_line_symbolizer.cpp +++ b/src/agg/process_line_symbolizer.cpp @@ -109,7 +109,7 @@ void agg_renderer::process(line_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 1) + if (geom.size() > 1) { converter.apply(geom); } @@ -132,7 +132,7 @@ void agg_renderer::process(line_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 1) + if (geom.size() > 1) { converter.apply(geom); } diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp index 56de677c7..0127c3460 100644 --- a/src/agg/process_point_symbolizer.cpp +++ b/src/agg/process_point_symbolizer.cpp @@ -23,6 +23,7 @@ // mapnik #include #include +#include #include #include #include @@ -81,9 +82,9 @@ void agg_renderer::process(point_symbolizer const& sym, double y; double z=0; if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT) - geom.label_position(&x, &y); + centroid(geom, x, y); else - geom.label_interior_position(&x, &y); + label_interior_position(geom ,x, y); prj_trans.backward(x,y,z); t_.forward(&x,&y); diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index f567db071..2a5ec53d3 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -151,7 +151,7 @@ void agg_renderer::process(polygon_pattern_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 2) + if (geom.size() > 2) { converter.apply(geom); } diff --git a/src/agg/process_polygon_symbolizer.cpp b/src/agg/process_polygon_symbolizer.cpp index 9f5047162..2b1266659 100644 --- a/src/agg/process_polygon_symbolizer.cpp +++ b/src/agg/process_polygon_symbolizer.cpp @@ -65,7 +65,7 @@ void agg_renderer::process(polygon_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 2) + if (geom.size() > 2) { converter.apply(geom); } diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index e3283e775..518c613e7 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -854,7 +854,7 @@ void cairo_renderer_base::process(polygon_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 2) + if (geom.size() > 2) { converter.apply(geom); } @@ -884,7 +884,7 @@ void cairo_renderer_base::process(building_symbolizer const& sym, { geometry_type const& geom = feature.get_geometry(i); - if (geom.num_points() > 2) + if (geom.size() > 2) { boost::scoped_ptr frame(new geometry_type(LineString)); boost::scoped_ptr roof(new geometry_type(Polygon)); @@ -895,7 +895,7 @@ void cairo_renderer_base::process(building_symbolizer const& sym, geom.rewind(0); unsigned cm = geom.vertex(&x0, &y0); - for (unsigned j = 1; j < geom.num_points(); ++j) + for (unsigned j = 1; j < geom.size(); ++j) { double x=0; double y=0; @@ -942,7 +942,7 @@ void cairo_renderer_base::process(building_symbolizer const& sym, } geom.rewind(0); - for (unsigned j = 0; j < geom.num_points(); ++j) + for (unsigned j = 0; j < geom.size(); ++j) { double x, y; unsigned cm = geom.vertex(&x, &y); @@ -1008,7 +1008,7 @@ void cairo_renderer_base::process(line_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 1) + if (geom.size() > 1) { converter.apply(geom); } @@ -1158,9 +1158,9 @@ void cairo_renderer_base::process(point_symbolizer const& sym, double z = 0; if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT) - geom.label_position(&x, &y); + centroid(geom, x, y); else - geom.label_interior_position(&x, &y); + label_interior_position(geom, x, y); prj_trans.backward(x, y, z); t_.forward(&x, &y); @@ -1236,7 +1236,7 @@ void cairo_renderer_base::process(line_pattern_symbolizer const& sym, { geometry_type & geom = feature.get_geometry(i); - if (geom.num_points() > 1) + if (geom.size() > 1) { clipped_geometry_type clipped(geom); clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy()); @@ -1316,7 +1316,7 @@ void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 2) + if (geom.size() > 2) { converter.apply(geom); } @@ -1433,12 +1433,12 @@ void cairo_renderer_base::process(markers_symbolizer const& sym, { 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) + if (placement_method == MARKER_POINT_PLACEMENT || geom.size() <= 1) { double x; double y; double z=0; - geom.label_interior_position(&x, &y); + label_interior_position(geom, x, y); prj_trans.backward(x,y,z); t_.forward(&x,&y); extent.re_center(x,y); @@ -1448,9 +1448,8 @@ void cairo_renderer_base::process(markers_symbolizer const& sym, { render_marker(pixel_position(x - 0.5 * w, y - 0.5 * h) ,**mark, tr, sym.get_opacity()); - // TODO - impl this for markers? - //if (!sym.get_ignore_placement()) - // detector_.insert(label_ext); + if (!sym.get_ignore_placement()) + detector_.insert(extent); } } else diff --git a/src/grid/process_building_symbolizer.cpp b/src/grid/process_building_symbolizer.cpp index e09d17218..d89898d37 100644 --- a/src/grid/process_building_symbolizer.cpp +++ b/src/grid/process_building_symbolizer.cpp @@ -70,7 +70,7 @@ void grid_renderer::process(building_symbolizer const& sym, for (unsigned i=0;i 2) + if (geom.size() > 2) { boost::scoped_ptr frame(new geometry_type(LineString)); boost::scoped_ptr roof(new geometry_type(Polygon)); @@ -78,7 +78,7 @@ void grid_renderer::process(building_symbolizer const& sym, double x0(0); double y0(0); unsigned cm = geom.vertex(&x0,&y0); - for (unsigned j=1;j::process(building_symbolizer const& sym, } geom.rewind(0); - for (unsigned j=0;j::process(line_pattern_symbolizer const& sym, for (unsigned i=0;i 1) + if (geom.size() > 1) { path_type path(t_,geom,prj_trans); agg::conv_stroke stroke(path); diff --git a/src/grid/process_line_symbolizer.cpp b/src/grid/process_line_symbolizer.cpp index 9e18180a4..debb189e9 100644 --- a/src/grid/process_line_symbolizer.cpp +++ b/src/grid/process_line_symbolizer.cpp @@ -84,7 +84,7 @@ void grid_renderer::process(line_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 1) + if (geom.size() > 1) { converter.apply(geom); } diff --git a/src/grid/process_markers_symbolizer.cpp b/src/grid/process_markers_symbolizer.cpp index adade0895..9dae111c6 100644 --- a/src/grid/process_markers_symbolizer.cpp +++ b/src/grid/process_markers_symbolizer.cpp @@ -123,12 +123,12 @@ void grid_renderer::process(markers_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { // TODO - merge this code with point_symbolizer rendering - if (placement_method == MARKER_POINT_PLACEMENT || geom.num_points() <= 1) + if (placement_method == MARKER_POINT_PLACEMENT || geom.size() <= 1) { double x; double y; double z=0; - geom.label_interior_position(&x, &y); + label_interior_position(geom, x, y); prj_trans.backward(x,y,z); t_.forward(&x,&y); geom_tr.transform(&x,&y); diff --git a/src/grid/process_point_symbolizer.cpp b/src/grid/process_point_symbolizer.cpp index 7398bf91d..211a3035d 100644 --- a/src/grid/process_point_symbolizer.cpp +++ b/src/grid/process_point_symbolizer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -73,9 +74,9 @@ void grid_renderer::process(point_symbolizer const& sym, double y; double z=0; if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT) - geom.label_position(&x, &y); + centroid(geom, x, y); else - geom.label_interior_position(&x, &y); + label_interior_position(geom, x, y); prj_trans.backward(x,y,z); t_.forward(&x,&y); diff --git a/src/grid/process_polygon_pattern_symbolizer.cpp b/src/grid/process_polygon_pattern_symbolizer.cpp index 154a24103..aae06ff45 100644 --- a/src/grid/process_polygon_pattern_symbolizer.cpp +++ b/src/grid/process_polygon_pattern_symbolizer.cpp @@ -60,7 +60,7 @@ void grid_renderer::process(polygon_pattern_symbolizer const& sym, for (unsigned i=0;i 2) + if (geom.size() > 2) { path_type path(t_,geom,prj_trans); ras_ptr->add_path(path); diff --git a/src/grid/process_polygon_symbolizer.cpp b/src/grid/process_polygon_symbolizer.cpp index 87e14d4b4..355e493b3 100644 --- a/src/grid/process_polygon_symbolizer.cpp +++ b/src/grid/process_polygon_symbolizer.cpp @@ -68,7 +68,7 @@ void grid_renderer::process(polygon_symbolizer const& sym, BOOST_FOREACH( geometry_type & geom, feature.paths()) { - if (geom.num_points() > 2) + if (geom.size() > 2) { converter.apply(geom); } diff --git a/src/svg/process_symbolizers.cpp b/src/svg/process_symbolizers.cpp index 1619b6caa..2a1bcbad1 100644 --- a/src/svg/process_symbolizers.cpp +++ b/src/svg/process_symbolizers.cpp @@ -46,7 +46,7 @@ bool svg_renderer::process(rule::symbolizers const& syms, for(unsigned i=0; i 1) + if(geom.size() > 1) { path_type path(t_, geom, prj_trans); generator_.generate_path(path, path_attributes_); diff --git a/src/symbolizer_helpers.cpp b/src/symbolizer_helpers.cpp index 87516c19d..f54e039fb 100644 --- a/src/symbolizer_helpers.cpp +++ b/src/symbolizer_helpers.cpp @@ -179,7 +179,7 @@ void text_symbolizer_helper::initialize_geometries() geometry_type const& geom = feature_.get_geometry(i); // don't bother with empty geometries - if (geom.num_points() == 0) continue; + if (geom.size() == 0) continue; eGeomType type = geom.type(); if (type == Polygon) { @@ -232,7 +232,7 @@ void text_symbolizer_helper::initialize_points() if (how_placed == VERTEX_PLACEMENT) { geom.rewind(0); - for(unsigned i = 0; i < geom.num_points(); i++) + for(unsigned i = 0; i < geom.size(); i++) { geom.vertex(&label_x, &label_y); prj_trans_.backward(label_x, label_y, z); @@ -244,11 +244,11 @@ void text_symbolizer_helper::initialize_points() { if (how_placed == POINT_PLACEMENT) { - geom.label_position(&label_x, &label_y); + centroid(geom, label_x, label_y); } else if (how_placed == INTERIOR_PLACEMENT) { - geom.label_interior_position(&label_x, &label_y); + label_interior_position(geom, label_x, label_y); } else {