diff --git a/CHANGELOG.md b/CHANGELOG.md index 948f9c3bb..30eda2629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ Released ... Summary: TODO +- Moved `label-position-tolerance` from unsigned type to double + - Default PNG encoding method when `png` is supplied is now `png8:m=h`, so paletted png using hextree color quantization (#2028) Use `png32` now for full color png. More details at https://github.com/mapnik/mapnik/wiki/Image-IO. diff --git a/include/mapnik/text_properties.hpp b/include/mapnik/text_properties.hpp index bbd7a6e85..ec03ba8de 100644 --- a/include/mapnik/text_properties.hpp +++ b/include/mapnik/text_properties.hpp @@ -157,7 +157,7 @@ struct MAPNIK_DECL text_symbolizer_properties /** distance between repeated labels on a single geometry */ double label_spacing; /** distance the label can be moved on the line to fit, if 0 the default is used */ - unsigned label_position_tolerance; + double label_position_tolerance; bool avoid_edges; double minimum_distance; double minimum_padding; diff --git a/include/mapnik/text_symbolizer.hpp b/include/mapnik/text_symbolizer.hpp index 3a8945ded..caddea2ce 100644 --- a/include/mapnik/text_symbolizer.hpp +++ b/include/mapnik/text_symbolizer.hpp @@ -91,8 +91,8 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base void set_character_spacing(double spacing); double get_label_spacing() const func_deprecated; // spacing between repeated labels on lines void set_label_spacing(double spacing); - unsigned get_label_position_tolerance() const func_deprecated; //distance the label can be moved on the line to fit, if 0 the default is used - void set_label_position_tolerance(unsigned tolerance); + double get_label_position_tolerance() const func_deprecated; //distance the label can be moved on the line to fit, if 0 the default is used + void set_label_position_tolerance(double tolerance); bool get_force_odd_labels() const func_deprecated; // try render an odd amount of labels void set_force_odd_labels(bool force); double get_max_char_angle_delta() const func_deprecated; // maximum change in angle between adjacent characters diff --git a/src/text_properties.cpp b/src/text_properties.cpp index a695e17d8..46b997828 100644 --- a/src/text_properties.cpp +++ b/src/text_properties.cpp @@ -40,13 +40,13 @@ using boost::optional; text_symbolizer_properties::text_symbolizer_properties() : orientation(), - displacement(0,0), + displacement(0.0,0.0), label_placement(POINT_PLACEMENT), halign(H_AUTO), jalign(J_AUTO), valign(V_AUTO), - label_spacing(0), - label_position_tolerance(0), + label_spacing(0.0), + label_position_tolerance(0.0), avoid_edges(false), minimum_distance(0.0), minimum_padding(0.0), @@ -55,8 +55,8 @@ text_symbolizer_properties::text_symbolizer_properties() : force_odd_labels(false), allow_overlap(false), largest_bbox_only(true), - text_ratio(0), - wrap_width(0), + text_ratio(0.0), + wrap_width(0.0), format(), tree_() { @@ -93,7 +93,7 @@ void text_symbolizer_properties::from_xml(xml_node const &sym, fontset_map const if (text_ratio_) text_ratio = *text_ratio_; optional wrap_width_ = sym.get_opt_attr("wrap-width"); if (wrap_width_) wrap_width = *wrap_width_; - optional label_position_tolerance_ = sym.get_opt_attr("label-position-tolerance"); + optional label_position_tolerance_ = sym.get_opt_attr("label-position-tolerance"); if (label_position_tolerance_) label_position_tolerance = *label_position_tolerance_; optional spacing_ = sym.get_opt_attr("spacing"); if (spacing_) label_spacing = *spacing_; diff --git a/src/text_symbolizer.cpp b/src/text_symbolizer.cpp index 61ea9f6ac..02fc6ab8a 100644 --- a/src/text_symbolizer.cpp +++ b/src/text_symbolizer.cpp @@ -280,12 +280,12 @@ void text_symbolizer::set_label_spacing(double spacing) placement_options_->defaults.label_spacing = spacing; } -unsigned text_symbolizer::get_label_position_tolerance() const +double text_symbolizer::get_label_position_tolerance() const { return placement_options_->defaults.label_position_tolerance; } -void text_symbolizer::set_label_position_tolerance(unsigned tolerance) +void text_symbolizer::set_label_position_tolerance(double tolerance) { placement_options_->defaults.label_position_tolerance = tolerance; }