diff --git a/bindings/python/mapnik_text_placement.cpp b/bindings/python/mapnik_text_placement.cpp index 482385187..ef90794ba 100644 --- a/bindings/python/mapnik_text_placement.cpp +++ b/bindings/python/mapnik_text_placement.cpp @@ -425,7 +425,7 @@ void export_text_placement() .def_readwrite("label_spacing", &text_symbolizer_properties::label_spacing) .def_readwrite("label_position_tolerance", &text_symbolizer_properties::label_position_tolerance) .def_readwrite("avoid_edges", &text_symbolizer_properties::avoid_edges) - .def_readwrite("text_margin", &text_symbolizer_properties::text_margin) + .def_readwrite("margin", &text_symbolizer_properties::margin) .def_readwrite("repeat_distance", &text_symbolizer_properties::repeat_distance) .def_readwrite("minimum_distance", &text_symbolizer_properties::minimum_distance) .def_readwrite("minimum_padding", &text_symbolizer_properties::minimum_padding) diff --git a/include/mapnik/text/text_properties.hpp b/include/mapnik/text/text_properties.hpp index b44d8086f..f094574de 100644 --- a/include/mapnik/text/text_properties.hpp +++ b/include/mapnik/text/text_properties.hpp @@ -139,7 +139,7 @@ struct text_properties_expressions symbolizer_base::value_type label_spacing = 0.0; symbolizer_base::value_type label_position_tolerance = 0.0; symbolizer_base::value_type avoid_edges = false; - symbolizer_base::value_type text_margin = 0.0; + symbolizer_base::value_type margin = 0.0; symbolizer_base::value_type repeat_distance = 0.0; symbolizer_base::value_type minimum_distance = 0.0; symbolizer_base::value_type minimum_padding = 0.0; @@ -183,7 +183,7 @@ struct MAPNIK_DECL text_symbolizer_properties // distance the label can be moved on the line to fit, if 0 the default is used double label_position_tolerance; bool avoid_edges; - double text_margin; + double margin; double repeat_distance; double minimum_distance; double minimum_padding; diff --git a/src/text/placement_finder.cpp b/src/text/placement_finder.cpp index dcaaf9502..edfa666b5 100644 --- a/src/text/placement_finder.cpp +++ b/src/text/placement_finder.cpp @@ -313,15 +313,15 @@ double placement_finder::get_spacing(double path_length, double layout_width) co bool placement_finder::collision(const box2d &box, const value_unicode_string &repeat_key, bool line_placement) const { - double text_margin, repeat_distance; + double margin, repeat_distance; if (line_placement) { - text_margin = info_.properties.text_margin * scale_factor_; + margin = info_.properties.margin * scale_factor_; repeat_distance = (info_.properties.repeat_distance != 0 ? info_.properties.repeat_distance : info_.properties.minimum_distance) * scale_factor_; } else { - text_margin = (info_.properties.text_margin != 0 ? info_.properties.text_margin : info_.properties.minimum_distance) * scale_factor_; + margin = (info_.properties.margin != 0 ? info_.properties.margin : info_.properties.minimum_distance) * scale_factor_; repeat_distance = info_.properties.repeat_distance * scale_factor_; } return !detector_.extent().intersects(box) @@ -332,9 +332,9 @@ bool placement_finder::collision(const box2d &box, const value_unicode_s !extent_.contains(box + (scale_factor_ * info_.properties.minimum_padding))) || (!info_.properties.allow_overlap && - ((repeat_key.length() == 0 && !detector_.has_placement(box, text_margin)) + ((repeat_key.length() == 0 && !detector_.has_placement(box, margin)) || - (repeat_key.length() > 0 && !detector_.has_placement(box, text_margin, repeat_key, repeat_distance)))); + (repeat_key.length() > 0 && !detector_.has_placement(box, margin, repeat_key, repeat_distance)))); } void placement_finder::set_marker(marker_info_ptr m, box2d box, bool marker_unlocked, pixel_position const& marker_displacement) diff --git a/src/text/text_properties.cpp b/src/text/text_properties.cpp index 10a8ae881..680cf1eab 100644 --- a/src/text/text_properties.cpp +++ b/src/text/text_properties.cpp @@ -44,7 +44,7 @@ text_symbolizer_properties::text_symbolizer_properties() label_spacing(0.0), label_position_tolerance(0.0), avoid_edges(false), - text_margin(0.0), + margin(0.0), repeat_distance(0.0), minimum_distance(0.0), minimum_padding(0.0), @@ -64,7 +64,7 @@ void text_symbolizer_properties::evaluate_text_properties(feature_impl const& fe label_spacing = util::apply_visitor(extract_value(feature,attrs), expressions.label_spacing); label_position_tolerance = util::apply_visitor(extract_value(feature,attrs), expressions.label_position_tolerance); avoid_edges = util::apply_visitor(extract_value(feature,attrs), expressions.avoid_edges); - text_margin = util::apply_visitor(extract_value(feature,attrs), expressions.text_margin); + margin = util::apply_visitor(extract_value(feature,attrs), expressions.margin); repeat_distance = util::apply_visitor(extract_value(feature,attrs), expressions.repeat_distance); minimum_distance = util::apply_visitor(extract_value(feature,attrs), expressions.minimum_distance); minimum_padding = util::apply_visitor(extract_value(feature,attrs), expressions.minimum_padding); @@ -114,16 +114,16 @@ formatting::node_ptr text_symbolizer_properties::format_tree() const void text_symbolizer_properties::text_properties_from_xml(xml_node const& node) { - // The options 'text-margin' and 'repeat-distance' replace 'minimum-distance'. + // The options 'margin' and 'repeat-distance' replace 'minimum-distance'. // Only allow one or the other to be defined here. - if (node.has_attribute("text-margin") || node.has_attribute("repeat-distance")) + if (node.has_attribute("margin") || node.has_attribute("repeat-distance")) { if (node.has_attribute("minimum-distance")) { throw config_error(std::string("Cannot use deprecated option minimum-distance with " - "new options text-margin and repeat-distance.")); + "new options margin and repeat-distance.")); } - set_property_from_xml(expressions.text_margin, "text-margin", node); + set_property_from_xml(expressions.margin, "margin", node); set_property_from_xml(expressions.repeat_distance, "repeat-distance", node); } else @@ -174,9 +174,9 @@ void text_symbolizer_properties::to_xml(boost::property_tree::ptree &node, { serialize_property("spacing", expressions.label_spacing, node); } - if (!(expressions.text_margin == dfl.expressions.text_margin) || explicit_defaults) + if (!(expressions.margin == dfl.expressions.margin) || explicit_defaults) { - serialize_property("text-margin", expressions.text_margin, node); + serialize_property("margin", expressions.margin, node); } if (!(expressions.repeat_distance == dfl.expressions.repeat_distance) || explicit_defaults) { @@ -227,7 +227,7 @@ void text_symbolizer_properties::add_expressions(expression_set & output) const if (is_expression(expressions.label_spacing)) output.insert(util::get(expressions.label_spacing)); if (is_expression(expressions.label_position_tolerance)) output.insert(util::get(expressions.label_position_tolerance)); if (is_expression(expressions.avoid_edges)) output.insert(util::get(expressions.avoid_edges)); - if (is_expression(expressions.text_margin)) output.insert(util::get(expressions.text_margin)); + if (is_expression(expressions.margin)) output.insert(util::get(expressions.margin)); if (is_expression(expressions.repeat_distance)) output.insert(util::get(expressions.repeat_distance)); if (is_expression(expressions.minimum_distance)) output.insert(util::get(expressions.minimum_distance)); if (is_expression(expressions.minimum_padding)) output.insert(util::get(expressions.minimum_padding)); diff --git a/tests/visual_tests/styles/repeat-labels-2.xml b/tests/visual_tests/styles/repeat-labels-2.xml index 07944c283..64b359c40 100644 --- a/tests/visual_tests/styles/repeat-labels-2.xml +++ b/tests/visual_tests/styles/repeat-labels-2.xml @@ -18,14 +18,14 @@ diff --git a/tests/visual_tests/styles/repeat-labels-3.xml b/tests/visual_tests/styles/repeat-labels-3.xml index cf8b31108..e767c00fb 100644 --- a/tests/visual_tests/styles/repeat-labels-3.xml +++ b/tests/visual_tests/styles/repeat-labels-3.xml @@ -18,14 +18,14 @@ diff --git a/tests/visual_tests/styles/repeat-labels-4.xml b/tests/visual_tests/styles/repeat-labels-4.xml index 24db0f7ff..88476f342 100644 --- a/tests/visual_tests/styles/repeat-labels-4.xml +++ b/tests/visual_tests/styles/repeat-labels-4.xml @@ -18,14 +18,14 @@