mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-13 00:22:10 +00:00
fixed dissolve linestring->ring
[SVN r61039]
This commit is contained in:
@@ -145,6 +145,10 @@ struct dissolve<ring_tag, ring_tag, Ring, RingOut>
|
||||
(e.g. vector of "intersection/turn point"'s)
|
||||
\param geometry first geometry
|
||||
\param output container which will contain dissolved geometry
|
||||
\note Currently dissolve with a (multi)linestring does NOT remove internal
|
||||
overlap, it only tries to connect multiple line end-points.
|
||||
TODO: we should change this behaviour and add a separate "connect"
|
||||
algorithm, and let dissolve work like polygon.
|
||||
*/
|
||||
template
|
||||
<
|
||||
|
||||
@@ -108,19 +108,27 @@ struct dissolve_multi_linestring
|
||||
}
|
||||
|
||||
static inline map_iterator_type find_start(map_type const& map,
|
||||
std::map<int, bool>& included)
|
||||
std::map<int, bool>& included, int expected_count = 1)
|
||||
{
|
||||
for (map_iterator_type it = map.begin();
|
||||
it != map.end();
|
||||
++it)
|
||||
{
|
||||
int count = map.count(it->first);
|
||||
if (count == 1 && ! included[it->second.index])
|
||||
if (count == expected_count && ! included[it->second.index])
|
||||
{
|
||||
included[it->second.index] = true;
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
// Not found with one point, try one with two points
|
||||
// to find rings
|
||||
if (expected_count == 1)
|
||||
{
|
||||
return find_start(map, included, 2);
|
||||
}
|
||||
|
||||
return map.end();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user