From eedd2f72a2d8db878af4fff1d16d6841d7a9a8c3 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 23 Feb 2010 02:17:34 +0000 Subject: [PATCH] load_map: fix the behavior of PolygonPatternSymbolizer and LinePatternSymbolizerby truly making it optional to not supply the width, height, and type parameters and allow them to be read automatically - closes #508 --- CHANGELOG | 4 ++ src/load_map.cpp | 24 ++++-------- tests/data/good_maps/point_symbolizer.xml | 19 ++++++++- .../point_symbolizer_on_polygon_map.xml | 39 +++++++++++++++++++ 4 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 tests/data/good_maps/point_symbolizer_on_polygon_map.xml diff --git a/CHANGELOG b/CHANGELOG index 796260acf..462e764ce 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,10 @@ For a complete change history, see the SVN log. Mapnik 0.7.1 Release -------------------- +- XML: Fixed behavior of PolygonPatternSymbolizer and LinePatternSymbolizer whereby width, height, + and type of images is actually allowed to be optionally ommitted (#508). This was added in r1543 but + only worked correctly for PointSymbolizer and ShieldSymbolizer. + - Fixed reading of PostGIS data on Big Endian systems (#515) - PostGIS: Added better support for alterative schemas (#500) diff --git a/src/load_map.cpp b/src/load_map.cpp index 8f8b2af7a..ea217fe12 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -661,7 +661,7 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym ) optional width = get_opt_attr(sym, "width"); optional height = get_opt_attr(sym, "height"); - // + if (file) { try @@ -724,16 +724,6 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym ) } } } - //else if (file || type || width || height) - //{ - // std::ostringstream os; - // os << "Missing required attributes: "; - // if ( ! file ) os << "file "; - // if ( ! type ) os << "type "; - // if ( ! width ) os << "width "; - // if ( ! height ) os << "height "; - // throw config_error( os.str() ); - //} else { rule.append(point_symbolizer()); @@ -752,9 +742,9 @@ void map_parser::parse_line_pattern_symbolizer( rule_type & rule, ptree const & { std::string file = get_attr(sym, "file"); optional base = get_opt_attr(sym, "base"); - optional type = get_attr(sym, "type"); - optional width = get_attr(sym, "width"); - optional height = get_attr(sym, "height"); + optional type = get_opt_attr(sym, "type"); + optional width = get_opt_attr(sym, "width"); + optional height = get_opt_attr(sym, "height"); try { @@ -822,9 +812,9 @@ void map_parser::parse_polygon_pattern_symbolizer( rule_type & rule, { std::string file = get_attr(sym, "file"); optional base = get_opt_attr(sym, "base"); - optional type = get_attr(sym, "type"); - optional width = get_attr(sym, "width"); - optional height = get_attr(sym, "height"); + optional type = get_opt_attr(sym, "type"); + optional width = get_opt_attr(sym, "width"); + optional height = get_opt_attr(sym, "height"); try { diff --git a/tests/data/good_maps/point_symbolizer.xml b/tests/data/good_maps/point_symbolizer.xml index b6cb927f7..00b4b06c4 100644 --- a/tests/data/good_maps/point_symbolizer.xml +++ b/tests/data/good_maps/point_symbolizer.xml @@ -1,6 +1,6 @@ - + + + + diff --git a/tests/data/good_maps/point_symbolizer_on_polygon_map.xml b/tests/data/good_maps/point_symbolizer_on_polygon_map.xml new file mode 100644 index 000000000..3caff1170 --- /dev/null +++ b/tests/data/good_maps/point_symbolizer_on_polygon_map.xml @@ -0,0 +1,39 @@ + + + + + + + test + + ../../data/shp/world_merc + shape + + +