Skip to content

Commit

Permalink
Simplify GEOSLineMerge_r
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaston committed Nov 25, 2019
1 parent ec5d8b2 commit 7a7cbf8
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions capi/geos_ts_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1890,26 +1890,15 @@ 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

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);
auto out = gf->buildGeometry(lines->begin(), lines->end());
out->setSRID(g->getSRID());

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

Expand Down

0 comments on commit 7a7cbf8

Please sign in to comment.