Compare commits
4 commits
master
...
node-mapni
Author | SHA1 | Date | |
---|---|---|---|
|
e553f55dc8 | ||
|
9832cb890d | ||
|
3361db7b5d | ||
|
865b0ec120 |
3 changed files with 10 additions and 19 deletions
|
@ -9,8 +9,6 @@ env:
|
||||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||||
- CCACHE_COMPRESS=1
|
- CCACHE_COMPRESS=1
|
||||||
- PREFIX=/tmp/mapnik
|
- PREFIX=/tmp/mapnik
|
||||||
- secure: "F6ivqDNMBQQnrDGA9+7IX+GDswuIqQQd7YPJdQqa2Ked9jddAQDeJClb05ig3JlwfOlYLGZOd43ZX0pKuMtI2Gbkwz211agGP9S3YunwlRg8iWtJlO5kYFUdKCmJNhjg4icfkGELCgwXn+zuEWFSLpkPcjqAFKFlQrIJeAJJgKM="
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.ccache
|
- $HOME/.ccache
|
||||||
|
|
|
@ -8,7 +8,7 @@ todo
|
||||||
- shrink icu data
|
- shrink icu data
|
||||||
'
|
'
|
||||||
|
|
||||||
MASON_VERSION="fde1d9f5"
|
MASON_VERSION="5bc05e04"
|
||||||
|
|
||||||
function setup_mason() {
|
function setup_mason() {
|
||||||
if [[ ! -d ./.mason ]]; then
|
if [[ ! -d ./.mason ]]; then
|
||||||
|
@ -44,7 +44,7 @@ function install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ICU_VERSION="57.1"
|
ICU_VERSION="57.1"
|
||||||
BOOST_VERSION="1.73.0"
|
BOOST_VERSION="1.75.0"
|
||||||
|
|
||||||
function install_mason_deps() {
|
function install_mason_deps() {
|
||||||
install ccache 3.3.1
|
install ccache 3.3.1
|
||||||
|
|
|
@ -265,10 +265,10 @@ double parse_svg_value(T & err_handler, const char* str, bool & is_percent)
|
||||||
css_unit_value units;
|
css_unit_value units;
|
||||||
const char* cur = str; // phrase_parse mutates the first iterator
|
const char* cur = str; // phrase_parse mutates the first iterator
|
||||||
const char* end = str + std::strlen(str);
|
const char* end = str + std::strlen(str);
|
||||||
|
bool is_percent_;
|
||||||
auto apply_value = [&](auto const& ctx) { val = _attr(ctx); is_percent = false; };
|
auto apply_value = [&](auto const& ctx) { val = _attr(ctx); is_percent_ = false; };
|
||||||
auto apply_units = [&](auto const& ctx) { val *= _attr(ctx); };
|
auto apply_units = [&](auto const& ctx) { val *= _attr(ctx); };
|
||||||
auto apply_percent = [&](auto const& ctx) { val *= 0.01; is_percent = true; };
|
auto apply_percent = [&](auto const& ctx) { val *= 0.01; is_percent_ = true; };
|
||||||
|
|
||||||
if (!x3::phrase_parse(cur, end,
|
if (!x3::phrase_parse(cur, end,
|
||||||
x3::double_[apply_value]
|
x3::double_[apply_value]
|
||||||
|
@ -277,8 +277,13 @@ double parse_svg_value(T & err_handler, const char* str, bool & is_percent)
|
||||||
x3::lit('%')[apply_percent]),
|
x3::lit('%')[apply_percent]),
|
||||||
x3::space) || (cur != end))
|
x3::space) || (cur != end))
|
||||||
{
|
{
|
||||||
|
val = 0.0; // restore to default on parsing failure
|
||||||
err_handler.on_error("SVG parse error: failed to parse <number> with value \"" + std::string(str) + "\"");
|
err_handler.on_error("SVG parse error: failed to parse <number> with value \"" + std::string(str) + "\"");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is_percent = is_percent_; // update only on success
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +376,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
|
||||||
auto itr = css.find(element_name);
|
auto itr = css.find(element_name);
|
||||||
if (itr != css.end())
|
if (itr != css.end())
|
||||||
{
|
{
|
||||||
//std::cerr << "-> element key:" << element_name << std::endl;
|
|
||||||
for (auto const& def : std::get<1>(*itr))
|
for (auto const& def : std::get<1>(*itr))
|
||||||
{
|
{
|
||||||
style[std::get<0>(def)] = std::get<1>(def);
|
style[std::get<0>(def)] = std::get<1>(def);
|
||||||
|
@ -396,8 +400,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
|
||||||
auto range = css.equal_range(solitary_class_key);
|
auto range = css.equal_range(solitary_class_key);
|
||||||
for (auto itr = range.first; itr != range.second; ++itr)
|
for (auto itr = range.first; itr != range.second; ++itr)
|
||||||
{
|
{
|
||||||
//std::cerr << "<" << element_name << ">";
|
|
||||||
//std::cerr << "--> solitary class key:" << solitary_class_key << std::endl;
|
|
||||||
for (auto const& def : std::get<1>(*itr))
|
for (auto const& def : std::get<1>(*itr))
|
||||||
{
|
{
|
||||||
style[std::get<0>(def)] = std::get<1>(def);
|
style[std::get<0>(def)] = std::get<1>(def);
|
||||||
|
@ -407,8 +409,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
|
||||||
range = css.equal_range(class_key);
|
range = css.equal_range(class_key);
|
||||||
for (auto itr = range.first; itr != range.second; ++itr)
|
for (auto itr = range.first; itr != range.second; ++itr)
|
||||||
{
|
{
|
||||||
//std::cerr << "<" << element_name << ">";
|
|
||||||
//std::cerr << "---> class key:" << class_key << std::endl;
|
|
||||||
for (auto const& def : std::get<1>(*itr))
|
for (auto const& def : std::get<1>(*itr))
|
||||||
{
|
{
|
||||||
style[std::get<0>(def)] = std::get<1>(def);
|
style[std::get<0>(def)] = std::get<1>(def);
|
||||||
|
@ -416,10 +416,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// std::cerr << "Failed to parse styles..." << std::endl;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto const* id_attr = node->first_attribute("id");
|
auto const* id_attr = node->first_attribute("id");
|
||||||
|
@ -432,8 +428,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
|
||||||
itr = css.find(id_key);
|
itr = css.find(id_key);
|
||||||
if (itr != css.end())
|
if (itr != css.end())
|
||||||
{
|
{
|
||||||
//std::cerr << "<" << element_name << ">";
|
|
||||||
//std::cerr << "----> ID key:" << id_key << std::endl;
|
|
||||||
for (auto const& def : std::get<1>(*itr))
|
for (auto const& def : std::get<1>(*itr))
|
||||||
{
|
{
|
||||||
style[std::get<0>(def)] = std::get<1>(def);
|
style[std::get<0>(def)] = std::get<1>(def);
|
||||||
|
@ -449,7 +443,6 @@ void process_css(svg_parser & parser, rapidxml::xml_node<char> const* node)
|
||||||
{
|
{
|
||||||
auto const& r = std::get<1>(def);
|
auto const& r = std::get<1>(def);
|
||||||
std::string val{r.begin(), r.end()};
|
std::string val{r.begin(), r.end()};
|
||||||
//std::cerr << "PARSE ATTR:" << std::get<0>(def) << ":" << val << std::endl;
|
|
||||||
parse_attr(parser, std::get<0>(def).c_str(), val.c_str());
|
parse_attr(parser, std::get<0>(def).c_str(), val.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue