Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Oct 15, 2022
1 parent c7daad6 commit d0b11bd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/triangulate/VoronoiDiagramBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ VoronoiDiagramBuilder::getDiagramEdges(const geom::GeometryFactory& geomFact)
std::unique_ptr<geom::Geometry> clipPoly(geomFact.toGeometry(&diagramEnv));
std::unique_ptr<Geometry> clipped(clipPoly->intersection(edges.get()));

if (dynamic_cast<LineString*>(clipped.get())) {
std::unique_ptr<std::vector<Geometry*>> lines(new std::vector<Geometry*>());
lines->push_back(clipped.release());
std::unique_ptr<MultiLineString> multi(geomFact.createMultiLineString(lines.release()));
return multi;
if (clipped->getGeometryTypeId() == GEOS_LINESTRING) {
std::vector<std::unique_ptr<LineString>> lines;
lines.emplace_back(static_cast<LineString*>(clipped.release()));
return geomFact.createMultiLineString(std::move(lines));
} else {
return clipped;
}
Expand Down

0 comments on commit d0b11bd

Please sign in to comment.