Skip to content

Commit

Permalink
New transpilation with additional fixes to shortcut method use
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharrtell committed Aug 29, 2023
1 parent 5947ebc commit 5be6f4e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 34 deletions.
3 changes: 2 additions & 1 deletion src/org/locationtech/jts/algorithm/MinimumBoundingCircle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Coordinate from '../geom/Coordinate.js'
import Double from '../../../../java/lang/Double.js'
import BufferOp from '../operation/buffer/BufferOp.js'
import CoordinateArrays from '../geom/CoordinateArrays.js'
import Angle from './Angle.js'
import Assert from '../util/Assert.js'
Expand Down Expand Up @@ -141,7 +142,7 @@ export default class MinimumBoundingCircle {
if (this._centre === null) return this._input.getFactory().createPolygon()
const centrePoint = this._input.getFactory().createPoint(this._centre)
if (this._radius === 0.0) return centrePoint
return centrePoint.buffer(this._radius)
return BufferOp.bufferOp(centrePoint, this._radius)
}
getCentre() {
this.compute()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import SimilarityMeasure from './SimilarityMeasure.js'
import UnionOp from '../../operation/union/UnionOp.js'
import OverlayOp from '../../operation/overlay/OverlayOp.js'
export default class AreaSimilarityMeasure {
measure(g1, g2) {
const areaInt = g1.intersection(g2).getArea()
const areaUnion = g1.union(g2).getArea()
const areaInt = OverlayOp.intersection(g1, g2).getArea()
const areaUnion = UnionOp.union(g1, g2).getArea()
return areaInt / areaUnion
}
get interfaces_() {
Expand Down
3 changes: 2 additions & 1 deletion src/org/locationtech/jts/operation/buffer/VariableBuffer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import BufferParameters from './BufferParameters.js'
import CoordinateList from '../../geom/CoordinateList.js'
import GeometryFactory from '../../geom/GeometryFactory.js'
import UnaryUnionOp from '../union/UnaryUnionOp.js'
import Double from '../../../../../java/lang/Double.js'
import LineSegment from '../../geom/LineSegment.js'
import Coordinate from '../../geom/Coordinate.js'
Expand Down Expand Up @@ -170,7 +171,7 @@ export default class VariableBuffer {
}
}
const partsGeom = this._geomFactory.createGeometryCollection(GeometryFactory.toGeometryArray(parts))
const buffer = partsGeom.union()
const buffer = UnaryUnionOp.union(partsGeom)
if (buffer.isEmpty())
return this._geomFactory.createPolygon()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import TreeSet from '../../../../../../java/util/TreeSet.js'
import Double from '../../../../../../java/lang/Double.js'
import BufferOp from '../../buffer/BufferOp.js'
import LineStringSnapper from './LineStringSnapper.js'
import PrecisionModel from '../../../geom/PrecisionModel.js'
import Polygonal from '../../../geom/Polygonal.js'
Expand Down Expand Up @@ -63,7 +64,7 @@ export default class GeometrySnapper {
const snappedGeom = snapTrans.transform(this._srcGeom)
let result = snappedGeom
if (cleanResult && hasInterface(result, Polygonal))
result = snappedGeom.buffer(0)
result = BufferOp.bufferOp(snappedGeom, 0)

return result
}
Expand Down
23 changes: 0 additions & 23 deletions src/org/locationtech/jts/operation/union/CascadedPolygonUnion.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ export default class CascadedPolygonUnion {
}
}
}
repeatedUnion(geoms) {
let union = null
for (let i = geoms.iterator(); i.hasNext(); ) {
const g = i.next()
if (union === null) union = g.copy(); else union = union.union(g)
}
return union
}
unionSafe(g0, g1) {
if (g0 === null && g1 === null) return null
if (g0 === null) return g1.copy()
Expand All @@ -106,20 +98,5 @@ export default class CascadedPolygonUnion {
const union = this.binaryUnion(geoms)
return union
}
bufferUnion() {
if (arguments.length === 1) {
const geoms = arguments[0]
const factory = geoms.get(0).getFactory()
const gColl = factory.buildGeometry(geoms)
const unionAll = gColl.buffer(0.0)
return unionAll
} else if (arguments.length === 2) {
const g0 = arguments[0], g1 = arguments[1]
const factory = g0.getFactory()
const gColl = factory.createGeometryCollection([g0, g1])
const unionAll = gColl.buffer(0.0)
return unionAll
}
}
}
CascadedPolygonUnion.STRTREE_NODE_CAPACITY = 4
6 changes: 0 additions & 6 deletions src/org/locationtech/jts/operation/union/UnionInteracting.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ export default class UnionInteracting {
return interactsWithAny
}
}
bufferUnion(g0, g1) {
const factory = g0.getFactory()
const gColl = factory.createGeometryCollection([g0, g1])
const unionAll = gColl.buffer(0.0)
return unionAll
}
union() {
this.computeInteracting()
const int0 = this.extractElements(this._g0, this._interacts0, true)
Expand Down

0 comments on commit 5be6f4e

Please sign in to comment.