make label-position-tolerance a double, as it should have been all along

This commit is contained in:
Dane Springmeyer 2013-10-23 23:48:24 -07:00
parent 2ef7f13d53
commit dcbbcdd8a9
5 changed files with 13 additions and 11 deletions

View file

@ -14,6 +14,8 @@ Released ...
Summary: TODO 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) - 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. Use `png32` now for full color png. More details at https://github.com/mapnik/mapnik/wiki/Image-IO.

View file

@ -157,7 +157,7 @@ struct MAPNIK_DECL text_symbolizer_properties
/** distance between repeated labels on a single geometry */ /** distance between repeated labels on a single geometry */
double label_spacing; double label_spacing;
/** distance the label can be moved on the line to fit, if 0 the default is used */ /** 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; bool avoid_edges;
double minimum_distance; double minimum_distance;
double minimum_padding; double minimum_padding;

View file

@ -91,8 +91,8 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base
void set_character_spacing(double spacing); void set_character_spacing(double spacing);
double get_label_spacing() const func_deprecated; // spacing between repeated labels on lines double get_label_spacing() const func_deprecated; // spacing between repeated labels on lines
void set_label_spacing(double spacing); 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 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(unsigned tolerance); void set_label_position_tolerance(double tolerance);
bool get_force_odd_labels() const func_deprecated; // try render an odd amount of labels bool get_force_odd_labels() const func_deprecated; // try render an odd amount of labels
void set_force_odd_labels(bool force); void set_force_odd_labels(bool force);
double get_max_char_angle_delta() const func_deprecated; // maximum change in angle between adjacent characters double get_max_char_angle_delta() const func_deprecated; // maximum change in angle between adjacent characters

View file

@ -40,13 +40,13 @@ using boost::optional;
text_symbolizer_properties::text_symbolizer_properties() : text_symbolizer_properties::text_symbolizer_properties() :
orientation(), orientation(),
displacement(0,0), displacement(0.0,0.0),
label_placement(POINT_PLACEMENT), label_placement(POINT_PLACEMENT),
halign(H_AUTO), halign(H_AUTO),
jalign(J_AUTO), jalign(J_AUTO),
valign(V_AUTO), valign(V_AUTO),
label_spacing(0), label_spacing(0.0),
label_position_tolerance(0), label_position_tolerance(0.0),
avoid_edges(false), avoid_edges(false),
minimum_distance(0.0), minimum_distance(0.0),
minimum_padding(0.0), minimum_padding(0.0),
@ -55,8 +55,8 @@ text_symbolizer_properties::text_symbolizer_properties() :
force_odd_labels(false), force_odd_labels(false),
allow_overlap(false), allow_overlap(false),
largest_bbox_only(true), largest_bbox_only(true),
text_ratio(0), text_ratio(0.0),
wrap_width(0), wrap_width(0.0),
format(), format(),
tree_() 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_; if (text_ratio_) text_ratio = *text_ratio_;
optional<double> wrap_width_ = sym.get_opt_attr<double>("wrap-width"); optional<double> wrap_width_ = sym.get_opt_attr<double>("wrap-width");
if (wrap_width_) wrap_width = *wrap_width_; if (wrap_width_) wrap_width = *wrap_width_;
optional<unsigned> label_position_tolerance_ = sym.get_opt_attr<unsigned>("label-position-tolerance"); optional<double> label_position_tolerance_ = sym.get_opt_attr<double>("label-position-tolerance");
if (label_position_tolerance_) label_position_tolerance = *label_position_tolerance_; if (label_position_tolerance_) label_position_tolerance = *label_position_tolerance_;
optional<double> spacing_ = sym.get_opt_attr<double>("spacing"); optional<double> spacing_ = sym.get_opt_attr<double>("spacing");
if (spacing_) label_spacing = *spacing_; if (spacing_) label_spacing = *spacing_;

View file

@ -280,12 +280,12 @@ void text_symbolizer::set_label_spacing(double spacing)
placement_options_->defaults.label_spacing = 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; 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; placement_options_->defaults.label_position_tolerance = tolerance;
} }