Skip to content

Commit 04853f4

Browse files
committed
Transpilation with additional patch for shortcut methods
1 parent acfeaf7 commit 04853f4

File tree

14 files changed

+66
-51
lines changed

14 files changed

+66
-51
lines changed

src/hasInterface.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export default function (o, i) {
1+
export default function(o, i) {
22
return o.interfaces_ && o.interfaces_.indexOf(i) > -1
33
}

src/org/locationtech/jts/algorithm/CGAlgorithmsDD.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ export default class CGAlgorithmsDD {
4949
const detright = (pa.y - pc.y) * (pb.x - pc.x)
5050
const det = detleft - detright
5151
if (detleft > 0.0)
52-
if (detright <= 0.0) {
52+
if (detright <= 0.0)
5353
return CGAlgorithmsDD.signum(det)
54-
} else {
54+
else
5555
detsum = detleft + detright
56-
}
56+
5757
else if (detleft < 0.0)
58-
if (detright >= 0.0) {
58+
if (detright >= 0.0)
5959
return CGAlgorithmsDD.signum(det)
60-
} else {
60+
else
6161
detsum = -detleft - detright
62-
}
62+
6363
else
6464
return CGAlgorithmsDD.signum(det)
6565

src/org/locationtech/jts/algorithm/InteriorPointPoint.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Geometry from '../geom/Geometry'
22
import Coordinate from '../geom/Coordinate'
33
import Point from '../geom/Point'
44
import Double from '../../../../java/lang/Double'
5+
import Centroid from './Centroid'
56
import GeometryCollection from '../geom/GeometryCollection'
67
export default class InteriorPointPoint {
78
constructor() {
@@ -12,7 +13,7 @@ export default class InteriorPointPoint {
1213
this._minDistance = Double.MAX_VALUE
1314
this._interiorPoint = null
1415
const g = arguments[0]
15-
this._centroid = g.getCentroid().getCoordinate()
16+
this._centroid = Centroid.getCentroid(g)
1617
this.add(g)
1718
}
1819
static getInteriorPoint(geom) {

src/org/locationtech/jts/algorithm/PointLocator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ export default class PointLocator {
7171
if (!l.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR
7272
const seq = l.getCoordinateSequence()
7373
if (!l.isClosed())
74-
if (p.equals(seq.getCoordinate(0)) || p.equals(seq.getCoordinate(seq.size() - 1))) {
74+
if (p.equals(seq.getCoordinate(0)) || p.equals(seq.getCoordinate(seq.size() - 1)))
7575
return Location.BOUNDARY
76-
}
76+
7777

7878
if (PointLocation.isOnLine(p, seq))
7979
return Location.INTERIOR

src/org/locationtech/jts/algorithm/RobustDeterminant.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,36 @@ export default class RobustDeterminant {
1313
let count = 0
1414
sign = 1
1515
if (x1 === 0.0 || y2 === 0.0)
16-
if (y1 === 0.0 || x2 === 0.0) {
16+
if (y1 === 0.0 || x2 === 0.0)
1717
return 0
18-
} else if (y1 > 0) {
18+
else if (y1 > 0)
1919
if (x2 > 0)
2020
return -sign
2121
else
2222
return sign
2323

24-
} else {
25-
if (x2 > 0)
26-
return sign
27-
else
28-
return -sign
24+
else
25+
if (x2 > 0)
26+
return sign
27+
else
28+
return -sign
2929

30-
}
30+
3131

3232
if (y1 === 0.0 || x2 === 0.0)
33-
if (y2 > 0) {
33+
if (y2 > 0)
3434
if (x1 > 0)
3535
return sign
3636
else
3737
return -sign
3838

39-
} else {
40-
if (x1 > 0)
41-
return -sign
42-
else
43-
return sign
39+
else
40+
if (x1 > 0)
41+
return -sign
42+
else
43+
return sign
4444

45-
}
45+
4646

4747
if (0.0 < y1) {
4848
if (0.0 < y2) {
@@ -150,11 +150,11 @@ export default class RobustDeterminant {
150150
}
151151
}
152152
if (y2 === 0.0)
153-
if (x2 === 0.0) {
153+
if (x2 === 0.0)
154154
return 0
155-
} else {
155+
else
156156
return -sign
157-
}
157+
158158

159159
if (x2 === 0.0)
160160
return sign
@@ -182,11 +182,11 @@ export default class RobustDeterminant {
182182
}
183183
}
184184
if (y1 === 0.0)
185-
if (x1 === 0.0) {
185+
if (x1 === 0.0)
186186
return 0
187-
} else {
187+
else
188188
return sign
189-
}
189+
190190

191191
if (x1 === 0.0)
192192
return -sign

src/org/locationtech/jts/algorithm/construct/LargestEmptyCircle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Location from '../../geom/Location'
22
import PriorityQueue from '../../../../../java/util/PriorityQueue'
33
import Coordinate from '../../geom/Coordinate'
44
import IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException'
5+
import Centroid from '../Centroid'
56
import Comparable from '../../../../../java/lang/Comparable'
67
import IndexedFacetDistance from '../../operation/distance/IndexedFacetDistance'
78
import IndexedPointInAreaLocator from '../locate/IndexedPointInAreaLocator'
@@ -84,7 +85,7 @@ export default class LargestEmptyCircle {
8485
return this._radiusPoint
8586
}
8687
createCentroidCell(geom) {
87-
const p = geom.getCentroid()
88+
const p = this._factory.createPoint(Centroid.getCentroid(geom))
8889
return new Cell(p.getX(), p.getY(), 0, this.distanceToConstraints(p))
8990
}
9091
getCenter() {

src/org/locationtech/jts/algorithm/construct/MaximumInscribedCircle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Coordinate from '../../geom/Coordinate'
44
import IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException'
55
import Polygon from '../../geom/Polygon'
66
import MultiPolygon from '../../geom/MultiPolygon'
7+
import Centroid from '../Centroid'
78
import Comparable from '../../../../../java/lang/Comparable'
89
import IndexedFacetDistance from '../../operation/distance/IndexedFacetDistance'
910
import Envelope from '../../geom/Envelope'
@@ -94,7 +95,7 @@ export default class MaximumInscribedCircle {
9495
return this._radiusPoint
9596
}
9697
createCentroidCell(geom) {
97-
const p = geom.getCentroid()
98+
const p = this._factory.createPoint(Centroid.getCentroid(geom))
9899
return new Cell(p.getX(), p.getY(), 0, this.distanceToBoundary(p))
99100
}
100101
getCenter() {

src/org/locationtech/jts/geom/GeometryCollectionIterator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export default class GeometryCollectionIterator {
2828
return this._parent
2929
}
3030
if (this._subcollectionIterator !== null)
31-
if (this._subcollectionIterator.hasNext()) {
31+
if (this._subcollectionIterator.hasNext())
3232
return this._subcollectionIterator.next()
33-
} else {
33+
else
3434
this._subcollectionIterator = null
35-
}
35+
3636

3737
if (this._index >= this._max)
3838
throw new NoSuchElementException()

src/org/locationtech/jts/geomgraph/Depth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export default class Depth {
7070
for (let j = 1; j < 3; j++) {
7171
const loc = lbl.getLocation(i, j)
7272
if (loc === Location.EXTERIOR || loc === Location.INTERIOR)
73-
if (this.isNull(i, j)) {
73+
if (this.isNull(i, j))
7474
this._depth[i][j] = Depth.depthAtLocation(loc)
75-
} else this._depth[i][j] += Depth.depthAtLocation(loc)
75+
else this._depth[i][j] += Depth.depthAtLocation(loc)
7676

7777
}
7878

src/org/locationtech/jts/index/strtree/AbstractSTRtree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ export default class AbstractSTRtree {
218218
}
219219
}
220220
if (childToPrune !== null)
221-
if (childToPrune.getChildBoundables().isEmpty()) {
221+
if (childToPrune.getChildBoundables().isEmpty())
222222
node.getChildBoundables().remove(childToPrune)
223-
}
223+
224224

225225
return found
226226
}

0 commit comments

Comments
 (0)