Skip to content

Commit

Permalink
Revert "Simplify GEOSLineMerge_r"
Browse files Browse the repository at this point in the history
This reverts commit 7a7cbf8.
  • Loading branch information
Algunenano committed Jan 15, 2020
1 parent 22532f5 commit 0e40b08
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions capi/geos_ts_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1890,15 +1890,26 @@ extern "C" {
return execute(extHandle, [&]() {
GEOSContextHandleInternal_t* handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
const GeometryFactory* gf = handle->geomFactory;
Geometry* out;
LineMerger lmrgr;
lmrgr.add(g);

std::vector<LineString*>* lines = lmrgr.getMergedLineStrings();
assert(0 != lines);

// TODO avoid "new" here

auto out = gf->buildGeometry(lines->begin(), lines->end());
std::vector<Geometry*>* geoms = new std::vector<Geometry*>(lines->size());
for(std::vector<Geometry*>::size_type i = 0; i < lines->size(); ++i) {
(*geoms)[i] = (*lines)[i];
}
delete lines;
lines = 0;

out = gf->buildGeometry(geoms);
out->setSRID(g->getSRID());

return out.release();
return out;
});
}

Expand Down

0 comments on commit 0e40b08

Please sign in to comment.