Merge branch 'master' of github.com:mapnik/mapnik into geometry-refactor2
This commit is contained in:
commit
afbd808c73
20 changed files with 228 additions and 140 deletions
16
.travis.yml
16
.travis.yml
|
@ -1,4 +1,4 @@
|
||||||
language: cpp
|
language: generic
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: 10
|
depth: 10
|
||||||
|
@ -25,24 +25,24 @@ matrix:
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
sudo: false
|
||||||
compiler: ": clang"
|
compiler: ": clang"
|
||||||
env: JOBS=8 MASON_PUBLISH=true _CXX="ccache clang++-3.8 -Qunused-arguments" _CC="clang-3.8" TRIGGER=true
|
env: JOBS=8 MASON_PUBLISH=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8" TRIGGER=true
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: [ 'ubuntu-toolchain-r-test']
|
sources: [ 'ubuntu-toolchain-r-test']
|
||||||
packages: [ 'libstdc++-5-dev', 'xutils']
|
packages: [ 'libstdc++-5-dev', 'xutils-dev']
|
||||||
- os: linux
|
- os: linux
|
||||||
sudo: false
|
sudo: false
|
||||||
compiler: ": clang-coverage"
|
compiler: ": clang-coverage"
|
||||||
env: JOBS=8 COVERAGE=true _CXX="ccache clang++-3.8 -Qunused-arguments" _CC="clang-3.8"
|
env: JOBS=8 COVERAGE=true CXX="ccache clang++-3.8 -Qunused-arguments" CC="clang-3.8"
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: [ 'ubuntu-toolchain-r-test']
|
sources: [ 'ubuntu-toolchain-r-test']
|
||||||
packages: ['libstdc++-5-dev', 'xutils' ]
|
packages: ['libstdc++-5-dev', 'xutils-dev' ]
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: ": clang-osx"
|
compiler: ": clang-osx"
|
||||||
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
# https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
|
||||||
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
osx_image: xcode7.3 # upgrades clang from 6 -> 7
|
||||||
env: JOBS=4 MASON_PUBLISH=true _CXX="ccache clang++ -Qunused-arguments"
|
env: JOBS=4 MASON_PUBLISH=true CXX="ccache clang++ -Qunused-arguments"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# workaround travis rvm bug
|
# workaround travis rvm bug
|
||||||
|
@ -51,8 +51,6 @@ before_install:
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
rvm get head || true
|
rvm get head || true
|
||||||
fi
|
fi
|
||||||
- if [[ ${_CXX:-false} != false ]]; then export CXX=${_CXX}; fi
|
|
||||||
- if [[ ${_CC:-false} != false ]]; then export CC=${_CC}; fi
|
|
||||||
- source scripts/travis-common.sh
|
- source scripts/travis-common.sh
|
||||||
- export PYTHONUSERBASE=$(pwd)/mason_packages/.link
|
- export PYTHONUSERBASE=$(pwd)/mason_packages/.link
|
||||||
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH}
|
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH}
|
||||||
|
@ -94,7 +92,7 @@ script:
|
||||||
- export SCONSFLAGS='--debug=time'
|
- export SCONSFLAGS='--debug=time'
|
||||||
- configure BENCHMARK=${BENCH}
|
- configure BENCHMARK=${BENCH}
|
||||||
- cat config.log
|
- cat config.log
|
||||||
- make
|
- scripts/travis-command-wrapper.py -s "date;ps aux | grep ${CXX}" -i 60 make
|
||||||
- make test
|
- make test
|
||||||
- enabled ${COVERAGE} coverage
|
- enabled ${COVERAGE} coverage
|
||||||
- enabled ${BENCH} make bench
|
- enabled ${BENCH} make bench
|
||||||
|
|
|
@ -36,7 +36,11 @@ Released: xx-xx-xx
|
||||||
- Added support for quantising small (less than 3 pixel) images (ref #3466)
|
- Added support for quantising small (less than 3 pixel) images (ref #3466)
|
||||||
- Added support for natural logarithm function in expressions (ref #3475)
|
- Added support for natural logarithm function in expressions (ref #3475)
|
||||||
- Improved logic determining if certain compiler features are available e.g `inheriting constructors` (MSVC)
|
- Improved logic determining if certain compiler features are available e.g `inheriting constructors` (MSVC)
|
||||||
- GeoJSON - corrected quoting in `stringgifird` objects (ref #3491)
|
- GeoJSON - corrected quoting in `stringify` objects (ref #3491)
|
||||||
|
- GeoJSON - ensured consistent ordering of attribute descriptors (ref #3494)
|
||||||
|
- GeoJSON - exposed `num_features_to_query` as datasource paramer (ref #3495)
|
||||||
|
- Replaced `boost::mpl::vector<Types...>` with `std::tuple<Types...>` (ref #3503)
|
||||||
|
- BuildingSymbolizer - fixed closing segment of polygon in building symbolizer (ref #3505)
|
||||||
|
|
||||||
## 3.0.11
|
## 3.0.11
|
||||||
|
|
||||||
|
|
34
bootstrap.sh
34
bootstrap.sh
|
@ -11,7 +11,7 @@ todo
|
||||||
- shrink icu data
|
- shrink icu data
|
||||||
'
|
'
|
||||||
|
|
||||||
MASON_VERSION="7ed8931"
|
MASON_VERSION="new-pkgs"
|
||||||
|
|
||||||
function setup_mason() {
|
function setup_mason() {
|
||||||
if [[ ! -d ./.mason ]]; then
|
if [[ ! -d ./.mason ]]; then
|
||||||
|
@ -19,7 +19,7 @@ function setup_mason() {
|
||||||
(cd ./.mason && git checkout ${MASON_VERSION})
|
(cd ./.mason && git checkout ${MASON_VERSION})
|
||||||
else
|
else
|
||||||
echo "Updating to latest mason"
|
echo "Updating to latest mason"
|
||||||
(cd ./.mason && git fetch && git checkout ${MASON_VERSION})
|
(cd ./.mason && git fetch && git checkout ${MASON_VERSION} && git pull)
|
||||||
fi
|
fi
|
||||||
export PATH=$(pwd)/.mason:$PATH
|
export PATH=$(pwd)/.mason:$PATH
|
||||||
export CXX=${CXX:-clang++}
|
export CXX=${CXX:-clang++}
|
||||||
|
@ -39,6 +39,8 @@ function install() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# the rm here is to workaround https://github.com/mapbox/mason/issues/230
|
||||||
|
rm -f ./mason_packages/.link/mason.ini
|
||||||
mason link $1 $2
|
mason link $1 $2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,22 +48,22 @@ ICU_VERSION="55.1"
|
||||||
|
|
||||||
function install_mason_deps() {
|
function install_mason_deps() {
|
||||||
FAIL=0
|
FAIL=0
|
||||||
install ccache 3.2.4 &
|
install ccache 3.3.0 &
|
||||||
install jpeg_turbo 1.4.0 libjpeg &
|
install jpeg_turbo 1.5.0 libjpeg &
|
||||||
install libpng 1.6.20 libpng &
|
install libpng 1.6.24 libpng &
|
||||||
install libtiff 4.0.4beta libtiff &
|
install libtiff 4.0.6 libtiff &
|
||||||
install libpq 9.4.1 &
|
install libpq 9.5.2 &
|
||||||
install sqlite 3.8.8.3 libsqlite3 &
|
install sqlite 3.14.1 libsqlite3 &
|
||||||
install expat 2.1.0 libexpat &
|
install expat 2.2.0 libexpat &
|
||||||
install icu ${ICU_VERSION} &
|
install icu ${ICU_VERSION} &
|
||||||
install proj 4.8.0 libproj &
|
install proj 4.9.2 libproj &
|
||||||
install pixman 0.32.6 libpixman-1 &
|
install pixman 0.34.0 libpixman-1 &
|
||||||
install cairo 1.14.2 libcairo &
|
install cairo 1.14.6 libcairo &
|
||||||
install protobuf 2.6.1 &
|
install protobuf 2.6.1 &
|
||||||
# technically protobuf is not a mapnik core dep, but installing
|
# technically protobuf is not a mapnik core dep, but installing
|
||||||
# here by default helps make mapnik-vector-tile builds easier
|
# here by default helps make mapnik-vector-tile builds easier
|
||||||
install webp 0.5.0 libwebp &
|
install webp 0.5.1 libwebp &
|
||||||
install gdal 1.11.2 libgdal &
|
install gdal 2.1.1 libgdal &
|
||||||
install boost 1.61.0 &
|
install boost 1.61.0 &
|
||||||
install boost_libsystem 1.61.0 &
|
install boost_libsystem 1.61.0 &
|
||||||
install boost_libfilesystem 1.61.0 &
|
install boost_libfilesystem 1.61.0 &
|
||||||
|
@ -71,8 +73,8 @@ function install_mason_deps() {
|
||||||
# here by default helps make python-mapnik builds easier
|
# here by default helps make python-mapnik builds easier
|
||||||
install boost_libthread 1.61.0 &
|
install boost_libthread 1.61.0 &
|
||||||
install boost_libpython 1.61.0 &
|
install boost_libpython 1.61.0 &
|
||||||
install freetype 2.6 libfreetype &
|
install freetype 2.6.5 libfreetype &
|
||||||
install harfbuzz 0.9.41 libharfbuzz &
|
install harfbuzz 1.3.0 libharfbuzz &
|
||||||
for job in $(jobs -p)
|
for job in $(jobs -p)
|
||||||
do
|
do
|
||||||
wait $job || let "FAIL+=1"
|
wait $job || let "FAIL+=1"
|
||||||
|
|
|
@ -27,7 +27,7 @@ dependencies:
|
||||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
override:
|
override:
|
||||||
- sudo apt-get update -y
|
- sudo apt-get update -y
|
||||||
- sudo apt-get install -y libstdc++-5-dev xutils
|
- sudo apt-get install -y libstdc++-5-dev xutils-dev
|
||||||
|
|
||||||
database:
|
database:
|
||||||
pre:
|
pre:
|
||||||
|
|
|
@ -144,28 +144,6 @@ extract_bounding_box_grammar<Iterator, Boxes, ErrorHandler>::extract_bounding_bo
|
||||||
rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
|
rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
|
||||||
;
|
;
|
||||||
|
|
||||||
// generic json types
|
|
||||||
json.value = json.object | json.array | json.string_ | json.number
|
|
||||||
;
|
|
||||||
|
|
||||||
json.key_value = json.string_ >> lit(':') >> json.value
|
|
||||||
;
|
|
||||||
|
|
||||||
json.object = lit('{') >> json.key_value % lit(',') >> lit('}')
|
|
||||||
;
|
|
||||||
|
|
||||||
json.array = lit('[')
|
|
||||||
>> json.value >> *(lit(',') >> json.value)
|
|
||||||
>> lit(']')
|
|
||||||
;
|
|
||||||
|
|
||||||
json.number = json.strict_double
|
|
||||||
| json.int__
|
|
||||||
| lit("true")
|
|
||||||
| lit("false")
|
|
||||||
| lit("null")
|
|
||||||
;
|
|
||||||
|
|
||||||
coords.name("Coordinates");
|
coords.name("Coordinates");
|
||||||
pos.name("Position");
|
pos.name("Position");
|
||||||
ring.name("Ring");
|
ring.name("Ring");
|
||||||
|
|
|
@ -35,7 +35,6 @@ feature_grammar<Iterator,FeatureType,ErrorHandler>::feature_grammar(mapnik::tran
|
||||||
qi::lit_type lit;
|
qi::lit_type lit;
|
||||||
qi::long_long_type long_long;
|
qi::long_long_type long_long;
|
||||||
qi::double_type double_;
|
qi::double_type double_;
|
||||||
qi::_val_type _val;
|
|
||||||
qi::_1_type _1;
|
qi::_1_type _1;
|
||||||
qi::_2_type _2;
|
qi::_2_type _2;
|
||||||
qi::_3_type _3;
|
qi::_3_type _3;
|
||||||
|
@ -49,30 +48,6 @@ feature_grammar<Iterator,FeatureType,ErrorHandler>::feature_grammar(mapnik::tran
|
||||||
using phoenix::new_;
|
using phoenix::new_;
|
||||||
using phoenix::construct;
|
using phoenix::construct;
|
||||||
|
|
||||||
// generic json types
|
|
||||||
json_.value = json_.object | json_.array | json_.string_ | json_.number
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.key_value = json_.string_ > lit(':') > json_.value
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.object = lit('{')
|
|
||||||
> -(json_.key_value % lit(','))
|
|
||||||
> lit('}')
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.array = lit('[')
|
|
||||||
> -(json_.value % lit(','))
|
|
||||||
> lit(']')
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.number = json_.strict_double[_val = json_.double_converter(_1)]
|
|
||||||
| json_.int__[_val = json_.integer_converter(_1)]
|
|
||||||
| lit("true") [_val = true]
|
|
||||||
| lit ("false") [_val = false]
|
|
||||||
| lit("null")[_val = construct<value_null>()]
|
|
||||||
;
|
|
||||||
|
|
||||||
// geojson types
|
// geojson types
|
||||||
feature_type = lit("\"type\"") > lit(':') > lit("\"Feature\"")
|
feature_type = lit("\"type\"") > lit(':') > lit("\"Feature\"")
|
||||||
;
|
;
|
||||||
|
|
|
@ -129,7 +129,7 @@ struct push_esc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename Iterator >
|
template< typename Iterator>
|
||||||
unicode_string<Iterator>::unicode_string()
|
unicode_string<Iterator>::unicode_string()
|
||||||
: unicode_string::base_type(double_quoted)
|
: unicode_string::base_type(double_quoted)
|
||||||
{
|
{
|
||||||
|
@ -175,8 +175,9 @@ unicode_string<Iterator>::unicode_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator>
|
template <typename Iterator>
|
||||||
struct generic_json
|
struct generic_json : qi::grammar<Iterator, json_value(), space_type>
|
||||||
{
|
{
|
||||||
|
generic_json();
|
||||||
qi::rule<Iterator, json_value(), space_type> value;
|
qi::rule<Iterator, json_value(), space_type> value;
|
||||||
qi::int_parser<mapnik::value_integer, 10, 1, -1> int__;
|
qi::int_parser<mapnik::value_integer, 10, 1, -1> int__;
|
||||||
unicode_string<Iterator> string_;
|
unicode_string<Iterator> string_;
|
||||||
|
|
|
@ -52,31 +52,6 @@ geometry_grammar<Iterator, ErrorHandler>::geometry_grammar()
|
||||||
using phoenix::push_back;
|
using phoenix::push_back;
|
||||||
|
|
||||||
start = geometry.alias() | lit("null");
|
start = geometry.alias() | lit("null");
|
||||||
|
|
||||||
// generic json types
|
|
||||||
json_.value = json_.object | json_.array | json_.string_ | json_.number
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.key_value = json_.string_ > lit(':') > json_.value
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.object = lit('{')
|
|
||||||
> -(json_.key_value % lit(','))
|
|
||||||
> lit('}')
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.array = lit('[')
|
|
||||||
> -(json_.value % lit(','))
|
|
||||||
> lit(']')
|
|
||||||
;
|
|
||||||
|
|
||||||
json_.number = json_.strict_double
|
|
||||||
| json_.int__
|
|
||||||
| lit("true")
|
|
||||||
| lit ("false")
|
|
||||||
| lit("null")
|
|
||||||
;
|
|
||||||
|
|
||||||
geometry = lit('{')[_a = 0]
|
geometry = lit('{')[_a = 0]
|
||||||
> (((lit("\"type\"") > lit(':') > geometry_type_dispatch[_a = _1])
|
> (((lit("\"type\"") > lit(':') > geometry_type_dispatch[_a = _1])
|
||||||
|
|
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/util/variant.hpp>
|
#include <mapnik/util/variant.hpp>
|
||||||
#include <mapnik/json/positions.hpp>
|
#include <mapnik/json/positions.hpp>
|
||||||
#include <mapnik/json/generic_json.hpp>
|
|
||||||
#include <mapnik/json/error_handler.hpp>
|
#include <mapnik/json/error_handler.hpp>
|
||||||
#include <mapnik/geometry.hpp>
|
#include <mapnik/geometry.hpp>
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
@ -38,6 +37,8 @@
|
||||||
namespace mapnik { namespace json {
|
namespace mapnik { namespace json {
|
||||||
|
|
||||||
namespace qi = boost::spirit::qi;
|
namespace qi = boost::spirit::qi;
|
||||||
|
namespace standard = boost::spirit::standard;
|
||||||
|
using space_type = standard::space_type;
|
||||||
|
|
||||||
template <typename Iterator, typename ErrorHandler = error_handler<Iterator> >
|
template <typename Iterator, typename ErrorHandler = error_handler<Iterator> >
|
||||||
struct positions_grammar :
|
struct positions_grammar :
|
||||||
|
|
|
@ -94,7 +94,6 @@ topojson_grammar<Iterator, ErrorHandler>::topojson_grammar()
|
||||||
using qi::fail;
|
using qi::fail;
|
||||||
using qi::on_error;
|
using qi::on_error;
|
||||||
using phoenix::push_back;
|
using phoenix::push_back;
|
||||||
using phoenix::construct;
|
|
||||||
|
|
||||||
geometry_type_dispatch.add
|
geometry_type_dispatch.add
|
||||||
("\"Point\"",1)
|
("\"Point\"",1)
|
||||||
|
@ -109,29 +108,6 @@ topojson_grammar<Iterator, ErrorHandler>::topojson_grammar()
|
||||||
// error handler
|
// error handler
|
||||||
boost::phoenix::function<ErrorHandler> const error_handler;
|
boost::phoenix::function<ErrorHandler> const error_handler;
|
||||||
boost::phoenix::function<create_geometry_impl> const create_geometry;
|
boost::phoenix::function<create_geometry_impl> const create_geometry;
|
||||||
// generic JSON types
|
|
||||||
json.value = json.object | json.array | json.string_ | json.number
|
|
||||||
;
|
|
||||||
|
|
||||||
json.key_value = json.string_ > lit(':') > json.value
|
|
||||||
;
|
|
||||||
|
|
||||||
json.object = lit('{')
|
|
||||||
> -(json.key_value % lit(','))
|
|
||||||
> lit('}')
|
|
||||||
;
|
|
||||||
|
|
||||||
json.array = lit('[')
|
|
||||||
> -(json.value % lit(','))
|
|
||||||
> lit(']')
|
|
||||||
;
|
|
||||||
|
|
||||||
json.number = json.strict_double[_val = json.double_converter(_1)]
|
|
||||||
| json.int__[_val = json.integer_converter(_1)]
|
|
||||||
| lit("true")[_val = true]
|
|
||||||
| lit("false")[_val = false]
|
|
||||||
| lit("null")[_val = construct<value_null>()]
|
|
||||||
;
|
|
||||||
|
|
||||||
// topo json
|
// topo json
|
||||||
topology = lit('{') >> lit("\"type\"") >> lit(':') >> lit("\"Topology\"")
|
topology = lit('{') >> lit("\"type\"") >> lit(':') >> lit("\"Topology\"")
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
|
|
||||||
//! \brief Set the stop value
|
//! \brief Set the stop value
|
||||||
//! \param[in] value The stop value
|
//! \param[in] value The stop value
|
||||||
inline void set_value(float value) { value_ = value; }
|
inline void set_value(float v) { value_ = v; }
|
||||||
|
|
||||||
//! \brief Get the stop value
|
//! \brief Get the stop value
|
||||||
//! \return The stop value
|
//! \return The stop value
|
||||||
|
@ -205,7 +205,7 @@ public:
|
||||||
//!
|
//!
|
||||||
//! \param[in] value Input value
|
//! \param[in] value Input value
|
||||||
//! \return color associated with the value
|
//! \return color associated with the value
|
||||||
unsigned get_color(float value) const;
|
unsigned get_color(float v) const;
|
||||||
|
|
||||||
|
|
||||||
//! \brief Set the epsilon value for exact mode
|
//! \brief Set the epsilon value for exact mode
|
||||||
|
|
|
@ -149,6 +149,7 @@ namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wpragmas"
|
||||||
#pragma GCC diagnostic ignored "-Wmismatched-tags"
|
#pragma GCC diagnostic ignored "-Wmismatched-tags"
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -160,7 +160,7 @@ topojson_datasource::topojson_datasource(parameters const& params)
|
||||||
}
|
}
|
||||||
if (!inline_string_.empty())
|
if (!inline_string_.empty())
|
||||||
{
|
{
|
||||||
parse_topojson(inline_string_);
|
parse_topojson(inline_string_.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -172,20 +172,22 @@ topojson_datasource::topojson_datasource(parameters const& params)
|
||||||
std::string file_buffer;
|
std::string file_buffer;
|
||||||
file_buffer.resize(file.size());
|
file_buffer.resize(file.size());
|
||||||
std::fread(&file_buffer[0], file.size(), 1, file.get());
|
std::fread(&file_buffer[0], file.size(), 1, file.get());
|
||||||
parse_topojson(file_buffer);
|
parse_topojson(file_buffer.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using base_iterator_type = std::string::const_iterator;
|
using iterator_type = const char*;
|
||||||
const mapnik::topojson::topojson_grammar<base_iterator_type> g;
|
const mapnik::topojson::topojson_grammar<iterator_type> g;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void topojson_datasource::parse_topojson(T const& buffer)
|
void topojson_datasource::parse_topojson(T const& buffer)
|
||||||
{
|
{
|
||||||
boost::spirit::standard::space_type space;
|
boost::spirit::standard::space_type space;
|
||||||
bool result = boost::spirit::qi::phrase_parse(buffer.begin(), buffer.end(), g, space, topo_);
|
auto itr = buffer;
|
||||||
|
auto end = buffer + std::strlen(buffer);
|
||||||
|
bool result = boost::spirit::qi::phrase_parse(itr, end, g, space, topo_);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
throw mapnik::datasource_exception("topojson_datasource: Failed parse TopoJSON file '" + filename_ + "'");
|
throw mapnik::datasource_exception("topojson_datasource: Failed parse TopoJSON file '" + filename_ + "'");
|
||||||
|
|
104
scripts/travis-command-wrapper.py
Executable file
104
scripts/travis-command-wrapper.py
Executable file
|
@ -0,0 +1,104 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# Author: Patrick Ohly <patrick.ohly@intel.com>
|
||||||
|
# Copyright: Copyright (C) 2015 Intel Corporation
|
||||||
|
#
|
||||||
|
# This file is licensed under the MIT license, see COPYING.MIT in
|
||||||
|
# this source distribution for the terms.
|
||||||
|
|
||||||
|
# Runs a command, pipes its output to stdout, and injects status
|
||||||
|
# reports at regular time interval.
|
||||||
|
#
|
||||||
|
# This ensures that TravisCI does not abort the command just because
|
||||||
|
# it is silent for more than 10 minutes, as it can happen with bitbake
|
||||||
|
# when working on a single complex task, like "bitbake linux-yocto".
|
||||||
|
#
|
||||||
|
# Piping bitbake stdout has the advantage that bitbake enters
|
||||||
|
# non-interactive output mode, which it would do when run by TravisCI
|
||||||
|
# directly.
|
||||||
|
#
|
||||||
|
# Finally, the default status messages give some sense of memory
|
||||||
|
# and disk usage, which is critical in the rather constrained
|
||||||
|
# TravisCI environments.
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import optparse
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
parser = optparse.OptionParser()
|
||||||
|
parser.add_option("-s", "--status",
|
||||||
|
help="invoked in a shell when it is time for a status report",
|
||||||
|
# 200 columns is readable in the TravisCI Web UI without wrapping.
|
||||||
|
# Depends of course on screen and font size. Resizing top output
|
||||||
|
# only works (and is needed) on the more recent Trusty TravisCI
|
||||||
|
# environment.
|
||||||
|
default="date; free; df -h .; COLUMNS=200 LINES=30 top -w -b -n 1 2>/dev/null || top -n 1; ps x --cols 200 --forest",
|
||||||
|
metavar="SHELL-CMD")
|
||||||
|
parser.add_option("-i", "--interval",
|
||||||
|
help="repeat status at intervals of this amount of seconds, 0 to disable",
|
||||||
|
default=300,
|
||||||
|
metavar="SECONDS", type="int")
|
||||||
|
parser.add_option("-d", "--deadline",
|
||||||
|
help="stop execution when reaching the given time",
|
||||||
|
default=time.time,
|
||||||
|
metavar="SECONDS-SINCE-EPOCH", type="int")
|
||||||
|
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
def check_deadline(now):
|
||||||
|
if options.deadline > 0 and options.deadline < now:
|
||||||
|
print "\n\n*** travis-cmd-wrapper: deadline reached, shutting down ***\n\n"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Set up status alarm. When we have a deadline, we need to check more often
|
||||||
|
# and/or sooner. Sending a SIGALRM manually will also trigger a status report
|
||||||
|
# (not really possible in TravisCI, but may be useful elsewhere).
|
||||||
|
now = time.time()
|
||||||
|
next_status = now + options.interval
|
||||||
|
alarm_interval = max(options.interval, 0)
|
||||||
|
if options.deadline:
|
||||||
|
check_deadline(now)
|
||||||
|
if options.deadline < now + 60:
|
||||||
|
# Wake up a little too late, to be sure that we trigger the if check.
|
||||||
|
deadline_alarm_interval = max(int(options.deadline + 2 - now), 1)
|
||||||
|
elif next_status > 60:
|
||||||
|
deadline_alarm_interval = 60
|
||||||
|
if deadline_alarm_interval < alarm_interval:
|
||||||
|
alarm_interval = deadline_alarm_interval
|
||||||
|
|
||||||
|
def status(signum, frame):
|
||||||
|
global next_status
|
||||||
|
now = time.time()
|
||||||
|
if options.interval < 0 or now >= next_status:
|
||||||
|
subprocess.call(options.status, shell=True)
|
||||||
|
next_status = now + options.interval
|
||||||
|
check_deadline(now)
|
||||||
|
if alarm_interval > 0:
|
||||||
|
signal.alarm(alarm_interval)
|
||||||
|
|
||||||
|
# Run command.
|
||||||
|
try:
|
||||||
|
cmd = subprocess.Popen(args, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
# Arm timer and handler.
|
||||||
|
signal.signal(signal.SIGALRM, status)
|
||||||
|
if alarm_interval > 0:
|
||||||
|
signal.alarm(alarm_interval)
|
||||||
|
|
||||||
|
while cmd.poll() is None:
|
||||||
|
try:
|
||||||
|
line = cmd.stdout.readline()
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
except IOError, ex:
|
||||||
|
if ex.errno != errno.EINTR:
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
# If we go down, so must our child...
|
||||||
|
if cmd.poll() is None:
|
||||||
|
cmd.kill()
|
||||||
|
|
||||||
|
exit(1 if cmd.returncode else 0)
|
63
src/json/generic_json.cpp
Normal file
63
src/json/generic_json.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* This file is part of Mapnik (c++ mapping toolkit)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Artem Pavlenko
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <mapnik/json/generic_json.hpp>
|
||||||
|
|
||||||
|
namespace mapnik { namespace json {
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
generic_json<Iterator>::generic_json()
|
||||||
|
: generic_json::base_type(value)
|
||||||
|
{
|
||||||
|
qi::lit_type lit;
|
||||||
|
qi::_val_type _val;
|
||||||
|
qi::_1_type _1;
|
||||||
|
using phoenix::construct;
|
||||||
|
// generic json types
|
||||||
|
value = object | array | string_ | number
|
||||||
|
;
|
||||||
|
|
||||||
|
key_value = string_ > lit(':') > value
|
||||||
|
;
|
||||||
|
|
||||||
|
object = lit('{')
|
||||||
|
> -(key_value % lit(','))
|
||||||
|
> lit('}')
|
||||||
|
;
|
||||||
|
|
||||||
|
array = lit('[')
|
||||||
|
> -(value % lit(','))
|
||||||
|
> lit(']')
|
||||||
|
;
|
||||||
|
|
||||||
|
number = strict_double[_val = double_converter(_1)]
|
||||||
|
| int__[_val = integer_converter(_1)]
|
||||||
|
| lit("true") [_val = true]
|
||||||
|
| lit ("false") [_val = false]
|
||||||
|
| lit("null")[_val = construct<value_null>()]
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
using iterator_type = char const*;
|
||||||
|
template struct mapnik::json::generic_json<iterator_type>;
|
|
@ -24,5 +24,5 @@
|
||||||
#include <mapnik/json/topojson_grammar_impl.hpp>
|
#include <mapnik/json/topojson_grammar_impl.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using iterator_type = std::string::const_iterator;
|
using iterator_type = char const*;
|
||||||
template struct mapnik::topojson::topojson_grammar<iterator_type> ;
|
template struct mapnik::topojson::topojson_grammar<iterator_type> ;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fb1529e225b36f8a3077ad23f7005951a07c8a7e
|
Subproject commit 6ce59adfc4f11b16a5dc0e2020c36dc614850989
|
|
@ -1 +1 @@
|
||||||
Subproject commit 91bc22de33fb6bf438d94d3c0db8475a7633588e
|
Subproject commit 61f0d314b989a345df9515d5bc1472c8d5362990
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using iterator_type = std::string::const_iterator;
|
using iterator_type = char const*;
|
||||||
const mapnik::topojson::topojson_grammar<iterator_type> grammar;
|
const mapnik::topojson::topojson_grammar<iterator_type> grammar;
|
||||||
|
|
||||||
bool parse_topology(std::string const& filename, mapnik::topojson::topology & topo)
|
bool parse_topology(std::string const& filename, mapnik::topojson::topology & topo)
|
||||||
|
@ -42,8 +42,8 @@ bool parse_topology(std::string const& filename, mapnik::topojson::topology & to
|
||||||
std::fread(&buffer[0], buffer.size(), 1, file.get());
|
std::fread(&buffer[0], buffer.size(), 1, file.get());
|
||||||
if (!file) return false;
|
if (!file) return false;
|
||||||
boost::spirit::standard::space_type space;
|
boost::spirit::standard::space_type space;
|
||||||
iterator_type itr = buffer.begin();
|
iterator_type itr = buffer.c_str();
|
||||||
iterator_type end = buffer.end();
|
iterator_type end = itr + buffer.length();
|
||||||
bool result = boost::spirit::qi::phrase_parse(itr, end, grammar, space, topo);
|
bool result = boost::spirit::qi::phrase_parse(itr, end, grammar, space, topo);
|
||||||
return (result && (itr == end));
|
return (result && (itr == end));
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,15 @@ def write_config(configuration,template,config_file):
|
||||||
os.chmod(config_file,0755)
|
os.chmod(config_file,0755)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
cxxflags = ' '.join(config_env['LIBMAPNIK_CXXFLAGS'])
|
|
||||||
|
cxxflags_raw = config_env['LIBMAPNIK_CXXFLAGS'];
|
||||||
|
# strip clang specific flags to avoid breaking gcc
|
||||||
|
# while it is not recommended to mix compilers, this nevertheless
|
||||||
|
# makes it easier to compile apps with gcc and mapnik-config against mapnik built with clang
|
||||||
|
to_remove = ['-Wno-unsequenced','-Wno-unknown-warning-option','-Wtautological-compare','-Wheader-hygiene']
|
||||||
|
cxxflags_cleaned = [item for item in config_env['LIBMAPNIK_CXXFLAGS'] if item not in to_remove];
|
||||||
|
|
||||||
|
cxxflags = ' '.join(cxxflags_cleaned)
|
||||||
|
|
||||||
defines = ' '.join(config_env['LIBMAPNIK_DEFINES'])
|
defines = ' '.join(config_env['LIBMAPNIK_DEFINES'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue