From 3ae432ac96f8a59a2c73653678eaff05cf3ba963 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 28 Jun 2013 15:53:08 -0400 Subject: [PATCH] fix behavior of marker-ignore-placement on lines - closes #1931 --- include/mapnik/grid/grid_marker_helpers.hpp | 4 ++-- include/mapnik/marker_helpers.hpp | 4 ++-- include/mapnik/markers_placement.hpp | 10 +++++++--- src/cairo_renderer.cpp | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/mapnik/grid/grid_marker_helpers.hpp b/include/mapnik/grid/grid_marker_helpers.hpp index f20c1d912..5acb73a5d 100644 --- a/include/mapnik/grid/grid_marker_helpers.hpp +++ b/include/mapnik/grid/grid_marker_helpers.hpp @@ -123,7 +123,7 @@ struct raster_markers_rasterizer_dispatch_grid sym_.get_max_error(), sym_.get_allow_overlap()); double x, y, angle; - while (placement.get_point(x, y, angle)) + while (placement.get_point(x, y, angle, sym_.get_ignore_placement())) { agg::trans_affine matrix = marker_trans_; matrix.rotate(angle); @@ -260,7 +260,7 @@ struct vector_markers_rasterizer_dispatch_grid sym_.get_max_error(), sym_.get_allow_overlap()); double x, y, angle; - while (placement.get_point(x, y, angle)) + while (placement.get_point(x, y, angle, sym_.get_ignore_placement())) { agg::trans_affine matrix = marker_trans_; matrix.rotate(angle); diff --git a/include/mapnik/marker_helpers.hpp b/include/mapnik/marker_helpers.hpp index 41431a177..04645ef16 100644 --- a/include/mapnik/marker_helpers.hpp +++ b/include/mapnik/marker_helpers.hpp @@ -142,7 +142,7 @@ struct vector_markers_rasterizer_dispatch double x = 0; double y = 0; double angle = 0; - while (placement.get_point(x, y, angle)) + while (placement.get_point(x, y, angle, sym_.get_ignore_placement())) { agg::trans_affine matrix = marker_trans_; matrix.rotate(angle); @@ -245,7 +245,7 @@ struct raster_markers_rasterizer_dispatch sym_.get_max_error(), sym_.get_allow_overlap()); double x, y, angle; - while (placement.get_point(x, y, angle)) + while (placement.get_point(x, y, angle,sym_.get_ignore_placement())) { agg::trans_affine matrix = marker_trans_; matrix.rotate(angle); diff --git a/include/mapnik/markers_placement.hpp b/include/mapnik/markers_placement.hpp index 39000a074..b796a1272 100644 --- a/include/mapnik/markers_placement.hpp +++ b/include/mapnik/markers_placement.hpp @@ -107,10 +107,10 @@ public: * \param x Return value for x position * \param y Return value for x position * \param angle Return value for rotation angle - * \param add_to_detector Add selected position to detector + * \param ignore_placement Whether to add selected position to detector * \return True if a place is found, false if none is found. */ - bool get_point(double & x, double & y, double & angle, bool add_to_detector = true) + bool get_point(double & x, double & y, double & angle, bool ignore_placement) { if (done_) { @@ -219,7 +219,11 @@ public: set_spacing_left(spacing_left_ + spacing_ * max_error_ / 10.0); //Only moves forward continue; } - if (add_to_detector) detector_.insert(box); + if (!ignore_placement) + { + std::clog << "Adding\n"; + detector_.insert(box); + } last_x = x; last_y = y; return true; diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index d0305b5d7..2f86fecd9 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -1031,7 +1031,7 @@ struct markers_dispatch sym_.get_max_error(), sym_.get_allow_overlap()); double x, y, angle; - while (placement.get_point(x, y, angle)) + while (placement.get_point(x, y, angle, sym_.get_ignore_placement())) { agg::trans_affine matrix = marker_trans_; matrix.rotate(angle); @@ -1119,7 +1119,7 @@ struct markers_dispatch_2 sym_.get_max_error(), sym_.get_allow_overlap()); double x, y, angle; - while (placement.get_point(x, y, angle)) + while (placement.get_point(x, y, angle, sym_.get_ignore_placement())) { coord2d center = bbox_.center(); agg::trans_affine matrix = agg::trans_affine_translation(-center.x, -center.y);