settle upon 'geometry-transform' naming - refs #1276

This commit is contained in:
Dane Springmeyer 2012-07-03 18:34:11 -07:00
parent e4ff79d8d8
commit 7d9b4ce0da
2 changed files with 54 additions and 4 deletions

View file

@ -840,14 +840,14 @@ void map_parser::parse_symbolizer_base(symbolizer_base &sym, xml_node const &pt)
}
}
optional<std::string> transform_wkt = pt.get_opt_attr<std::string>("view-transform");
if (transform_wkt)
optional<std::string> geometry_transform_wkt = pt.get_opt_attr<std::string>("geometry-transform");
if (geometry_transform_wkt)
{
mapnik::transform_list_ptr tl = boost::make_shared<mapnik::transform_list>();
if (!mapnik::parse_transform(*tl, *transform_wkt, pt.get_tree().transform_expr_grammar))
if (!mapnik::parse_transform(*tl, *geometry_transform_wkt, pt.get_tree().transform_expr_grammar))
{
std::stringstream ss;
ss << "Could not parse transform from '" << transform_wkt << "', expected transform attribute";
ss << "Could not parse transform from '" << geometry_transform_wkt << "', expected transform attribute";
if (strict_)
throw config_error(ss.str()); // value_error here?
else

View file

@ -0,0 +1,50 @@
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="steelblue" minimum-version="0.7.2">
<Style name="base">
<Rule>
<LineSymbolizer stroke-width=".5"/>
</Rule>
</Style>
<Style name="style">
<!-- Asia -->
<Rule>
<Filter>([REGION]=142)</Filter>
<PolygonSymbolizer fill="yellow" geometry-transform="translate(10,10)"/>
</Rule>
<!-- Europe -->
<Rule>
<Filter>([REGION]=150)</Filter>
<PolygonSymbolizer fill="rgb(176,151,238)" geometry-transform="translate(-10,-10)"/>
</Rule>
<!-- Americas -->
<Rule>
<Filter>([REGION]=19)</Filter>
<PolygonSymbolizer fill="rgb(136,172,2)" geometry-transform="skewX(-10) skewY(-10)"/>
</Rule>
<!-- Africa -->
<Rule>
<Filter>([REGION]=2)</Filter>
<PolygonSymbolizer fill="rgb(239,98,133)" geometry-transform="rotate(10,1,-1)"/>
</Rule>
<!-- Oceana -->
<Rule>
<Filter>([REGION]=9)</Filter>
<PolygonSymbolizer fill="darkred" geometry-transform="translate(1.1,1.1)"/>
<PolygonSymbolizer fill="red" geometry-transform="translate(-1.1,-1.1)"/>
</Rule>
</Style>
<Layer name="world" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>style</StyleName>
<StyleName>base</StyleName>
<Datasource>
<Parameter name="file">../../data/shp/world_merc</Parameter>
<Parameter name="type">shape</Parameter>
</Datasource>
</Layer>
</Map>