This commit is contained in:
bergwerkgis 2016-02-08 13:55:25 +00:00
commit 9e7b67e35d
3 changed files with 21 additions and 48 deletions

View file

@ -8,8 +8,8 @@ _/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/
_/
```
[![Build Status Linux](https://secure.travis-ci.org/mapnik/mapnik.png)](http://travis-ci.org/mapnik/mapnik)
[![Build status Windows](https://ci.appveyor.com/api/projects/status/hc9l7okdjtucfqqn?svg=true)](https://ci.appveyor.com/project/Mapbox/mapnik)
[![Build Status Linux](https://api.travis-ci.org/mapnik/mapnik.svg?branch=master)](http://travis-ci.org/mapnik/mapnik)
[![Build Status Windows](https://ci.appveyor.com/api/projects/status/hc9l7okdjtucfqqn?branch=master&svg=true)](https://ci.appveyor.com/project/Mapbox/mapnik)
[![Coverage Status](https://coveralls.io/repos/mapnik/mapnik/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapnik/mapnik?branch=master)
Mapnik is an open source toolkit for developing mapping applications. At the core is a C++ shared library providing algorithms and patterns for spatial data access and visualization.

View file

@ -107,43 +107,6 @@ struct regex_replace_impl
mapnik::transcoder const& tr_;
};
struct geometry_types : qi::symbols<char, mapnik::value_integer>
{
geometry_types()
{
add
("point", 1)
("linestring", 2)
("polygon",3)
("collection",4)
;
}
};
struct boolean_constants : qi::symbols<char,mapnik::value_bool>
{
boolean_constants()
{
add
("true", true)
("false", false)
;
}
};
struct floating_point_constants : qi::symbols<char,mapnik::value_double>
{
floating_point_constants()
{
add
("pi", 3.1415926535897932384626433832795)
("deg_to_rad",0.017453292519943295769236907684886)
("rad_to_deg",57.295779513082320876798154814105)
;
}
};
template <typename T>
struct integer_parser
{
@ -200,9 +163,7 @@ struct expression_grammar : qi::grammar<Iterator, expr_node(), space_type>
qi::symbols<char const, char const> unesc_char;
qi::rule<Iterator, char() > quote_char;
geometry_types geom_type;
boolean_constants bool_const;
floating_point_constants float_const;
qi::symbols<char, expr_node> constant;
unary_function_types unary_func_type;
binary_function_types binary_func_type;

View file

@ -103,6 +103,20 @@ expression_grammar<Iterator>::expression_grammar(std::string const& encoding)
standard_wide::char_type char_;
standard_wide::no_case_type no_case;
using boost::phoenix::construct;
using boost::phoenix::if_else;
constant.add
("null", mapnik::value_null())
("false", mapnik::value_bool(false))
("true", mapnik::value_bool(true))
("point", mapnik::value_integer(1))
("linestring", mapnik::value_integer(2))
("polygon", mapnik::value_integer(3))
("collection", mapnik::value_integer(4))
("pi", mapnik::value_double(3.1415926535897932384626433832795))
("deg_to_rad", mapnik::value_double(0.017453292519943295769236907684886))
("rad_to_deg", mapnik::value_double(57.295779513082320876798154814105))
;
expr = logical_expr.alias();
@ -180,13 +194,11 @@ expression_grammar<Iterator>::expression_grammar(std::string const& encoding)
primary_expr = strict_double [_val = _1]
| int__[_val = _1]
| no_case[bool_const][_val = _1]
| no_case[lit("null")] [_val = value_null() ]
| no_case[geom_type][_val = _1 ]
| no_case[float_const] [_val = _1 ]
| no_case[constant] [_val = _1]
| quoted_ustring [_val = unicode_(_1)]
| lit("[mapnik::geometry_type]")[_val = construct<mapnik::geometry_type_attribute>()]
| attr [_val = construct<mapnik::attribute>( _1 ) ]
| attr [if_else(_1 == "mapnik::geometry_type",
_val = construct<mapnik::geometry_type_attribute>(),
_val = construct<mapnik::attribute>(_1))]
| global_attr [_val = construct<mapnik::global_attribute>( _1 )]
| lit("not") >> expr [_val = !_1]
| unary_function_expr [_val = _1]