Skip to content
Snippets Groups Projects
Commit cfddd1b4 authored by Tom Fischer's avatar Tom Fischer
Browse files

changed SHPInterface::adjustPolylines() in order to omit line segments with zero length

parent be033bcf
No related branches found
No related tags found
No related merge requests found
......@@ -167,8 +167,17 @@ void SHPInterface::adjustPolylines (std::vector<GeoLib::Polyline*>* lines,
for (size_t i = 0; i < lines->size(); i++)
{
GeoLib::Polyline* line( (*lines)[i] );
size_t nPoints( line->getNumberOfPoints() );
for (size_t j = 0; j < nPoints; j++)
line->setPointID(j, id_map[line->getPointID(j)]);
size_t previous_pnt_id (std::numeric_limits<size_t>::max());
for (size_t j = 0; j < line->getNumberOfPoints(); j++) {
size_t jth_pnt_id(id_map[line->getPointID(j)]);
if (previous_pnt_id == jth_pnt_id) {
line->removePoint(j);
j--;
} else {
line->setPointID(j, jth_pnt_id);
}
previous_pnt_id = jth_pnt_id;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment