diff --git a/src/org/locationtech/jts/algorithm/ConvexHull.js b/src/org/locationtech/jts/algorithm/ConvexHull.js index 4bef46c16..8c4c466cf 100644 --- a/src/org/locationtech/jts/algorithm/ConvexHull.js +++ b/src/org/locationtech/jts/algorithm/ConvexHull.js @@ -14,16 +14,12 @@ export default class ConvexHull { this.inputPts = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [geometry] = args; - overloaded.call(this, ConvexHull.extractCoordinates(geometry), geometry.getFactory()); - })(...args); + let [geometry] = args; + overloaded.call(this, ConvexHull.extractCoordinates(geometry), geometry.getFactory()); } else if (args.length === 2) { - return ((...args) => { - let [pts, geomFactory] = args; - this.inputPts = UniqueCoordinateArrayFilter.filterCoordinates(pts); - this.geomFactory = geomFactory; - })(...args); + let [pts, geomFactory] = args; + this.inputPts = UniqueCoordinateArrayFilter.filterCoordinates(pts); + this.geomFactory = geomFactory; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/algorithm/HCoordinate.js b/src/org/locationtech/jts/algorithm/HCoordinate.js index f41e3d98f..d165d4c04 100644 --- a/src/org/locationtech/jts/algorithm/HCoordinate.js +++ b/src/org/locationtech/jts/algorithm/HCoordinate.js @@ -8,62 +8,48 @@ export default class HCoordinate { this.w = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.x = 0.0; - this.y = 0.0; - this.w = 1.0; - })(...args); + let [] = args; + this.x = 0.0; + this.y = 0.0; + this.w = 1.0; } else if (args.length === 1) { - return ((...args) => { - let [p] = args; - this.x = p.x; - this.y = p.y; - this.w = 1.0; - })(...args); + let [p] = args; + this.x = p.x; + this.y = p.y; + this.w = 1.0; } else if (args.length === 2) { if (typeof args[0] === "number" && typeof args[1] === "number") { - return ((...args) => { - let [_x, _y] = args; - this.x = _x; - this.y = _y; - this.w = 1.0; - })(...args); + let [_x, _y] = args; + this.x = _x; + this.y = _y; + this.w = 1.0; } else if (args[0] instanceof HCoordinate && args[1] instanceof HCoordinate) { - return ((...args) => { - let [p1, p2] = args; - this.x = p1.y * p2.w - p2.y * p1.w; - this.y = p2.x * p1.w - p1.x * p2.w; - this.w = p1.x * p2.y - p2.x * p1.y; - })(...args); + let [p1, p2] = args; + this.x = p1.y * p2.w - p2.y * p1.w; + this.y = p2.x * p1.w - p1.x * p2.w; + this.w = p1.x * p2.y - p2.x * p1.y; } else if (args[0] instanceof Coordinate && args[1] instanceof Coordinate) { - return ((...args) => { - let [p1, p2] = args; - this.x = p1.y - p2.y; - this.y = p2.x - p1.x; - this.w = p1.x * p2.y - p2.x * p1.y; - })(...args); + let [p1, p2] = args; + this.x = p1.y - p2.y; + this.y = p2.x - p1.x; + this.w = p1.x * p2.y - p2.x * p1.y; } } else if (args.length === 3) { - return ((...args) => { - let [_x, _y, _w] = args; - this.x = _x; - this.y = _y; - this.w = _w; - })(...args); + let [_x, _y, _w] = args; + this.x = _x; + this.y = _y; + this.w = _w; } else if (args.length === 4) { - return ((...args) => { - let [p1, p2, q1, q2] = args; - var px = p1.y - p2.y; - var py = p2.x - p1.x; - var pw = p1.x * p2.y - p2.x * p1.y; - var qx = q1.y - q2.y; - var qy = q2.x - q1.x; - var qw = q1.x * q2.y - q2.x * q1.y; - this.x = py * qw - qy * pw; - this.y = qx * pw - px * qw; - this.w = px * qy - qx * py; - })(...args); + let [p1, p2, q1, q2] = args; + var px = p1.y - p2.y; + var py = p2.x - p1.x; + var pw = p1.x * p2.y - p2.x * p1.y; + var qx = q1.y - q2.y; + var qy = q2.x - q1.x; + var qw = q1.x * q2.y - q2.x * q1.y; + this.x = py * qw - qy * pw; + this.y = qx * pw - px * qw; + this.w = px * qy - qx * py; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/algorithm/MinimumDiameter.js b/src/org/locationtech/jts/algorithm/MinimumDiameter.js index 62cebb841..791a21723 100644 --- a/src/org/locationtech/jts/algorithm/MinimumDiameter.js +++ b/src/org/locationtech/jts/algorithm/MinimumDiameter.js @@ -14,16 +14,12 @@ export default class MinimumDiameter { this.minWidth = 0.0; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [inputGeom] = args; - overloaded.call(this, inputGeom, false); - })(...args); + let [inputGeom] = args; + overloaded.call(this, inputGeom, false); } else if (args.length === 2) { - return ((...args) => { - let [inputGeom, isConvex] = args; - this.inputGeom = inputGeom; - this.isConvex = isConvex; - })(...args); + let [inputGeom, isConvex] = args; + this.inputGeom = inputGeom; + this.isConvex = isConvex; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/algorithm/PointLocator.js b/src/org/locationtech/jts/algorithm/PointLocator.js index 1a910ca85..37a817a60 100644 --- a/src/org/locationtech/jts/algorithm/PointLocator.js +++ b/src/org/locationtech/jts/algorithm/PointLocator.js @@ -18,15 +18,11 @@ export default class PointLocator { this.numBoundaries = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [boundaryRule] = args; - if (boundaryRule === null) throw new IllegalArgumentException("Rule must be non-null"); - this.boundaryRule = boundaryRule; - })(...args); + let [boundaryRule] = args; + if (boundaryRule === null) throw new IllegalArgumentException("Rule must be non-null"); + this.boundaryRule = boundaryRule; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/Coordinate.js b/src/org/locationtech/jts/geom/Coordinate.js index 1d6e97be4..65ee8446a 100644 --- a/src/org/locationtech/jts/geom/Coordinate.js +++ b/src/org/locationtech/jts/geom/Coordinate.js @@ -13,27 +13,19 @@ export default class Coordinate { this.z = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, 0.0, 0.0); - })(...args); + let [] = args; + overloaded.call(this, 0.0, 0.0); } else if (args.length === 1) { - return ((...args) => { - let [c] = args; - overloaded.call(this, c.x, c.y, c.z); - })(...args); + let [c] = args; + overloaded.call(this, c.x, c.y, c.z); } else if (args.length === 2) { - return ((...args) => { - let [x, y] = args; - overloaded.call(this, x, y, Coordinate.NULL_ORDINATE); - })(...args); + let [x, y] = args; + overloaded.call(this, x, y, Coordinate.NULL_ORDINATE); } else if (args.length === 3) { - return ((...args) => { - let [x, y, z] = args; - this.x = x; - this.y = y; - this.z = z; - })(...args); + let [x, y, z] = args; + this.x = x; + this.y = y; + this.z = z; } }; return overloaded.apply(this, args); @@ -166,16 +158,12 @@ class DimensionalComparator { this.dimensionsToTest = 2; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, 2); - })(...args); + let [] = args; + overloaded.call(this, 2); } else if (args.length === 1) { - return ((...args) => { - let [dimensionsToTest] = args; - if (dimensionsToTest !== 2 && dimensionsToTest !== 3) throw new IllegalArgumentException("only 2 or 3 dimensions may be specified"); - this.dimensionsToTest = dimensionsToTest; - })(...args); + let [dimensionsToTest] = args; + if (dimensionsToTest !== 2 && dimensionsToTest !== 3) throw new IllegalArgumentException("only 2 or 3 dimensions may be specified"); + this.dimensionsToTest = dimensionsToTest; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/CoordinateSequenceComparator.js b/src/org/locationtech/jts/geom/CoordinateSequenceComparator.js index 03ae99c48..735b4b33d 100644 --- a/src/org/locationtech/jts/geom/CoordinateSequenceComparator.js +++ b/src/org/locationtech/jts/geom/CoordinateSequenceComparator.js @@ -6,15 +6,11 @@ export default class CoordinateSequenceComparator { this.dimensionLimit = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.dimensionLimit = Integer.MAX_VALUE; - })(...args); + let [] = args; + this.dimensionLimit = Integer.MAX_VALUE; } else if (args.length === 1) { - return ((...args) => { - let [dimensionLimit] = args; - this.dimensionLimit = dimensionLimit; - })(...args); + let [dimensionLimit] = args; + this.dimensionLimit = dimensionLimit; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/Envelope.js b/src/org/locationtech/jts/geom/Envelope.js index 54d49683e..b036359b0 100644 --- a/src/org/locationtech/jts/geom/Envelope.js +++ b/src/org/locationtech/jts/geom/Envelope.js @@ -9,32 +9,22 @@ export default class Envelope { this.maxy = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.init(); - })(...args); + let [] = args; + this.init(); } else if (args.length === 1) { if (args[0] instanceof Coordinate) { - return ((...args) => { - let [p] = args; - this.init(p.x, p.x, p.y, p.y); - })(...args); + let [p] = args; + this.init(p.x, p.x, p.y, p.y); } else if (args[0] instanceof Envelope) { - return ((...args) => { - let [env] = args; - this.init(env); - })(...args); + let [env] = args; + this.init(env); } } else if (args.length === 2) { - return ((...args) => { - let [p1, p2] = args; - this.init(p1.x, p2.x, p1.y, p2.y); - })(...args); + let [p1, p2] = args; + this.init(p1.x, p2.x, p1.y, p2.y); } else if (args.length === 4) { - return ((...args) => { - let [x1, x2, y1, y2] = args; - this.init(x1, x2, y1, y2); - })(...args); + let [x1, x2, y1, y2] = args; + this.init(x1, x2, y1, y2); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/Geometry.js b/src/org/locationtech/jts/geom/Geometry.js index 7f340bd72..33dc47b5c 100644 --- a/src/org/locationtech/jts/geom/Geometry.js +++ b/src/org/locationtech/jts/geom/Geometry.js @@ -5,23 +5,15 @@ import Envelope from './Envelope'; import Assert from '../util/Assert'; export default class Geometry { constructor(...args) { - (() => { - this.envelope = null; - this.factory = null; - this.SRID = null; - this.userData = null; - })(); - const overloads = (...args) => { - switch (args.length) { - case 1: - return ((...args) => { - let [factory] = args; - this.factory = factory; - this.SRID = factory.getSRID(); - })(...args); - } - }; - return overloads.apply(this, args); + this.envelope = null; + this.factory = null; + this.SRID = null; + this.userData = null; + if (args.length === 1) { + let [factory] = args; + this.factory = factory; + this.SRID = factory.getSRID(); + } } get interfaces_() { return [Cloneable, Comparable, Serializable]; @@ -55,28 +47,20 @@ export default class Geometry { return 0.0; } union(...args) { - const overloads = (...args) => { - switch (args.length) { - case 0: - return ((...args) => { - let [] = args; - return UnaryUnionOp.union(this); - })(...args); - case 1: - return ((...args) => { - let [other] = args; - if (this.isEmpty() || other.isEmpty()) { - if (this.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, this.factory); - if (this.isEmpty()) return other.copy(); - if (other.isEmpty()) return this.copy(); - } - this.checkNotGeometryCollection(this); - this.checkNotGeometryCollection(other); - return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION); - })(...args); + if (args.length === 0) { + let [] = args; + return UnaryUnionOp.union(this); + } else if (args.length === 1) { + let [other] = args; + if (this.isEmpty() || other.isEmpty()) { + if (this.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, this.factory); + if (this.isEmpty()) return other.copy(); + if (other.isEmpty()) return this.copy(); } - }; - return overloads.apply(this, args); + this.checkNotGeometryCollection(this); + this.checkNotGeometryCollection(other); + return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION); + } } isValid() { return IsValidOp.isValid(this); @@ -85,26 +69,18 @@ export default class Geometry { return false; } equals(...args) { - const overloads = (...args) => { - switch (args.length) { - case 1: - if (args[0] instanceof Geometry) { - return ((...args) => { - let [g] = args; - if (g === null) return false; - return this.equalsTopo(g); - })(...args); - } else if (args[0] instanceof Object) { - return ((...args) => { - let [o] = args; - if (!(o instanceof Geometry)) return false; - var g = o; - return this.equalsExact(g); - })(...args); - } + if (args.length === 1) { + if (args[0] instanceof Geometry) { + let [g] = args; + if (g === null) return false; + return this.equalsTopo(g); + } else if (args[0] instanceof Object) { + let [o] = args; + if (!(o instanceof Geometry)) return false; + var g = o; + return this.equalsExact(g); } - }; - return overloads.apply(this, args); + } } equalsExact(other) { return this === other || this.equalsExact(other, 0); @@ -117,6 +93,9 @@ export default class Geometry { map(g) { return g.intersection(g2); } + get interfaces_() { + return [MapOp]; + } })()); } this.checkNotGeometryCollection(this); @@ -154,26 +133,16 @@ export default class Geometry { this.envelope = null; } buffer(...args) { - const overloads = (...args) => { - switch (args.length) { - case 1: - return ((...args) => { - let [distance] = args; - return BufferOp.bufferOp(this, distance); - })(...args); - case 2: - return ((...args) => { - let [distance, quadrantSegments] = args; - return BufferOp.bufferOp(this, distance, quadrantSegments); - })(...args); - case 3: - return ((...args) => { - let [distance, quadrantSegments, endCapStyle] = args; - return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle); - })(...args); - } - }; - return overloads.apply(this, args); + if (args.length === 1) { + let [distance] = args; + return BufferOp.bufferOp(this, distance); + } else if (args.length === 2) { + let [distance, quadrantSegments] = args; + return BufferOp.bufferOp(this, distance, quadrantSegments); + } else if (args.length === 3) { + let [distance, quadrantSegments, endCapStyle] = args; + return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle); + } } equalsNorm(g) { if (g === null) return false; @@ -186,47 +155,39 @@ export default class Geometry { return 1; } compareTo(...args) { - const overloads = (...args) => { - switch (args.length) { - case 1: - return ((...args) => { - let [o] = args; - var other = o; - if (this.getSortIndex() !== other.getSortIndex()) { - return this.getSortIndex() - other.getSortIndex(); - } - if (this.isEmpty() && other.isEmpty()) { - return 0; - } - if (this.isEmpty()) { - return -1; - } - if (other.isEmpty()) { - return 1; - } - return this.compareToSameClass(o); - })(...args); - case 2: - return ((...args) => { - let [o, comp] = args; - var other = o; - if (this.getSortIndex() !== other.getSortIndex()) { - return this.getSortIndex() - other.getSortIndex(); - } - if (this.isEmpty() && other.isEmpty()) { - return 0; - } - if (this.isEmpty()) { - return -1; - } - if (other.isEmpty()) { - return 1; - } - return this.compareToSameClass(o, comp); - })(...args); + if (args.length === 1) { + let [o] = args; + var other = o; + if (this.getSortIndex() !== other.getSortIndex()) { + return this.getSortIndex() - other.getSortIndex(); + } + if (this.isEmpty() && other.isEmpty()) { + return 0; + } + if (this.isEmpty()) { + return -1; } - }; - return overloads.apply(this, args); + if (other.isEmpty()) { + return 1; + } + return this.compareToSameClass(o); + } else if (args.length === 2) { + let [o, comp] = args; + var other = o; + if (this.getSortIndex() !== other.getSortIndex()) { + return this.getSortIndex() - other.getSortIndex(); + } + if (this.isEmpty() && other.isEmpty()) { + return 0; + } + if (this.isEmpty()) { + return -1; + } + if (other.isEmpty()) { + return 1; + } + return this.compareToSameClass(o, comp); + } } convexHull() { return new ConvexHull(this).getConvexHull(); @@ -259,23 +220,15 @@ export default class Geometry { return a.distance(b) <= tolerance; } relate(...args) { - const overloads = (...args) => { - switch (args.length) { - case 1: - return ((...args) => { - let [g] = args; - this.checkNotGeometryCollection(this); - this.checkNotGeometryCollection(g); - return RelateOp.relate(this, g); - })(...args); - case 2: - return ((...args) => { - let [g, intersectionPattern] = args; - return this.relate(g).matches(intersectionPattern); - })(...args); - } - }; - return overloads.apply(this, args); + if (args.length === 1) { + let [g] = args; + this.checkNotGeometryCollection(this); + this.checkNotGeometryCollection(g); + return RelateOp.relate(this, g); + } else if (args.length === 2) { + let [g, intersectionPattern] = args; + return this.relate(g).matches(intersectionPattern); + } } overlaps(g) { if (!this.getEnvelopeInternal().intersects(g.getEnvelopeInternal())) return false; @@ -438,4 +391,7 @@ Geometry.geometryChangedFilter = new (class { filter(geom) { geom.geometryChangedAction(); } + get interfaces_() { + return [GeometryComponentFilter]; + } })(); diff --git a/src/org/locationtech/jts/geom/GeometryFactory.js b/src/org/locationtech/jts/geom/GeometryFactory.js index 4231651c1..fd20d0322 100644 --- a/src/org/locationtech/jts/geom/GeometryFactory.js +++ b/src/org/locationtech/jts/geom/GeometryFactory.js @@ -22,34 +22,24 @@ export default class GeometryFactory { this.SRID = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, new PrecisionModel(), 0); - })(...args); + let [] = args; + overloaded.call(this, new PrecisionModel(), 0); } else if (args.length === 1) { if (args[0].interfaces_ && args[0].interfaces_.indexOf(CoordinateSequenceFactory) > -1) { - return ((...args) => { - let [coordinateSequenceFactory] = args; - overloaded.call(this, new PrecisionModel(), 0, coordinateSequenceFactory); - })(...args); + let [coordinateSequenceFactory] = args; + overloaded.call(this, new PrecisionModel(), 0, coordinateSequenceFactory); } else if (args[0] instanceof PrecisionModel) { - return ((...args) => { - let [precisionModel] = args; - overloaded.call(this, precisionModel, 0, GeometryFactory.getDefaultCoordinateSequenceFactory()); - })(...args); + let [precisionModel] = args; + overloaded.call(this, precisionModel, 0, GeometryFactory.getDefaultCoordinateSequenceFactory()); } } else if (args.length === 2) { - return ((...args) => { - let [precisionModel, SRID] = args; - overloaded.call(this, precisionModel, SRID, GeometryFactory.getDefaultCoordinateSequenceFactory()); - })(...args); + let [precisionModel, SRID] = args; + overloaded.call(this, precisionModel, SRID, GeometryFactory.getDefaultCoordinateSequenceFactory()); } else if (args.length === 3) { - return ((...args) => { - let [precisionModel, SRID, coordinateSequenceFactory] = args; - this.precisionModel = precisionModel; - this.coordinateSequenceFactory = coordinateSequenceFactory; - this.SRID = SRID; - })(...args); + let [precisionModel, SRID, coordinateSequenceFactory] = args; + this.precisionModel = precisionModel; + this.coordinateSequenceFactory = coordinateSequenceFactory; + this.SRID = SRID; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/IntersectionMatrix.js b/src/org/locationtech/jts/geom/IntersectionMatrix.js index 4b80dfe40..0165b7b25 100644 --- a/src/org/locationtech/jts/geom/IntersectionMatrix.js +++ b/src/org/locationtech/jts/geom/IntersectionMatrix.js @@ -8,32 +8,26 @@ export default class IntersectionMatrix { this.matrix = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.matrix = Array(3).fill().map(() => Array(3)); - this.setAll(Dimension.FALSE); - })(...args); + let [] = args; + this.matrix = Array(3).fill().map(() => Array(3)); + this.setAll(Dimension.FALSE); } else if (args.length === 1) { if (typeof args[0] === "string") { - return ((...args) => { - let [elements] = args; - overloaded.call(this); - this.set(elements); - })(...args); + let [elements] = args; + overloaded.call(this); + this.set(elements); } else if (args[0] instanceof IntersectionMatrix) { - return ((...args) => { - let [other] = args; - overloaded.call(this); - this.matrix[Location.INTERIOR][Location.INTERIOR] = other.matrix[Location.INTERIOR][Location.INTERIOR]; - this.matrix[Location.INTERIOR][Location.BOUNDARY] = other.matrix[Location.INTERIOR][Location.BOUNDARY]; - this.matrix[Location.INTERIOR][Location.EXTERIOR] = other.matrix[Location.INTERIOR][Location.EXTERIOR]; - this.matrix[Location.BOUNDARY][Location.INTERIOR] = other.matrix[Location.BOUNDARY][Location.INTERIOR]; - this.matrix[Location.BOUNDARY][Location.BOUNDARY] = other.matrix[Location.BOUNDARY][Location.BOUNDARY]; - this.matrix[Location.BOUNDARY][Location.EXTERIOR] = other.matrix[Location.BOUNDARY][Location.EXTERIOR]; - this.matrix[Location.EXTERIOR][Location.INTERIOR] = other.matrix[Location.EXTERIOR][Location.INTERIOR]; - this.matrix[Location.EXTERIOR][Location.BOUNDARY] = other.matrix[Location.EXTERIOR][Location.BOUNDARY]; - this.matrix[Location.EXTERIOR][Location.EXTERIOR] = other.matrix[Location.EXTERIOR][Location.EXTERIOR]; - })(...args); + let [other] = args; + overloaded.call(this); + this.matrix[Location.INTERIOR][Location.INTERIOR] = other.matrix[Location.INTERIOR][Location.INTERIOR]; + this.matrix[Location.INTERIOR][Location.BOUNDARY] = other.matrix[Location.INTERIOR][Location.BOUNDARY]; + this.matrix[Location.INTERIOR][Location.EXTERIOR] = other.matrix[Location.INTERIOR][Location.EXTERIOR]; + this.matrix[Location.BOUNDARY][Location.INTERIOR] = other.matrix[Location.BOUNDARY][Location.INTERIOR]; + this.matrix[Location.BOUNDARY][Location.BOUNDARY] = other.matrix[Location.BOUNDARY][Location.BOUNDARY]; + this.matrix[Location.BOUNDARY][Location.EXTERIOR] = other.matrix[Location.BOUNDARY][Location.EXTERIOR]; + this.matrix[Location.EXTERIOR][Location.INTERIOR] = other.matrix[Location.EXTERIOR][Location.INTERIOR]; + this.matrix[Location.EXTERIOR][Location.BOUNDARY] = other.matrix[Location.EXTERIOR][Location.BOUNDARY]; + this.matrix[Location.EXTERIOR][Location.EXTERIOR] = other.matrix[Location.EXTERIOR][Location.EXTERIOR]; } } }; diff --git a/src/org/locationtech/jts/geom/LineSegment.js b/src/org/locationtech/jts/geom/LineSegment.js index a204ae53d..155250436 100644 --- a/src/org/locationtech/jts/geom/LineSegment.js +++ b/src/org/locationtech/jts/geom/LineSegment.js @@ -12,26 +12,18 @@ export default class LineSegment { this.p1 = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, new Coordinate(), new Coordinate()); - })(...args); + let [] = args; + overloaded.call(this, new Coordinate(), new Coordinate()); } else if (args.length === 1) { - return ((...args) => { - let [ls] = args; - overloaded.call(this, ls.p0, ls.p1); - })(...args); + let [ls] = args; + overloaded.call(this, ls.p0, ls.p1); } else if (args.length === 2) { - return ((...args) => { - let [p0, p1] = args; - this.p0 = p0; - this.p1 = p1; - })(...args); + let [p0, p1] = args; + this.p0 = p0; + this.p1 = p1; } else if (args.length === 4) { - return ((...args) => { - let [x0, y0, x1, y1] = args; - overloaded.call(this, new Coordinate(x0, y0), new Coordinate(x1, y1)); - })(...args); + let [x0, y0, x1, y1] = args; + overloaded.call(this, new Coordinate(x0, y0), new Coordinate(x1, y1)); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/OctagonalEnvelope.js b/src/org/locationtech/jts/geom/OctagonalEnvelope.js index 2be78c8e3..79cef5b6a 100644 --- a/src/org/locationtech/jts/geom/OctagonalEnvelope.js +++ b/src/org/locationtech/jts/geom/OctagonalEnvelope.js @@ -19,37 +19,25 @@ export default class OctagonalEnvelope { this.maxB = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { if (args[0] instanceof Coordinate) { - return ((...args) => { - let [p] = args; - this.expandToInclude(p); - })(...args); + let [p] = args; + this.expandToInclude(p); } else if (args[0] instanceof Envelope) { - return ((...args) => { - let [env] = args; - this.expandToInclude(env); - })(...args); + let [env] = args; + this.expandToInclude(env); } else if (args[0] instanceof OctagonalEnvelope) { - return ((...args) => { - let [oct] = args; - this.expandToInclude(oct); - })(...args); + let [oct] = args; + this.expandToInclude(oct); } else if (args[0] instanceof Geometry) { - return ((...args) => { - let [geom] = args; - this.expandToInclude(geom); - })(...args); + let [geom] = args; + this.expandToInclude(geom); } } else if (args.length === 2) { - return ((...args) => { - let [p0, p1] = args; - this.expandToInclude(p0); - this.expandToInclude(p1); - })(...args); + let [p0, p1] = args; + this.expandToInclude(p0); + this.expandToInclude(p1); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/PrecisionModel.js b/src/org/locationtech/jts/geom/PrecisionModel.js index 4bf0c5dcd..70be86826 100644 --- a/src/org/locationtech/jts/geom/PrecisionModel.js +++ b/src/org/locationtech/jts/geom/PrecisionModel.js @@ -10,31 +10,23 @@ export default class PrecisionModel { this.scale = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.modelType = PrecisionModel.FLOATING; - })(...args); + let [] = args; + this.modelType = PrecisionModel.FLOATING; } else if (args.length === 1) { if (args[0] instanceof Type) { - return ((...args) => { - let [modelType] = args; - this.modelType = modelType; - if (modelType === PrecisionModel.FIXED) { - this.setScale(1.0); - } - })(...args); + let [modelType] = args; + this.modelType = modelType; + if (modelType === PrecisionModel.FIXED) { + this.setScale(1.0); + } } else if (typeof args[0] === "number") { - return ((...args) => { - let [scale] = args; - this.modelType = PrecisionModel.FIXED; - this.setScale(scale); - })(...args); + let [scale] = args; + this.modelType = PrecisionModel.FIXED; + this.setScale(scale); } else if (args[0] instanceof PrecisionModel) { - return ((...args) => { - let [pm] = args; - this.modelType = pm.modelType; - this.scale = pm.scale; - })(...args); + let [pm] = args; + this.modelType = pm.modelType; + this.scale = pm.scale; } } }; diff --git a/src/org/locationtech/jts/geom/impl/CoordinateArraySequence.js b/src/org/locationtech/jts/geom/impl/CoordinateArraySequence.js index d3e7a727a..de60d95fc 100644 --- a/src/org/locationtech/jts/geom/impl/CoordinateArraySequence.js +++ b/src/org/locationtech/jts/geom/impl/CoordinateArraySequence.js @@ -11,49 +11,39 @@ export default class CoordinateArraySequence { const overloaded = (...args) => { if (args.length === 1) { if (args[0] instanceof Array) { - return ((...args) => { - let [coordinates] = args; - overloaded.call(this, coordinates, 3); - })(...args); + let [coordinates] = args; + overloaded.call(this, coordinates, 3); } else if (Number.isInteger(args[0])) { - return ((...args) => { - let [size] = args; - this.coordinates = new Array(size); - for (var i = 0; i < size; i++) { - this.coordinates[i] = new Coordinate(); - } - })(...args); + let [size] = args; + this.coordinates = new Array(size); + for (var i = 0; i < size; i++) { + this.coordinates[i] = new Coordinate(); + } } else if (args[0].interfaces_ && args[0].interfaces_.indexOf(CoordinateSequence) > -1) { - return ((...args) => { - let [coordSeq] = args; - if (coordSeq === null) { - this.coordinates = new Array(0); - return null; - } - this.dimension = coordSeq.getDimension(); - this.coordinates = new Array(coordSeq.size()); - for (var i = 0; i < this.coordinates.length; i++) { - this.coordinates[i] = coordSeq.getCoordinateCopy(i); - } - })(...args); + let [coordSeq] = args; + if (coordSeq === null) { + this.coordinates = new Array(0); + return null; + } + this.dimension = coordSeq.getDimension(); + this.coordinates = new Array(coordSeq.size()); + for (var i = 0; i < this.coordinates.length; i++) { + this.coordinates[i] = coordSeq.getCoordinateCopy(i); + } } } else if (args.length === 2) { if (args[0] instanceof Array && Number.isInteger(args[1])) { - return ((...args) => { - let [coordinates, dimension] = args; - this.coordinates = coordinates; - this.dimension = dimension; - if (coordinates === null) this.coordinates = new Array(0); - })(...args); + let [coordinates, dimension] = args; + this.coordinates = coordinates; + this.dimension = dimension; + if (coordinates === null) this.coordinates = new Array(0); } else if (Number.isInteger(args[0]) && Number.isInteger(args[1])) { - return ((...args) => { - let [size, dimension] = args; - this.coordinates = new Array(size); - this.dimension = dimension; - for (var i = 0; i < size; i++) { - this.coordinates[i] = new Coordinate(); - } - })(...args); + let [size, dimension] = args; + this.coordinates = new Array(size); + this.dimension = dimension; + for (var i = 0; i < size; i++) { + this.coordinates[i] = new Coordinate(); + } } } }; diff --git a/src/org/locationtech/jts/geom/impl/PackedCoordinateSequenceFactory.js b/src/org/locationtech/jts/geom/impl/PackedCoordinateSequenceFactory.js index a432f61d6..6929d4555 100644 --- a/src/org/locationtech/jts/geom/impl/PackedCoordinateSequenceFactory.js +++ b/src/org/locationtech/jts/geom/impl/PackedCoordinateSequenceFactory.js @@ -7,21 +7,15 @@ export default class PackedCoordinateSequenceFactory { this.dimension = 3; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, PackedCoordinateSequenceFactory.DOUBLE); - })(...args); + let [] = args; + overloaded.call(this, PackedCoordinateSequenceFactory.DOUBLE); } else if (args.length === 1) { - return ((...args) => { - let [type] = args; - overloaded.call(this, type, 3); - })(...args); + let [type] = args; + overloaded.call(this, type, 3); } else if (args.length === 2) { - return ((...args) => { - let [type, dimension] = args; - this.setType(type); - this.setDimension(dimension); - })(...args); + let [type, dimension] = args; + this.setType(type); + this.setDimension(dimension); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/util/AffineTransformation.js b/src/org/locationtech/jts/geom/util/AffineTransformation.js index 2c40a210d..77e703149 100644 --- a/src/org/locationtech/jts/geom/util/AffineTransformation.js +++ b/src/org/locationtech/jts/geom/util/AffineTransformation.js @@ -16,37 +16,27 @@ export default class AffineTransformation { this.m12 = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.setToIdentity(); - })(...args); + let [] = args; + this.setToIdentity(); } else if (args.length === 1) { if (args[0] instanceof Array) { - return ((...args) => { - let [matrix] = args; - this.m00 = matrix[0]; - this.m01 = matrix[1]; - this.m02 = matrix[2]; - this.m10 = matrix[3]; - this.m11 = matrix[4]; - this.m12 = matrix[5]; - })(...args); + let [matrix] = args; + this.m00 = matrix[0]; + this.m01 = matrix[1]; + this.m02 = matrix[2]; + this.m10 = matrix[3]; + this.m11 = matrix[4]; + this.m12 = matrix[5]; } else if (args[0] instanceof AffineTransformation) { - return ((...args) => { - let [trans] = args; - this.setTransformation(trans); - })(...args); + let [trans] = args; + this.setTransformation(trans); } } else if (args.length === 6) { if (typeof args[0] === "number") { - return ((...args) => { - let [m00, m01, m02, m10, m11, m12] = args; - this.setTransformation(m00, m01, m02, m10, m11, m12); - })(...args); + let [m00, m01, m02, m10, m11, m12] = args; + this.setTransformation(m00, m01, m02, m10, m11, m12); } else if (args[0] instanceof Coordinate) { - return ((...args) => { - let [src0, src1, src2, dest0, dest1, dest2] = args; - })(...args); + let [src0, src1, src2, dest0, dest1, dest2] = args; } } }; diff --git a/src/org/locationtech/jts/geom/util/GeometryEditor.js b/src/org/locationtech/jts/geom/util/GeometryEditor.js index 4796927e0..fb9ffff02 100644 --- a/src/org/locationtech/jts/geom/util/GeometryEditor.js +++ b/src/org/locationtech/jts/geom/util/GeometryEditor.js @@ -14,14 +14,10 @@ export default class GeometryEditor { this.isUserDataCopied = false; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [factory] = args; - this.factory = factory; - })(...args); + let [factory] = args; + this.factory = factory; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geom/util/LinearComponentExtracter.js b/src/org/locationtech/jts/geom/util/LinearComponentExtracter.js index 0f4a38493..2be3793fa 100644 --- a/src/org/locationtech/jts/geom/util/LinearComponentExtracter.js +++ b/src/org/locationtech/jts/geom/util/LinearComponentExtracter.js @@ -10,16 +10,12 @@ export default class LinearComponentExtracter { this.isForcedToLineString = false; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [lines] = args; - this.lines = lines; - })(...args); + let [lines] = args; + this.lines = lines; } else if (args.length === 2) { - return ((...args) => { - let [lines, isForcedToLineString] = args; - this.lines = lines; - this.isForcedToLineString = isForcedToLineString; - })(...args); + let [lines, isForcedToLineString] = args; + this.lines = lines; + this.isForcedToLineString = isForcedToLineString; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geomgraph/EdgeEnd.js b/src/org/locationtech/jts/geomgraph/EdgeEnd.js index c6e7c1562..a7a01ea1b 100644 --- a/src/org/locationtech/jts/geomgraph/EdgeEnd.js +++ b/src/org/locationtech/jts/geomgraph/EdgeEnd.js @@ -14,22 +14,16 @@ export default class EdgeEnd { this.quadrant = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [edge] = args; - this.edge = edge; - })(...args); + let [edge] = args; + this.edge = edge; } else if (args.length === 3) { - return ((...args) => { - let [edge, p0, p1] = args; - overloaded.call(this, edge, p0, p1, null); - })(...args); + let [edge, p0, p1] = args; + overloaded.call(this, edge, p0, p1, null); } else if (args.length === 4) { - return ((...args) => { - let [edge, p0, p1, label] = args; - overloaded.call(this, edge); - this.init(p0, p1); - this.label = label; - })(...args); + let [edge, p0, p1, label] = args; + overloaded.call(this, edge); + this.init(p0, p1); + this.label = label; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geomgraph/GraphComponent.js b/src/org/locationtech/jts/geomgraph/GraphComponent.js index 1ee1beae1..22e761a5c 100644 --- a/src/org/locationtech/jts/geomgraph/GraphComponent.js +++ b/src/org/locationtech/jts/geomgraph/GraphComponent.js @@ -8,14 +8,10 @@ export default class GraphComponent { this._isVisited = false; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [label] = args; - this.label = label; - })(...args); + let [label] = args; + this.label = label; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geomgraph/Label.js b/src/org/locationtech/jts/geomgraph/Label.js index 35c20d7d9..6093a29e7 100644 --- a/src/org/locationtech/jts/geomgraph/Label.js +++ b/src/org/locationtech/jts/geomgraph/Label.js @@ -8,38 +8,28 @@ export default class Label { const overloaded = (...args) => { if (args.length === 1) { if (Number.isInteger(args[0])) { - return ((...args) => { - let [onLoc] = args; - this.elt[0] = new TopologyLocation(onLoc); - this.elt[1] = new TopologyLocation(onLoc); - })(...args); + let [onLoc] = args; + this.elt[0] = new TopologyLocation(onLoc); + this.elt[1] = new TopologyLocation(onLoc); } else if (args[0] instanceof Label) { - return ((...args) => { - let [lbl] = args; - this.elt[0] = new TopologyLocation(lbl.elt[0]); - this.elt[1] = new TopologyLocation(lbl.elt[1]); - })(...args); + let [lbl] = args; + this.elt[0] = new TopologyLocation(lbl.elt[0]); + this.elt[1] = new TopologyLocation(lbl.elt[1]); } } else if (args.length === 2) { - return ((...args) => { - let [geomIndex, onLoc] = args; - this.elt[0] = new TopologyLocation(Location.NONE); - this.elt[1] = new TopologyLocation(Location.NONE); - this.elt[geomIndex].setLocation(onLoc); - })(...args); + let [geomIndex, onLoc] = args; + this.elt[0] = new TopologyLocation(Location.NONE); + this.elt[1] = new TopologyLocation(Location.NONE); + this.elt[geomIndex].setLocation(onLoc); } else if (args.length === 3) { - return ((...args) => { - let [onLoc, leftLoc, rightLoc] = args; - this.elt[0] = new TopologyLocation(onLoc, leftLoc, rightLoc); - this.elt[1] = new TopologyLocation(onLoc, leftLoc, rightLoc); - })(...args); + let [onLoc, leftLoc, rightLoc] = args; + this.elt[0] = new TopologyLocation(onLoc, leftLoc, rightLoc); + this.elt[1] = new TopologyLocation(onLoc, leftLoc, rightLoc); } else if (args.length === 4) { - return ((...args) => { - let [geomIndex, onLoc, leftLoc, rightLoc] = args; - this.elt[0] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE); - this.elt[1] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE); - this.elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc); - })(...args); + let [geomIndex, onLoc, leftLoc, rightLoc] = args; + this.elt[0] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE); + this.elt[1] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE); + this.elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geomgraph/PlanarGraph.js b/src/org/locationtech/jts/geomgraph/PlanarGraph.js index 17d6f905e..6403aa8f8 100644 --- a/src/org/locationtech/jts/geomgraph/PlanarGraph.js +++ b/src/org/locationtech/jts/geomgraph/PlanarGraph.js @@ -15,15 +15,11 @@ export default class PlanarGraph { this.edgeEndList = new ArrayList(); const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.nodes = new NodeMap(new NodeFactory()); - })(...args); + let [] = args; + this.nodes = new NodeMap(new NodeFactory()); } else if (args.length === 1) { - return ((...args) => { - let [nodeFact] = args; - this.nodes = new NodeMap(nodeFact); - })(...args); + let [nodeFact] = args; + this.nodes = new NodeMap(nodeFact); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geomgraph/TopologyLocation.js b/src/org/locationtech/jts/geomgraph/TopologyLocation.js index 5df3f7c60..64475b515 100644 --- a/src/org/locationtech/jts/geomgraph/TopologyLocation.js +++ b/src/org/locationtech/jts/geomgraph/TopologyLocation.js @@ -7,35 +7,27 @@ export default class TopologyLocation { const overloaded = (...args) => { if (args.length === 1) { if (args[0] instanceof Array) { - return ((...args) => { - let [location] = args; - this.init(location.length); - })(...args); + let [location] = args; + this.init(location.length); } else if (Number.isInteger(args[0])) { - return ((...args) => { - let [on] = args; - this.init(1); - this.location[Position.ON] = on; - })(...args); + let [on] = args; + this.init(1); + this.location[Position.ON] = on; } else if (args[0] instanceof TopologyLocation) { - return ((...args) => { - let [gl] = args; - this.init(gl.location.length); - if (gl !== null) { - for (var i = 0; i < this.location.length; i++) { - this.location[i] = gl.location[i]; - } + let [gl] = args; + this.init(gl.location.length); + if (gl !== null) { + for (var i = 0; i < this.location.length; i++) { + this.location[i] = gl.location[i]; } - })(...args); + } } } else if (args.length === 3) { - return ((...args) => { - let [on, left, right] = args; - this.init(3); - this.location[Position.ON] = on; - this.location[Position.LEFT] = left; - this.location[Position.RIGHT] = right; - })(...args); + let [on, left, right] = args; + this.init(3); + this.location[Position.ON] = on; + this.location[Position.LEFT] = left; + this.location[Position.RIGHT] = right; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/geomgraph/index/SweepLineEvent.js b/src/org/locationtech/jts/geomgraph/index/SweepLineEvent.js index 24b383d7c..55ab1ac24 100644 --- a/src/org/locationtech/jts/geomgraph/index/SweepLineEvent.js +++ b/src/org/locationtech/jts/geomgraph/index/SweepLineEvent.js @@ -9,20 +9,16 @@ export default class SweepLineEvent { this.obj = null; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [x, insertEvent] = args; - this.eventType = SweepLineEvent.DELETE; - this.xValue = x; - this.insertEvent = insertEvent; - })(...args); + let [x, insertEvent] = args; + this.eventType = SweepLineEvent.DELETE; + this.xValue = x; + this.insertEvent = insertEvent; } else if (args.length === 3) { - return ((...args) => { - let [label, x, obj] = args; - this.eventType = SweepLineEvent.INSERT; - this.label = label; - this.xValue = x; - this.obj = obj; - })(...args); + let [label, x, obj] = args; + this.eventType = SweepLineEvent.INSERT; + this.label = label; + this.xValue = x; + this.obj = obj; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/bintree/Interval.js b/src/org/locationtech/jts/index/bintree/Interval.js index 1f5f8d535..46139a1fd 100644 --- a/src/org/locationtech/jts/index/bintree/Interval.js +++ b/src/org/locationtech/jts/index/bintree/Interval.js @@ -4,21 +4,15 @@ export default class Interval { this.max = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.min = 0.0; - this.max = 0.0; - })(...args); + let [] = args; + this.min = 0.0; + this.max = 0.0; } else if (args.length === 1) { - return ((...args) => { - let [interval] = args; - this.init(interval.min, interval.max); - })(...args); + let [interval] = args; + this.init(interval.min, interval.max); } else if (args.length === 2) { - return ((...args) => { - let [min, max] = args; - this.init(min, max); - })(...args); + let [min, max] = args; + this.init(min, max); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/kdtree/KdNode.js b/src/org/locationtech/jts/index/kdtree/KdNode.js index 3d63df885..0a3c1aeb6 100644 --- a/src/org/locationtech/jts/index/kdtree/KdNode.js +++ b/src/org/locationtech/jts/index/kdtree/KdNode.js @@ -8,23 +8,19 @@ export default class KdNode { this.count = null; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [p, data] = args; - this.p = new Coordinate(p); - this.left = null; - this.right = null; - this.count = 1; - this.data = data; - })(...args); + let [p, data] = args; + this.p = new Coordinate(p); + this.left = null; + this.right = null; + this.count = 1; + this.data = data; } else if (args.length === 3) { - return ((...args) => { - let [_x, _y, data] = args; - this.p = new Coordinate(_x, _y); - this.left = null; - this.right = null; - this.count = 1; - this.data = data; - })(...args); + let [_x, _y, data] = args; + this.p = new Coordinate(_x, _y); + this.left = null; + this.right = null; + this.count = 1; + this.data = data; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/kdtree/KdTree.js b/src/org/locationtech/jts/index/kdtree/KdTree.js index 71da5fec3..f611a309c 100644 --- a/src/org/locationtech/jts/index/kdtree/KdTree.js +++ b/src/org/locationtech/jts/index/kdtree/KdTree.js @@ -11,15 +11,11 @@ export default class KdTree { this.tolerance = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, 0.0); - })(...args); + let [] = args; + overloaded.call(this, 0.0); } else if (args.length === 1) { - return ((...args) => { - let [tolerance] = args; - this.tolerance = tolerance; - })(...args); + let [tolerance] = args; + this.tolerance = tolerance; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/strtree/AbstractNode.js b/src/org/locationtech/jts/index/strtree/AbstractNode.js index 83cbcbf8e..6b0069b6a 100644 --- a/src/org/locationtech/jts/index/strtree/AbstractNode.js +++ b/src/org/locationtech/jts/index/strtree/AbstractNode.js @@ -9,14 +9,10 @@ export default class AbstractNode { this.level = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [level] = args; - this.level = level; - })(...args); + let [level] = args; + this.level = level; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/strtree/AbstractSTRtree.js b/src/org/locationtech/jts/index/strtree/AbstractSTRtree.js index 40b05cacf..08ec40d85 100644 --- a/src/org/locationtech/jts/index/strtree/AbstractSTRtree.js +++ b/src/org/locationtech/jts/index/strtree/AbstractSTRtree.js @@ -14,16 +14,12 @@ export default class AbstractSTRtree { this.nodeCapacity = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, AbstractSTRtree.DEFAULT_NODE_CAPACITY); - })(...args); + let [] = args; + overloaded.call(this, AbstractSTRtree.DEFAULT_NODE_CAPACITY); } else if (args.length === 1) { - return ((...args) => { - let [nodeCapacity] = args; - Assert.isTrue(nodeCapacity > 1, "Node capacity must be greater than 1"); - this.nodeCapacity = nodeCapacity; - })(...args); + let [nodeCapacity] = args; + Assert.isTrue(nodeCapacity > 1, "Node capacity must be greater than 1"); + this.nodeCapacity = nodeCapacity; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/strtree/Interval.js b/src/org/locationtech/jts/index/strtree/Interval.js index 63f57c5e0..e6b8e65da 100644 --- a/src/org/locationtech/jts/index/strtree/Interval.js +++ b/src/org/locationtech/jts/index/strtree/Interval.js @@ -5,17 +5,13 @@ export default class Interval { this.max = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [other] = args; - overloaded.call(this, other.min, other.max); - })(...args); + let [other] = args; + overloaded.call(this, other.min, other.max); } else if (args.length === 2) { - return ((...args) => { - let [min, max] = args; - Assert.isTrue(min <= max); - this.min = min; - this.max = max; - })(...args); + let [min, max] = args; + Assert.isTrue(min <= max); + this.min = min; + this.max = max; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/index/sweepline/SweepLineInterval.js b/src/org/locationtech/jts/index/sweepline/SweepLineInterval.js index 79caf100c..f9debf449 100644 --- a/src/org/locationtech/jts/index/sweepline/SweepLineInterval.js +++ b/src/org/locationtech/jts/index/sweepline/SweepLineInterval.js @@ -5,17 +5,13 @@ export default class SweepLineInterval { this.item = null; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [min, max] = args; - overloaded.call(this, min, max, null); - })(...args); + let [min, max] = args; + overloaded.call(this, min, max, null); } else if (args.length === 3) { - return ((...args) => { - let [min, max, item] = args; - this.min = min < max ? min : max; - this.max = max > min ? max : min; - this.item = item; - })(...args); + let [min, max, item] = args; + this.min = min < max ? min : max; + this.max = max > min ? max : min; + this.item = item; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/linearref/LinearIterator.js b/src/org/locationtech/jts/linearref/LinearIterator.js index a11783ac2..5e4e91e7a 100644 --- a/src/org/locationtech/jts/linearref/LinearIterator.js +++ b/src/org/locationtech/jts/linearref/LinearIterator.js @@ -9,25 +9,19 @@ export default class LinearIterator { this.vertexIndex = 0; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [linear] = args; - overloaded.call(this, linear, 0, 0); - })(...args); + let [linear] = args; + overloaded.call(this, linear, 0, 0); } else if (args.length === 2) { - return ((...args) => { - let [linear, start] = args; - overloaded.call(this, linear, start.getComponentIndex(), LinearIterator.segmentEndVertexIndex(start)); - })(...args); + let [linear, start] = args; + overloaded.call(this, linear, start.getComponentIndex(), LinearIterator.segmentEndVertexIndex(start)); } else if (args.length === 3) { - return ((...args) => { - let [linearGeom, componentIndex, vertexIndex] = args; - if (!(linearGeom.interfaces_ && linearGeom.interfaces_.indexOf(Lineal) > -1)) throw new IllegalArgumentException("Lineal geometry is required"); - this.linearGeom = linearGeom; - this.numLines = linearGeom.getNumGeometries(); - this.componentIndex = componentIndex; - this.vertexIndex = vertexIndex; - this.loadCurrentLine(); - })(...args); + let [linearGeom, componentIndex, vertexIndex] = args; + if (!(linearGeom.interfaces_ && linearGeom.interfaces_.indexOf(Lineal) > -1)) throw new IllegalArgumentException("Lineal geometry is required"); + this.linearGeom = linearGeom; + this.numLines = linearGeom.getNumGeometries(); + this.componentIndex = componentIndex; + this.vertexIndex = vertexIndex; + this.loadCurrentLine(); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/linearref/LinearLocation.js b/src/org/locationtech/jts/linearref/LinearLocation.js index 5f44cd94a..42ef83e0c 100644 --- a/src/org/locationtech/jts/linearref/LinearLocation.js +++ b/src/org/locationtech/jts/linearref/LinearLocation.js @@ -8,37 +8,27 @@ export default class LinearLocation { this.segmentFraction = 0.0; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [loc] = args; - this.componentIndex = loc.componentIndex; - this.segmentIndex = loc.segmentIndex; - this.segmentFraction = loc.segmentFraction; - })(...args); + let [loc] = args; + this.componentIndex = loc.componentIndex; + this.segmentIndex = loc.segmentIndex; + this.segmentFraction = loc.segmentFraction; } else if (args.length === 2) { - return ((...args) => { - let [segmentIndex, segmentFraction] = args; - overloaded.call(this, 0, segmentIndex, segmentFraction); - })(...args); + let [segmentIndex, segmentFraction] = args; + overloaded.call(this, 0, segmentIndex, segmentFraction); } else if (args.length === 3) { - return ((...args) => { - let [componentIndex, segmentIndex, segmentFraction] = args; - this.componentIndex = componentIndex; - this.segmentIndex = segmentIndex; - this.segmentFraction = segmentFraction; - this.normalize(); - })(...args); + let [componentIndex, segmentIndex, segmentFraction] = args; + this.componentIndex = componentIndex; + this.segmentIndex = segmentIndex; + this.segmentFraction = segmentFraction; + this.normalize(); } else if (args.length === 4) { - return ((...args) => { - let [componentIndex, segmentIndex, segmentFraction, doNormalize] = args; - this.componentIndex = componentIndex; - this.segmentIndex = segmentIndex; - this.segmentFraction = segmentFraction; - if (doNormalize) this.normalize(); - })(...args); + let [componentIndex, segmentIndex, segmentFraction, doNormalize] = args; + this.componentIndex = componentIndex; + this.segmentIndex = segmentIndex; + this.segmentFraction = segmentFraction; + if (doNormalize) this.normalize(); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/math/DD.js b/src/org/locationtech/jts/math/DD.js index 10ccfa8f8..81fcc44a6 100644 --- a/src/org/locationtech/jts/math/DD.js +++ b/src/org/locationtech/jts/math/DD.js @@ -11,32 +11,22 @@ export default class DD { this.lo = 0.0; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - this.init(0.0); - })(...args); + let [] = args; + this.init(0.0); } else if (args.length === 1) { if (typeof args[0] === "number") { - return ((...args) => { - let [x] = args; - this.init(x); - })(...args); + let [x] = args; + this.init(x); } else if (args[0] instanceof DD) { - return ((...args) => { - let [dd] = args; - this.init(dd); - })(...args); + let [dd] = args; + this.init(dd); } else if (typeof args[0] === "string") { - return ((...args) => { - let [str] = args; - overloaded.call(this, DD.parse(str)); - })(...args); + let [str] = args; + overloaded.call(this, DD.parse(str)); } } else if (args.length === 2) { - return ((...args) => { - let [hi, lo] = args; - this.init(hi, lo); - })(...args); + let [hi, lo] = args; + this.init(hi, lo); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/math/Vector2D.js b/src/org/locationtech/jts/math/Vector2D.js index 4f86c6ea8..e953d5359 100644 --- a/src/org/locationtech/jts/math/Vector2D.js +++ b/src/org/locationtech/jts/math/Vector2D.js @@ -8,37 +8,27 @@ export default class Vector2D { this.y = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, 0.0, 0.0); - })(...args); + let [] = args; + overloaded.call(this, 0.0, 0.0); } else if (args.length === 1) { if (args[0] instanceof Vector2D) { - return ((...args) => { - let [v] = args; - this.x = v.x; - this.y = v.y; - })(...args); + let [v] = args; + this.x = v.x; + this.y = v.y; } else if (args[0] instanceof Coordinate) { - return ((...args) => { - let [v] = args; - this.x = v.x; - this.y = v.y; - })(...args); + let [v] = args; + this.x = v.x; + this.y = v.y; } } else if (args.length === 2) { if (typeof args[0] === "number" && typeof args[1] === "number") { - return ((...args) => { - let [x, y] = args; - this.x = x; - this.y = y; - })(...args); + let [x, y] = args; + this.x = x; + this.y = y; } else if (args[0] instanceof Coordinate && args[1] instanceof Coordinate) { - return ((...args) => { - let [from, to] = args; - this.x = to.x - from.x; - this.y = to.y - from.y; - })(...args); + let [from, to] = args; + this.x = to.x - from.x; + this.y = to.y - from.y; } } }; diff --git a/src/org/locationtech/jts/math/Vector3D.js b/src/org/locationtech/jts/math/Vector3D.js index 0b4d98099..7bf4f18fe 100644 --- a/src/org/locationtech/jts/math/Vector3D.js +++ b/src/org/locationtech/jts/math/Vector3D.js @@ -6,26 +6,20 @@ export default class Vector3D { this.z = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [v] = args; - this.x = v.x; - this.y = v.y; - this.z = v.z; - })(...args); + let [v] = args; + this.x = v.x; + this.y = v.y; + this.z = v.z; } else if (args.length === 2) { - return ((...args) => { - let [from, to] = args; - this.x = to.x - from.x; - this.y = to.y - from.y; - this.z = to.z - from.z; - })(...args); + let [from, to] = args; + this.x = to.x - from.x; + this.y = to.y - from.y; + this.z = to.z - from.z; } else if (args.length === 3) { - return ((...args) => { - let [x, y, z] = args; - this.x = x; - this.y = y; - this.z = z; - })(...args); + let [x, y, z] = args; + this.x = x; + this.y = y; + this.z = z; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/monkey.js b/src/org/locationtech/jts/monkey.js index 177b1589c..4de4fcb3d 100644 --- a/src/org/locationtech/jts/monkey.js +++ b/src/org/locationtech/jts/monkey.js @@ -53,28 +53,20 @@ export default function patch () { return 0.0; }, union(...args) { - const overloads = (...args) => { - switch (args.length) { - case 0: - return ((...args) => { - let [] = args; - return UnaryUnionOp.union(this); - })(...args); - case 1: - return ((...args) => { - let [other] = args; - if (this.isEmpty() || other.isEmpty()) { - if (this.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, this.factory); - if (this.isEmpty()) return other.copy(); - if (other.isEmpty()) return this.copy(); - } - this.checkNotGeometryCollection(this); - this.checkNotGeometryCollection(other); - return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION); - })(...args); + if (args.length === 0) { + let [] = args; + return UnaryUnionOp.union(this); + } else if (args.length === 1) { + let [other] = args; + if (this.isEmpty() || other.isEmpty()) { + if (this.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, this.factory); + if (this.isEmpty()) return other.copy(); + if (other.isEmpty()) return this.copy(); } - }; - return overloads.apply(this, args); + this.checkNotGeometryCollection(this); + this.checkNotGeometryCollection(other); + return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION); + } }, isValid() { return IsValidOp.isValid(this); @@ -104,48 +96,30 @@ export default function patch () { return this.relate(g).isIntersects(); }, buffer(...args) { - const overloads = (...args) => { - switch (args.length) { - case 1: - return ((...args) => { - let [distance] = args; - return BufferOp.bufferOp(this, distance); - })(...args); - case 2: - return ((...args) => { - let [distance, quadrantSegments] = args; - return BufferOp.bufferOp(this, distance, quadrantSegments); - })(...args); - case 3: - return ((...args) => { - let [distance, quadrantSegments, endCapStyle] = args; - return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle); - })(...args); - } - }; - return overloads.apply(this, args); + if (args.length === 1) { + let [distance] = args; + return BufferOp.bufferOp(this, distance); + } else if (args.length === 2) { + let [distance, quadrantSegments] = args; + return BufferOp.bufferOp(this, distance, quadrantSegments); + } else if (args.length === 3) { + let [distance, quadrantSegments, endCapStyle] = args; + return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle); + } }, convexHull() { return new ConvexHull(this).getConvexHull(); }, relate(...args) { - const overloads = (...args) => { - switch (args.length) { - case 1: - return ((...args) => { - let [g] = args; - this.checkNotGeometryCollection(this); - this.checkNotGeometryCollection(g); - return RelateOp.relate(this, g); - })(...args); - case 2: - return ((...args) => { - let [g, intersectionPattern] = args; - return this.relate(g).matches(intersectionPattern); - })(...args); - } - }; - return overloads.apply(this, args); + if (args.length === 1) { + let [g] = args; + this.checkNotGeometryCollection(this); + this.checkNotGeometryCollection(g); + return RelateOp.relate(this, g); + } else if (args.length === 2) { + let [g, intersectionPattern] = args; + return this.relate(g).matches(intersectionPattern); + } }, getCentroid() { if (this.isEmpty()) return this.factory.createPoint(); diff --git a/src/org/locationtech/jts/noding/ScaledNoder.js b/src/org/locationtech/jts/noding/ScaledNoder.js index 9f8ae25b9..3de98a1ad 100644 --- a/src/org/locationtech/jts/noding/ScaledNoder.js +++ b/src/org/locationtech/jts/noding/ScaledNoder.js @@ -14,17 +14,13 @@ export default class ScaledNoder { this.isScaled = false; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [noder, scaleFactor] = args; - overloaded.call(this, noder, scaleFactor, 0, 0); - })(...args); + let [noder, scaleFactor] = args; + overloaded.call(this, noder, scaleFactor, 0, 0); } else if (args.length === 4) { - return ((...args) => { - let [noder, scaleFactor, offsetX, offsetY] = args; - this.noder = noder; - this.scaleFactor = scaleFactor; - this.isScaled = !this.isIntegerPrecision(); - })(...args); + let [noder, scaleFactor, offsetX, offsetY] = args; + this.noder = noder; + this.scaleFactor = scaleFactor; + this.isScaled = !this.isIntegerPrecision(); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/noding/SegmentIntersectionDetector.js b/src/org/locationtech/jts/noding/SegmentIntersectionDetector.js index 13c2f3914..7ae8271fc 100644 --- a/src/org/locationtech/jts/noding/SegmentIntersectionDetector.js +++ b/src/org/locationtech/jts/noding/SegmentIntersectionDetector.js @@ -12,15 +12,11 @@ export default class SegmentIntersectionDetector { this.intSegments = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, new RobustLineIntersector()); - })(...args); + let [] = args; + overloaded.call(this, new RobustLineIntersector()); } else if (args.length === 1) { - return ((...args) => { - let [li] = args; - this.li = li; - })(...args); + let [li] = args; + this.li = li; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/noding/SegmentStringDissolver.js b/src/org/locationtech/jts/noding/SegmentStringDissolver.js index 13e531e86..64562247e 100644 --- a/src/org/locationtech/jts/noding/SegmentStringDissolver.js +++ b/src/org/locationtech/jts/noding/SegmentStringDissolver.js @@ -9,15 +9,11 @@ export default class SegmentStringDissolver { this.ocaMap = new TreeMap(); const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, null); - })(...args); + let [] = args; + overloaded.call(this, null); } else if (args.length === 1) { - return ((...args) => { - let [merger] = args; - this.merger = merger; - })(...args); + let [merger] = args; + this.merger = merger; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/noding/SinglePassNoder.js b/src/org/locationtech/jts/noding/SinglePassNoder.js index c64a58950..8f82aeca2 100644 --- a/src/org/locationtech/jts/noding/SinglePassNoder.js +++ b/src/org/locationtech/jts/noding/SinglePassNoder.js @@ -4,14 +4,10 @@ export default class SinglePassNoder { this.segInt = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [segInt] = args; - this.setSegmentIntersector(segInt); - })(...args); + let [segInt] = args; + this.setSegmentIntersector(segInt); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/BoundaryOp.js b/src/org/locationtech/jts/operation/BoundaryOp.js index f08b245ad..2f14e9916 100644 --- a/src/org/locationtech/jts/operation/BoundaryOp.js +++ b/src/org/locationtech/jts/operation/BoundaryOp.js @@ -12,17 +12,13 @@ export default class BoundaryOp { this.endpointMap = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [geom] = args; - overloaded.call(this, geom, BoundaryNodeRule.MOD2_BOUNDARY_RULE); - })(...args); + let [geom] = args; + overloaded.call(this, geom, BoundaryNodeRule.MOD2_BOUNDARY_RULE); } else if (args.length === 2) { - return ((...args) => { - let [geom, bnRule] = args; - this.geom = geom; - this.geomFact = geom.getFactory(); - this.bnRule = bnRule; - })(...args); + let [geom, bnRule] = args; + this.geom = geom; + this.geomFact = geom.getFactory(); + this.bnRule = bnRule; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/GeometryGraphOperation.js b/src/org/locationtech/jts/operation/GeometryGraphOperation.js index cc1054161..b7357c9bf 100644 --- a/src/org/locationtech/jts/operation/GeometryGraphOperation.js +++ b/src/org/locationtech/jts/operation/GeometryGraphOperation.js @@ -8,26 +8,20 @@ export default class GeometryGraphOperation { this.arg = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [g0] = args; - this.setComputationPrecision(g0.getPrecisionModel()); - this.arg = new Array(1); - this.arg[0] = new GeometryGraph(0, g0); - ; - })(...args); + let [g0] = args; + this.setComputationPrecision(g0.getPrecisionModel()); + this.arg = new Array(1); + this.arg[0] = new GeometryGraph(0, g0); + ; } else if (args.length === 2) { - return ((...args) => { - let [g0, g1] = args; - overloaded.call(this, g0, g1, BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE); - })(...args); + let [g0, g1] = args; + overloaded.call(this, g0, g1, BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE); } else if (args.length === 3) { - return ((...args) => { - let [g0, g1, boundaryNodeRule] = args; - if (g0.getPrecisionModel().compareTo(g1.getPrecisionModel()) >= 0) this.setComputationPrecision(g0.getPrecisionModel()); else this.setComputationPrecision(g1.getPrecisionModel()); - this.arg = new Array(2); - this.arg[0] = new GeometryGraph(0, g0, boundaryNodeRule); - this.arg[1] = new GeometryGraph(1, g1, boundaryNodeRule); - })(...args); + let [g0, g1, boundaryNodeRule] = args; + if (g0.getPrecisionModel().compareTo(g1.getPrecisionModel()) >= 0) this.setComputationPrecision(g0.getPrecisionModel()); else this.setComputationPrecision(g1.getPrecisionModel()); + this.arg = new Array(2); + this.arg[0] = new GeometryGraph(0, g0, boundaryNodeRule); + this.arg[1] = new GeometryGraph(1, g1, boundaryNodeRule); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/IsSimpleOp.js b/src/org/locationtech/jts/operation/IsSimpleOp.js index 32926104e..8423c5e53 100644 --- a/src/org/locationtech/jts/operation/IsSimpleOp.js +++ b/src/org/locationtech/jts/operation/IsSimpleOp.js @@ -15,16 +15,12 @@ export default class IsSimpleOp { this.nonSimpleLocation = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [geom] = args; - this.inputGeom = geom; - })(...args); + let [geom] = args; + this.inputGeom = geom; } else if (args.length === 2) { - return ((...args) => { - let [geom, boundaryNodeRule] = args; - this.inputGeom = geom; - this.isClosedEndpointsInInterior = !boundaryNodeRule.isInBoundary(2); - })(...args); + let [geom, boundaryNodeRule] = args; + this.inputGeom = geom; + this.isClosedEndpointsInInterior = !boundaryNodeRule.isInBoundary(2); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/buffer/BufferOp.js b/src/org/locationtech/jts/operation/buffer/BufferOp.js index 8d5f756e9..8e1c4981d 100644 --- a/src/org/locationtech/jts/operation/buffer/BufferOp.js +++ b/src/org/locationtech/jts/operation/buffer/BufferOp.js @@ -16,16 +16,12 @@ export default class BufferOp { this.saveException = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [g] = args; - this.argGeom = g; - })(...args); + let [g] = args; + this.argGeom = g; } else if (args.length === 2) { - return ((...args) => { - let [g, bufParams] = args; - this.argGeom = g; - this.bufParams = bufParams; - })(...args); + let [g, bufParams] = args; + this.argGeom = g; + this.bufParams = bufParams; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/buffer/BufferParameters.js b/src/org/locationtech/jts/operation/buffer/BufferParameters.js index de438c289..0798de54a 100644 --- a/src/org/locationtech/jts/operation/buffer/BufferParameters.js +++ b/src/org/locationtech/jts/operation/buffer/BufferParameters.js @@ -8,28 +8,20 @@ export default class BufferParameters { this.simplifyFactor = BufferParameters.DEFAULT_SIMPLIFY_FACTOR; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [quadrantSegments] = args; - this.setQuadrantSegments(quadrantSegments); - })(...args); + let [quadrantSegments] = args; + this.setQuadrantSegments(quadrantSegments); } else if (args.length === 2) { - return ((...args) => { - let [quadrantSegments, endCapStyle] = args; - this.setQuadrantSegments(quadrantSegments); - this.setEndCapStyle(endCapStyle); - })(...args); + let [quadrantSegments, endCapStyle] = args; + this.setQuadrantSegments(quadrantSegments); + this.setEndCapStyle(endCapStyle); } else if (args.length === 4) { - return ((...args) => { - let [quadrantSegments, endCapStyle, joinStyle, mitreLimit] = args; - this.setQuadrantSegments(quadrantSegments); - this.setEndCapStyle(endCapStyle); - this.setJoinStyle(joinStyle); - this.setMitreLimit(mitreLimit); - })(...args); + let [quadrantSegments, endCapStyle, joinStyle, mitreLimit] = args; + this.setQuadrantSegments(quadrantSegments); + this.setEndCapStyle(endCapStyle); + this.setJoinStyle(joinStyle); + this.setMitreLimit(mitreLimit); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/distance/DistanceOp.js b/src/org/locationtech/jts/operation/distance/DistanceOp.js index 4499fa116..89a04579d 100644 --- a/src/org/locationtech/jts/operation/distance/DistanceOp.js +++ b/src/org/locationtech/jts/operation/distance/DistanceOp.js @@ -22,18 +22,14 @@ export default class DistanceOp { this.minDistance = Double.MAX_VALUE; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [g0, g1] = args; - overloaded.call(this, g0, g1, 0.0); - })(...args); + let [g0, g1] = args; + overloaded.call(this, g0, g1, 0.0); } else if (args.length === 3) { - return ((...args) => { - let [g0, g1, terminateDistance] = args; - this.geom = new Array(2); - this.geom[0] = g0; - this.geom[1] = g1; - this.terminateDistance = terminateDistance; - })(...args); + let [g0, g1, terminateDistance] = args; + this.geom = new Array(2); + this.geom[0] = g0; + this.geom[1] = g1; + this.terminateDistance = terminateDistance; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/distance/FacetSequence.js b/src/org/locationtech/jts/operation/distance/FacetSequence.js index 453f65803..31859207f 100644 --- a/src/org/locationtech/jts/operation/distance/FacetSequence.js +++ b/src/org/locationtech/jts/operation/distance/FacetSequence.js @@ -16,19 +16,15 @@ export default class FacetSequence { this.q1 = new Coordinate(); const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [pts, start] = args; - this.pts = pts; - this.start = start; - this.end = start + 1; - })(...args); + let [pts, start] = args; + this.pts = pts; + this.start = start; + this.end = start + 1; } else if (args.length === 3) { - return ((...args) => { - let [pts, start, end] = args; - this.pts = pts; - this.start = start; - this.end = end; - })(...args); + let [pts, start, end] = args; + this.pts = pts; + this.start = start; + this.end = end; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/distance/GeometryLocation.js b/src/org/locationtech/jts/operation/distance/GeometryLocation.js index efb1f12e8..afef6d7fd 100644 --- a/src/org/locationtech/jts/operation/distance/GeometryLocation.js +++ b/src/org/locationtech/jts/operation/distance/GeometryLocation.js @@ -5,17 +5,13 @@ export default class GeometryLocation { this.pt = null; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [component, pt] = args; - overloaded.call(this, component, GeometryLocation.INSIDE_AREA, pt); - })(...args); + let [component, pt] = args; + overloaded.call(this, component, GeometryLocation.INSIDE_AREA, pt); } else if (args.length === 3) { - return ((...args) => { - let [component, segIndex, pt] = args; - this.component = component; - this.segIndex = segIndex; - this.pt = pt; - })(...args); + let [component, segIndex, pt] = args; + this.component = component; + this.segIndex = segIndex; + this.pt = pt; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/distance3d/Distance3DOp.js b/src/org/locationtech/jts/operation/distance3d/Distance3DOp.js index 47deff388..e3295552d 100644 --- a/src/org/locationtech/jts/operation/distance3d/Distance3DOp.js +++ b/src/org/locationtech/jts/operation/distance3d/Distance3DOp.js @@ -19,18 +19,14 @@ export default class Distance3DOp { this.isDone = false; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [g0, g1] = args; - overloaded.call(this, g0, g1, 0.0); - })(...args); + let [g0, g1] = args; + overloaded.call(this, g0, g1, 0.0); } else if (args.length === 3) { - return ((...args) => { - let [g0, g1, terminateDistance] = args; - this.geom = new Array(2); - this.geom[0] = g0; - this.geom[1] = g1; - this.terminateDistance = terminateDistance; - })(...args); + let [g0, g1, terminateDistance] = args; + this.geom = new Array(2); + this.geom[0] = g0; + this.geom[1] = g1; + this.terminateDistance = terminateDistance; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/overlay/snap/LineStringSnapper.js b/src/org/locationtech/jts/operation/overlay/snap/LineStringSnapper.js index f4ce698d6..06995def1 100644 --- a/src/org/locationtech/jts/operation/overlay/snap/LineStringSnapper.js +++ b/src/org/locationtech/jts/operation/overlay/snap/LineStringSnapper.js @@ -13,17 +13,13 @@ export default class LineStringSnapper { const overloaded = (...args) => { if (args.length === 2) { if (args[0] instanceof LineString && typeof args[1] === "number") { - return ((...args) => { - let [srcLine, snapTolerance] = args; - overloaded.call(this, srcLine.getCoordinates(), snapTolerance); - })(...args); + let [srcLine, snapTolerance] = args; + overloaded.call(this, srcLine.getCoordinates(), snapTolerance); } else if (args[0] instanceof Array && typeof args[1] === "number") { - return ((...args) => { - let [srcPts, snapTolerance] = args; - this.srcPts = srcPts; - this._isClosed = LineStringSnapper.isClosed(srcPts); - this.snapTolerance = snapTolerance; - })(...args); + let [srcPts, snapTolerance] = args; + this.srcPts = srcPts; + this._isClosed = LineStringSnapper.isClosed(srcPts); + this.snapTolerance = snapTolerance; } } }; diff --git a/src/org/locationtech/jts/operation/polygonize/Polygonizer.js b/src/org/locationtech/jts/operation/polygonize/Polygonizer.js index ba961fa10..41ca3d397 100644 --- a/src/org/locationtech/jts/operation/polygonize/Polygonizer.js +++ b/src/org/locationtech/jts/operation/polygonize/Polygonizer.js @@ -22,15 +22,11 @@ export default class Polygonizer { this.geomFactory = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, false); - })(...args); + let [] = args; + overloaded.call(this, false); } else if (args.length === 1) { - return ((...args) => { - let [extractOnlyPolygonal] = args; - this.extractOnlyPolygonal = extractOnlyPolygonal; - })(...args); + let [extractOnlyPolygonal] = args; + this.extractOnlyPolygonal = extractOnlyPolygonal; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/union/UnaryUnionOp.js b/src/org/locationtech/jts/operation/union/UnaryUnionOp.js index eba99437f..f7103272a 100644 --- a/src/org/locationtech/jts/operation/union/UnaryUnionOp.js +++ b/src/org/locationtech/jts/operation/union/UnaryUnionOp.js @@ -18,22 +18,16 @@ export default class UnaryUnionOp { const overloaded = (...args) => { if (args.length === 1) { if (args[0].interfaces_ && args[0].interfaces_.indexOf(Collection) > -1) { - return ((...args) => { - let [geoms] = args; - this.extract(geoms); - })(...args); + let [geoms] = args; + this.extract(geoms); } else if (args[0] instanceof Geometry) { - return ((...args) => { - let [geom] = args; - this.extract(geom); - })(...args); + let [geom] = args; + this.extract(geom); } } else if (args.length === 2) { - return ((...args) => { - let [geoms, geomFact] = args; - this.geomFact = geomFact; - this.extract(geoms); - })(...args); + let [geoms, geomFact] = args; + this.geomFact = geomFact; + this.extract(geoms); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/operation/valid/TopologyValidationError.js b/src/org/locationtech/jts/operation/valid/TopologyValidationError.js index c24addf97..f61a4c5d8 100644 --- a/src/org/locationtech/jts/operation/valid/TopologyValidationError.js +++ b/src/org/locationtech/jts/operation/valid/TopologyValidationError.js @@ -4,16 +4,12 @@ export default class TopologyValidationError { this.pt = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [errorType] = args; - overloaded.call(this, errorType, null); - })(...args); + let [errorType] = args; + overloaded.call(this, errorType, null); } else if (args.length === 2) { - return ((...args) => { - let [errorType, pt] = args; - this.errorType = errorType; - if (pt !== null) this.pt = pt.copy(); - })(...args); + let [errorType, pt] = args; + this.errorType = errorType; + if (pt !== null) this.pt = pt.copy(); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/precision/CommonBitsOp.js b/src/org/locationtech/jts/precision/CommonBitsOp.js index b77d2c086..045e29233 100644 --- a/src/org/locationtech/jts/precision/CommonBitsOp.js +++ b/src/org/locationtech/jts/precision/CommonBitsOp.js @@ -5,15 +5,11 @@ export default class CommonBitsOp { this.cbr = null; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, true); - })(...args); + let [] = args; + overloaded.call(this, true); } else if (args.length === 1) { - return ((...args) => { - let [returnToOriginalPrecision] = args; - this.returnToOriginalPrecision = returnToOriginalPrecision; - })(...args); + let [returnToOriginalPrecision] = args; + this.returnToOriginalPrecision = returnToOriginalPrecision; } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/simplify/TaggedLineString.js b/src/org/locationtech/jts/simplify/TaggedLineString.js index d55fde1ec..7f1137cf1 100644 --- a/src/org/locationtech/jts/simplify/TaggedLineString.js +++ b/src/org/locationtech/jts/simplify/TaggedLineString.js @@ -8,17 +8,13 @@ export default class TaggedLineString { this.minimumSize = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [parentLine] = args; - overloaded.call(this, parentLine, 2); - })(...args); + let [parentLine] = args; + overloaded.call(this, parentLine, 2); } else if (args.length === 2) { - return ((...args) => { - let [parentLine, minimumSize] = args; - this.parentLine = parentLine; - this.minimumSize = minimumSize; - this.init(); - })(...args); + let [parentLine, minimumSize] = args; + this.parentLine = parentLine; + this.minimumSize = minimumSize; + this.init(); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/triangulate/Segment.js b/src/org/locationtech/jts/triangulate/Segment.js index 1677841b5..2cf747c6c 100644 --- a/src/org/locationtech/jts/triangulate/Segment.js +++ b/src/org/locationtech/jts/triangulate/Segment.js @@ -6,26 +6,18 @@ export default class Segment { this.data = null; const overloaded = (...args) => { if (args.length === 2) { - return ((...args) => { - let [p0, p1] = args; - this.ls = new LineSegment(p0, p1); - })(...args); + let [p0, p1] = args; + this.ls = new LineSegment(p0, p1); } else if (args.length === 3) { - return ((...args) => { - let [p0, p1, data] = args; - this.ls = new LineSegment(p0, p1); - this.data = data; - })(...args); + let [p0, p1, data] = args; + this.ls = new LineSegment(p0, p1); + this.data = data; } else if (args.length === 6) { - return ((...args) => { - let [x1, y1, z1, x2, y2, z2] = args; - overloaded.call(this, new Coordinate(x1, y1, z1), new Coordinate(x2, y2, z2)); - })(...args); + let [x1, y1, z1, x2, y2, z2] = args; + overloaded.call(this, new Coordinate(x1, y1, z1), new Coordinate(x2, y2, z2)); } else if (args.length === 7) { - return ((...args) => { - let [x1, y1, z1, x2, y2, z2, data] = args; - overloaded.call(this, new Coordinate(x1, y1, z1), new Coordinate(x2, y2, z2), data); - })(...args); + let [x1, y1, z1, x2, y2, z2, data] = args; + overloaded.call(this, new Coordinate(x1, y1, z1), new Coordinate(x2, y2, z2), data); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/triangulate/quadedge/Vertex.js b/src/org/locationtech/jts/triangulate/quadedge/Vertex.js index 4d4842bfc..c2981ed68 100644 --- a/src/org/locationtech/jts/triangulate/quadedge/Vertex.js +++ b/src/org/locationtech/jts/triangulate/quadedge/Vertex.js @@ -8,20 +8,14 @@ export default class Vertex { this.p = null; const overloaded = (...args) => { if (args.length === 1) { - return ((...args) => { - let [_p] = args; - this.p = new Coordinate(_p); - })(...args); + let [_p] = args; + this.p = new Coordinate(_p); } else if (args.length === 2) { - return ((...args) => { - let [_x, _y] = args; - this.p = new Coordinate(_x, _y); - })(...args); + let [_x, _y] = args; + this.p = new Coordinate(_x, _y); } else if (args.length === 3) { - return ((...args) => { - let [_x, _y, _z] = args; - this.p = new Coordinate(_x, _y, _z); - })(...args); + let [_x, _y, _z] = args; + this.p = new Coordinate(_x, _y, _z); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/util/GeometricShapeFactory.js b/src/org/locationtech/jts/util/GeometricShapeFactory.js index 83a1765b3..3dd052a37 100644 --- a/src/org/locationtech/jts/util/GeometricShapeFactory.js +++ b/src/org/locationtech/jts/util/GeometricShapeFactory.js @@ -10,16 +10,12 @@ export default class GeometricShapeFactory { this.rotationAngle = 0.0; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - overloaded.call(this, new GeometryFactory()); - })(...args); + let [] = args; + overloaded.call(this, new GeometryFactory()); } else if (args.length === 1) { - return ((...args) => { - let [geomFact] = args; - this.geomFact = geomFact; - this.precModel = geomFact.getPrecisionModel(); - })(...args); + let [geomFact] = args; + this.geomFact = geomFact; + this.precModel = geomFact.getPrecisionModel(); } }; return overloaded.apply(this, args); diff --git a/src/org/locationtech/jts/util/ObjectCounter.js b/src/org/locationtech/jts/util/ObjectCounter.js index 7d9d8ae93..d028b25a0 100644 --- a/src/org/locationtech/jts/util/ObjectCounter.js +++ b/src/org/locationtech/jts/util/ObjectCounter.js @@ -29,14 +29,10 @@ class Counter { this._count = 0; const overloaded = (...args) => { if (args.length === 0) { - return ((...args) => { - let [] = args; - })(...args); + let [] = args; } else if (args.length === 1) { - return ((...args) => { - let [count] = args; - this._count = count; - })(...args); + let [count] = args; + this._count = count; } }; return overloaded.apply(this, args);