From 37fea120918b8e365085b7ad658e04d18dc4e711 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 4 Dec 2013 11:47:36 +0000 Subject: [PATCH] load_map : allow optional expressions in symbolizer properties (work-in-progress) --- src/load_map.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/load_map.cpp b/src/load_map.cpp index c9a9388dc..7b43b1c3e 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -106,15 +106,11 @@ private: void parse_raster_symbolizer(rule & rule, xml_node const& sym); void parse_markers_symbolizer(rule & rule, xml_node const& sym); void parse_debug_symbolizer(rule & rule, xml_node const& sym); - bool parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node const& node); void parse_stroke(symbolizer_base & symbol, xml_node const & sym); - void ensure_font_face(std::string const& face_name); void find_unused_nodes(xml_node const& root); void find_unused_nodes_recursive(xml_node const& node, std::string & error_text); - - std::string ensure_relative_to_xml(boost::optional const& opt_path); void ensure_exists(std::string const& file_path); boost::optional get_opt_color_attr(boost::property_tree::ptree const& node, @@ -1298,9 +1294,16 @@ void map_parser::parse_stroke(symbolizer_base & symbol, xml_node const & sym) if (stroke) put(symbol, keys::stroke, *stroke); // stroke-width - optional width = sym.get_opt_attr("stroke-width"); - if (width) put(symbol, keys::stroke_width, *width); - + try + { + optional width = sym.get_opt_attr("stroke-width"); + if (width) put(symbol, keys::stroke_width, *width); + } + catch (...) + { + optional width = sym.get_opt_attr("stroke-width"); + if (width) put(symbol, keys::stroke_width, *width); + } // stroke-opacity optional opacity = sym.get_opt_attr("stroke-opacity"); if (opacity) put(symbol, keys::stroke_opacity, *opacity); @@ -1396,12 +1399,17 @@ void map_parser::parse_polygon_symbolizer(rule & rule, xml_node const & sym) { polygon_symbolizer poly_sym; // fill - optional fill = sym.get_opt_attr("fill"); - //optional fill = sym.get_opt_attr("fill"); - if (fill) + try { - put(poly_sym, keys::fill, *fill); + optional fill = sym.get_opt_attr("fill"); + if (fill) put(poly_sym, keys::fill, *fill); } + catch (...) + { + optional fill = sym.get_opt_attr("fill"); + if (fill) put(poly_sym, keys::fill, *fill); + } + // fill-opacity optional opacity = sym.get_opt_attr("fill-opacity"); if (opacity) put(poly_sym, keys::fill_opacity, *opacity);