Merge branch 'master' into boost_1_67

This commit is contained in:
Artem Pavlenko 2018-05-01 10:01:59 +02:00
commit b1a19bc13c
2 changed files with 76 additions and 1 deletions

View file

@ -1275,7 +1275,10 @@ if not preconfigured:
color_print(4,"Configuring on %s in *%s*..." % (env['PLATFORM'],mode))
cxx_version = call("%s --version" % env["CXX"] ,silent=True)
color_print(5, "CXX %s" % cxx_version.decode("utf8"))
if cxx_version:
color_print(5, "CXX %s" % cxx_version.decode("utf8"))
else:
color_print(5, "Could not detect CXX compiler")
env['MISSING_DEPS'] = []
env['SKIPPED_DEPS'] = []

View file

@ -150,6 +150,76 @@ private:
};
struct allow_overlap_visitor
{
bool operator()(point_symbolizer const&) { return true; }
bool operator()(line_symbolizer const&) { return false; }
bool operator()(line_pattern_symbolizer const&) { return false; }
bool operator()(polygon_symbolizer const&) { return false; }
bool operator()(polygon_pattern_symbolizer const&) { return false; }
bool operator()(raster_symbolizer const&) { return false; }
bool operator()(shield_symbolizer const&) { return false; }
bool operator()(text_symbolizer const&) { return true; }
bool operator()(building_symbolizer const&) { return false; }
bool operator()(markers_symbolizer const&) { return true; }
bool operator()(group_symbolizer const&) { return false; }
bool operator()(debug_symbolizer const&) { return true; } //Requires the quadtree
bool operator()(dot_symbolizer const&) { return false; }
};
// If all symbolizers declare 'allow_overlap: true' (their placement is independent
// from already placed symbols), there is no need to check collisions with subsequent
// symbolizers. To avoid building the quadtree unnecessarily we set
// the 'ignore_placement' flag
void map_apply_overlap_optimization(Map &map)
{
bool ignore_placement = true;
for (auto const & style : map.styles())
{
for (auto const & rule : style.second.get_rules())
{
for (auto const & sym : rule)
{
struct allow_overlap_visitor visitor;
if (util::apply_visitor(visitor, sym))
{
symbolizer_base const & sb = sym.get_unchecked<markers_symbolizer>();
auto prop_it = sb.properties.find(keys::allow_overlap);
if (prop_it != sb.properties.end())
{
if (prop_it->second == true)
{
continue;
}
}
ignore_placement = false;
break;
}
}
}
}
if (ignore_placement)
{
for (auto & style : map.styles())
{
for (auto & rule : style.second.get_rules_nonconst())
{
for (auto & sym : rule)
{
struct allow_overlap_visitor visitor;
if (util::apply_visitor(visitor, sym))
{
symbolizer_base & sb = sym.get_unchecked<markers_symbolizer>();
sb.properties[keys::ignore_placement] = true;
}
}
}
}
MAPNIK_LOG_DEBUG(load_map) << "setting ignore_placement=true due to all rules having allow_overlap=true";
}
}
void load_map(Map & map, std::string const& filename, bool strict, std::string base_path)
{
xml_tree tree;
@ -157,6 +227,7 @@ void load_map(Map & map, std::string const& filename, bool strict, std::string b
read_xml(filename, tree.root());
map_parser parser(map, strict, filename);
parser.parse_map(map, tree.root(), base_path);
map_apply_overlap_optimization(map);
}
void load_map_string(Map & map, std::string const& str, bool strict, std::string base_path)
@ -172,6 +243,7 @@ void load_map_string(Map & map, std::string const& str, bool strict, std::string
}
map_parser parser(map, strict, base_path);
parser.parse_map(map, tree.root(), base_path);
map_apply_overlap_optimization(map);
}
void map_parser::parse_map(Map & map, xml_node const& node, std::string const& base_path)