Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an already existing constant consequently #28

Merged
merged 2 commits into from
Sep 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/GeometryUtil/GeometryUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@ class GeometryUtil {
* Merges multiple geometries into one MultiGeometry.
*
* @param {ol.geom.Geometry[]} geometries An array of ol.geom.geometries;
* @returns {ol.geom.Multipoint|ol.geom.MultiPolygon|ol.geom.MultiLinestring} A Multigeometry.
* @returns {ol.geom.MultiPoint|ol.geom.MultiPolygon|ol.geom.MultiLineString} A Multigeometry.
*/
static mergeGeometries(geometries) {
const multiPrefix = GeometryUtil.MULTI_GEOM_PREFIX;
let geomType = geometries[0].getType();
let mixedGeometryTypes = false;
geometries.forEach(geometry => {
if (geomType.replace('Multi', '') !== geometry.getType().replace('Multi', '')) {
if (geomType.replace(multiPrefix, '') !== geometry.getType().replace(multiPrefix, '')) {
mixedGeometryTypes = true;
}
});
Expand All @@ -184,8 +185,8 @@ class GeometryUtil {

// split all multi-geometries to simple ones if passed geometries are
// multigeometries
if (geomType.startsWith(GeometryUtil.MULTI_GEOM_PREFIX)) {
const multiGeomPartType = geomType.substring(GeometryUtil.MULTI_GEOM_PREFIX.length);
if (geomType.startsWith(multiPrefix)) {
const multiGeomPartType = geomType.substring(multiPrefix.length);
geometries = GeometryUtil.separateGeometries(geometries);
geomType = multiGeomPartType;
}
Expand Down