Skip to content

Commit b670f92

Browse files
committed
perf: Use geos for addition
1 parent 62e3d7f commit b670f92

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

bg_operators.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ bg::model::multi_polygon<polygon_type_t> operator+(const bg::model::multi_polygo
150150
bg::convert(rhs, ret);
151151
return ret;
152152
}
153+
#ifdef GEOS_VERSION
154+
auto geos_rhs = to_geos(rhs);
155+
return from_geos<multi_polygon_type_fp>(to_geos(lhs)->Union(geos_rhs.get()));
156+
#else // !GEOS_VERSION
153157
// This optimization fixes a bug in boost geometry when shapes are bordering
154158
// somwhat but not overlapping. This is exposed by EasyEDA that makes lots of
155159
// shapes like that.
@@ -166,6 +170,7 @@ bg::model::multi_polygon<polygon_type_t> operator+(const bg::model::multi_polygo
166170
bg::model::multi_polygon<polygon_type_t> ret;
167171
bg::union_(lhs, rhs, ret);
168172
return ret;
173+
#endif //GEOS_VERSION
169174
}
170175

171176
template multi_polygon_type_fp operator+(const multi_polygon_type_fp&, const multi_polygon_type_fp&);

0 commit comments

Comments
 (0)