UNPKG

node-red-contrib-tak-registration

Version:

A Node-RED node to register to TAK and to help wrap files as datapackages to send to TAK

1,635 lines (1,563 loc) 641 kB
/* Polyfill service v3.13.0 * For detailed credits and licence information see http://github.com/financial-times/polyfill-service * * - Array.prototype.fill, License: CC0 */ if (!('fill' in Array.prototype)) { Object.defineProperty(Array.prototype, 'fill', { configurable: true, value: function fill (value) { if (this === undefined || this === null) { throw new TypeError(this + ' is not an object') } var arrayLike = Object(this); var length = Math.max(Math.min(arrayLike.length, 9007199254740991), 0) || 0; var relativeStart = 1 in arguments ? parseInt(Number(arguments[1]), 10) || 0 : 0; relativeStart = relativeStart < 0 ? Math.max(length + relativeStart, 0) : Math.min(relativeStart, length); var relativeEnd = 2 in arguments && arguments[2] !== undefined ? parseInt(Number(arguments[2]), 10) || 0 : length; relativeEnd = relativeEnd < 0 ? Math.max(length + arguments[2], 0) : Math.min(relativeEnd, length); while (relativeStart < relativeEnd) { arrayLike[relativeStart] = value; ++relativeStart; } return arrayLike }, writable: true }); } /** * Polyfill for IE support */ Number.isFinite = Number.isFinite || function (value) { return typeof value === 'number' && isFinite(value) }; Number.isInteger = Number.isInteger || function (val) { return typeof val === 'number' && isFinite(val) && Math.floor(val) === val }; Number.parseFloat = Number.parseFloat || parseFloat; Number.isNaN = Number.isNaN || function (value) { return value !== value // eslint-disable-line }; /** * Polyfill for IE support */ Math.trunc = Math.trunc || function (x) { return x < 0 ? Math.ceil(x) : Math.floor(x) }; var NumberUtil = function NumberUtil () {}; NumberUtil.prototype.interfaces_ = function interfaces_ () { return [] }; NumberUtil.prototype.getClass = function getClass () { return NumberUtil }; NumberUtil.prototype.equalsWithTolerance = function equalsWithTolerance (x1, x2, tolerance) { return Math.abs(x1 - x2) <= tolerance }; var IllegalArgumentException = (function (Error) { function IllegalArgumentException (message) { Error.call(this, message); this.name = 'IllegalArgumentException'; this.message = message; this.stack = (new Error()).stack; } if ( Error ) IllegalArgumentException.__proto__ = Error; IllegalArgumentException.prototype = Object.create( Error && Error.prototype ); IllegalArgumentException.prototype.constructor = IllegalArgumentException; return IllegalArgumentException; }(Error)); var Double = function Double () {}; var staticAccessors$1 = { MAX_VALUE: { configurable: true } }; Double.isNaN = function isNaN (n) { return Number.isNaN(n) }; Double.doubleToLongBits = function doubleToLongBits (n) { return n }; Double.longBitsToDouble = function longBitsToDouble (n) { return n }; Double.isInfinite = function isInfinite (n) { return !Number.isFinite(n) }; staticAccessors$1.MAX_VALUE.get = function () { return Number.MAX_VALUE }; Object.defineProperties( Double, staticAccessors$1 ); var Comparable = function Comparable () {}; var Clonable = function Clonable () {}; var Comparator = function Comparator () {}; function Serializable () {} // import Assert from '../util/Assert' var Coordinate = function Coordinate () { this.x = null; this.y = null; this.z = null; if (arguments.length === 0) { this.x = 0.0; this.y = 0.0; this.z = Coordinate.NULL_ORDINATE; } else if (arguments.length === 1) { var c = arguments[0]; this.x = c.x; this.y = c.y; this.z = c.z; } else if (arguments.length === 2) { this.x = arguments[0]; this.y = arguments[1]; this.z = Coordinate.NULL_ORDINATE; } else if (arguments.length === 3) { this.x = arguments[0]; this.y = arguments[1]; this.z = arguments[2]; } }; var staticAccessors = { DimensionalComparator: { configurable: true },serialVersionUID: { configurable: true },NULL_ORDINATE: { configurable: true },X: { configurable: true },Y: { configurable: true },Z: { configurable: true } }; Coordinate.prototype.setOrdinate = function setOrdinate (ordinateIndex, value) { switch (ordinateIndex) { case Coordinate.X: this.x = value; break case Coordinate.Y: this.y = value; break case Coordinate.Z: this.z = value; break default: throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex) } }; Coordinate.prototype.equals2D = function equals2D () { if (arguments.length === 1) { var other = arguments[0]; if (this.x !== other.x) { return false } if (this.y !== other.y) { return false } return true } else if (arguments.length === 2) { var c = arguments[0]; var tolerance = arguments[1]; if (!NumberUtil.equalsWithTolerance(this.x, c.x, tolerance)) { return false } if (!NumberUtil.equalsWithTolerance(this.y, c.y, tolerance)) { return false } return true } }; Coordinate.prototype.getOrdinate = function getOrdinate (ordinateIndex) { switch (ordinateIndex) { case Coordinate.X: return this.x case Coordinate.Y: return this.y case Coordinate.Z: return this.z default: } throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex) }; Coordinate.prototype.equals3D = function equals3D (other) { return this.x === other.x && this.y === other.y && ((this.z === other.z || Double.isNaN(this.z)) && Double.isNaN(other.z)) }; Coordinate.prototype.equals = function equals (other) { if (!(other instanceof Coordinate)) { return false } return this.equals2D(other) }; Coordinate.prototype.equalInZ = function equalInZ (c, tolerance) { return NumberUtil.equalsWithTolerance(this.z, c.z, tolerance) }; Coordinate.prototype.compareTo = function compareTo (o) { var other = o; if (this.x < other.x) { return -1 } if (this.x > other.x) { return 1 } if (this.y < other.y) { return -1 } if (this.y > other.y) { return 1 } return 0 }; Coordinate.prototype.clone = function clone () { // try { // var coord = null // return coord // } catch (e) { // if (e instanceof CloneNotSupportedException) { // Assert.shouldNeverReachHere("this shouldn't happen because this class is Cloneable") // return null // } else throw e // } finally {} }; Coordinate.prototype.copy = function copy () { return new Coordinate(this) }; Coordinate.prototype.toString = function toString () { return '(' + this.x + ', ' + this.y + ', ' + this.z + ')' }; Coordinate.prototype.distance3D = function distance3D (c) { var dx = this.x - c.x; var dy = this.y - c.y; var dz = this.z - c.z; return Math.sqrt(dx * dx + dy * dy + dz * dz) }; Coordinate.prototype.distance = function distance (c) { var dx = this.x - c.x; var dy = this.y - c.y; return Math.sqrt(dx * dx + dy * dy) }; Coordinate.prototype.hashCode = function hashCode () { var result = 17; result = 37 * result + Coordinate.hashCode(this.x); result = 37 * result + Coordinate.hashCode(this.y); return result }; Coordinate.prototype.setCoordinate = function setCoordinate (other) { this.x = other.x; this.y = other.y; this.z = other.z; }; Coordinate.prototype.interfaces_ = function interfaces_ () { return [Comparable, Clonable, Serializable] }; Coordinate.prototype.getClass = function getClass () { return Coordinate }; Coordinate.hashCode = function hashCode () { if (arguments.length === 1) { var x = arguments[0]; var f = Double.doubleToLongBits(x); return Math.trunc((f ^ f) >>> 32) } }; staticAccessors.DimensionalComparator.get = function () { return DimensionalComparator }; staticAccessors.serialVersionUID.get = function () { return 6683108902428366910 }; staticAccessors.NULL_ORDINATE.get = function () { return Double.NaN }; staticAccessors.X.get = function () { return 0 }; staticAccessors.Y.get = function () { return 1 }; staticAccessors.Z.get = function () { return 2 }; Object.defineProperties( Coordinate, staticAccessors ); var DimensionalComparator = function DimensionalComparator (dimensionsToTest) { this._dimensionsToTest = 2; if (arguments.length === 0) {} else if (arguments.length === 1) { var dimensionsToTest$1 = arguments[0]; if (dimensionsToTest$1 !== 2 && dimensionsToTest$1 !== 3) { throw new IllegalArgumentException('only 2 or 3 dimensions may be specified') } this._dimensionsToTest = dimensionsToTest$1; } }; DimensionalComparator.prototype.compare = function compare (o1, o2) { var c1 = o1; var c2 = o2; var compX = DimensionalComparator.compare(c1.x, c2.x); if (compX !== 0) { return compX } var compY = DimensionalComparator.compare(c1.y, c2.y); if (compY !== 0) { return compY } if (this._dimensionsToTest <= 2) { return 0 } var compZ = DimensionalComparator.compare(c1.z, c2.z); return compZ }; DimensionalComparator.prototype.interfaces_ = function interfaces_ () { return [Comparator] }; DimensionalComparator.prototype.getClass = function getClass () { return DimensionalComparator }; DimensionalComparator.compare = function compare (a, b) { if (a < b) { return -1 } if (a > b) { return 1 } if (Double.isNaN(a)) { if (Double.isNaN(b)) { return 0 } return -1 } if (Double.isNaN(b)) { return 1 } return 0 }; // import hasInterface from '../../../../hasInterface' // import CoordinateSequence from './CoordinateSequence' var CoordinateSequenceFactory = function CoordinateSequenceFactory () {}; CoordinateSequenceFactory.prototype.create = function create () { // if (arguments.length === 1) { // if (arguments[0] instanceof Array) { // let coordinates = arguments[0] // } else if (hasInterface(arguments[0], CoordinateSequence)) { // let coordSeq = arguments[0] // } // } else if (arguments.length === 2) { // let size = arguments[0] // let dimension = arguments[1] // } }; CoordinateSequenceFactory.prototype.interfaces_ = function interfaces_ () { return [] }; CoordinateSequenceFactory.prototype.getClass = function getClass () { return CoordinateSequenceFactory }; var Location = function Location () {}; var staticAccessors$4 = { INTERIOR: { configurable: true },BOUNDARY: { configurable: true },EXTERIOR: { configurable: true },NONE: { configurable: true } }; Location.prototype.interfaces_ = function interfaces_ () { return [] }; Location.prototype.getClass = function getClass () { return Location }; Location.toLocationSymbol = function toLocationSymbol (locationValue) { switch (locationValue) { case Location.EXTERIOR: return 'e' case Location.BOUNDARY: return 'b' case Location.INTERIOR: return 'i' case Location.NONE: return '-' default: } throw new IllegalArgumentException('Unknown location value: ' + locationValue) }; staticAccessors$4.INTERIOR.get = function () { return 0 }; staticAccessors$4.BOUNDARY.get = function () { return 1 }; staticAccessors$4.EXTERIOR.get = function () { return 2 }; staticAccessors$4.NONE.get = function () { return -1 }; Object.defineProperties( Location, staticAccessors$4 ); var hasInterface = function (o, i) { return o.interfaces_ && o.interfaces_().indexOf(i) > -1 }; var MathUtil = function MathUtil () {}; var staticAccessors$5 = { LOG_10: { configurable: true } }; MathUtil.prototype.interfaces_ = function interfaces_ () { return [] }; MathUtil.prototype.getClass = function getClass () { return MathUtil }; MathUtil.log10 = function log10 (x) { var ln = Math.log(x); if (Double.isInfinite(ln)) { return ln } if (Double.isNaN(ln)) { return ln } return ln / MathUtil.LOG_10 }; MathUtil.min = function min (v1, v2, v3, v4) { var min = v1; if (v2 < min) { min = v2; } if (v3 < min) { min = v3; } if (v4 < min) { min = v4; } return min }; MathUtil.clamp = function clamp () { if (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number')) { var x = arguments[0]; var min = arguments[1]; var max = arguments[2]; if (x < min) { return min } if (x > max) { return max } return x } else if (Number.isInteger(arguments[2]) && (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1]))) { var x$1 = arguments[0]; var min$1 = arguments[1]; var max$1 = arguments[2]; if (x$1 < min$1) { return min$1 } if (x$1 > max$1) { return max$1 } return x$1 } }; MathUtil.wrap = function wrap (index, max) { if (index < 0) { return max - -index % max } return index % max }; MathUtil.max = function max () { if (arguments.length === 3) { var v1 = arguments[0]; var v2 = arguments[1]; var v3 = arguments[2]; var max = v1; if (v2 > max) { max = v2; } if (v3 > max) { max = v3; } return max } else if (arguments.length === 4) { var v1$1 = arguments[0]; var v2$1 = arguments[1]; var v3$1 = arguments[2]; var v4 = arguments[3]; var max$1 = v1$1; if (v2$1 > max$1) { max$1 = v2$1; } if (v3$1 > max$1) { max$1 = v3$1; } if (v4 > max$1) { max$1 = v4; } return max$1 } }; MathUtil.average = function average (x1, x2) { return (x1 + x2) / 2.0 }; staticAccessors$5.LOG_10.get = function () { return Math.log(10) }; Object.defineProperties( MathUtil, staticAccessors$5 ); var StringBuffer = function StringBuffer (str) { this.str = str; }; StringBuffer.prototype.append = function append (e) { this.str += e; }; StringBuffer.prototype.setCharAt = function setCharAt (i, c) { this.str = this.str.substr(0, i) + c + this.str.substr(i + 1); }; StringBuffer.prototype.toString = function toString (e) { return this.str }; var Integer = function Integer (value) { this.value = value; }; Integer.prototype.intValue = function intValue () { return this.value }; Integer.prototype.compareTo = function compareTo (o) { if (this.value < o) { return -1 } if (this.value > o) { return 1 } return 0 }; Integer.isNaN = function isNaN (n) { return Number.isNaN(n) }; var Character = function Character () {}; Character.isWhitespace = function isWhitespace (c) { return ((c <= 32 && c >= 0) || c === 127) }; Character.toUpperCase = function toUpperCase (c) { return c.toUpperCase() }; var DD = function DD () { this._hi = 0.0; this._lo = 0.0; if (arguments.length === 0) { this.init(0.0); } else if (arguments.length === 1) { if (typeof arguments[0] === 'number') { var x = arguments[0]; this.init(x); } else if (arguments[0] instanceof DD) { var dd = arguments[0]; this.init(dd); } else if (typeof arguments[0] === 'string') { var str = arguments[0]; DD.call(this, DD.parse(str)); } } else if (arguments.length === 2) { var hi = arguments[0]; var lo = arguments[1]; this.init(hi, lo); } }; var staticAccessors$7 = { PI: { configurable: true },TWO_PI: { configurable: true },PI_2: { configurable: true },E: { configurable: true },NaN: { configurable: true },EPS: { configurable: true },SPLIT: { configurable: true },MAX_PRINT_DIGITS: { configurable: true },TEN: { configurable: true },ONE: { configurable: true },SCI_NOT_EXPONENT_CHAR: { configurable: true },SCI_NOT_ZERO: { configurable: true } }; DD.prototype.le = function le (y) { return (this._hi < y._hi || this._hi === y._hi) && this._lo <= y._lo }; DD.prototype.extractSignificantDigits = function extractSignificantDigits (insertDecimalPoint, magnitude) { var y = this.abs(); var mag = DD.magnitude(y._hi); var scale = DD.TEN.pow(mag); y = y.divide(scale); if (y.gt(DD.TEN)) { y = y.divide(DD.TEN); mag += 1; } else if (y.lt(DD.ONE)) { y = y.multiply(DD.TEN); mag -= 1; } var decimalPointPos = mag + 1; var buf = new StringBuffer(); var numDigits = DD.MAX_PRINT_DIGITS - 1; for (var i = 0; i <= numDigits; i++) { if (insertDecimalPoint && i === decimalPointPos) { buf.append('.'); } var digit = Math.trunc(y._hi); if (digit < 0) { break } var rebiasBy10 = false; var digitChar = 0; if (digit > 9) { rebiasBy10 = true; digitChar = '9'; } else { digitChar = '0' + digit; } buf.append(digitChar); y = y.subtract(DD.valueOf(digit)).multiply(DD.TEN); if (rebiasBy10) { y.selfAdd(DD.TEN); } var continueExtractingDigits = true; var remMag = DD.magnitude(y._hi); if (remMag < 0 && Math.abs(remMag) >= numDigits - i) { continueExtractingDigits = false; } if (!continueExtractingDigits) { break } } magnitude[0] = mag; return buf.toString() }; DD.prototype.sqr = function sqr () { return this.multiply(this) }; DD.prototype.doubleValue = function doubleValue () { return this._hi + this._lo }; DD.prototype.subtract = function subtract () { if (arguments[0] instanceof DD) { var y = arguments[0]; return this.add(y.negate()) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; return this.add(-y$1) } }; DD.prototype.equals = function equals () { if (arguments.length === 1) { var y = arguments[0]; return this._hi === y._hi && this._lo === y._lo } }; DD.prototype.isZero = function isZero () { return this._hi === 0.0 && this._lo === 0.0 }; DD.prototype.selfSubtract = function selfSubtract () { if (arguments[0] instanceof DD) { var y = arguments[0]; if (this.isNaN()) { return this } return this.selfAdd(-y._hi, -y._lo) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; if (this.isNaN()) { return this } return this.selfAdd(-y$1, 0.0) } }; DD.prototype.getSpecialNumberString = function getSpecialNumberString () { if (this.isZero()) { return '0.0' } if (this.isNaN()) { return 'NaN ' } return null }; DD.prototype.min = function min (x) { if (this.le(x)) { return this } else { return x } }; DD.prototype.selfDivide = function selfDivide () { if (arguments.length === 1) { if (arguments[0] instanceof DD) { var y = arguments[0]; return this.selfDivide(y._hi, y._lo) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; return this.selfDivide(y$1, 0.0) } } else if (arguments.length === 2) { var yhi = arguments[0]; var ylo = arguments[1]; var hc = null; var tc = null; var hy = null; var ty = null; var C = null; var c = null; var U = null; var u = null; C = this._hi / yhi; c = DD.SPLIT * C; hc = c - C; u = DD.SPLIT * yhi; hc = c - hc; tc = C - hc; hy = u - yhi; U = C * yhi; hy = u - hy; ty = yhi - hy; u = hc * hy - U + hc * ty + tc * hy + tc * ty; c = (this._hi - U - u + this._lo - C * ylo) / yhi; u = C + c; this._hi = u; this._lo = C - u + c; return this } }; DD.prototype.dump = function dump () { return 'DD<' + this._hi + ', ' + this._lo + '>' }; DD.prototype.divide = function divide () { if (arguments[0] instanceof DD) { var y = arguments[0]; var hc = null; var tc = null; var hy = null; var ty = null; var C = null; var c = null; var U = null; var u = null; C = this._hi / y._hi; c = DD.SPLIT * C; hc = c - C; u = DD.SPLIT * y._hi; hc = c - hc; tc = C - hc; hy = u - y._hi; U = C * y._hi; hy = u - hy; ty = y._hi - hy; u = hc * hy - U + hc * ty + tc * hy + tc * ty; c = (this._hi - U - u + this._lo - C * y._lo) / y._hi; u = C + c; var zhi = u; var zlo = C - u + c; return new DD(zhi, zlo) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; if (Double.isNaN(y$1)) { return DD.createNaN() } return DD.copy(this).selfDivide(y$1, 0.0) } }; DD.prototype.ge = function ge (y) { return (this._hi > y._hi || this._hi === y._hi) && this._lo >= y._lo }; DD.prototype.pow = function pow (exp) { if (exp === 0.0) { return DD.valueOf(1.0) } var r = new DD(this); var s = DD.valueOf(1.0); var n = Math.abs(exp); if (n > 1) { while (n > 0) { if (n % 2 === 1) { s.selfMultiply(r); } n /= 2; if (n > 0) { r = r.sqr(); } } } else { s = r; } if (exp < 0) { return s.reciprocal() } return s }; DD.prototype.ceil = function ceil () { if (this.isNaN()) { return DD.NaN } var fhi = Math.ceil(this._hi); var flo = 0.0; if (fhi === this._hi) { flo = Math.ceil(this._lo); } return new DD(fhi, flo) }; DD.prototype.compareTo = function compareTo (o) { var other = o; if (this._hi < other._hi) { return -1 } if (this._hi > other._hi) { return 1 } if (this._lo < other._lo) { return -1 } if (this._lo > other._lo) { return 1 } return 0 }; DD.prototype.rint = function rint () { if (this.isNaN()) { return this } var plus5 = this.add(0.5); return plus5.floor() }; DD.prototype.setValue = function setValue () { if (arguments[0] instanceof DD) { var value = arguments[0]; this.init(value); return this } else if (typeof arguments[0] === 'number') { var value$1 = arguments[0]; this.init(value$1); return this } }; DD.prototype.max = function max (x) { if (this.ge(x)) { return this } else { return x } }; DD.prototype.sqrt = function sqrt () { if (this.isZero()) { return DD.valueOf(0.0) } if (this.isNegative()) { return DD.NaN } var x = 1.0 / Math.sqrt(this._hi); var ax = this._hi * x; var axdd = DD.valueOf(ax); var diffSq = this.subtract(axdd.sqr()); var d2 = diffSq._hi * (x * 0.5); return axdd.add(d2) }; DD.prototype.selfAdd = function selfAdd () { if (arguments.length === 1) { if (arguments[0] instanceof DD) { var y = arguments[0]; return this.selfAdd(y._hi, y._lo) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; var H = null; var h = null; var S = null; var s = null; var e = null; var f = null; S = this._hi + y$1; e = S - this._hi; s = S - e; s = y$1 - e + (this._hi - s); f = s + this._lo; H = S + f; h = f + (S - H); this._hi = H + h; this._lo = h + (H - this._hi); return this } } else if (arguments.length === 2) { var yhi = arguments[0]; var ylo = arguments[1]; var H$1 = null; var h$1 = null; var T = null; var t = null; var S$1 = null; var s$1 = null; var e$1 = null; var f$1 = null; S$1 = this._hi + yhi; T = this._lo + ylo; e$1 = S$1 - this._hi; f$1 = T - this._lo; s$1 = S$1 - e$1; t = T - f$1; s$1 = yhi - e$1 + (this._hi - s$1); t = ylo - f$1 + (this._lo - t); e$1 = s$1 + T; H$1 = S$1 + e$1; h$1 = e$1 + (S$1 - H$1); e$1 = t + h$1; var zhi = H$1 + e$1; var zlo = e$1 + (H$1 - zhi); this._hi = zhi; this._lo = zlo; return this } }; DD.prototype.selfMultiply = function selfMultiply () { if (arguments.length === 1) { if (arguments[0] instanceof DD) { var y = arguments[0]; return this.selfMultiply(y._hi, y._lo) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; return this.selfMultiply(y$1, 0.0) } } else if (arguments.length === 2) { var yhi = arguments[0]; var ylo = arguments[1]; var hx = null; var tx = null; var hy = null; var ty = null; var C = null; var c = null; C = DD.SPLIT * this._hi; hx = C - this._hi; c = DD.SPLIT * yhi; hx = C - hx; tx = this._hi - hx; hy = c - yhi; C = this._hi * yhi; hy = c - hy; ty = yhi - hy; c = hx * hy - C + hx * ty + tx * hy + tx * ty + (this._hi * ylo + this._lo * yhi); var zhi = C + c; hx = C - zhi; var zlo = c + hx; this._hi = zhi; this._lo = zlo; return this } }; DD.prototype.selfSqr = function selfSqr () { return this.selfMultiply(this) }; DD.prototype.floor = function floor () { if (this.isNaN()) { return DD.NaN } var fhi = Math.floor(this._hi); var flo = 0.0; if (fhi === this._hi) { flo = Math.floor(this._lo); } return new DD(fhi, flo) }; DD.prototype.negate = function negate () { if (this.isNaN()) { return this } return new DD(-this._hi, -this._lo) }; DD.prototype.clone = function clone () { // try { // return null // } catch (ex) { // if (ex instanceof CloneNotSupportedException) { // return null // } else throw ex // } finally {} }; DD.prototype.multiply = function multiply () { if (arguments[0] instanceof DD) { var y = arguments[0]; if (y.isNaN()) { return DD.createNaN() } return DD.copy(this).selfMultiply(y) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; if (Double.isNaN(y$1)) { return DD.createNaN() } return DD.copy(this).selfMultiply(y$1, 0.0) } }; DD.prototype.isNaN = function isNaN () { return Double.isNaN(this._hi) }; DD.prototype.intValue = function intValue () { return Math.trunc(this._hi) }; DD.prototype.toString = function toString () { var mag = DD.magnitude(this._hi); if (mag >= -3 && mag <= 20) { return this.toStandardNotation() } return this.toSciNotation() }; DD.prototype.toStandardNotation = function toStandardNotation () { var specialStr = this.getSpecialNumberString(); if (specialStr !== null) { return specialStr } var magnitude = new Array(1).fill(null); var sigDigits = this.extractSignificantDigits(true, magnitude); var decimalPointPos = magnitude[0] + 1; var num = sigDigits; if (sigDigits.charAt(0) === '.') { num = '0' + sigDigits; } else if (decimalPointPos < 0) { num = '0.' + DD.stringOfChar('0', -decimalPointPos) + sigDigits; } else if (sigDigits.indexOf('.') === -1) { var numZeroes = decimalPointPos - sigDigits.length; var zeroes = DD.stringOfChar('0', numZeroes); num = sigDigits + zeroes + '.0'; } if (this.isNegative()) { return '-' + num } return num }; DD.prototype.reciprocal = function reciprocal () { var hc = null; var tc = null; var hy = null; var ty = null; var C = null; var c = null; var U = null; var u = null; C = 1.0 / this._hi; c = DD.SPLIT * C; hc = c - C; u = DD.SPLIT * this._hi; hc = c - hc; tc = C - hc; hy = u - this._hi; U = C * this._hi; hy = u - hy; ty = this._hi - hy; u = hc * hy - U + hc * ty + tc * hy + tc * ty; c = (1.0 - U - u - C * this._lo) / this._hi; var zhi = C + c; var zlo = C - zhi + c; return new DD(zhi, zlo) }; DD.prototype.toSciNotation = function toSciNotation () { if (this.isZero()) { return DD.SCI_NOT_ZERO } var specialStr = this.getSpecialNumberString(); if (specialStr !== null) { return specialStr } var magnitude = new Array(1).fill(null); var digits = this.extractSignificantDigits(false, magnitude); var expStr = DD.SCI_NOT_EXPONENT_CHAR + magnitude[0]; if (digits.charAt(0) === '0') { throw new Error('Found leading zero: ' + digits) } var trailingDigits = ''; if (digits.length > 1) { trailingDigits = digits.substring(1); } var digitsWithDecimal = digits.charAt(0) + '.' + trailingDigits; if (this.isNegative()) { return '-' + digitsWithDecimal + expStr } return digitsWithDecimal + expStr }; DD.prototype.abs = function abs () { if (this.isNaN()) { return DD.NaN } if (this.isNegative()) { return this.negate() } return new DD(this) }; DD.prototype.isPositive = function isPositive () { return (this._hi > 0.0 || this._hi === 0.0) && this._lo > 0.0 }; DD.prototype.lt = function lt (y) { return (this._hi < y._hi || this._hi === y._hi) && this._lo < y._lo }; DD.prototype.add = function add () { if (arguments[0] instanceof DD) { var y = arguments[0]; return DD.copy(this).selfAdd(y) } else if (typeof arguments[0] === 'number') { var y$1 = arguments[0]; return DD.copy(this).selfAdd(y$1) } }; DD.prototype.init = function init () { if (arguments.length === 1) { if (typeof arguments[0] === 'number') { var x = arguments[0]; this._hi = x; this._lo = 0.0; } else if (arguments[0] instanceof DD) { var dd = arguments[0]; this._hi = dd._hi; this._lo = dd._lo; } } else if (arguments.length === 2) { var hi = arguments[0]; var lo = arguments[1]; this._hi = hi; this._lo = lo; } }; DD.prototype.gt = function gt (y) { return (this._hi > y._hi || this._hi === y._hi) && this._lo > y._lo }; DD.prototype.isNegative = function isNegative () { return (this._hi < 0.0 || this._hi === 0.0) && this._lo < 0.0 }; DD.prototype.trunc = function trunc () { if (this.isNaN()) { return DD.NaN } if (this.isPositive()) { return this.floor(); } else { return this.ceil() } }; DD.prototype.signum = function signum () { if (this._hi > 0) { return 1 } if (this._hi < 0) { return -1 } if (this._lo > 0) { return 1 } if (this._lo < 0) { return -1 } return 0 }; DD.prototype.interfaces_ = function interfaces_ () { return [Serializable, Comparable, Clonable] }; DD.prototype.getClass = function getClass () { return DD }; DD.sqr = function sqr (x) { return DD.valueOf(x).selfMultiply(x) }; DD.valueOf = function valueOf () { if (typeof arguments[0] === 'string') { var str = arguments[0]; return DD.parse(str) } else if (typeof arguments[0] === 'number') { var x = arguments[0]; return new DD(x) } }; DD.sqrt = function sqrt (x) { return DD.valueOf(x).sqrt() }; DD.parse = function parse (str) { var i = 0; var strlen = str.length; while (Character.isWhitespace(str.charAt(i))) { i++; } var isNegative = false; if (i < strlen) { var signCh = str.charAt(i); if (signCh === '-' || signCh === '+') { i++; if (signCh === '-') { isNegative = true; } } } var val = new DD(); var numDigits = 0; var numBeforeDec = 0; var exp = 0; while (true) { if (i >= strlen) { break } var ch = str.charAt(i); i++; if (Character.isDigit(ch)) { var d = ch - '0'; val.selfMultiply(DD.TEN); val.selfAdd(d); numDigits++; continue } if (ch === '.') { numBeforeDec = numDigits; continue } if (ch === 'e' || ch === 'E') { var expStr = str.substring(i); try { exp = Integer.parseInt(expStr); } catch (ex) { if (ex instanceof Error) { throw new Error('Invalid exponent ' + expStr + ' in string ' + str) } else { throw ex } } finally {} break } throw new Error("Unexpected character '" + ch + "' at position " + i + ' in string ' + str) } var val2 = val; var numDecPlaces = numDigits - numBeforeDec - exp; if (numDecPlaces === 0) { val2 = val; } else if (numDecPlaces > 0) { var scale = DD.TEN.pow(numDecPlaces); val2 = val.divide(scale); } else if (numDecPlaces < 0) { var scale$1 = DD.TEN.pow(-numDecPlaces); val2 = val.multiply(scale$1); } if (isNegative) { return val2.negate() } return val2 }; DD.createNaN = function createNaN () { return new DD(Double.NaN, Double.NaN) }; DD.copy = function copy (dd) { return new DD(dd) }; DD.magnitude = function magnitude (x) { var xAbs = Math.abs(x); var xLog10 = Math.log(xAbs) / Math.log(10); var xMag = Math.trunc(Math.floor(xLog10)); var xApprox = Math.pow(10, xMag); if (xApprox * 10 <= xAbs) { xMag += 1; } return xMag }; DD.stringOfChar = function stringOfChar (ch, len) { var buf = new StringBuffer(); for (var i = 0; i < len; i++) { buf.append(ch); } return buf.toString() }; staticAccessors$7.PI.get = function () { return new DD(3.141592653589793116e+00, 1.224646799147353207e-16) }; staticAccessors$7.TWO_PI.get = function () { return new DD(6.283185307179586232e+00, 2.449293598294706414e-16) }; staticAccessors$7.PI_2.get = function () { return new DD(1.570796326794896558e+00, 6.123233995736766036e-17) }; staticAccessors$7.E.get = function () { return new DD(2.718281828459045091e+00, 1.445646891729250158e-16) }; staticAccessors$7.NaN.get = function () { return new DD(Double.NaN, Double.NaN) }; staticAccessors$7.EPS.get = function () { return 1.23259516440783e-32 }; staticAccessors$7.SPLIT.get = function () { return 134217729.0 }; staticAccessors$7.MAX_PRINT_DIGITS.get = function () { return 32 }; staticAccessors$7.TEN.get = function () { return DD.valueOf(10.0) }; staticAccessors$7.ONE.get = function () { return DD.valueOf(1.0) }; staticAccessors$7.SCI_NOT_EXPONENT_CHAR.get = function () { return 'E' }; staticAccessors$7.SCI_NOT_ZERO.get = function () { return '0.0E0' }; Object.defineProperties( DD, staticAccessors$7 ); var CGAlgorithmsDD = function CGAlgorithmsDD () {}; var staticAccessors$6 = { DP_SAFE_EPSILON: { configurable: true } }; CGAlgorithmsDD.prototype.interfaces_ = function interfaces_ () { return [] }; CGAlgorithmsDD.prototype.getClass = function getClass () { return CGAlgorithmsDD }; CGAlgorithmsDD.orientationIndex = function orientationIndex (p1, p2, q) { var index = CGAlgorithmsDD.orientationIndexFilter(p1, p2, q); if (index <= 1) { return index } var dx1 = DD.valueOf(p2.x).selfAdd(-p1.x); var dy1 = DD.valueOf(p2.y).selfAdd(-p1.y); var dx2 = DD.valueOf(q.x).selfAdd(-p2.x); var dy2 = DD.valueOf(q.y).selfAdd(-p2.y); return dx1.selfMultiply(dy2).selfSubtract(dy1.selfMultiply(dx2)).signum() }; CGAlgorithmsDD.signOfDet2x2 = function signOfDet2x2 (x1, y1, x2, y2) { var det = x1.multiply(y2).selfSubtract(y1.multiply(x2)); return det.signum() }; CGAlgorithmsDD.intersection = function intersection (p1, p2, q1, q2) { var denom1 = DD.valueOf(q2.y).selfSubtract(q1.y).selfMultiply(DD.valueOf(p2.x).selfSubtract(p1.x)); var denom2 = DD.valueOf(q2.x).selfSubtract(q1.x).selfMultiply(DD.valueOf(p2.y).selfSubtract(p1.y)); var denom = denom1.subtract(denom2); var numx1 = DD.valueOf(q2.x).selfSubtract(q1.x).selfMultiply(DD.valueOf(p1.y).selfSubtract(q1.y)); var numx2 = DD.valueOf(q2.y).selfSubtract(q1.y).selfMultiply(DD.valueOf(p1.x).selfSubtract(q1.x)); var numx = numx1.subtract(numx2); var fracP = numx.selfDivide(denom).doubleValue(); var x = DD.valueOf(p1.x).selfAdd(DD.valueOf(p2.x).selfSubtract(p1.x).selfMultiply(fracP)).doubleValue(); var numy1 = DD.valueOf(p2.x).selfSubtract(p1.x).selfMultiply(DD.valueOf(p1.y).selfSubtract(q1.y)); var numy2 = DD.valueOf(p2.y).selfSubtract(p1.y).selfMultiply(DD.valueOf(p1.x).selfSubtract(q1.x)); var numy = numy1.subtract(numy2); var fracQ = numy.selfDivide(denom).doubleValue(); var y = DD.valueOf(q1.y).selfAdd(DD.valueOf(q2.y).selfSubtract(q1.y).selfMultiply(fracQ)).doubleValue(); return new Coordinate(x, y) }; CGAlgorithmsDD.orientationIndexFilter = function orientationIndexFilter (pa, pb, pc) { var detsum = null; var detleft = (pa.x - pc.x) * (pb.y - pc.y); var detright = (pa.y - pc.y) * (pb.x - pc.x); var det = detleft - detright; if (detleft > 0.0) { if (detright <= 0.0) { return CGAlgorithmsDD.signum(det) } else { detsum = detleft + detright; } } else if (detleft < 0.0) { if (detright >= 0.0) { return CGAlgorithmsDD.signum(det) } else { detsum = -detleft - detright; } } else { return CGAlgorithmsDD.signum(det) } var errbound = CGAlgorithmsDD.DP_SAFE_EPSILON * detsum; if (det >= errbound || -det >= errbound) { return CGAlgorithmsDD.signum(det) } return 2 }; CGAlgorithmsDD.signum = function signum (x) { if (x > 0) { return 1 } if (x < 0) { return -1 } return 0 }; staticAccessors$6.DP_SAFE_EPSILON.get = function () { return 1e-15 }; Object.defineProperties( CGAlgorithmsDD, staticAccessors$6 ); var CoordinateSequence = function CoordinateSequence () {}; var staticAccessors$8 = { X: { configurable: true },Y: { configurable: true },Z: { configurable: true },M: { configurable: true } }; staticAccessors$8.X.get = function () { return 0 }; staticAccessors$8.Y.get = function () { return 1 }; staticAccessors$8.Z.get = function () { return 2 }; staticAccessors$8.M.get = function () { return 3 }; CoordinateSequence.prototype.setOrdinate = function setOrdinate (index, ordinateIndex, value) {}; CoordinateSequence.prototype.size = function size () {}; CoordinateSequence.prototype.getOrdinate = function getOrdinate (index, ordinateIndex) {}; CoordinateSequence.prototype.getCoordinate = function getCoordinate () {}; CoordinateSequence.prototype.getCoordinateCopy = function getCoordinateCopy (i) {}; CoordinateSequence.prototype.getDimension = function getDimension () {}; CoordinateSequence.prototype.getX = function getX (index) {}; CoordinateSequence.prototype.clone = function clone () {}; CoordinateSequence.prototype.expandEnvelope = function expandEnvelope (env) {}; CoordinateSequence.prototype.copy = function copy () {}; CoordinateSequence.prototype.getY = function getY (index) {}; CoordinateSequence.prototype.toCoordinateArray = function toCoordinateArray () {}; CoordinateSequence.prototype.interfaces_ = function interfaces_ () { return [Clonable] }; CoordinateSequence.prototype.getClass = function getClass () { return CoordinateSequence }; Object.defineProperties( CoordinateSequence, staticAccessors$8 ); var Exception = function Exception () {}; var NotRepresentableException = (function (Exception$$1) { function NotRepresentableException () { Exception$$1.call(this, 'Projective point not representable on the Cartesian plane.'); } if ( Exception$$1 ) NotRepresentableException.__proto__ = Exception$$1; NotRepresentableException.prototype = Object.create( Exception$$1 && Exception$$1.prototype ); NotRepresentableException.prototype.constructor = NotRepresentableException; NotRepresentableException.prototype.interfaces_ = function interfaces_ () { return [] }; NotRepresentableException.prototype.getClass = function getClass () { return NotRepresentableException }; return NotRepresentableException; }(Exception)); var System = function System () {}; System.arraycopy = function arraycopy (src, srcPos, dest, destPos, len) { var c = 0; for (var i = srcPos; i < srcPos + len; i++) { dest[destPos + c] = src[i]; c++; } }; System.getProperty = function getProperty (name) { return { 'line.separator': '\n' }[name] }; var HCoordinate = function HCoordinate () { this.x = null; this.y = null; this.w = null; if (arguments.length === 0) { this.x = 0.0; this.y = 0.0; this.w = 1.0; } else if (arguments.length === 1) { var p = arguments[0]; this.x = p.x; this.y = p.y; this.w = 1.0; } else if (arguments.length === 2) { if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') { var _x = arguments[0]; var _y = arguments[1]; this.x = _x; this.y = _y; this.w = 1.0; } else if (arguments[0] instanceof HCoordinate && arguments[1] instanceof HCoordinate) { var p1 = arguments[0]; var p2 = arguments[1]; 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 (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) { var p1$1 = arguments[0]; var p2$1 = arguments[1]; this.x = p1$1.y - p2$1.y; this.y = p2$1.x - p1$1.x; this.w = p1$1.x * p2$1.y - p2$1.x * p1$1.y; } } else if (arguments.length === 3) { var _x$1 = arguments[0]; var _y$1 = arguments[1]; var _w = arguments[2]; this.x = _x$1; this.y = _y$1; this.w = _w; } else if (arguments.length === 4) { var p1$2 = arguments[0]; var p2$2 = arguments[1]; var q1 = arguments[2]; var q2 = arguments[3]; var px = p1$2.y - p2$2.y; var py = p2$2.x - p1$2.x; var pw = p1$2.x * p2$2.y - p2$2.x * p1$2.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; } }; HCoordinate.prototype.getY = function getY () { var a = this.y / this.w; if (Double.isNaN(a) || Double.isInfinite(a)) { throw new NotRepresentableException() } return a }; HCoordinate.prototype.getX = function getX () { var a = this.x / this.w; if (Double.isNaN(a) || Double.isInfinite(a)) { throw new NotRepresentableException() } return a }; HCoordinate.prototype.getCoordinate = function getCoordinate () { var p = new Coordinate(); p.x = this.getX(); p.y = this.getY(); return p }; HCoordinate.prototype.interfaces_ = function interfaces_ () { return [] }; HCoordinate.prototype.getClass = function getClass () { return HCoordinate }; HCoordinate.intersection = function intersection (p1, p2, q1, q2) { 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; var x = py * qw - qy * pw; var y = qx * pw - px * qw; var w = px * qy - qx * py; var xInt = x / w; var yInt = y / w; if (Double.isNaN(xInt) || (Double.isInfinite(xInt) || Double.isNaN(yInt)) || Double.isInfinite(yInt)) { throw new NotRepresentableException() } return new Coordinate(xInt, yInt) }; var Envelope = function Envelope () { this._minx = null; this._maxx = null; this._miny = null; this._maxy = null; if (arguments.length === 0) { this.init(); } else if (arguments.length === 1) { if (arguments[0] instanceof Coordinate) { var p = arguments[0]; this.init(p.x, p.x, p.y, p.y); } else if (arguments[0] instanceof Envelope) { var env = arguments[0]; this.init(env); } } else if (arguments.length === 2) { var p1 = arguments[0]; var p2 = arguments[1]; this.init(p1.x, p2.x, p1.y, p2.y); } else if (arguments.length === 4) { var x1 = arguments[0]; var x2 = arguments[1]; var y1 = arguments[2]; var y2 = arguments[3]; this.init(x1, x2, y1, y2); } }; var staticAccessors$9 = { serialVersionUID: { configurable: true } }; Envelope.prototype.getArea = function getArea () { return this.getWidth() * this.getHeight() }; Envelope.prototype.equals = function equals (other) { if (!(other instanceof Envelope)) { return false } var otherEnvelope = other; if (this.isNull()) { return otherEnvelope.isNull() } return this._maxx === otherEnvelope.getMaxX() && this._maxy === otherEnvelope.getMaxY() && this._minx === otherEnvelope.getMinX() && this._miny === otherEnvelope.getMinY() }; Envelope.prototype.intersection = function intersection (env) { if (this.isNull() || env.isNull() || !this.intersects(env)) { return new Envelope() } var intMinX = this._minx > env._minx ? this._minx : env._minx; var intMinY = this._miny > env._miny ? this._miny : env._miny; var intMaxX = this._maxx < env._maxx ? this._maxx : env._maxx; var intMaxY = this._maxy < env._maxy ? this._maxy : env._maxy; return new Envelope(intMinX, intMaxX, intMinY, intMaxY) }; Envelope.prototype.isNull = function isNull () { return this._maxx < this._minx }; Envelope.prototype.getMaxX = function getMaxX () { return this._maxx }; Envelope.prototype.covers = function covers () { if (arguments.length === 1) { if (arguments[0] instanceof Coordinate) { var p = arguments[0]; return this.covers(p.x, p.y) } else if (arguments[0] instanceof Envelope) { var other = arguments[0]; if (this.isNull() || other.isNull()) { return false } return other.getMinX() >= this._minx && other.getMaxX() <= this._maxx && other.getMinY() >= this._miny && other.getMaxY() <= this._maxy } } else if (arguments.length === 2) { var x = arguments[0]; var y = arguments[1]; if (this.isNull()) { return false } return x >= this._minx && x <= this._maxx && y >= this._miny && y <= this._maxy } }; Envelope.prototype.intersects = function intersects () { if (arguments.length === 1) { if (arguments[0] instanceof Envelope) { var other = arguments[0]; if (this.isNull() || other.isNull()) { return false } return !(other._minx > this._maxx || other._maxx < this._minx || other._miny > this._maxy || other._maxy < this._miny) } else if (arguments[0] instanceof Coordinate) { var p = arguments[0]; return this.intersects(p.x, p.y) } } else if (arguments.length === 2) { var x = arguments[0]; var y = arguments[1]; if (this.isNull()) { return false } return !(x > this._maxx || x < this._minx || y > this._maxy || y < this._miny) } }; Envelope.prototype.getMinY = function getMinY () { return this._miny }; Envelope.prototype.getMinX = function getMinX () { return this._minx }; Envelope.prototype.expandToInclude = function expandToInclude () { if (arguments.length === 1) { if (arguments[0] instanceof Coordinate) { var p = arguments[0]; this.expandToInclude(p.x, p.y); } else if (arguments[0] instanceof Envelope) { var other = arguments[0]; if (other.isNull()) { return null } if (this.isNull()) { this._minx = other.getMinX(); this._maxx = other.getMaxX(); this._miny = other.getMinY(); this._maxy = other.getMaxY(); } else { if (other._minx < this._minx) { this._minx = other._minx; } if (other._maxx > this._maxx) { this._maxx = other._maxx; } if (other._miny < this._miny) { this._miny = other._miny; } if (other._maxy > this._maxy) { this._maxy = other._maxy; } } } } else if (arguments.length === 2) { var x = arguments[0]; var y = arguments[1]; if (this.isNull()) { this._minx = x; this._maxx = x; this._miny = y; this._maxy = y; } else { if (x < this._minx) { this._minx = x; } if (x > this._maxx) { this._maxx = x; } if (y < this._miny) { this._miny = y; } if (y > this._maxy) { this._maxy = y; } } } }; Envelope.prototype.minExtent = function minExtent () { if (this.isNull()) { return 0.0 } var w = this.getWidth(); var h = this.getHeight(); if (w < h) { return w } return h }; Envelope.prototype.getWidth = function getWidth () { if (this.isNull()) { return 0 } return this._maxx - this._minx }; Envelope.prototype.compareTo = function compareTo (o) { var env = o; if (this.isNull()) { if (env.isNull()) { return 0 } return -1 } else { if (env.isNull()) { return 1 } } if (this._minx < env._minx) { return -1 } if (this._minx > env._minx) { return 1 } if (this._miny < env._miny) { return -1 } if (this._miny > env._miny) { return 1 } if (this._maxx < env._maxx) { return -1 } if (this._maxx > env._maxx) { return 1 } if (this._maxy < env._maxy) { return -1 } if (this._maxy > env._maxy) { return 1 } return 0 }; Envelope.prototype.translate = function translate (transX, transY) { if (this.isNull()) { return null } this.init(this.getMinX() + transX, this.getMaxX() + transX, this.getMinY() + transY, this.getMaxY() + transY); }; Envelope.prototype.toString = function toString () { return 'Env[' + this._minx + ' : ' + this._maxx + ', ' + this._miny + ' : ' + this._maxy + ']' }; Envelope.prototype.setToNull = function setToNull () { this._minx = 0; this._maxx = -1; this._miny = 0; this._maxy = -1; }; Envelope.prototype.getHeight = function getHeight () { if (this.isNull()) { return 0 } return this._maxy - this._miny }; Envelope.prototype.maxExtent = function maxExtent () { if (this.isNull()) { return 0.0 } var w = this.getWidth(); var h = this.getHeight(); if (w > h) { return w } return h }; Envelope.prototype.expandBy = function expandBy () { if (arguments.length === 1) { var distance = arguments[0]; this.expandBy(distance, distance); } else if (arguments.length === 2) { var deltaX = arguments[0]; var deltaY = arguments[1]; if (this.isNull()) { return null } this._minx -= deltaX; this._maxx += deltaX; this._miny -= deltaY; this._maxy += deltaY; if (this._minx > this._maxx || this._miny > this._maxy) { this.setToNull(); } } }; Envelope.prototype.contains = function contains () { if (arguments.length === 1) { if (arguments[0] instanceof Envelope) { var other = arguments[0]; return this.covers(other) } else if (arguments[0] instanceof Coordinate) { var p = arguments[0]; return this.covers(p) } } else if (arguments.length === 2) { var x = arguments[0]; var y = arguments[1]; return this.covers(x, y) } }; Envelope.prototype.centre = function centre () { if (this.isNull()) { return null } return new Coordinate((this.getMinX() + this.getMaxX()) / 2.0, (this.getMinY() + this.getMaxY()) / 2.0) }; Envelope.prototype.init = function init () { if (arguments.length === 0) { this.setToNull(); } else if (arguments.length === 1) { if (arguments[0] instanceof Coordinate) { var p = arguments[0]; this.init(p.x, p.x, p.y, p.y); } else if (arguments[0] instanceof Envelope) { var env = arguments[0]; this._minx = env._minx; this._maxx = env._maxx; this._miny = env._miny; this._maxy = env._maxy; } } else if (arguments.length === 2) { var p1 = arguments[0]; var p2 = arguments[1]; this.init(p1.x, p2.x, p1.y, p2.y); } else if (arguments.length === 4) { var x1 = arguments[0]; var x2 = arguments[1]; var y1 = arguments[2]; var y2 = arguments[3]; if (x1 < x2) { this._minx = x1; this._maxx = x2; } else { this._minx = x2; this._maxx = x1; } if (y1 < y2) { this._miny = y1; this._maxy = y2; } else { this._miny = y2; this._maxy = y1; } } }; Envelope.prototype.getMaxY = function getMaxY () { return this._maxy }; Envelope.prototype.distance = function distance (env) { if (this.intersect