diff --git a/module.json b/module.json index ed79767..c5fb7a3 100644 --- a/module.json +++ b/module.json @@ -7,7 +7,7 @@ "library": "false", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.9", - "compatibleCoreVersion": "0.8.9", + "compatibleCoreVersion": "9", "dependencies": [], "esmodules": ["./modules/dungeondraw-bundle.min.js"], "packs": [], diff --git a/modules/dungeondraw-bundle.min.js b/modules/dungeondraw-bundle.min.js index 38cc0a7..53e4291 100644 --- a/modules/dungeondraw-bundle.min.js +++ b/modules/dungeondraw-bundle.min.js @@ -5,5 +5,5 @@ const t="dungeon-draw",e=t=>{const e=t.split("."),i=e[0],r=e[1];if("custom"===i) * * pixi-filters is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license - */var Ir=function(t,e,n,i,r,s,o,l){var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function c(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var h=function(){return(h=Object.assign||function(t){for(var e,n=arguments,i=1,r=arguments.length;i 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n")||this;return n.gamma=1,n.saturation=1,n.contrast=1,n.brightness=1,n.red=1,n.green=1,n.blue=1,n.alpha=1,Object.assign(n,e),n}return c(e,t),e.prototype.apply=function(t,e,n,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,e,n,i)},e}(e.Filter),g=function(t){function e(e){void 0===e&&(e=.5);var n=t.call(this,u,"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n")||this;return n.threshold=e,n}return c(e,t),Object.defineProperty(e.prototype,"threshold",{get:function(){return this.uniforms.threshold},set:function(t){this.uniforms.threshold=t},enumerable:!1,configurable:!0}),e}(e.Filter),f=function(t){function e(e,i,r){void 0===e&&(e=4),void 0===i&&(i=3),void 0===r&&(r=!1);var s=t.call(this,u,r?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}")||this;return s._kernels=[],s._blur=4,s._quality=3,s.uniforms.uOffset=new Float32Array(2),s._pixelSize=new n.Point,s.pixelSize=1,s._clamp=r,Array.isArray(e)?s.kernels=e:(s._blur=e,s.quality=i),s}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s=this._pixelSize.x/e._frame.width,o=this._pixelSize.y/e._frame.height;if(1===this._quality||0===this._blur)r=this._kernels[0]+.5,this.uniforms.uOffset[0]=r*s,this.uniforms.uOffset[1]=r*o,t.applyFilter(this,e,n,i);else{for(var l=t.getFilterTexture(),a=e,c=l,h=void 0,u=this._quality-1,d=0;d0)for(var i=t,r=t/e,s=1;s0?(this._kernels=t,this._quality=t.length,this._blur=Math.max.apply(Math,t)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clamp",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._pixelSize},set:function(t){"number"==typeof t?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof n.Point?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur=t,this._generateKernels()},enumerable:!1,configurable:!0}),e}(e.Filter),p=function(t){function e(n){var r=t.call(this,u,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n")||this;r.bloomScale=1,r.brightness=1,r._resolution=i.settings.FILTER_RESOLUTION,"number"==typeof n&&(n={threshold:n});var s=Object.assign(e.defaults,n);r.bloomScale=s.bloomScale,r.brightness=s.brightness;var o=s.kernels,l=s.blur,a=s.quality,c=s.pixelSize,h=s.resolution;return r._extractFilter=new g(s.threshold),r._extractFilter.resolution=h,r._blurFilter=o?new f(o):new f(l,a),r.pixelSize=c,r.resolution=h,r}return c(e,t),e.prototype.apply=function(t,e,n,i,r){var s=t.getFilterTexture();this._extractFilter.apply(t,e,s,1,r);var o=t.getFilterTexture();this._blurFilter.apply(t,s,o,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=o,t.applyFilter(this,e,n,i),t.returnFilterTexture(o),t.returnFilterTexture(s)},Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._extractFilter.threshold},set:function(t){this._extractFilter.threshold=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),e.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:i.settings.FILTER_RESOLUTION},e}(e.Filter),m=function(t){function e(e){void 0===e&&(e=8);var n=t.call(this,u,"varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n")||this;return n.size=e,n}return c(e,t),Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.pixelSize},set:function(t){this.uniforms.pixelSize=t},enumerable:!1,configurable:!0}),e}(e.Filter),_=function(t){function e(e){var n=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n")||this;return n._thickness=2,n._angle=0,n.uniforms.lightColor=new Float32Array(3),n.uniforms.shadowColor=new Float32Array(3),Object.assign(n,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),n.padding=1,n}return c(e,t),e.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._angle/n.DEG_TO_RAD},set:function(t){this._angle=t*n.DEG_TO_RAD,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightColor",{get:function(){return r.rgb2hex(this.uniforms.lightColor)},set:function(t){r.hex2rgb(t,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightAlpha",{get:function(){return this.uniforms.lightAlpha},set:function(t){this.uniforms.lightAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return r.rgb2hex(this.uniforms.shadowColor)},set:function(t){r.hex2rgb(t,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowAlpha",{get:function(){return this.uniforms.shadowAlpha},set:function(t){this.uniforms.shadowAlpha=t},enumerable:!1,configurable:!0}),e}(e.Filter),y=function(t){function e(e,r,a,c){void 0===e&&(e=2),void 0===r&&(r=4),void 0===a&&(a=i.settings.FILTER_RESOLUTION),void 0===c&&(c=5);var h,u,d=t.call(this)||this;return"number"==typeof e?(h=e,u=e):e instanceof n.Point?(h=e.x,u=e.y):Array.isArray(e)&&(h=e[0],u=e[1]),d.blurXFilter=new l.BlurFilterPass(!0,h,r,a,c),d.blurYFilter=new l.BlurFilterPass(!1,u,r,a,c),d.blurYFilter.blendMode=s.BLEND_MODES.SCREEN,d.defaultFilter=new o.AlphaFilter,d}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=t.getFilterTexture();this.defaultFilter.apply(t,e,n,i),this.blurXFilter.apply(t,e,r,1),this.blurYFilter.apply(t,r,n,0),t.returnFilterTexture(r)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t},enumerable:!1,configurable:!0}),e}(e.Filter),x=function(t){function e(n){var i=t.call(this,u,"uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n")||this;return i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,n),i}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=e.filterFrame,s=r.width,o=r.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=o,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),e.defaults={center:[.5,.5],radius:100,strength:1},e}(e.Filter),I=function(t){function n(e,n,i){void 0===n&&(n=!1),void 0===i&&(i=1);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}")||this;return r.mix=1,r._size=0,r._sliceSize=0,r._slicePixelSize=0,r._sliceInnerSize=0,r._nearest=!1,r._scaleMode=null,r._colorMap=null,r._scaleMode=null,r.nearest=n,r.mix=i,r.colorMap=e,r}return c(n,t),n.prototype.apply=function(t,e,n,i){this.uniforms._mix=this.mix,t.applyFilter(this,e,n,i)},Object.defineProperty(n.prototype,"colorSize",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"colorMap",{get:function(){return this._colorMap},set:function(t){var n;t&&(t instanceof e.Texture||(t=e.Texture.from(t)),(null===(n=t)||void 0===n?void 0:n.baseTexture)&&(t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=s.MIPMAP_MODES.OFF,this._size=t.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=t),this._colorMap=t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nearest",{get:function(){return this._nearest},set:function(t){this._nearest=t,this._scaleMode=t?s.SCALE_MODES.NEAREST:s.SCALE_MODES.LINEAR;var e=this._colorMap;e&&e.baseTexture&&(e.baseTexture._glTextures={},e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=s.MIPMAP_MODES.OFF,e._updateID++,e.baseTexture.emit("update",e.baseTexture))},enumerable:!1,configurable:!0}),n.prototype.updateColorMap=function(){var t=this._colorMap;t&&t.baseTexture&&(t._updateID++,t.baseTexture.emit("update",t.baseTexture),this.colorMap=t)},n.prototype.destroy=function(e){void 0===e&&(e=!1),this._colorMap&&this._colorMap.destroy(e),t.prototype.destroy.call(this)},n}(e.Filter),E=function(t){function e(e,n){void 0===e&&(e=0),void 0===n&&(n=1);var i=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 color;\nuniform float alpha;\n\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a);\n}\n")||this;return i._color=0,i._alpha=1,i.uniforms.color=new Float32Array(3),i.color=e,i.alpha=n,i}return c(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var e=this.uniforms.color;"number"==typeof t?(r.hex2rgb(t,e),this._color=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._color=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this.uniforms.alpha=t,this._alpha=t},enumerable:!1,configurable:!0}),e}(e.Filter),C=function(t){function e(e,n,i){void 0===e&&(e=16711680),void 0===n&&(n=0),void 0===i&&(i=.4);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n")||this;return r._originalColor=16711680,r._newColor=0,r.uniforms.originalColor=new Float32Array(3),r.uniforms.newColor=new Float32Array(3),r.originalColor=e,r.newColor=n,r.epsilon=i,r}return c(e,t),Object.defineProperty(e.prototype,"originalColor",{get:function(){return this._originalColor},set:function(t){var e=this.uniforms.originalColor;"number"==typeof t?(r.hex2rgb(t,e),this._originalColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._originalColor=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"newColor",{get:function(){return this._newColor},set:function(t){var e=this.uniforms.newColor;"number"==typeof t?(r.hex2rgb(t,e),this._newColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._newColor=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"epsilon",{get:function(){return this.uniforms.epsilon},set:function(t){this.uniforms.epsilon=t},enumerable:!1,configurable:!0}),e}(e.Filter),S=function(t){function e(e,n,i){void 0===n&&(n=200),void 0===i&&(i=200);var r=t.call(this,u,"precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n")||this;return r.uniforms.texelSize=new Float32Array(2),r.uniforms.matrix=new Float32Array(9),void 0!==e&&(r.matrix=e),r.width=n,r.height=i,r}return c(e,t),Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.matrix},set:function(t){var e=this;t.forEach((function(t,n){e.uniforms.matrix[n]=t}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(t){this.uniforms.texelSize[0]=1/t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(t){this.uniforms.texelSize[1]=1/t},enumerable:!1,configurable:!0}),e}(e.Filter),T=function(t){function e(){return t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")||this}return c(e,t),e}(e.Filter),w=function(t){function e(n){var i=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 dir = vec2(vTextureCoord.xy - vec2(0.5, 0.5)) * filterArea.xy / dimensions;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0)\n {\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n")||this;return i.time=0,i.seed=0,i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,n),i}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=e.filterFrame,s=r.width,o=r.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=o,this.uniforms.seed=this.seed,this.uniforms.time=this.time,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"curvature",{get:function(){return this.uniforms.curvature},set:function(t){this.uniforms.curvature=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.uniforms.lineWidth},set:function(t){this.uniforms.lineWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineContrast",{get:function(){return this.uniforms.lineContrast},set:function(t){this.uniforms.lineContrast=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalLine",{get:function(){return this.uniforms.verticalLine},set:function(t){this.uniforms.verticalLine=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e}(e.Filter),N=function(t){function e(e,n){void 0===e&&(e=1),void 0===n&&(n=5);var i=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n")||this;return i.scale=e,i.angle=n,i}return c(e,t),Object.defineProperty(e.prototype,"scale",{get:function(){return this.uniforms.scale},set:function(t){this.uniforms.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e}(e.Filter),b=function(t){function s(r){var o=t.call(this)||this;o.angle=45,o._distance=5,o._resolution=i.settings.FILTER_RESOLUTION;var l=r?h(h({},s.defaults),r):s.defaults,a=l.kernels,c=l.blur,d=l.quality,g=l.pixelSize,p=l.resolution;o._tintFilter=new e.Filter(u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Premultiply alpha\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),o._tintFilter.uniforms.color=new Float32Array(4),o._tintFilter.uniforms.shift=new n.Point,o._tintFilter.resolution=p,o._blurFilter=a?new f(a):new f(c,d),o.pixelSize=g,o.resolution=p;var m=l.shadowOnly,_=l.rotation,y=l.distance,x=l.alpha,I=l.color;return o.shadowOnly=m,o.rotation=_,o.distance=y,o.alpha=x,o.color=I,o._updatePadding(),o}return c(s,t),s.prototype.apply=function(t,e,n,i){var r=t.getFilterTexture();this._tintFilter.apply(t,e,r,1),this._blurFilter.apply(t,r,n,i),!0!==this.shadowOnly&&t.applyFilter(this,e,n,0),t.returnFilterTexture(r)},s.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},s.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},Object.defineProperty(s.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._tintFilter&&(this._tintFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance=t,this._updatePadding(),this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"rotation",{get:function(){return this.angle/n.DEG_TO_RAD},set:function(t){this.angle=t*n.DEG_TO_RAD,this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"alpha",{get:function(){return this._tintFilter.uniforms.alpha},set:function(t){this._tintFilter.uniforms.alpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"color",{get:function(){return r.rgb2hex(this._tintFilter.uniforms.color)},set:function(t){r.hex2rgb(t,this._tintFilter.uniforms.color)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t,this._updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),s.defaults={rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:i.settings.FILTER_RESOLUTION},s}(e.Filter),v=function(t){function e(e){void 0===e&&(e=5);var n=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n")||this;return n.strength=e,n}return c(e,t),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),e}(e.Filter),O=function(t){function i(n){var r=t.call(this,u,"// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n")||this;return r.offset=100,r.fillMode=i.TRANSPARENT,r.average=!1,r.seed=0,r.minSize=8,r.sampleSize=512,r._slices=0,r._offsets=new Float32Array(1),r._sizes=new Float32Array(1),r._direction=-1,r.uniforms.dimensions=new Float32Array(2),r._canvas=document.createElement("canvas"),r._canvas.width=4,r._canvas.height=r.sampleSize,r.texture=e.Texture.from(r._canvas,{scaleMode:s.SCALE_MODES.NEAREST}),Object.assign(r,i.defaults,n),r}return c(i,t),i.prototype.apply=function(t,e,n,i){var r=e.filterFrame,s=r.width,o=r.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/s,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,t.applyFilter(this,e,n,i)},i.prototype._randomizeSizes=function(){var t=this._sizes,e=this._slices-1,n=this.sampleSize,i=Math.min(this.minSize/n,.9/this._slices);if(this.average){for(var r=this._slices,s=1,o=0;o0;e--){var n=Math.random()*e>>0,i=t[e];t[e]=t[n],t[n]=i}},i.prototype._randomizeOffsets=function(){for(var t=0;t0?t:0,a=t<0?-t:0;i.fillStyle="rgba("+l+", "+a+", 0, 1)",i.fillRect(0,r>>0,e,o+1>>0),r+=o}n.baseTexture.update(),this.uniforms.displacementMap=n},Object.defineProperty(i.prototype,"sizes",{get:function(){return this._sizes},set:function(t){for(var e=Math.min(this._slices,t.length),n=0;n>0)},Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(t){this.uniforms.uOffset=t},enumerable:!1,configurable:!0}),e}(e.Filter),P=function(t){function e(e,n,i){void 0===n&&(n=.05),void 0===i&&(i=e.length);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float epsilon;\n\nconst int MAX_COLORS = %maxColors%;\n\nuniform vec3 originalColors[MAX_COLORS];\nuniform vec3 targetColors[MAX_COLORS];\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n float alpha = gl_FragColor.a;\n if (alpha < 0.0001)\n {\n return;\n }\n\n vec3 color = gl_FragColor.rgb / alpha;\n\n for(int i = 0; i < MAX_COLORS; i++)\n {\n vec3 origColor = originalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n vec3 colorDiff = origColor - color;\n if (length(colorDiff) < epsilon)\n {\n vec3 targetColor = targetColors[i];\n gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\n return;\n }\n }\n}\n".replace(/%maxColors%/g,i.toFixed(0)))||this;return r._replacements=[],r._maxColors=0,r.epsilon=n,r._maxColors=i,r.uniforms.originalColors=new Float32Array(3*i),r.uniforms.targetColors=new Float32Array(3*i),r.replacements=e,r}return c(e,t),Object.defineProperty(e.prototype,"replacements",{get:function(){return this._replacements},set:function(t){var e=this.uniforms.originalColors,n=this.uniforms.targetColors,i=t.length;if(i>this._maxColors)throw new Error("Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")");e[3*i]=-1;for(var s=0;s 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n")||this;return r.seed=0,r.uniforms.dimensions=new Float32Array(2),"number"==typeof n?(r.seed=n,n=void 0):r.seed=i,Object.assign(r,e.defaults,n),r}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s;this.uniforms.dimensions[0]=null===(r=e.filterFrame)||void 0===r?void 0:r.width,this.uniforms.dimensions[1]=null===(s=e.filterFrame)||void 0===s?void 0:s.height,this.uniforms.seed=this.seed,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"sepia",{get:function(){return this.uniforms.sepia},set:function(t){this.uniforms.sepia=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratch",{get:function(){return this.uniforms.scratch},set:function(t){this.uniforms.scratch=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchDensity",{get:function(){return this.uniforms.scratchDensity},set:function(t){this.uniforms.scratchDensity=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchWidth",{get:function(){return this.uniforms.scratchWidth},set:function(t){this.uniforms.scratchWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e}(e.Filter),F=function(t){function e(n,i,r){void 0===n&&(n=1),void 0===i&&(i=0),void 0===r&&(r=.1);var s=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,e.getAngleStep(r)))||this;return s._thickness=1,s.uniforms.thickness=new Float32Array([0,0]),s.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(s,{thickness:n,color:i,quality:r}),s}return c(e,t),e.getAngleStep=function(t){var n=Math.max(t*e.MAX_SAMPLES,e.MIN_SAMPLES);return(2*Math.PI/n).toFixed(7)},e.prototype.apply=function(t,e,n,i){this.uniforms.thickness[0]=this._thickness/e._frame.width,this.uniforms.thickness[1]=this._thickness/e._frame.height,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"color",{get:function(){return r.rgb2hex(this.uniforms.outlineColor)},set:function(t){r.hex2rgb(t,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this.padding=t},enumerable:!1,configurable:!0}),e.MIN_SAMPLES=1,e.MAX_SAMPLES=100,e}(e.Filter),M=function(t){function e(e){void 0===e&&(e=10);var n=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n")||this;return n.size=e,n}return c(e,t),Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.size},set:function(t){"number"==typeof t&&(t=[t,t]),this.uniforms.size=t},enumerable:!1,configurable:!0}),e}(e.Filter),G=function(t){function e(e,n,i,r){void 0===e&&(e=0),void 0===n&&(n=[0,0]),void 0===i&&(i=5),void 0===r&&(r=-1);var s=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n")||this;return s._angle=0,s.angle=e,s.center=n,s.kernelSize=i,s.radius=r,s}return c(e,t),e.prototype.apply=function(t,e,n,i){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.uniforms.uRadian=t*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e}(e.Filter),k=function(t){function e(n){var i=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n")||this;return i.time=0,i.uniforms.amplitude=new Float32Array(2),i.uniforms.waveLength=new Float32Array(2),i.uniforms.alpha=new Float32Array(2),i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,n),i}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s;this.uniforms.dimensions[0]=null===(r=e.filterFrame)||void 0===r?void 0:r.width,this.uniforms.dimensions[1]=null===(s=e.filterFrame)||void 0===s?void 0:s.height,this.uniforms.time=this.time,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"mirror",{get:function(){return this.uniforms.mirror},set:function(t){this.uniforms.mirror=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this.uniforms.boundary},set:function(t){this.uniforms.boundary=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude[0]=t[0],this.uniforms.amplitude[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"waveLength",{get:function(){return this.uniforms.waveLength},set:function(t){this.uniforms.waveLength[0]=t[0],this.uniforms.waveLength[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.alpha},set:function(t){this.uniforms.alpha[0]=t[0],this.uniforms.alpha[1]=t[1]},enumerable:!1,configurable:!0}),e.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e}(e.Filter),z=function(t){function e(e,n,i){void 0===e&&(e=[-10,0]),void 0===n&&(n=[0,10]),void 0===i&&(i=[0,0]);var r=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n")||this;return r.red=e,r.green=n,r.blue=i,r}return c(e,t),Object.defineProperty(e.prototype,"red",{get:function(){return this.uniforms.red},set:function(t){this.uniforms.red=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.uniforms.green},set:function(t){this.uniforms.green=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.uniforms.blue},set:function(t){this.uniforms.blue=t},enumerable:!1,configurable:!0}),e}(e.Filter),B=function(t){function e(n,i,r){void 0===n&&(n=[0,0]),void 0===r&&(r=0);var s=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n")||this;return s.center=n,Object.assign(s,e.defaults,i),s.time=r,s}return c(e,t),e.prototype.apply=function(t,e,n,i){this.uniforms.time=this.time,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wavelength",{get:function(){return this.uniforms.wavelength},set:function(t){this.uniforms.wavelength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"brightness",{get:function(){return this.uniforms.brightness},set:function(t){this.uniforms.brightness=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this.uniforms.speed},set:function(t){this.uniforms.speed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),e.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},e}(e.Filter),q=function(t){function e(e,n,i){void 0===n&&(n=0),void 0===i&&(i=1);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n")||this;return r._color=0,r.uniforms.dimensions=new Float32Array(2),r.uniforms.ambientColor=new Float32Array([0,0,0,i]),r.texture=e,r.color=n,r}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s;this.uniforms.dimensions[0]=null===(r=e.filterFrame)||void 0===r?void 0:r.width,this.uniforms.dimensions[1]=null===(s=e.filterFrame)||void 0===s?void 0:s.height,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uLightmap},set:function(t){this.uniforms.uLightmap=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var e=this.uniforms.ambientColor;"number"==typeof t?(r.hex2rgb(t,e),this._color=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._color=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.ambientColor[3]},set:function(t){this.uniforms.ambientColor[3]=t},enumerable:!1,configurable:!0}),e}(e.Filter),Y=function(t){function e(e,i,r,s){void 0===e&&(e=100),void 0===i&&(i=600);var o=t.call(this,u,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n")||this;return o.uniforms.blur=e,o.uniforms.gradientBlur=i,o.uniforms.start=r||new n.Point(0,window.innerHeight/2),o.uniforms.end=s||new n.Point(600,window.innerHeight/2),o.uniforms.delta=new n.Point(30,30),o.uniforms.texSize=new n.Point(window.innerWidth,window.innerHeight),o.updateDelta(),o}return c(e,t),e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(e.prototype,"blur",{get:function(){return this.uniforms.blur},set:function(t){this.uniforms.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.uniforms.gradientBlur},set:function(t){this.uniforms.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.uniforms.start},set:function(t){this.uniforms.start=t,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.uniforms.end},set:function(t){this.uniforms.end=t,this.updateDelta()},enumerable:!1,configurable:!0}),e}(e.Filter),X=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,n=Math.sqrt(t*t+e*e);this.uniforms.delta.x=t/n,this.uniforms.delta.y=e/n},e}(Y),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,n=Math.sqrt(t*t+e*e);this.uniforms.delta.x=-e/n,this.uniforms.delta.y=t/n},e}(Y),U=function(t){function e(e,n,i,r){void 0===e&&(e=100),void 0===n&&(n=600);var s=t.call(this)||this;return s.tiltShiftXFilter=new X(e,n,i,r),s.tiltShiftYFilter=new j(e,n,i,r),s}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=t.getFilterTexture();this.tiltShiftXFilter.apply(t,e,r,1),this.tiltShiftYFilter.apply(t,r,n,i),t.returnFilterTexture(r)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},enumerable:!1,configurable:!0}),e}(e.Filter),V=function(t){function e(n){var i=t.call(this,u,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n")||this;return Object.assign(i,e.defaults,n),i}return c(e,t),Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.offset},set:function(t){this.uniforms.offset=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e.defaults={radius:200,angle:4,padding:20,offset:new n.Point},e}(e.Filter),W=function(t){function e(n){var i,r=Object.assign(e.defaults,n),s=r.maxKernelSize,o=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n".replace("${maxKernelSize}",s.toFixed(1)))||this,Object.assign(i,o),i}return c(e,t),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.uStrength},set:function(t){this.uniforms.uStrength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this.uniforms.uInnerRadius},set:function(t){this.uniforms.uInnerRadius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},e}(e.Filter);return t.AdjustmentFilter=d,t.AdvancedBloomFilter=p,t.AsciiFilter=m,t.BevelFilter=_,t.BloomFilter=y,t.BulgePinchFilter=x,t.CRTFilter=w,t.ColorMapFilter=I,t.ColorOverlayFilter=E,t.ColorReplaceFilter=C,t.ConvolutionFilter=S,t.CrossHatchFilter=T,t.DotFilter=N,t.DropShadowFilter=b,t.EmbossFilter=v,t.GlitchFilter=O,t.GlowFilter=R,t.GodrayFilter=L,t.KawaseBlurFilter=f,t.MotionBlurFilter=D,t.MultiColorReplaceFilter=P,t.OldFilmFilter=A,t.OutlineFilter=F,t.PixelateFilter=M,t.RGBSplitFilter=z,t.RadialBlurFilter=G,t.ReflectionFilter=k,t.ShockwaveFilter=B,t.SimpleLightmapFilter=q,t.TiltShiftAxisFilter=Y,t.TiltShiftFilter=U,t.TiltShiftXFilter=X,t.TiltShiftYFilter=j,t.TwistFilter=V,t.ZoomBlurFilter=W,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters);Object.assign(PIXI.filters,Ir);const Er=async(t,n)=>{for(let i of n.themeAreas){const r=e(i.themeKey);if(!r){console.log(`No such ${i.themeType} theme: ${i.themeKey}`);continue}const s=n.clone();s.config=r.config,s.config.doorColor=n.config.doorColor,s.config.doorFillColor=n.config.doorFillColor,s.config.doorFillOpacity=n.config.doorFillOpacity,s.config.doorThickness=n.config.doorThickness,s.config.wallColor=n.config.wallColor,s.config.wallThickness=n.config.wallThickness,s.config.exteriorShadowOpacity=0;const o=new PIXI.Container,l=new PIXI.Graphics;l.beginFill(16777215,1),l.drawPolygon(i.points.flat()),l.endFill(),o.mask=l;const a=gr(i.points);await Cr(o,s,{clipPoly:a}),t.addChild(l),t.addChild(o)}},Cr=async(t,e,n={})=>{const i=new PIXI.Graphics,r=new PIXI.Graphics,s=new PIXI.Graphics;if(e.geometry){Nr(t,e.config,e.geometry);const o=new PIXI.Graphics;Rr(o,e.geometry),t.addChild(o),r.mask=o;const l=new PIXI.filters.AlphaFilter(e.config.interiorShadowOpacity),a=new PIXI.filters.BlurFilter;r.filters=[l,a],e.config.floorTexture&&await vr(t,o,e.config.floorTexture,e.config.floorTextureTint,e.geometry,n.clipPoly),Pr(i,r,s,e.config,e.geometry)}const o=new PIXI.Graphics,l=JSON.parse(JSON.stringify(e.config));l.wallColor="#000000";for(let t of e.interiorWalls)Mr(r,e.config,t),e.config.wallTexture?Fr(o,l,t):Fr(s,e.config,t);for(let t of e.doors)zr(r,e.config,t),Gr(s,o,e.config,t);for(let t of e.secretDoors)Mr(r,e.config,t),kr(s,o,e.config,t);if(t.addChild(i),t.addChild(r),e.config.wallTexture){Dr(o,e.geometry,e.config.wallThickness),t.addChild(o);const i=ar(e.geometry,e.config.wallThickness/2);await vr(t,o,e.config.wallTexture,e.config.wallTextureTint,i,n.clipPoly)}t.addChild(s)},Sr=async t=>{try{return await loadTexture(t)}catch(t){console.log(t)}},Tr=async(t,e)=>{if(e.backgroundImage){const n=await Sr(e.backgroundImage);if(n?.valid){const e=canvas.dimensions,i=new PIXI.Sprite(n);i.position.set(e.paddingX-e.shiftX,e.paddingY-e.shiftY),i.width=e.sceneWidth,i.height=e.sceneHeight,wr(i),t.addChild(i)}}},wr=t=>{const e=t.texture.baseTexture.resource.source;e&&"VIDEO"===e.tagName&&(e.loop=!0,e.volume=game.settings.get("core","globalAmbientVolume"),game.video.play(e))},Nr=(t,e,n)=>{if(e.exteriorShadowThickness&&e.exteriorShadowOpacity&&n)for(let i=0;i{const i=new PIXI.Graphics,r=ar(n,e.exteriorShadowThickness);i.beginFill(PIXI.utils.string2hex(e.exteriorShadowColor),e.exteriorShadowOpacity),i.drawPolygon(r.getCoordinates().map((t=>[t.x,t.y])).flat()),i.endFill();const s=new PIXI.filters.BlurFilter;i.filters=[s],t.addChild(i)},vr=async(t,e,n,i,r,s)=>{const o=await Sr(n);if(!o?.valid)return;const l=o.width,a=canvas.scene.data.height*(1+2*canvas.scene.data.padding),c=canvas.scene.data.width*(1+2*canvas.scene.data.padding),h=Math.ceil(a/l),u=Math.ceil(c/l),d=new PIXI.Container;for(let t=0;t{const n=e.getExteriorRing().getCoordinates().map((t=>[t.x,t.y])).flat();t.beginFill(16777215,1),t.drawPolygon(n),t.endFill();const i=e.getNumInteriorRing();for(let n=0;n[t.x,t.y])).flat();t.lineStyle(0,0,1,1,.5),t.beginHole(),t.drawPolygon(i),t.endHole()}},Rr=(t,e)=>{for(let n=0;n{const i=e.getExteriorRing().getCoordinates().map((t=>[t.x,t.y])).flat();t.lineStyle(n,PIXI.utils.string2hex("#000000"),1,.5),t.drawPolygon(i);const r=e.getNumInteriorRing();for(let i=0;i[t.x,t.y])).flat();t.lineStyle(n,PIXI.utils.string2hex("#000000"),1),t.drawPolygon(r)}},Dr=(t,e,n)=>{for(let i=0;i{for(let s=0;s{const s=r.getExteriorRing().getCoordinates().map((t=>[t.x,t.y])).flat();i.floorTexture||(t.beginFill(PIXI.utils.string2hex(i.floorColor),1),t.drawPolygon(s),t.endFill());const o=r.getNumInteriorRing();for(let e=0;e[t.x,t.y])).flat();t.lineStyle(0,0,1,1,.5),t.beginHole(),t.drawPolygon(n),t.endHole()}i.interiorShadowOpacity&&(e.lineStyle({width:i.wallThickness+i.interiorShadowThickness,color:PIXI.utils.string2hex(i.interiorShadowColor),alignment:.5,join:"round"}),e.drawPolygon(s)),i.wallTexture||(n.lineStyle(i.wallThickness,PIXI.utils.string2hex(i.wallColor),1,.5),n.drawPolygon(s));for(let t=0;t[t.x,t.y])).flat();e.drawPolygon(s),i.wallTexture||(n.lineStyle(i.wallThickness,PIXI.utils.string2hex(i.wallColor),1),n.drawPolygon(s))}},Fr=(t,e,n)=>{t.lineStyle({width:e.wallThickness,color:PIXI.utils.string2hex(e.wallColor),alpha:1,alignment:.5,cap:"round"}),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3])},Mr=(t,e,n)=>{t.lineStyle({width:e.wallThickness+e.interiorShadowThickness,color:PIXI.utils.string2hex(e.interiorShadowColor),alignment:.5,join:"round",cap:"round"}),t.moveTo(n[2],n[3]),t.lineTo(n[0],n[1])},Gr=(t,e,n,i)=>{const r=fr(i[0],i[1],i[2],i[3]),s=20/r,o=s+(r-40)/r,l=i[2]-i[0],a=i[3]-i[1],c=[i[0]+l*s,i[1]+a*s],h=[i[0]+l*o,i[1]+a*o],u=yr(n.doorThickness,c[0],c[1],h[0],h[1]),d=n.wallTexture?"#000000":n.wallColor;t.lineStyle({width:n.wallThickness,color:PIXI.utils.string2hex(d),alpha:1,alignment:.5,cap:"round"}),n.wallTexture?(e.moveTo(i[0],i[1]),e.lineTo(c[0],c[1]),e.moveTo(h[0],h[1]),e.lineTo(i[2],i[3])):(t.moveTo(i[0],i[1]),t.lineTo(c[0],c[1]),t.moveTo(h[0],h[1]),t.lineTo(i[2],i[3])),n.doorFillOpacity&&t.beginFill(PIXI.utils.string2hex(n.doorFillColor),n.doorFillOpacity),t.lineStyle(n.doorLineThickness,PIXI.utils.string2hex(n.doorColor),1,.5),t.drawPolygon(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[0],u[1]),n.doorFillColor&&t.endFill()},kr=(t,e,n,i)=>{const r=game.user.isGM;if(r&&"door"===n.secretDoorStyleGM||!r&&"door"===n.secretDoorStylePlayer)return void Gr(t,e,n,i);const s=fr(i[0],i[1],i[2],i[3]),o=(s-40)/2/s,l=o+40/s,a=i[2]-i[0],c=i[3]-i[1],h=[i[0]+a*o,i[1]+c*o],u=[i[0]+.5*a,i[1]+.5*c],d=[i[0]+a*l,i[1]+c*l],g=yr(30,h[0],h[1],d[0],d[1]),f=n.wallTexture?"#000000":n.wallColor;if(t.lineStyle({width:n.wallThickness,color:PIXI.utils.string2hex(f),alpha:1,alignment:.5,cap:"round"}),n.wallTexture?(e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3])):(t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3])),r&&"secret"===n.secretDoorStyleGM||!r&&"secret"===n.secretDoorStylePlayer){const e=yr(50,h[0],h[1],u[0],u[1]),i=yr(50,u[0],u[1],d[0],d[1]);t.lineStyle({width:5,color:PIXI.utils.string2hex(n.secretDoorSColor),alpha:1,alignment:.5,cap:"round"}),t.moveTo(g[6],g[7]),t.bezierCurveTo(e[0],e[1],e[2],e[3],u[0],u[1]),t.bezierCurveTo(i[6],i[7],i[4],i[5],g[2],g[3])}},zr=(t,e,n)=>{const i=fr(n[0],n[1],n[2],n[3]),r=20/i,s=r+(i-40)/i,o=n[2]-n[0],l=n[3]-n[1],a=[n[0]+o*r,n[1]+l*r],c=[n[0]+o*s,n[1]+l*s],h=yr(e.doorThickness,a[0],a[1],c[0],c[1]);t.lineStyle({width:e.wallThickness+e.interiorShadowThickness,color:PIXI.utils.string2hex(e.interiorShadowColor),alignment:.5,join:"round"}),t.moveTo(n[2],n[3]),t.lineTo(c[0],c[1]),t.moveTo(a[0],a[1]),t.lineTo(n[0],n[1]),t.lineStyle({width:e.doorLineThickness+e.interiorShadowThickness,color:PIXI.utils.string2hex(e.interiorShadowColor),alignment:.5,join:"round"}),t.drawPolygon(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[0],h[1])};class Br extends PlaceableObject{constructor(t,e){super(e),this.journalEntry=t,this.history=[xr.startState()],this.historyIndex=0}static embeddedName="Drawing";deleteAll(){const t=this.state(),e=xr.startState();e.config=t.config,this.history=[e],this.historyIndex=0,this.history[this.historyIndex].saveToJournalEntry(this.journalEntry),this.refresh()}state(){return this.history[this.historyIndex]}draw(){return this.refresh(),this}refresh(){(async(t,e)=>{t.clear(),await Tr(t,e.config),await Cr(t,e),await Er(t,e)})(this,this.state())}async maybeRefresh(t){if(t.id===this.journalEntry.id){const t=await xr.loadFromJournalEntry(this.journalEntry);await this.pushState(t,!1)}}async loadFromJournalEntry(){const t=await xr.loadFromJournalEntry(this.journalEntry);this.history=[t],this.historyIndex=0,await this.refresh()}async undo(){this.historyIndex=Math.max(0,this.historyIndex-1),await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry),await this.refresh()}async redo(){this.historyIndex=Math.min(this.history.length-1,this.historyIndex+1),await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry),await this.refresh()}async pushState(t,e=!0){for(let t=this.history.length-1;t>this.historyIndex;t--)this.history.pop();this.history.push(t),this.historyIndex++,e&&await t.saveToJournalEntry(this.journalEntry),await this.refresh()}async setConfig(t){const e=this.state().clone();e.config=t,await this.pushState(e)}async addDoor(t,e,n,i){await this._addDoor(t,e,n,i,"doors")}async addSecretDoor(t,e,n,i){await this._addDoor(t,e,n,i,"secretDoors")}async _addDoor(t,e,n,i,r){const s=this.history[this.historyIndex].clone(),o=dr(t,e,n,i),l=[],a=[];for(let r of s.interiorWalls){const s=dr(r[0],r[1],r[2],r[3]);if(lr(s,o)){l.push(r);const s=mr(r[0],r[1],r[2],r[3]),o=_r(r[0],r[1],r[2],r[3]),c=mr(t,e,n,i),h=_r(t,e,n,i);a.push([s[0],s[1],c[0],c[1]]),a.push([h[0],h[1],o[0],o[1]])}}s.interiorWalls=s.interiorWalls.filter((t=>-1===l.indexOf(t))),s.interiorWalls=s.interiorWalls.concat(a),s[r].push([t,e,n,i]),await this.pushState(s)}async subtractDoors(t){const e=hr(t),n=this.history[this.historyIndex].doors.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)}));if(n.length!=this.history[this.historyIndex].doors.length){const t=this.history[this.historyIndex].clone();t.doors=n,await this.pushState(t)}}_maybeSplitWall(t,e,n,i,r){const s=dr(t,e,n,i);for(let o of r){const r=dr(o[0],o[1],o[2],o[3]);if(lr(s,r)){const r=mr(t,e,n,i),s=_r(t,e,n,i),l=mr(o[0],o[1],o[2],o[3]),a=_r(o[0],o[1],o[2],o[3]);return[[r[0],r[1],l[0],l[1]],[a[0],a[1],s[0],s[1]]]}}return[[t,e,n,i]]}async addInteriorWall(t,e,n,i){const r=this.history[this.historyIndex].clone(),s=this._maybeSplitWall(t,e,n,i,r.doors);r.interiorWalls=r.interiorWalls.concat(s),await this.pushState(r)}async subtractInteriorWalls(t){const e=hr(t),n=this.history[this.historyIndex].interiorWalls.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)}));if(n.length!=this.history[this.historyIndex].interiorWalls.length){const t=this.history[this.historyIndex].clone();t.interiorWalls=n,await this.pushState(t)}}async subtractDoorsAndInteriorWalls(t){const e=hr(t),n=this.history[this.historyIndex],i=n.doors.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)})),r=n.secretDoors.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)})),s=n.interiorWalls.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)}));if(i.length!=n.doors.length||r.length!=n.secretDoors.length||s.length!=n.interiorWalls.length){const t=n.clone();t.doors=i,t.secretDoors=r,t.interiorWalls=s,await this.pushState(t)}}async _addPoly(t){const e=this.history[this.historyIndex],n=e.clone();if(n.geometry){n.geometry=(i=n.geometry,r=t,rr.union(i,r));if(or(e.geometry,t)){const i=((t,e)=>Xi.intersection(t,e))(e.geometry,t),r=i.getCoordinates();if(r.length>1&&r.length%2==0)for(let t=0;t{const n=dr(e[0],e[1],e[2],e[3]);return!sr(t,n)}));e.length!=n.interiorWalls.length&&(n.interiorWalls=e)}}else n.geometry=t;var i,r;await this.pushState(n)}async addRectangle(t){const e=hr(t);this._addPoly(e)}async subtractRectangle(t){if(!this.history[this.historyIndex].geometry)return;const e=hr(t);if(!sr(this.history[this.historyIndex].geometry,e))return;const n=this.history[this.historyIndex].clone();var i,r;n.geometry=(i=n.geometry,r=e,Xi.difference(i,r)),await this.pushState(n)}async addPolygon(t){try{const e=gr(t);await this._addPoly(e)}catch(t){console.log(t)}}async addThemeArea(t){try{gr(t)}catch(t){return void console.log(t)}const e={points:t,themeKey:r()},n=this.history[this.historyIndex].clone();n.themeAreas.push(e),await this.pushState(n)}async removeThemeAreas(t){const e=hr(t),n=this.history[this.historyIndex].themeAreas.filter((t=>{try{const n=gr(t.points);return!sr(e,n)}catch(t){return console.log(t),!1}}));if(n.length!=this.history[this.historyIndex].themeAreas.length){const t=this.history[this.historyIndex].clone();t.themeAreas=n,await this.pushState(t)}}}const qr=async()=>{let t=game.folders.filter((t=>"JournalEntry"===t.data.type&&"Dungeon Draw"===t.name)).pop();t||(t=await Folder.create({name:"Dungeon Draw",type:"JournalEntry"}));return await JournalEntry.create({name:canvas.scene.name,folder:t.id,flags:{"dungeon-draw":{dungeonVersion:"1.0"}}})},Yr=async t=>{await canvas.scene.createEmbeddedDocuments("Note",[{entryId:t.id,fontSize:20,icon:"icons/svg/cave.svg",iconSize:32,textAnchor:1,textColor:"#FFFFFF",x:50,y:50,iconTint:"",text:"Dungeon Draw",flags:{}}])};class Xr extends PlaceablesLayer{static LAYER_NAME="dungeon";constructor(){super(),this.dungeonContainer=null,this.dungeon=null}static get layerOptions(){return foundry.utils.mergeObject(super.layerOptions,{name:Xr.LAYER_NAME,canDragCreate:!0,zIndex:-1})}static documentName="Drawing";_getNewDrawingData(t){const e=game.activeTool,n={fillColor:game.user.color,strokeColor:game.user.color,strokeWidth:8};switch(n.x=t.x,n.y=t.y,n.author=game.user.id,e){case"addrect":case"subtractdoor":case"subtractrect":case"themeeraser":n.type=CONST.DRAWING_TYPES.RECTANGLE,n.points=[];break;case"adddoor":case"addpoly":case"addsecretdoor":case"addwall":case"themepainter":n.type=CONST.DRAWING_TYPES.POLYGON,n.points=[[0,0]];break;case"ellipse":n.type=CONST.DRAWING_TYPES.ELLIPSE,n.points=[]}return n}async deleteAll(){const t=this.constructor.documentName;if(!game.user.isGM)throw new Error(`You do not have permission to delete ${t} objects from the Scene.`);return Dialog.confirm({title:game.i18n.localize("CONTROLS.ClearAll"),content:`

${game.i18n.format("CONTROLS.ClearAllHint",{type:t})}

`,yes:()=>this._deleteAll()})}async _deleteAll(){this.dungeon?.deleteAll()}async loadDungeon(){const{journalEntry:e,note:n}=await(()=>{for(const e of canvas.scene.notes){const n=game.journal.get(e.data.entryId);if(n&&n.getFlag(t,"dungeonVersion"))return{journalEntry:n,note:e}}return{journalEntry:null,note:null}})();e?(this.dungeon=new Br(e,n),await this.dungeon.loadFromJournalEntry(),this.addChildAt(this.dungeon,0)):this.dungeon=null}async createNewDungeon(){await(async()=>{const t=await qr();return{journalEntry:t,note:await Yr(t)}})(),await this.loadDungeon()}async draw(){return await super.draw(),this}async _onClickLeft(t){const{preview:e,createState:n,originalEvent:i}=t.data;if(n>=1&&e.isPolygon){let n=t.data.destination;return i.shiftKey||(n=canvas.grid.getSnappedPosition(n.x,n.y,this.gridPrecision)),e._addPoint(n,!1),e._chain=!0,e.refresh()}await super._onClickLeft(t)}_onClickLeft2(t){const{createState:e,preview:n}=t.data;if(e>=1&&n.isPolygon)return t.data.createState=2,this._onDragLeftDrop(t);super._onClickLeft2(t)}async _onDragLeftStart(t){await super._onDragLeftStart(t);const e=this._getNewDrawingData(t.data.origin),n=new DrawingDocument(e,{parent:canvas.scene}),i=new Drawing(n);return t.data.preview=this.preview.addChild(i),i.draw()}_onDragLeftMove(t){const{preview:e,createState:n}=t.data;e&&(null===e.parent&&this.preview.addChild(e),n>=1&&(e._onMouseDraw(t),e.data.type===CONST.DRAWING_TYPES.POLYGON&&"adddoor"!==game.activeTool&&"addsecretdoor"!==game.activeTool&&"addwall"!==game.activeTool||(t.data.createState=2)))}async _onDragLeftDrop(t){const{createState:e,destination:n,origin:i,preview:r}=t.data;if(2===e){this.dungeon||await this.createNewDungeon();const e=Math.hypot(n.x-i.x,n.y-i.y)>=canvas.dimensions.size/8,s=r.isPolygon&&r.data.points.length>2;if("adddoor"===game.activeTool){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1,await this.dungeon.addDoor(e.x,e.y,e.x+e.points[1][0],e.y+e.points[1][1])}if("addsecretdoor"===game.activeTool){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1,await this.dungeon.addSecretDoor(e.x,e.y,e.x+e.points[1][0],e.y+e.points[1][1])}else if("addwall"===game.activeTool){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1,await this.dungeon.addInteriorWall(e.x,e.y,e.x+e.points[1][0],e.y+e.points[1][1])}else if(e||s){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1;const n=this.constructor.placeableClass.normalizeShape(e);if("addpoly"===game.activeTool){const t=n.points.length;t>2&&(n.points[0][0]!==n.points[t-1][0]||n.points[0][1]!==n.points[t-1][1])&&n.points.push(n.points[0]);const e=n.points.map((t=>[t[0]+n.x,t[1]+n.y]));await this.dungeon.addPolygon(e)}else if("addrect"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.addRectangle(t)}else if("subtractdoor"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.subtractDoorsAndInteriorWalls(t)}else if("themeeraser"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.removeThemeAreas(t)}else if("themepainter"===game.activeTool){const t=n.points.length;t>2&&(n.points[0][0]!==n.points[t-1][0]||n.points[0][1]!==n.points[t-1][1])&&n.points.push(n.points[0]);const e=n.points.map((t=>[t[0]+n.x,t[1]+n.y]));await this.dungeon.addThemeArea(e)}else if("subtractrect"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.subtractRectangle(t)}}return this._onDragLeftCancel(t)}if(1===e&&r.isPolygon){if(t.data.originalEvent.preventDefault(),r._chain)return;return this._onClickLeft(t)}return this._onDragLeftCancel(t)}}class jr{static init(){console.log("***** DUNGEON DRAW *****"),game.settings.register(t,"releaseNotesVersion",{name:"Last version we showed release notes.",scope:"client",default:"",type:String,config:!1}),game.settings.register(t,"customThemes",{name:"Custom themes.",scope:"client",default:"{}",type:String,config:!1}),game.settings.register(t,"themePainterTheme",{name:"Theme painter theme key.",scope:"client",default:"module.cavern",type:String,config:!1})}static ready(){jr.maybeShowReleaseNotes()}static async maybeShowReleaseNotes(){if(!game.user.isGM)return;const e=game.modules.get(t).data.version;if(e===game.settings.get(t,"releaseNotesVersion"))return;const n=await fetch("modules/dungeon-draw/CHANGELOG.md"),i="#"+(await n.text()).split("#")[1],r=await renderTemplate("modules/dungeon-draw/templates/release-notes.html",{data:{version:e,changelog:i}});new Dialog({title:game.i18n.localize("DD.ReleaseNotes"),content:r,buttons:{roll:{icon:'',label:"OK"}}},{width:600}).render(!0),await game.settings.set(t,"releaseNotesVersion",e)}static getSceneControlButtons(t){CONFIG.Canvas.layers.dungeon=Xr,CONFIG.Dungeon={layerClass:Xr},t.push({name:"dungeondraw",title:"DD.SceneControlTitle",layer:Xr.LAYER_NAME,icon:"fas fa-dungeon",visible:game.user.isTrusted,tools:[{name:"addrect",title:"DD.ButtonTitleAddRect",icon:"fas fa-plus-square"},{name:"subtractrect",title:"DD.ButtonTitleSubtractRect",icon:"fas fa-minus-square"},{name:"addpoly",title:"DD.ButtonTitleAddPoly",icon:"fas fa-draw-polygon"},{name:"addwall",title:"DD.ButtonTitleAddWall",icon:"fas fa-bars"},{name:"adddoor",title:"DD.ButtonTitleAddDoor",icon:"fas fa-door-open"},{name:"addsecretdoor",title:"DD.ButtonTitleAddSecretDoor",icon:"fas fa-mask"},{name:"subtractdoor",title:"DD.ButtonTitleSubtractDoorsAndWalls",icon:"fas fa-window-close"},{name:"themepainter",title:"DD.ButtonTitleThemePainter",icon:"fas fa-brush"},{name:"themeeraser",title:"DD.ButtonTitleThemeEraser",icon:"fas fa-eraser"},{name:"undo",title:"DD.ButtonTitleUndo",icon:"fas fa-undo",onClick:async()=>{await canvas.dungeon.dungeon.undo()},button:!0},{name:"redo",title:"DD.ButtonTitleRedo",icon:"fas fa-redo",onClick:async()=>{await canvas.dungeon.dungeon.redo()},button:!0},{name:"config",title:"DD.ButtonTitleConfig",icon:"fas fa-cog",onClick:()=>(new l).render(!0),button:!0},{name:"clear",title:"DD.ButtonTitleClear",icon:"fas fa-trash",visible:!0,onClick:()=>canvas.dungeon.deleteAll(),button:!0}],activeTool:"addrect"})}static async canvasReady(t){await t.dungeon.loadDungeon()}static async updateJournalEntry(t,e,n,i){game.user.id!==i&&await(canvas.dungeon.dungeon?.maybeRefresh(t))}}Hooks.on("init",jr.init),Hooks.on("ready",jr.ready),Hooks.on("getSceneControlButtons",jr.getSceneControlButtons),Hooks.on("canvasReady",jr.canvasReady),Hooks.on("updateJournalEntry",jr.updateJournalEntry);export{jr as DungeonDraw}; + */var Ir=function(t,e,n,i,r,s,o,l){var a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function c(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var h=function(){return(h=Object.assign||function(t){for(var e,n=arguments,i=1,r=arguments.length;i 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n")||this;return n.gamma=1,n.saturation=1,n.contrast=1,n.brightness=1,n.red=1,n.green=1,n.blue=1,n.alpha=1,Object.assign(n,e),n}return c(e,t),e.prototype.apply=function(t,e,n,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,e,n,i)},e}(e.Filter),g=function(t){function e(e){void 0===e&&(e=.5);var n=t.call(this,u,"\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n")||this;return n.threshold=e,n}return c(e,t),Object.defineProperty(e.prototype,"threshold",{get:function(){return this.uniforms.threshold},set:function(t){this.uniforms.threshold=t},enumerable:!1,configurable:!0}),e}(e.Filter),f=function(t){function e(e,i,r){void 0===e&&(e=4),void 0===i&&(i=3),void 0===r&&(r=!1);var s=t.call(this,u,r?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}")||this;return s._kernels=[],s._blur=4,s._quality=3,s.uniforms.uOffset=new Float32Array(2),s._pixelSize=new n.Point,s.pixelSize=1,s._clamp=r,Array.isArray(e)?s.kernels=e:(s._blur=e,s.quality=i),s}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s=this._pixelSize.x/e._frame.width,o=this._pixelSize.y/e._frame.height;if(1===this._quality||0===this._blur)r=this._kernels[0]+.5,this.uniforms.uOffset[0]=r*s,this.uniforms.uOffset[1]=r*o,t.applyFilter(this,e,n,i);else{for(var l=t.getFilterTexture(),a=e,c=l,h=void 0,u=this._quality-1,d=0;d0)for(var i=t,r=t/e,s=1;s0?(this._kernels=t,this._quality=t.length,this._blur=Math.max.apply(Math,t)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clamp",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._pixelSize},set:function(t){"number"==typeof t?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof n.Point?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur=t,this._generateKernels()},enumerable:!1,configurable:!0}),e}(e.Filter),p=function(t){function e(n){var r=t.call(this,u,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n")||this;r.bloomScale=1,r.brightness=1,r._resolution=i.settings.FILTER_RESOLUTION,"number"==typeof n&&(n={threshold:n});var s=Object.assign(e.defaults,n);r.bloomScale=s.bloomScale,r.brightness=s.brightness;var o=s.kernels,l=s.blur,a=s.quality,c=s.pixelSize,h=s.resolution;return r._extractFilter=new g(s.threshold),r._extractFilter.resolution=h,r._blurFilter=o?new f(o):new f(l,a),r.pixelSize=c,r.resolution=h,r}return c(e,t),e.prototype.apply=function(t,e,n,i,r){var s=t.getFilterTexture();this._extractFilter.apply(t,e,s,1,r);var o=t.getFilterTexture();this._blurFilter.apply(t,s,o,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=o,t.applyFilter(this,e,n,i),t.returnFilterTexture(o),t.returnFilterTexture(s)},Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._extractFilter.threshold},set:function(t){this._extractFilter.threshold=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),e.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:i.settings.FILTER_RESOLUTION},e}(e.Filter),m=function(t){function e(e){void 0===e&&(e=8);var n=t.call(this,u,"varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n")||this;return n.size=e,n}return c(e,t),Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.pixelSize},set:function(t){this.uniforms.pixelSize=t},enumerable:!1,configurable:!0}),e}(e.Filter),_=function(t){function e(e){var n=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n")||this;return n._thickness=2,n._angle=0,n.uniforms.lightColor=new Float32Array(3),n.uniforms.shadowColor=new Float32Array(3),Object.assign(n,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),n.padding=1,n}return c(e,t),e.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._angle/n.DEG_TO_RAD},set:function(t){this._angle=t*n.DEG_TO_RAD,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightColor",{get:function(){return r.rgb2hex(this.uniforms.lightColor)},set:function(t){r.hex2rgb(t,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightAlpha",{get:function(){return this.uniforms.lightAlpha},set:function(t){this.uniforms.lightAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return r.rgb2hex(this.uniforms.shadowColor)},set:function(t){r.hex2rgb(t,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowAlpha",{get:function(){return this.uniforms.shadowAlpha},set:function(t){this.uniforms.shadowAlpha=t},enumerable:!1,configurable:!0}),e}(e.Filter),y=function(t){function e(e,r,a,c){void 0===e&&(e=2),void 0===r&&(r=4),void 0===a&&(a=i.settings.FILTER_RESOLUTION),void 0===c&&(c=5);var h,u,d=t.call(this)||this;return"number"==typeof e?(h=e,u=e):e instanceof n.Point?(h=e.x,u=e.y):Array.isArray(e)&&(h=e[0],u=e[1]),d.blurXFilter=new l.BlurFilterPass(!0,h,r,a,c),d.blurYFilter=new l.BlurFilterPass(!1,u,r,a,c),d.blurYFilter.blendMode=s.BLEND_MODES.SCREEN,d.defaultFilter=new o.AlphaFilter,d}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=t.getFilterTexture();this.defaultFilter.apply(t,e,n,i),this.blurXFilter.apply(t,e,r,1),this.blurYFilter.apply(t,r,n,0),t.returnFilterTexture(r)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t},enumerable:!1,configurable:!0}),e}(e.Filter),x=function(t){function e(n){var i=t.call(this,u,"uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n")||this;return i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,n),i}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=e.filterFrame,s=r.width,o=r.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=o,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),e.defaults={center:[.5,.5],radius:100,strength:1},e}(e.Filter),I=function(t){function n(e,n,i){void 0===n&&(n=!1),void 0===i&&(i=1);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}")||this;return r.mix=1,r._size=0,r._sliceSize=0,r._slicePixelSize=0,r._sliceInnerSize=0,r._nearest=!1,r._scaleMode=null,r._colorMap=null,r._scaleMode=null,r.nearest=n,r.mix=i,r.colorMap=e,r}return c(n,t),n.prototype.apply=function(t,e,n,i){this.uniforms._mix=this.mix,t.applyFilter(this,e,n,i)},Object.defineProperty(n.prototype,"colorSize",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"colorMap",{get:function(){return this._colorMap},set:function(t){var n;t&&(t instanceof e.Texture||(t=e.Texture.from(t)),(null===(n=t)||void 0===n?void 0:n.baseTexture)&&(t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=s.MIPMAP_MODES.OFF,this._size=t.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=t),this._colorMap=t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nearest",{get:function(){return this._nearest},set:function(t){this._nearest=t,this._scaleMode=t?s.SCALE_MODES.NEAREST:s.SCALE_MODES.LINEAR;var e=this._colorMap;e&&e.baseTexture&&(e.baseTexture._glTextures={},e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=s.MIPMAP_MODES.OFF,e._updateID++,e.baseTexture.emit("update",e.baseTexture))},enumerable:!1,configurable:!0}),n.prototype.updateColorMap=function(){var t=this._colorMap;t&&t.baseTexture&&(t._updateID++,t.baseTexture.emit("update",t.baseTexture),this.colorMap=t)},n.prototype.destroy=function(e){void 0===e&&(e=!1),this._colorMap&&this._colorMap.destroy(e),t.prototype.destroy.call(this)},n}(e.Filter),E=function(t){function e(e,n){void 0===e&&(e=0),void 0===n&&(n=1);var i=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 color;\nuniform float alpha;\n\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a);\n}\n")||this;return i._color=0,i._alpha=1,i.uniforms.color=new Float32Array(3),i.color=e,i.alpha=n,i}return c(e,t),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var e=this.uniforms.color;"number"==typeof t?(r.hex2rgb(t,e),this._color=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._color=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this.uniforms.alpha=t,this._alpha=t},enumerable:!1,configurable:!0}),e}(e.Filter),C=function(t){function e(e,n,i){void 0===e&&(e=16711680),void 0===n&&(n=0),void 0===i&&(i=.4);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n")||this;return r._originalColor=16711680,r._newColor=0,r.uniforms.originalColor=new Float32Array(3),r.uniforms.newColor=new Float32Array(3),r.originalColor=e,r.newColor=n,r.epsilon=i,r}return c(e,t),Object.defineProperty(e.prototype,"originalColor",{get:function(){return this._originalColor},set:function(t){var e=this.uniforms.originalColor;"number"==typeof t?(r.hex2rgb(t,e),this._originalColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._originalColor=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"newColor",{get:function(){return this._newColor},set:function(t){var e=this.uniforms.newColor;"number"==typeof t?(r.hex2rgb(t,e),this._newColor=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],this._newColor=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"epsilon",{get:function(){return this.uniforms.epsilon},set:function(t){this.uniforms.epsilon=t},enumerable:!1,configurable:!0}),e}(e.Filter),S=function(t){function e(e,n,i){void 0===n&&(n=200),void 0===i&&(i=200);var r=t.call(this,u,"precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n")||this;return r.uniforms.texelSize=new Float32Array(2),r.uniforms.matrix=new Float32Array(9),void 0!==e&&(r.matrix=e),r.width=n,r.height=i,r}return c(e,t),Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.matrix},set:function(t){var e=this;t.forEach((function(t,n){e.uniforms.matrix[n]=t}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(t){this.uniforms.texelSize[0]=1/t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(t){this.uniforms.texelSize[1]=1/t},enumerable:!1,configurable:!0}),e}(e.Filter),T=function(t){function e(){return t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")||this}return c(e,t),e}(e.Filter),w=function(t){function e(n){var i=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 dir = vec2(vTextureCoord.xy - vec2(0.5, 0.5)) * filterArea.xy / dimensions;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0)\n {\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n")||this;return i.time=0,i.seed=0,i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,n),i}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=e.filterFrame,s=r.width,o=r.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=o,this.uniforms.seed=this.seed,this.uniforms.time=this.time,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"curvature",{get:function(){return this.uniforms.curvature},set:function(t){this.uniforms.curvature=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.uniforms.lineWidth},set:function(t){this.uniforms.lineWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineContrast",{get:function(){return this.uniforms.lineContrast},set:function(t){this.uniforms.lineContrast=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalLine",{get:function(){return this.uniforms.verticalLine},set:function(t){this.uniforms.verticalLine=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e}(e.Filter),N=function(t){function e(e,n){void 0===e&&(e=1),void 0===n&&(n=5);var i=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n")||this;return i.scale=e,i.angle=n,i}return c(e,t),Object.defineProperty(e.prototype,"scale",{get:function(){return this.uniforms.scale},set:function(t){this.uniforms.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e}(e.Filter),b=function(t){function s(r){var o=t.call(this)||this;o.angle=45,o._distance=5,o._resolution=i.settings.FILTER_RESOLUTION;var l=r?h(h({},s.defaults),r):s.defaults,a=l.kernels,c=l.blur,d=l.quality,g=l.pixelSize,p=l.resolution;o._tintFilter=new e.Filter(u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Premultiply alpha\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),o._tintFilter.uniforms.color=new Float32Array(4),o._tintFilter.uniforms.shift=new n.Point,o._tintFilter.resolution=p,o._blurFilter=a?new f(a):new f(c,d),o.pixelSize=g,o.resolution=p;var m=l.shadowOnly,_=l.rotation,y=l.distance,x=l.alpha,I=l.color;return o.shadowOnly=m,o.rotation=_,o.distance=y,o.alpha=x,o.color=I,o._updatePadding(),o}return c(s,t),s.prototype.apply=function(t,e,n,i){var r=t.getFilterTexture();this._tintFilter.apply(t,e,r,1),this._blurFilter.apply(t,r,n,i),!0!==this.shadowOnly&&t.applyFilter(this,e,n,0),t.returnFilterTexture(r)},s.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},s.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},Object.defineProperty(s.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._tintFilter&&(this._tintFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance=t,this._updatePadding(),this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"rotation",{get:function(){return this.angle/n.DEG_TO_RAD},set:function(t){this.angle=t*n.DEG_TO_RAD,this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"alpha",{get:function(){return this._tintFilter.uniforms.alpha},set:function(t){this._tintFilter.uniforms.alpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"color",{get:function(){return r.rgb2hex(this._tintFilter.uniforms.color)},set:function(t){r.hex2rgb(t,this._tintFilter.uniforms.color)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t,this._updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),s.defaults={rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:i.settings.FILTER_RESOLUTION},s}(e.Filter),v=function(t){function e(e){void 0===e&&(e=5);var n=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n")||this;return n.strength=e,n}return c(e,t),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),e}(e.Filter),O=function(t){function i(n){var r=t.call(this,u,"// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n")||this;return r.offset=100,r.fillMode=i.TRANSPARENT,r.average=!1,r.seed=0,r.minSize=8,r.sampleSize=512,r._slices=0,r._offsets=new Float32Array(1),r._sizes=new Float32Array(1),r._direction=-1,r.uniforms.dimensions=new Float32Array(2),r._canvas=document.createElement("canvas"),r._canvas.width=4,r._canvas.height=r.sampleSize,r.texture=e.Texture.from(r._canvas,{scaleMode:s.SCALE_MODES.NEAREST}),Object.assign(r,i.defaults,n),r}return c(i,t),i.prototype.apply=function(t,e,n,i){var r=e.filterFrame,s=r.width,o=r.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/s,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,t.applyFilter(this,e,n,i)},i.prototype._randomizeSizes=function(){var t=this._sizes,e=this._slices-1,n=this.sampleSize,i=Math.min(this.minSize/n,.9/this._slices);if(this.average){for(var r=this._slices,s=1,o=0;o0;e--){var n=Math.random()*e>>0,i=t[e];t[e]=t[n],t[n]=i}},i.prototype._randomizeOffsets=function(){for(var t=0;t0?t:0,a=t<0?-t:0;i.fillStyle="rgba("+l+", "+a+", 0, 1)",i.fillRect(0,r>>0,e,o+1>>0),r+=o}n.baseTexture.update(),this.uniforms.displacementMap=n},Object.defineProperty(i.prototype,"sizes",{get:function(){return this._sizes},set:function(t){for(var e=Math.min(this._slices,t.length),n=0;n>0)},Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(t){this.uniforms.uOffset=t},enumerable:!1,configurable:!0}),e}(e.Filter),P=function(t){function e(e,n,i){void 0===n&&(n=.05),void 0===i&&(i=e.length);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float epsilon;\n\nconst int MAX_COLORS = %maxColors%;\n\nuniform vec3 originalColors[MAX_COLORS];\nuniform vec3 targetColors[MAX_COLORS];\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n\n float alpha = gl_FragColor.a;\n if (alpha < 0.0001)\n {\n return;\n }\n\n vec3 color = gl_FragColor.rgb / alpha;\n\n for(int i = 0; i < MAX_COLORS; i++)\n {\n vec3 origColor = originalColors[i];\n if (origColor.r < 0.0)\n {\n break;\n }\n vec3 colorDiff = origColor - color;\n if (length(colorDiff) < epsilon)\n {\n vec3 targetColor = targetColors[i];\n gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\n return;\n }\n }\n}\n".replace(/%maxColors%/g,i.toFixed(0)))||this;return r._replacements=[],r._maxColors=0,r.epsilon=n,r._maxColors=i,r.uniforms.originalColors=new Float32Array(3*i),r.uniforms.targetColors=new Float32Array(3*i),r.replacements=e,r}return c(e,t),Object.defineProperty(e.prototype,"replacements",{get:function(){return this._replacements},set:function(t){var e=this.uniforms.originalColors,n=this.uniforms.targetColors,i=t.length;if(i>this._maxColors)throw new Error("Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")");e[3*i]=-1;for(var s=0;s 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n")||this;return r.seed=0,r.uniforms.dimensions=new Float32Array(2),"number"==typeof n?(r.seed=n,n=void 0):r.seed=i,Object.assign(r,e.defaults,n),r}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s;this.uniforms.dimensions[0]=null===(r=e.filterFrame)||void 0===r?void 0:r.width,this.uniforms.dimensions[1]=null===(s=e.filterFrame)||void 0===s?void 0:s.height,this.uniforms.seed=this.seed,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"sepia",{get:function(){return this.uniforms.sepia},set:function(t){this.uniforms.sepia=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratch",{get:function(){return this.uniforms.scratch},set:function(t){this.uniforms.scratch=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchDensity",{get:function(){return this.uniforms.scratchDensity},set:function(t){this.uniforms.scratchDensity=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchWidth",{get:function(){return this.uniforms.scratchWidth},set:function(t){this.uniforms.scratchWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e}(e.Filter),F=function(t){function e(n,i,r){void 0===n&&(n=1),void 0===i&&(i=0),void 0===r&&(r=.1);var s=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,e.getAngleStep(r)))||this;return s._thickness=1,s.uniforms.thickness=new Float32Array([0,0]),s.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(s,{thickness:n,color:i,quality:r}),s}return c(e,t),e.getAngleStep=function(t){var n=Math.max(t*e.MAX_SAMPLES,e.MIN_SAMPLES);return(2*Math.PI/n).toFixed(7)},e.prototype.apply=function(t,e,n,i){this.uniforms.thickness[0]=this._thickness/e._frame.width,this.uniforms.thickness[1]=this._thickness/e._frame.height,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"color",{get:function(){return r.rgb2hex(this.uniforms.outlineColor)},set:function(t){r.hex2rgb(t,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this.padding=t},enumerable:!1,configurable:!0}),e.MIN_SAMPLES=1,e.MAX_SAMPLES=100,e}(e.Filter),M=function(t){function e(e){void 0===e&&(e=10);var n=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n")||this;return n.size=e,n}return c(e,t),Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.size},set:function(t){"number"==typeof t&&(t=[t,t]),this.uniforms.size=t},enumerable:!1,configurable:!0}),e}(e.Filter),G=function(t){function e(e,n,i,r){void 0===e&&(e=0),void 0===n&&(n=[0,0]),void 0===i&&(i=5),void 0===r&&(r=-1);var s=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n")||this;return s._angle=0,s.angle=e,s.center=n,s.kernelSize=i,s.radius=r,s}return c(e,t),e.prototype.apply=function(t,e,n,i){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.uniforms.uRadian=t*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e}(e.Filter),k=function(t){function e(n){var i=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n")||this;return i.time=0,i.uniforms.amplitude=new Float32Array(2),i.uniforms.waveLength=new Float32Array(2),i.uniforms.alpha=new Float32Array(2),i.uniforms.dimensions=new Float32Array(2),Object.assign(i,e.defaults,n),i}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s;this.uniforms.dimensions[0]=null===(r=e.filterFrame)||void 0===r?void 0:r.width,this.uniforms.dimensions[1]=null===(s=e.filterFrame)||void 0===s?void 0:s.height,this.uniforms.time=this.time,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"mirror",{get:function(){return this.uniforms.mirror},set:function(t){this.uniforms.mirror=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this.uniforms.boundary},set:function(t){this.uniforms.boundary=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude[0]=t[0],this.uniforms.amplitude[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"waveLength",{get:function(){return this.uniforms.waveLength},set:function(t){this.uniforms.waveLength[0]=t[0],this.uniforms.waveLength[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.alpha},set:function(t){this.uniforms.alpha[0]=t[0],this.uniforms.alpha[1]=t[1]},enumerable:!1,configurable:!0}),e.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e}(e.Filter),z=function(t){function e(e,n,i){void 0===e&&(e=[-10,0]),void 0===n&&(n=[0,10]),void 0===i&&(i=[0,0]);var r=t.call(this,u,"precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n")||this;return r.red=e,r.green=n,r.blue=i,r}return c(e,t),Object.defineProperty(e.prototype,"red",{get:function(){return this.uniforms.red},set:function(t){this.uniforms.red=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.uniforms.green},set:function(t){this.uniforms.green=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.uniforms.blue},set:function(t){this.uniforms.blue=t},enumerable:!1,configurable:!0}),e}(e.Filter),B=function(t){function e(n,i,r){void 0===n&&(n=[0,0]),void 0===r&&(r=0);var s=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n")||this;return s.center=n,Object.assign(s,e.defaults,i),s.time=r,s}return c(e,t),e.prototype.apply=function(t,e,n,i){this.uniforms.time=this.time,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wavelength",{get:function(){return this.uniforms.wavelength},set:function(t){this.uniforms.wavelength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"brightness",{get:function(){return this.uniforms.brightness},set:function(t){this.uniforms.brightness=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this.uniforms.speed},set:function(t){this.uniforms.speed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),e.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},e}(e.Filter),q=function(t){function e(e,n,i){void 0===n&&(n=0),void 0===i&&(i=1);var r=t.call(this,u,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n")||this;return r._color=0,r.uniforms.dimensions=new Float32Array(2),r.uniforms.ambientColor=new Float32Array([0,0,0,i]),r.texture=e,r.color=n,r}return c(e,t),e.prototype.apply=function(t,e,n,i){var r,s;this.uniforms.dimensions[0]=null===(r=e.filterFrame)||void 0===r?void 0:r.width,this.uniforms.dimensions[1]=null===(s=e.filterFrame)||void 0===s?void 0:s.height,t.applyFilter(this,e,n,i)},Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uLightmap},set:function(t){this.uniforms.uLightmap=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var e=this.uniforms.ambientColor;"number"==typeof t?(r.hex2rgb(t,e),this._color=t):(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._color=r.rgb2hex(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.ambientColor[3]},set:function(t){this.uniforms.ambientColor[3]=t},enumerable:!1,configurable:!0}),e}(e.Filter),Y=function(t){function e(e,i,r,s){void 0===e&&(e=100),void 0===i&&(i=600);var o=t.call(this,u,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n")||this;return o.uniforms.blur=e,o.uniforms.gradientBlur=i,o.uniforms.start=r||new n.Point(0,window.innerHeight/2),o.uniforms.end=s||new n.Point(600,window.innerHeight/2),o.uniforms.delta=new n.Point(30,30),o.uniforms.texSize=new n.Point(window.innerWidth,window.innerHeight),o.updateDelta(),o}return c(e,t),e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(e.prototype,"blur",{get:function(){return this.uniforms.blur},set:function(t){this.uniforms.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.uniforms.gradientBlur},set:function(t){this.uniforms.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.uniforms.start},set:function(t){this.uniforms.start=t,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.uniforms.end},set:function(t){this.uniforms.end=t,this.updateDelta()},enumerable:!1,configurable:!0}),e}(e.Filter),X=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,n=Math.sqrt(t*t+e*e);this.uniforms.delta.x=t/n,this.uniforms.delta.y=e/n},e}(Y),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,n=Math.sqrt(t*t+e*e);this.uniforms.delta.x=-e/n,this.uniforms.delta.y=t/n},e}(Y),U=function(t){function e(e,n,i,r){void 0===e&&(e=100),void 0===n&&(n=600);var s=t.call(this)||this;return s.tiltShiftXFilter=new X(e,n,i,r),s.tiltShiftYFilter=new j(e,n,i,r),s}return c(e,t),e.prototype.apply=function(t,e,n,i){var r=t.getFilterTexture();this.tiltShiftXFilter.apply(t,e,r,1),this.tiltShiftYFilter.apply(t,r,n,i),t.returnFilterTexture(r)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},enumerable:!1,configurable:!0}),e}(e.Filter),V=function(t){function e(n){var i=t.call(this,u,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n")||this;return Object.assign(i,e.defaults,n),i}return c(e,t),Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.offset},set:function(t){this.uniforms.offset=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e.defaults={radius:200,angle:4,padding:20,offset:new n.Point},e}(e.Filter),W=function(t){function e(n){var i,r=Object.assign(e.defaults,n),s=r.maxKernelSize,o=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n".replace("${maxKernelSize}",s.toFixed(1)))||this,Object.assign(i,o),i}return c(e,t),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.uStrength},set:function(t){this.uniforms.uStrength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this.uniforms.uInnerRadius},set:function(t){this.uniforms.uInnerRadius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},e}(e.Filter);return t.AdjustmentFilter=d,t.AdvancedBloomFilter=p,t.AsciiFilter=m,t.BevelFilter=_,t.BloomFilter=y,t.BulgePinchFilter=x,t.CRTFilter=w,t.ColorMapFilter=I,t.ColorOverlayFilter=E,t.ColorReplaceFilter=C,t.ConvolutionFilter=S,t.CrossHatchFilter=T,t.DotFilter=N,t.DropShadowFilter=b,t.EmbossFilter=v,t.GlitchFilter=O,t.GlowFilter=R,t.GodrayFilter=L,t.KawaseBlurFilter=f,t.MotionBlurFilter=D,t.MultiColorReplaceFilter=P,t.OldFilmFilter=A,t.OutlineFilter=F,t.PixelateFilter=M,t.RGBSplitFilter=z,t.RadialBlurFilter=G,t.ReflectionFilter=k,t.ShockwaveFilter=B,t.SimpleLightmapFilter=q,t.TiltShiftAxisFilter=Y,t.TiltShiftFilter=U,t.TiltShiftXFilter=X,t.TiltShiftYFilter=j,t.TwistFilter=V,t.ZoomBlurFilter=W,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters);Object.assign(PIXI.filters,Ir);const Er=async(t,n)=>{for(let i of n.themeAreas){const r=e(i.themeKey);if(!r){console.log(`No such ${i.themeType} theme: ${i.themeKey}`);continue}const s=n.clone();s.config=r.config,s.config.doorColor=n.config.doorColor,s.config.doorFillColor=n.config.doorFillColor,s.config.doorFillOpacity=n.config.doorFillOpacity,s.config.doorThickness=n.config.doorThickness,s.config.wallColor=n.config.wallColor,s.config.wallThickness=n.config.wallThickness,s.config.exteriorShadowOpacity=0;const o=new PIXI.Container,l=new PIXI.Graphics;l.beginFill(16777215,1),l.drawPolygon(i.points.flat()),l.endFill(),o.mask=l;const a=gr(i.points);await Cr(o,s,{clipPoly:a}),t.addChild(l),t.addChild(o)}},Cr=async(t,e,n={})=>{if(!e.geometry)return;const i=new PIXI.Graphics,r=new PIXI.Graphics,s=new PIXI.Graphics;Nr(t,e.config,e.geometry);const o=new PIXI.Graphics;Rr(o,e.geometry),t.addChild(o),r.mask=o;const l=new PIXI.filters.AlphaFilter(e.config.interiorShadowOpacity),a=new PIXI.filters.BlurFilter;r.filters=[l,a],e.config.floorTexture&&await vr(t,o,e.config.floorTexture,e.config.floorTextureTint,e.geometry,n.clipPoly),Pr(i,r,s,e.config,e.geometry);const c=new PIXI.Graphics,h=JSON.parse(JSON.stringify(e.config));h.wallColor="#000000";for(let t of e.interiorWalls)Mr(r,e.config,t),e.config.wallTexture?Fr(c,h,t):Fr(s,e.config,t);for(let t of e.doors)zr(r,e.config,t),Gr(s,c,e.config,t);for(let t of e.secretDoors)Mr(r,e.config,t),kr(s,c,e.config,t);if(t.addChild(i),t.addChild(r),e.config.wallTexture){Dr(c,e.geometry,e.config.wallThickness),t.addChild(c);const i=ar(e.geometry,e.config.wallThickness/2);await vr(t,c,e.config.wallTexture,e.config.wallTextureTint,i,n.clipPoly)}t.addChild(s)},Sr=async t=>{try{return await loadTexture(t)}catch(t){console.log(t)}},Tr=async(t,e)=>{if(e.backgroundImage){const n=await Sr(e.backgroundImage);if(n?.valid){const e=canvas.dimensions,i=new PIXI.Sprite(n);i.position.set(e.paddingX-e.shiftX,e.paddingY-e.shiftY),i.width=e.sceneWidth,i.height=e.sceneHeight,wr(i),t.addChild(i)}}},wr=t=>{const e=t.texture.baseTexture.resource.source;e&&"VIDEO"===e.tagName&&(e.loop=!0,e.volume=game.settings.get("core","globalAmbientVolume"),game.video.play(e))},Nr=(t,e,n)=>{if(e.exteriorShadowThickness&&e.exteriorShadowOpacity&&n)for(let i=0;i{const i=new PIXI.Graphics,r=ar(n,e.exteriorShadowThickness);i.beginFill(PIXI.utils.string2hex(e.exteriorShadowColor),e.exteriorShadowOpacity),i.drawPolygon(r.getCoordinates().map((t=>[t.x,t.y])).flat()),i.endFill();const s=new PIXI.filters.BlurFilter;i.filters=[s],t.addChild(i)},vr=async(t,e,n,i,r,s)=>{const o=await Sr(n);if(!o?.valid)return;const l=o.width,a=canvas.scene.data.height*(1+2*canvas.scene.data.padding),c=canvas.scene.data.width*(1+2*canvas.scene.data.padding),h=Math.ceil(a/l),u=Math.ceil(c/l),d=new PIXI.Container;for(let t=0;t{const n=e.getExteriorRing().getCoordinates().map((t=>[t.x,t.y])).flat();t.beginFill(16777215,1),t.drawPolygon(n),t.endFill();const i=e.getNumInteriorRing();for(let n=0;n[t.x,t.y])).flat();t.lineStyle(0,0,1,1,.5),t.beginHole(),t.drawPolygon(i),t.endHole()}},Rr=(t,e)=>{for(let n=0;n{const i=e.getExteriorRing().getCoordinates().map((t=>[t.x,t.y])).flat();t.lineStyle(n,PIXI.utils.string2hex("#000000"),1,.5),t.drawPolygon(i);const r=e.getNumInteriorRing();for(let i=0;i[t.x,t.y])).flat();t.lineStyle(n,PIXI.utils.string2hex("#000000"),1),t.drawPolygon(r)}},Dr=(t,e,n)=>{for(let i=0;i{for(let s=0;s{const s=r.getExteriorRing().getCoordinates().map((t=>[t.x,t.y])).flat();i.floorTexture||(t.beginFill(PIXI.utils.string2hex(i.floorColor),1),t.drawPolygon(s),t.endFill());const o=r.getNumInteriorRing();for(let e=0;e[t.x,t.y])).flat();t.lineStyle(0,0,1,1,.5),t.beginHole(),t.drawPolygon(n),t.endHole()}i.interiorShadowOpacity&&(e.lineStyle({width:i.wallThickness+i.interiorShadowThickness,color:PIXI.utils.string2hex(i.interiorShadowColor),alignment:.5,join:"round"}),e.drawPolygon(s)),i.wallTexture||(n.lineStyle(i.wallThickness,PIXI.utils.string2hex(i.wallColor),1,.5),n.drawPolygon(s));for(let t=0;t[t.x,t.y])).flat();e.drawPolygon(s),i.wallTexture||(n.lineStyle(i.wallThickness,PIXI.utils.string2hex(i.wallColor),1),n.drawPolygon(s))}},Fr=(t,e,n)=>{t.lineStyle({width:e.wallThickness,color:PIXI.utils.string2hex(e.wallColor),alpha:1,alignment:.5,cap:"round"}),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3])},Mr=(t,e,n)=>{t.lineStyle({width:e.wallThickness+e.interiorShadowThickness,color:PIXI.utils.string2hex(e.interiorShadowColor),alignment:.5,join:"round",cap:"round"}),t.moveTo(n[2],n[3]),t.lineTo(n[0],n[1])},Gr=(t,e,n,i)=>{const r=fr(i[0],i[1],i[2],i[3]),s=20/r,o=s+(r-40)/r,l=i[2]-i[0],a=i[3]-i[1],c=[i[0]+l*s,i[1]+a*s],h=[i[0]+l*o,i[1]+a*o],u=yr(n.doorThickness,c[0],c[1],h[0],h[1]),d=n.wallTexture?"#000000":n.wallColor;t.lineStyle({width:n.wallThickness,color:PIXI.utils.string2hex(d),alpha:1,alignment:.5,cap:"round"}),n.wallTexture?(e.moveTo(i[0],i[1]),e.lineTo(c[0],c[1]),e.moveTo(h[0],h[1]),e.lineTo(i[2],i[3])):(t.moveTo(i[0],i[1]),t.lineTo(c[0],c[1]),t.moveTo(h[0],h[1]),t.lineTo(i[2],i[3])),n.doorFillOpacity&&t.beginFill(PIXI.utils.string2hex(n.doorFillColor),n.doorFillOpacity),t.lineStyle(n.doorLineThickness,PIXI.utils.string2hex(n.doorColor),1,.5),t.drawPolygon(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[0],u[1]),n.doorFillColor&&t.endFill()},kr=(t,e,n,i)=>{const r=game.user.isGM;if(r&&"door"===n.secretDoorStyleGM||!r&&"door"===n.secretDoorStylePlayer)return void Gr(t,e,n,i);const s=fr(i[0],i[1],i[2],i[3]),o=(s-40)/2/s,l=o+40/s,a=i[2]-i[0],c=i[3]-i[1],h=[i[0]+a*o,i[1]+c*o],u=[i[0]+.5*a,i[1]+.5*c],d=[i[0]+a*l,i[1]+c*l],g=yr(30,h[0],h[1],d[0],d[1]),f=n.wallTexture?"#000000":n.wallColor;if(t.lineStyle({width:n.wallThickness,color:PIXI.utils.string2hex(f),alpha:1,alignment:.5,cap:"round"}),n.wallTexture?(e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3])):(t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3])),r&&"secret"===n.secretDoorStyleGM||!r&&"secret"===n.secretDoorStylePlayer){const e=yr(50,h[0],h[1],u[0],u[1]),i=yr(50,u[0],u[1],d[0],d[1]);t.lineStyle({width:5,color:PIXI.utils.string2hex(n.secretDoorSColor),alpha:1,alignment:.5,cap:"round"}),t.moveTo(g[6],g[7]),t.bezierCurveTo(e[0],e[1],e[2],e[3],u[0],u[1]),t.bezierCurveTo(i[6],i[7],i[4],i[5],g[2],g[3])}},zr=(t,e,n)=>{const i=fr(n[0],n[1],n[2],n[3]),r=20/i,s=r+(i-40)/i,o=n[2]-n[0],l=n[3]-n[1],a=[n[0]+o*r,n[1]+l*r],c=[n[0]+o*s,n[1]+l*s],h=yr(e.doorThickness,a[0],a[1],c[0],c[1]);t.lineStyle({width:e.wallThickness+e.interiorShadowThickness,color:PIXI.utils.string2hex(e.interiorShadowColor),alignment:.5,join:"round"}),t.moveTo(n[2],n[3]),t.lineTo(c[0],c[1]),t.moveTo(a[0],a[1]),t.lineTo(n[0],n[1]),t.lineStyle({width:e.doorLineThickness+e.interiorShadowThickness,color:PIXI.utils.string2hex(e.interiorShadowColor),alignment:.5,join:"round"}),t.drawPolygon(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[0],h[1])};class Br extends PlaceableObject{constructor(t,e){super(e),this.journalEntry=t,this.history=[xr.startState()],this.historyIndex=0}static embeddedName="Drawing";deleteAll(){const t=this.state(),e=xr.startState();e.config=t.config,this.history=[e],this.historyIndex=0,this.history[this.historyIndex].saveToJournalEntry(this.journalEntry),this.refresh()}state(){return this.history[this.historyIndex]}draw(){return this.refresh(),this}refresh(){(async(t,e)=>{t.clear(),await Tr(t,e.config),await Cr(t,e),await Er(t,e)})(this,this.state())}async maybeRefresh(t){if(t.id===this.journalEntry.id){const t=await xr.loadFromJournalEntry(this.journalEntry);await this.pushState(t,!1)}}async loadFromJournalEntry(){const t=await xr.loadFromJournalEntry(this.journalEntry);this.history=[t],this.historyIndex=0,await this.refresh()}async undo(){this.historyIndex=Math.max(0,this.historyIndex-1),await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry),await this.refresh()}async redo(){this.historyIndex=Math.min(this.history.length-1,this.historyIndex+1),await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry),await this.refresh()}async pushState(t,e=!0){for(let t=this.history.length-1;t>this.historyIndex;t--)this.history.pop();this.history.push(t),this.historyIndex++,e&&await t.saveToJournalEntry(this.journalEntry),await this.refresh()}async setConfig(t){const e=this.state().clone();e.config=t,await this.pushState(e)}async addDoor(t,e,n,i){await this._addDoor(t,e,n,i,"doors")}async addSecretDoor(t,e,n,i){await this._addDoor(t,e,n,i,"secretDoors")}async _addDoor(t,e,n,i,r){const s=this.history[this.historyIndex].clone(),o=dr(t,e,n,i),l=[],a=[];for(let r of s.interiorWalls){const s=dr(r[0],r[1],r[2],r[3]);if(lr(s,o)){l.push(r);const s=mr(r[0],r[1],r[2],r[3]),o=_r(r[0],r[1],r[2],r[3]),c=mr(t,e,n,i),h=_r(t,e,n,i);a.push([s[0],s[1],c[0],c[1]]),a.push([h[0],h[1],o[0],o[1]])}}s.interiorWalls=s.interiorWalls.filter((t=>-1===l.indexOf(t))),s.interiorWalls=s.interiorWalls.concat(a),s[r].push([t,e,n,i]),await this.pushState(s)}async subtractDoors(t){const e=hr(t),n=this.history[this.historyIndex].doors.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)}));if(n.length!=this.history[this.historyIndex].doors.length){const t=this.history[this.historyIndex].clone();t.doors=n,await this.pushState(t)}}_maybeSplitWall(t,e,n,i,r){const s=dr(t,e,n,i);for(let o of r){const r=dr(o[0],o[1],o[2],o[3]);if(lr(s,r)){const r=mr(t,e,n,i),s=_r(t,e,n,i),l=mr(o[0],o[1],o[2],o[3]),a=_r(o[0],o[1],o[2],o[3]);return[[r[0],r[1],l[0],l[1]],[a[0],a[1],s[0],s[1]]]}}return[[t,e,n,i]]}async addInteriorWall(t,e,n,i){const r=this.history[this.historyIndex].clone(),s=this._maybeSplitWall(t,e,n,i,r.doors);r.interiorWalls=r.interiorWalls.concat(s),await this.pushState(r)}async subtractInteriorWalls(t){const e=hr(t),n=this.history[this.historyIndex].interiorWalls.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)}));if(n.length!=this.history[this.historyIndex].interiorWalls.length){const t=this.history[this.historyIndex].clone();t.interiorWalls=n,await this.pushState(t)}}async subtractDoorsAndInteriorWalls(t){const e=hr(t),n=this.history[this.historyIndex],i=n.doors.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)})),r=n.secretDoors.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)})),s=n.interiorWalls.filter((t=>{const n=dr(t[0],t[1],t[2],t[3]);return!sr(e,n)}));if(i.length!=n.doors.length||r.length!=n.secretDoors.length||s.length!=n.interiorWalls.length){const t=n.clone();t.doors=i,t.secretDoors=r,t.interiorWalls=s,await this.pushState(t)}}async _addPoly(t){const e=this.history[this.historyIndex],n=e.clone();if(n.geometry){n.geometry=(i=n.geometry,r=t,rr.union(i,r));if(or(e.geometry,t)){const i=((t,e)=>Xi.intersection(t,e))(e.geometry,t),r=i.getCoordinates();if(r.length>1&&r.length%2==0)for(let t=0;t{const n=dr(e[0],e[1],e[2],e[3]);return!sr(t,n)}));e.length!=n.interiorWalls.length&&(n.interiorWalls=e)}}else n.geometry=t;var i,r;await this.pushState(n)}async addRectangle(t){const e=hr(t);this._addPoly(e)}async subtractRectangle(t){if(!this.history[this.historyIndex].geometry)return;const e=hr(t);if(!sr(this.history[this.historyIndex].geometry,e))return;const n=this.history[this.historyIndex].clone();var i,r;n.geometry=(i=n.geometry,r=e,Xi.difference(i,r)),await this.pushState(n)}async addPolygon(t){try{const e=gr(t);await this._addPoly(e)}catch(t){console.log(t)}}async addThemeArea(t){try{gr(t)}catch(t){return void console.log(t)}const e={points:t,themeKey:r()},n=this.history[this.historyIndex].clone();n.themeAreas.push(e),await this.pushState(n)}async removeThemeAreas(t){const e=hr(t),n=this.history[this.historyIndex].themeAreas.filter((t=>{try{const n=gr(t.points);return!sr(e,n)}catch(t){return console.log(t),!1}}));if(n.length!=this.history[this.historyIndex].themeAreas.length){const t=this.history[this.historyIndex].clone();t.themeAreas=n,await this.pushState(t)}}}const qr=async()=>{let t=game.folders.filter((t=>"JournalEntry"===t.data.type&&"Dungeon Draw"===t.name)).pop();t||(t=await Folder.create({name:"Dungeon Draw",type:"JournalEntry"}));return await JournalEntry.create({name:canvas.scene.name,folder:t.id,flags:{"dungeon-draw":{dungeonVersion:"1.0"}}})},Yr=async t=>{await canvas.scene.createEmbeddedDocuments("Note",[{entryId:t.id,fontSize:20,icon:"icons/svg/cave.svg",iconSize:32,textAnchor:1,textColor:"#FFFFFF",x:50,y:50,iconTint:"",text:"Dungeon Draw",flags:{}}])};class Xr extends PlaceablesLayer{static LAYER_NAME="dungeon";constructor(){super(),this.dungeonContainer=null,this.dungeon=null}static get layerOptions(){return foundry.utils.mergeObject(super.layerOptions,{name:Xr.LAYER_NAME,canDragCreate:!0,zIndex:-1})}static documentName="Drawing";_getNewDrawingData(t){const e=game.activeTool,n={fillColor:game.user.color,strokeColor:game.user.color,strokeWidth:8};switch(n.x=t.x,n.y=t.y,n.author=game.user.id,e){case"addrect":case"subtractdoor":case"subtractrect":case"themeeraser":n.type=CONST.DRAWING_TYPES.RECTANGLE,n.points=[];break;case"adddoor":case"addpoly":case"addsecretdoor":case"addwall":case"themepainter":n.type=CONST.DRAWING_TYPES.POLYGON,n.points=[[0,0]];break;case"ellipse":n.type=CONST.DRAWING_TYPES.ELLIPSE,n.points=[]}return n}async deleteAll(){const t=this.constructor.documentName;if(!game.user.isGM)throw new Error(`You do not have permission to delete ${t} objects from the Scene.`);return Dialog.confirm({title:game.i18n.localize("CONTROLS.ClearAll"),content:`

${game.i18n.format("CONTROLS.ClearAllHint",{type:t})}

`,yes:()=>this._deleteAll()})}async _deleteAll(){this.dungeon?.deleteAll()}async loadDungeon(){const{journalEntry:e,note:n}=await(()=>{for(const e of canvas.scene.notes){const n=game.journal.get(e.data.entryId);if(n&&n.getFlag(t,"dungeonVersion"))return{journalEntry:n,note:e}}return{journalEntry:null,note:null}})();e?(this.dungeon=new Br(e,n),await this.dungeon.loadFromJournalEntry(),this.addChildAt(this.dungeon,0)):this.dungeon=null}async createNewDungeon(){await(async()=>{const t=await qr();return{journalEntry:t,note:await Yr(t)}})(),await this.loadDungeon()}async draw(){return await super.draw(),this}async _onClickLeft(t){const{preview:e,createState:n,originalEvent:i}=t.data;if(n>=1&&e.isPolygon){let n=t.data.destination;return i.shiftKey||(n=canvas.grid.getSnappedPosition(n.x,n.y,this.gridPrecision)),e._addPoint(n,!1),e._chain=!0,e.refresh()}await super._onClickLeft(t)}_onClickLeft2(t){const{createState:e,preview:n}=t.data;if(e>=1&&n.isPolygon)return t.data.createState=2,this._onDragLeftDrop(t);super._onClickLeft2(t)}async _onDragLeftStart(t){await super._onDragLeftStart(t);const e=this._getNewDrawingData(t.data.origin),n=new DrawingDocument(e,{parent:canvas.scene}),i=new Drawing(n);return t.data.preview=this.preview.addChild(i),i.draw()}_onDragLeftMove(t){const{preview:e,createState:n}=t.data;e&&(null===e.parent&&this.preview.addChild(e),n>=1&&(e._onMouseDraw(t),e.data.type===CONST.DRAWING_TYPES.POLYGON&&"adddoor"!==game.activeTool&&"addsecretdoor"!==game.activeTool&&"addwall"!==game.activeTool||(t.data.createState=2)))}async _onDragLeftDrop(t){const{createState:e,destination:n,origin:i,preview:r}=t.data;if(2===e){this.dungeon||await this.createNewDungeon();const e=Math.hypot(n.x-i.x,n.y-i.y)>=canvas.dimensions.size/8,s=r.isPolygon&&r.data.points.length>2;if("adddoor"===game.activeTool){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1,await this.dungeon.addDoor(e.x,e.y,e.x+e.points[1][0],e.y+e.points[1][1])}if("addsecretdoor"===game.activeTool){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1,await this.dungeon.addSecretDoor(e.x,e.y,e.x+e.points[1][0],e.y+e.points[1][1])}else if("addwall"===game.activeTool){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1,await this.dungeon.addInteriorWall(e.x,e.y,e.x+e.points[1][0],e.y+e.points[1][1])}else if(e||s){t.data.createState=0;const e=r.data.toObject(!1);r._chain=!1;const n=this.constructor.placeableClass.normalizeShape(e);if("addpoly"===game.activeTool){const t=n.points.length;t>2&&(n.points[0][0]!==n.points[t-1][0]||n.points[0][1]!==n.points[t-1][1])&&n.points.push(n.points[0]);const e=n.points.map((t=>[t[0]+n.x,t[1]+n.y]));await this.dungeon.addPolygon(e)}else if("addrect"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.addRectangle(t)}else if("subtractdoor"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.subtractDoorsAndInteriorWalls(t)}else if("themeeraser"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.removeThemeAreas(t)}else if("themepainter"===game.activeTool){const t=n.points.length;t>2&&(n.points[0][0]!==n.points[t-1][0]||n.points[0][1]!==n.points[t-1][1])&&n.points.push(n.points[0]);const e=n.points.map((t=>[t[0]+n.x,t[1]+n.y]));await this.dungeon.addThemeArea(e)}else if("subtractrect"===game.activeTool){const t={x:n.x,y:n.y,height:n.height,width:n.width};await this.dungeon.subtractRectangle(t)}}return this._onDragLeftCancel(t)}if(1===e&&r.isPolygon){if(t.data.originalEvent.preventDefault(),r._chain)return;return this._onClickLeft(t)}return this._onDragLeftCancel(t)}}class jr{static init(){console.log("***** DUNGEON DRAW *****"),game.settings.register(t,"releaseNotesVersion",{name:"Last version we showed release notes.",scope:"client",default:"",type:String,config:!1}),game.settings.register(t,"customThemes",{name:"Custom themes.",scope:"client",default:"{}",type:String,config:!1}),game.settings.register(t,"themePainterTheme",{name:"Theme painter theme key.",scope:"client",default:"module.cavern",type:String,config:!1})}static ready(){jr.maybeShowReleaseNotes()}static async maybeShowReleaseNotes(){if(!game.user.isGM)return;const e=game.modules.get(t).data.version;if(e===game.settings.get(t,"releaseNotesVersion"))return;const n=await fetch("modules/dungeon-draw/CHANGELOG.md"),i="#"+(await n.text()).split("#")[1],r=await renderTemplate("modules/dungeon-draw/templates/release-notes.html",{data:{version:e,changelog:i}});new Dialog({title:game.i18n.localize("DD.ReleaseNotes"),content:r,buttons:{roll:{icon:'',label:"OK"}}},{width:600}).render(!0),await game.settings.set(t,"releaseNotesVersion",e)}static getSceneControlButtons(t){CONFIG.Canvas.layers.background?.group?CONFIG.Canvas.layers.dungeon={layerClass:Xr,group:"primary"}:CONFIG.Canvas.layers.dungeon=Xr,CONFIG.Dungeon={layerClass:Xr},t.push({name:"dungeondraw",title:"DD.SceneControlTitle",layer:Xr.LAYER_NAME,icon:"fas fa-dungeon",visible:game.user.isTrusted,tools:[{name:"addrect",title:"DD.ButtonTitleAddRect",icon:"fas fa-plus-square"},{name:"subtractrect",title:"DD.ButtonTitleSubtractRect",icon:"fas fa-minus-square"},{name:"addpoly",title:"DD.ButtonTitleAddPoly",icon:"fas fa-draw-polygon"},{name:"addwall",title:"DD.ButtonTitleAddWall",icon:"fas fa-bars"},{name:"adddoor",title:"DD.ButtonTitleAddDoor",icon:"fas fa-door-open"},{name:"addsecretdoor",title:"DD.ButtonTitleAddSecretDoor",icon:"fas fa-mask"},{name:"subtractdoor",title:"DD.ButtonTitleSubtractDoorsAndWalls",icon:"fas fa-window-close"},{name:"themepainter",title:"DD.ButtonTitleThemePainter",icon:"fas fa-brush"},{name:"themeeraser",title:"DD.ButtonTitleThemeEraser",icon:"fas fa-eraser"},{name:"undo",title:"DD.ButtonTitleUndo",icon:"fas fa-undo",onClick:async()=>{await canvas.dungeon.dungeon.undo()},button:!0},{name:"redo",title:"DD.ButtonTitleRedo",icon:"fas fa-redo",onClick:async()=>{await canvas.dungeon.dungeon.redo()},button:!0},{name:"config",title:"DD.ButtonTitleConfig",icon:"fas fa-cog",onClick:()=>(new l).render(!0),button:!0},{name:"clear",title:"DD.ButtonTitleClear",icon:"fas fa-trash",visible:!0,onClick:()=>canvas.dungeon.deleteAll(),button:!0}],activeTool:"addrect"})}static async canvasReady(t){await t.dungeon.loadDungeon()}static async updateJournalEntry(t,e,n,i){game.user.id!==i&&await(canvas.dungeon.dungeon?.maybeRefresh(t))}}Hooks.on("init",jr.init),Hooks.on("ready",jr.ready),Hooks.on("getSceneControlButtons",jr.getSceneControlButtons),Hooks.on("canvasReady",jr.canvasReady),Hooks.on("updateJournalEntry",jr.updateJournalEntry);export{jr as DungeonDraw}; //# sourceMappingURL=dungeondraw-bundle.min.js.map diff --git a/modules/dungeondraw-bundle.min.js.map b/modules/dungeondraw-bundle.min.js.map index 60b1dd1..82b510a 100644 --- a/modules/dungeondraw-bundle.min.js.map +++ b/modules/dungeondraw-bundle.min.js.map @@ -1 +1 @@ -{"version":3,"file":"dungeondraw-bundle.min.js","sources":["../src/constants.js","../src/themes.js","../src/themesheet.js","../src/configsheet.js","../src/wallmaker.js","../node_modules/jsts/org/locationtech/jts/util/NumberUtil.js","../node_modules/jsts/java/lang/Exception.js","../node_modules/jsts/java/lang/IllegalArgumentException.js","../node_modules/jsts/java/lang/Long.js","../node_modules/jsts/java/lang/Double.js","../node_modules/jsts/java/lang/Comparable.js","../node_modules/jsts/java/lang/Cloneable.js","../node_modules/jsts/java/util/Comparator.js","../node_modules/jsts/java/io/Serializable.js","../node_modules/jsts/java/lang/RuntimeException.js","../node_modules/jsts/org/locationtech/jts/util/AssertionFailedException.js","../node_modules/jsts/org/locationtech/jts/util/Assert.js","../node_modules/jsts/org/locationtech/jts/geom/Coordinate.js","../node_modules/jsts/hasInterface.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequence.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequenceFactory.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryComponentFilter.js","../node_modules/jsts/org/locationtech/jts/geom/Envelope.js","../node_modules/jsts/org/locationtech/jts/geom/Geometry.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateFilter.js","../node_modules/jsts/org/locationtech/jts/geom/Lineal.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequences.js","../node_modules/jsts/java/lang/UnsupportedOperationException.js","../node_modules/jsts/java/lang/Character.js","../node_modules/jsts/org/locationtech/jts/geom/Dimension.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryFilter.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequenceFilter.js","../node_modules/jsts/org/locationtech/jts/geom/LineString.js","../node_modules/jsts/org/locationtech/jts/algorithm/Length.js","../node_modules/jsts/org/locationtech/jts/geom/Puntal.js","../node_modules/jsts/org/locationtech/jts/geom/Point.js","../node_modules/jsts/org/locationtech/jts/algorithm/Area.js","../node_modules/jsts/java/util/Collection.js","../node_modules/jsts/java/lang/IndexOutOfBoundsException.js","../node_modules/jsts/java/util/List.js","../node_modules/jsts/java/util/NoSuchElementException.js","../node_modules/jsts/java/util/ArrayList.js","../node_modules/jsts/java/util/Arrays.js","../node_modules/jsts/java/lang/StringBuffer.js","../node_modules/jsts/java/lang/Integer.js","../node_modules/jsts/org/locationtech/jts/math/DD.js","../node_modules/jsts/org/locationtech/jts/algorithm/CGAlgorithmsDD.js","../node_modules/jsts/org/locationtech/jts/algorithm/Orientation.js","../node_modules/jsts/org/locationtech/jts/geom/Polygonal.js","../node_modules/jsts/org/locationtech/jts/geom/Polygon.js","../node_modules/jsts/java/util/Set.js","../node_modules/jsts/java/util/SortedSet.js","../node_modules/jsts/java/util/TreeSet.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryCollection.js","../node_modules/jsts/org/locationtech/jts/geom/MultiPoint.js","../node_modules/jsts/org/locationtech/jts/geom/LinearRing.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateXY.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateXYM.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateXYZM.js","../node_modules/jsts/org/locationtech/jts/geom/Coordinates.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateList.js","../node_modules/jsts/org/locationtech/jts/math/MathUtil.js","../node_modules/jsts/java/lang/System.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateArrays.js","../node_modules/jsts/java/lang/StringBuilder.js","../node_modules/jsts/org/locationtech/jts/geom/impl/CoordinateArraySequence.js","../node_modules/jsts/org/locationtech/jts/geom/impl/CoordinateArraySequenceFactory.js","../node_modules/jsts/org/locationtech/jts/geom/MultiPolygon.js","../node_modules/jsts/java/util/Map.js","../node_modules/jsts/java/util/HashSet.js","../node_modules/jsts/java/util/HashMap.js","../node_modules/jsts/org/locationtech/jts/geom/PrecisionModel.js","../node_modules/jsts/org/locationtech/jts/geom/MultiLineString.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryFactory.js","../node_modules/jsts/org/locationtech/jts/io/WKTParser.js","../node_modules/jsts/org/locationtech/jts/io/WKTReader.js","../node_modules/jsts/org/locationtech/jts/io/WKTWriter.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferParameters.js","../node_modules/jsts/org/locationtech/jts/geom/Location.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Position.js","../node_modules/jsts/java/util/EmptyStackException.js","../node_modules/jsts/java/util/Stack.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/RightmostEdgeFinder.js","../node_modules/jsts/org/locationtech/jts/geom/TopologyException.js","../node_modules/jsts/java/util/LinkedList.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferSubgraph.js","../node_modules/jsts/org/locationtech/jts/algorithm/Intersection.js","../node_modules/jsts/org/locationtech/jts/algorithm/Distance.js","../node_modules/jsts/org/locationtech/jts/algorithm/LineIntersector.js","../node_modules/jsts/org/locationtech/jts/algorithm/RobustLineIntersector.js","../node_modules/jsts/org/locationtech/jts/algorithm/RayCrossingCounter.js","../node_modules/jsts/org/locationtech/jts/algorithm/PointLocation.js","../node_modules/jsts/org/locationtech/jts/geomgraph/TopologyLocation.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Label.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeRing.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/MinimalEdgeRing.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/MaximalEdgeRing.js","../node_modules/jsts/org/locationtech/jts/geomgraph/GraphComponent.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Node.js","../node_modules/jsts/java/util/SortedMap.js","../node_modules/jsts/java/util/TreeMap.js","../node_modules/jsts/org/locationtech/jts/geomgraph/NodeMap.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Quadrant.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeEnd.js","../node_modules/jsts/org/locationtech/jts/geomgraph/DirectedEdge.js","../node_modules/jsts/org/locationtech/jts/geomgraph/NodeFactory.js","../node_modules/jsts/org/locationtech/jts/geomgraph/PlanarGraph.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/PolygonBuilder.js","../node_modules/jsts/org/locationtech/jts/index/strtree/Boundable.js","../node_modules/jsts/org/locationtech/jts/index/strtree/ItemBoundable.js","../node_modules/jsts/org/locationtech/jts/util/PriorityQueue.js","../node_modules/jsts/org/locationtech/jts/index/SpatialIndex.js","../node_modules/jsts/org/locationtech/jts/index/strtree/AbstractNode.js","../node_modules/jsts/java/util/Collections.js","../node_modules/jsts/org/locationtech/jts/index/strtree/EnvelopeDistance.js","../node_modules/jsts/org/locationtech/jts/index/strtree/BoundablePair.js","../node_modules/jsts/org/locationtech/jts/index/ItemVisitor.js","../node_modules/jsts/org/locationtech/jts/index/strtree/AbstractSTRtree.js","../node_modules/jsts/org/locationtech/jts/index/strtree/ItemDistance.js","../node_modules/jsts/org/locationtech/jts/index/strtree/STRtree.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentPointComparator.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentNode.js","../node_modules/jsts/java/util/Iterator.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentNodeList.js","../node_modules/jsts/org/locationtech/jts/noding/Octant.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentString.js","../node_modules/jsts/org/locationtech/jts/noding/NodableSegmentString.js","../node_modules/jsts/org/locationtech/jts/noding/NodedSegmentString.js","../node_modules/jsts/org/locationtech/jts/geom/LineSegment.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChainOverlapAction.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChain.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChainBuilder.js","../node_modules/jsts/org/locationtech/jts/noding/Noder.js","../node_modules/jsts/org/locationtech/jts/noding/SinglePassNoder.js","../node_modules/jsts/org/locationtech/jts/noding/MCIndexNoder.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferInputLineSimplifier.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetSegmentString.js","../node_modules/jsts/org/locationtech/jts/algorithm/Angle.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetSegmentGenerator.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetCurveBuilder.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/SubgraphDepthLocater.js","../node_modules/jsts/org/locationtech/jts/algorithm/NotRepresentableException.js","../node_modules/jsts/org/locationtech/jts/algorithm/HCoordinate.js","../node_modules/jsts/org/locationtech/jts/geom/Triangle.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetCurveSetBuilder.js","../node_modules/jsts/org/locationtech/jts/algorithm/locate/PointOnGeometryLocator.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryCollectionIterator.js","../node_modules/jsts/org/locationtech/jts/algorithm/locate/SimplePointInAreaLocator.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeEndStar.js","../node_modules/jsts/org/locationtech/jts/geomgraph/DirectedEdgeStar.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/OverlayNodeFactory.js","../node_modules/jsts/org/locationtech/jts/noding/OrientedCoordinateArray.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeList.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentIntersector.js","../node_modules/jsts/org/locationtech/jts/noding/IntersectionAdder.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeIntersection.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeIntersectionList.js","../node_modules/jsts/org/locationtech/jts/geom/IntersectionMatrix.js","../node_modules/jsts/org/locationtech/jts/util/IntArrayList.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/MonotoneChainIndexer.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/MonotoneChainEdge.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Depth.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Edge.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferBuilder.js","../node_modules/jsts/org/locationtech/jts/noding/ScaledNoder.js","../node_modules/jsts/org/locationtech/jts/noding/NodingValidator.js","../node_modules/jsts/org/locationtech/jts/noding/snapround/HotPixel.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChainSelectAction.js","../node_modules/jsts/org/locationtech/jts/noding/snapround/MCIndexPointSnapper.js","../node_modules/jsts/org/locationtech/jts/noding/InteriorIntersectionFinderAdder.js","../node_modules/jsts/org/locationtech/jts/noding/snapround/MCIndexSnapRounder.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferOp.js","../node_modules/jsts/org/locationtech/jts/algorithm/BoundaryNodeRule.js","../node_modules/jsts/org/locationtech/jts/algorithm/PointLocator.js","../node_modules/jsts/org/locationtech/jts/noding/BasicSegmentString.js","../node_modules/jsts/org/locationtech/jts/noding/NodingIntersectionFinder.js","../node_modules/jsts/org/locationtech/jts/noding/FastNodingValidator.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeNodingValidator.js","../node_modules/jsts/org/locationtech/jts/geom/util/GeometryCollectionMapper.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/LineBuilder.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/PointBuilder.js","../node_modules/jsts/org/locationtech/jts/geom/util/GeometryTransformer.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/LineStringSnapper.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/GeometrySnapper.js","../node_modules/jsts/org/locationtech/jts/precision/CommonBits.js","../node_modules/jsts/org/locationtech/jts/precision/CommonBitsRemover.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/SnapOverlayOp.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/SnapIfNeededOverlayOp.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/MonotoneChain.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/SweepLineEvent.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/SegmentIntersector.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/SimpleMCSweepLineIntersector.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/EdgeSetIntersector.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/IntervalRTreeNode.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/IntervalRTreeLeafNode.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/IntervalRTreeBranchNode.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/SortedPackedIntervalRTree.js","../node_modules/jsts/org/locationtech/jts/geom/util/LinearComponentExtracter.js","../node_modules/jsts/org/locationtech/jts/index/ArrayListVisitor.js","../node_modules/jsts/org/locationtech/jts/algorithm/locate/IndexedPointInAreaLocator.js","../node_modules/jsts/org/locationtech/jts/geomgraph/GeometryGraph.js","../node_modules/jsts/org/locationtech/jts/operation/GeometryGraphOperation.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/OverlayOp.js","../node_modules/jsts/org/locationtech/jts/operation/relate/EdgeEndBuilder.js","../node_modules/jsts/org/locationtech/jts/operation/relate/EdgeEndBundle.js","../node_modules/jsts/org/locationtech/jts/operation/relate/EdgeEndBundleStar.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateNode.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateNodeFactory.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateComputer.js","../node_modules/jsts/org/locationtech/jts/operation/predicate/RectangleContains.js","../node_modules/jsts/org/locationtech/jts/algorithm/RectangleLineIntersector.js","../node_modules/jsts/org/locationtech/jts/geom/util/ShortCircuitedGeometryVisitor.js","../node_modules/jsts/org/locationtech/jts/operation/predicate/RectangleIntersects.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateOp.js","../node_modules/jsts/org/locationtech/jts/operation/union/UnionOp.js","../src/geo-utils.js","../src/dungeonstate.js","../src/lib/pixi-filters.min.js","../src/renderer.js","../src/dungeon.js","../src/dungeonlayer.js","../src/dungeondraw.js"],"sourcesContent":["// module name from module.json\nexport const MODULE_NAME = \"dungeon-draw\";\nexport const SETTING_THEME_PAINTER_THEME = \"themePainterTheme\";\n","import * as constants from \"./constants.js\";\n\nexport const defaultConfig = () => {\n return {\n backgroundImage: \"\",\n doorColor: \"#000000\",\n doorFillColor: \"#ffffff\",\n doorFillOpacity: 1.0,\n doorLineThickness: 8,\n doorThickness: 25,\n exteriorShadowColor: \"#000000\",\n exteriorShadowThickness: 20,\n exteriorShadowOpacity: 0.5,\n floorColor: \"#F2EDDF\",\n floorTexture: \"\",\n floorTextureTint: \"\",\n interiorShadowColor: \"#000000\",\n interiorShadowThickness: 8,\n interiorShadowOpacity: 0.5,\n sceneBackgroundColor: \"#999999\",\n sceneGridColor: \"#000000\",\n sceneGridOpacity: 0.2,\n secretDoorSColor: \"#ffffff\",\n secretDoorStyleGM: \"secret\",\n secretDoorStylePlayer: \"wall\",\n wallColor: \"#000000\",\n wallTexture: \"\",\n wallTextureTint: \"\",\n wallThickness: 8,\n };\n};\n\nexport const getTheme = (themeKey) => {\n const splits = themeKey.split(\".\");\n const type = splits[0];\n const key = splits[1];\n if (type === \"custom\") {\n const customThemes = getCustomThemes();\n return customThemes[key];\n }\n return themes[key];\n};\n\nexport const getCustomThemes = () => {\n try {\n const customThemesString = game.settings.get(\n constants.MODULE_NAME,\n \"customThemes\"\n );\n return JSON.parse(customThemesString);\n } catch (e) {\n console.log(e);\n return {};\n }\n};\n\nexport const setCustomThemes = (customThemes) => {\n const themesString = JSON.stringify(customThemes);\n game.settings.set(constants.MODULE_NAME, \"customThemes\", themesString);\n};\n\nexport const getThemePainterThemeKey = () => {\n return game.settings.get(\n constants.MODULE_NAME,\n constants.SETTING_THEME_PAINTER_THEME\n );\n};\n\nexport const setThemePainterThemeKey = (themeKey) => {\n return game.settings.set(\n constants.MODULE_NAME,\n constants.SETTING_THEME_PAINTER_THEME,\n themeKey\n );\n};\n\nexport const themes = {\n default: {\n name: \"Default\",\n config: defaultConfig(),\n },\n arcPavement: {\n name: \"Arc Pavement\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#111111\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Arc_Pavement_001_basecolor.jpg\",\n wallColor: \"#111111\",\n wallThickness: 12,\n }),\n },\n basicBlack: {\n name: \"Basic Black\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#0D0D0D\",\n doorFillOpacity: 0.0,\n exteriorShadowOpacity: 0,\n interiorShadowOpacity: 0,\n floorColor: \"#FFFFFF\",\n sceneBackgroundColor: \"#0D0D0D\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#0D0D0D\",\n wallColor: \"#0D0D0D\",\n }),\n },\n cavern: {\n name: \"Cavern\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#2B2D2F\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Stylized_Stone_Floor_002_bw.jpg\",\n wallColor: \"#2B2D2F\",\n wallThickness: 12,\n }),\n },\n checkerboard: {\n name: \"Checkerboard\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorFillColor: \"#C2BFB0\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/sci_fi_texture_150_by_llexandro_d939vk9.png\",\n secretDoorSColor: \"#C2BFB0\",\n wallThickness: 10,\n }),\n },\n cobblestone: {\n name: \"Cobblestone\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#222222\",\n doorFillColor: \"#FFFFFF\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Cobblestone_001_COLOR.jpg\",\n secretDoorSColor: \"#FFFFFF\",\n wallColor: \"#222222\",\n wallThickness: 12,\n }),\n },\n dirt: {\n name: \"Dirt\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#1a1714\",\n doorFillColor: \"#8d7862\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Ground_Dirt_007_basecolor.jpg\",\n secretDoorSColor: \"#8d7862\",\n wallColor: \"#1a1714\",\n wallThickness: 10,\n }),\n },\n dungeonSquares: {\n name: \"Dungeon Squares\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#111111\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/outdoor+stone+tiles+pavement.jpg\",\n wallColor: \"#111111\",\n wallThickness: 12,\n }),\n },\n grass: {\n name: \"Grass\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#72471d\",\n doorFillColor: \"#eee8c1\",\n floorTexture: \"modules/dungeon-draw/assets/textures/Grass_001_COLOR.jpg\",\n secretDoorSColor: \"#eee8c1\",\n wallColor: \"#72471d\",\n wallThickness: 10,\n }),\n },\n groovyCarpet: {\n name: \"Groovy Carpet\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#2B2D2F\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Fabric_Rug_006_basecolor.jpg\",\n wallColor: \"#2B2D2F\",\n wallThickness: 12,\n }),\n },\n hexagon: {\n name: \"Hexagons\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#282828\",\n doorFillColor: \"#D1BD8A\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Rocks_Hexagons_002_basecolor.jpg\",\n secretDoorSColor: \"#D1BD8A\",\n wallColor: \"#282828\",\n wallThickness: 12,\n }),\n },\n marble: {\n name: \"Marble\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#686882\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Marble_Tiles_001_basecolor.jpg\",\n wallColor: \"#686882\",\n }),\n },\n metalGrid: {\n name: \"Metal Grid\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#27251A\",\n doorFillColor: \"#AAAAAA\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Sci-fi_Floor_002_basecolor.jpg\",\n secretDoorSColor: \"#AAAAAA\",\n wallColor: \"#27251A\",\n }),\n },\n metalSquares: {\n name: \"Metal Squares\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorFillColor: \"#C0C0C0\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/sci_fi_texture_212_by_llexandro_dcuxgum.png\",\n secretDoorSColor: \"#C0C0C0\",\n }),\n },\n moldvayBlue: {\n name: \"Moldvay Blue\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#3A9FF2\",\n doorFillOpacity: 0.0,\n doorThickness: 35,\n exteriorShadowOpacity: 0,\n floorColor: \"#FFFFFF\",\n interiorShadowOpacity: 0,\n sceneBackgroundColor: \"#3A9FF2\",\n sceneGridColor: \"#3A9FF2\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#3A9FF2\",\n wallColor: \"#3A9FF2\",\n }),\n },\n neonBlueprint: {\n name: \"Neon Blueprint\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#3A9FF2\",\n doorFillOpacity: 0.0,\n doorThickness: 35,\n exteriorShadowColor: \"#18495E\",\n floorColor: \"#142A3B\",\n interiorShadowColor: \"#1B7FAB\",\n sceneBackgroundColor: \"#171008\",\n sceneGridColor: \"#4C89A1\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#3A9FF2\",\n wallColor: \"#63C9E6\",\n wallThickness: 4,\n }),\n },\n ruddyPaper: {\n name: \"Ruddy Paper\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#913B55\",\n doorFillColor: \"#FADEE6\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Paper_Recycled_001_COLOR.jpg\",\n floorTextureTint: \"#F9FAE6\",\n exteriorShadowOpacity: 0,\n interiorShadowOpacity: 0,\n sceneBackgroundColor: \"#EBD3BC\",\n sceneGridColor: \"#594026\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#913B55\",\n wallColor: \"#9A6D54\",\n }),\n },\n water: {\n name: \"Water\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#203246\",\n floorTexture: \"modules/dungeon-draw/assets/textures/Water_001_COLOR.jpg\",\n wallColor: \"#203246\",\n wallThickness: 5,\n }),\n },\n woodPlanks: {\n name: \"Wood Planks\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#332211\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Old_Wooden_Plank_Seamless_Texture_765.jpg\",\n wallColor: \"#332211\",\n wallTexture: \"modules/dungeon-draw/assets/textures/Bark_002_bw.jpg\",\n wallTextureTint: \"#7e5935\",\n wallThickness: 15,\n }),\n },\n};\n","// TODO: fix this circular dependency\n// import { ConfigSheet } from \"./configsheet.js\";\nimport { getCustomThemes, setCustomThemes } from \"./themes.js\";\n\n/**\n * Sheet for Theme editing.\n *\n * @extends {FormApplication}\n */\nexport class ThemeSheet extends FormApplication {\n constructor(themeKey) {\n super();\n this.themeKey = themeKey;\n }\n\n static get defaultOptions() {\n return foundry.utils.mergeObject(super.defaultOptions, {\n id: \"dd-theme-sheet\",\n classes: [\"sheet\"],\n template: \"modules/dungeon-draw/templates/theme-sheet.html\",\n width: 480,\n height: 880,\n tabs: [\n { navSelector: \".tabs\", contentSelector: \"form\", initial: \"position\" },\n ],\n });\n }\n\n /** @override */\n get title() {\n return game.i18n.localize(\"DD.ThemeSheetTitle\");\n }\n\n /** @override */\n getData() {\n const customThemes = getCustomThemes();\n const theme = customThemes[this.themeKey];\n return {\n config: theme.config,\n themeName: theme.name,\n };\n }\n\n /* -------------------------------------------- */\n\n /** @override */\n async _updateObject(event, formData) {\n const customThemes = getCustomThemes();\n const themeName = formData.themeName;\n delete formData.themeName;\n // overwrite the theme at our key\n customThemes[this.themeKey] = {\n name: themeName,\n config: formData,\n };\n setCustomThemes(customThemes);\n // force already-open config sheet to re-render\n // TODO: fix this circular dependency\n // new ConfigSheet(\"themes\").render(true);\n }\n}\n","import {\n defaultConfig,\n getCustomThemes,\n getThemePainterThemeKey,\n setCustomThemes,\n setThemePainterThemeKey,\n themes,\n} from \"./themes.js\";\nimport { ThemeSheet } from \"./themesheet.js\";\n\n/**\n * Sheet for dungeon config/settings.\n *\n * @extends {FormApplication}\n */\nexport class ConfigSheet extends FormApplication {\n constructor(activeTab = \"settings\") {\n super();\n this._tabs[0].active = activeTab;\n }\n\n static get defaultOptions() {\n return foundry.utils.mergeObject(super.defaultOptions, {\n id: \"dd-config-sheet\",\n classes: [\"sheet\"],\n template: \"modules/dungeon-draw/templates/config-sheet.html\",\n width: 480,\n height: 970,\n tabs: [\n { navSelector: \".tabs\", contentSelector: \"form\", initial: \"position\" },\n ],\n });\n }\n\n /** @override */\n get title() {\n return game.i18n.localize(\"DD.ConfigSheetTitle\");\n }\n\n /** @override */\n getData() {\n let config = canvas.dungeon.dungeon?.state().config;\n if (!config) {\n config = defaultConfig();\n }\n const customThemes = getCustomThemes();\n const customThemeKeys = Object.keys(customThemes).sort();\n const themeKeys = Object.keys(themes).sort();\n const themePainterThemeKey = getThemePainterThemeKey();\n return {\n config,\n customThemes,\n customThemeKeys,\n themes,\n themeKeys,\n themePainterThemeKey,\n };\n }\n\n /* -------------------------------------------- */\n\n /** @override */\n async _updateObject(event, formData) {\n // TODO: handle customThemeName vs. config better\n delete formData.customThemeName;\n delete formData.themePainterTheme;\n console.log(\"*** formData\");\n console.log(formData);\n canvas.dungeon.dungeon?.setConfig(formData);\n if (game.user.isGM) {\n // need GM privs to update scene\n await canvas.scene.update({\n backgroundColor: formData.sceneBackgroundColor,\n gridAlpha: formData.sceneGridAlpha,\n gridColor: formData.sceneGridColor,\n });\n }\n }\n\n /* -------------------------------------------- */\n\n /** @override */\n async close(options) {\n await super.close(options);\n if (this.preview) {\n this.preview.removeChildren();\n this.preview = null;\n }\n }\n\n /* -------------------------------------------- */\n /* Event Listeners and Handlers */\n /* -------------------------------------------- */\n\n /** @override */\n activateListeners(html) {\n super.activateListeners(html);\n html\n .find('button[name=\"resetDefault\"]')\n .click(this._onResetDefaults.bind(this));\n html.find(\".dd-theme-name\").click(this._onThemeNameClick.bind(this));\n html\n .find(\".dd-save-as-theme-button\")\n .click(this._onSaveAsThemeClick.bind(this));\n html.find(\".dd-theme-edit\").click(this._onEditThemeClick.bind(this));\n html.find(\".dd-theme-copy\").click(this._onCopyThemeClick.bind(this));\n html.find(\".dd-theme-delete\").click(this._onDeleteThemeClick.bind(this));\n html\n .find('select[name=\"themePainterThemeKey\"]')\n .change(this._onThemePainterThemeSelect.bind(this));\n }\n\n /* -------------------------------------------- */\n\n /**\n * Reset the user Drawing configuration settings to their default values\n * @param {PointerEvent} event The originating mouse-click event\n * @protected\n */\n _onResetDefaults(event) {\n event.preventDefault();\n canvas.dungeon.dungeon?.setConfig(defaultConfig());\n canvas.dungeon.dungeon.refresh();\n this.render();\n }\n\n async _onThemeNameClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).parent(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n const isCustom = themeRow.data(\"themetype\") === \"custom\";\n let theme;\n if (isCustom) {\n const customThemes = getCustomThemes();\n theme = customThemes[themeKey];\n } else {\n theme = themes[themeKey];\n }\n const newConfig = { ...theme.config };\n await canvas.dungeon.dungeon?.setConfig(newConfig);\n if (game.user.isGM) {\n // need GM privs to update scene\n await canvas.scene.update({\n backgroundColor: newConfig.sceneBackgroundColor,\n gridAlpha: newConfig.sceneGridAlpha,\n gridColor: newConfig.sceneGridColor,\n });\n }\n this.render();\n }\n\n async _onSaveAsThemeClick(event) {\n event.preventDefault();\n const input = $(event.currentTarget)\n .closest(\".form-fields\")\n .children(\".saveAsThemeName\");\n const saveAsThemeName = input.val();\n const formData = this._getSubmitData();\n // TODO: handle saveAsThemeName better\n delete formData.saveAsThemeName;\n delete formData.themePainterThemeKey;\n const customThemes = getCustomThemes();\n customThemes[saveAsThemeName] = {\n name: saveAsThemeName,\n config: formData,\n };\n setCustomThemes(customThemes);\n this._tabs[0].active = \"themes\";\n this.render();\n }\n\n async _onEditThemeClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).closest(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n new ThemeSheet(themeKey).render(true);\n }\n\n _onCopyThemeClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).closest(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n const customThemes = getCustomThemes();\n const oldTheme = customThemes[themeKey];\n const newTheme = JSON.parse(JSON.stringify(oldTheme));\n // deal with possible name collisions\n let num = 1;\n let newName;\n let done = false;\n while (!done) {\n newName = `${oldTheme.name} (${num})`;\n if (newName in customThemes) {\n num++;\n } else {\n done = true;\n }\n }\n newTheme.name = newName;\n customThemes[newName] = newTheme;\n setCustomThemes(customThemes);\n this.render();\n }\n\n _onDeleteThemeClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).closest(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n const customThemes = getCustomThemes();\n delete customThemes[themeKey];\n setCustomThemes(customThemes);\n this.render();\n }\n\n _onThemePainterThemeSelect(event) {\n const themeKey = $(event.currentTarget).val();\n setThemePainterThemeKey(themeKey);\n }\n}\n","import * as constants from \"./constants.js\";\n\nexport const makeWalls = async (state) => {\n if (!game.user.isGM) {\n // need GM privs to delete/create walls\n return;\n }\n await deleteAllWalls();\n if (state.geometry) {\n await makeWallsFromMulti(state.geometry);\n }\n await makeInteriorWalls(state.interiorWalls);\n await makeDoors(state.doors);\n await makeSecretDoors(state.secretDoors);\n};\n\nconst deleteAllWalls = async () => {\n try {\n // scene.update() triggers a redraw,\n // which causes an infinite loop of redraw/refresh.\n // so avoid it :P\n const walls = canvas.scene.getEmbeddedCollection(\"Wall\");\n const ids = [];\n for (const wall of walls) {\n const flag = wall.getFlag(constants.MODULE_NAME, \"dungeonVersion\");\n if (flag) {\n ids.push(wall.id);\n }\n }\n await canvas.scene.deleteEmbeddedDocuments(\"Wall\", ids);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst makeWallsFromMulti = async (multi) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n await makeWallsFromPoly(poly);\n }\n};\n\nconst wallData = (x1, y1, x2, y2) => {\n return {\n // From Foundry API docs:\n // \"The wall coordinates, a length-4 array of finite numbers [x0,y0,x1,y1]\"\n c: [x1, y1, x2, y2],\n flags: {\n \"dungeon-draw\": {\n // extract string constant somewhere\n dungeonVersion: \"1.0\",\n },\n },\n };\n};\n\nconst doorData = (x1, y1, x2, y2) => {\n const data = wallData(x1, y1, x2, y2);\n data.door = 1; // door\n return data;\n};\n\nconst secretDoorData = (x1, y1, x2, y2) => {\n const data = wallData(x1, y1, x2, y2);\n data.door = 2; // secret\n return data;\n};\n\nconst makeWallsFromPoly = async (poly) => {\n const allWalls = [];\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n for (let i = 0; i < coords.length - 1; i++) {\n // constants.MODULE_NAME\n const data = wallData(\n coords[i].x,\n coords[i].y,\n coords[i + 1].x,\n coords[i + 1].y\n );\n allWalls.push(data);\n }\n const numHoles = poly.getNumInteriorRing();\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n for (let i = 0; i < coords.length - 1; i++) {\n const data = wallData(\n coords[i].x,\n coords[i].y,\n coords[i + 1].x,\n coords[i + 1].y\n );\n allWalls.push(data);\n }\n }\n if (allWalls.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allWalls);\n }\n};\n\n/** [[x1,y1,x2,y2],...] */\nconst makeInteriorWalls = async (walls) => {\n const allWalls = [];\n for (const wall of walls) {\n const data = wallData(wall[0], wall[1], wall[2], wall[3]);\n allWalls.push(data);\n }\n if (allWalls.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allWalls);\n }\n};\n\n/** [[x1,y1,x2,y2],...] */\nconst makeDoors = async (doors) => {\n const allDoors = [];\n for (const door of doors) {\n const data = doorData(door[0], door[1], door[2], door[3]);\n allDoors.push(data);\n }\n if (allDoors.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allDoors);\n }\n};\n\n/** [[x1,y1,x2,y2],...] */\nconst makeSecretDoors = async (doors) => {\n const allDoors = [];\n for (const door of doors) {\n const data = secretDoorData(door[0], door[1], door[2], door[3]);\n allDoors.push(data);\n }\n if (allDoors.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allDoors);\n }\n};\n","export default class NumberUtil {\n static equalsWithTolerance(x1, x2, tolerance) {\n return Math.abs(x1 - x2) <= tolerance\n }\n}\n","export default class Exception extends Error {\n constructor(message) {\n super(message)\n this.name = Object.keys({ Exception })[0]\n }\n toString() {\n return this.message\n }\n}\n","import Exception from './Exception.js'\n\nexport default class IllegalArgumentException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ IllegalArgumentException })[0]\n }\n}\n","export default class Long {\n constructor(high, low) {\n this.low = low || 0\n this.high = high || 0\n }\n\n static toBinaryString(i) {\n let mask\n let result = ''\n for (mask = 0x80000000; mask > 0; mask >>>= 1)\n result += (i.high & mask) === mask ? '1' : '0'\n for (mask = 0x80000000; mask > 0; mask >>>= 1)\n result += (i.low & mask) === mask ? '1' : '0'\n return result\n }\n}\n","import Long from './Long.js'\n\nexport default function Double() { }\n\nDouble.NaN = NaN\nDouble.isNaN = n => Number.isNaN(n)\nDouble.isInfinite = n => !Number.isFinite(n)\nDouble.MAX_VALUE = Number.MAX_VALUE\nDouble.POSITIVE_INFINITY = Number.POSITIVE_INFINITY\nDouble.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY\n\nif (typeof Float64Array === 'function' &&\n typeof Int32Array === 'function')\n// Simple and fast conversion between double and long bits\n// using TypedArrays and ArrayViewBuffers.\n\n (function() {\n const EXP_BIT_MASK = 0x7ff00000\n const SIGNIF_BIT_MASK = 0xFFFFF\n const f64buf = new Float64Array(1)\n const i32buf = new Int32Array(f64buf.buffer)\n Double.doubleToLongBits = function(value) {\n f64buf[0] = value\n let low = i32buf[0] | 0\n let high = i32buf[1] | 0\n // Check for NaN based on values of bit fields, maximum\n // exponent and nonzero significand.\n if (((high & EXP_BIT_MASK) === EXP_BIT_MASK) &&\n ((high & SIGNIF_BIT_MASK) !== 0) &&\n (low !== 0)) {\n low = 0 | 0\n high = 0x7ff80000 | 0\n }\n return new Long(high, low)\n }\n Double.longBitsToDouble = function(bits) {\n i32buf[0] = bits.low\n i32buf[1] = bits.high\n return f64buf[0]\n }\n })()\nelse\n// More complex and slower fallback implementation using\n// math and the divide-by-two and multiply-by-two algorithms.\n\n (function() {\n const BIAS = 1023\n const log2 = Math.log2\n const floor = Math.floor\n const pow = Math.pow\n const MAX_REL_BITS_INTEGER = (function() {\n for (let i = 53; i > 0; i--) {\n const bits = pow(2, i) - 1\n if (floor(log2(bits)) + 1 === i) return bits\n }\n return 0\n })()\n Double.doubleToLongBits = function(value) {\n let x, y, f, bits, skip\n let sign, exp, high, low\n\n // Get the sign bit and absolute value.\n if (value < 0 || 1 / value === Number.NEGATIVE_INFINITY) {\n sign = (1 << 31)\n value = (-value)\n } else {\n sign = 0\n }\n\n // Handle some special values.\n if (value === 0) {\n // Handle zeros (+/-0).\n low = 0 | 0\n high = sign // exponent: 00..00, significand: 00..00\n return new Long(high, low)\n }\n\n if (value === Infinity) {\n // Handle infinity (only positive values for value possible).\n low = 0 | 0\n high = sign | 0x7ff00000 // exponent: 11..11, significand: 00..00\n return new Long(high, low)\n }\n\n if (value !== value) { // eslint-disable-line\n // Handle NaNs (boiled down to only one distinct NaN).\n low = 0 | 0\n high = 0x7ff80000 // exponent: 11..11, significand: 10..00\n return new Long(high, low)\n }\n\n // Preinitialize variables, that are not neccessarily set by\n // the algorithm.\n bits = 0\n low = 0 | 0\n\n // Get the (always positive) integer part of value.\n x = floor(value)\n\n // Process the integer part if it's greater than 1. Zero requires\n // no bits at all, 1 represents the implicit (hidden) leading bit,\n // which must not be written as well.\n if (x > 1)\n // If we can reliably determine the number of bits required for\n // the integer part,\n\n if (x <= MAX_REL_BITS_INTEGER) {\n // get the number of bits required to represent it minus 1\n bits = floor(log2(x)) /* + 1 - 1 */\n // and simply copy/shift the integer bits into low and high.\n // That's much faster than the divide-by-two algorithm (saves\n // up to ~60%).\n // We always need to mask out the most significant bit, which\n // is the implicit (aka hidden) bit.\n if (bits <= 20) {\n // The simple case in which the integer fits into the\n // lower 20 bits of the high word is worth to be handled\n // separately (saves ~25%).\n low = 0 | 0\n high = (x << (20 - bits)) & 0xfffff\n } else {\n // Here, the integer part is split into low and high.\n // Since its value may require more than 32 bits, we\n // cannot use bitwise operators (which implicitly cast\n // to Int32), but use arithmetic operators % and / to\n // get low and high parts. The uppper 20 bits go to high,\n // the remaining bits (in f) to low.\n f = bits - 20\n // Like (1 << f) but safe with even more than 32 bits.\n y = pow(2, f)\n low = (x % y) << (32 - f)\n high = (x / y) & 0xfffff\n }\n } else {\n // For greater values, we must use the much slower divide-by-two\n // algorithm. Bits are generated from right to left, that is from\n // least to most significant bit. For each bit, we left-shift both\n // low and high by one and carry bit #0 from high to #31 in low.\n // The next bit is then copied into bit #19 in high, the leftmost\n // bit of the double's significand.\n\n // Preserve x for later user, so work with f.\n f = x\n low = 0 | 0\n for (;;) {\n y = f / 2\n f = floor(y)\n if (f === 0)\n // We just found the most signigicant (1-)bit, which\n // is the implicit bit and so, not stored in the double\n // value. So, it's time to leave the loop.\n break\n\n // Count this bit, shift low and carry bit #0 from high.\n bits++\n low >>>= 1\n low |= (high & 0x1) << 31\n // Shift high.\n high >>>= 1\n if (y !== f)\n // Copy the new bit into bit #19 in high (only required if 1).\n high |= 0x80000\n }\n }\n\n // Bias the exponent.\n exp = bits + BIAS\n\n // If the integer part is zero, we've not yet seen the implicit\n // leading bit. Variable skip is later used while processing the\n // fractional part (if any).\n skip = (x === 0)\n\n // Get fraction only into x.\n x = value - x\n\n // If some significand bits are still left to be filled and\n // the fractional part is not zero, convert the fraction using\n // the multiply-by-2 algorithm.\n if (bits < 52 && x !== 0) {\n // Initialize 'buffer' f, into which newly created bits get\n // shifted from right to left.\n f = 0\n\n for (;;) {\n y = x * 2\n if (y >= 1) {\n // This is a new 1-bit. Add and count this bit, if not\n // prohibited by skip.\n x = y - 1\n if (!skip) {\n f <<= 1\n f |= 1\n bits++\n } else {\n // Otherwise, decrement the exponent and unset\n // skip, so that all following bits get written.\n exp--\n skip = false\n }\n } else {\n // This is a new 0-bit. Add and count this bit, if not\n // prohibited by skip.\n x = y\n if (!skip) {\n f <<= 1\n bits++\n } else if (--exp === 0) {\n // Otherwise we've just decremented the exponent. If the\n // biased exponent is zero now (-1023), we process a\n // subnormal number, which has no impled leading 1-bit.\n // So, count this 0-bit and unset skip to write out\n // all the following bits.\n bits++\n skip = false\n }\n }\n if (bits === 20) {\n // When 20 bits have been created in total, we're done with\n // the high word. Copy the bits from 'buffer' f into high\n // and reset 'buffer' f. Following bits will end up in the\n // low word.\n high |= f\n f = 0\n } else if (bits === 52) {\n // When 52 bits have been created in total, we're done with\n // low word as well. Copy the bits from 'buffer' f into low\n // and exit the loop.\n low |= f\n break\n }\n if (y === 1) {\n // When y is exactly 1, there is no remainder and the process\n // is complete (the number is finite). Copy the bits from\n // 'buffer' f into either low or high and exit the loop.\n if (bits < 20)\n high |= (f << (20 - bits))\n else if (bits < 52) low |= (f << (52 - bits))\n\n break\n }\n }\n }\n\n // Copy/shift the exponent and sign bits into the high word.\n high |= (exp << 20)\n high |= sign\n\n return new Long(high, low)\n }\n Double.longBitsToDouble = function(bits) {\n let i\n let x, exp, fract\n const high = bits.high\n const low = bits.low\n\n // Extract the sign.\n const sign = (high & (1 << 31)) ? -1 : 1\n\n // Extract the unbiased exponent.\n exp = ((high & 0x7ff00000) >> 20) - BIAS\n\n // Calculate the fraction from left to right. Start\n // off with the 20 lower bits from the high word.\n fract = 0\n x = (1 << 19)\n for (i = 1; i <= 20; i++) {\n if (high & x) fract += pow(2, -i)\n\n x >>>= 1\n }\n // Continue with all 32 bits from the low word.\n x = (1 << 31)\n for (i = 21; i <= 52; i++) {\n if (low & x) fract += pow(2, -i)\n\n x >>>= 1\n }\n\n // Handle special values.\n // Check for zero and subnormal values.\n if (exp === -BIAS) {\n if (fract === 0)\n // +/-1.0 * 0.0 => +/-0.0\n return sign * 0\n\n exp = -1022\n } else if (exp === BIAS + 1) { // Check for +/-Infinity or NaN.\n if (fract === 0)\n // +/-1.0 / 0.0 => +/-Infinity\n return sign / 0\n\n return NaN\n } else { // Nothing special? Seems to be a normal number.\n // Add the implicit leading bit (1*2^0).\n fract += 1\n }\n\n return sign * fract * pow(2, exp)\n }\n })()\n","export default function Comparable() {}\n","export default function Clonable() {}\n","export default function Comparator() {}\n","export default function Serializable() {}\n","import Exception from './Exception.js'\n\nexport default class RuntimeException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ RuntimeException })[0]\n }\n}\n","import RuntimeException from '../../../../java/lang/RuntimeException.js'\nexport default class AssertionFailedException extends RuntimeException {\n constructor() {\n super()\n AssertionFailedException.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {\n RuntimeException.constructor_.call(this)\n } else if (arguments.length === 1) {\n const message = arguments[0]\n RuntimeException.constructor_.call(this, message)\n }\n }\n}\n","import AssertionFailedException from './AssertionFailedException.js'\nexport default class Assert {\n static shouldNeverReachHere() {\n if (arguments.length === 0) {\n Assert.shouldNeverReachHere(null)\n } else if (arguments.length === 1) {\n const message = arguments[0]\n throw new AssertionFailedException('Should never reach here' + (message !== null ? ': ' + message : ''))\n }\n }\n static isTrue() {\n if (arguments.length === 1) {\n const assertion = arguments[0]\n Assert.isTrue(assertion, null)\n } else if (arguments.length === 2) {\n const assertion = arguments[0], message = arguments[1]\n if (!assertion) \n if (message === null) \n throw new AssertionFailedException()\n else \n throw new AssertionFailedException(message)\n \n \n }\n }\n static equals() {\n if (arguments.length === 2) {\n const expectedValue = arguments[0], actualValue = arguments[1]\n Assert.equals(expectedValue, actualValue, null)\n } else if (arguments.length === 3) {\n const expectedValue = arguments[0], actualValue = arguments[1], message = arguments[2]\n if (!actualValue.equals(expectedValue)) \n throw new AssertionFailedException('Expected ' + expectedValue + ' but encountered ' + actualValue + (message !== null ? ': ' + message : ''))\n \n }\n }\n}\n","import NumberUtil from '../util/NumberUtil.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport Comparator from '../../../../java/util/Comparator.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Assert from '../util/Assert.js'\n\nconst kBuf = new ArrayBuffer(8)\nconst kBufAsF64 = new Float64Array(kBuf)\nconst kBufAsI32 = new Int32Array(kBuf)\n\nexport default class Coordinate {\n constructor() {\n Coordinate.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.x = null\n this.y = null\n this.z = null\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this, 0.0, 0.0)\n } else if (arguments.length === 1) {\n const c = arguments[0]\n Coordinate.constructor_.call(this, c.x, c.y, c.getZ())\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n Coordinate.constructor_.call(this, x, y, Coordinate.NULL_ORDINATE)\n } else if (arguments.length === 3) {\n const x = arguments[0], y = arguments[1], z = arguments[2]\n this.x = x\n this.y = y\n this.z = z\n }\n }\n static hashCode(n) {\n kBufAsF64[0] = n\n return kBufAsI32[0] ^ kBufAsI32[1]\n }\n getM() {\n return Double.NaN\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case Coordinate.X:\n this.x = value\n break\n case Coordinate.Y:\n this.y = value\n break\n case Coordinate.Z:\n this.setZ(value)\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n equals2D() {\n if (arguments.length === 1) {\n const other = arguments[0]\n if (this.x !== other.x) \n return false\n \n if (this.y !== other.y) \n return false\n \n return true\n } else if (arguments.length === 2) {\n const c = arguments[0], tolerance = arguments[1]\n if (!NumberUtil.equalsWithTolerance(this.x, c.x, tolerance)) \n return false\n \n if (!NumberUtil.equalsWithTolerance(this.y, c.y, tolerance)) \n return false\n \n return true\n }\n }\n setM(m) {\n throw new IllegalArgumentException('Invalid ordinate index: ' + Coordinate.M)\n }\n getZ() {\n return this.z\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case Coordinate.X:\n return this.x\n case Coordinate.Y:\n return this.y\n case Coordinate.Z:\n return this.getZ()\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n equals3D(other) {\n return this.x === other.x && this.y === other.y && (this.getZ() === other.getZ() || Double.isNaN(this.getZ()) && Double.isNaN(other.getZ()))\n }\n equals(other) {\n if (!(other instanceof Coordinate)) \n return false\n \n return this.equals2D(other)\n }\n equalInZ(c, tolerance) {\n return NumberUtil.equalsWithTolerance(this.getZ(), c.getZ(), tolerance)\n }\n setX(x) {\n this.x = x\n }\n compareTo(o) {\n const other = o\n if (this.x < other.x) return -1\n if (this.x > other.x) return 1\n if (this.y < other.y) return -1\n if (this.y > other.y) return 1\n return 0\n }\n getX() {\n return this.x\n }\n setZ(z) {\n this.z = z\n }\n clone() {\n try {\n const coord = null\n return coord\n } catch (e) {\n if (e instanceof CloneNotSupportedException) {\n Assert.shouldNeverReachHere('this shouldn\\'t happen because this class is Cloneable')\n return null\n } else {\n throw e\n }\n } finally {}\n }\n copy() {\n return new Coordinate(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ', ' + this.getZ() + ')'\n }\n distance3D(c) {\n const dx = this.x - c.x\n const dy = this.y - c.y\n const dz = this.getZ() - c.getZ()\n return Math.sqrt(dx * dx + dy * dy + dz * dz)\n }\n getY() {\n return this.y\n }\n setY(y) {\n this.y = y\n }\n distance(c) {\n const dx = this.x - c.x\n const dy = this.y - c.y\n return Math.sqrt(dx * dx + dy * dy)\n }\n hashCode() {\n let result = 17\n result = 37 * result + Coordinate.hashCode(this.x)\n result = 37 * result + Coordinate.hashCode(this.y)\n return result\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n }\n get interfaces_() {\n return [Comparable, Cloneable, Serializable]\n }\n}\nclass DimensionalComparator {\n constructor() {\n DimensionalComparator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._dimensionsToTest = 2\n if (arguments.length === 0) {\n DimensionalComparator.constructor_.call(this, 2)\n } else if (arguments.length === 1) {\n const dimensionsToTest = arguments[0]\n if (dimensionsToTest !== 2 && dimensionsToTest !== 3) throw new IllegalArgumentException('only 2 or 3 dimensions may be specified')\n this._dimensionsToTest = dimensionsToTest\n }\n }\n static compare(a, b) {\n if (a < b) return -1\n if (a > b) return 1\n if (Double.isNaN(a)) {\n if (Double.isNaN(b)) return 0\n return -1\n }\n if (Double.isNaN(b)) return 1\n return 0\n }\n compare(c1, c2) {\n const compX = DimensionalComparator.compare(c1.x, c2.x)\n if (compX !== 0) return compX\n const compY = DimensionalComparator.compare(c1.y, c2.y)\n if (compY !== 0) return compY\n if (this._dimensionsToTest <= 2) return 0\n const compZ = DimensionalComparator.compare(c1.getZ(), c2.getZ())\n return compZ\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nCoordinate.DimensionalComparator = DimensionalComparator\nCoordinate.NULL_ORDINATE = Double.NaN\nCoordinate.X = 0\nCoordinate.Y = 1\nCoordinate.Z = 2\nCoordinate.M = 3\n","export default function(o, i) {\n return o.interfaces_ && o.interfaces_.indexOf(i) > -1\n}\n","import Double from '../../../../java/lang/Double.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nexport default class CoordinateSequence {\n getM(index) {\n if (this.hasM()) {\n const mIndex = this.getDimension() - this.getMeasures()\n return this.getOrdinate(index, mIndex)\n } else {\n return Double.NaN\n }\n }\n setOrdinate(index, ordinateIndex, value) {}\n getZ(index) {\n if (this.hasZ()) \n return this.getOrdinate(index, 2)\n else \n return Double.NaN\n \n }\n size() {}\n getOrdinate(index, ordinateIndex) {}\n getCoordinate() {\n if (arguments.length === 1) {\n const i = arguments[0]\n } else if (arguments.length === 2) {\n const index = arguments[0], coord = arguments[1]\n }\n }\n getCoordinateCopy(i) {}\n createCoordinate() {}\n getDimension() {}\n hasM() {\n return this.getMeasures() > 0\n }\n getX(index) {}\n hasZ() {\n return this.getDimension() - this.getMeasures() > 2\n }\n getMeasures() {\n return 0\n }\n expandEnvelope(env) {}\n copy() {}\n getY(index) {}\n toCoordinateArray() {}\n get interfaces_() {\n return [Cloneable]\n }\n}\nCoordinateSequence.X = 0\nCoordinateSequence.Y = 1\nCoordinateSequence.Z = 2\nCoordinateSequence.M = 3\n","import hasInterface from '../../../../hasInterface.js'\nimport CoordinateSequence from './CoordinateSequence.js'\nexport default class CoordinateSequenceFactory {\n create() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordSeq = arguments[0]\n }\n } else if (arguments.length === 2) {\n const size = arguments[0], dimension = arguments[1]\n } else if (arguments.length === 3) {\n const size = arguments[0], dimension = arguments[1], measures = arguments[2]\n return this.create(size, dimension)\n }\n }\n}\n","export default class GeometryComponentFilter {\n filter(geom) {}\n}\n","import Coordinate from './Coordinate.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nexport default class Envelope {\n constructor() {\n Envelope.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._minx = null\n this._maxx = null\n this._miny = null\n this._maxy = null\n if (arguments.length === 0) {\n this.init()\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n this.init(p.x, p.x, p.y, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const env = arguments[0]\n this.init(env)\n }\n } else if (arguments.length === 2) {\n const p1 = arguments[0], p2 = arguments[1]\n this.init(p1.x, p2.x, p1.y, p2.y)\n } else if (arguments.length === 4) {\n const x1 = arguments[0], x2 = arguments[1], y1 = arguments[2], y2 = arguments[3]\n this.init(x1, x2, y1, y2)\n }\n }\n static intersects() {\n if (arguments.length === 3) {\n const p1 = arguments[0], p2 = arguments[1], q = arguments[2]\n if (q.x >= (p1.x < p2.x ? p1.x : p2.x) && q.x <= (p1.x > p2.x ? p1.x : p2.x) && (q.y >= (p1.y < p2.y ? p1.y : p2.y) && q.y <= (p1.y > p2.y ? p1.y : p2.y))) \n return true\n \n return false\n } else if (arguments.length === 4) {\n const p1 = arguments[0], p2 = arguments[1], q1 = arguments[2], q2 = arguments[3]\n let minq = Math.min(q1.x, q2.x)\n let maxq = Math.max(q1.x, q2.x)\n let minp = Math.min(p1.x, p2.x)\n let maxp = Math.max(p1.x, p2.x)\n if (minp > maxq) return false\n if (maxp < minq) return false\n minq = Math.min(q1.y, q2.y)\n maxq = Math.max(q1.y, q2.y)\n minp = Math.min(p1.y, p2.y)\n maxp = Math.max(p1.y, p2.y)\n if (minp > maxq) return false\n if (maxp < minq) return false\n return true\n }\n }\n getArea() {\n return this.getWidth() * this.getHeight()\n }\n equals(other) {\n if (!(other instanceof Envelope)) \n return false\n \n const otherEnvelope = other\n if (this.isNull()) \n return otherEnvelope.isNull()\n \n return this._maxx === otherEnvelope.getMaxX() && this._maxy === otherEnvelope.getMaxY() && this._minx === otherEnvelope.getMinX() && this._miny === otherEnvelope.getMinY()\n }\n intersection(env) {\n if (this.isNull() || env.isNull() || !this.intersects(env)) return new Envelope()\n const intMinX = this._minx > env._minx ? this._minx : env._minx\n const intMinY = this._miny > env._miny ? this._miny : env._miny\n const intMaxX = this._maxx < env._maxx ? this._maxx : env._maxx\n const intMaxY = this._maxy < env._maxy ? this._maxy : env._maxy\n return new Envelope(intMinX, intMaxX, intMinY, intMaxY)\n }\n isNull() {\n return this._maxx < this._minx\n }\n getMaxX() {\n return this._maxx\n }\n covers() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return this.covers(p.x, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n if (this.isNull() || other.isNull()) \n return false\n \n return other.getMinX() >= this._minx && other.getMaxX() <= this._maxx && other.getMinY() >= this._miny && other.getMaxY() <= this._maxy\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n if (this.isNull()) return false\n return x >= this._minx && x <= this._maxx && y >= this._miny && y <= this._maxy\n }\n }\n intersects() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n if (this.isNull() || other.isNull()) \n return false\n \n return !(other._minx > this._maxx || other._maxx < this._minx || other._miny > this._maxy || other._maxy < this._miny)\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return this.intersects(p.x, p.y)\n }\n } else if (arguments.length === 2) {\n if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const a = arguments[0], b = arguments[1]\n if (this.isNull()) \n return false\n \n const envminx = a.x < b.x ? a.x : b.x\n if (envminx > this._maxx) return false\n const envmaxx = a.x > b.x ? a.x : b.x\n if (envmaxx < this._minx) return false\n const envminy = a.y < b.y ? a.y : b.y\n if (envminy > this._maxy) return false\n const envmaxy = a.y > b.y ? a.y : b.y\n if (envmaxy < this._miny) return false\n return true\n } else if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const x = arguments[0], y = arguments[1]\n if (this.isNull()) return false\n return !(x > this._maxx || x < this._minx || y > this._maxy || y < this._miny)\n }\n }\n }\n getMinY() {\n return this._miny\n }\n getDiameter() {\n if (this.isNull()) \n return 0\n \n const w = this.getWidth()\n const h = this.getHeight()\n return Math.sqrt(w * w + h * h)\n }\n getMinX() {\n return this._minx\n }\n expandToInclude() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n this.expandToInclude(p.x, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n if (other.isNull()) \n return null\n \n if (this.isNull()) {\n this._minx = other.getMinX()\n this._maxx = other.getMaxX()\n this._miny = other.getMinY()\n this._maxy = other.getMaxY()\n } else {\n if (other._minx < this._minx) \n this._minx = other._minx\n \n if (other._maxx > this._maxx) \n this._maxx = other._maxx\n \n if (other._miny < this._miny) \n this._miny = other._miny\n \n if (other._maxy > this._maxy) \n this._maxy = other._maxy\n \n }\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n if (this.isNull()) {\n this._minx = x\n this._maxx = x\n this._miny = y\n this._maxy = y\n } else {\n if (x < this._minx) \n this._minx = x\n \n if (x > this._maxx) \n this._maxx = x\n \n if (y < this._miny) \n this._miny = y\n \n if (y > this._maxy) \n this._maxy = y\n \n }\n }\n }\n minExtent() {\n if (this.isNull()) return 0.0\n const w = this.getWidth()\n const h = this.getHeight()\n if (w < h) return w\n return h\n }\n getWidth() {\n if (this.isNull()) \n return 0\n \n return this._maxx - this._minx\n }\n compareTo(o) {\n const env = o\n if (this.isNull()) {\n if (env.isNull()) return 0\n return -1\n } else {\n if (env.isNull()) return 1\n }\n if (this._minx < env._minx) return -1\n if (this._minx > env._minx) return 1\n if (this._miny < env._miny) return -1\n if (this._miny > env._miny) return 1\n if (this._maxx < env._maxx) return -1\n if (this._maxx > env._maxx) return 1\n if (this._maxy < env._maxy) return -1\n if (this._maxy > env._maxy) return 1\n return 0\n }\n translate(transX, transY) {\n if (this.isNull()) \n return null\n \n this.init(this.getMinX() + transX, this.getMaxX() + transX, this.getMinY() + transY, this.getMaxY() + transY)\n }\n copy() {\n return new Envelope(this)\n }\n toString() {\n return 'Env[' + this._minx + ' : ' + this._maxx + ', ' + this._miny + ' : ' + this._maxy + ']'\n }\n setToNull() {\n this._minx = 0\n this._maxx = -1\n this._miny = 0\n this._maxy = -1\n }\n disjoint(other) {\n if (this.isNull() || other.isNull()) \n return true\n \n return other._minx > this._maxx || other._maxx < this._minx || other._miny > this._maxy || other._maxy < this._miny\n }\n getHeight() {\n if (this.isNull()) \n return 0\n \n return this._maxy - this._miny\n }\n maxExtent() {\n if (this.isNull()) return 0.0\n const w = this.getWidth()\n const h = this.getHeight()\n if (w > h) return w\n return h\n }\n expandBy() {\n if (arguments.length === 1) {\n const distance = arguments[0]\n this.expandBy(distance, distance)\n } else if (arguments.length === 2) {\n const deltaX = arguments[0], deltaY = arguments[1]\n if (this.isNull()) return null\n this._minx -= deltaX\n this._maxx += deltaX\n this._miny -= deltaY\n this._maxy += deltaY\n if (this._minx > this._maxx || this._miny > this._maxy) this.setToNull()\n }\n }\n contains() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n return this.covers(other)\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return this.covers(p)\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n return this.covers(x, y)\n }\n }\n centre() {\n if (this.isNull()) return null\n return new Coordinate((this.getMinX() + this.getMaxX()) / 2.0, (this.getMinY() + this.getMaxY()) / 2.0)\n }\n init() {\n if (arguments.length === 0) {\n this.setToNull()\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n this.init(p.x, p.x, p.y, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const env = arguments[0]\n this._minx = env._minx\n this._maxx = env._maxx\n this._miny = env._miny\n this._maxy = env._maxy\n }\n } else if (arguments.length === 2) {\n const p1 = arguments[0], p2 = arguments[1]\n this.init(p1.x, p2.x, p1.y, p2.y)\n } else if (arguments.length === 4) {\n const x1 = arguments[0], x2 = arguments[1], y1 = arguments[2], y2 = arguments[3]\n if (x1 < x2) {\n this._minx = x1\n this._maxx = x2\n } else {\n this._minx = x2\n this._maxx = x1\n }\n if (y1 < y2) {\n this._miny = y1\n this._maxy = y2\n } else {\n this._miny = y2\n this._maxy = y1\n }\n }\n }\n getMaxY() {\n return this._maxy\n }\n distance(env) {\n if (this.intersects(env)) return 0\n let dx = 0.0\n if (this._maxx < env._minx) dx = env._minx - this._maxx; else if (this._minx > env._maxx) dx = this._minx - env._maxx\n let dy = 0.0\n if (this._maxy < env._miny) dy = env._miny - this._maxy; else if (this._miny > env._maxy) dy = this._miny - env._maxy\n if (dx === 0.0) return dy\n if (dy === 0.0) return dx\n return Math.sqrt(dx * dx + dy * dy)\n }\n hashCode() {\n let result = 17\n result = 37 * result + Coordinate.hashCode(this._minx)\n result = 37 * result + Coordinate.hashCode(this._maxx)\n result = 37 * result + Coordinate.hashCode(this._miny)\n result = 37 * result + Coordinate.hashCode(this._maxy)\n return result\n }\n get interfaces_() {\n return [Comparable, Serializable]\n }\n}\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Envelope from './Envelope.js'\nexport default class Geometry {\n constructor() {\n Geometry.constructor_.apply(this, arguments)\n }\n\n isGeometryCollection() {\n return this.getTypeCode() === Geometry.TYPECODE_GEOMETRYCOLLECTION\n }\n\n getFactory() {\n return this._factory\n }\n\n getGeometryN(n) {\n return this\n }\n\n getArea() {\n return 0.0\n }\n\n isRectangle() {\n return false\n }\n\n equalsExact(other) {\n return this === other || this.equalsExact(other, 0)\n }\n\n geometryChanged() {\n this.apply(Geometry.geometryChangedFilter)\n }\n\n geometryChangedAction() {\n this._envelope = null\n }\n\n equalsNorm(g) {\n if (g === null) return false\n return this.norm().equalsExact(g.norm())\n }\n\n getLength() {\n return 0.0\n }\n\n getNumGeometries() {\n return 1\n }\n\n compareTo() {\n let other\n if (arguments.length === 1) {\n const o = arguments[0]\n other = o\n if (this.getTypeCode() !== other.getTypeCode()) return this.getTypeCode() - other.getTypeCode()\n\n if (this.isEmpty() && other.isEmpty()) return 0\n\n if (this.isEmpty()) return -1\n\n if (other.isEmpty()) return 1\n\n return this.compareToSameClass(o)\n } else if (arguments.length === 2) {\n const o = arguments[0]; const comp = arguments[1]\n other = o\n if (this.getTypeCode() !== other.getTypeCode()) return this.getTypeCode() - other.getTypeCode()\n\n if (this.isEmpty() && other.isEmpty()) return 0\n\n if (this.isEmpty()) return -1\n\n if (other.isEmpty()) return 1\n\n return this.compareToSameClass(o, comp)\n }\n }\n\n getUserData() {\n return this._userData\n }\n\n getSRID() {\n return this._SRID\n }\n\n getEnvelope() {\n return this.getFactory().toGeometry(this.getEnvelopeInternal())\n }\n\n checkNotGeometryCollection(g) {\n if (g.getTypeCode() === Geometry.TYPECODE_GEOMETRYCOLLECTION) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n }\n\n equal(a, b, tolerance) {\n if (tolerance === 0) return a.equals(b)\n\n return a.distance(b) <= tolerance\n }\n\n norm() {\n const copy = this.copy()\n copy.normalize()\n return copy\n }\n\n reverse() {\n const res = this.reverseInternal()\n if (this.envelope != null) res.envelope = this.envelope.copy()\n\n res.setSRID(this.getSRID())\n return res\n }\n\n copy() {\n const copy = this.copyInternal()\n copy.envelope = this._envelope == null ? null : this._envelope.copy()\n copy._SRID = this._SRID\n copy._userData = this._userData\n return copy\n }\n\n getPrecisionModel() {\n return this._factory.getPrecisionModel()\n }\n\n getEnvelopeInternal() {\n if (this._envelope === null) this._envelope = this.computeEnvelopeInternal()\n\n return new Envelope(this._envelope)\n }\n\n setSRID(SRID) {\n this._SRID = SRID\n }\n\n setUserData(userData) {\n this._userData = userData\n }\n\n compare(a, b) {\n const i = a.iterator()\n const j = b.iterator()\n while (i.hasNext() && j.hasNext()) {\n const aElement = i.next()\n const bElement = j.next()\n const comparison = aElement.compareTo(bElement)\n if (comparison !== 0) return comparison\n }\n if (i.hasNext()) return 1\n\n if (j.hasNext()) return -1\n\n return 0\n }\n\n hashCode() {\n return this.getEnvelopeInternal().hashCode()\n }\n\n isEquivalentClass(other) {\n return this.getClass() === other.getClass()\n }\n\n isGeometryCollectionOrDerived() {\n if (this.getTypeCode() === Geometry.TYPECODE_GEOMETRYCOLLECTION || this.getTypeCode() === Geometry.TYPECODE_MULTIPOINT || this.getTypeCode() === Geometry.TYPECODE_MULTILINESTRING || this.getTypeCode() === Geometry.TYPECODE_MULTIPOLYGON) return true\n\n return false\n }\n\n get interfaces_() {\n return [Cloneable, Comparable, Serializable]\n }\n\n getClass() {\n return Geometry\n }\n\n static hasNonEmptyElements(geometries) {\n for (let i = 0; i < geometries.length; i++)\n if (!geometries[i].isEmpty()) return true\n\n return false\n }\n\n static hasNullElements(array) {\n for (let i = 0; i < array.length; i++)\n if (array[i] === null) return true\n\n return false\n }\n}\nGeometry.constructor_ = function(factory) {\n if (!factory) return\n this._envelope = null\n this._userData = null\n this._factory = factory\n this._SRID = factory.getSRID()\n}\nGeometry.TYPECODE_POINT = 0\nGeometry.TYPECODE_MULTIPOINT = 1\nGeometry.TYPECODE_LINESTRING = 2\nGeometry.TYPECODE_LINEARRING = 3\nGeometry.TYPECODE_MULTILINESTRING = 4\nGeometry.TYPECODE_POLYGON = 5\nGeometry.TYPECODE_MULTIPOLYGON = 6\nGeometry.TYPECODE_GEOMETRYCOLLECTION = 7\nGeometry.TYPENAME_POINT = 'Point'\nGeometry.TYPENAME_MULTIPOINT = 'MultiPoint'\nGeometry.TYPENAME_LINESTRING = 'LineString'\nGeometry.TYPENAME_LINEARRING = 'LinearRing'\nGeometry.TYPENAME_MULTILINESTRING = 'MultiLineString'\nGeometry.TYPENAME_POLYGON = 'Polygon'\nGeometry.TYPENAME_MULTIPOLYGON = 'MultiPolygon'\nGeometry.TYPENAME_GEOMETRYCOLLECTION = 'GeometryCollection'\nGeometry.geometryChangedFilter = {\n get interfaces_() {\n return [GeometryComponentFilter]\n },\n filter(geom) {\n geom.geometryChangedAction()\n }\n}\n","export default class CoordinateFilter {\n filter(coord) {}\n}\n","export default class Lineal {}\n","import hasInterface from '../../../../hasInterface.js'\nimport Coordinate from './Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport CoordinateSequence from './CoordinateSequence.js'\nexport default class CoordinateSequences {\n static copyCoord(src, srcPos, dest, destPos) {\n const minDim = Math.min(src.getDimension(), dest.getDimension())\n for (let dim = 0; dim < minDim; dim++) \n dest.setOrdinate(destPos, dim, src.getOrdinate(srcPos, dim))\n \n }\n static isRing(seq) {\n const n = seq.size()\n if (n === 0) return true\n if (n <= 3) return false\n return seq.getOrdinate(0, CoordinateSequence.X) === seq.getOrdinate(n - 1, CoordinateSequence.X) && seq.getOrdinate(0, CoordinateSequence.Y) === seq.getOrdinate(n - 1, CoordinateSequence.Y)\n }\n static scroll() {\n if (arguments.length === 2) {\n if (hasInterface(arguments[0], CoordinateSequence) && Number.isInteger(arguments[1])) {\n const seq = arguments[0], indexOfFirstCoordinate = arguments[1]\n CoordinateSequences.scroll(seq, indexOfFirstCoordinate, CoordinateSequences.isRing(seq))\n } else if (hasInterface(arguments[0], CoordinateSequence) && arguments[1] instanceof Coordinate) {\n const seq = arguments[0], firstCoordinate = arguments[1]\n const i = CoordinateSequences.indexOf(firstCoordinate, seq)\n if (i <= 0) return null\n CoordinateSequences.scroll(seq, i)\n }\n } else if (arguments.length === 3) {\n const seq = arguments[0], indexOfFirstCoordinate = arguments[1], ensureRing = arguments[2]\n const i = indexOfFirstCoordinate\n if (i <= 0) return null\n const copy = seq.copy()\n const last = ensureRing ? seq.size() - 1 : seq.size()\n for (let j = 0; j < last; j++) \n for (let k = 0; k < seq.getDimension(); k++) seq.setOrdinate(j, k, copy.getOrdinate((indexOfFirstCoordinate + j) % last, k))\n \n if (ensureRing) \n for (let k = 0; k < seq.getDimension(); k++) seq.setOrdinate(last, k, seq.getOrdinate(0, k))\n \n }\n }\n static isEqual(cs1, cs2) {\n const cs1Size = cs1.size()\n const cs2Size = cs2.size()\n if (cs1Size !== cs2Size) return false\n const dim = Math.min(cs1.getDimension(), cs2.getDimension())\n for (let i = 0; i < cs1Size; i++) \n for (let d = 0; d < dim; d++) {\n const v1 = cs1.getOrdinate(i, d)\n const v2 = cs2.getOrdinate(i, d)\n if (cs1.getOrdinate(i, d) === cs2.getOrdinate(i, d)) continue\n if (Double.isNaN(v1) && Double.isNaN(v2)) continue\n return false\n }\n \n return true\n }\n static minCoordinateIndex() {\n if (arguments.length === 1) {\n const seq = arguments[0]\n return CoordinateSequences.minCoordinateIndex(seq, 0, seq.size() - 1)\n } else if (arguments.length === 3) {\n const seq = arguments[0], from = arguments[1], to = arguments[2]\n let minCoordIndex = -1\n let minCoord = null\n for (let i = from; i <= to; i++) {\n const testCoord = seq.getCoordinate(i)\n if (minCoord === null || minCoord.compareTo(testCoord) > 0) {\n minCoord = testCoord\n minCoordIndex = i\n }\n }\n return minCoordIndex\n }\n }\n static extend(fact, seq, size) {\n const newseq = fact.create(size, seq.getDimension())\n const n = seq.size()\n CoordinateSequences.copy(seq, 0, newseq, 0, n)\n if (n > 0) \n for (let i = n; i < size; i++) CoordinateSequences.copy(seq, n - 1, newseq, i, 1)\n \n return newseq\n }\n static reverse(seq) {\n const last = seq.size() - 1\n const mid = Math.trunc(last / 2)\n for (let i = 0; i <= mid; i++) \n CoordinateSequences.swap(seq, i, last - i)\n \n }\n static swap(seq, i, j) {\n if (i === j) return null\n for (let dim = 0; dim < seq.getDimension(); dim++) {\n const tmp = seq.getOrdinate(i, dim)\n seq.setOrdinate(i, dim, seq.getOrdinate(j, dim))\n seq.setOrdinate(j, dim, tmp)\n }\n }\n static copy(src, srcPos, dest, destPos, length) {\n for (let i = 0; i < length; i++) \n CoordinateSequences.copyCoord(src, srcPos + i, dest, destPos + i)\n \n }\n static ensureValidRing(fact, seq) {\n const n = seq.size()\n if (n === 0) return seq\n if (n <= 3) return CoordinateSequences.createClosedRing(fact, seq, 4)\n const isClosed = seq.getOrdinate(0, CoordinateSequence.X) === seq.getOrdinate(n - 1, CoordinateSequence.X) && seq.getOrdinate(0, CoordinateSequence.Y) === seq.getOrdinate(n - 1, CoordinateSequence.Y)\n if (isClosed) return seq\n return CoordinateSequences.createClosedRing(fact, seq, n + 1)\n }\n static indexOf(coordinate, seq) {\n for (let i = 0; i < seq.size(); i++) \n if (coordinate.x === seq.getOrdinate(i, CoordinateSequence.X) && coordinate.y === seq.getOrdinate(i, CoordinateSequence.Y)) \n return i\n \n \n return -1\n }\n static createClosedRing(fact, seq, size) {\n const newseq = fact.create(size, seq.getDimension())\n const n = seq.size()\n CoordinateSequences.copy(seq, 0, newseq, 0, n)\n for (let i = n; i < size; i++) CoordinateSequences.copy(seq, 0, newseq, i, 1)\n return newseq\n }\n static minCoordinate(seq) {\n let minCoord = null\n for (let i = 0; i < seq.size(); i++) {\n const testCoord = seq.getCoordinate(i)\n if (minCoord === null || minCoord.compareTo(testCoord) > 0) \n minCoord = testCoord\n \n }\n return minCoord\n }\n}\n","import Exception from './Exception.js'\n\nexport default class UnsupportedOperationException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ UnsupportedOperationException })[0]\n }\n}\n","export default class Character {\n static isWhitespace(c) {\n return ((c <= 32 && c >= 0) || c === 127)\n }\n\n static toUpperCase(c) {\n return c.toUpperCase()\n }\n}\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Character from '../../../../java/lang/Character.js'\nexport default class Dimension {\n static toDimensionSymbol(dimensionValue) {\n switch (dimensionValue) {\n case Dimension.FALSE:\n return Dimension.SYM_FALSE\n case Dimension.TRUE:\n return Dimension.SYM_TRUE\n case Dimension.DONTCARE:\n return Dimension.SYM_DONTCARE\n case Dimension.P:\n return Dimension.SYM_P\n case Dimension.L:\n return Dimension.SYM_L\n case Dimension.A:\n return Dimension.SYM_A\n }\n throw new IllegalArgumentException('Unknown dimension value: ' + dimensionValue)\n }\n static toDimensionValue(dimensionSymbol) {\n switch (Character.toUpperCase(dimensionSymbol)) {\n case Dimension.SYM_FALSE:\n return Dimension.FALSE\n case Dimension.SYM_TRUE:\n return Dimension.TRUE\n case Dimension.SYM_DONTCARE:\n return Dimension.DONTCARE\n case Dimension.SYM_P:\n return Dimension.P\n case Dimension.SYM_L:\n return Dimension.L\n case Dimension.SYM_A:\n return Dimension.A\n }\n throw new IllegalArgumentException('Unknown dimension symbol: ' + dimensionSymbol)\n }\n}\nDimension.P = 0\nDimension.L = 1\nDimension.A = 2\nDimension.FALSE = -1\nDimension.TRUE = -2\nDimension.DONTCARE = -3\nDimension.SYM_FALSE = 'F'\nDimension.SYM_TRUE = 'T'\nDimension.SYM_DONTCARE = '*'\nDimension.SYM_P = '0'\nDimension.SYM_L = '1'\nDimension.SYM_A = '2'\n","export default class GeometryFilter {\n filter(geom) {}\n}\n","export default class CoordinateSequenceFilter {\n filter(seq, i) {}\n isDone() {}\n isGeometryChanged() {}\n}\n","import Geometry from './Geometry.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Length from '../algorithm/Length.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Lineal from './Lineal.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport Dimension from './Dimension.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nimport Envelope from './Envelope.js'\nexport default class LineString extends Geometry {\n constructor() {\n super()\n LineString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._points = null\n if (arguments.length === 0) {} else if (arguments.length === 2) {\n const points = arguments[0], factory = arguments[1]\n Geometry.constructor_.call(this, factory)\n this.init(points)\n }\n }\n computeEnvelopeInternal() {\n if (this.isEmpty()) \n return new Envelope()\n \n return this._points.expandEnvelope(new Envelope())\n }\n isRing() {\n return this.isClosed() && this.isSimple()\n }\n getCoordinates() {\n return this._points.toCoordinateArray()\n }\n copyInternal() {\n return new LineString(this._points.copy(), this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n const otherLineString = other\n if (this._points.size() !== otherLineString._points.size()) \n return false\n \n for (let i = 0; i < this._points.size(); i++) \n if (!this.equal(this._points.getCoordinate(i), otherLineString._points.getCoordinate(i), tolerance)) \n return false\n \n \n return true\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {\n for (let i = 0; i < Math.trunc(this._points.size() / 2); i++) {\n const j = this._points.size() - 1 - i\n if (!this._points.getCoordinate(i).equals(this._points.getCoordinate(j))) {\n if (this._points.getCoordinate(i).compareTo(this._points.getCoordinate(j)) > 0) {\n const copy = this._points.copy()\n CoordinateSequences.reverse(copy)\n this._points = copy\n }\n return null\n }\n }\n }\n getCoordinate() {\n if (this.isEmpty()) return null\n return this._points.getCoordinate(0)\n }\n getBoundaryDimension() {\n if (this.isClosed()) \n return Dimension.FALSE\n \n return 0\n }\n isClosed() {\n if (this.isEmpty()) \n return false\n \n return this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints() - 1))\n }\n reverseInternal() {\n const seq = this._points.copy()\n CoordinateSequences.reverse(seq)\n return this.getFactory().createLineString(seq)\n }\n getEndPoint() {\n if (this.isEmpty()) \n return null\n \n return this.getPointN(this.getNumPoints() - 1)\n }\n getTypeCode() {\n return Geometry.TYPECODE_LINESTRING\n }\n getDimension() {\n return 1\n }\n getLength() {\n return Length.ofLine(this._points)\n }\n getNumPoints() {\n return this._points.size()\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const o = arguments[0]\n const line = o\n let i = 0\n let j = 0\n while (i < this._points.size() && j < line._points.size()) {\n const comparison = this._points.getCoordinate(i).compareTo(line._points.getCoordinate(j))\n if (comparison !== 0) \n return comparison\n \n i++\n j++\n }\n if (i < this._points.size()) \n return 1\n \n if (j < line._points.size()) \n return -1\n \n return 0\n } else if (arguments.length === 2) {\n const o = arguments[0], comp = arguments[1]\n const line = o\n return comp.compare(this._points, line._points)\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n for (let i = 0; i < this._points.size(); i++) \n filter.filter(this._points.getCoordinate(i))\n \n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n if (this._points.size() === 0) return null\n for (let i = 0; i < this._points.size(); i++) {\n filter.filter(this._points, i)\n if (filter.isDone()) break\n }\n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n }\n }\n getBoundary() {\n throw new UnsupportedOperationException()\n }\n isEquivalentClass(other) {\n return other instanceof LineString\n }\n getCoordinateN(n) {\n return this._points.getCoordinate(n)\n }\n getGeometryType() {\n return Geometry.TYPENAME_LINESTRING\n }\n getCoordinateSequence() {\n return this._points\n }\n isEmpty() {\n return this._points.size() === 0\n }\n init(points) {\n if (points === null) \n points = this.getFactory().getCoordinateSequenceFactory().create([])\n \n if (points.size() === 1) \n throw new IllegalArgumentException('Invalid number of points in LineString (found ' + points.size() + ' - must be 0 or >= 2)')\n \n this._points = points\n }\n isCoordinate(pt) {\n for (let i = 0; i < this._points.size(); i++) \n if (this._points.getCoordinate(i).equals(pt)) \n return true\n \n \n return false\n }\n getStartPoint() {\n if (this.isEmpty()) \n return null\n \n return this.getPointN(0)\n }\n getPointN(n) {\n return this.getFactory().createPoint(this._points.getCoordinate(n))\n }\n get interfaces_() {\n return [Lineal]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nexport default class Length {\n static ofLine(pts) {\n const n = pts.size()\n if (n <= 1) return 0.0\n let len = 0.0\n const p = new Coordinate()\n pts.getCoordinate(0, p)\n let x0 = p.x\n let y0 = p.y\n for (let i = 1; i < n; i++) {\n pts.getCoordinate(i, p)\n const x1 = p.x\n const y1 = p.y\n const dx = x1 - x0\n const dy = y1 - y0\n len += Math.sqrt(dx * dx + dy * dy)\n x0 = x1\n y0 = y1\n }\n return len\n }\n}\n","export default class Puntal {}\n","import Geometry from './Geometry.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Dimension from './Dimension.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nimport Puntal from './Puntal.js'\nimport Envelope from './Envelope.js'\nimport Assert from '../util/Assert.js'\nexport default class Point extends Geometry {\n constructor() {\n super()\n Point.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._coordinates = null\n const coordinates = arguments[0], factory = arguments[1]\n Geometry.constructor_.call(this, factory)\n this.init(coordinates)\n }\n computeEnvelopeInternal() {\n if (this.isEmpty()) \n return new Envelope()\n \n const env = new Envelope()\n env.expandToInclude(this._coordinates.getX(0), this._coordinates.getY(0))\n return env\n }\n getCoordinates() {\n return this.isEmpty() ? [] : [this.getCoordinate()]\n }\n copyInternal() {\n return new Point(this._coordinates.copy(), this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n if (this.isEmpty() && other.isEmpty()) \n return true\n \n if (this.isEmpty() !== other.isEmpty()) \n return false\n \n return this.equal(other.getCoordinate(), this.getCoordinate(), tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {}\n getCoordinate() {\n return this._coordinates.size() !== 0 ? this._coordinates.getCoordinate(0) : null\n }\n getBoundaryDimension() {\n return Dimension.FALSE\n }\n reverseInternal() {\n return this.getFactory().createPoint(this._coordinates.copy())\n }\n getTypeCode() {\n return Geometry.TYPECODE_POINT\n }\n getDimension() {\n return 0\n }\n getNumPoints() {\n return this.isEmpty() ? 0 : 1\n }\n getX() {\n if (this.getCoordinate() === null) \n throw new IllegalStateException('getX called on empty Point')\n \n return this.getCoordinate().x\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const other = arguments[0]\n const point = other\n return this.getCoordinate().compareTo(point.getCoordinate())\n } else if (arguments.length === 2) {\n const other = arguments[0], comp = arguments[1]\n const point = other\n return comp.compare(this._coordinates, point._coordinates)\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n if (this.isEmpty()) \n return null\n \n filter.filter(this.getCoordinate())\n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n if (this.isEmpty()) return null\n filter.filter(this._coordinates, 0)\n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n }\n }\n getBoundary() {\n return this.getFactory().createGeometryCollection()\n }\n getGeometryType() {\n return Geometry.TYPENAME_POINT\n }\n getCoordinateSequence() {\n return this._coordinates\n }\n getY() {\n if (this.getCoordinate() === null) \n throw new IllegalStateException('getY called on empty Point')\n \n return this.getCoordinate().y\n }\n isEmpty() {\n return this._coordinates.size() === 0\n }\n init(coordinates) {\n if (coordinates === null) \n coordinates = this.getFactory().getCoordinateSequenceFactory().create([])\n \n Assert.isTrue(coordinates.size() <= 1)\n this._coordinates = coordinates\n }\n isSimple() {\n return true\n }\n get interfaces_() {\n return [Puntal]\n }\n}\n","import hasInterface from '../../../../hasInterface.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nexport default class Area {\n static ofRing() {\n if (arguments[0] instanceof Array) {\n const ring = arguments[0]\n return Math.abs(Area.ofRingSigned(ring))\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const ring = arguments[0]\n return Math.abs(Area.ofRingSigned(ring))\n }\n }\n static ofRingSigned() {\n if (arguments[0] instanceof Array) {\n const ring = arguments[0]\n if (ring.length < 3) return 0.0\n let sum = 0.0\n const x0 = ring[0].x\n for (let i = 1; i < ring.length - 1; i++) {\n const x = ring[i].x - x0\n const y1 = ring[i + 1].y\n const y2 = ring[i - 1].y\n sum += x * (y2 - y1)\n }\n return sum / 2.0\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const ring = arguments[0]\n const n = ring.size()\n if (n < 3) return 0.0\n const p0 = new Coordinate()\n const p1 = new Coordinate()\n const p2 = new Coordinate()\n ring.getCoordinate(0, p1)\n ring.getCoordinate(1, p2)\n const x0 = p1.x\n p2.x -= x0\n let sum = 0.0\n for (let i = 1; i < n - 1; i++) {\n p0.y = p1.y\n p1.x = p2.x\n p1.y = p2.y\n ring.getCoordinate(i + 1, p2)\n p2.x -= x0\n sum += p1.x * (p0.y - p2.y)\n }\n return sum / 2.0\n }\n }\n}\n","/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Collection.html\n */\nexport default class Collection {\n /**\n * Ensures that this collection contains the specified element (optional\n * operation).\n * @param {Object} e\n * @return {boolean}\n */\n add() { }\n /**\n * Appends all of the elements in the specified collection to the end of this\n * list, in the order that they are returned by the specified collection's\n * iterator (optional operation).\n * @param {javascript.util.Collection} c\n * @return {boolean}\n */\n addAll() { }\n /**\n * Returns true if this collection contains no elements.\n * @return {boolean}\n */\n isEmpty() { }\n /**\n * Returns an iterator over the elements in this collection.\n * @return {javascript.util.Iterator}\n */\n iterator() { }\n /**\n * Returns an iterator over the elements in this collection.\n * @return {number}\n */\n size() { }\n /**\n * Returns an array containing all of the elements in this collection.\n * @return {Array}\n */\n toArray() { }\n /**\n * Removes a single instance of the specified element from this collection if it\n * is present. (optional)\n * @param {Object} e\n * @return {boolean}\n */\n remove() { }\n}\n","import Exception from './Exception.js'\n\nexport default class IndexOutOfBoundsException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ IndexOutOfBoundsException })[0]\n } \n}","import Collection from './Collection.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/List.html\n */\nexport default class List extends Collection {\n /**\n * Returns the element at the specified position in this list.\n * @param {number} index\n * @return {Object}\n */\n get() { }\n /**\n * Replaces the element at the specified position in this list with the\n * specified element (optional operation).\n * @param {number} index\n * @param {Object} e\n * @return {Object}\n */\n set() { }\n /**\n * Returns true if this collection contains no elements.\n * @return {boolean}\n */\n isEmpty() { }\n}\n","import Exception from '../lang/Exception.js'\n\nexport default class NoSuchElementException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ NoSuchElementException })[0]\n }\n}","import Collection from './Collection.js'\nimport IndexOutOfBoundsException from '../lang/IndexOutOfBoundsException.js'\nimport List from './List.js'\nimport NoSuchElementException from './NoSuchElementException.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html\n */\nexport default class ArrayList extends List {\n\n constructor(o) {\n super()\n this.array = []\n if (o instanceof Collection) this.addAll(o)\n }\n\n get interfaces_() {\n return [List, Collection]\n }\n\n ensureCapacity() { }\n\n add(e) {\n if (arguments.length === 1)\n this.array.push(e)\n else\n this.array.splice(arguments[0], 0, arguments[1])\n return true\n }\n\n clear() {\n this.array = []\n }\n\n addAll(c) {\n for (const e of c)\n this.array.push(e)\n }\n\n set(index, element) {\n const oldElement = this.array[index]\n this.array[index] = element\n return oldElement\n }\n\n iterator() {\n return new Iterator(this)\n }\n\n get(index) {\n if (index < 0 || index >= this.size())\n throw new IndexOutOfBoundsException()\n return this.array[index]\n }\n\n isEmpty() {\n return this.array.length === 0\n }\n\n sort(comparator) {\n if (comparator)\n this.array.sort((a, b) => comparator.compare(a, b))\n else this.array.sort()\n }\n\n size() {\n return this.array.length\n }\n\n toArray() {\n return this.array.slice()\n }\n\n remove(o) {\n for (let i = 0, len = this.array.length; i < len; i++)\n if (this.array[i] === o)\n return !!this.array.splice(i, 1)\n return false\n }\n\n [Symbol.iterator]() {\n return this.array.values()\n }\n}\n\nclass Iterator {\n constructor(arrayList) {\n this.arrayList = arrayList\n this.position = 0\n }\n\n next() {\n if (this.position === this.arrayList.size())\n throw new NoSuchElementException()\n return this.arrayList.get(this.position++)\n }\n\n hasNext() {\n return this.position < this.arrayList.size()\n }\n\n set(element) {\n return this.arrayList.set(this.position - 1, element)\n }\n\n remove() {\n this.arrayList.remove(this.arrayList.get(this.position))\n }\n}\n","import ArrayList from './ArrayList.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Arrays.html\n */\nexport default class Arrays {\n static sort() {\n const a = arguments[0]\n if (arguments.length === 1) {\n a.sort((a, b) => a.compareTo(b))\n } else if (arguments.length === 2) {\n a.sort((a, b) => arguments[1].compare(a, b))\n } else if (arguments.length === 3) {\n const t = a.slice(arguments[1], arguments[2])\n t.sort()\n const r = a.slice(0, arguments[1]).concat(t, a.slice(arguments[2], a.length))\n a.splice(0, a.length)\n for (const e of r)\n a.push(e)\n } else if (arguments.length === 4) {\n const t = a.slice(arguments[1], arguments[2])\n t.sort((a, b) => arguments[3].compare(a, b))\n const r = a.slice(0, arguments[1]).concat(t, a.slice(arguments[2], a.length))\n a.splice(0, a.length)\n for (const e of r)\n a.push(e)\n }\n }\n\n /**\n * @param {Array} array\n * @return {ArrayList}\n */\n static asList(array) {\n const arrayList = new ArrayList()\n for (const e of array)\n arrayList.add(e)\n return arrayList\n }\n\n static copyOf(original, newLength) {\n return original.slice(0, newLength)\n }\n}\n","export default class StringBuffer {\n constructor(str) {\n this.str = str\n }\n append(e) {\n this.str += e\n }\n setCharAt(i, c) {\n this.str = this.str.substr(0, i) + c + this.str.substr(i + 1)\n }\n toString() {\n return this.str\n }\n}","export default class Integer {\n constructor(value) {\n this.value = value\n }\n\n intValue() {\n return this.value\n }\n\n compareTo(o) {\n if (this.value < o)\n return -1\n if (this.value > o)\n return 1\n return 0\n }\n\n static compare(x, y) {\n if (x < y)\n return -1\n if (x > y)\n return 1\n return 0\n }\n\n static isNan(n) {\n return Number.isNaN(n)\n }\n\n static valueOf(value) {\n return new Integer(value)\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Integer from '../../../../java/lang/Integer.js'\nimport Character from '../../../../java/lang/Character.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nexport default class DD {\n constructor() {\n DD.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hi = 0.0\n this._lo = 0.0\n if (arguments.length === 0) {\n this.init(0.0)\n } else if (arguments.length === 1) {\n if (typeof arguments[0] === 'number') {\n const x = arguments[0]\n this.init(x)\n } else if (arguments[0] instanceof DD) {\n const dd = arguments[0]\n this.init(dd)\n } else if (typeof arguments[0] === 'string') {\n const str = arguments[0]\n DD.constructor_.call(this, DD.parse(str))\n }\n } else if (arguments.length === 2) {\n const hi = arguments[0], lo = arguments[1]\n this.init(hi, lo)\n }\n }\n static determinant() {\n if (typeof arguments[3] === 'number' && (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number'))) {\n const x1 = arguments[0], y1 = arguments[1], x2 = arguments[2], y2 = arguments[3]\n return DD.determinant(DD.valueOf(x1), DD.valueOf(y1), DD.valueOf(x2), DD.valueOf(y2))\n } else if (arguments[3] instanceof DD && (arguments[2] instanceof DD && (arguments[0] instanceof DD && arguments[1] instanceof DD))) {\n const x1 = arguments[0], y1 = arguments[1], x2 = arguments[2], y2 = arguments[3]\n const det = x1.multiply(y2).selfSubtract(y1.multiply(x2))\n return det\n }\n }\n static sqr(x) {\n return DD.valueOf(x).selfMultiply(x)\n }\n static valueOf() {\n if (typeof arguments[0] === 'string') {\n const str = arguments[0]\n return DD.parse(str)\n } else if (typeof arguments[0] === 'number') {\n const x = arguments[0]\n return new DD(x)\n }\n }\n static sqrt(x) {\n return DD.valueOf(x).sqrt()\n }\n static parse(str) {\n let i = 0\n const strlen = str.length\n while (Character.isWhitespace(str.charAt(i))) i++\n let isNegative = false\n if (i < strlen) {\n const signCh = str.charAt(i)\n if (signCh === '-' || signCh === '+') {\n i++\n if (signCh === '-') isNegative = true\n }\n }\n const val = new DD()\n let numDigits = 0\n let numBeforeDec = 0\n let exp = 0\n let hasDecimalChar = false\n while (true) {\n if (i >= strlen) break\n const ch = str.charAt(i)\n i++\n if (Character.isDigit(ch)) {\n const d = ch - '0'\n val.selfMultiply(DD.TEN)\n val.selfAdd(d)\n numDigits++\n continue\n }\n if (ch === '.') {\n numBeforeDec = numDigits\n hasDecimalChar = true\n continue\n }\n if (ch === 'e' || ch === 'E') {\n const expStr = str.substring(i)\n try {\n exp = Integer.parseInt(expStr)\n } catch (ex) {\n if (ex instanceof NumberFormatException) \n throw new NumberFormatException('Invalid exponent ' + expStr + ' in string ' + str)\n else throw ex\n } finally {}\n break\n }\n throw new NumberFormatException('Unexpected character \\'' + ch + '\\' at position ' + i + ' in string ' + str)\n }\n let val2 = val\n if (!hasDecimalChar) numBeforeDec = numDigits\n const numDecPlaces = numDigits - numBeforeDec - exp\n if (numDecPlaces === 0) {\n val2 = val\n } else if (numDecPlaces > 0) {\n const scale = DD.TEN.pow(numDecPlaces)\n val2 = val.divide(scale)\n } else if (numDecPlaces < 0) {\n const scale = DD.TEN.pow(-numDecPlaces)\n val2 = val.multiply(scale)\n }\n if (isNegative) \n return val2.negate()\n \n return val2\n }\n static createNaN() {\n return new DD(Double.NaN, Double.NaN)\n }\n static copy(dd) {\n return new DD(dd)\n }\n static magnitude(x) {\n const xAbs = Math.abs(x)\n const xLog10 = Math.log(xAbs) / Math.log(10)\n let xMag = Math.trunc(Math.floor(xLog10))\n const xApprox = Math.pow(10, xMag)\n if (xApprox * 10 <= xAbs) xMag += 1\n return xMag\n }\n static stringOfChar(ch, len) {\n const buf = new StringBuffer()\n for (let i = 0; i < len; i++) \n buf.append(ch)\n \n return buf.toString()\n }\n le(y) {\n return this._hi < y._hi || this._hi === y._hi && this._lo <= y._lo\n }\n extractSignificantDigits(insertDecimalPoint, magnitude) {\n let y = this.abs()\n let mag = DD.magnitude(y._hi)\n const scale = DD.TEN.pow(mag)\n y = y.divide(scale)\n if (y.gt(DD.TEN)) {\n y = y.divide(DD.TEN)\n mag += 1\n } else if (y.lt(DD.ONE)) {\n y = y.multiply(DD.TEN)\n mag -= 1\n }\n const decimalPointPos = mag + 1\n const buf = new StringBuffer()\n const numDigits = DD.MAX_PRINT_DIGITS - 1\n for (let i = 0; i <= numDigits; i++) {\n if (insertDecimalPoint && i === decimalPointPos) \n buf.append('.')\n \n const digit = Math.trunc(y._hi)\n if (digit < 0 || digit > 9) {}\n if (digit < 0) \n break\n \n let rebiasBy10 = false\n let digitChar = 0\n if (digit > 9) {\n rebiasBy10 = true\n digitChar = '9'\n } else {\n digitChar = '0' + digit\n }\n buf.append(digitChar)\n y = y.subtract(DD.valueOf(digit)).multiply(DD.TEN)\n if (rebiasBy10) y.selfAdd(DD.TEN)\n let continueExtractingDigits = true\n const remMag = DD.magnitude(y._hi)\n if (remMag < 0 && Math.abs(remMag) >= numDigits - i) continueExtractingDigits = false\n if (!continueExtractingDigits) break\n }\n magnitude[0] = mag\n return buf.toString()\n }\n sqr() {\n return this.multiply(this)\n }\n doubleValue() {\n return this._hi + this._lo\n }\n subtract() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.add(y.negate())\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return this.add(-y)\n }\n }\n equals() {\n if (arguments.length === 1 && arguments[0] instanceof DD) {\n const y = arguments[0]\n return this._hi === y._hi && this._lo === y._lo\n }\n }\n isZero() {\n return this._hi === 0.0 && this._lo === 0.0\n }\n selfSubtract() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n if (this.isNaN()) return this\n return this.selfAdd(-y._hi, -y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n if (this.isNaN()) return this\n return this.selfAdd(-y, 0.0)\n }\n }\n getSpecialNumberString() {\n if (this.isZero()) return '0.0'\n if (this.isNaN()) return 'NaN '\n return null\n }\n min(x) {\n if (this.le(x)) \n return this\n else \n return x\n \n }\n selfDivide() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.selfDivide(y._hi, y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return this.selfDivide(y, 0.0)\n }\n } else if (arguments.length === 2) {\n const yhi = arguments[0], ylo = arguments[1]\n let hc = null, tc = null, hy = null, ty = null, C = null, c = null, U = null, u = null\n C = this._hi / yhi\n c = DD.SPLIT * C\n hc = c - C\n u = DD.SPLIT * yhi\n hc = c - hc\n tc = C - hc\n hy = u - yhi\n U = C * yhi\n hy = u - hy\n ty = yhi - hy\n u = hc * hy - U + hc * ty + tc * hy + tc * ty\n c = (this._hi - U - u + this._lo - C * ylo) / yhi\n u = C + c\n this._hi = u\n this._lo = C - u + c\n return this\n }\n }\n dump() {\n return 'DD<' + this._hi + ', ' + this._lo + '>'\n }\n divide() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n let hc = null, tc = null, hy = null, ty = null, C = null, c = null, U = null, u = null\n C = this._hi / y._hi\n c = DD.SPLIT * C\n hc = c - C\n u = DD.SPLIT * y._hi\n hc = c - hc\n tc = C - hc\n hy = u - y._hi\n U = C * y._hi\n hy = u - hy\n ty = y._hi - hy\n u = hc * hy - U + hc * ty + tc * hy + tc * ty\n c = (this._hi - U - u + this._lo - C * y._lo) / y._hi\n u = C + c\n const zhi = u\n const zlo = C - u + c\n return new DD(zhi, zlo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n if (Double.isNaN(y)) return DD.createNaN()\n return DD.copy(this).selfDivide(y, 0.0)\n }\n }\n ge(y) {\n return this._hi > y._hi || this._hi === y._hi && this._lo >= y._lo\n }\n pow(exp) {\n if (exp === 0.0) return DD.valueOf(1.0)\n let r = new DD(this)\n let s = DD.valueOf(1.0)\n let n = Math.abs(exp)\n if (n > 1) \n while (n > 0) {\n if (n % 2 === 1) \n s.selfMultiply(r)\n \n n /= 2\n if (n > 0) r = r.sqr()\n }\n else \n s = r\n \n if (exp < 0) return s.reciprocal()\n return s\n }\n ceil() {\n if (this.isNaN()) return DD.NaN\n const fhi = Math.ceil(this._hi)\n let flo = 0.0\n if (fhi === this._hi) \n flo = Math.ceil(this._lo)\n \n return new DD(fhi, flo)\n }\n compareTo(o) {\n const other = o\n if (this._hi < other._hi) return -1\n if (this._hi > other._hi) return 1\n if (this._lo < other._lo) return -1\n if (this._lo > other._lo) return 1\n return 0\n }\n rint() {\n if (this.isNaN()) return this\n const plus5 = this.add(0.5)\n return plus5.floor()\n }\n setValue() {\n if (arguments[0] instanceof DD) {\n const value = arguments[0]\n this.init(value)\n return this\n } else if (typeof arguments[0] === 'number') {\n const value = arguments[0]\n this.init(value)\n return this\n }\n }\n max(x) {\n if (this.ge(x)) \n return this\n else \n return x\n \n }\n sqrt() {\n if (this.isZero()) return DD.valueOf(0.0)\n if (this.isNegative()) \n return DD.NaN\n \n const x = 1.0 / Math.sqrt(this._hi)\n const ax = this._hi * x\n const axdd = DD.valueOf(ax)\n const diffSq = this.subtract(axdd.sqr())\n const d2 = diffSq._hi * (x * 0.5)\n return axdd.add(d2)\n }\n selfAdd() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.selfAdd(y._hi, y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n let H = null, h = null, S = null, s = null, e = null, f = null\n S = this._hi + y\n e = S - this._hi\n s = S - e\n s = y - e + (this._hi - s)\n f = s + this._lo\n H = S + f\n h = f + (S - H)\n this._hi = H + h\n this._lo = h + (H - this._hi)\n return this\n }\n } else if (arguments.length === 2) {\n const yhi = arguments[0], ylo = arguments[1]\n let H = null, h = null, T = null, t = null, S = null, s = null, e = null, f = null\n S = this._hi + yhi\n T = this._lo + ylo\n e = S - this._hi\n f = T - this._lo\n s = S - e\n t = T - f\n s = yhi - e + (this._hi - s)\n t = ylo - f + (this._lo - t)\n e = s + T\n H = S + e\n h = e + (S - H)\n e = t + h\n const zhi = H + e\n const zlo = e + (H - zhi)\n this._hi = zhi\n this._lo = zlo\n return this\n }\n }\n selfMultiply() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.selfMultiply(y._hi, y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return this.selfMultiply(y, 0.0)\n }\n } else if (arguments.length === 2) {\n const yhi = arguments[0], ylo = arguments[1]\n let hx = null, tx = null, hy = null, ty = null, C = null, c = null\n C = DD.SPLIT * this._hi\n hx = C - this._hi\n c = DD.SPLIT * yhi\n hx = C - hx\n tx = this._hi - hx\n hy = c - yhi\n C = this._hi * yhi\n hy = c - hy\n ty = yhi - hy\n c = hx * hy - C + hx * ty + tx * hy + tx * ty + (this._hi * ylo + this._lo * yhi)\n const zhi = C + c\n hx = C - zhi\n const zlo = c + hx\n this._hi = zhi\n this._lo = zlo\n return this\n }\n }\n selfSqr() {\n return this.selfMultiply(this)\n }\n floor() {\n if (this.isNaN()) return DD.NaN\n const fhi = Math.floor(this._hi)\n let flo = 0.0\n if (fhi === this._hi) \n flo = Math.floor(this._lo)\n \n return new DD(fhi, flo)\n }\n negate() {\n if (this.isNaN()) return this\n return new DD(-this._hi, -this._lo)\n }\n clone() {\n try {\n return null\n } catch (ex) {\n if (ex instanceof CloneNotSupportedException) \n return null\n else throw ex\n } finally {}\n }\n multiply() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n if (y.isNaN()) return DD.createNaN()\n return DD.copy(this).selfMultiply(y)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n if (Double.isNaN(y)) return DD.createNaN()\n return DD.copy(this).selfMultiply(y, 0.0)\n }\n }\n isNaN() {\n return Double.isNaN(this._hi)\n }\n intValue() {\n return Math.trunc(this._hi)\n }\n toString() {\n const mag = DD.magnitude(this._hi)\n if (mag >= -3 && mag <= 20) return this.toStandardNotation()\n return this.toSciNotation()\n }\n toStandardNotation() {\n const specialStr = this.getSpecialNumberString()\n if (specialStr !== null) return specialStr\n const magnitude = new Array(1).fill(null)\n const sigDigits = this.extractSignificantDigits(true, magnitude)\n const decimalPointPos = magnitude[0] + 1\n let num = sigDigits\n if (sigDigits.charAt(0) === '.') {\n num = '0' + sigDigits\n } else if (decimalPointPos < 0) {\n num = '0.' + DD.stringOfChar('0', -decimalPointPos) + sigDigits\n } else if (sigDigits.indexOf('.') === -1) {\n const numZeroes = decimalPointPos - sigDigits.length\n const zeroes = DD.stringOfChar('0', numZeroes)\n num = sigDigits + zeroes + '.0'\n }\n if (this.isNegative()) return '-' + num\n return num\n }\n reciprocal() {\n let hc = null, tc = null, hy = null, ty = null, C = null, c = null, U = null, u = null\n C = 1.0 / this._hi\n c = DD.SPLIT * C\n hc = c - C\n u = DD.SPLIT * this._hi\n hc = c - hc\n tc = C - hc\n hy = u - this._hi\n U = C * this._hi\n hy = u - hy\n ty = this._hi - hy\n u = hc * hy - U + hc * ty + tc * hy + tc * ty\n c = (1.0 - U - u - C * this._lo) / this._hi\n const zhi = C + c\n const zlo = C - zhi + c\n return new DD(zhi, zlo)\n }\n toSciNotation() {\n if (this.isZero()) return DD.SCI_NOT_ZERO\n const specialStr = this.getSpecialNumberString()\n if (specialStr !== null) return specialStr\n const magnitude = new Array(1).fill(null)\n const digits = this.extractSignificantDigits(false, magnitude)\n const expStr = DD.SCI_NOT_EXPONENT_CHAR + magnitude[0]\n if (digits.charAt(0) === '0') \n throw new IllegalStateException('Found leading zero: ' + digits)\n \n let trailingDigits = ''\n if (digits.length > 1) trailingDigits = digits.substring(1)\n const digitsWithDecimal = digits.charAt(0) + '.' + trailingDigits\n if (this.isNegative()) return '-' + digitsWithDecimal + expStr\n return digitsWithDecimal + expStr\n }\n abs() {\n if (this.isNaN()) return DD.NaN\n if (this.isNegative()) return this.negate()\n return new DD(this)\n }\n isPositive() {\n return this._hi > 0.0 || this._hi === 0.0 && this._lo > 0.0\n }\n lt(y) {\n return this._hi < y._hi || this._hi === y._hi && this._lo < y._lo\n }\n add() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return DD.copy(this).selfAdd(y)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return DD.copy(this).selfAdd(y)\n }\n }\n init() {\n if (arguments.length === 1) {\n if (typeof arguments[0] === 'number') {\n const x = arguments[0]\n this._hi = x\n this._lo = 0.0\n } else if (arguments[0] instanceof DD) {\n const dd = arguments[0]\n this._hi = dd._hi\n this._lo = dd._lo\n }\n } else if (arguments.length === 2) {\n const hi = arguments[0], lo = arguments[1]\n this._hi = hi\n this._lo = lo\n }\n }\n gt(y) {\n return this._hi > y._hi || this._hi === y._hi && this._lo > y._lo\n }\n isNegative() {\n return this._hi < 0.0 || this._hi === 0.0 && this._lo < 0.0\n }\n trunc() {\n if (this.isNaN()) return DD.NaN\n if (this.isPositive()) return this.floor(); else return this.ceil()\n }\n signum() {\n if (this._hi > 0) return 1\n if (this._hi < 0) return -1\n if (this._lo > 0) return 1\n if (this._lo < 0) return -1\n return 0\n }\n get interfaces_() {\n return [Serializable, Comparable, Cloneable]\n }\n}\nDD.PI = new DD(3.141592653589793116e+00, 1.224646799147353207e-16)\nDD.TWO_PI = new DD(6.283185307179586232e+00, 2.449293598294706414e-16)\nDD.PI_2 = new DD(1.570796326794896558e+00, 6.123233995736766036e-17)\nDD.E = new DD(2.718281828459045091e+00, 1.445646891729250158e-16)\nDD.NaN = new DD(Double.NaN, Double.NaN)\nDD.EPS = 1.23259516440783e-32\nDD.SPLIT = 134217729.0\nDD.MAX_PRINT_DIGITS = 32\nDD.TEN = DD.valueOf(10.0)\nDD.ONE = DD.valueOf(1.0)\nDD.SCI_NOT_EXPONENT_CHAR = 'E'\nDD.SCI_NOT_ZERO = '0.0E0'\n","import Coordinate from '../geom/Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport DD from '../math/DD.js'\nexport default class CGAlgorithmsDD {\n static orientationIndex(p1, p2, q) {\n const index = CGAlgorithmsDD.orientationIndexFilter(p1, p2, q)\n if (index <= 1) return index\n const dx1 = DD.valueOf(p2.x).selfAdd(-p1.x)\n const dy1 = DD.valueOf(p2.y).selfAdd(-p1.y)\n const dx2 = DD.valueOf(q.x).selfAdd(-p2.x)\n const dy2 = DD.valueOf(q.y).selfAdd(-p2.y)\n return dx1.selfMultiply(dy2).selfSubtract(dy1.selfMultiply(dx2)).signum()\n }\n static signOfDet2x2() {\n if (arguments[3] instanceof DD && (arguments[2] instanceof DD && (arguments[0] instanceof DD && arguments[1] instanceof DD))) {\n const x1 = arguments[0], y1 = arguments[1], x2 = arguments[2], y2 = arguments[3]\n const det = x1.multiply(y2).selfSubtract(y1.multiply(x2))\n return det.signum()\n } else if (typeof arguments[3] === 'number' && (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number'))) {\n const dx1 = arguments[0], dy1 = arguments[1], dx2 = arguments[2], dy2 = arguments[3]\n const x1 = DD.valueOf(dx1)\n const y1 = DD.valueOf(dy1)\n const x2 = DD.valueOf(dx2)\n const y2 = DD.valueOf(dy2)\n const det = x1.multiply(y2).selfSubtract(y1.multiply(x2))\n return det.signum()\n }\n }\n static intersection(p1, p2, q1, q2) {\n const px = new DD(p1.y).selfSubtract(p2.y)\n const py = new DD(p2.x).selfSubtract(p1.x)\n const pw = new DD(p1.x).selfMultiply(p2.y).selfSubtract(new DD(p2.x).selfMultiply(p1.y))\n const qx = new DD(q1.y).selfSubtract(q2.y)\n const qy = new DD(q2.x).selfSubtract(q1.x)\n const qw = new DD(q1.x).selfMultiply(q2.y).selfSubtract(new DD(q2.x).selfMultiply(q1.y))\n const x = py.multiply(qw).selfSubtract(qy.multiply(pw))\n const y = qx.multiply(pw).selfSubtract(px.multiply(qw))\n const w = px.multiply(qy).selfSubtract(qx.multiply(py))\n const xInt = x.selfDivide(w).doubleValue()\n const yInt = y.selfDivide(w).doubleValue()\n if (Double.isNaN(xInt) || (Double.isInfinite(xInt) || Double.isNaN(yInt)) || Double.isInfinite(yInt)) \n return null\n \n return new Coordinate(xInt, yInt)\n }\n static orientationIndexFilter(pa, pb, pc) {\n let detsum = null\n const detleft = (pa.x - pc.x) * (pb.y - pc.y)\n const detright = (pa.y - pc.y) * (pb.x - pc.x)\n const det = detleft - detright\n if (detleft > 0.0) \n if (detright <= 0.0) \n return CGAlgorithmsDD.signum(det)\n else \n detsum = detleft + detright\n \n else if (detleft < 0.0) \n if (detright >= 0.0) \n return CGAlgorithmsDD.signum(det)\n else \n detsum = -detleft - detright\n \n else \n return CGAlgorithmsDD.signum(det)\n \n const errbound = CGAlgorithmsDD.DP_SAFE_EPSILON * detsum\n if (det >= errbound || -det >= errbound) \n return CGAlgorithmsDD.signum(det)\n \n return 2\n }\n static signum(x) {\n if (x > 0) return 1\n if (x < 0) return -1\n return 0\n }\n}\nCGAlgorithmsDD.DP_SAFE_EPSILON = 1e-15\n","import hasInterface from '../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport CGAlgorithmsDD from './CGAlgorithmsDD.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nexport default class Orientation {\n static index(p1, p2, q) {\n return CGAlgorithmsDD.orientationIndex(p1, p2, q)\n }\n static isCCW() {\n if (arguments[0] instanceof Array) {\n const ring = arguments[0]\n const nPts = ring.length - 1\n if (nPts < 3) throw new IllegalArgumentException('Ring has fewer than 4 points, so orientation cannot be determined')\n let hiPt = ring[0]\n let hiIndex = 0\n for (let i = 1; i <= nPts; i++) {\n const p = ring[i]\n if (p.y > hiPt.y) {\n hiPt = p\n hiIndex = i\n }\n }\n let iPrev = hiIndex\n do {\n iPrev = iPrev - 1\n if (iPrev < 0) iPrev = nPts\n } while (ring[iPrev].equals2D(hiPt) && iPrev !== hiIndex)\n let iNext = hiIndex\n do \n iNext = (iNext + 1) % nPts\n while (ring[iNext].equals2D(hiPt) && iNext !== hiIndex)\n const prev = ring[iPrev]\n const next = ring[iNext]\n if (prev.equals2D(hiPt) || next.equals2D(hiPt) || prev.equals2D(next)) return false\n const disc = Orientation.index(prev, hiPt, next)\n let isCCW = null\n if (disc === 0) \n isCCW = prev.x > next.x\n else \n isCCW = disc > 0\n \n return isCCW\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const ring = arguments[0]\n const nPts = ring.size() - 1\n if (nPts < 3) throw new IllegalArgumentException('Ring has fewer than 4 points, so orientation cannot be determined')\n let hiPt = ring.getCoordinate(0)\n let hiIndex = 0\n for (let i = 1; i <= nPts; i++) {\n const p = ring.getCoordinate(i)\n if (p.y > hiPt.y) {\n hiPt = p\n hiIndex = i\n }\n }\n let prev = null\n let iPrev = hiIndex\n do {\n iPrev = iPrev - 1\n if (iPrev < 0) iPrev = nPts\n prev = ring.getCoordinate(iPrev)\n } while (prev.equals2D(hiPt) && iPrev !== hiIndex)\n let next = null\n let iNext = hiIndex\n do {\n iNext = (iNext + 1) % nPts\n next = ring.getCoordinate(iNext)\n } while (next.equals2D(hiPt) && iNext !== hiIndex)\n if (prev.equals2D(hiPt) || next.equals2D(hiPt) || prev.equals2D(next)) return false\n const disc = Orientation.index(prev, hiPt, next)\n let isCCW = null\n if (disc === 0) \n isCCW = prev.x > next.x\n else \n isCCW = disc > 0\n \n return isCCW\n }\n }\n}\nOrientation.CLOCKWISE = -1\nOrientation.RIGHT = Orientation.CLOCKWISE\nOrientation.COUNTERCLOCKWISE = 1\nOrientation.LEFT = Orientation.COUNTERCLOCKWISE\nOrientation.COLLINEAR = 0\nOrientation.STRAIGHT = Orientation.COLLINEAR\n","export default class Polygonal {}\n","import Area from '../algorithm/Area.js'\nimport Geometry from './Geometry.js'\nimport Arrays from '../../../../java/util/Arrays.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Polygonal from './Polygonal.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nexport default class Polygon extends Geometry {\n constructor() {\n super()\n Polygon.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._shell = null\n this._holes = null\n let shell = arguments[0], holes = arguments[1], factory = arguments[2]\n Geometry.constructor_.call(this, factory)\n if (shell === null) \n shell = this.getFactory().createLinearRing()\n \n if (holes === null) \n holes = []\n \n if (Geometry.hasNullElements(holes)) \n throw new IllegalArgumentException('holes must not contain null elements')\n \n if (shell.isEmpty() && Geometry.hasNonEmptyElements(holes)) \n throw new IllegalArgumentException('shell is empty but holes are not')\n \n this._shell = shell\n this._holes = holes\n }\n computeEnvelopeInternal() {\n return this._shell.getEnvelopeInternal()\n }\n getCoordinates() {\n if (this.isEmpty()) \n return []\n \n const coordinates = new Array(this.getNumPoints()).fill(null)\n let k = -1\n const shellCoordinates = this._shell.getCoordinates()\n for (let x = 0; x < shellCoordinates.length; x++) {\n k++\n coordinates[k] = shellCoordinates[x]\n }\n for (let i = 0; i < this._holes.length; i++) {\n const childCoordinates = this._holes[i].getCoordinates()\n for (let j = 0; j < childCoordinates.length; j++) {\n k++\n coordinates[k] = childCoordinates[j]\n }\n }\n return coordinates\n }\n getArea() {\n let area = 0.0\n area += Area.ofRing(this._shell.getCoordinateSequence())\n for (let i = 0; i < this._holes.length; i++) \n area -= Area.ofRing(this._holes[i].getCoordinateSequence())\n \n return area\n }\n copyInternal() {\n const shellCopy = this._shell.copy()\n const holeCopies = new Array(this._holes.length).fill(null)\n for (let i = 0; i < this._holes.length; i++) \n holeCopies[i] = this._holes[i].copy()\n \n return new Polygon(shellCopy, holeCopies, this._factory)\n }\n isRectangle() {\n if (this.getNumInteriorRing() !== 0) return false\n if (this._shell === null) return false\n if (this._shell.getNumPoints() !== 5) return false\n const seq = this._shell.getCoordinateSequence()\n const env = this.getEnvelopeInternal()\n for (let i = 0; i < 5; i++) {\n const x = seq.getX(i)\n if (!(x === env.getMinX() || x === env.getMaxX())) return false\n const y = seq.getY(i)\n if (!(y === env.getMinY() || y === env.getMaxY())) return false\n }\n let prevX = seq.getX(0)\n let prevY = seq.getY(0)\n for (let i = 1; i <= 4; i++) {\n const x = seq.getX(i)\n const y = seq.getY(i)\n const xChanged = x !== prevX\n const yChanged = y !== prevY\n if (xChanged === yChanged) return false\n prevX = x\n prevY = y\n }\n return true\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n const otherPolygon = other\n const thisShell = this._shell\n const otherPolygonShell = otherPolygon._shell\n if (!thisShell.equalsExact(otherPolygonShell, tolerance)) \n return false\n \n if (this._holes.length !== otherPolygon._holes.length) \n return false\n \n for (let i = 0; i < this._holes.length; i++) \n if (!this._holes[i].equalsExact(otherPolygon._holes[i], tolerance)) \n return false\n \n \n return true\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {\n if (arguments.length === 0) {\n this._shell = this.normalized(this._shell, true)\n for (let i = 0; i < this._holes.length; i++) \n this._holes[i] = this.normalized(this._holes[i], false)\n \n Arrays.sort(this._holes)\n } else if (arguments.length === 2) {\n const ring = arguments[0], clockwise = arguments[1]\n if (ring.isEmpty()) \n return null\n \n const seq = ring.getCoordinateSequence()\n const minCoordinateIndex = CoordinateSequences.minCoordinateIndex(seq, 0, seq.size() - 2)\n CoordinateSequences.scroll(seq, minCoordinateIndex, true)\n if (Orientation.isCCW(seq) === clockwise) CoordinateSequences.reverse(seq)\n }\n }\n getCoordinate() {\n return this._shell.getCoordinate()\n }\n getNumInteriorRing() {\n return this._holes.length\n }\n getBoundaryDimension() {\n return 1\n }\n reverseInternal() {\n const shell = this.getExteriorRing().reverse()\n const holes = new Array(this.getNumInteriorRing()).fill(null)\n for (let i = 0; i < holes.length; i++) \n holes[i] = this.getInteriorRingN(i).reverse()\n \n return this.getFactory().createPolygon(shell, holes)\n }\n getTypeCode() {\n return Geometry.TYPECODE_POLYGON\n }\n getDimension() {\n return 2\n }\n getLength() {\n let len = 0.0\n len += this._shell.getLength()\n for (let i = 0; i < this._holes.length; i++) \n len += this._holes[i].getLength()\n \n return len\n }\n getNumPoints() {\n let numPoints = this._shell.getNumPoints()\n for (let i = 0; i < this._holes.length; i++) \n numPoints += this._holes[i].getNumPoints()\n \n return numPoints\n }\n convexHull() {\n return this.getExteriorRing().convexHull()\n }\n normalized(ring, clockwise) {\n const res = ring.copy()\n this.normalize(res, clockwise)\n return res\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const o = arguments[0]\n const thisShell = this._shell\n const otherShell = o._shell\n return thisShell.compareToSameClass(otherShell)\n } else if (arguments.length === 2) {\n const o = arguments[0], comp = arguments[1]\n const poly = o\n const thisShell = this._shell\n const otherShell = poly._shell\n const shellComp = thisShell.compareToSameClass(otherShell, comp)\n if (shellComp !== 0) return shellComp\n const nHole1 = this.getNumInteriorRing()\n const nHole2 = poly.getNumInteriorRing()\n let i = 0\n while (i < nHole1 && i < nHole2) {\n const thisHole = this.getInteriorRingN(i)\n const otherHole = poly.getInteriorRingN(i)\n const holeComp = thisHole.compareToSameClass(otherHole, comp)\n if (holeComp !== 0) return holeComp\n i++\n }\n if (i < nHole1) return 1\n if (i < nHole2) return -1\n return 0\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n this._shell.apply(filter)\n for (let i = 0; i < this._holes.length; i++) \n this._holes[i].apply(filter)\n \n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n this._shell.apply(filter)\n if (!filter.isDone()) \n for (let i = 0; i < this._holes.length; i++) {\n this._holes[i].apply(filter)\n if (filter.isDone()) break\n }\n \n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n this._shell.apply(filter)\n for (let i = 0; i < this._holes.length; i++) \n this._holes[i].apply(filter)\n \n }\n }\n getBoundary() {\n if (this.isEmpty()) \n return this.getFactory().createMultiLineString()\n \n const rings = new Array(this._holes.length + 1).fill(null)\n rings[0] = this._shell\n for (let i = 0; i < this._holes.length; i++) \n rings[i + 1] = this._holes[i]\n \n if (rings.length <= 1) return this.getFactory().createLinearRing(rings[0].getCoordinateSequence())\n return this.getFactory().createMultiLineString(rings)\n }\n getGeometryType() {\n return Geometry.TYPENAME_POLYGON\n }\n getExteriorRing() {\n return this._shell\n }\n isEmpty() {\n return this._shell.isEmpty()\n }\n getInteriorRingN(n) {\n return this._holes[n]\n }\n get interfaces_() {\n return [Polygonal]\n }\n}\n","import Collection from './Collection.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Set.html\n *\n * @extends {Collection}\n * @constructor\n * @private\n */\nexport default class Set extends Collection {\n /**\n * Returns true if this set contains the specified element. More formally,\n * returns true if and only if this set contains an element e such that (o==null ?\n * e==null : o.equals(e)).\n * @param {Object} e\n * @return {boolean}\n */\n contains() { }\n}\n","import Set from './Set.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html\n */\nexport default class SortedSet extends Set {}\n","import Collection from './Collection.js'\nimport NoSuchElementException from './NoSuchElementException.js'\nimport UnsupportedOperationException from '../lang/UnsupportedOperationException.js'\nimport SortedSet from './SortedSet.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/TreeSet.html\n */\nexport default class TreeSet extends SortedSet {\n constructor(o) {\n super()\n this.array = []\n if (o instanceof Collection)\n this.addAll(o)\n }\n\n contains(o) {\n for (const e of this.array)\n if (e.compareTo(o) === 0)\n return true\n return false\n }\n\n add(o) {\n if (this.contains(o))\n return false\n for (let i = 0, len = this.array.length; i < len; i++) {\n const e = this.array[i]\n if (e.compareTo(o) === 1)\n return !!this.array.splice(i, 0, o)\n }\n this.array.push(o)\n return true\n }\n\n addAll(c) {\n for (const e of c)\n this.add(e)\n return true\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n\n size() {\n return this.array.length\n }\n\n isEmpty() {\n return this.array.length === 0\n }\n\n toArray() {\n return this.array.slice()\n }\n\n iterator() {\n return new Iterator(this.array)\n }\n}\n\nclass Iterator {\n constructor(array) {\n this.array = array\n this.position = 0\n }\n\n next() {\n if (this.position === this.array.length)\n throw new NoSuchElementException()\n return this.array[this.position++]\n }\n\n hasNext() {\n return this.position < this.array.length\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n}\n","import TreeSet from '../../../../java/util/TreeSet.js'\nimport Geometry from './Geometry.js'\nimport Arrays from '../../../../java/util/Arrays.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Dimension from './Dimension.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nimport Envelope from './Envelope.js'\nimport Assert from '../util/Assert.js'\nexport default class GeometryCollection extends Geometry {\n constructor() {\n super()\n GeometryCollection.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geometries = null\n if (arguments.length === 0) {} else if (arguments.length === 2) {\n let geometries = arguments[0], factory = arguments[1]\n Geometry.constructor_.call(this, factory)\n if (geometries === null) \n geometries = []\n \n if (Geometry.hasNullElements(geometries)) \n throw new IllegalArgumentException('geometries must not contain null elements')\n \n this._geometries = geometries\n }\n }\n computeEnvelopeInternal() {\n const envelope = new Envelope()\n for (let i = 0; i < this._geometries.length; i++) \n envelope.expandToInclude(this._geometries[i].getEnvelopeInternal())\n \n return envelope\n }\n getGeometryN(n) {\n return this._geometries[n]\n }\n getCoordinates() {\n const coordinates = new Array(this.getNumPoints()).fill(null)\n let k = -1\n for (let i = 0; i < this._geometries.length; i++) {\n const childCoordinates = this._geometries[i].getCoordinates()\n for (let j = 0; j < childCoordinates.length; j++) {\n k++\n coordinates[k] = childCoordinates[j]\n }\n }\n return coordinates\n }\n getArea() {\n let area = 0.0\n for (let i = 0; i < this._geometries.length; i++) \n area += this._geometries[i].getArea()\n \n return area\n }\n copyInternal() {\n const geometries = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < geometries.length; i++) \n geometries[i] = this._geometries[i].copy()\n \n return new GeometryCollection(geometries, this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n const otherCollection = other\n if (this._geometries.length !== otherCollection._geometries.length) \n return false\n \n for (let i = 0; i < this._geometries.length; i++) \n if (!this._geometries[i].equalsExact(otherCollection._geometries[i], tolerance)) \n return false\n \n \n return true\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].normalize()\n \n Arrays.sort(this._geometries)\n }\n getCoordinate() {\n if (this.isEmpty()) return null\n return this._geometries[0].getCoordinate()\n }\n getBoundaryDimension() {\n let dimension = Dimension.FALSE\n for (let i = 0; i < this._geometries.length; i++) \n dimension = Math.max(dimension, this._geometries[i].getBoundaryDimension())\n \n return dimension\n }\n reverseInternal() {\n const numGeometries = this._geometries.length\n const reversed = new ArrayList(numGeometries)\n for (let i = 0; i < numGeometries; i++) \n reversed.add(this._geometries[i].reverse())\n \n return this.getFactory().buildGeometry(reversed)\n }\n getTypeCode() {\n return Geometry.TYPECODE_GEOMETRYCOLLECTION\n }\n getDimension() {\n let dimension = Dimension.FALSE\n for (let i = 0; i < this._geometries.length; i++) \n dimension = Math.max(dimension, this._geometries[i].getDimension())\n \n return dimension\n }\n getLength() {\n let sum = 0.0\n for (let i = 0; i < this._geometries.length; i++) \n sum += this._geometries[i].getLength()\n \n return sum\n }\n getNumPoints() {\n let numPoints = 0\n for (let i = 0; i < this._geometries.length; i++) \n numPoints += this._geometries[i].getNumPoints()\n \n return numPoints\n }\n getNumGeometries() {\n return this._geometries.length\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const o = arguments[0]\n const theseElements = new TreeSet(Arrays.asList(this._geometries))\n const otherElements = new TreeSet(Arrays.asList(o._geometries))\n return this.compare(theseElements, otherElements)\n } else if (arguments.length === 2) {\n const o = arguments[0], comp = arguments[1]\n const gc = o\n const n1 = this.getNumGeometries()\n const n2 = gc.getNumGeometries()\n let i = 0\n while (i < n1 && i < n2) {\n const thisGeom = this.getGeometryN(i)\n const otherGeom = gc.getGeometryN(i)\n const holeComp = thisGeom.compareToSameClass(otherGeom, comp)\n if (holeComp !== 0) return holeComp\n i++\n }\n if (i < n1) return 1\n if (i < n2) return -1\n return 0\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].apply(filter)\n \n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n if (this._geometries.length === 0) return null\n for (let i = 0; i < this._geometries.length; i++) {\n this._geometries[i].apply(filter)\n if (filter.isDone()) \n break\n \n }\n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].apply(filter)\n \n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].apply(filter)\n \n }\n }\n getBoundary() {\n Geometry.checkNotGeometryCollection(this)\n Assert.shouldNeverReachHere()\n return null\n }\n getGeometryType() {\n return Geometry.TYPENAME_GEOMETRYCOLLECTION\n }\n isEmpty() {\n for (let i = 0; i < this._geometries.length; i++) \n if (!this._geometries[i].isEmpty()) \n return false\n \n \n return true\n }\n}\n","import Geometry from './Geometry.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport Dimension from './Dimension.js'\nimport Puntal from './Puntal.js'\nexport default class MultiPoint extends GeometryCollection {\n constructor() {\n super()\n MultiPoint.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const points = arguments[0], factory = arguments[1]\n GeometryCollection.constructor_.call(this, points, factory)\n }\n copyInternal() {\n const points = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < points.length; i++) \n points[i] = this._geometries[i].copy()\n \n return new MultiPoint(points, this._factory)\n }\n isValid() {\n return true\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n return super.equalsExact.call(this, other, tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n getCoordinate() {\n if (arguments.length === 1 && Number.isInteger(arguments[0])) {\n const n = arguments[0]\n return this._geometries[n].getCoordinate()\n } else {\n return super.getCoordinate.apply(this, arguments)\n }\n }\n getBoundaryDimension() {\n return Dimension.FALSE\n }\n getTypeCode() {\n return Geometry.TYPECODE_MULTIPOINT\n }\n getDimension() {\n return 0\n }\n getBoundary() {\n return this.getFactory().createGeometryCollection()\n }\n getGeometryType() {\n return Geometry.TYPENAME_MULTIPOINT\n }\n get interfaces_() {\n return [Puntal]\n }\n}\n","import LineString from './LineString.js'\nimport Geometry from './Geometry.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport Dimension from './Dimension.js'\nexport default class LinearRing extends LineString {\n constructor() {\n super()\n LinearRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const points = arguments[0], factory = arguments[1]\n LineString.constructor_.call(this, points, factory)\n this.validateConstruction()\n }\n copyInternal() {\n return new LinearRing(this._points.copy(), this._factory)\n }\n getBoundaryDimension() {\n return Dimension.FALSE\n }\n isClosed() {\n if (this.isEmpty()) \n return true\n \n return super.isClosed.call(this)\n }\n reverseInternal() {\n const seq = this._points.copy()\n CoordinateSequences.reverse(seq)\n return this.getFactory().createLinearRing(seq)\n }\n getTypeCode() {\n return Geometry.TYPECODE_LINEARRING\n }\n validateConstruction() {\n if (!this.isEmpty() && !super.isClosed.call(this)) \n throw new IllegalArgumentException('Points of LinearRing do not form a closed linestring')\n \n if (this.getCoordinateSequence().size() >= 1 && this.getCoordinateSequence().size() < LinearRing.MINIMUM_VALID_SIZE) \n throw new IllegalArgumentException('Invalid number of points in LinearRing (found ' + this.getCoordinateSequence().size() + ' - must be 0 or >= 4)')\n \n }\n getGeometryType() {\n return Geometry.TYPENAME_LINEARRING\n }\n}\nLinearRing.MINIMUM_VALID_SIZE = 4\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class CoordinateXY extends Coordinate {\n constructor() {\n super()\n CoordinateXY.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this)\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof CoordinateXY) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n Coordinate.constructor_.call(this, x, y, Coordinate.NULL_ORDINATE)\n }\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case CoordinateXY.X:\n this.x = value\n break\n case CoordinateXY.Y:\n this.y = value\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n getZ() {\n return Coordinate.NULL_ORDINATE\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case CoordinateXY.X:\n return this.x\n case CoordinateXY.Y:\n return this.y\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n setZ(z) {\n throw new IllegalArgumentException('CoordinateXY dimension 2 does not support z-ordinate')\n }\n copy() {\n return new CoordinateXY(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ')'\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n }\n}\nCoordinateXY.X = 0\nCoordinateXY.Y = 1\nCoordinateXY.Z = -1\nCoordinateXY.M = -1\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class CoordinateXYM extends Coordinate {\n constructor() {\n super()\n CoordinateXYM.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._m = null\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this)\n this._m = 0.0\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof CoordinateXYM) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n this._m = coord._m\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n this._m = this.getM()\n }\n } else if (arguments.length === 3) {\n const x = arguments[0], y = arguments[1], m = arguments[2]\n Coordinate.constructor_.call(this, x, y, Coordinate.NULL_ORDINATE)\n this._m = m\n }\n }\n getM() {\n return this._m\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case CoordinateXYM.X:\n this.x = value\n break\n case CoordinateXYM.Y:\n this.y = value\n break\n case CoordinateXYM.M:\n this._m = value\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n setM(m) {\n this._m = m\n }\n getZ() {\n return Coordinate.NULL_ORDINATE\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case CoordinateXYM.X:\n return this.x\n case CoordinateXYM.Y:\n return this.y\n case CoordinateXYM.M:\n return this._m\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n setZ(z) {\n throw new IllegalArgumentException('CoordinateXY dimension 2 does not support z-ordinate')\n }\n copy() {\n return new CoordinateXYM(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ' m=' + this.getM() + ')'\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n this._m = other.getM()\n }\n}\nCoordinateXYM.X = 0\nCoordinateXYM.Y = 1\nCoordinateXYM.Z = -1\nCoordinateXYM.M = 2\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class CoordinateXYZM extends Coordinate {\n constructor() {\n super()\n CoordinateXYZM.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._m = null\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this)\n this._m = 0.0\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof CoordinateXYZM) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord)\n this._m = coord._m\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord)\n this._m = this.getM()\n }\n } else if (arguments.length === 4) {\n const x = arguments[0], y = arguments[1], z = arguments[2], m = arguments[3]\n Coordinate.constructor_.call(this, x, y, z)\n this._m = m\n }\n }\n getM() {\n return this._m\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case Coordinate.X:\n this.x = value\n break\n case Coordinate.Y:\n this.y = value\n break\n case Coordinate.Z:\n this.z = value\n break\n case Coordinate.M:\n this._m = value\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n setM(m) {\n this._m = m\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case Coordinate.X:\n return this.x\n case Coordinate.Y:\n return this.y\n case Coordinate.Z:\n return this.getZ()\n case Coordinate.M:\n return this.getM()\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n copy() {\n return new CoordinateXYZM(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ', ' + this.getZ() + ' m=' + this.getM() + ')'\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n this._m = other.getM()\n }\n}\n","import CoordinateXY from './CoordinateXY.js'\nimport Coordinate from './Coordinate.js'\nimport CoordinateXYM from './CoordinateXYM.js'\nimport CoordinateXYZM from './CoordinateXYZM.js'\nexport default class Coordinates {\n static measures(coordinate) {\n if (coordinate instanceof CoordinateXY) \n return 0\n else if (coordinate instanceof CoordinateXYM) \n return 1\n else if (coordinate instanceof CoordinateXYZM) \n return 1\n else if (coordinate instanceof Coordinate) \n return 0\n \n return 0\n }\n static dimension(coordinate) {\n if (coordinate instanceof CoordinateXY) \n return 2\n else if (coordinate instanceof CoordinateXYM) \n return 3\n else if (coordinate instanceof CoordinateXYZM) \n return 4\n else if (coordinate instanceof Coordinate) \n return 3\n \n return 3\n }\n static create() {\n if (arguments.length === 1) {\n const dimension = arguments[0]\n return Coordinates.create(dimension, 0)\n } else if (arguments.length === 2) {\n const dimension = arguments[0], measures = arguments[1]\n if (dimension === 2) \n return new CoordinateXY()\n else if (dimension === 3 && measures === 0) \n return new Coordinate()\n else if (dimension === 3 && measures === 1) \n return new CoordinateXYM()\n else if (dimension === 4 && measures === 1) \n return new CoordinateXYZM()\n \n return new Coordinate()\n }\n }\n}\n","import hasInterface from '../../../../hasInterface.js'\nimport Collection from '../../../../java/util/Collection.js'\nimport Coordinate from './Coordinate.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class CoordinateList extends ArrayList {\n constructor() {\n super()\n CoordinateList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const coord = arguments[0]\n this.ensureCapacity(coord.length)\n this.add(coord, true)\n } else if (arguments.length === 2) {\n const coord = arguments[0], allowRepeated = arguments[1]\n this.ensureCapacity(coord.length)\n this.add(coord, allowRepeated)\n }\n }\n getCoordinate(i) {\n return this.get(i)\n }\n addAll() {\n if (arguments.length === 2 && (typeof arguments[1] === 'boolean' && hasInterface(arguments[0], Collection))) {\n const coll = arguments[0], allowRepeated = arguments[1]\n let isChanged = false\n for (let i = coll.iterator(); i.hasNext(); ) {\n this.add(i.next(), allowRepeated)\n isChanged = true\n }\n return isChanged\n } else {\n return super.addAll.apply(this, arguments)\n }\n }\n clone() {\n const clone = super.clone.call(this)\n for (let i = 0; i < this.size(); i++) \n clone.add(i, this.get(i).clone())\n \n return clone\n }\n toCoordinateArray() {\n if (arguments.length === 0) {\n return this.toArray(CoordinateList.coordArrayType)\n } else if (arguments.length === 1) {\n const isForward = arguments[0]\n if (isForward) \n return this.toArray(CoordinateList.coordArrayType)\n \n const size = this.size()\n const pts = new Array(size).fill(null)\n for (let i = 0; i < size; i++) \n pts[i] = this.get(size - i - 1)\n \n return pts\n }\n }\n add() {\n if (arguments.length === 1) {\n const coord = arguments[0]\n return super.add.call(this, coord)\n } else if (arguments.length === 2) {\n if (arguments[0] instanceof Array && typeof arguments[1] === 'boolean') {\n const coord = arguments[0], allowRepeated = arguments[1]\n this.add(coord, allowRepeated, true)\n return true\n } else if (arguments[0] instanceof Coordinate && typeof arguments[1] === 'boolean') {\n const coord = arguments[0], allowRepeated = arguments[1]\n if (!allowRepeated) \n if (this.size() >= 1) {\n const last = this.get(this.size() - 1)\n if (last.equals2D(coord)) return null\n }\n \n super.add.call(this, coord)\n } else if (arguments[0] instanceof Object && typeof arguments[1] === 'boolean') {\n const obj = arguments[0], allowRepeated = arguments[1]\n this.add(obj, allowRepeated)\n return true\n }\n } else if (arguments.length === 3) {\n if (typeof arguments[2] === 'boolean' && (arguments[0] instanceof Array && typeof arguments[1] === 'boolean')) {\n const coord = arguments[0], allowRepeated = arguments[1], direction = arguments[2]\n if (direction) \n for (let i = 0; i < coord.length; i++) \n this.add(coord[i], allowRepeated)\n \n else \n for (let i = coord.length - 1; i >= 0; i--) \n this.add(coord[i], allowRepeated)\n \n \n return true\n } else if (typeof arguments[2] === 'boolean' && (Number.isInteger(arguments[0]) && arguments[1] instanceof Coordinate)) {\n const i = arguments[0], coord = arguments[1], allowRepeated = arguments[2]\n if (!allowRepeated) {\n const size = this.size()\n if (size > 0) {\n if (i > 0) {\n const prev = this.get(i - 1)\n if (prev.equals2D(coord)) return null\n }\n if (i < size) {\n const next = this.get(i)\n if (next.equals2D(coord)) return null\n }\n }\n }\n super.add.call(this, i, coord)\n }\n } else if (arguments.length === 4) {\n const coord = arguments[0], allowRepeated = arguments[1], start = arguments[2], end = arguments[3]\n let inc = 1\n if (start > end) inc = -1\n for (let i = start; i !== end; i += inc) \n this.add(coord[i], allowRepeated)\n \n return true\n }\n }\n closeRing() {\n if (this.size() > 0) {\n const duplicate = this.get(0).copy()\n this.add(duplicate, false)\n }\n }\n}\nCoordinateList.coordArrayType = new Array(0).fill(null)\n","import Double from '../../../../java/lang/Double.js'\nexport default class MathUtil {\n static log10(x) {\n const ln = Math.log(x)\n if (Double.isInfinite(ln)) return ln\n if (Double.isNaN(ln)) return ln\n return ln / MathUtil.LOG_10\n }\n static min(v1, v2, v3, v4) {\n let min = v1\n if (v2 < min) min = v2\n if (v3 < min) min = v3\n if (v4 < min) min = v4\n return min\n }\n static clamp() {\n if (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number')) {\n const x = arguments[0], min = arguments[1], max = arguments[2]\n if (x < min) return min\n if (x > max) return max\n return x\n } else if (Number.isInteger(arguments[2]) && (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1]))) {\n const x = arguments[0], min = arguments[1], max = arguments[2]\n if (x < min) return min\n if (x > max) return max\n return x\n }\n }\n static wrap(index, max) {\n if (index < 0) \n return max - -index % max\n \n return index % max\n }\n static max() {\n if (arguments.length === 3) {\n const v1 = arguments[0], v2 = arguments[1], v3 = arguments[2]\n let max = v1\n if (v2 > max) max = v2\n if (v3 > max) max = v3\n return max\n } else if (arguments.length === 4) {\n const v1 = arguments[0], v2 = arguments[1], v3 = arguments[2], v4 = arguments[3]\n let max = v1\n if (v2 > max) max = v2\n if (v3 > max) max = v3\n if (v4 > max) max = v4\n return max\n }\n }\n static average(x1, x2) {\n return (x1 + x2) / 2.0\n }\n}\nMathUtil.LOG_10 = Math.log(10)\n","export default class System {\n static arraycopy(src, srcPos, dest, destPos, len) {\n let c = 0\n for (let i = srcPos; i < srcPos + len; i++) {\n dest[destPos + c] = src[i]\n c++\n }\n }\n\n static getProperty(name) {\n return {\n 'line.separator': '\\n'\n }[name]\n }\n}\n","import CoordinateList from './CoordinateList.js'\nimport Coordinates from './Coordinates.js'\nimport MathUtil from '../math/MathUtil.js'\nimport System from '../../../../java/lang/System.js'\nimport Comparator from '../../../../java/util/Comparator.js'\nimport Envelope from './Envelope.js'\nexport default class CoordinateArrays {\n static isRing(pts) {\n if (pts.length < 4) return false\n if (!pts[0].equals2D(pts[pts.length - 1])) return false\n return true\n }\n static ptNotInList(testPts, pts) {\n for (let i = 0; i < testPts.length; i++) {\n const testPt = testPts[i]\n if (CoordinateArrays.indexOf(testPt, pts) < 0) return testPt\n }\n return null\n }\n static scroll(coordinates, firstCoordinate) {\n const i = CoordinateArrays.indexOf(firstCoordinate, coordinates)\n if (i < 0) return null\n const newCoordinates = new Array(coordinates.length).fill(null)\n System.arraycopy(coordinates, i, newCoordinates, 0, coordinates.length - i)\n System.arraycopy(coordinates, 0, newCoordinates, coordinates.length - i, i)\n System.arraycopy(newCoordinates, 0, coordinates, 0, coordinates.length)\n }\n static equals() {\n if (arguments.length === 2) {\n const coord1 = arguments[0], coord2 = arguments[1]\n if (coord1 === coord2) return true\n if (coord1 === null || coord2 === null) return false\n if (coord1.length !== coord2.length) return false\n for (let i = 0; i < coord1.length; i++) \n if (!coord1[i].equals(coord2[i])) return false\n \n return true\n } else if (arguments.length === 3) {\n const coord1 = arguments[0], coord2 = arguments[1], coordinateComparator = arguments[2]\n if (coord1 === coord2) return true\n if (coord1 === null || coord2 === null) return false\n if (coord1.length !== coord2.length) return false\n for (let i = 0; i < coord1.length; i++) \n if (coordinateComparator.compare(coord1[i], coord2[i]) !== 0) return false\n \n return true\n }\n }\n static intersection(coordinates, env) {\n const coordList = new CoordinateList()\n for (let i = 0; i < coordinates.length; i++) \n if (env.intersects(coordinates[i])) coordList.add(coordinates[i], true)\n \n return coordList.toCoordinateArray()\n }\n static measures(pts) {\n if (pts === null || pts.length === 0) \n return 0\n \n let measures = 0\n for (const coordinate of pts) \n measures = Math.max(measures, Coordinates.measures(coordinate))\n \n return measures\n }\n static hasRepeatedPoints(coord) {\n for (let i = 1; i < coord.length; i++) \n if (coord[i - 1].equals(coord[i])) \n return true\n \n \n return false\n }\n static removeRepeatedPoints(coord) {\n if (!CoordinateArrays.hasRepeatedPoints(coord)) return coord\n const coordList = new CoordinateList(coord, false)\n return coordList.toCoordinateArray()\n }\n static reverse(coord) {\n const last = coord.length - 1\n const mid = Math.trunc(last / 2)\n for (let i = 0; i <= mid; i++) {\n const tmp = coord[i]\n coord[i] = coord[last - i]\n coord[last - i] = tmp\n }\n }\n static removeNull(coord) {\n let nonNull = 0\n for (let i = 0; i < coord.length; i++) \n if (coord[i] !== null) nonNull++\n \n const newCoord = new Array(nonNull).fill(null)\n if (nonNull === 0) return newCoord\n let j = 0\n for (let i = 0; i < coord.length; i++) \n if (coord[i] !== null) newCoord[j++] = coord[i]\n \n return newCoord\n }\n static copyDeep() {\n if (arguments.length === 1) {\n const coordinates = arguments[0]\n const copy = new Array(coordinates.length).fill(null)\n for (let i = 0; i < coordinates.length; i++) \n copy[i] = coordinates[i].copy()\n \n return copy\n } else if (arguments.length === 5) {\n const src = arguments[0], srcStart = arguments[1], dest = arguments[2], destStart = arguments[3], length = arguments[4]\n for (let i = 0; i < length; i++) \n dest[destStart + i] = src[srcStart + i].copy()\n \n }\n }\n static isEqualReversed(pts1, pts2) {\n for (let i = 0; i < pts1.length; i++) {\n const p1 = pts1[i]\n const p2 = pts2[pts1.length - i - 1]\n if (p1.compareTo(p2) !== 0) return false\n }\n return true\n }\n static envelope(coordinates) {\n const env = new Envelope()\n for (let i = 0; i < coordinates.length; i++) \n env.expandToInclude(coordinates[i])\n \n return env\n }\n static toCoordinateArray(coordList) {\n return coordList.toArray(CoordinateArrays.coordArrayType)\n }\n static dimension(pts) {\n if (pts === null || pts.length === 0) \n return 3\n \n let dimension = 0\n for (const coordinate of pts) \n dimension = Math.max(dimension, Coordinates.dimension(coordinate))\n \n return dimension\n }\n static atLeastNCoordinatesOrNothing(n, c) {\n return c.length >= n ? c : []\n }\n static indexOf(coordinate, coordinates) {\n for (let i = 0; i < coordinates.length; i++) \n if (coordinate.equals(coordinates[i])) \n return i\n \n \n return -1\n }\n static increasingDirection(pts) {\n for (let i = 0; i < Math.trunc(pts.length / 2); i++) {\n const j = pts.length - 1 - i\n const comp = pts[i].compareTo(pts[j])\n if (comp !== 0) return comp\n }\n return 1\n }\n static compare(pts1, pts2) {\n let i = 0\n while (i < pts1.length && i < pts2.length) {\n const compare = pts1[i].compareTo(pts2[i])\n if (compare !== 0) return compare\n i++\n }\n if (i < pts2.length) return -1\n if (i < pts1.length) return 1\n return 0\n }\n static minCoordinate(coordinates) {\n let minCoord = null\n for (let i = 0; i < coordinates.length; i++) \n if (minCoord === null || minCoord.compareTo(coordinates[i]) > 0) \n minCoord = coordinates[i]\n \n \n return minCoord\n }\n static extract(pts, start, end) {\n start = MathUtil.clamp(start, 0, pts.length)\n end = MathUtil.clamp(end, -1, pts.length)\n let npts = end - start + 1\n if (end < 0) npts = 0\n if (start >= pts.length) npts = 0\n if (end < start) npts = 0\n const extractPts = new Array(npts).fill(null)\n if (npts === 0) return extractPts\n let iPts = 0\n for (let i = start; i <= end; i++) \n extractPts[iPts++] = pts[i]\n \n return extractPts\n }\n}\nclass ForwardComparator {\n compare(o1, o2) {\n const pts1 = o1\n const pts2 = o2\n return CoordinateArrays.compare(pts1, pts2)\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nclass BidirectionalComparator {\n compare(o1, o2) {\n const pts1 = o1\n const pts2 = o2\n if (pts1.length < pts2.length) return -1\n if (pts1.length > pts2.length) return 1\n if (pts1.length === 0) return 0\n const forwardComp = CoordinateArrays.compare(pts1, pts2)\n const isEqualRev = CoordinateArrays.isEqualReversed(pts1, pts2)\n if (isEqualRev) return 0\n return forwardComp\n }\n OLDcompare(o1, o2) {\n const pts1 = o1\n const pts2 = o2\n if (pts1.length < pts2.length) return -1\n if (pts1.length > pts2.length) return 1\n if (pts1.length === 0) return 0\n const dir1 = CoordinateArrays.increasingDirection(pts1)\n const dir2 = CoordinateArrays.increasingDirection(pts2)\n let i1 = dir1 > 0 ? 0 : pts1.length - 1\n let i2 = dir2 > 0 ? 0 : pts1.length - 1\n for (let i = 0; i < pts1.length; i++) {\n const comparePt = pts1[i1].compareTo(pts2[i2])\n if (comparePt !== 0) return comparePt\n i1 += dir1\n i2 += dir2\n }\n return 0\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nCoordinateArrays.ForwardComparator = ForwardComparator\nCoordinateArrays.BidirectionalComparator = BidirectionalComparator\nCoordinateArrays.coordArrayType = new Array(0).fill(null)\n","export default class StringBuilder {\n constructor(str) {\n this.str = str\n }\n append(e) {\n this.str += e\n }\n setCharAt(i, c) {\n this.str = this.str.substr(0, i) + c + this.str.substr(i + 1)\n }\n toString() {\n return this.str\n }\n}","import hasInterface from '../../../../../hasInterface.js'\nimport Coordinate from '../Coordinate.js'\nimport Double from '../../../../../java/lang/Double.js'\nimport Coordinates from '../Coordinates.js'\nimport CoordinateSequence from '../CoordinateSequence.js'\nimport CoordinateArrays from '../CoordinateArrays.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport StringBuilder from '../../../../../java/lang/StringBuilder.js'\nexport default class CoordinateArraySequence {\n constructor() {\n CoordinateArraySequence.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._dimension = 3\n this._measures = 0\n this._coordinates = null\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n CoordinateArraySequence.constructor_.call(this, coordinates, CoordinateArrays.dimension(coordinates), CoordinateArrays.measures(coordinates))\n } else if (Number.isInteger(arguments[0])) {\n const size = arguments[0]\n this._coordinates = new Array(size).fill(null)\n for (let i = 0; i < size; i++) \n this._coordinates[i] = new Coordinate()\n \n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordSeq = arguments[0]\n if (coordSeq === null) {\n this._coordinates = new Array(0).fill(null)\n return null\n }\n this._dimension = coordSeq.getDimension()\n this._measures = coordSeq.getMeasures()\n this._coordinates = new Array(coordSeq.size()).fill(null)\n for (let i = 0; i < this._coordinates.length; i++) \n this._coordinates[i] = coordSeq.getCoordinateCopy(i)\n \n }\n } else if (arguments.length === 2) {\n if (arguments[0] instanceof Array && Number.isInteger(arguments[1])) {\n const coordinates = arguments[0], dimension = arguments[1]\n CoordinateArraySequence.constructor_.call(this, coordinates, dimension, CoordinateArrays.measures(coordinates))\n } else if (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1])) {\n const size = arguments[0], dimension = arguments[1]\n this._coordinates = new Array(size).fill(null)\n this._dimension = dimension\n for (let i = 0; i < size; i++) \n this._coordinates[i] = Coordinates.create(dimension)\n \n }\n } else if (arguments.length === 3) {\n if (Number.isInteger(arguments[2]) && (arguments[0] instanceof Array && Number.isInteger(arguments[1]))) {\n const coordinates = arguments[0], dimension = arguments[1], measures = arguments[2]\n this._dimension = dimension\n this._measures = measures\n if (coordinates === null) \n this._coordinates = new Array(0).fill(null)\n else \n this._coordinates = coordinates\n \n } else if (Number.isInteger(arguments[2]) && (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1]))) {\n const size = arguments[0], dimension = arguments[1], measures = arguments[2]\n this._coordinates = new Array(size).fill(null)\n this._dimension = dimension\n this._measures = measures\n for (let i = 0; i < size; i++) \n this._coordinates[i] = this.createCoordinate()\n \n }\n }\n }\n getM(index) {\n if (this.hasM()) \n return this._coordinates[index].getM()\n else \n return Double.NaN\n \n }\n setOrdinate(index, ordinateIndex, value) {\n switch (ordinateIndex) {\n case CoordinateSequence.X:\n this._coordinates[index].x = value\n break\n case CoordinateSequence.Y:\n this._coordinates[index].y = value\n break\n default:\n this._coordinates[index].setOrdinate(ordinateIndex, value)\n }\n }\n getZ(index) {\n if (this.hasZ()) \n return this._coordinates[index].getZ()\n else \n return Double.NaN\n \n }\n size() {\n return this._coordinates.length\n }\n getOrdinate(index, ordinateIndex) {\n switch (ordinateIndex) {\n case CoordinateSequence.X:\n return this._coordinates[index].x\n case CoordinateSequence.Y:\n return this._coordinates[index].y\n default:\n return this._coordinates[index].getOrdinate(ordinateIndex)\n }\n }\n getCoordinate() {\n if (arguments.length === 1) {\n const i = arguments[0]\n return this._coordinates[i]\n } else if (arguments.length === 2) {\n const index = arguments[0], coord = arguments[1]\n coord.setCoordinate(this._coordinates[index])\n }\n }\n getCoordinateCopy(i) {\n const copy = this.createCoordinate()\n copy.setCoordinate(this._coordinates[i])\n return copy\n }\n createCoordinate() {\n return Coordinates.create(this.getDimension(), this.getMeasures())\n }\n getDimension() {\n return this._dimension\n }\n getX(index) {\n return this._coordinates[index].x\n }\n getMeasures() {\n return this._measures\n }\n expandEnvelope(env) {\n for (let i = 0; i < this._coordinates.length; i++) \n env.expandToInclude(this._coordinates[i])\n \n return env\n }\n copy() {\n const cloneCoordinates = new Array(this.size()).fill(null)\n for (let i = 0; i < this._coordinates.length; i++) {\n const duplicate = this.createCoordinate()\n duplicate.setCoordinate(this._coordinates[i])\n cloneCoordinates[i] = duplicate\n }\n return new CoordinateArraySequence(cloneCoordinates, this._dimension, this._measures)\n }\n toString() {\n if (this._coordinates.length > 0) {\n const strBuilder = new StringBuilder(17 * this._coordinates.length)\n strBuilder.append('(')\n strBuilder.append(this._coordinates[0])\n for (let i = 1; i < this._coordinates.length; i++) {\n strBuilder.append(', ')\n strBuilder.append(this._coordinates[i])\n }\n strBuilder.append(')')\n return strBuilder.toString()\n } else {\n return '()'\n }\n }\n getY(index) {\n return this._coordinates[index].y\n }\n toCoordinateArray() {\n return this._coordinates\n }\n get interfaces_() {\n return [CoordinateSequence, Serializable]\n }\n}\n","import CoordinateSequenceFactory from '../CoordinateSequenceFactory.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport CoordinateArraySequence from './CoordinateArraySequence.js'\nimport CoordinateSequence from '../CoordinateSequence.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nexport default class CoordinateArraySequenceFactory {\n static instance() {\n return CoordinateArraySequenceFactory.instanceObject\n }\n readResolve() {\n return CoordinateArraySequenceFactory.instance()\n }\n create() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n return new CoordinateArraySequence(coordinates)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordSeq = arguments[0]\n return new CoordinateArraySequence(coordSeq)\n }\n } else if (arguments.length === 2) {\n let size = arguments[0], dimension = arguments[1]\n if (dimension > 3) dimension = 3\n if (dimension < 2) dimension = 2\n return new CoordinateArraySequence(size, dimension)\n } else if (arguments.length === 3) {\n let size = arguments[0], dimension = arguments[1], measures = arguments[2]\n let spatial = dimension - measures\n if (measures > 1) \n measures = 1\n \n if (spatial > 3) \n spatial = 3\n \n if (spatial < 2) spatial = 2\n return new CoordinateArraySequence(size, spatial + measures, measures)\n }\n }\n get interfaces_() {\n return [CoordinateSequenceFactory, Serializable]\n }\n}\nCoordinateArraySequenceFactory.instanceObject = new CoordinateArraySequenceFactory()\n","import Geometry from './Geometry.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport Polygonal from './Polygonal.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class MultiPolygon extends GeometryCollection {\n constructor() {\n super()\n MultiPolygon.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const polygons = arguments[0], factory = arguments[1]\n GeometryCollection.constructor_.call(this, polygons, factory)\n }\n copyInternal() {\n const polygons = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < polygons.length; i++) \n polygons[i] = this._geometries[i].copy()\n \n return new MultiPolygon(polygons, this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n return super.equalsExact.call(this, other, tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n getBoundaryDimension() {\n return 1\n }\n getTypeCode() {\n return Geometry.TYPECODE_MULTIPOLYGON\n }\n getDimension() {\n return 2\n }\n getBoundary() {\n if (this.isEmpty()) \n return this.getFactory().createMultiLineString()\n \n const allRings = new ArrayList()\n for (let i = 0; i < this._geometries.length; i++) {\n const polygon = this._geometries[i]\n const rings = polygon.getBoundary()\n for (let j = 0; j < rings.getNumGeometries(); j++) \n allRings.add(rings.getGeometryN(j))\n \n }\n const allRingsArray = new Array(allRings.size()).fill(null)\n return this.getFactory().createMultiLineString(allRings.toArray(allRingsArray))\n }\n getGeometryType() {\n return Geometry.TYPENAME_MULTIPOLYGON\n }\n get interfaces_() {\n return [Polygonal]\n }\n}\n","/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Map.html\n */\nexport default class Map {\n /**\n * Returns the value to which the specified key is mapped, or null if this map\n * contains no mapping for the key.\n * @param {Object} key\n * @return {Object}\n */\n get() { }\n\n /**\n * Associates the specified value with the specified key in this map (optional\n * operation).\n * @param {Object} key\n * @param {Object} value\n * @return {Object}\n */\n put() { }\n\n /**\n * Returns the number of key-value mappings in this map.\n * @return {number}\n */\n size() { }\n\n /**\n * Returns a Collection view of the values contained in this map.\n * @return {javascript.util.Collection}\n */\n values() { }\n\n /**\n * Returns a {@link Set} view of the mappings contained in this map.\n * The set is backed by the map, so changes to the map are\n * reflected in the set, and vice-versa. If the map is modified\n * while an iteration over the set is in progress (except through\n * the iterator's own remove operation, or through the\n * setValue operation on a map entry returned by the\n * iterator) the results of the iteration are undefined. The set\n * supports element removal, which removes the corresponding\n * mapping from the map, via the Iterator.remove,\n * Set.remove, removeAll, retainAll and\n * clear operations. It does not support the\n * add or addAll operations.\n *\n * @return {Set} a set view of the mappings contained in this map\n */\n entrySet() { }\n}\n","import Collection from './Collection.js'\nimport NoSuchElementException from './NoSuchElementException.js'\nimport UnsupportedOperationException from '../lang/UnsupportedOperationException.js'\nimport Set from './Set.js'\n\n/**\n * @see http://docs.oracle.com/javase/6/docs/api/java/util/HashSet.html\n */\nexport default class HashSet extends Set {\n constructor(o) {\n super()\n this.map = new Map()\n if (o instanceof Collection)\n this.addAll(o)\n }\n\n contains(o) {\n const hashCode = o.hashCode ? o.hashCode() : o\n if (this.map.has(hashCode))\n return true\n return false\n }\n\n add(o) {\n const hashCode = o.hashCode ? o.hashCode() : o\n if (this.map.has(hashCode))\n return false\n return !!this.map.set(hashCode, o)\n }\n\n addAll(c) {\n for (const e of c)\n this.add(e)\n return true\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n\n size() {\n return this.map.size\n }\n\n isEmpty() {\n return this.map.size === 0\n }\n\n toArray() {\n return Array.from(this.map.values())\n }\n\n iterator() {\n return new Iterator(this.map)\n }\n\n [Symbol.iterator]() {\n return this.map\n }\n}\n\nclass Iterator {\n constructor(map) {\n this.iterator = map.values()\n const { done, value } = this.iterator.next()\n this.done = done\n this.value = value\n }\n\n next() {\n if (this.done)\n throw new NoSuchElementException()\n const current = this.value\n const { done, value } = this.iterator.next()\n this.done = done\n this.value = value\n return current\n }\n\n hasNext() {\n return !this.done\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n}\n","import ArrayList from './ArrayList.js'\nimport MapInterface from './Map.js'\nimport HashSet from './HashSet.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/HashMap.html\n */\nexport default class HashMap extends MapInterface {\n constructor() {\n super()\n this.map = new Map()\n }\n\n get(key) {\n return this.map.get(key) || null\n }\n\n put(key, value) {\n this.map.set(key, value)\n return value\n }\n\n values() {\n const arrayList = new ArrayList()\n const it = this.map.values()\n let o = it.next()\n while (!o.done) {\n arrayList.add(o.value)\n o = it.next()\n }\n return arrayList\n }\n\n entrySet() {\n const hashSet = new HashSet()\n this.map.entries().forEach(entry => hashSet.add(entry))\n return hashSet\n }\n\n size() {\n return this.map.size()\n }\n}\n","import HashMap from '../../../../java/util/HashMap.js'\nimport Coordinate from './Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Integer from '../../../../java/lang/Integer.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nexport default class PrecisionModel {\n constructor() {\n PrecisionModel.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._modelType = null\n this._scale = null\n if (arguments.length === 0) \n this._modelType = PrecisionModel.FLOATING\n else if (arguments.length === 1) \n if (arguments[0] instanceof Type) {\n const modelType = arguments[0]\n this._modelType = modelType\n if (modelType === PrecisionModel.FIXED) \n this.setScale(1.0)\n \n } else if (typeof arguments[0] === 'number') {\n const scale = arguments[0]\n this._modelType = PrecisionModel.FIXED\n this.setScale(scale)\n } else if (arguments[0] instanceof PrecisionModel) {\n const pm = arguments[0]\n this._modelType = pm._modelType\n this._scale = pm._scale\n }\n \n }\n static mostPrecise(pm1, pm2) {\n if (pm1.compareTo(pm2) >= 0) return pm1\n return pm2\n }\n equals(other) {\n if (!(other instanceof PrecisionModel)) \n return false\n \n const otherPrecisionModel = other\n return this._modelType === otherPrecisionModel._modelType && this._scale === otherPrecisionModel._scale\n }\n compareTo(o) {\n const other = o\n const sigDigits = this.getMaximumSignificantDigits()\n const otherSigDigits = other.getMaximumSignificantDigits()\n return Integer.compare(sigDigits, otherSigDigits)\n }\n getScale() {\n return this._scale\n }\n isFloating() {\n return this._modelType === PrecisionModel.FLOATING || this._modelType === PrecisionModel.FLOATING_SINGLE\n }\n getType() {\n return this._modelType\n }\n toString() {\n let description = 'UNKNOWN'\n if (this._modelType === PrecisionModel.FLOATING) \n description = 'Floating'\n else if (this._modelType === PrecisionModel.FLOATING_SINGLE) \n description = 'Floating-Single'\n else if (this._modelType === PrecisionModel.FIXED) \n description = 'Fixed (Scale=' + this.getScale() + ')'\n \n return description\n }\n makePrecise() {\n if (typeof arguments[0] === 'number') {\n const val = arguments[0]\n if (Double.isNaN(val)) return val\n if (this._modelType === PrecisionModel.FLOATING_SINGLE) {\n const floatSingleVal = val\n return floatSingleVal\n }\n if (this._modelType === PrecisionModel.FIXED) \n return Math.round(val * this._scale) / this._scale\n \n return val\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n if (this._modelType === PrecisionModel.FLOATING) return null\n coord.x = this.makePrecise(coord.x)\n coord.y = this.makePrecise(coord.y)\n }\n }\n getMaximumSignificantDigits() {\n let maxSigDigits = 16\n if (this._modelType === PrecisionModel.FLOATING) \n maxSigDigits = 16\n else if (this._modelType === PrecisionModel.FLOATING_SINGLE) \n maxSigDigits = 6\n else if (this._modelType === PrecisionModel.FIXED) \n maxSigDigits = 1 + Math.trunc(Math.ceil(Math.log(this.getScale()) / Math.log(10)))\n \n return maxSigDigits\n }\n setScale(scale) {\n this._scale = Math.abs(scale)\n }\n get interfaces_() {\n return [Serializable, Comparable]\n }\n}\nclass Type {\n constructor() {\n Type.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._name = null\n const name = arguments[0]\n this._name = name\n Type.nameToTypeMap.put(name, this)\n }\n readResolve() {\n return Type.nameToTypeMap.get(this._name)\n }\n toString() {\n return this._name\n }\n get interfaces_() {\n return [Serializable]\n }\n}\nType.nameToTypeMap = new HashMap()\nPrecisionModel.Type = Type\nPrecisionModel.FIXED = new Type('FIXED')\nPrecisionModel.FLOATING = new Type('FLOATING')\nPrecisionModel.FLOATING_SINGLE = new Type('FLOATING SINGLE')\nPrecisionModel.maximumPreciseValue = 9007199254740992.0\n","import Geometry from './Geometry.js'\nimport Lineal from './Lineal.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport Dimension from './Dimension.js'\nexport default class MultiLineString extends GeometryCollection {\n constructor() {\n super()\n MultiLineString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const lineStrings = arguments[0], factory = arguments[1]\n GeometryCollection.constructor_.call(this, lineStrings, factory)\n }\n copyInternal() {\n const lineStrings = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < lineStrings.length; i++) \n lineStrings[i] = this._geometries[i].copy()\n \n return new MultiLineString(lineStrings, this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n return super.equalsExact.call(this, other, tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n getBoundaryDimension() {\n if (this.isClosed()) \n return Dimension.FALSE\n \n return 0\n }\n isClosed() {\n if (this.isEmpty()) \n return false\n \n for (let i = 0; i < this._geometries.length; i++) \n if (!this._geometries[i].isClosed()) \n return false\n \n \n return true\n }\n getTypeCode() {\n return Geometry.TYPECODE_MULTILINESTRING\n }\n getDimension() {\n return 1\n }\n getBoundary() {\n throw new UnsupportedOperationException()\n }\n getGeometryType() {\n return Geometry.TYPENAME_MULTILINESTRING\n }\n get interfaces_() {\n return [Lineal]\n }\n}\n","import CoordinateSequenceFactory from './CoordinateSequenceFactory.js'\nimport LineString from './LineString.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Point from './Point.js'\nimport Polygon from './Polygon.js'\nimport MultiPoint from './MultiPoint.js'\nimport LinearRing from './LinearRing.js'\nimport CoordinateArraySequenceFactory from './impl/CoordinateArraySequenceFactory.js'\nimport MultiPolygon from './MultiPolygon.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport CoordinateSequence from './CoordinateSequence.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport PrecisionModel from './PrecisionModel.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Assert from '../util/Assert.js'\nimport MultiLineString from './MultiLineString.js'\nexport default class GeometryFactory {\n constructor() {\n GeometryFactory.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._precisionModel = null\n this._coordinateSequenceFactory = null\n this._SRID = null\n if (arguments.length === 0) {\n GeometryFactory.constructor_.call(this, new PrecisionModel(), 0)\n } else if (arguments.length === 1) {\n if (hasInterface(arguments[0], CoordinateSequenceFactory)) {\n const coordinateSequenceFactory = arguments[0]\n GeometryFactory.constructor_.call(this, new PrecisionModel(), 0, coordinateSequenceFactory)\n } else if (arguments[0] instanceof PrecisionModel) {\n const precisionModel = arguments[0]\n GeometryFactory.constructor_.call(this, precisionModel, 0, GeometryFactory.getDefaultCoordinateSequenceFactory())\n }\n } else if (arguments.length === 2) {\n const precisionModel = arguments[0], SRID = arguments[1]\n GeometryFactory.constructor_.call(this, precisionModel, SRID, GeometryFactory.getDefaultCoordinateSequenceFactory())\n } else if (arguments.length === 3) {\n const precisionModel = arguments[0], SRID = arguments[1], coordinateSequenceFactory = arguments[2]\n this._precisionModel = precisionModel\n this._coordinateSequenceFactory = coordinateSequenceFactory\n this._SRID = SRID\n }\n }\n static toMultiPolygonArray(multiPolygons) {\n const multiPolygonArray = new Array(multiPolygons.size()).fill(null)\n return multiPolygons.toArray(multiPolygonArray)\n }\n static toGeometryArray(geometries) {\n if (geometries === null) return null\n const geometryArray = new Array(geometries.size()).fill(null)\n return geometries.toArray(geometryArray)\n }\n static getDefaultCoordinateSequenceFactory() {\n return CoordinateArraySequenceFactory.instance()\n }\n static toMultiLineStringArray(multiLineStrings) {\n const multiLineStringArray = new Array(multiLineStrings.size()).fill(null)\n return multiLineStrings.toArray(multiLineStringArray)\n }\n static toLineStringArray(lineStrings) {\n const lineStringArray = new Array(lineStrings.size()).fill(null)\n return lineStrings.toArray(lineStringArray)\n }\n static toMultiPointArray(multiPoints) {\n const multiPointArray = new Array(multiPoints.size()).fill(null)\n return multiPoints.toArray(multiPointArray)\n }\n static toLinearRingArray(linearRings) {\n const linearRingArray = new Array(linearRings.size()).fill(null)\n return linearRings.toArray(linearRingArray)\n }\n static toPointArray(points) {\n const pointArray = new Array(points.size()).fill(null)\n return points.toArray(pointArray)\n }\n static toPolygonArray(polygons) {\n const polygonArray = new Array(polygons.size()).fill(null)\n return polygons.toArray(polygonArray)\n }\n static createPointFromInternalCoord(coord, exemplar) {\n exemplar.getPrecisionModel().makePrecise(coord)\n return exemplar.getFactory().createPoint(coord)\n }\n createEmpty(dimension) {\n switch (dimension) {\n case -1:\n return this.createGeometryCollection()\n case 0:\n return this.createPoint()\n case 1:\n return this.createLineString()\n case 2:\n return this.createPolygon()\n default:\n throw new IllegalArgumentException('Invalid dimension: ' + dimension)\n }\n }\n toGeometry(envelope) {\n if (envelope.isNull()) \n return this.createPoint()\n \n if (envelope.getMinX() === envelope.getMaxX() && envelope.getMinY() === envelope.getMaxY()) \n return this.createPoint(new Coordinate(envelope.getMinX(), envelope.getMinY()))\n \n if (envelope.getMinX() === envelope.getMaxX() || envelope.getMinY() === envelope.getMaxY()) \n return this.createLineString([new Coordinate(envelope.getMinX(), envelope.getMinY()), new Coordinate(envelope.getMaxX(), envelope.getMaxY())])\n \n return this.createPolygon(this.createLinearRing([new Coordinate(envelope.getMinX(), envelope.getMinY()), new Coordinate(envelope.getMinX(), envelope.getMaxY()), new Coordinate(envelope.getMaxX(), envelope.getMaxY()), new Coordinate(envelope.getMaxX(), envelope.getMinY()), new Coordinate(envelope.getMinX(), envelope.getMinY())]), null)\n }\n createLineString() {\n if (arguments.length === 0) \n return this.createLineString(this.getCoordinateSequenceFactory().create([]))\n else if (arguments.length === 1) \n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n return this.createLineString(coordinates !== null ? this.getCoordinateSequenceFactory().create(coordinates) : null)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n return new LineString(coordinates, this)\n }\n \n }\n createMultiLineString() {\n if (arguments.length === 0) {\n return new MultiLineString(null, this)\n } else if (arguments.length === 1) {\n const lineStrings = arguments[0]\n return new MultiLineString(lineStrings, this)\n }\n }\n buildGeometry(geomList) {\n let geomType = null\n let isHeterogeneous = false\n let hasGeometryCollection = false\n for (let i = geomList.iterator(); i.hasNext(); ) {\n const geom = i.next()\n const partType = geom.getTypeCode()\n if (geomType === null) \n geomType = partType\n \n if (partType !== geomType) \n isHeterogeneous = true\n \n if (geom instanceof GeometryCollection) hasGeometryCollection = true\n }\n if (geomType === null) \n return this.createGeometryCollection()\n \n if (isHeterogeneous || hasGeometryCollection) \n return this.createGeometryCollection(GeometryFactory.toGeometryArray(geomList))\n \n const geom0 = geomList.iterator().next()\n const isCollection = geomList.size() > 1\n if (isCollection) {\n if (geom0 instanceof Polygon) \n return this.createMultiPolygon(GeometryFactory.toPolygonArray(geomList))\n else if (geom0 instanceof LineString) \n return this.createMultiLineString(GeometryFactory.toLineStringArray(geomList))\n else if (geom0 instanceof Point) \n return this.createMultiPoint(GeometryFactory.toPointArray(geomList))\n \n Assert.shouldNeverReachHere('Unhandled geometry type: ' + geom0.getGeometryType())\n }\n return geom0\n }\n createMultiPointFromCoords(coordinates) {\n return this.createMultiPoint(coordinates !== null ? this.getCoordinateSequenceFactory().create(coordinates) : null)\n }\n createPoint() {\n if (arguments.length === 0) \n return this.createPoint(this.getCoordinateSequenceFactory().create([]))\n else if (arguments.length === 1) \n if (arguments[0] instanceof Coordinate) {\n const coordinate = arguments[0]\n return this.createPoint(coordinate !== null ? this.getCoordinateSequenceFactory().create([coordinate]) : null)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n return new Point(coordinates, this)\n }\n \n }\n getCoordinateSequenceFactory() {\n return this._coordinateSequenceFactory\n }\n createPolygon() {\n if (arguments.length === 0) {\n return this.createPolygon(null, null)\n } else if (arguments.length === 1) {\n if (hasInterface(arguments[0], CoordinateSequence)) {\n const shell = arguments[0]\n return this.createPolygon(this.createLinearRing(shell))\n } else if (arguments[0] instanceof Array) {\n const shell = arguments[0]\n return this.createPolygon(this.createLinearRing(shell))\n } else if (arguments[0] instanceof LinearRing) {\n const shell = arguments[0]\n return this.createPolygon(shell, null)\n }\n } else if (arguments.length === 2) {\n const shell = arguments[0], holes = arguments[1]\n return new Polygon(shell, holes, this)\n }\n }\n getSRID() {\n return this._SRID\n }\n createGeometryCollection() {\n if (arguments.length === 0) {\n return new GeometryCollection(null, this)\n } else if (arguments.length === 1) {\n const geometries = arguments[0]\n return new GeometryCollection(geometries, this)\n }\n }\n getPrecisionModel() {\n return this._precisionModel\n }\n createLinearRing() {\n if (arguments.length === 0) \n return this.createLinearRing(this.getCoordinateSequenceFactory().create([]))\n else if (arguments.length === 1) \n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n return this.createLinearRing(coordinates !== null ? this.getCoordinateSequenceFactory().create(coordinates) : null)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n return new LinearRing(coordinates, this)\n }\n \n }\n createMultiPolygon() {\n if (arguments.length === 0) {\n return new MultiPolygon(null, this)\n } else if (arguments.length === 1) {\n const polygons = arguments[0]\n return new MultiPolygon(polygons, this)\n }\n }\n createMultiPoint() {\n if (arguments.length === 0) \n return new MultiPoint(null, this)\n else if (arguments.length === 1) \n if (arguments[0] instanceof Array) {\n const point = arguments[0]\n return new MultiPoint(point, this)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n if (coordinates === null) \n return this.createMultiPoint(new Array(0).fill(null))\n \n const points = new Array(coordinates.size()).fill(null)\n for (let i = 0; i < coordinates.size(); i++) {\n const ptSeq = this.getCoordinateSequenceFactory().create(1, coordinates.getDimension(), coordinates.getMeasures())\n CoordinateSequences.copy(coordinates, i, ptSeq, 0, 1)\n points[i] = this.createPoint(ptSeq)\n }\n return this.createMultiPoint(points)\n }\n \n }\n get interfaces_() {\n return [Serializable]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport GeometryFactory from '../geom/GeometryFactory.js'\n\n/**\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available. Supported values are `'XY'`,\n * `'XYZ'`, `'XYM'`, `'XYZM'`.\n * @enum {string}\n */\nconst GeometryLayout = {\n XY: 'XY',\n XYZ: 'XYZ',\n XYM: 'XYM',\n XYZM: 'XYZM',\n}\n\n/**\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, `'Circle'`.\n * @enum {string}\n */\nconst GeometryType = {\n POINT: 'Point',\n LINE_STRING: 'LineString',\n LINEAR_RING: 'LinearRing',\n POLYGON: 'Polygon',\n MULTI_POINT: 'MultiPoint',\n MULTI_LINE_STRING: 'MultiLineString',\n MULTI_POLYGON: 'MultiPolygon',\n GEOMETRY_COLLECTION: 'GeometryCollection',\n CIRCLE: 'Circle',\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into\n * multiple features on reading.\n */\n\n/**\n * @typedef {Object} Token\n * @property {number} type\n * @property {number|string} [value]\n * @property {number} position\n */\n\n/**\n * @const\n * @type {string}\n */\nconst EMPTY = 'EMPTY'\n\n/**\n * @const\n * @type {string}\n */\nconst Z = 'Z'\n\n/**\n * @const\n * @type {string}\n */\nconst M = 'M'\n\n/**\n * @const\n * @type {string}\n */\nconst ZM = 'ZM'\n\n/**\n * @const\n * @enum {number}\n */\nconst TokenType = {\n TEXT: 1,\n LEFT_PAREN: 2,\n RIGHT_PAREN: 3,\n NUMBER: 4,\n COMMA: 5,\n EOF: 6,\n}\n\n/**\n * @const\n * @type {Object}\n */\nconst WKTGeometryType = {}\nfor (const type in GeometryType)\n WKTGeometryType[type] = GeometryType[type].toUpperCase()\n\n\n/**\n * Class to tokenize a WKT string.\n */\nclass Lexer {\n /**\n * @param {string} wkt WKT string.\n */\n constructor(wkt) {\n /**\n * @type {string}\n */\n this.wkt = wkt\n\n /**\n * @type {number}\n * @private\n */\n this.index_ = -1\n }\n\n /**\n * @param {string} c Character.\n * @return {boolean} Whether the character is alphabetic.\n * @private\n */\n isAlpha_(c) {\n return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')\n }\n\n /**\n * @param {string} c Character.\n * @param {boolean=} opt_decimal Whether the string number\n * contains a dot, i.e. is a decimal number.\n * @return {boolean} Whether the character is numeric.\n * @private\n */\n isNumeric_(c, opt_decimal) {\n const decimal = opt_decimal !== undefined ? opt_decimal : false\n return (c >= '0' && c <= '9') || (c == '.' && !decimal)\n }\n\n /**\n * @param {string} c Character.\n * @return {boolean} Whether the character is whitespace.\n * @private\n */\n isWhiteSpace_(c) {\n return c == ' ' || c == '\\t' || c == '\\r' || c == '\\n'\n }\n\n /**\n * @return {string} Next string character.\n * @private\n */\n nextChar_() {\n return this.wkt.charAt(++this.index_)\n }\n\n /**\n * Fetch and return the next token.\n * @return {!Token} Next string token.\n */\n nextToken() {\n const c = this.nextChar_()\n const position = this.index_\n /** @type {number|string} */\n let value = c\n let type\n\n if (c == '(') {\n type = TokenType.LEFT_PAREN\n } else if (c == ',') {\n type = TokenType.COMMA\n } else if (c == ')') {\n type = TokenType.RIGHT_PAREN\n } else if (this.isNumeric_(c) || c == '-') {\n type = TokenType.NUMBER\n value = this.readNumber_()\n } else if (this.isAlpha_(c)) {\n type = TokenType.TEXT\n value = this.readText_()\n } else if (this.isWhiteSpace_(c)) {\n return this.nextToken()\n } else if (c === '') {\n type = TokenType.EOF\n } else {\n throw new Error('Unexpected character: ' + c)\n }\n\n return { position: position, value: value, type: type }\n }\n\n /**\n * @return {number} Numeric token value.\n * @private\n */\n readNumber_() {\n let c\n const index = this.index_\n let decimal = false\n let scientificNotation = false\n do {\n if (c == '.')\n decimal = true\n else if (c == 'e' || c == 'E')\n scientificNotation = true\n c = this.nextChar_()\n } while (\n this.isNumeric_(c, decimal) ||\n // if we haven't detected a scientific number before, 'e' or 'E'\n // hint that we should continue to read\n (!scientificNotation && (c == 'e' || c == 'E')) ||\n // once we know that we have a scientific number, both '-' and '+'\n // are allowed\n (scientificNotation && (c == '-' || c == '+'))\n )\n return parseFloat(this.wkt.substring(index, this.index_--))\n }\n\n /**\n * @return {string} String token value.\n * @private\n */\n readText_() {\n let c\n const index = this.index_\n do\n c = this.nextChar_()\n while (this.isAlpha_(c))\n return this.wkt.substring(index, this.index_--).toUpperCase()\n }\n}\n\n/**\n * Class to parse the tokens from the WKT string.\n */\nclass Parser {\n /**\n * @param {Lexer} lexer The lexer.\n */\n constructor(lexer, factory) {\n /**\n * @type {Lexer}\n * @private\n */\n this.lexer_ = lexer\n\n /**\n * @type {Token}\n * @private\n */\n this.token_\n\n /**\n * @type {import(\"../geom/GeometryLayout.js\").default}\n * @private\n */\n this.layout_ = GeometryLayout.XY\n\n this.factory = factory\n }\n\n /**\n * Fetch the next token form the lexer and replace the active token.\n * @private\n */\n consume_() {\n this.token_ = this.lexer_.nextToken()\n }\n\n /**\n * Tests if the given type matches the type of the current token.\n * @param {TokenType} type Token type.\n * @return {boolean} Whether the token matches the given type.\n */\n isTokenType(type) {\n const isMatch = this.token_.type == type\n return isMatch\n }\n\n /**\n * If the given type matches the current token, consume it.\n * @param {TokenType} type Token type.\n * @return {boolean} Whether the token matches the given type.\n */\n match(type) {\n const isMatch = this.isTokenType(type)\n if (isMatch) \n this.consume_()\n return isMatch\n }\n\n /**\n * Try to parse the tokens provided by the lexer.\n * @return {import(\"../geom/Geometry.js\").default} The geometry.\n */\n parse() {\n this.consume_()\n const geometry = this.parseGeometry_()\n return geometry\n }\n\n /**\n * Try to parse the dimensional info.\n * @return {import(\"../geom/GeometryLayout.js\").default} The layout.\n * @private\n */\n parseGeometryLayout_() {\n let layout = GeometryLayout.XY\n const dimToken = this.token_\n if (this.isTokenType(TokenType.TEXT)) {\n const dimInfo = dimToken.value\n if (dimInfo === Z)\n layout = GeometryLayout.XYZ\n else if (dimInfo === M)\n layout = GeometryLayout.XYM\n else if (dimInfo === ZM)\n layout = GeometryLayout.XYZM\n if (layout !== GeometryLayout.XY)\n this.consume_()\n }\n return layout\n }\n\n /**\n * @return {!Array} A collection of geometries.\n * @private\n */\n parseGeometryCollectionText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const geometries = []\n do\n geometries.push(this.parseGeometry_())\n while (this.match(TokenType.COMMA))\n if (this.match(TokenType.RIGHT_PAREN)) \n return geometries\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {Array} All values in a point.\n * @private\n */\n parsePointText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePoint_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return null\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>} All points in a linestring.\n * @private\n */\n parseLineStringText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePointList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>>} All points in a polygon.\n * @private\n */\n parsePolygonText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parseLineStringTextList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>} All points in a multipoint.\n * @private\n */\n parseMultiPointText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n let coordinates\n if (this.token_.type == TokenType.LEFT_PAREN) \n coordinates = this.parsePointTextList_()\n else\n coordinates = this.parsePointList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>>} All linestring points\n * in a multilinestring.\n * @private\n */\n parseMultiLineStringText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parseLineStringTextList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>>>} All polygon points in a multipolygon.\n * @private\n */\n parseMultiPolygonText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePolygonTextList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array} A point.\n * @private\n */\n parsePoint_() {\n const coordinates = []\n const dimensions = this.layout_.length\n for (let i = 0; i < dimensions; ++i) {\n const token = this.token_\n if (this.match(TokenType.NUMBER)) \n coordinates.push(/** @type {number} */(token.value))\n else\n break\n }\n if (coordinates.length == dimensions) \n return coordinates\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>} An array of points.\n * @private\n */\n parsePointList_() {\n const coordinates = [this.parsePoint_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parsePoint_())\n return coordinates\n }\n\n /**\n * @return {!Array>} An array of points.\n * @private\n */\n parsePointTextList_() {\n const coordinates = [this.parsePointText_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parsePointText_())\n return coordinates\n }\n\n /**\n * @return {!Array>>} An array of points.\n * @private\n */\n parseLineStringTextList_() {\n const coordinates = [this.parseLineStringText_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parseLineStringText_())\n return coordinates\n }\n\n /**\n * @return {!Array>>>} An array of points.\n * @private\n */\n parsePolygonTextList_() {\n const coordinates = [this.parsePolygonText_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parsePolygonText_())\n return coordinates\n }\n\n /**\n * @return {boolean} Whether the token implies an empty geometry.\n * @private\n */\n isEmptyGeometry_() {\n const isEmpty =\n this.isTokenType(TokenType.TEXT) && this.token_.value == EMPTY\n if (isEmpty)\n this.consume_()\n return isEmpty\n }\n\n /**\n * Create an error message for an unexpected token error.\n * @return {string} Error message.\n * @private\n */\n formatErrorMessage_() {\n return (\n 'Unexpected `' +\n this.token_.value +\n '` at position ' +\n this.token_.position +\n ' in `' +\n this.lexer_.wkt +\n '`'\n )\n }\n\n /**\n * @return {!import(\"../geom/Geometry.js\").default} The geometry.\n * @private\n */\n parseGeometry_() {\n const factory = this.factory\n\n const o2c = ordinates => new Coordinate(...ordinates)\n const ca2p = coordinates => {\n const rings = coordinates.map(a => factory.createLinearRing(a.map(o2c)))\n if (rings.length > 1)\n return factory.createPolygon(rings[0], rings.slice(1))\n else\n return factory.createPolygon(rings[0])\n }\n\n const token = this.token_\n if (this.match(TokenType.TEXT)) {\n const geomType = token.value\n this.layout_ = this.parseGeometryLayout_()\n if (geomType == 'GEOMETRYCOLLECTION') {\n const geometries = this.parseGeometryCollectionText_()\n return factory.createGeometryCollection(geometries)\n } else {\n switch (geomType) {\n case 'POINT': {\n const ordinates = this.parsePointText_()\n if (!ordinates)\n return factory.createPoint()\n return factory.createPoint(new Coordinate(...ordinates))\n }\n case 'LINESTRING': {\n const coordinates = this.parseLineStringText_()\n const components = coordinates.map(o2c)\n return factory.createLineString(components)\n }\n case 'LINEARRING': {\n const coordinates = this.parseLineStringText_()\n const components = coordinates.map(o2c)\n return factory.createLinearRing(components)\n }\n case 'POLYGON': {\n const coordinates = this.parsePolygonText_()\n if (!coordinates || coordinates.length === 0)\n return factory.createPolygon()\n return ca2p(coordinates)\n }\n case 'MULTIPOINT': {\n const coordinates = this.parseMultiPointText_()\n if (!coordinates || coordinates.length === 0)\n return factory.createMultiPoint()\n const components = coordinates.map(o2c).map(c => factory.createPoint(c))\n return factory.createMultiPoint(components)\n }\n case 'MULTILINESTRING': {\n const coordinates = this.parseMultiLineStringText_()\n const components = coordinates.map(a => factory.createLineString(a.map(o2c)))\n return factory.createMultiLineString(components)\n }\n case 'MULTIPOLYGON': {\n const coordinates = this.parseMultiPolygonText_()\n if (!coordinates || coordinates.length === 0)\n return factory.createMultiPolygon()\n const polygons = coordinates.map(ca2p)\n return factory.createMultiPolygon(polygons)\n }\n default: {\n throw new Error('Invalid geometry type: ' + geomType)\n }\n }\n }\n }\n throw new Error(this.formatErrorMessage_())\n }\n}\n\n/**\n * @param {Point} geom Point geometry.\n * @return {string} Coordinates part of Point as WKT.\n */\nfunction encodePointGeometry(geom) {\n if (geom.isEmpty())\n return ''\n const c = geom.getCoordinate()\n const cs = [c.x, c.y]\n if (c.z !== undefined && !Number.isNaN(c.z))\n cs.push(c.z)\n if (c.m !== undefined && !Number.isNaN(c.m))\n cs.push(c.m)\n return cs.join(' ')\n}\n\n/**\n * @param {MultiPoint} geom MultiPoint geometry.\n * @return {string} Coordinates part of MultiPoint as WKT.\n */\nfunction encodeMultiPointGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push('(' + encodePointGeometry(geom.getGeometryN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {GeometryCollection} geom GeometryCollection geometry.\n * @return {string} Coordinates part of GeometryCollection as WKT.\n */\nfunction encodeGeometryCollectionGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push(encode(geom.getGeometryN(i)))\n return array.join(', ')\n}\n\n/**\n * @param {LineString|import(\"../geom/LinearRing.js\").default} geom LineString geometry.\n * @return {string} Coordinates part of LineString as WKT.\n */\nfunction encodeLineStringGeometry(geom) {\n const coordinates = geom.getCoordinates()\n .map(c => {\n const a = [c.x, c.y]\n if (c.z !== undefined && !Number.isNaN(c.z))\n a.push(c.z)\n if (c.m !== undefined && !Number.isNaN(c.m))\n a.push(c.m)\n return a\n })\n const array = []\n for (let i = 0, ii = coordinates.length; i < ii; ++i) \n array.push(coordinates[i].join(' '))\n return array.join(', ')\n}\n\n/**\n * @param {MultiLineString} geom MultiLineString geometry.\n * @return {string} Coordinates part of MultiLineString as WKT.\n */\nfunction encodeMultiLineStringGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push('(' + encodeLineStringGeometry(geom.getGeometryN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {Polygon} geom Polygon geometry.\n * @return {string} Coordinates part of Polygon as WKT.\n */\nfunction encodePolygonGeometry(geom) {\n const array = []\n array.push('(' + encodeLineStringGeometry(geom.getExteriorRing()) + ')')\n for (let i = 0, ii = geom.getNumInteriorRing(); i < ii; ++i) \n array.push('(' + encodeLineStringGeometry(geom.getInteriorRingN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {MultiPolygon} geom MultiPolygon geometry.\n * @return {string} Coordinates part of MultiPolygon as WKT.\n */\nfunction encodeMultiPolygonGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push('(' + encodePolygonGeometry(geom.getGeometryN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {Geometry} geom Geometry geometry.\n * @return {string} Potential dimensional information for WKT type.\n */\nfunction encodeGeometryLayout(geom) {\n let dimInfo = ''\n if (geom.isEmpty())\n return dimInfo\n const c = geom.getCoordinate()\n if (c.z !== undefined && !Number.isNaN(c.z))\n dimInfo += Z\n if (c.m !== undefined && !Number.isNaN(c.m))\n dimInfo += M\n return dimInfo\n}\n\n/**\n * @const\n * @type {Object}\n */\nconst GeometryEncoder = {\n 'Point': encodePointGeometry,\n 'LineString': encodeLineStringGeometry,\n 'LinearRing': encodeLineStringGeometry,\n 'Polygon': encodePolygonGeometry,\n 'MultiPoint': encodeMultiPointGeometry,\n 'MultiLineString': encodeMultiLineStringGeometry,\n 'MultiPolygon': encodeMultiPolygonGeometry,\n 'GeometryCollection': encodeGeometryCollectionGeometry,\n}\n\n/**\n * Encode a geometry as WKT.\n * @param {!import(\"../geom/Geometry.js\").default} geom The geometry to encode.\n * @return {string} WKT string for the geometry.\n */\nfunction encode(geom) {\n let type = geom.getGeometryType()\n const geometryEncoder = GeometryEncoder[type]\n type = type.toUpperCase()\n const dimInfo = encodeGeometryLayout(geom)\n if (dimInfo.length > 0) \n type += ' ' + dimInfo\n if (geom.isEmpty()) \n return type + ' ' + EMPTY\n const enc = geometryEncoder(geom)\n return type + ' (' + enc + ')'\n}\n\n/**\n * Class for reading and writing Well-Known Text.\n *\n * NOTE: Adapted from OpenLayers.\n */\n\nexport default class WKTParser {\n /** Create a new parser for WKT\n *\n * @param {GeometryFactory} geometryFactory\n * @return An instance of WKTParser.\n * @private\n */\n constructor(geometryFactory) {\n this.geometryFactory = geometryFactory || new GeometryFactory()\n this.precisionModel = this.geometryFactory.getPrecisionModel()\n }\n\n /**\n * Deserialize a WKT string and return a geometry. Supports WKT for POINT,\n * MULTIPOINT, LINESTRING, LINEARRING, MULTILINESTRING, POLYGON, MULTIPOLYGON,\n * and GEOMETRYCOLLECTION.\n *\n * @param {String} wkt A WKT string.\n * @return {Geometry} A geometry instance.\n * @private\n */\n read(wkt) {\n const lexer = new Lexer(wkt)\n const parser = new Parser(lexer, this.geometryFactory)\n const geometry = parser.parse()\n return geometry\n }\n\n /**\n * Serialize a geometry into a WKT string.\n *\n * @param {Geometry} geometry A feature or array of features.\n * @return {String} The WKT string representation of the input geometries.\n * @private\n */\n write(geometry) {\n return encode(geometry)\n }\n}\n","/**\n * @module org/locationtech/jts/io/WKTReader\n */\n\nimport GeometryFactory from '../geom/GeometryFactory.js'\nimport WKTParser from './WKTParser.js'\n\n/**\n * Converts a geometry in Well-Known Text format to a {@link Geometry}.\n *

\n * WKTReader supports extracting Geometry objects\n * from either {@link Reader}s or {@link String}s. This allows it to function\n * as a parser to read Geometry objects from text blocks embedded\n * in other data formats (e.g. XML).\n */\n\nexport default class WKTReader {\n /**\n * A WKTReader is parameterized by a GeometryFactory,\n * to allow it to create Geometry objects of the appropriate\n * implementation. In particular, the GeometryFactory determines\n * the PrecisionModel and SRID that is used.\n * @param {GeometryFactory} geometryFactory\n */\n constructor(geometryFactory) {\n this.parser = new WKTParser(geometryFactory || new GeometryFactory())\n }\n\n /**\n * Reads a Well-Known Text representation of a {@link Geometry}\n *\n * @param {string}\n * wkt a string (see the OpenGIS Simple Features\n * Specification).\n * @return {Geometry} a Geometry read from\n * string.\n * @memberof module:org/locationtech/jts/io/WKTReader#\n */\n read(wkt) {\n return this.parser.read(wkt)\n }\n}\n","/**\n * @module org/locationtech/jts/io/WKTWriter\n */\n\nimport WKTParser from './WKTParser.js'\n\n/**\n * Writes the Well-Known Text representation of a {@link Geometry}. The\n * Well-Known Text format is defined in the OGC Simple Features\n * Specification for SQL.\n *

\n * The WKTWriter outputs coordinates rounded to the precision\n * model. Only the maximum number of decimal places necessary to represent the\n * ordinates to the required precision will be output.\n *

\n * The SFS WKT spec does not define a special tag for {@link LinearRing}s.\n * Under the spec, rings are output as LINESTRINGs.\n */\nexport default class WKTWriter {\n /**\n * @param {GeometryFactory} geometryFactory\n */\n constructor(geometryFactory) {\n this.parser = new WKTParser(geometryFactory)\n }\n\n /**\n * Converts a Geometry to its Well-known Text representation.\n *\n * @param {Geometry} geometry a Geometry to process.\n * @return {string} a string (see the OpenGIS Simple\n * Features Specification).\n * @memberof module:org/locationtech/jts/io/WKTWriter#\n */\n write(geometry) {\n return this.parser.write(geometry)\n }\n\n /**\n * Generates the WKT for a LINESTRING specified by two\n * {@link Coordinate}s.\n *\n * @param p0 the first coordinate.\n * @param p1 the second coordinate.\n *\n * @return the WKT.\n * @private\n */\n static toLineString(p0, p1) {\n if (arguments.length !== 2) throw new Error('Not implemented')\n\n return 'LINESTRING ( ' + p0.x + ' ' + p0.y + ', ' + p1.x + ' ' + p1.y + ' )'\n }\n}\n","export default class BufferParameters {\n constructor() {\n BufferParameters.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._quadrantSegments = BufferParameters.DEFAULT_QUADRANT_SEGMENTS\n this._endCapStyle = BufferParameters.CAP_ROUND\n this._joinStyle = BufferParameters.JOIN_ROUND\n this._mitreLimit = BufferParameters.DEFAULT_MITRE_LIMIT\n this._isSingleSided = false\n this._simplifyFactor = BufferParameters.DEFAULT_SIMPLIFY_FACTOR\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const quadrantSegments = arguments[0]\n this.setQuadrantSegments(quadrantSegments)\n } else if (arguments.length === 2) {\n const quadrantSegments = arguments[0], endCapStyle = arguments[1]\n this.setQuadrantSegments(quadrantSegments)\n this.setEndCapStyle(endCapStyle)\n } else if (arguments.length === 4) {\n const quadrantSegments = arguments[0], endCapStyle = arguments[1], joinStyle = arguments[2], mitreLimit = arguments[3]\n this.setQuadrantSegments(quadrantSegments)\n this.setEndCapStyle(endCapStyle)\n this.setJoinStyle(joinStyle)\n this.setMitreLimit(mitreLimit)\n }\n }\n static bufferDistanceError(quadSegs) {\n const alpha = Math.PI / 2.0 / quadSegs\n return 1 - Math.cos(alpha / 2.0)\n }\n getEndCapStyle() {\n return this._endCapStyle\n }\n isSingleSided() {\n return this._isSingleSided\n }\n setQuadrantSegments(quadSegs) {\n this._quadrantSegments = quadSegs\n if (this._quadrantSegments === 0) this._joinStyle = BufferParameters.JOIN_BEVEL\n if (this._quadrantSegments < 0) {\n this._joinStyle = BufferParameters.JOIN_MITRE\n this._mitreLimit = Math.abs(this._quadrantSegments)\n }\n if (quadSegs <= 0) \n this._quadrantSegments = 1\n \n if (this._joinStyle !== BufferParameters.JOIN_ROUND) \n this._quadrantSegments = BufferParameters.DEFAULT_QUADRANT_SEGMENTS\n \n }\n getJoinStyle() {\n return this._joinStyle\n }\n setJoinStyle(joinStyle) {\n this._joinStyle = joinStyle\n }\n setSimplifyFactor(simplifyFactor) {\n this._simplifyFactor = simplifyFactor < 0 ? 0 : simplifyFactor\n }\n getSimplifyFactor() {\n return this._simplifyFactor\n }\n getQuadrantSegments() {\n return this._quadrantSegments\n }\n setEndCapStyle(endCapStyle) {\n this._endCapStyle = endCapStyle\n }\n getMitreLimit() {\n return this._mitreLimit\n }\n setMitreLimit(mitreLimit) {\n this._mitreLimit = mitreLimit\n }\n setSingleSided(isSingleSided) {\n this._isSingleSided = isSingleSided\n }\n}\nBufferParameters.CAP_ROUND = 1\nBufferParameters.CAP_FLAT = 2\nBufferParameters.CAP_SQUARE = 3\nBufferParameters.JOIN_ROUND = 1\nBufferParameters.JOIN_MITRE = 2\nBufferParameters.JOIN_BEVEL = 3\nBufferParameters.DEFAULT_QUADRANT_SEGMENTS = 8\nBufferParameters.DEFAULT_MITRE_LIMIT = 5.0\nBufferParameters.DEFAULT_SIMPLIFY_FACTOR = 0.01\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class Location {\n static toLocationSymbol(locationValue) {\n switch (locationValue) {\n case Location.EXTERIOR:\n return 'e'\n case Location.BOUNDARY:\n return 'b'\n case Location.INTERIOR:\n return 'i'\n case Location.NONE:\n return '-'\n }\n throw new IllegalArgumentException('Unknown location value: ' + locationValue)\n }\n}\nLocation.INTERIOR = 0\nLocation.BOUNDARY = 1\nLocation.EXTERIOR = 2\nLocation.NONE = -1\n","export default class Position {\n static opposite(position) {\n if (position === Position.LEFT) return Position.RIGHT\n if (position === Position.RIGHT) return Position.LEFT\n return position\n }\n}\nPosition.ON = 0\nPosition.LEFT = 1\nPosition.RIGHT = 2\n","import Exception from '../lang/Exception.js'\n\nexport default class EmptyStackException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ EmptyStackException })[0]\n }\n}\n","import EmptyStackException from './EmptyStackException.js'\nimport IndexOutOfBoundsException from '../lang/IndexOutOfBoundsException.js'\nimport List from './List.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Stack.html\n */\nexport default class Stack extends List {\n constructor() {\n super()\n this.array = []\n }\n\n add(e) {\n this.array.push(e)\n return true\n }\n\n get(index) {\n if (index < 0 || index >= this.size())\n throw new IndexOutOfBoundsException()\n return this.array[index]\n }\n\n /**\n * Pushes an item onto the top of this stack.\n * @param {Object} e\n * @return {Object}\n */\n push(e) {\n this.array.push(e)\n return e\n }\n\n /**\n * Removes the object at the top of this stack and returns that object as the value of this function.\n * @return {Object}\n */\n pop() {\n if (this.array.length === 0)\n throw new EmptyStackException()\n return this.array.pop()\n }\n\n /**\n * Looks at the object at the top of this stack without removing it from the\n * stack.\n * @return {Object}\n */\n peek() {\n if (this.array.length === 0)\n throw new EmptyStackException()\n return this.array[this.array.length - 1]\n }\n\n /**\n * Tests if this stack is empty.\n * @return {boolean} true if and only if this stack contains no items; false\n * otherwise.\n */\n empty() {\n return this.array.length === 0\n }\n\n /**\n * @return {boolean}\n */\n isEmpty() {\n return this.empty()\n }\n\n /**\n * Returns the 1-based position where an object is on this stack. If the object\n * o occurs as an item in this stack, this method returns the distance from the\n * top of the stack of the occurrence nearest the top of the stack; the topmost\n * item on the stack is considered to be at distance 1. The equals method is\n * used to compare o to the items in this stack.\n *\n * NOTE: does not currently actually use equals. (=== is used)\n *\n * @param {Object} o\n * @return {number} the 1-based position from the top of the stack where the\n * object is located; the return value -1 indicates that the object is\n * not on the stack.\n */\n search(o) {\n return this.array.indexOf(o)\n }\n\n /**\n * @return {number}\n */\n size() {\n return this.array.length\n }\n\n /**\n * @return {Array}\n */\n toArray() {\n return this.array.slice()\n }\n}\n","import Position from '../../geomgraph/Position.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Assert from '../../util/Assert.js'\nexport default class RightmostEdgeFinder {\n constructor() {\n RightmostEdgeFinder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._minIndex = -1\n this._minCoord = null\n this._minDe = null\n this._orientedDe = null\n }\n getCoordinate() {\n return this._minCoord\n }\n getRightmostSide(de, index) {\n let side = this.getRightmostSideOfSegment(de, index)\n if (side < 0) side = this.getRightmostSideOfSegment(de, index - 1)\n if (side < 0) {\n this._minCoord = null\n this.checkForRightmostCoordinate(de)\n }\n return side\n }\n findRightmostEdgeAtVertex() {\n const pts = this._minDe.getEdge().getCoordinates()\n Assert.isTrue(this._minIndex > 0 && this._minIndex < pts.length, 'rightmost point expected to be interior vertex of edge')\n const pPrev = pts[this._minIndex - 1]\n const pNext = pts[this._minIndex + 1]\n const orientation = Orientation.index(this._minCoord, pNext, pPrev)\n let usePrev = false\n if (pPrev.y < this._minCoord.y && pNext.y < this._minCoord.y && orientation === Orientation.COUNTERCLOCKWISE) \n usePrev = true\n else if (pPrev.y > this._minCoord.y && pNext.y > this._minCoord.y && orientation === Orientation.CLOCKWISE) \n usePrev = true\n \n if (usePrev) \n this._minIndex = this._minIndex - 1\n \n }\n getRightmostSideOfSegment(de, i) {\n const e = de.getEdge()\n const coord = e.getCoordinates()\n if (i < 0 || i + 1 >= coord.length) return -1\n if (coord[i].y === coord[i + 1].y) return -1\n let pos = Position.LEFT\n if (coord[i].y < coord[i + 1].y) pos = Position.RIGHT\n return pos\n }\n getEdge() {\n return this._orientedDe\n }\n checkForRightmostCoordinate(de) {\n const coord = de.getEdge().getCoordinates()\n for (let i = 0; i < coord.length - 1; i++) \n if (this._minCoord === null || coord[i].x > this._minCoord.x) {\n this._minDe = de\n this._minIndex = i\n this._minCoord = coord[i]\n }\n \n }\n findRightmostEdgeAtNode() {\n const node = this._minDe.getNode()\n const star = node.getEdges()\n this._minDe = star.getRightmostEdge()\n if (!this._minDe.isForward()) {\n this._minDe = this._minDe.getSym()\n this._minIndex = this._minDe.getEdge().getCoordinates().length - 1\n }\n }\n findEdge(dirEdgeList) {\n for (let i = dirEdgeList.iterator(); i.hasNext(); ) {\n const de = i.next()\n if (!de.isForward()) continue\n this.checkForRightmostCoordinate(de)\n }\n Assert.isTrue(this._minIndex !== 0 || this._minCoord.equals(this._minDe.getCoordinate()), 'inconsistency in rightmost processing')\n if (this._minIndex === 0) \n this.findRightmostEdgeAtNode()\n else \n this.findRightmostEdgeAtVertex()\n \n this._orientedDe = this._minDe\n const rightmostSide = this.getRightmostSide(this._minDe, this._minIndex)\n if (rightmostSide === Position.LEFT) \n this._orientedDe = this._minDe.getSym()\n \n }\n}\n","import Coordinate from './Coordinate.js'\nimport RuntimeException from '../../../../java/lang/RuntimeException.js'\n\nexport default class TopologyException extends RuntimeException {\n constructor(msg, pt) {\n super(pt ? msg + ' [ ' + pt + ' ]' : msg)\n this.pt = pt ? new Coordinate(pt) : undefined\n this.name = Object.keys({ TopologyException })[0]\n }\n getCoordinate() {\n return this.pt\n }\n}\n","export default class LinkedList {\n constructor() {\n this.array = []\n }\n\n addLast(e) {\n this.array.push(e)\n }\n\n removeFirst() {\n return this.array.shift()\n }\n\n isEmpty() {\n return this.array.length === 0\n }\n}\n","import HashSet from '../../../../../java/util/HashSet.js'\nimport Position from '../../geomgraph/Position.js'\nimport Stack from '../../../../../java/util/Stack.js'\nimport RightmostEdgeFinder from './RightmostEdgeFinder.js'\nimport TopologyException from '../../geom/TopologyException.js'\nimport LinkedList from '../../../../../java/util/LinkedList.js'\nimport Comparable from '../../../../../java/lang/Comparable.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Envelope from '../../geom/Envelope.js'\nexport default class BufferSubgraph {\n constructor() {\n BufferSubgraph.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._finder = null\n this._dirEdgeList = new ArrayList()\n this._nodes = new ArrayList()\n this._rightMostCoord = null\n this._env = null\n this._finder = new RightmostEdgeFinder()\n }\n clearVisitedEdges() {\n for (let it = this._dirEdgeList.iterator(); it.hasNext(); ) {\n const de = it.next()\n de.setVisited(false)\n }\n }\n getRightmostCoordinate() {\n return this._rightMostCoord\n }\n computeNodeDepth(n) {\n let startEdge = null\n for (let i = n.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n if (de.isVisited() || de.getSym().isVisited()) {\n startEdge = de\n break\n }\n }\n if (startEdge === null) throw new TopologyException('unable to find edge to compute depths at ' + n.getCoordinate())\n n.getEdges().computeDepths(startEdge)\n for (let i = n.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n de.setVisited(true)\n this.copySymDepths(de)\n }\n }\n computeDepth(outsideDepth) {\n this.clearVisitedEdges()\n const de = this._finder.getEdge()\n const n = de.getNode()\n const label = de.getLabel()\n de.setEdgeDepths(Position.RIGHT, outsideDepth)\n this.copySymDepths(de)\n this.computeDepths(de)\n }\n create(node) {\n this.addReachable(node)\n this._finder.findEdge(this._dirEdgeList)\n this._rightMostCoord = this._finder.getCoordinate()\n }\n findResultEdges() {\n for (let it = this._dirEdgeList.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.getDepth(Position.RIGHT) >= 1 && de.getDepth(Position.LEFT) <= 0 && !de.isInteriorAreaEdge()) \n de.setInResult(true)\n \n }\n }\n computeDepths(startEdge) {\n const nodesVisited = new HashSet()\n const nodeQueue = new LinkedList()\n const startNode = startEdge.getNode()\n nodeQueue.addLast(startNode)\n nodesVisited.add(startNode)\n startEdge.setVisited(true)\n while (!nodeQueue.isEmpty()) {\n const n = nodeQueue.removeFirst()\n nodesVisited.add(n)\n this.computeNodeDepth(n)\n for (let i = n.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n const sym = de.getSym()\n if (sym.isVisited()) continue\n const adjNode = sym.getNode()\n if (!nodesVisited.contains(adjNode)) {\n nodeQueue.addLast(adjNode)\n nodesVisited.add(adjNode)\n }\n }\n }\n }\n compareTo(o) {\n const graph = o\n if (this._rightMostCoord.x < graph._rightMostCoord.x) \n return -1\n \n if (this._rightMostCoord.x > graph._rightMostCoord.x) \n return 1\n \n return 0\n }\n getEnvelope() {\n if (this._env === null) {\n const edgeEnv = new Envelope()\n for (let it = this._dirEdgeList.iterator(); it.hasNext(); ) {\n const dirEdge = it.next()\n const pts = dirEdge.getEdge().getCoordinates()\n for (let i = 0; i < pts.length - 1; i++) \n edgeEnv.expandToInclude(pts[i])\n \n }\n this._env = edgeEnv\n }\n return this._env\n }\n addReachable(startNode) {\n const nodeStack = new Stack()\n nodeStack.add(startNode)\n while (!nodeStack.empty()) {\n const node = nodeStack.pop()\n this.add(node, nodeStack)\n }\n }\n copySymDepths(de) {\n const sym = de.getSym()\n sym.setDepth(Position.LEFT, de.getDepth(Position.RIGHT))\n sym.setDepth(Position.RIGHT, de.getDepth(Position.LEFT))\n }\n add(node, nodeStack) {\n node.setVisited(true)\n this._nodes.add(node)\n for (let i = node.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n this._dirEdgeList.add(de)\n const sym = de.getSym()\n const symNode = sym.getNode()\n if (!symNode.isVisited()) nodeStack.push(symNode)\n }\n }\n getNodes() {\n return this._nodes\n }\n getDirectedEdges() {\n return this._dirEdgeList\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nexport default class Intersection {\n static intersection(p1, p2, q1, q2) {\n const minX0 = p1.x < p2.x ? p1.x : p2.x\n const minY0 = p1.y < p2.y ? p1.y : p2.y\n const maxX0 = p1.x > p2.x ? p1.x : p2.x\n const maxY0 = p1.y > p2.y ? p1.y : p2.y\n const minX1 = q1.x < q2.x ? q1.x : q2.x\n const minY1 = q1.y < q2.y ? q1.y : q2.y\n const maxX1 = q1.x > q2.x ? q1.x : q2.x\n const maxY1 = q1.y > q2.y ? q1.y : q2.y\n const intMinX = minX0 > minX1 ? minX0 : minX1\n const intMaxX = maxX0 < maxX1 ? maxX0 : maxX1\n const intMinY = minY0 > minY1 ? minY0 : minY1\n const intMaxY = maxY0 < maxY1 ? maxY0 : maxY1\n const midx = (intMinX + intMaxX) / 2.0\n const midy = (intMinY + intMaxY) / 2.0\n const p1x = p1.x - midx\n const p1y = p1.y - midy\n const p2x = p2.x - midx\n const p2y = p2.y - midy\n const q1x = q1.x - midx\n const q1y = q1.y - midy\n const q2x = q2.x - midx\n const q2y = q2.y - midy\n const px = p1y - p2y\n const py = p2x - p1x\n const pw = p1x * p2y - p2x * p1y\n const qx = q1y - q2y\n const qy = q2x - q1x\n const qw = q1x * q2y - q2x * q1y\n const x = py * qw - qy * pw\n const y = qx * pw - px * qw\n const w = px * qy - qx * py\n const xInt = x / w\n const yInt = y / w\n if (Double.isNaN(xInt) || (Double.isInfinite(xInt) || Double.isNaN(yInt)) || Double.isInfinite(yInt)) \n return null\n \n return new Coordinate(xInt + midx, yInt + midy)\n }\n}\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport MathUtil from '../math/MathUtil.js'\nimport Envelope from '../geom/Envelope.js'\nexport default class Distance {\n static segmentToSegment(A, B, C, D) {\n if (A.equals(B)) return Distance.pointToSegment(A, C, D)\n if (C.equals(D)) return Distance.pointToSegment(D, A, B)\n let noIntersection = false\n if (!Envelope.intersects(A, B, C, D)) {\n noIntersection = true\n } else {\n const denom = (B.x - A.x) * (D.y - C.y) - (B.y - A.y) * (D.x - C.x)\n if (denom === 0) {\n noIntersection = true\n } else {\n const r_num = (A.y - C.y) * (D.x - C.x) - (A.x - C.x) * (D.y - C.y)\n const s_num = (A.y - C.y) * (B.x - A.x) - (A.x - C.x) * (B.y - A.y)\n const s = s_num / denom\n const r = r_num / denom\n if (r < 0 || r > 1 || s < 0 || s > 1) \n noIntersection = true\n \n }\n }\n if (noIntersection) \n return MathUtil.min(Distance.pointToSegment(A, C, D), Distance.pointToSegment(B, C, D), Distance.pointToSegment(C, A, B), Distance.pointToSegment(D, A, B))\n \n return 0.0\n }\n static pointToSegment(p, A, B) {\n if (A.x === B.x && A.y === B.y) return p.distance(A)\n const len2 = (B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)\n const r = ((p.x - A.x) * (B.x - A.x) + (p.y - A.y) * (B.y - A.y)) / len2\n if (r <= 0.0) return p.distance(A)\n if (r >= 1.0) return p.distance(B)\n const s = ((A.y - p.y) * (B.x - A.x) - (A.x - p.x) * (B.y - A.y)) / len2\n return Math.abs(s) * Math.sqrt(len2)\n }\n static pointToLinePerpendicular(p, A, B) {\n const len2 = (B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)\n const s = ((A.y - p.y) * (B.x - A.x) - (A.x - p.x) * (B.y - A.y)) / len2\n return Math.abs(s) * Math.sqrt(len2)\n }\n static pointToSegmentString(p, line) {\n if (line.length === 0) throw new IllegalArgumentException('Line array must contain at least one vertex')\n let minDistance = p.distance(line[0])\n for (let i = 0; i < line.length - 1; i++) {\n const dist = Distance.pointToSegment(p, line[i], line[i + 1])\n if (dist < minDistance) \n minDistance = dist\n \n }\n return minDistance\n }\n}\n","import WKTWriter from '../io/WKTWriter.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Assert from '../util/Assert.js'\nimport StringBuilder from '../../../../java/lang/StringBuilder.js'\nexport default class LineIntersector {\n constructor() {\n LineIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._result = null\n this._inputLines = Array(2).fill().map(() => Array(2))\n this._intPt = new Array(2).fill(null)\n this._intLineIndex = null\n this._isProper = null\n this._pa = null\n this._pb = null\n this._precisionModel = null\n this._intPt[0] = new Coordinate()\n this._intPt[1] = new Coordinate()\n this._pa = this._intPt[0]\n this._pb = this._intPt[1]\n this._result = 0\n }\n static computeEdgeDistance(p, p0, p1) {\n const dx = Math.abs(p1.x - p0.x)\n const dy = Math.abs(p1.y - p0.y)\n let dist = -1.0\n if (p.equals(p0)) {\n dist = 0.0\n } else if (p.equals(p1)) {\n if (dx > dy) dist = dx; else dist = dy\n } else {\n const pdx = Math.abs(p.x - p0.x)\n const pdy = Math.abs(p.y - p0.y)\n if (dx > dy) dist = pdx; else dist = pdy\n if (dist === 0.0 && !p.equals(p0)) \n dist = Math.max(pdx, pdy)\n \n }\n Assert.isTrue(!(dist === 0.0 && !p.equals(p0)), 'Bad distance calculation')\n return dist\n }\n static nonRobustComputeEdgeDistance(p, p1, p2) {\n const dx = p.x - p1.x\n const dy = p.y - p1.y\n const dist = Math.sqrt(dx * dx + dy * dy)\n Assert.isTrue(!(dist === 0.0 && !p.equals(p1)), 'Invalid distance calculation')\n return dist\n }\n getIndexAlongSegment(segmentIndex, intIndex) {\n this.computeIntLineIndex()\n return this._intLineIndex[segmentIndex][intIndex]\n }\n getTopologySummary() {\n const catBuilder = new StringBuilder()\n if (this.isEndPoint()) catBuilder.append(' endpoint')\n if (this._isProper) catBuilder.append(' proper')\n if (this.isCollinear()) catBuilder.append(' collinear')\n return catBuilder.toString()\n }\n computeIntersection(p1, p2, p3, p4) {\n this._inputLines[0][0] = p1\n this._inputLines[0][1] = p2\n this._inputLines[1][0] = p3\n this._inputLines[1][1] = p4\n this._result = this.computeIntersect(p1, p2, p3, p4)\n }\n getIntersectionNum() {\n return this._result\n }\n computeIntLineIndex() {\n if (arguments.length === 0) {\n if (this._intLineIndex === null) {\n this._intLineIndex = Array(2).fill().map(() => Array(2))\n this.computeIntLineIndex(0)\n this.computeIntLineIndex(1)\n }\n } else if (arguments.length === 1) {\n const segmentIndex = arguments[0]\n const dist0 = this.getEdgeDistance(segmentIndex, 0)\n const dist1 = this.getEdgeDistance(segmentIndex, 1)\n if (dist0 > dist1) {\n this._intLineIndex[segmentIndex][0] = 0\n this._intLineIndex[segmentIndex][1] = 1\n } else {\n this._intLineIndex[segmentIndex][0] = 1\n this._intLineIndex[segmentIndex][1] = 0\n }\n }\n }\n isProper() {\n return this.hasIntersection() && this._isProper\n }\n setPrecisionModel(precisionModel) {\n this._precisionModel = precisionModel\n }\n isInteriorIntersection() {\n if (arguments.length === 0) {\n if (this.isInteriorIntersection(0)) return true\n if (this.isInteriorIntersection(1)) return true\n return false\n } else if (arguments.length === 1) {\n const inputLineIndex = arguments[0]\n for (let i = 0; i < this._result; i++) \n if (!(this._intPt[i].equals2D(this._inputLines[inputLineIndex][0]) || this._intPt[i].equals2D(this._inputLines[inputLineIndex][1]))) \n return true\n \n \n return false\n }\n }\n getIntersection(intIndex) {\n return this._intPt[intIndex]\n }\n isEndPoint() {\n return this.hasIntersection() && !this._isProper\n }\n hasIntersection() {\n return this._result !== LineIntersector.NO_INTERSECTION\n }\n getEdgeDistance(segmentIndex, intIndex) {\n const dist = LineIntersector.computeEdgeDistance(this._intPt[intIndex], this._inputLines[segmentIndex][0], this._inputLines[segmentIndex][1])\n return dist\n }\n isCollinear() {\n return this._result === LineIntersector.COLLINEAR_INTERSECTION\n }\n toString() {\n return WKTWriter.toLineString(this._inputLines[0][0], this._inputLines[0][1]) + ' - ' + WKTWriter.toLineString(this._inputLines[1][0], this._inputLines[1][1]) + this.getTopologySummary()\n }\n getEndpoint(segmentIndex, ptIndex) {\n return this._inputLines[segmentIndex][ptIndex]\n }\n isIntersection(pt) {\n for (let i = 0; i < this._result; i++) \n if (this._intPt[i].equals2D(pt)) \n return true\n \n \n return false\n }\n getIntersectionAlongSegment(segmentIndex, intIndex) {\n this.computeIntLineIndex()\n return this._intPt[this._intLineIndex[segmentIndex][intIndex]]\n }\n}\nLineIntersector.DONT_INTERSECT = 0\nLineIntersector.DO_INTERSECT = 1\nLineIntersector.COLLINEAR = 2\nLineIntersector.NO_INTERSECTION = 0\nLineIntersector.POINT_INTERSECTION = 1\nLineIntersector.COLLINEAR_INTERSECTION = 2\n","import Coordinate from '../geom/Coordinate.js'\nimport Orientation from './Orientation.js'\nimport Intersection from './Intersection.js'\nimport CGAlgorithmsDD from './CGAlgorithmsDD.js'\nimport System from '../../../../java/lang/System.js'\nimport Envelope from '../geom/Envelope.js'\nimport Distance from './Distance.js'\nimport LineIntersector from './LineIntersector.js'\nexport default class RobustLineIntersector extends LineIntersector {\n constructor() {\n super()\n }\n static nearestEndpoint(p1, p2, q1, q2) {\n let nearestPt = p1\n let minDist = Distance.pointToSegment(p1, q1, q2)\n let dist = Distance.pointToSegment(p2, q1, q2)\n if (dist < minDist) {\n minDist = dist\n nearestPt = p2\n }\n dist = Distance.pointToSegment(q1, p1, p2)\n if (dist < minDist) {\n minDist = dist\n nearestPt = q1\n }\n dist = Distance.pointToSegment(q2, p1, p2)\n if (dist < minDist) {\n minDist = dist\n nearestPt = q2\n }\n return nearestPt\n }\n isInSegmentEnvelopes(intPt) {\n const env0 = new Envelope(this._inputLines[0][0], this._inputLines[0][1])\n const env1 = new Envelope(this._inputLines[1][0], this._inputLines[1][1])\n return env0.contains(intPt) && env1.contains(intPt)\n }\n computeIntersection() {\n if (arguments.length === 3) {\n const p = arguments[0], p1 = arguments[1], p2 = arguments[2]\n this._isProper = false\n if (Envelope.intersects(p1, p2, p)) \n if (Orientation.index(p1, p2, p) === 0 && Orientation.index(p2, p1, p) === 0) {\n this._isProper = true\n if (p.equals(p1) || p.equals(p2)) \n this._isProper = false\n \n this._result = LineIntersector.POINT_INTERSECTION\n return null\n }\n \n this._result = LineIntersector.NO_INTERSECTION\n } else {\n return super.computeIntersection.apply(this, arguments)\n }\n }\n intersection(p1, p2, q1, q2) {\n let intPt = this.intersectionSafe(p1, p2, q1, q2)\n if (!this.isInSegmentEnvelopes(intPt)) \n intPt = new Coordinate(RobustLineIntersector.nearestEndpoint(p1, p2, q1, q2))\n \n if (this._precisionModel !== null) \n this._precisionModel.makePrecise(intPt)\n \n return intPt\n }\n checkDD(p1, p2, q1, q2, intPt) {\n const intPtDD = CGAlgorithmsDD.intersection(p1, p2, q1, q2)\n const isIn = this.isInSegmentEnvelopes(intPtDD)\n System.out.println('DD in env = ' + isIn + ' --------------------- ' + intPtDD)\n if (intPt.distance(intPtDD) > 0.0001) \n System.out.println('Distance = ' + intPt.distance(intPtDD))\n \n }\n intersectionSafe(p1, p2, q1, q2) {\n let intPt = Intersection.intersection(p1, p2, q1, q2)\n if (intPt === null) intPt = RobustLineIntersector.nearestEndpoint(p1, p2, q1, q2)\n return intPt\n }\n computeCollinearIntersection(p1, p2, q1, q2) {\n const p1q1p2 = Envelope.intersects(p1, p2, q1)\n const p1q2p2 = Envelope.intersects(p1, p2, q2)\n const q1p1q2 = Envelope.intersects(q1, q2, p1)\n const q1p2q2 = Envelope.intersects(q1, q2, p2)\n if (p1q1p2 && p1q2p2) {\n this._intPt[0] = q1\n this._intPt[1] = q2\n return LineIntersector.COLLINEAR_INTERSECTION\n }\n if (q1p1q2 && q1p2q2) {\n this._intPt[0] = p1\n this._intPt[1] = p2\n return LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q1p2 && q1p1q2) {\n this._intPt[0] = q1\n this._intPt[1] = p1\n return q1.equals(p1) && !p1q2p2 && !q1p2q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q1p2 && q1p2q2) {\n this._intPt[0] = q1\n this._intPt[1] = p2\n return q1.equals(p2) && !p1q2p2 && !q1p1q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q2p2 && q1p1q2) {\n this._intPt[0] = q2\n this._intPt[1] = p1\n return q2.equals(p1) && !p1q1p2 && !q1p2q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q2p2 && q1p2q2) {\n this._intPt[0] = q2\n this._intPt[1] = p2\n return q2.equals(p2) && !p1q1p2 && !q1p1q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n return LineIntersector.NO_INTERSECTION\n }\n computeIntersect(p1, p2, q1, q2) {\n this._isProper = false\n if (!Envelope.intersects(p1, p2, q1, q2)) return LineIntersector.NO_INTERSECTION\n const Pq1 = Orientation.index(p1, p2, q1)\n const Pq2 = Orientation.index(p1, p2, q2)\n if (Pq1 > 0 && Pq2 > 0 || Pq1 < 0 && Pq2 < 0) \n return LineIntersector.NO_INTERSECTION\n \n const Qp1 = Orientation.index(q1, q2, p1)\n const Qp2 = Orientation.index(q1, q2, p2)\n if (Qp1 > 0 && Qp2 > 0 || Qp1 < 0 && Qp2 < 0) \n return LineIntersector.NO_INTERSECTION\n \n const collinear = Pq1 === 0 && Pq2 === 0 && Qp1 === 0 && Qp2 === 0\n if (collinear) \n return this.computeCollinearIntersection(p1, p2, q1, q2)\n \n if (Pq1 === 0 || Pq2 === 0 || Qp1 === 0 || Qp2 === 0) {\n this._isProper = false\n if (p1.equals2D(q1) || p1.equals2D(q2)) \n this._intPt[0] = p1\n else if (p2.equals2D(q1) || p2.equals2D(q2)) \n this._intPt[0] = p2\n else if (Pq1 === 0) \n this._intPt[0] = new Coordinate(q1)\n else if (Pq2 === 0) \n this._intPt[0] = new Coordinate(q2)\n else if (Qp1 === 0) \n this._intPt[0] = new Coordinate(p1)\n else if (Qp2 === 0) \n this._intPt[0] = new Coordinate(p2)\n \n } else {\n this._isProper = true\n this._intPt[0] = this.intersection(p1, p2, q1, q2)\n }\n return LineIntersector.POINT_INTERSECTION\n }\n}\n","import Location from '../geom/Location.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Orientation from './Orientation.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nexport default class RayCrossingCounter {\n constructor() {\n RayCrossingCounter.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._p = null\n this._crossingCount = 0\n this._isPointOnSegment = false\n const p = arguments[0]\n this._p = p\n }\n static locatePointInRing() {\n if (arguments[0] instanceof Coordinate && hasInterface(arguments[1], CoordinateSequence)) {\n const p = arguments[0], ring = arguments[1]\n const counter = new RayCrossingCounter(p)\n const p1 = new Coordinate()\n const p2 = new Coordinate()\n for (let i = 1; i < ring.size(); i++) {\n ring.getCoordinate(i, p1)\n ring.getCoordinate(i - 1, p2)\n counter.countSegment(p1, p2)\n if (counter.isOnSegment()) return counter.getLocation()\n }\n return counter.getLocation()\n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Array) {\n const p = arguments[0], ring = arguments[1]\n const counter = new RayCrossingCounter(p)\n for (let i = 1; i < ring.length; i++) {\n const p1 = ring[i]\n const p2 = ring[i - 1]\n counter.countSegment(p1, p2)\n if (counter.isOnSegment()) return counter.getLocation()\n }\n return counter.getLocation()\n }\n }\n countSegment(p1, p2) {\n if (p1.x < this._p.x && p2.x < this._p.x) return null\n if (this._p.x === p2.x && this._p.y === p2.y) {\n this._isPointOnSegment = true\n return null\n }\n if (p1.y === this._p.y && p2.y === this._p.y) {\n let minx = p1.x\n let maxx = p2.x\n if (minx > maxx) {\n minx = p2.x\n maxx = p1.x\n }\n if (this._p.x >= minx && this._p.x <= maxx) \n this._isPointOnSegment = true\n \n return null\n }\n if (p1.y > this._p.y && p2.y <= this._p.y || p2.y > this._p.y && p1.y <= this._p.y) {\n let orient = Orientation.index(p1, p2, this._p)\n if (orient === Orientation.COLLINEAR) {\n this._isPointOnSegment = true\n return null\n }\n if (p2.y < p1.y) \n orient = -orient\n \n if (orient === Orientation.LEFT) \n this._crossingCount++\n \n }\n }\n isPointInPolygon() {\n return this.getLocation() !== Location.EXTERIOR\n }\n getLocation() {\n if (this._isPointOnSegment) return Location.BOUNDARY\n if (this._crossingCount % 2 === 1) \n return Location.INTERIOR\n \n return Location.EXTERIOR\n }\n isOnSegment() {\n return this._isPointOnSegment\n }\n}\n","import Location from '../geom/Location.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nimport RobustLineIntersector from './RobustLineIntersector.js'\nimport RayCrossingCounter from './RayCrossingCounter.js'\nexport default class PointLocation {\n static isOnLine() {\n if (arguments[0] instanceof Coordinate && hasInterface(arguments[1], CoordinateSequence)) {\n const p = arguments[0], line = arguments[1]\n const lineIntersector = new RobustLineIntersector()\n const p0 = new Coordinate()\n const p1 = new Coordinate()\n const n = line.size()\n for (let i = 1; i < n; i++) {\n line.getCoordinate(i - 1, p0)\n line.getCoordinate(i, p1)\n lineIntersector.computeIntersection(p, p0, p1)\n if (lineIntersector.hasIntersection()) \n return true\n \n }\n return false\n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Array) {\n const p = arguments[0], line = arguments[1]\n const lineIntersector = new RobustLineIntersector()\n for (let i = 1; i < line.length; i++) {\n const p0 = line[i - 1]\n const p1 = line[i]\n lineIntersector.computeIntersection(p, p0, p1)\n if (lineIntersector.hasIntersection()) \n return true\n \n }\n return false\n }\n }\n static locateInRing(p, ring) {\n return RayCrossingCounter.locatePointInRing(p, ring)\n }\n static isInRing(p, ring) {\n return PointLocation.locateInRing(p, ring) !== Location.EXTERIOR\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Location from '../geom/Location.js'\nimport Position from './Position.js'\nexport default class TopologyLocation {\n constructor() {\n TopologyLocation.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.location = null\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const location = arguments[0]\n this.init(location.length)\n } else if (Number.isInteger(arguments[0])) {\n const on = arguments[0]\n this.init(1)\n this.location[Position.ON] = on\n } else if (arguments[0] instanceof TopologyLocation) {\n const gl = arguments[0]\n this.init(gl.location.length)\n if (gl !== null) \n for (let i = 0; i < this.location.length; i++) \n this.location[i] = gl.location[i]\n \n \n }\n } else if (arguments.length === 3) {\n const on = arguments[0], left = arguments[1], right = arguments[2]\n this.init(3)\n this.location[Position.ON] = on\n this.location[Position.LEFT] = left\n this.location[Position.RIGHT] = right\n }\n }\n setAllLocations(locValue) {\n for (let i = 0; i < this.location.length; i++) \n this.location[i] = locValue\n \n }\n isNull() {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] !== Location.NONE) return false\n \n return true\n }\n setAllLocationsIfNull(locValue) {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] === Location.NONE) this.location[i] = locValue\n \n }\n isLine() {\n return this.location.length === 1\n }\n merge(gl) {\n if (gl.location.length > this.location.length) {\n const newLoc = new Array(3).fill(null)\n newLoc[Position.ON] = this.location[Position.ON]\n newLoc[Position.LEFT] = Location.NONE\n newLoc[Position.RIGHT] = Location.NONE\n this.location = newLoc\n }\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] === Location.NONE && i < gl.location.length) this.location[i] = gl.location[i]\n \n }\n getLocations() {\n return this.location\n }\n flip() {\n if (this.location.length <= 1) return null\n const temp = this.location[Position.LEFT]\n this.location[Position.LEFT] = this.location[Position.RIGHT]\n this.location[Position.RIGHT] = temp\n }\n toString() {\n const buf = new StringBuffer()\n if (this.location.length > 1) buf.append(Location.toLocationSymbol(this.location[Position.LEFT]))\n buf.append(Location.toLocationSymbol(this.location[Position.ON]))\n if (this.location.length > 1) buf.append(Location.toLocationSymbol(this.location[Position.RIGHT]))\n return buf.toString()\n }\n setLocations(on, left, right) {\n this.location[Position.ON] = on\n this.location[Position.LEFT] = left\n this.location[Position.RIGHT] = right\n }\n get(posIndex) {\n if (posIndex < this.location.length) return this.location[posIndex]\n return Location.NONE\n }\n isArea() {\n return this.location.length > 1\n }\n isAnyNull() {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] === Location.NONE) return true\n \n return false\n }\n setLocation() {\n if (arguments.length === 1) {\n const locValue = arguments[0]\n this.setLocation(Position.ON, locValue)\n } else if (arguments.length === 2) {\n const locIndex = arguments[0], locValue = arguments[1]\n this.location[locIndex] = locValue\n }\n }\n init(size) {\n this.location = new Array(size).fill(null)\n this.setAllLocations(Location.NONE)\n }\n isEqualOnSide(le, locIndex) {\n return this.location[locIndex] === le.location[locIndex]\n }\n allPositionsEqual(loc) {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] !== loc) return false\n \n return true\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport TopologyLocation from './TopologyLocation.js'\nexport default class Label {\n constructor() {\n Label.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.elt = new Array(2).fill(null)\n if (arguments.length === 1) {\n if (Number.isInteger(arguments[0])) {\n const onLoc = arguments[0]\n this.elt[0] = new TopologyLocation(onLoc)\n this.elt[1] = new TopologyLocation(onLoc)\n } else if (arguments[0] instanceof Label) {\n const lbl = arguments[0]\n this.elt[0] = new TopologyLocation(lbl.elt[0])\n this.elt[1] = new TopologyLocation(lbl.elt[1])\n }\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], onLoc = arguments[1]\n this.elt[0] = new TopologyLocation(Location.NONE)\n this.elt[1] = new TopologyLocation(Location.NONE)\n this.elt[geomIndex].setLocation(onLoc)\n } else if (arguments.length === 3) {\n const onLoc = arguments[0], leftLoc = arguments[1], rightLoc = arguments[2]\n this.elt[0] = new TopologyLocation(onLoc, leftLoc, rightLoc)\n this.elt[1] = new TopologyLocation(onLoc, leftLoc, rightLoc)\n } else if (arguments.length === 4) {\n const geomIndex = arguments[0], onLoc = arguments[1], leftLoc = arguments[2], rightLoc = arguments[3]\n this.elt[0] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE)\n this.elt[1] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE)\n this.elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc)\n }\n }\n static toLineLabel(label) {\n const lineLabel = new Label(Location.NONE)\n for (let i = 0; i < 2; i++) \n lineLabel.setLocation(i, label.getLocation(i))\n \n return lineLabel\n }\n getGeometryCount() {\n let count = 0\n if (!this.elt[0].isNull()) count++\n if (!this.elt[1].isNull()) count++\n return count\n }\n setAllLocations(geomIndex, location) {\n this.elt[geomIndex].setAllLocations(location)\n }\n isNull(geomIndex) {\n return this.elt[geomIndex].isNull()\n }\n setAllLocationsIfNull() {\n if (arguments.length === 1) {\n const location = arguments[0]\n this.setAllLocationsIfNull(0, location)\n this.setAllLocationsIfNull(1, location)\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], location = arguments[1]\n this.elt[geomIndex].setAllLocationsIfNull(location)\n }\n }\n isLine(geomIndex) {\n return this.elt[geomIndex].isLine()\n }\n merge(lbl) {\n for (let i = 0; i < 2; i++) \n if (this.elt[i] === null && lbl.elt[i] !== null) \n this.elt[i] = new TopologyLocation(lbl.elt[i])\n else \n this.elt[i].merge(lbl.elt[i])\n \n \n }\n flip() {\n this.elt[0].flip()\n this.elt[1].flip()\n }\n getLocation() {\n if (arguments.length === 1) {\n const geomIndex = arguments[0]\n return this.elt[geomIndex].get(Position.ON)\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], posIndex = arguments[1]\n return this.elt[geomIndex].get(posIndex)\n }\n }\n toString() {\n const buf = new StringBuffer()\n if (this.elt[0] !== null) {\n buf.append('A:')\n buf.append(this.elt[0].toString())\n }\n if (this.elt[1] !== null) {\n buf.append(' B:')\n buf.append(this.elt[1].toString())\n }\n return buf.toString()\n }\n isArea() {\n if (arguments.length === 0) {\n return this.elt[0].isArea() || this.elt[1].isArea()\n } else if (arguments.length === 1) {\n const geomIndex = arguments[0]\n return this.elt[geomIndex].isArea()\n }\n }\n isAnyNull(geomIndex) {\n return this.elt[geomIndex].isAnyNull()\n }\n setLocation() {\n if (arguments.length === 2) {\n const geomIndex = arguments[0], location = arguments[1]\n this.elt[geomIndex].setLocation(Position.ON, location)\n } else if (arguments.length === 3) {\n const geomIndex = arguments[0], posIndex = arguments[1], location = arguments[2]\n this.elt[geomIndex].setLocation(posIndex, location)\n }\n }\n isEqualOnSide(lbl, side) {\n return this.elt[0].isEqualOnSide(lbl.elt[0], side) && this.elt[1].isEqualOnSide(lbl.elt[1], side)\n }\n allPositionsEqual(geomIndex, loc) {\n return this.elt[geomIndex].allPositionsEqual(loc)\n }\n toLine(geomIndex) {\n if (this.elt[geomIndex].isArea()) this.elt[geomIndex] = new TopologyLocation(this.elt[geomIndex].location[0])\n }\n}\n","import Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport PointLocation from '../algorithm/PointLocation.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport Label from './Label.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Assert from '../util/Assert.js'\nexport default class EdgeRing {\n constructor() {\n EdgeRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._startDe = null\n this._maxNodeDegree = -1\n this._edges = new ArrayList()\n this._pts = new ArrayList()\n this._label = new Label(Location.NONE)\n this._ring = null\n this._isHole = null\n this._shell = null\n this._holes = new ArrayList()\n this._geometryFactory = null\n if (arguments.length === 0) {} else if (arguments.length === 2) {\n const start = arguments[0], geometryFactory = arguments[1]\n this._geometryFactory = geometryFactory\n this.computePoints(start)\n this.computeRing()\n }\n }\n computeRing() {\n if (this._ring !== null) return null\n const coord = new Array(this._pts.size()).fill(null)\n for (let i = 0; i < this._pts.size(); i++) \n coord[i] = this._pts.get(i)\n \n this._ring = this._geometryFactory.createLinearRing(coord)\n this._isHole = Orientation.isCCW(this._ring.getCoordinates())\n }\n isIsolated() {\n return this._label.getGeometryCount() === 1\n }\n computePoints(start) {\n this._startDe = start\n let de = start\n let isFirstEdge = true\n do {\n if (de === null) throw new TopologyException('Found null DirectedEdge')\n if (de.getEdgeRing() === this) throw new TopologyException('Directed Edge visited twice during ring-building at ' + de.getCoordinate())\n this._edges.add(de)\n const label = de.getLabel()\n Assert.isTrue(label.isArea())\n this.mergeLabel(label)\n this.addPoints(de.getEdge(), de.isForward(), isFirstEdge)\n isFirstEdge = false\n this.setEdgeRing(de, this)\n de = this.getNext(de)\n } while (de !== this._startDe)\n }\n getLinearRing() {\n return this._ring\n }\n getCoordinate(i) {\n return this._pts.get(i)\n }\n computeMaxNodeDegree() {\n this._maxNodeDegree = 0\n let de = this._startDe\n do {\n const node = de.getNode()\n const degree = node.getEdges().getOutgoingDegree(this)\n if (degree > this._maxNodeDegree) this._maxNodeDegree = degree\n de = this.getNext(de)\n } while (de !== this._startDe)\n this._maxNodeDegree *= 2\n }\n addPoints(edge, isForward, isFirstEdge) {\n const edgePts = edge.getCoordinates()\n if (isForward) {\n let startIndex = 1\n if (isFirstEdge) startIndex = 0\n for (let i = startIndex; i < edgePts.length; i++) \n this._pts.add(edgePts[i])\n \n } else {\n let startIndex = edgePts.length - 2\n if (isFirstEdge) startIndex = edgePts.length - 1\n for (let i = startIndex; i >= 0; i--) \n this._pts.add(edgePts[i])\n \n }\n }\n isHole() {\n return this._isHole\n }\n setInResult() {\n let de = this._startDe\n do {\n de.getEdge().setInResult(true)\n de = de.getNext()\n } while (de !== this._startDe)\n }\n containsPoint(p) {\n const shell = this.getLinearRing()\n const env = shell.getEnvelopeInternal()\n if (!env.contains(p)) return false\n if (!PointLocation.isInRing(p, shell.getCoordinates())) return false\n for (let i = this._holes.iterator(); i.hasNext(); ) {\n const hole = i.next()\n if (hole.containsPoint(p)) return false\n }\n return true\n }\n addHole(ring) {\n this._holes.add(ring)\n }\n isShell() {\n return this._shell === null\n }\n getLabel() {\n return this._label\n }\n getEdges() {\n return this._edges\n }\n getMaxNodeDegree() {\n if (this._maxNodeDegree < 0) this.computeMaxNodeDegree()\n return this._maxNodeDegree\n }\n getShell() {\n return this._shell\n }\n mergeLabel() {\n if (arguments.length === 1) {\n const deLabel = arguments[0]\n this.mergeLabel(deLabel, 0)\n this.mergeLabel(deLabel, 1)\n } else if (arguments.length === 2) {\n const deLabel = arguments[0], geomIndex = arguments[1]\n const loc = deLabel.getLocation(geomIndex, Position.RIGHT)\n if (loc === Location.NONE) return null\n if (this._label.getLocation(geomIndex) === Location.NONE) {\n this._label.setLocation(geomIndex, loc)\n return null\n }\n }\n }\n setShell(shell) {\n this._shell = shell\n if (shell !== null) shell.addHole(this)\n }\n toPolygon(geometryFactory) {\n const holeLR = new Array(this._holes.size()).fill(null)\n for (let i = 0; i < this._holes.size(); i++) \n holeLR[i] = this._holes.get(i).getLinearRing()\n \n const poly = geometryFactory.createPolygon(this.getLinearRing(), holeLR)\n return poly\n }\n}\n","import EdgeRing from '../../geomgraph/EdgeRing.js'\nexport default class MinimalEdgeRing extends EdgeRing {\n constructor() {\n super()\n MinimalEdgeRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const start = arguments[0], geometryFactory = arguments[1]\n EdgeRing.constructor_.call(this, start, geometryFactory)\n }\n setEdgeRing(de, er) {\n de.setMinEdgeRing(er)\n }\n getNext(de) {\n return de.getNextMin()\n }\n}\n","import MinimalEdgeRing from './MinimalEdgeRing.js'\nimport EdgeRing from '../../geomgraph/EdgeRing.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class MaximalEdgeRing extends EdgeRing {\n constructor() {\n super()\n MaximalEdgeRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const start = arguments[0], geometryFactory = arguments[1]\n EdgeRing.constructor_.call(this, start, geometryFactory)\n }\n buildMinimalRings() {\n const minEdgeRings = new ArrayList()\n let de = this._startDe\n do {\n if (de.getMinEdgeRing() === null) {\n const minEr = new MinimalEdgeRing(de, this._geometryFactory)\n minEdgeRings.add(minEr)\n }\n de = de.getNext()\n } while (de !== this._startDe)\n return minEdgeRings\n }\n setEdgeRing(de, er) {\n de.setEdgeRing(er)\n }\n linkDirectedEdgesForMinimalEdgeRings() {\n let de = this._startDe\n do {\n const node = de.getNode()\n node.getEdges().linkMinimalDirectedEdges(this)\n de = de.getNext()\n } while (de !== this._startDe)\n }\n getNext(de) {\n return de.getNext()\n }\n}\n","import Assert from '../util/Assert.js'\nexport default class GraphComponent {\n constructor() {\n GraphComponent.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._label = null\n this._isInResult = false\n this._isCovered = false\n this._isCoveredSet = false\n this._isVisited = false\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const label = arguments[0]\n this._label = label\n }\n }\n setVisited(isVisited) {\n this._isVisited = isVisited\n }\n setInResult(isInResult) {\n this._isInResult = isInResult\n }\n isCovered() {\n return this._isCovered\n }\n isCoveredSet() {\n return this._isCoveredSet\n }\n setLabel(label) {\n this._label = label\n }\n getLabel() {\n return this._label\n }\n setCovered(isCovered) {\n this._isCovered = isCovered\n this._isCoveredSet = true\n }\n updateIM(im) {\n Assert.isTrue(this._label.getGeometryCount() >= 2, 'found partial label')\n this.computeIM(im)\n }\n isInResult() {\n return this._isInResult\n }\n isVisited() {\n return this._isVisited\n }\n}\n","import Location from '../geom/Location.js'\nimport Label from './Label.js'\nimport GraphComponent from './GraphComponent.js'\nexport default class Node extends GraphComponent {\n constructor() {\n super()\n Node.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._coord = null\n this._edges = null\n const coord = arguments[0], edges = arguments[1]\n this._coord = coord\n this._edges = edges\n this._label = new Label(0, Location.NONE)\n }\n isIncidentEdgeInResult() {\n for (let it = this.getEdges().getEdges().iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.getEdge().isInResult()) return true\n }\n return false\n }\n isIsolated() {\n return this._label.getGeometryCount() === 1\n }\n getCoordinate() {\n return this._coord\n }\n print(out) {\n out.println('node ' + this._coord + ' lbl: ' + this._label)\n }\n computeIM(im) {}\n computeMergedLocation(label2, eltIndex) {\n let loc = Location.NONE\n loc = this._label.getLocation(eltIndex)\n if (!label2.isNull(eltIndex)) {\n const nLoc = label2.getLocation(eltIndex)\n if (loc !== Location.BOUNDARY) loc = nLoc\n }\n return loc\n }\n setLabel() {\n if (arguments.length === 2 && (Number.isInteger(arguments[1]) && Number.isInteger(arguments[0]))) {\n const argIndex = arguments[0], onLocation = arguments[1]\n if (this._label === null) \n this._label = new Label(argIndex, onLocation)\n else this._label.setLocation(argIndex, onLocation)\n } else {\n return super.setLabel.apply(this, arguments)\n }\n }\n getEdges() {\n return this._edges\n }\n mergeLabel() {\n if (arguments[0] instanceof Node) {\n const n = arguments[0]\n this.mergeLabel(n._label)\n } else if (arguments[0] instanceof Label) {\n const label2 = arguments[0]\n for (let i = 0; i < 2; i++) {\n const loc = this.computeMergedLocation(label2, i)\n const thisLoc = this._label.getLocation(i)\n if (thisLoc === Location.NONE) this._label.setLocation(i, loc)\n }\n }\n }\n add(e) {\n this._edges.insert(e)\n e.setNode(this)\n }\n setLabelBoundary(argIndex) {\n if (this._label === null) return null\n let loc = Location.NONE\n if (this._label !== null) loc = this._label.getLocation(argIndex)\n let newLoc = null\n switch (loc) {\n case Location.BOUNDARY:\n newLoc = Location.INTERIOR\n break\n case Location.INTERIOR:\n newLoc = Location.BOUNDARY\n break\n default:\n newLoc = Location.BOUNDARY\n break\n }\n this._label.setLocation(argIndex, newLoc)\n }\n}\n","import Map from './Map.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/SortedMap.html\n */\nexport default class SortedMap extends Map {}\n","import ArrayList from './ArrayList.js'\nimport SortedMap from './SortedMap.js'\nimport HashSet from './HashSet.js'\n\nconst BLACK = 0\nconst RED = 1\n\nfunction colorOf(p) {\n return (p == null ? BLACK : p.color)\n}\nfunction parentOf(p) {\n return (p == null ? null : p.parent)\n}\nfunction setColor(p, c) {\n if (p !== null) p.color = c\n}\nfunction leftOf(p) {\n return (p == null ? null : p.left)\n}\nfunction rightOf(p) {\n return (p == null ? null : p.right)\n}\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/TreeMap.html\n */\nexport default class TreeMap extends SortedMap {\n constructor() {\n super()\n this.root_ = null\n this.size_ = 0\n }\n\n get(key) {\n let p = this.root_\n while (p !== null) {\n const cmp = key.compareTo(p.key)\n if (cmp < 0)\n p = p.left\n else if (cmp > 0)\n p = p.right\n else return p.value\n }\n return null\n }\n\n put(key, value) {\n if (this.root_ === null) {\n this.root_ = {\n key: key,\n value: value,\n left: null,\n right: null,\n parent: null,\n color: BLACK,\n getValue() {\n return this.value\n },\n getKey() {\n return this.key\n }\n }\n this.size_ = 1\n return null\n }\n let t = this.root_; let parent; let cmp\n do {\n parent = t\n cmp = key.compareTo(t.key)\n if (cmp < 0) {\n t = t.left\n } else if (cmp > 0) {\n t = t.right\n } else {\n const oldValue = t.value\n t.value = value\n return oldValue\n }\n } while (t !== null)\n const e = {\n key: key,\n left: null,\n right: null,\n value: value,\n parent: parent,\n color: BLACK,\n getValue() {\n return this.value\n },\n getKey() {\n return this.key\n }\n }\n if (cmp < 0)\n parent.left = e\n else parent.right = e\n\n this.fixAfterInsertion(e)\n this.size_++\n return null\n }\n\n /**\n * @param {Object} x\n */\n fixAfterInsertion(x) {\n let y\n x.color = RED\n while (x != null && x !== this.root_ && x.parent.color === RED)\n if (parentOf(x) === leftOf(parentOf(parentOf(x)))) {\n y = rightOf(parentOf(parentOf(x)))\n if (colorOf(y) === RED) {\n setColor(parentOf(x), BLACK)\n setColor(y, BLACK)\n setColor(parentOf(parentOf(x)), RED)\n x = parentOf(parentOf(x))\n } else {\n if (x === rightOf(parentOf(x))) {\n x = parentOf(x)\n this.rotateLeft(x)\n }\n setColor(parentOf(x), BLACK)\n setColor(parentOf(parentOf(x)), RED)\n this.rotateRight(parentOf(parentOf(x)))\n }\n } else {\n y = leftOf(parentOf(parentOf(x)))\n if (colorOf(y) === RED) {\n setColor(parentOf(x), BLACK)\n setColor(y, BLACK)\n setColor(parentOf(parentOf(x)), RED)\n x = parentOf(parentOf(x))\n } else {\n if (x === leftOf(parentOf(x))) {\n x = parentOf(x)\n this.rotateRight(x)\n }\n setColor(parentOf(x), BLACK)\n setColor(parentOf(parentOf(x)), RED)\n this.rotateLeft(parentOf(parentOf(x)))\n }\n }\n\n this.root_.color = BLACK\n }\n\n values() {\n const arrayList = new ArrayList()\n let p = this.getFirstEntry()\n if (p !== null) {\n arrayList.add(p.value)\n while ((p = TreeMap.successor(p)) !== null)\n arrayList.add(p.value)\n }\n return arrayList\n }\n\n entrySet() {\n const hashSet = new HashSet()\n let p = this.getFirstEntry()\n if (p !== null) {\n hashSet.add(p)\n while ((p = TreeMap.successor(p)) !== null)\n hashSet.add(p)\n }\n return hashSet\n }\n\n /**\n * @param {Object} p\n */\n rotateLeft(p) {\n if (p != null) {\n const r = p.right\n p.right = r.left\n if (r.left != null)\n r.left.parent = p\n r.parent = p.parent\n if (p.parent == null)\n this.root_ = r\n else if (p.parent.left === p)\n p.parent.left = r\n else\n p.parent.right = r\n r.left = p\n p.parent = r\n }\n }\n\n /**\n * @param {Object} p\n */\n rotateRight(p) {\n if (p != null) {\n const l = p.left\n p.left = l.right\n if (l.right != null)\n l.right.parent = p\n l.parent = p.parent\n if (p.parent == null)\n this.root_ = l\n else if (p.parent.right === p)\n p.parent.right = l\n else\n p.parent.left = l\n l.right = p\n p.parent = l\n }\n }\n\n /**\n * @return {Object}\n */\n getFirstEntry() {\n let p = this.root_\n if (p != null)\n while (p.left != null) p = p.left\n return p\n }\n\n /**\n * @param {Object} t\n * @return {Object}\n * @private\n */\n static successor(t) {\n let p\n if (t === null) {\n return null\n } else if (t.right !== null) {\n p = t.right\n while (p.left !== null)\n p = p.left\n return p\n } else {\n p = t.parent\n let ch = t\n while (p !== null && ch === p.right) {\n ch = p\n p = p.parent\n }\n return p\n }\n }\n\n size() {\n return this.size_\n }\n\n containsKey(key) {\n let p = this.root_\n while (p !== null) {\n const cmp = key.compareTo(p.key)\n if (cmp < 0)\n p = p.left\n else if (cmp > 0)\n p = p.right\n else return true\n }\n return false\n }\n}\n","import Location from '../geom/Location.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Node from './Node.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class NodeMap {\n constructor() {\n NodeMap.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.nodeMap = new TreeMap()\n this.nodeFact = null\n const nodeFact = arguments[0]\n this.nodeFact = nodeFact\n }\n find(coord) {\n return this.nodeMap.get(coord)\n }\n addNode() {\n if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n let node = this.nodeMap.get(coord)\n if (node === null) {\n node = this.nodeFact.createNode(coord)\n this.nodeMap.put(coord, node)\n }\n return node\n } else if (arguments[0] instanceof Node) {\n const n = arguments[0]\n const node = this.nodeMap.get(n.getCoordinate())\n if (node === null) {\n this.nodeMap.put(n.getCoordinate(), n)\n return n\n }\n node.mergeLabel(n)\n return node\n }\n }\n print(out) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const n = it.next()\n n.print(out)\n }\n }\n iterator() {\n return this.nodeMap.values().iterator()\n }\n values() {\n return this.nodeMap.values()\n }\n getBoundaryNodes(geomIndex) {\n const bdyNodes = new ArrayList()\n for (let i = this.iterator(); i.hasNext(); ) {\n const node = i.next()\n if (node.getLabel().getLocation(geomIndex) === Location.BOUNDARY) bdyNodes.add(node)\n }\n return bdyNodes\n }\n add(e) {\n const p = e.getCoordinate()\n const n = this.addNode(p)\n n.add(e)\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class Quadrant {\n static isNorthern(quad) {\n return quad === Quadrant.NE || quad === Quadrant.NW\n }\n static isOpposite(quad1, quad2) {\n if (quad1 === quad2) return false\n const diff = (quad1 - quad2 + 4) % 4\n if (diff === 2) return true\n return false\n }\n static commonHalfPlane(quad1, quad2) {\n if (quad1 === quad2) return quad1\n const diff = (quad1 - quad2 + 4) % 4\n if (diff === 2) return -1\n const min = quad1 < quad2 ? quad1 : quad2\n const max = quad1 > quad2 ? quad1 : quad2\n if (min === 0 && max === 3) return 3\n return min\n }\n static isInHalfPlane(quad, halfPlane) {\n if (halfPlane === Quadrant.SE) \n return quad === Quadrant.SE || quad === Quadrant.SW\n \n return quad === halfPlane || quad === halfPlane + 1\n }\n static quadrant() {\n if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const dx = arguments[0], dy = arguments[1]\n if (dx === 0.0 && dy === 0.0) throw new IllegalArgumentException('Cannot compute the quadrant for point ( ' + dx + ', ' + dy + ' )')\n if (dx >= 0.0) \n if (dy >= 0.0) return Quadrant.NE; else return Quadrant.SE\n else \n if (dy >= 0.0) return Quadrant.NW; else return Quadrant.SW\n \n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const p0 = arguments[0], p1 = arguments[1]\n if (p1.x === p0.x && p1.y === p0.y) throw new IllegalArgumentException('Cannot compute the quadrant for two identical points ' + p0)\n if (p1.x >= p0.x) \n if (p1.y >= p0.y) return Quadrant.NE; else return Quadrant.SE\n else \n if (p1.y >= p0.y) return Quadrant.NW; else return Quadrant.SW\n \n }\n }\n}\nQuadrant.NE = 0\nQuadrant.NW = 1\nQuadrant.SW = 2\nQuadrant.SE = 3\n","import Orientation from '../algorithm/Orientation.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Quadrant from './Quadrant.js'\nimport Assert from '../util/Assert.js'\nexport default class EdgeEnd {\n constructor() {\n EdgeEnd.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edge = null\n this._label = null\n this._node = null\n this._p0 = null\n this._p1 = null\n this._dx = null\n this._dy = null\n this._quadrant = null\n if (arguments.length === 1) {\n const edge = arguments[0]\n this._edge = edge\n } else if (arguments.length === 3) {\n const edge = arguments[0], p0 = arguments[1], p1 = arguments[2]\n EdgeEnd.constructor_.call(this, edge, p0, p1, null)\n } else if (arguments.length === 4) {\n const edge = arguments[0], p0 = arguments[1], p1 = arguments[2], label = arguments[3]\n EdgeEnd.constructor_.call(this, edge)\n this.init(p0, p1)\n this._label = label\n }\n }\n compareDirection(e) {\n if (this._dx === e._dx && this._dy === e._dy) return 0\n if (this._quadrant > e._quadrant) return 1\n if (this._quadrant < e._quadrant) return -1\n return Orientation.index(e._p0, e._p1, this._p1)\n }\n getDy() {\n return this._dy\n }\n getCoordinate() {\n return this._p0\n }\n setNode(node) {\n this._node = node\n }\n print(out) {\n const angle = Math.atan2(this._dy, this._dx)\n const className = this.getClass().getName()\n const lastDotPos = className.lastIndexOf('.')\n const name = className.substring(lastDotPos + 1)\n out.print(' ' + name + ': ' + this._p0 + ' - ' + this._p1 + ' ' + this._quadrant + ':' + angle + ' ' + this._label)\n }\n compareTo(obj) {\n const e = obj\n return this.compareDirection(e)\n }\n getDirectedCoordinate() {\n return this._p1\n }\n getDx() {\n return this._dx\n }\n getLabel() {\n return this._label\n }\n getEdge() {\n return this._edge\n }\n getQuadrant() {\n return this._quadrant\n }\n getNode() {\n return this._node\n }\n toString() {\n const angle = Math.atan2(this._dy, this._dx)\n const className = this.getClass().getName()\n const lastDotPos = className.lastIndexOf('.')\n const name = className.substring(lastDotPos + 1)\n return ' ' + name + ': ' + this._p0 + ' - ' + this._p1 + ' ' + this._quadrant + ':' + angle + ' ' + this._label\n }\n computeLabel(boundaryNodeRule) {}\n init(p0, p1) {\n this._p0 = p0\n this._p1 = p1\n this._dx = p1.x - p0.x\n this._dy = p1.y - p0.y\n this._quadrant = Quadrant.quadrant(this._dx, this._dy)\n Assert.isTrue(!(this._dx === 0 && this._dy === 0), 'EdgeEnd with identical endpoints found')\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import Location from '../geom/Location.js'\nimport EdgeEnd from './EdgeEnd.js'\nimport Position from './Position.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport Label from './Label.js'\nexport default class DirectedEdge extends EdgeEnd {\n constructor() {\n super()\n DirectedEdge.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._isForward = null\n this._isInResult = false\n this._isVisited = false\n this._sym = null\n this._next = null\n this._nextMin = null\n this._edgeRing = null\n this._minEdgeRing = null\n this._depth = [0, -999, -999]\n const edge = arguments[0], isForward = arguments[1]\n EdgeEnd.constructor_.call(this, edge)\n this._isForward = isForward\n if (isForward) {\n this.init(edge.getCoordinate(0), edge.getCoordinate(1))\n } else {\n const n = edge.getNumPoints() - 1\n this.init(edge.getCoordinate(n), edge.getCoordinate(n - 1))\n }\n this.computeDirectedLabel()\n }\n static depthFactor(currLocation, nextLocation) {\n if (currLocation === Location.EXTERIOR && nextLocation === Location.INTERIOR) return 1; else if (currLocation === Location.INTERIOR && nextLocation === Location.EXTERIOR) return -1\n return 0\n }\n getNextMin() {\n return this._nextMin\n }\n getDepth(position) {\n return this._depth[position]\n }\n setVisited(isVisited) {\n this._isVisited = isVisited\n }\n computeDirectedLabel() {\n this._label = new Label(this._edge.getLabel())\n if (!this._isForward) this._label.flip()\n }\n getNext() {\n return this._next\n }\n setDepth(position, depthVal) {\n if (this._depth[position] !== -999) \n if (this._depth[position] !== depthVal) throw new TopologyException('assigned depths do not match', this.getCoordinate())\n \n this._depth[position] = depthVal\n }\n isInteriorAreaEdge() {\n let isInteriorAreaEdge = true\n for (let i = 0; i < 2; i++) \n if (!(this._label.isArea(i) && this._label.getLocation(i, Position.LEFT) === Location.INTERIOR && this._label.getLocation(i, Position.RIGHT) === Location.INTERIOR)) \n isInteriorAreaEdge = false\n \n \n return isInteriorAreaEdge\n }\n setNextMin(nextMin) {\n this._nextMin = nextMin\n }\n print(out) {\n super.print.call(this, out)\n out.print(' ' + this._depth[Position.LEFT] + '/' + this._depth[Position.RIGHT])\n out.print(' (' + this.getDepthDelta() + ')')\n if (this._isInResult) out.print(' inResult')\n }\n setMinEdgeRing(minEdgeRing) {\n this._minEdgeRing = minEdgeRing\n }\n isLineEdge() {\n const isLine = this._label.isLine(0) || this._label.isLine(1)\n const isExteriorIfArea0 = !this._label.isArea(0) || this._label.allPositionsEqual(0, Location.EXTERIOR)\n const isExteriorIfArea1 = !this._label.isArea(1) || this._label.allPositionsEqual(1, Location.EXTERIOR)\n return isLine && isExteriorIfArea0 && isExteriorIfArea1\n }\n setEdgeRing(edgeRing) {\n this._edgeRing = edgeRing\n }\n getMinEdgeRing() {\n return this._minEdgeRing\n }\n getDepthDelta() {\n let depthDelta = this._edge.getDepthDelta()\n if (!this._isForward) depthDelta = -depthDelta\n return depthDelta\n }\n setInResult(isInResult) {\n this._isInResult = isInResult\n }\n getSym() {\n return this._sym\n }\n isForward() {\n return this._isForward\n }\n getEdge() {\n return this._edge\n }\n printEdge(out) {\n this.print(out)\n out.print(' ')\n if (this._isForward) this._edge.print(out); else this._edge.printReverse(out)\n }\n setSym(de) {\n this._sym = de\n }\n setVisitedEdge(isVisited) {\n this.setVisited(isVisited)\n this._sym.setVisited(isVisited)\n }\n setEdgeDepths(position, depth) {\n let depthDelta = this.getEdge().getDepthDelta()\n if (!this._isForward) depthDelta = -depthDelta\n let directionFactor = 1\n if (position === Position.LEFT) directionFactor = -1\n const oppositePos = Position.opposite(position)\n const delta = depthDelta * directionFactor\n const oppositeDepth = depth + delta\n this.setDepth(position, depth)\n this.setDepth(oppositePos, oppositeDepth)\n }\n getEdgeRing() {\n return this._edgeRing\n }\n isInResult() {\n return this._isInResult\n }\n setNext(next) {\n this._next = next\n }\n isVisited() {\n return this._isVisited\n }\n}\n","import Node from './Node.js'\nexport default class NodeFactory {\n createNode(coord) {\n return new Node(coord, null)\n }\n}\n","import Location from '../geom/Location.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Node from './Node.js'\nimport NodeMap from './NodeMap.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport DirectedEdge from './DirectedEdge.js'\nimport System from '../../../../java/lang/System.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Quadrant from './Quadrant.js'\nimport NodeFactory from './NodeFactory.js'\nexport default class PlanarGraph {\n constructor() {\n PlanarGraph.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edges = new ArrayList()\n this._nodes = null\n this._edgeEndList = new ArrayList()\n if (arguments.length === 0) {\n this._nodes = new NodeMap(new NodeFactory())\n } else if (arguments.length === 1) {\n const nodeFact = arguments[0]\n this._nodes = new NodeMap(nodeFact)\n }\n }\n static linkResultDirectedEdges(nodes) {\n for (let nodeit = nodes.iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().linkResultDirectedEdges()\n }\n }\n printEdges(out) {\n out.println('Edges:')\n for (let i = 0; i < this._edges.size(); i++) {\n out.println('edge ' + i + ':')\n const e = this._edges.get(i)\n e.print(out)\n e.eiList.print(out)\n }\n }\n find(coord) {\n return this._nodes.find(coord)\n }\n addNode() {\n if (arguments[0] instanceof Node) {\n const node = arguments[0]\n return this._nodes.addNode(node)\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n return this._nodes.addNode(coord)\n }\n }\n getNodeIterator() {\n return this._nodes.iterator()\n }\n linkResultDirectedEdges() {\n for (let nodeit = this._nodes.iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().linkResultDirectedEdges()\n }\n }\n debugPrintln(o) {\n System.out.println(o)\n }\n isBoundaryNode(geomIndex, coord) {\n const node = this._nodes.find(coord)\n if (node === null) return false\n const label = node.getLabel()\n if (label !== null && label.getLocation(geomIndex) === Location.BOUNDARY) return true\n return false\n }\n linkAllDirectedEdges() {\n for (let nodeit = this._nodes.iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().linkAllDirectedEdges()\n }\n }\n matchInSameDirection(p0, p1, ep0, ep1) {\n if (!p0.equals(ep0)) return false\n if (Orientation.index(p0, p1, ep1) === Orientation.COLLINEAR && Quadrant.quadrant(p0, p1) === Quadrant.quadrant(ep0, ep1)) return true\n return false\n }\n getEdgeEnds() {\n return this._edgeEndList\n }\n debugPrint(o) {\n System.out.print(o)\n }\n getEdgeIterator() {\n return this._edges.iterator()\n }\n findEdgeInSameDirection(p0, p1) {\n for (let i = 0; i < this._edges.size(); i++) {\n const e = this._edges.get(i)\n const eCoord = e.getCoordinates()\n if (this.matchInSameDirection(p0, p1, eCoord[0], eCoord[1])) return e\n if (this.matchInSameDirection(p0, p1, eCoord[eCoord.length - 1], eCoord[eCoord.length - 2])) return e\n }\n return null\n }\n insertEdge(e) {\n this._edges.add(e)\n }\n findEdgeEnd(e) {\n for (let i = this.getEdgeEnds().iterator(); i.hasNext(); ) {\n const ee = i.next()\n if (ee.getEdge() === e) return ee\n }\n return null\n }\n addEdges(edgesToAdd) {\n for (let it = edgesToAdd.iterator(); it.hasNext(); ) {\n const e = it.next()\n this._edges.add(e)\n const de1 = new DirectedEdge(e, true)\n const de2 = new DirectedEdge(e, false)\n de1.setSym(de2)\n de2.setSym(de1)\n this.add(de1)\n this.add(de2)\n }\n }\n add(e) {\n this._nodes.add(e)\n this._edgeEndList.add(e)\n }\n getNodes() {\n return this._nodes.values()\n }\n findEdge(p0, p1) {\n for (let i = 0; i < this._edges.size(); i++) {\n const e = this._edges.get(i)\n const eCoord = e.getCoordinates()\n if (p0.equals(eCoord[0]) && p1.equals(eCoord[1])) return e\n }\n return null\n }\n}\n","import PointLocation from '../../algorithm/PointLocation.js'\nimport TopologyException from '../../geom/TopologyException.js'\nimport MaximalEdgeRing from './MaximalEdgeRing.js'\nimport CoordinateArrays from '../../geom/CoordinateArrays.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Assert from '../../util/Assert.js'\nimport PlanarGraph from '../../geomgraph/PlanarGraph.js'\nexport default class PolygonBuilder {\n constructor() {\n PolygonBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geometryFactory = null\n this._shellList = new ArrayList()\n const geometryFactory = arguments[0]\n this._geometryFactory = geometryFactory\n }\n static findEdgeRingContaining(testEr, shellList) {\n const testRing = testEr.getLinearRing()\n const testEnv = testRing.getEnvelopeInternal()\n let testPt = testRing.getCoordinateN(0)\n let minShell = null\n let minShellEnv = null\n for (let it = shellList.iterator(); it.hasNext(); ) {\n const tryShell = it.next()\n const tryShellRing = tryShell.getLinearRing()\n const tryShellEnv = tryShellRing.getEnvelopeInternal()\n if (tryShellEnv.equals(testEnv)) continue\n if (!tryShellEnv.contains(testEnv)) continue\n testPt = CoordinateArrays.ptNotInList(testRing.getCoordinates(), tryShellRing.getCoordinates())\n let isContained = false\n if (PointLocation.isInRing(testPt, tryShellRing.getCoordinates())) isContained = true\n if (isContained) \n if (minShell === null || minShellEnv.contains(tryShellEnv)) {\n minShell = tryShell\n minShellEnv = minShell.getLinearRing().getEnvelopeInternal()\n }\n \n }\n return minShell\n }\n sortShellsAndHoles(edgeRings, shellList, freeHoleList) {\n for (let it = edgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (er.isHole()) \n freeHoleList.add(er)\n else \n shellList.add(er)\n \n }\n }\n computePolygons(shellList) {\n const resultPolyList = new ArrayList()\n for (let it = shellList.iterator(); it.hasNext(); ) {\n const er = it.next()\n const poly = er.toPolygon(this._geometryFactory)\n resultPolyList.add(poly)\n }\n return resultPolyList\n }\n placeFreeHoles(shellList, freeHoleList) {\n for (let it = freeHoleList.iterator(); it.hasNext(); ) {\n const hole = it.next()\n if (hole.getShell() === null) {\n const shell = PolygonBuilder.findEdgeRingContaining(hole, shellList)\n if (shell === null) throw new TopologyException('unable to assign hole to a shell', hole.getCoordinate(0))\n hole.setShell(shell)\n }\n }\n }\n buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList) {\n const edgeRings = new ArrayList()\n for (let it = maxEdgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (er.getMaxNodeDegree() > 2) {\n er.linkDirectedEdgesForMinimalEdgeRings()\n const minEdgeRings = er.buildMinimalRings()\n const shell = this.findShell(minEdgeRings)\n if (shell !== null) {\n this.placePolygonHoles(shell, minEdgeRings)\n shellList.add(shell)\n } else {\n freeHoleList.addAll(minEdgeRings)\n }\n } else {\n edgeRings.add(er)\n }\n }\n return edgeRings\n }\n buildMaximalEdgeRings(dirEdges) {\n const maxEdgeRings = new ArrayList()\n for (let it = dirEdges.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.isInResult() && de.getLabel().isArea()) \n if (de.getEdgeRing() === null) {\n const er = new MaximalEdgeRing(de, this._geometryFactory)\n maxEdgeRings.add(er)\n er.setInResult()\n }\n \n }\n return maxEdgeRings\n }\n placePolygonHoles(shell, minEdgeRings) {\n for (let it = minEdgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (er.isHole()) \n er.setShell(shell)\n \n }\n }\n getPolygons() {\n const resultPolyList = this.computePolygons(this._shellList)\n return resultPolyList\n }\n findShell(minEdgeRings) {\n let shellCount = 0\n let shell = null\n for (let it = minEdgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (!er.isHole()) {\n shell = er\n shellCount++\n }\n }\n Assert.isTrue(shellCount <= 1, 'found two shells in MinimalEdgeRing list')\n return shell\n }\n add() {\n if (arguments.length === 1) {\n const graph = arguments[0]\n this.add(graph.getEdgeEnds(), graph.getNodes())\n } else if (arguments.length === 2) {\n const dirEdges = arguments[0], nodes = arguments[1]\n PlanarGraph.linkResultDirectedEdges(nodes)\n const maxEdgeRings = this.buildMaximalEdgeRings(dirEdges)\n const freeHoleList = new ArrayList()\n const edgeRings = this.buildMinimalEdgeRings(maxEdgeRings, this._shellList, freeHoleList)\n this.sortShellsAndHoles(edgeRings, this._shellList, freeHoleList)\n this.placeFreeHoles(this._shellList, freeHoleList)\n }\n }\n}\n","export default class Boundable {\n getBounds() {}\n}\n","import Boundable from './Boundable.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nexport default class ItemBoundable {\n constructor() {\n ItemBoundable.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._bounds = null\n this._item = null\n const bounds = arguments[0], item = arguments[1]\n this._bounds = bounds\n this._item = item\n }\n getItem() {\n return this._item\n }\n getBounds() {\n return this._bounds\n }\n get interfaces_() {\n return [Boundable, Serializable]\n }\n}\n","import ArrayList from '../../../../java/util/ArrayList.js'\nexport default class PriorityQueue {\n constructor() {\n PriorityQueue.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._size = null\n this._items = null\n this._size = 0\n this._items = new ArrayList()\n this._items.add(null)\n }\n poll() {\n if (this.isEmpty()) return null\n const minItem = this._items.get(1)\n this._items.set(1, this._items.get(this._size))\n this._size -= 1\n this.reorder(1)\n return minItem\n }\n size() {\n return this._size\n }\n reorder(hole) {\n let child = null\n const tmp = this._items.get(hole)\n for (; hole * 2 <= this._size; hole = child) {\n child = hole * 2\n if (child !== this._size && this._items.get(child + 1).compareTo(this._items.get(child)) < 0) child++\n if (this._items.get(child).compareTo(tmp) < 0) this._items.set(hole, this._items.get(child)); else break\n }\n this._items.set(hole, tmp)\n }\n clear() {\n this._size = 0\n this._items.clear()\n }\n peek() {\n if (this.isEmpty()) return null\n const minItem = this._items.get(1)\n return minItem\n }\n isEmpty() {\n return this._size === 0\n }\n add(x) {\n this._items.add(null)\n this._size += 1\n let hole = this._size\n this._items.set(0, x)\n for (; x.compareTo(this._items.get(Math.trunc(hole / 2))) < 0; hole /= 2) \n this._items.set(hole, this._items.get(Math.trunc(hole / 2)))\n \n this._items.set(hole, x)\n }\n}\n","export default class SpatialIndex {\n insert(itemEnv, item) {}\n remove(itemEnv, item) {}\n query() {\n if (arguments.length === 1) {\n const searchEnv = arguments[0]\n } else if (arguments.length === 2) {\n const searchEnv = arguments[0], visitor = arguments[1]\n }\n }\n}\n","import Boundable from './Boundable.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport Assert from '../../util/Assert.js'\nexport default class AbstractNode {\n constructor() {\n AbstractNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._childBoundables = new ArrayList()\n this._bounds = null\n this._level = null\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const level = arguments[0]\n this._level = level\n }\n }\n getLevel() {\n return this._level\n }\n size() {\n return this._childBoundables.size()\n }\n getChildBoundables() {\n return this._childBoundables\n }\n addChildBoundable(childBoundable) {\n Assert.isTrue(this._bounds === null)\n this._childBoundables.add(childBoundable)\n }\n isEmpty() {\n return this._childBoundables.isEmpty()\n }\n getBounds() {\n if (this._bounds === null) \n this._bounds = this.computeBounds()\n \n return this._bounds\n }\n get interfaces_() {\n return [Boundable, Serializable]\n }\n}\n","import Arrays from './Arrays.js'\nimport ArrayList from './ArrayList.js'\n\nconst Collections = {\n reverseOrder: function() {\n return {\n compare(a, b) {\n return b.compareTo(a)\n }\n }\n },\n min: function(l) {\n Collections.sort(l)\n return l.get(0)\n },\n sort: function(l, c) {\n const a = l.toArray()\n if (c)\n Arrays.sort(a, c)\n else\n Arrays.sort(a)\n const i = l.iterator()\n for (let pos = 0, alen = a.length; pos < alen; pos++) {\n i.next()\n i.set(a[pos])\n }\n },\n singletonList: function(o) {\n const arrayList = new ArrayList()\n arrayList.add(o)\n return arrayList\n }\n}\n\nexport default Collections\n","export default class EnvelopeDistance {\n static maxDistance(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n let dist = EnvelopeDistance.distance(ax1, ay1, bx1, by1)\n dist = Math.max(dist, EnvelopeDistance.distance(ax1, ay1, bx2, by2))\n dist = Math.max(dist, EnvelopeDistance.distance(ax2, ay2, bx1, by1))\n dist = Math.max(dist, EnvelopeDistance.distance(ax2, ay2, bx2, by2))\n return dist\n }\n static distance(x1, y1, x2, y2) {\n const dx = x2 - x1\n const dy = y2 - y1\n return Math.sqrt(dx * dx + dy * dy)\n }\n static maximumDistance(env1, env2) {\n const minx = Math.min(env1.getMinX(), env2.getMinX())\n const miny = Math.min(env1.getMinY(), env2.getMinY())\n const maxx = Math.max(env1.getMaxX(), env2.getMaxX())\n const maxy = Math.max(env1.getMaxY(), env2.getMaxY())\n return EnvelopeDistance.distance(minx, miny, maxx, maxy)\n }\n static minMaxDistance(a, b) {\n const aminx = a.getMinX()\n const aminy = a.getMinY()\n const amaxx = a.getMaxX()\n const amaxy = a.getMaxY()\n const bminx = b.getMinX()\n const bminy = b.getMinY()\n const bmaxx = b.getMaxX()\n const bmaxy = b.getMaxY()\n let dist = EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bminx, bminy, bminx, bmaxy)\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bmaxx, bmaxy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bminx, bminy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bmaxx, bmaxy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bminx, bminy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bmaxx, bmaxy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bminx, bminy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bmaxx, bmaxy, bmaxx, bminy))\n return dist\n }\n}\n","import IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport AbstractNode from './AbstractNode.js'\nimport EnvelopeDistance from './EnvelopeDistance.js'\nimport Comparable from '../../../../../java/lang/Comparable.js'\nexport default class BoundablePair {\n constructor() {\n BoundablePair.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._boundable1 = null\n this._boundable2 = null\n this._distance = null\n this._itemDistance = null\n const boundable1 = arguments[0], boundable2 = arguments[1], itemDistance = arguments[2]\n this._boundable1 = boundable1\n this._boundable2 = boundable2\n this._itemDistance = itemDistance\n this._distance = this.distance()\n }\n static area(b) {\n return b.getBounds().getArea()\n }\n static isComposite(item) {\n return item instanceof AbstractNode\n }\n maximumDistance() {\n return EnvelopeDistance.maximumDistance(this._boundable1.getBounds(), this._boundable2.getBounds())\n }\n expandToQueue(priQ, minDistance) {\n const isComp1 = BoundablePair.isComposite(this._boundable1)\n const isComp2 = BoundablePair.isComposite(this._boundable2)\n if (isComp1 && isComp2) {\n if (BoundablePair.area(this._boundable1) > BoundablePair.area(this._boundable2)) {\n this.expand(this._boundable1, this._boundable2, false, priQ, minDistance)\n return null\n } else {\n this.expand(this._boundable2, this._boundable1, true, priQ, minDistance)\n return null\n }\n } else if (isComp1) {\n this.expand(this._boundable1, this._boundable2, false, priQ, minDistance)\n return null\n } else if (isComp2) {\n this.expand(this._boundable2, this._boundable1, true, priQ, minDistance)\n return null\n }\n throw new IllegalArgumentException('neither boundable is composite')\n }\n isLeaves() {\n return !(BoundablePair.isComposite(this._boundable1) || BoundablePair.isComposite(this._boundable2))\n }\n compareTo(o) {\n const nd = o\n if (this._distance < nd._distance) return -1\n if (this._distance > nd._distance) return 1\n return 0\n }\n expand(bndComposite, bndOther, isFlipped, priQ, minDistance) {\n const children = bndComposite.getChildBoundables()\n for (let i = children.iterator(); i.hasNext(); ) {\n const child = i.next()\n let bp = null\n if (isFlipped) \n bp = new BoundablePair(bndOther, child, this._itemDistance)\n else \n bp = new BoundablePair(child, bndOther, this._itemDistance)\n \n if (bp.getDistance() < minDistance) \n priQ.add(bp)\n \n }\n }\n getBoundable(i) {\n if (i === 0) return this._boundable1\n return this._boundable2\n }\n getDistance() {\n return this._distance\n }\n distance() {\n if (this.isLeaves()) \n return this._itemDistance.distance(this._boundable1, this._boundable2)\n \n return this._boundable1.getBounds().distance(this._boundable2.getBounds())\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","export default class ItemVisitor {\n visitItem(item) {}\n}\n","import ItemBoundable from './ItemBoundable.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport ItemVisitor from '../ItemVisitor.js'\nimport AbstractNode from './AbstractNode.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport Assert from '../../util/Assert.js'\nimport List from '../../../../../java/util/List.js'\nexport default class AbstractSTRtree {\n constructor() {\n AbstractSTRtree.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._root = null\n this._built = false\n this._itemBoundables = new ArrayList()\n this._nodeCapacity = null\n if (arguments.length === 0) {\n AbstractSTRtree.constructor_.call(this, AbstractSTRtree.DEFAULT_NODE_CAPACITY)\n } else if (arguments.length === 1) {\n const nodeCapacity = arguments[0]\n Assert.isTrue(nodeCapacity > 1, 'Node capacity must be greater than 1')\n this._nodeCapacity = nodeCapacity\n }\n }\n static compareDoubles(a, b) {\n return a > b ? 1 : a < b ? -1 : 0\n }\n queryInternal() {\n if (hasInterface(arguments[2], ItemVisitor) && (arguments[0] instanceof Object && arguments[1] instanceof AbstractNode)) {\n const searchBounds = arguments[0], node = arguments[1], visitor = arguments[2]\n const childBoundables = node.getChildBoundables()\n for (let i = 0; i < childBoundables.size(); i++) {\n const childBoundable = childBoundables.get(i)\n if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) \n continue\n \n if (childBoundable instanceof AbstractNode) \n this.queryInternal(searchBounds, childBoundable, visitor)\n else if (childBoundable instanceof ItemBoundable) \n visitor.visitItem(childBoundable.getItem())\n else \n Assert.shouldNeverReachHere()\n \n }\n } else if (hasInterface(arguments[2], List) && (arguments[0] instanceof Object && arguments[1] instanceof AbstractNode)) {\n const searchBounds = arguments[0], node = arguments[1], matches = arguments[2]\n const childBoundables = node.getChildBoundables()\n for (let i = 0; i < childBoundables.size(); i++) {\n const childBoundable = childBoundables.get(i)\n if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) \n continue\n \n if (childBoundable instanceof AbstractNode) \n this.queryInternal(searchBounds, childBoundable, matches)\n else if (childBoundable instanceof ItemBoundable) \n matches.add(childBoundable.getItem())\n else \n Assert.shouldNeverReachHere()\n \n }\n }\n }\n getNodeCapacity() {\n return this._nodeCapacity\n }\n lastNode(nodes) {\n return nodes.get(nodes.size() - 1)\n }\n size() {\n if (arguments.length === 0) {\n if (this.isEmpty()) \n return 0\n \n this.build()\n return this.size(this._root)\n } else if (arguments.length === 1) {\n const node = arguments[0]\n let size = 0\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof AbstractNode) \n size += this.size(childBoundable)\n else if (childBoundable instanceof ItemBoundable) \n size += 1\n \n }\n return size\n }\n }\n removeItem(node, item) {\n let childToRemove = null\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof ItemBoundable) \n if (childBoundable.getItem() === item) childToRemove = childBoundable\n \n }\n if (childToRemove !== null) {\n node.getChildBoundables().remove(childToRemove)\n return true\n }\n return false\n }\n itemsTree() {\n if (arguments.length === 0) {\n this.build()\n const valuesTree = this.itemsTree(this._root)\n if (valuesTree === null) return new ArrayList()\n return valuesTree\n } else if (arguments.length === 1) {\n const node = arguments[0]\n const valuesTreeForNode = new ArrayList()\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof AbstractNode) {\n const valuesTreeForChild = this.itemsTree(childBoundable)\n if (valuesTreeForChild !== null) valuesTreeForNode.add(valuesTreeForChild)\n } else if (childBoundable instanceof ItemBoundable) {\n valuesTreeForNode.add(childBoundable.getItem())\n } else {\n Assert.shouldNeverReachHere()\n }\n }\n if (valuesTreeForNode.size() <= 0) return null\n return valuesTreeForNode\n }\n }\n insert(bounds, item) {\n Assert.isTrue(!this._built, 'Cannot insert items into an STR packed R-tree after it has been built.')\n this._itemBoundables.add(new ItemBoundable(bounds, item))\n }\n boundablesAtLevel() {\n if (arguments.length === 1) {\n const level = arguments[0]\n const boundables = new ArrayList()\n this.boundablesAtLevel(level, this._root, boundables)\n return boundables\n } else if (arguments.length === 3) {\n const level = arguments[0], top = arguments[1], boundables = arguments[2]\n Assert.isTrue(level > -2)\n if (top.getLevel() === level) {\n boundables.add(top)\n return null\n }\n for (let i = top.getChildBoundables().iterator(); i.hasNext(); ) {\n const boundable = i.next()\n if (boundable instanceof AbstractNode) {\n this.boundablesAtLevel(level, boundable, boundables)\n } else {\n Assert.isTrue(boundable instanceof ItemBoundable)\n if (level === -1) \n boundables.add(boundable)\n \n }\n }\n return null\n }\n }\n query() {\n if (arguments.length === 1) {\n const searchBounds = arguments[0]\n this.build()\n const matches = new ArrayList()\n if (this.isEmpty()) \n return matches\n \n if (this.getIntersectsOp().intersects(this._root.getBounds(), searchBounds)) \n this.queryInternal(searchBounds, this._root, matches)\n \n return matches\n } else if (arguments.length === 2) {\n const searchBounds = arguments[0], visitor = arguments[1]\n this.build()\n if (this.isEmpty()) \n return null\n \n if (this.getIntersectsOp().intersects(this._root.getBounds(), searchBounds)) \n this.queryInternal(searchBounds, this._root, visitor)\n \n }\n }\n build() {\n if (this._built) return null\n this._root = this._itemBoundables.isEmpty() ? this.createNode(0) : this.createHigherLevels(this._itemBoundables, -1)\n this._itemBoundables = null\n this._built = true\n }\n getRoot() {\n this.build()\n return this._root\n }\n remove() {\n if (arguments.length === 2) {\n const searchBounds = arguments[0], item = arguments[1]\n this.build()\n if (this.getIntersectsOp().intersects(this._root.getBounds(), searchBounds)) \n return this.remove(searchBounds, this._root, item)\n \n return false\n } else if (arguments.length === 3) {\n const searchBounds = arguments[0], node = arguments[1], item = arguments[2]\n let found = this.removeItem(node, item)\n if (found) return true\n let childToPrune = null\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) \n continue\n \n if (childBoundable instanceof AbstractNode) {\n found = this.remove(searchBounds, childBoundable, item)\n if (found) {\n childToPrune = childBoundable\n break\n }\n }\n }\n if (childToPrune !== null) \n if (childToPrune.getChildBoundables().isEmpty()) \n node.getChildBoundables().remove(childToPrune)\n \n \n return found\n }\n }\n createHigherLevels(boundablesOfALevel, level) {\n Assert.isTrue(!boundablesOfALevel.isEmpty())\n const parentBoundables = this.createParentBoundables(boundablesOfALevel, level + 1)\n if (parentBoundables.size() === 1) \n return parentBoundables.get(0)\n \n return this.createHigherLevels(parentBoundables, level + 1)\n }\n depth() {\n if (arguments.length === 0) {\n if (this.isEmpty()) \n return 0\n \n this.build()\n return this.depth(this._root)\n } else if (arguments.length === 1) {\n const node = arguments[0]\n let maxChildDepth = 0\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof AbstractNode) {\n const childDepth = this.depth(childBoundable)\n if (childDepth > maxChildDepth) maxChildDepth = childDepth\n }\n }\n return maxChildDepth + 1\n }\n }\n createParentBoundables(childBoundables, newLevel) {\n Assert.isTrue(!childBoundables.isEmpty())\n const parentBoundables = new ArrayList()\n parentBoundables.add(this.createNode(newLevel))\n const sortedChildBoundables = new ArrayList(childBoundables)\n Collections.sort(sortedChildBoundables, this.getComparator())\n for (let i = sortedChildBoundables.iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (this.lastNode(parentBoundables).getChildBoundables().size() === this.getNodeCapacity()) \n parentBoundables.add(this.createNode(newLevel))\n \n this.lastNode(parentBoundables).addChildBoundable(childBoundable)\n }\n return parentBoundables\n }\n isEmpty() {\n if (!this._built) return this._itemBoundables.isEmpty()\n return this._root.isEmpty()\n }\n get interfaces_() {\n return [Serializable]\n }\n}\nfunction IntersectsOp() {}\nAbstractSTRtree.IntersectsOp = IntersectsOp\nAbstractSTRtree.DEFAULT_NODE_CAPACITY = 10\n","export default class ItemDistance {\n distance(item1, item2) {}\n}\n","import ItemBoundable from './ItemBoundable.js'\nimport PriorityQueue from '../../util/PriorityQueue.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport SpatialIndex from '../SpatialIndex.js'\nimport AbstractNode from './AbstractNode.js'\nimport Double from '../../../../../java/lang/Double.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport BoundablePair from './BoundablePair.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Comparator from '../../../../../java/util/Comparator.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport Envelope from '../../geom/Envelope.js'\nimport Assert from '../../util/Assert.js'\nimport AbstractSTRtree from './AbstractSTRtree.js'\nimport ItemDistance from './ItemDistance.js'\nexport default class STRtree extends AbstractSTRtree {\n constructor() {\n super()\n STRtree.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {\n STRtree.constructor_.call(this, STRtree.DEFAULT_NODE_CAPACITY)\n } else if (arguments.length === 1) {\n const nodeCapacity = arguments[0]\n AbstractSTRtree.constructor_.call(this, nodeCapacity)\n }\n }\n static centreX(e) {\n return STRtree.avg(e.getMinX(), e.getMaxX())\n }\n static avg(a, b) {\n return (a + b) / 2\n }\n static getItems(kNearestNeighbors) {\n const items = new Array(kNearestNeighbors.size()).fill(null)\n let count = 0\n while (!kNearestNeighbors.isEmpty()) {\n const bp = kNearestNeighbors.poll()\n items[count] = bp.getBoundable(0).getItem()\n count++\n }\n return items\n }\n static centreY(e) {\n return STRtree.avg(e.getMinY(), e.getMaxY())\n }\n createParentBoundablesFromVerticalSlices(verticalSlices, newLevel) {\n Assert.isTrue(verticalSlices.length > 0)\n const parentBoundables = new ArrayList()\n for (let i = 0; i < verticalSlices.length; i++) \n parentBoundables.addAll(this.createParentBoundablesFromVerticalSlice(verticalSlices[i], newLevel))\n \n return parentBoundables\n }\n nearestNeighbourK() {\n if (arguments.length === 2) {\n const initBndPair = arguments[0], k = arguments[1]\n return this.nearestNeighbourK(initBndPair, Double.POSITIVE_INFINITY, k)\n } else if (arguments.length === 3) {\n const initBndPair = arguments[0], maxDistance = arguments[1], k = arguments[2]\n let distanceLowerBound = maxDistance\n const priQ = new PriorityQueue()\n priQ.add(initBndPair)\n const kNearestNeighbors = new PriorityQueue()\n while (!priQ.isEmpty() && distanceLowerBound >= 0.0) {\n const bndPair = priQ.poll()\n const pairDistance = bndPair.getDistance()\n if (pairDistance >= distanceLowerBound) \n break\n \n if (bndPair.isLeaves()) \n if (kNearestNeighbors.size() < k) {\n kNearestNeighbors.add(bndPair)\n } else {\n const bp1 = kNearestNeighbors.peek()\n if (bp1.getDistance() > pairDistance) {\n kNearestNeighbors.poll()\n kNearestNeighbors.add(bndPair)\n }\n const bp2 = kNearestNeighbors.peek()\n distanceLowerBound = bp2.getDistance()\n }\n else \n bndPair.expandToQueue(priQ, distanceLowerBound)\n \n }\n return STRtree.getItems(kNearestNeighbors)\n }\n }\n createNode(level) {\n return new STRtreeNode(level)\n }\n size() {\n if (arguments.length === 0) \n return super.size.call(this)\n else return super.size.apply(this, arguments)\n }\n insert() {\n if (arguments.length === 2 && (arguments[1] instanceof Object && arguments[0] instanceof Envelope)) {\n const itemEnv = arguments[0], item = arguments[1]\n if (itemEnv.isNull()) \n return null\n \n super.insert.call(this, itemEnv, item)\n } else {\n return super.insert.apply(this, arguments)\n }\n }\n getIntersectsOp() {\n return STRtree.intersectsOp\n }\n verticalSlices(childBoundables, sliceCount) {\n const sliceCapacity = Math.trunc(Math.ceil(childBoundables.size() / sliceCount))\n const slices = new Array(sliceCount).fill(null)\n const i = childBoundables.iterator()\n for (let j = 0; j < sliceCount; j++) {\n slices[j] = new ArrayList()\n let boundablesAddedToSlice = 0\n while (i.hasNext() && boundablesAddedToSlice < sliceCapacity) {\n const childBoundable = i.next()\n slices[j].add(childBoundable)\n boundablesAddedToSlice++\n }\n }\n return slices\n }\n query() {\n if (arguments.length === 1) {\n const searchEnv = arguments[0]\n return super.query.call(this, searchEnv)\n } else if (arguments.length === 2) {\n const searchEnv = arguments[0], visitor = arguments[1]\n super.query.call(this, searchEnv, visitor)\n }\n }\n getComparator() {\n return STRtree.yComparator\n }\n createParentBoundablesFromVerticalSlice(childBoundables, newLevel) {\n return super.createParentBoundables.call(this, childBoundables, newLevel)\n }\n remove() {\n if (arguments.length === 2 && (arguments[1] instanceof Object && arguments[0] instanceof Envelope)) {\n const itemEnv = arguments[0], item = arguments[1]\n return super.remove.call(this, itemEnv, item)\n } else {\n return super.remove.apply(this, arguments)\n }\n }\n depth() {\n if (arguments.length === 0) \n return super.depth.call(this)\n else return super.depth.apply(this, arguments)\n }\n createParentBoundables(childBoundables, newLevel) {\n Assert.isTrue(!childBoundables.isEmpty())\n const minLeafCount = Math.trunc(Math.ceil(childBoundables.size() / this.getNodeCapacity()))\n const sortedChildBoundables = new ArrayList(childBoundables)\n Collections.sort(sortedChildBoundables, STRtree.xComparator)\n const verticalSlices = this.verticalSlices(sortedChildBoundables, Math.trunc(Math.ceil(Math.sqrt(minLeafCount))))\n return this.createParentBoundablesFromVerticalSlices(verticalSlices, newLevel)\n }\n nearestNeighbour() {\n if (arguments.length === 1) {\n if (hasInterface(arguments[0], ItemDistance)) {\n const itemDist = arguments[0]\n if (this.isEmpty()) return null\n const bp = new BoundablePair(this.getRoot(), this.getRoot(), itemDist)\n return this.nearestNeighbour(bp)\n } else if (arguments[0] instanceof BoundablePair) {\n const initBndPair = arguments[0]\n let distanceLowerBound = Double.POSITIVE_INFINITY\n let minPair = null\n const priQ = new PriorityQueue()\n priQ.add(initBndPair)\n while (!priQ.isEmpty() && distanceLowerBound > 0.0) {\n const bndPair = priQ.poll()\n const pairDistance = bndPair.getDistance()\n if (pairDistance >= distanceLowerBound) break\n if (bndPair.isLeaves()) {\n distanceLowerBound = pairDistance\n minPair = bndPair\n } else {\n bndPair.expandToQueue(priQ, distanceLowerBound)\n }\n }\n if (minPair === null) return null\n return [minPair.getBoundable(0).getItem(), minPair.getBoundable(1).getItem()]\n }\n } else if (arguments.length === 2) {\n const tree = arguments[0], itemDist = arguments[1]\n if (this.isEmpty() || tree.isEmpty()) return null\n const bp = new BoundablePair(this.getRoot(), tree.getRoot(), itemDist)\n return this.nearestNeighbour(bp)\n } else if (arguments.length === 3) {\n const env = arguments[0], item = arguments[1], itemDist = arguments[2]\n const bnd = new ItemBoundable(env, item)\n const bp = new BoundablePair(this.getRoot(), bnd, itemDist)\n return this.nearestNeighbour(bp)[0]\n } else if (arguments.length === 4) {\n const env = arguments[0], item = arguments[1], itemDist = arguments[2], k = arguments[3]\n const bnd = new ItemBoundable(env, item)\n const bp = new BoundablePair(this.getRoot(), bnd, itemDist)\n return this.nearestNeighbourK(bp, k)\n }\n }\n isWithinDistance() {\n if (arguments.length === 2) {\n const initBndPair = arguments[0], maxDistance = arguments[1]\n let distanceUpperBound = Double.POSITIVE_INFINITY\n const priQ = new PriorityQueue()\n priQ.add(initBndPair)\n while (!priQ.isEmpty()) {\n const bndPair = priQ.poll()\n const pairDistance = bndPair.getDistance()\n if (pairDistance > maxDistance) return false\n if (bndPair.maximumDistance() <= maxDistance) return true\n if (bndPair.isLeaves()) {\n distanceUpperBound = pairDistance\n if (distanceUpperBound <= maxDistance) return true\n } else {\n bndPair.expandToQueue(priQ, distanceUpperBound)\n }\n }\n return false\n } else if (arguments.length === 3) {\n const tree = arguments[0], itemDist = arguments[1], maxDistance = arguments[2]\n const bp = new BoundablePair(this.getRoot(), tree.getRoot(), itemDist)\n return this.isWithinDistance(bp, maxDistance)\n }\n }\n get interfaces_() {\n return [SpatialIndex, Serializable]\n }\n}\nclass STRtreeNode extends AbstractNode {\n constructor() {\n super()\n STRtreeNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const level = arguments[0]\n AbstractNode.constructor_.call(this, level)\n }\n computeBounds() {\n let bounds = null\n for (let i = this.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (bounds === null) \n bounds = new Envelope(childBoundable.getBounds())\n else \n bounds.expandToInclude(childBoundable.getBounds())\n \n }\n return bounds\n }\n}\nSTRtree.STRtreeNode = STRtreeNode\nSTRtree.xComparator = new (class {\n get interfaces_() {\n return [Comparator]\n }\n compare(o1, o2) {\n return AbstractSTRtree.compareDoubles(STRtree.centreX(o1.getBounds()), STRtree.centreX(o2.getBounds()))\n }\n})()\nSTRtree.yComparator = new (class {\n get interfaces_() {\n return [Comparator]\n }\n compare(o1, o2) {\n return AbstractSTRtree.compareDoubles(STRtree.centreY(o1.getBounds()), STRtree.centreY(o2.getBounds()))\n }\n})()\nSTRtree.intersectsOp = new (class {\n get interfaces_() {\n return [IntersectsOp]\n }\n intersects(aBounds, bBounds) {\n return aBounds.intersects(bBounds)\n }\n})()\nSTRtree.DEFAULT_NODE_CAPACITY = 10\n","import Assert from '../util/Assert.js'\nexport default class SegmentPointComparator {\n static relativeSign(x0, x1) {\n if (x0 < x1) return -1\n if (x0 > x1) return 1\n return 0\n }\n static compare(octant, p0, p1) {\n if (p0.equals2D(p1)) return 0\n const xSign = SegmentPointComparator.relativeSign(p0.x, p1.x)\n const ySign = SegmentPointComparator.relativeSign(p0.y, p1.y)\n switch (octant) {\n case 0:\n return SegmentPointComparator.compareValue(xSign, ySign)\n case 1:\n return SegmentPointComparator.compareValue(ySign, xSign)\n case 2:\n return SegmentPointComparator.compareValue(ySign, -xSign)\n case 3:\n return SegmentPointComparator.compareValue(-xSign, ySign)\n case 4:\n return SegmentPointComparator.compareValue(-xSign, -ySign)\n case 5:\n return SegmentPointComparator.compareValue(-ySign, -xSign)\n case 6:\n return SegmentPointComparator.compareValue(-ySign, xSign)\n case 7:\n return SegmentPointComparator.compareValue(xSign, -ySign)\n }\n Assert.shouldNeverReachHere('invalid octant value')\n return 0\n }\n static compareValue(compareSign0, compareSign1) {\n if (compareSign0 < 0) return -1\n if (compareSign0 > 0) return 1\n if (compareSign1 < 0) return -1\n if (compareSign1 > 0) return 1\n return 0\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport SegmentPointComparator from './SegmentPointComparator.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nexport default class SegmentNode {\n constructor() {\n SegmentNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._segString = null\n this.coord = null\n this.segmentIndex = null\n this._segmentOctant = null\n this._isInterior = null\n const segString = arguments[0], coord = arguments[1], segmentIndex = arguments[2], segmentOctant = arguments[3]\n this._segString = segString\n this.coord = new Coordinate(coord)\n this.segmentIndex = segmentIndex\n this._segmentOctant = segmentOctant\n this._isInterior = !coord.equals2D(segString.getCoordinate(segmentIndex))\n }\n getCoordinate() {\n return this.coord\n }\n print(out) {\n out.print(this.coord)\n out.print(' seg # = ' + this.segmentIndex)\n }\n compareTo(obj) {\n const other = obj\n if (this.segmentIndex < other.segmentIndex) return -1\n if (this.segmentIndex > other.segmentIndex) return 1\n if (this.coord.equals2D(other.coord)) return 0\n if (!this._isInterior) return -1\n if (!other._isInterior) return 1\n return SegmentPointComparator.compare(this._segmentOctant, this.coord, other.coord)\n }\n isEndPoint(maxSegmentIndex) {\n if (this.segmentIndex === 0 && !this._isInterior) return true\n if (this.segmentIndex === maxSegmentIndex) return true\n return false\n }\n toString() {\n return this.segmentIndex + ':' + this.coord.toString()\n }\n isInterior() {\n return this._isInterior\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html\n * @constructor\n * @private\n */\nexport default class Iterator {\n /**\n * Returns true if the iteration has more elements.\n * @return {boolean}\n */\n hasNext() {}\n\n /**\n * Returns the next element in the iteration.\n * @return {Object}\n */\n next() {}\n\n /**\n * Removes from the underlying collection the last element returned by the\n * iterator (optional operation).\n */\n remove() {}\n}\n","import CoordinateList from '../geom/CoordinateList.js'\nimport SegmentNode from './SegmentNode.js'\nimport Iterator from '../../../../java/util/Iterator.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport NodedSegmentString from './NodedSegmentString.js'\nimport Integer from '../../../../java/lang/Integer.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport RuntimeException from '../../../../java/lang/RuntimeException.js'\nimport Assert from '../util/Assert.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class SegmentNodeList {\n constructor() {\n SegmentNodeList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeMap = new TreeMap()\n this._edge = null\n const edge = arguments[0]\n this._edge = edge\n }\n getSplitCoordinates() {\n const coordList = new CoordinateList()\n this.addEndpoints()\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n this.addEdgeCoordinates(eiPrev, ei, coordList)\n eiPrev = ei\n }\n return coordList.toCoordinateArray()\n }\n addCollapsedNodes() {\n const collapsedVertexIndexes = new ArrayList()\n this.findCollapsesFromInsertedNodes(collapsedVertexIndexes)\n this.findCollapsesFromExistingVertices(collapsedVertexIndexes)\n for (let it = collapsedVertexIndexes.iterator(); it.hasNext(); ) {\n const vertexIndex = it.next().intValue()\n this.add(this._edge.getCoordinate(vertexIndex), vertexIndex)\n }\n }\n createSplitEdgePts(ei0, ei1) {\n let npts = ei1.segmentIndex - ei0.segmentIndex + 2\n if (npts === 2) return [new Coordinate(ei0.coord), new Coordinate(ei1.coord)]\n const lastSegStartPt = this._edge.getCoordinate(ei1.segmentIndex)\n const useIntPt1 = ei1.isInterior() || !ei1.coord.equals2D(lastSegStartPt)\n if (!useIntPt1) \n npts--\n \n const pts = new Array(npts).fill(null)\n let ipt = 0\n pts[ipt++] = new Coordinate(ei0.coord)\n for (let i = ei0.segmentIndex + 1; i <= ei1.segmentIndex; i++) \n pts[ipt++] = this._edge.getCoordinate(i)\n \n if (useIntPt1) pts[ipt] = new Coordinate(ei1.coord)\n return pts\n }\n print(out) {\n out.println('Intersections:')\n for (let it = this.iterator(); it.hasNext(); ) {\n const ei = it.next()\n ei.print(out)\n }\n }\n findCollapsesFromExistingVertices(collapsedVertexIndexes) {\n for (let i = 0; i < this._edge.size() - 2; i++) {\n const p0 = this._edge.getCoordinate(i)\n const p1 = this._edge.getCoordinate(i + 1)\n const p2 = this._edge.getCoordinate(i + 2)\n if (p0.equals2D(p2)) \n collapsedVertexIndexes.add(Integer.valueOf(i + 1))\n \n }\n }\n addEdgeCoordinates(ei0, ei1, coordList) {\n const pts = this.createSplitEdgePts(ei0, ei1)\n coordList.add(pts, false)\n }\n iterator() {\n return this._nodeMap.values().iterator()\n }\n addSplitEdges(edgeList) {\n this.addEndpoints()\n this.addCollapsedNodes()\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n const newEdge = this.createSplitEdge(eiPrev, ei)\n edgeList.add(newEdge)\n eiPrev = ei\n }\n }\n findCollapseIndex(ei0, ei1, collapsedVertexIndex) {\n if (!ei0.coord.equals2D(ei1.coord)) return false\n let numVerticesBetween = ei1.segmentIndex - ei0.segmentIndex\n if (!ei1.isInterior()) \n numVerticesBetween--\n \n if (numVerticesBetween === 1) {\n collapsedVertexIndex[0] = ei0.segmentIndex + 1\n return true\n }\n return false\n }\n findCollapsesFromInsertedNodes(collapsedVertexIndexes) {\n const collapsedVertexIndex = new Array(1).fill(null)\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n const isCollapsed = this.findCollapseIndex(eiPrev, ei, collapsedVertexIndex)\n if (isCollapsed) collapsedVertexIndexes.add(Integer.valueOf(collapsedVertexIndex[0]))\n eiPrev = ei\n }\n }\n getEdge() {\n return this._edge\n }\n addEndpoints() {\n const maxSegIndex = this._edge.size() - 1\n this.add(this._edge.getCoordinate(0), 0)\n this.add(this._edge.getCoordinate(maxSegIndex), maxSegIndex)\n }\n createSplitEdge(ei0, ei1) {\n const pts = this.createSplitEdgePts(ei0, ei1)\n return new NodedSegmentString(pts, this._edge.getData())\n }\n add(intPt, segmentIndex) {\n const eiNew = new SegmentNode(this._edge, intPt, segmentIndex, this._edge.getSegmentOctant(segmentIndex))\n const ei = this._nodeMap.get(eiNew)\n if (ei !== null) {\n Assert.isTrue(ei.coord.equals2D(intPt), 'Found equal nodes with different coordinates')\n return ei\n }\n this._nodeMap.put(eiNew, eiNew)\n return eiNew\n }\n checkSplitEdgesCorrectness(splitEdges) {\n const edgePts = this._edge.getCoordinates()\n const split0 = splitEdges.get(0)\n const pt0 = split0.getCoordinate(0)\n if (!pt0.equals2D(edgePts[0])) throw new RuntimeException('bad split edge start point at ' + pt0)\n const splitn = splitEdges.get(splitEdges.size() - 1)\n const splitnPts = splitn.getCoordinates()\n const ptn = splitnPts[splitnPts.length - 1]\n if (!ptn.equals2D(edgePts[edgePts.length - 1])) throw new RuntimeException('bad split edge end point at ' + ptn)\n }\n}\nclass NodeVertexIterator {\n constructor() {\n NodeVertexIterator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeList = null\n this._edge = null\n this._nodeIt = null\n this._currNode = null\n this._nextNode = null\n this._currSegIndex = 0\n const nodeList = arguments[0]\n this._nodeList = nodeList\n this._edge = nodeList.getEdge()\n this._nodeIt = nodeList.iterator()\n this.readNextNode()\n }\n next() {\n if (this._currNode === null) {\n this._currNode = this._nextNode\n this._currSegIndex = this._currNode.segmentIndex\n this.readNextNode()\n return this._currNode\n }\n if (this._nextNode === null) return null\n if (this._nextNode.segmentIndex === this._currNode.segmentIndex) {\n this._currNode = this._nextNode\n this._currSegIndex = this._currNode.segmentIndex\n this.readNextNode()\n return this._currNode\n }\n if (this._nextNode.segmentIndex > this._currNode.segmentIndex) {}\n return null\n }\n remove() {\n throw new UnsupportedOperationException(this.getClass().getName())\n }\n hasNext() {\n if (this._nextNode === null) return false\n return true\n }\n readNextNode() {\n if (this._nodeIt.hasNext()) this._nextNode = this._nodeIt.next(); else this._nextNode = null\n }\n get interfaces_() {\n return [Iterator]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class Octant {\n static octant() {\n if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const dx = arguments[0], dy = arguments[1]\n if (dx === 0.0 && dy === 0.0) throw new IllegalArgumentException('Cannot compute the octant for point ( ' + dx + ', ' + dy + ' )')\n const adx = Math.abs(dx)\n const ady = Math.abs(dy)\n if (dx >= 0) \n if (dy >= 0) \n if (adx >= ady) return 0; else return 1\n else \n if (adx >= ady) return 7; else return 6\n \n else \n if (dy >= 0) \n if (adx >= ady) return 3; else return 2\n else \n if (adx >= ady) return 4; else return 5\n \n \n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const p0 = arguments[0], p1 = arguments[1]\n const dx = p1.x - p0.x\n const dy = p1.y - p0.y\n if (dx === 0.0 && dy === 0.0) throw new IllegalArgumentException('Cannot compute the octant for two identical points ' + p0)\n return Octant.octant(dx, dy)\n }\n }\n}\n","export default class SegmentString {\n getCoordinates() {}\n size() {}\n getCoordinate(i) {}\n isClosed() {}\n setData(data) {}\n getData() {}\n}\n","import SegmentString from './SegmentString.js'\nexport default class NodableSegmentString {\n addIntersection(intPt, segmentIndex) {}\n get interfaces_() {\n return [SegmentString]\n }\n}\n","import SegmentNodeList from './SegmentNodeList.js'\nimport WKTWriter from '../io/WKTWriter.js'\nimport CoordinateArraySequence from '../geom/impl/CoordinateArraySequence.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Octant from './Octant.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport NodableSegmentString from './NodableSegmentString.js'\nexport default class NodedSegmentString {\n constructor() {\n NodedSegmentString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeList = new SegmentNodeList(this)\n this._pts = null\n this._data = null\n const pts = arguments[0], data = arguments[1]\n this._pts = pts\n this._data = data\n }\n static getNodedSubstrings() {\n if (arguments.length === 1) {\n const segStrings = arguments[0]\n const resultEdgelist = new ArrayList()\n NodedSegmentString.getNodedSubstrings(segStrings, resultEdgelist)\n return resultEdgelist\n } else if (arguments.length === 2) {\n const segStrings = arguments[0], resultEdgelist = arguments[1]\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n ss.getNodeList().addSplitEdges(resultEdgelist)\n }\n }\n }\n getCoordinates() {\n return this._pts\n }\n size() {\n return this._pts.length\n }\n getCoordinate(i) {\n return this._pts[i]\n }\n isClosed() {\n return this._pts[0].equals(this._pts[this._pts.length - 1])\n }\n getSegmentOctant(index) {\n if (index === this._pts.length - 1) return -1\n return this.safeOctant(this.getCoordinate(index), this.getCoordinate(index + 1))\n }\n setData(data) {\n this._data = data\n }\n safeOctant(p0, p1) {\n if (p0.equals2D(p1)) return 0\n return Octant.octant(p0, p1)\n }\n getData() {\n return this._data\n }\n addIntersection() {\n if (arguments.length === 2) {\n const intPt = arguments[0], segmentIndex = arguments[1]\n this.addIntersectionNode(intPt, segmentIndex)\n } else if (arguments.length === 4) {\n const li = arguments[0], segmentIndex = arguments[1], geomIndex = arguments[2], intIndex = arguments[3]\n const intPt = new Coordinate(li.getIntersection(intIndex))\n this.addIntersection(intPt, segmentIndex)\n }\n }\n toString() {\n return WKTWriter.toLineString(new CoordinateArraySequence(this._pts))\n }\n getNodeList() {\n return this._nodeList\n }\n addIntersectionNode(intPt, segmentIndex) {\n let normalizedSegmentIndex = segmentIndex\n const nextSegIndex = normalizedSegmentIndex + 1\n if (nextSegIndex < this._pts.length) {\n const nextPt = this._pts[nextSegIndex]\n if (intPt.equals2D(nextPt)) \n normalizedSegmentIndex = nextSegIndex\n \n }\n const ei = this._nodeList.add(intPt, normalizedSegmentIndex)\n return ei\n }\n addIntersections(li, segmentIndex, geomIndex) {\n for (let i = 0; i < li.getIntersectionNum(); i++) \n this.addIntersection(li, segmentIndex, geomIndex, i)\n \n }\n get interfaces_() {\n return [NodableSegmentString]\n }\n}\n","import Coordinate from './Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport Intersection from '../algorithm/Intersection.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Distance from '../algorithm/Distance.js'\nexport default class LineSegment {\n constructor() {\n LineSegment.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.p0 = null\n this.p1 = null\n if (arguments.length === 0) {\n LineSegment.constructor_.call(this, new Coordinate(), new Coordinate())\n } else if (arguments.length === 1) {\n const ls = arguments[0]\n LineSegment.constructor_.call(this, ls.p0, ls.p1)\n } else if (arguments.length === 2) {\n const p0 = arguments[0], p1 = arguments[1]\n this.p0 = p0\n this.p1 = p1\n } else if (arguments.length === 4) {\n const x0 = arguments[0], y0 = arguments[1], x1 = arguments[2], y1 = arguments[3]\n LineSegment.constructor_.call(this, new Coordinate(x0, y0), new Coordinate(x1, y1))\n }\n }\n static midPoint(p0, p1) {\n return new Coordinate((p0.x + p1.x) / 2, (p0.y + p1.y) / 2)\n }\n minX() {\n return Math.min(this.p0.x, this.p1.x)\n }\n orientationIndex() {\n if (arguments[0] instanceof LineSegment) {\n const seg = arguments[0]\n const orient0 = Orientation.index(this.p0, this.p1, seg.p0)\n const orient1 = Orientation.index(this.p0, this.p1, seg.p1)\n if (orient0 >= 0 && orient1 >= 0) return Math.max(orient0, orient1)\n if (orient0 <= 0 && orient1 <= 0) return Math.max(orient0, orient1)\n return 0\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return Orientation.index(this.p0, this.p1, p)\n }\n }\n toGeometry(geomFactory) {\n return geomFactory.createLineString([this.p0, this.p1])\n }\n isVertical() {\n return this.p0.x === this.p1.x\n }\n equals(o) {\n if (!(o instanceof LineSegment)) \n return false\n \n const other = o\n return this.p0.equals(other.p0) && this.p1.equals(other.p1)\n }\n intersection(line) {\n const li = new RobustLineIntersector()\n li.computeIntersection(this.p0, this.p1, line.p0, line.p1)\n if (li.hasIntersection()) return li.getIntersection(0)\n return null\n }\n project() {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n if (p.equals(this.p0) || p.equals(this.p1)) return new Coordinate(p)\n const r = this.projectionFactor(p)\n const coord = new Coordinate()\n coord.x = this.p0.x + r * (this.p1.x - this.p0.x)\n coord.y = this.p0.y + r * (this.p1.y - this.p0.y)\n return coord\n } else if (arguments[0] instanceof LineSegment) {\n const seg = arguments[0]\n const pf0 = this.projectionFactor(seg.p0)\n const pf1 = this.projectionFactor(seg.p1)\n if (pf0 >= 1.0 && pf1 >= 1.0) return null\n if (pf0 <= 0.0 && pf1 <= 0.0) return null\n let newp0 = this.project(seg.p0)\n if (pf0 < 0.0) newp0 = this.p0\n if (pf0 > 1.0) newp0 = this.p1\n let newp1 = this.project(seg.p1)\n if (pf1 < 0.0) newp1 = this.p0\n if (pf1 > 1.0) newp1 = this.p1\n return new LineSegment(newp0, newp1)\n }\n }\n normalize() {\n if (this.p1.compareTo(this.p0) < 0) this.reverse()\n }\n angle() {\n return Math.atan2(this.p1.y - this.p0.y, this.p1.x - this.p0.x)\n }\n getCoordinate(i) {\n if (i === 0) return this.p0\n return this.p1\n }\n distancePerpendicular(p) {\n return Distance.pointToLinePerpendicular(p, this.p0, this.p1)\n }\n minY() {\n return Math.min(this.p0.y, this.p1.y)\n }\n midPoint() {\n return LineSegment.midPoint(this.p0, this.p1)\n }\n projectionFactor(p) {\n if (p.equals(this.p0)) return 0.0\n if (p.equals(this.p1)) return 1.0\n const dx = this.p1.x - this.p0.x\n const dy = this.p1.y - this.p0.y\n const len = dx * dx + dy * dy\n if (len <= 0.0) return Double.NaN\n const r = ((p.x - this.p0.x) * dx + (p.y - this.p0.y) * dy) / len\n return r\n }\n closestPoints(line) {\n const intPt = this.intersection(line)\n if (intPt !== null) \n return [intPt, intPt]\n \n const closestPt = new Array(2).fill(null)\n let minDistance = Double.MAX_VALUE\n let dist = null\n const close00 = this.closestPoint(line.p0)\n minDistance = close00.distance(line.p0)\n closestPt[0] = close00\n closestPt[1] = line.p0\n const close01 = this.closestPoint(line.p1)\n dist = close01.distance(line.p1)\n if (dist < minDistance) {\n minDistance = dist\n closestPt[0] = close01\n closestPt[1] = line.p1\n }\n const close10 = line.closestPoint(this.p0)\n dist = close10.distance(this.p0)\n if (dist < minDistance) {\n minDistance = dist\n closestPt[0] = this.p0\n closestPt[1] = close10\n }\n const close11 = line.closestPoint(this.p1)\n dist = close11.distance(this.p1)\n if (dist < minDistance) {\n minDistance = dist\n closestPt[0] = this.p1\n closestPt[1] = close11\n }\n return closestPt\n }\n closestPoint(p) {\n const factor = this.projectionFactor(p)\n if (factor > 0 && factor < 1) \n return this.project(p)\n \n const dist0 = this.p0.distance(p)\n const dist1 = this.p1.distance(p)\n if (dist0 < dist1) return this.p0\n return this.p1\n }\n maxX() {\n return Math.max(this.p0.x, this.p1.x)\n }\n getLength() {\n return this.p0.distance(this.p1)\n }\n compareTo(o) {\n const other = o\n const comp0 = this.p0.compareTo(other.p0)\n if (comp0 !== 0) return comp0\n return this.p1.compareTo(other.p1)\n }\n reverse() {\n const temp = this.p0\n this.p0 = this.p1\n this.p1 = temp\n }\n equalsTopo(other) {\n return this.p0.equals(other.p0) && this.p1.equals(other.p1) || this.p0.equals(other.p1) && this.p1.equals(other.p0)\n }\n lineIntersection(line) {\n const intPt = Intersection.intersection(this.p0, this.p1, line.p0, line.p1)\n return intPt\n }\n maxY() {\n return Math.max(this.p0.y, this.p1.y)\n }\n pointAlongOffset(segmentLengthFraction, offsetDistance) {\n const segx = this.p0.x + segmentLengthFraction * (this.p1.x - this.p0.x)\n const segy = this.p0.y + segmentLengthFraction * (this.p1.y - this.p0.y)\n const dx = this.p1.x - this.p0.x\n const dy = this.p1.y - this.p0.y\n const len = Math.sqrt(dx * dx + dy * dy)\n let ux = 0.0\n let uy = 0.0\n if (offsetDistance !== 0.0) {\n if (len <= 0.0) throw new IllegalStateException('Cannot compute offset from zero-length line segment')\n ux = offsetDistance * dx / len\n uy = offsetDistance * dy / len\n }\n const offsetx = segx - uy\n const offsety = segy + ux\n const coord = new Coordinate(offsetx, offsety)\n return coord\n }\n setCoordinates() {\n if (arguments.length === 1) {\n const ls = arguments[0]\n this.setCoordinates(ls.p0, ls.p1)\n } else if (arguments.length === 2) {\n const p0 = arguments[0], p1 = arguments[1]\n this.p0.x = p0.x\n this.p0.y = p0.y\n this.p1.x = p1.x\n this.p1.y = p1.y\n }\n }\n segmentFraction(inputPt) {\n let segFrac = this.projectionFactor(inputPt)\n if (segFrac < 0.0) segFrac = 0.0; else if (segFrac > 1.0 || Double.isNaN(segFrac)) segFrac = 1.0\n return segFrac\n }\n toString() {\n return 'LINESTRING( ' + this.p0.x + ' ' + this.p0.y + ', ' + this.p1.x + ' ' + this.p1.y + ')'\n }\n isHorizontal() {\n return this.p0.y === this.p1.y\n }\n reflect(p) {\n const A = this.p1.getY() - this.p0.getY()\n const B = this.p0.getX() - this.p1.getX()\n const C = this.p0.getY() * (this.p1.getX() - this.p0.getX()) - this.p0.getX() * (this.p1.getY() - this.p0.getY())\n const A2plusB2 = A * A + B * B\n const A2subB2 = A * A - B * B\n const x = p.getX()\n const y = p.getY()\n const rx = (-A2subB2 * x - 2 * A * B * y - 2 * A * C) / A2plusB2\n const ry = (A2subB2 * y - 2 * A * B * x - 2 * B * C) / A2plusB2\n return new Coordinate(rx, ry)\n }\n distance() {\n if (arguments[0] instanceof LineSegment) {\n const ls = arguments[0]\n return Distance.segmentToSegment(this.p0, this.p1, ls.p0, ls.p1)\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return Distance.pointToSegment(p, this.p0, this.p1)\n }\n }\n pointAlong(segmentLengthFraction) {\n const coord = new Coordinate()\n coord.x = this.p0.x + segmentLengthFraction * (this.p1.x - this.p0.x)\n coord.y = this.p0.y + segmentLengthFraction * (this.p1.y - this.p0.y)\n return coord\n }\n hashCode() {\n let bits0 = Double.doubleToLongBits(this.p0.x)\n bits0 ^= Double.doubleToLongBits(this.p0.y) * 31\n const hash0 = Math.trunc(bits0) ^ Math.trunc(bits0 >> 32)\n let bits1 = Double.doubleToLongBits(this.p1.x)\n bits1 ^= Double.doubleToLongBits(this.p1.y) * 31\n const hash1 = Math.trunc(bits1) ^ Math.trunc(bits1 >> 32)\n return hash0 ^ hash1\n }\n get interfaces_() {\n return [Comparable, Serializable]\n }\n}\n","import LineSegment from '../../geom/LineSegment.js'\nexport default class MonotoneChainOverlapAction {\n constructor() {\n MonotoneChainOverlapAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._overlapSeg1 = new LineSegment()\n this._overlapSeg2 = new LineSegment()\n }\n overlap() {\n if (arguments.length === 2) {\n const seg1 = arguments[0], seg2 = arguments[1]\n } else if (arguments.length === 4) {\n const mc1 = arguments[0], start1 = arguments[1], mc2 = arguments[2], start2 = arguments[3]\n mc1.getLineSegment(start1, this._overlapSeg1)\n mc2.getLineSegment(start2, this._overlapSeg2)\n this.overlap(this._overlapSeg1, this._overlapSeg2)\n }\n }\n}\n","import Envelope from '../../geom/Envelope.js'\nexport default class MonotoneChain {\n constructor() {\n MonotoneChain.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pts = null\n this._start = null\n this._end = null\n this._env = null\n this._context = null\n this._id = null\n const pts = arguments[0], start = arguments[1], end = arguments[2], context = arguments[3]\n this._pts = pts\n this._start = start\n this._end = end\n this._context = context\n }\n getLineSegment(index, ls) {\n ls.p0 = this._pts[index]\n ls.p1 = this._pts[index + 1]\n }\n computeSelect(searchEnv, start0, end0, mcs) {\n const p0 = this._pts[start0]\n const p1 = this._pts[end0]\n if (end0 - start0 === 1) {\n mcs.select(this, start0)\n return null\n }\n if (!searchEnv.intersects(p0, p1)) return null\n const mid = Math.trunc((start0 + end0) / 2)\n if (start0 < mid) \n this.computeSelect(searchEnv, start0, mid, mcs)\n \n if (mid < end0) \n this.computeSelect(searchEnv, mid, end0, mcs)\n \n }\n getCoordinates() {\n const coord = new Array(this._end - this._start + 1).fill(null)\n let index = 0\n for (let i = this._start; i <= this._end; i++) \n coord[index++] = this._pts[i]\n \n return coord\n }\n computeOverlaps() {\n if (arguments.length === 2) {\n const mc = arguments[0], mco = arguments[1]\n this.computeOverlaps(this._start, this._end, mc, mc._start, mc._end, mco)\n } else if (arguments.length === 6) {\n const start0 = arguments[0], end0 = arguments[1], mc = arguments[2], start1 = arguments[3], end1 = arguments[4], mco = arguments[5]\n if (end0 - start0 === 1 && end1 - start1 === 1) {\n mco.overlap(this, start0, mc, start1)\n return null\n }\n if (!this.overlaps(start0, end0, mc, start1, end1)) return null\n const mid0 = Math.trunc((start0 + end0) / 2)\n const mid1 = Math.trunc((start1 + end1) / 2)\n if (start0 < mid0) {\n if (start1 < mid1) this.computeOverlaps(start0, mid0, mc, start1, mid1, mco)\n if (mid1 < end1) this.computeOverlaps(start0, mid0, mc, mid1, end1, mco)\n }\n if (mid0 < end0) {\n if (start1 < mid1) this.computeOverlaps(mid0, end0, mc, start1, mid1, mco)\n if (mid1 < end1) this.computeOverlaps(mid0, end0, mc, mid1, end1, mco)\n }\n }\n }\n setId(id) {\n this._id = id\n }\n select(searchEnv, mcs) {\n this.computeSelect(searchEnv, this._start, this._end, mcs)\n }\n getEnvelope() {\n if (this._env === null) {\n const p0 = this._pts[this._start]\n const p1 = this._pts[this._end]\n this._env = new Envelope(p0, p1)\n }\n return this._env\n }\n overlaps(start0, end0, mc, start1, end1) {\n return Envelope.intersects(this._pts[start0], this._pts[end0], mc._pts[start1], mc._pts[end1])\n }\n getEndIndex() {\n return this._end\n }\n getStartIndex() {\n return this._start\n }\n getContext() {\n return this._context\n }\n getId() {\n return this._id\n }\n}\n","import MonotoneChain from './MonotoneChain.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Quadrant from '../../geomgraph/Quadrant.js'\nexport default class MonotoneChainBuilder {\n static findChainEnd(pts, start) {\n let safeStart = start\n while (safeStart < pts.length - 1 && pts[safeStart].equals2D(pts[safeStart + 1])) \n safeStart++\n \n if (safeStart >= pts.length - 1) \n return pts.length - 1\n \n const chainQuad = Quadrant.quadrant(pts[safeStart], pts[safeStart + 1])\n let last = start + 1\n while (last < pts.length) {\n if (!pts[last - 1].equals2D(pts[last])) {\n const quad = Quadrant.quadrant(pts[last - 1], pts[last])\n if (quad !== chainQuad) break\n }\n last++\n }\n return last - 1\n }\n static getChains() {\n if (arguments.length === 1) {\n const pts = arguments[0]\n return MonotoneChainBuilder.getChains(pts, null)\n } else if (arguments.length === 2) {\n const pts = arguments[0], context = arguments[1]\n const mcList = new ArrayList()\n let chainStart = 0\n do {\n const chainEnd = MonotoneChainBuilder.findChainEnd(pts, chainStart)\n const mc = new MonotoneChain(pts, chainStart, chainEnd, context)\n mcList.add(mc)\n chainStart = chainEnd\n } while (chainStart < pts.length - 1)\n return mcList\n }\n }\n}\n","export default class Noder {\n computeNodes(segStrings) {}\n getNodedSubstrings() {}\n}\n","import Noder from './Noder.js'\nexport default class SinglePassNoder {\n constructor() {\n SinglePassNoder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._segInt = null\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const segInt = arguments[0]\n this.setSegmentIntersector(segInt)\n }\n }\n setSegmentIntersector(segInt) {\n this._segInt = segInt\n }\n get interfaces_() {\n return [Noder]\n }\n}\n","import STRtree from '../index/strtree/STRtree.js'\nimport NodedSegmentString from './NodedSegmentString.js'\nimport MonotoneChainOverlapAction from '../index/chain/MonotoneChainOverlapAction.js'\nimport MonotoneChainBuilder from '../index/chain/MonotoneChainBuilder.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport SinglePassNoder from './SinglePassNoder.js'\nexport default class MCIndexNoder extends SinglePassNoder {\n constructor() {\n super()\n MCIndexNoder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._monoChains = new ArrayList()\n this._index = new STRtree()\n this._idCounter = 0\n this._nodedSegStrings = null\n this._nOverlaps = 0\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const si = arguments[0]\n SinglePassNoder.constructor_.call(this, si)\n }\n }\n getMonotoneChains() {\n return this._monoChains\n }\n getNodedSubstrings() {\n return NodedSegmentString.getNodedSubstrings(this._nodedSegStrings)\n }\n getIndex() {\n return this._index\n }\n add(segStr) {\n const segChains = MonotoneChainBuilder.getChains(segStr.getCoordinates(), segStr)\n for (let i = segChains.iterator(); i.hasNext(); ) {\n const mc = i.next()\n mc.setId(this._idCounter++)\n this._index.insert(mc.getEnvelope(), mc)\n this._monoChains.add(mc)\n }\n }\n computeNodes(inputSegStrings) {\n this._nodedSegStrings = inputSegStrings\n for (let i = inputSegStrings.iterator(); i.hasNext(); ) \n this.add(i.next())\n \n this.intersectChains()\n }\n intersectChains() {\n const overlapAction = new SegmentOverlapAction(this._segInt)\n for (let i = this._monoChains.iterator(); i.hasNext(); ) {\n const queryChain = i.next()\n const overlapChains = this._index.query(queryChain.getEnvelope())\n for (let j = overlapChains.iterator(); j.hasNext(); ) {\n const testChain = j.next()\n if (testChain.getId() > queryChain.getId()) {\n queryChain.computeOverlaps(testChain, overlapAction)\n this._nOverlaps++\n }\n if (this._segInt.isDone()) return null\n }\n }\n }\n}\nclass SegmentOverlapAction extends MonotoneChainOverlapAction {\n constructor() {\n super()\n SegmentOverlapAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._si = null\n const si = arguments[0]\n this._si = si\n }\n overlap() {\n if (arguments.length === 4) {\n const mc1 = arguments[0], start1 = arguments[1], mc2 = arguments[2], start2 = arguments[3]\n const ss1 = mc1.getContext()\n const ss2 = mc2.getContext()\n this._si.processIntersections(ss1, start1, ss2, start2)\n } else {\n return super.overlap.apply(this, arguments)\n }\n }\n}\nMCIndexNoder.SegmentOverlapAction = SegmentOverlapAction\n","import CoordinateList from '../../geom/CoordinateList.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Distance from '../../algorithm/Distance.js'\nexport default class BufferInputLineSimplifier {\n constructor() {\n BufferInputLineSimplifier.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._inputLine = null\n this._distanceTol = null\n this._isDeleted = null\n this._angleOrientation = Orientation.COUNTERCLOCKWISE\n const inputLine = arguments[0]\n this._inputLine = inputLine\n }\n static simplify(inputLine, distanceTol) {\n const simp = new BufferInputLineSimplifier(inputLine)\n return simp.simplify(distanceTol)\n }\n isDeletable(i0, i1, i2, distanceTol) {\n const p0 = this._inputLine[i0]\n const p1 = this._inputLine[i1]\n const p2 = this._inputLine[i2]\n if (!this.isConcave(p0, p1, p2)) return false\n if (!this.isShallow(p0, p1, p2, distanceTol)) return false\n return this.isShallowSampled(p0, p1, i0, i2, distanceTol)\n }\n deleteShallowConcavities() {\n let index = 1\n let midIndex = this.findNextNonDeletedIndex(index)\n let lastIndex = this.findNextNonDeletedIndex(midIndex)\n let isChanged = false\n while (lastIndex < this._inputLine.length) {\n let isMiddleVertexDeleted = false\n if (this.isDeletable(index, midIndex, lastIndex, this._distanceTol)) {\n this._isDeleted[midIndex] = BufferInputLineSimplifier.DELETE\n isMiddleVertexDeleted = true\n isChanged = true\n }\n if (isMiddleVertexDeleted) index = lastIndex; else index = midIndex\n midIndex = this.findNextNonDeletedIndex(index)\n lastIndex = this.findNextNonDeletedIndex(midIndex)\n }\n return isChanged\n }\n isShallowConcavity(p0, p1, p2, distanceTol) {\n const orientation = Orientation.index(p0, p1, p2)\n const isAngleToSimplify = orientation === this._angleOrientation\n if (!isAngleToSimplify) return false\n const dist = Distance.pointToSegment(p1, p0, p2)\n return dist < distanceTol\n }\n isShallowSampled(p0, p2, i0, i2, distanceTol) {\n let inc = Math.trunc((i2 - i0) / BufferInputLineSimplifier.NUM_PTS_TO_CHECK)\n if (inc <= 0) inc = 1\n for (let i = i0; i < i2; i += inc) \n if (!this.isShallow(p0, p2, this._inputLine[i], distanceTol)) return false\n \n return true\n }\n isConcave(p0, p1, p2) {\n const orientation = Orientation.index(p0, p1, p2)\n const isConcave = orientation === this._angleOrientation\n return isConcave\n }\n simplify(distanceTol) {\n this._distanceTol = Math.abs(distanceTol)\n if (distanceTol < 0) this._angleOrientation = Orientation.CLOCKWISE\n this._isDeleted = new Array(this._inputLine.length).fill(null)\n let isChanged = false\n do \n isChanged = this.deleteShallowConcavities()\n while (isChanged)\n return this.collapseLine()\n }\n findNextNonDeletedIndex(index) {\n let next = index + 1\n while (next < this._inputLine.length && this._isDeleted[next] === BufferInputLineSimplifier.DELETE) next++\n return next\n }\n isShallow(p0, p1, p2, distanceTol) {\n const dist = Distance.pointToSegment(p1, p0, p2)\n return dist < distanceTol\n }\n collapseLine() {\n const coordList = new CoordinateList()\n for (let i = 0; i < this._inputLine.length; i++) \n if (this._isDeleted[i] !== BufferInputLineSimplifier.DELETE) coordList.add(this._inputLine[i])\n \n return coordList.toCoordinateArray()\n }\n}\nBufferInputLineSimplifier.INIT = 0\nBufferInputLineSimplifier.DELETE = 1\nBufferInputLineSimplifier.KEEP = 1\nBufferInputLineSimplifier.NUM_PTS_TO_CHECK = 10\n","import GeometryFactory from '../../geom/GeometryFactory.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class OffsetSegmentString {\n constructor() {\n OffsetSegmentString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._ptList = null\n this._precisionModel = null\n this._minimimVertexDistance = 0.0\n this._ptList = new ArrayList()\n }\n getCoordinates() {\n const coord = this._ptList.toArray(OffsetSegmentString.COORDINATE_ARRAY_TYPE)\n return coord\n }\n setPrecisionModel(precisionModel) {\n this._precisionModel = precisionModel\n }\n addPt(pt) {\n const bufPt = new Coordinate(pt)\n this._precisionModel.makePrecise(bufPt)\n if (this.isRedundant(bufPt)) return null\n this._ptList.add(bufPt)\n }\n reverse() {}\n addPts(pt, isForward) {\n if (isForward) \n for (let i = 0; i < pt.length; i++) \n this.addPt(pt[i])\n \n else \n for (let i = pt.length - 1; i >= 0; i--) \n this.addPt(pt[i])\n \n \n }\n isRedundant(pt) {\n if (this._ptList.size() < 1) return false\n const lastPt = this._ptList.get(this._ptList.size() - 1)\n const ptDist = pt.distance(lastPt)\n if (ptDist < this._minimimVertexDistance) return true\n return false\n }\n toString() {\n const fact = new GeometryFactory()\n const line = fact.createLineString(this.getCoordinates())\n return line.toString()\n }\n closeRing() {\n if (this._ptList.size() < 1) return null\n const startPt = new Coordinate(this._ptList.get(0))\n const lastPt = this._ptList.get(this._ptList.size() - 1)\n if (startPt.equals(lastPt)) return null\n this._ptList.add(startPt)\n }\n setMinimumVertexDistance(minimimVertexDistance) {\n this._minimimVertexDistance = minimimVertexDistance\n }\n}\nOffsetSegmentString.COORDINATE_ARRAY_TYPE = new Array(0).fill(null)\n","import Orientation from './Orientation.js'\nexport default class Angle {\n static toDegrees(radians) {\n return radians * 180 / Math.PI\n }\n static normalize(angle) {\n while (angle > Math.PI) angle -= Angle.PI_TIMES_2\n while (angle <= -Math.PI) angle += Angle.PI_TIMES_2\n return angle\n }\n static angle() {\n if (arguments.length === 1) {\n const p = arguments[0]\n return Math.atan2(p.y, p.x)\n } else if (arguments.length === 2) {\n const p0 = arguments[0], p1 = arguments[1]\n const dx = p1.x - p0.x\n const dy = p1.y - p0.y\n return Math.atan2(dy, dx)\n }\n }\n static isAcute(p0, p1, p2) {\n const dx0 = p0.x - p1.x\n const dy0 = p0.y - p1.y\n const dx1 = p2.x - p1.x\n const dy1 = p2.y - p1.y\n const dotprod = dx0 * dx1 + dy0 * dy1\n return dotprod > 0\n }\n static isObtuse(p0, p1, p2) {\n const dx0 = p0.x - p1.x\n const dy0 = p0.y - p1.y\n const dx1 = p2.x - p1.x\n const dy1 = p2.y - p1.y\n const dotprod = dx0 * dx1 + dy0 * dy1\n return dotprod < 0\n }\n static interiorAngle(p0, p1, p2) {\n const anglePrev = Angle.angle(p1, p0)\n const angleNext = Angle.angle(p1, p2)\n return Math.abs(angleNext - anglePrev)\n }\n static normalizePositive(angle) {\n if (angle < 0.0) {\n while (angle < 0.0) angle += Angle.PI_TIMES_2\n if (angle >= Angle.PI_TIMES_2) angle = 0.0\n } else {\n while (angle >= Angle.PI_TIMES_2) angle -= Angle.PI_TIMES_2\n if (angle < 0.0) angle = 0.0\n }\n return angle\n }\n static angleBetween(tip1, tail, tip2) {\n const a1 = Angle.angle(tail, tip1)\n const a2 = Angle.angle(tail, tip2)\n return Angle.diff(a1, a2)\n }\n static diff(ang1, ang2) {\n let delAngle = null\n if (ang1 < ang2) \n delAngle = ang2 - ang1\n else \n delAngle = ang1 - ang2\n \n if (delAngle > Math.PI) \n delAngle = 2 * Math.PI - delAngle\n \n return delAngle\n }\n static toRadians(angleDegrees) {\n return angleDegrees * Math.PI / 180.0\n }\n static getTurn(ang1, ang2) {\n const crossproduct = Math.sin(ang2 - ang1)\n if (crossproduct > 0) \n return Angle.COUNTERCLOCKWISE\n \n if (crossproduct < 0) \n return Angle.CLOCKWISE\n \n return Angle.NONE\n }\n static angleBetweenOriented(tip1, tail, tip2) {\n const a1 = Angle.angle(tail, tip1)\n const a2 = Angle.angle(tail, tip2)\n const angDel = a2 - a1\n if (angDel <= -Math.PI) return angDel + Angle.PI_TIMES_2\n if (angDel > Math.PI) return angDel - Angle.PI_TIMES_2\n return angDel\n }\n}\nAngle.PI_TIMES_2 = 2.0 * Math.PI\nAngle.PI_OVER_2 = Math.PI / 2.0\nAngle.PI_OVER_4 = Math.PI / 4.0\nAngle.COUNTERCLOCKWISE = Orientation.COUNTERCLOCKWISE\nAngle.CLOCKWISE = Orientation.CLOCKWISE\nAngle.NONE = Orientation.COLLINEAR\n","import BufferParameters from './BufferParameters.js'\nimport Position from '../../geomgraph/Position.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Intersection from '../../algorithm/Intersection.js'\nimport OffsetSegmentString from './OffsetSegmentString.js'\nimport LineSegment from '../../geom/LineSegment.js'\nimport Angle from '../../algorithm/Angle.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nexport default class OffsetSegmentGenerator {\n constructor() {\n OffsetSegmentGenerator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._maxCurveSegmentError = 0.0\n this._filletAngleQuantum = null\n this._closingSegLengthFactor = 1\n this._segList = null\n this._distance = 0.0\n this._precisionModel = null\n this._bufParams = null\n this._li = null\n this._s0 = null\n this._s1 = null\n this._s2 = null\n this._seg0 = new LineSegment()\n this._seg1 = new LineSegment()\n this._offset0 = new LineSegment()\n this._offset1 = new LineSegment()\n this._side = 0\n this._hasNarrowConcaveAngle = false\n const precisionModel = arguments[0], bufParams = arguments[1], distance = arguments[2]\n this._precisionModel = precisionModel\n this._bufParams = bufParams\n this._li = new RobustLineIntersector()\n this._filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments()\n if (bufParams.getQuadrantSegments() >= 8 && bufParams.getJoinStyle() === BufferParameters.JOIN_ROUND) this._closingSegLengthFactor = OffsetSegmentGenerator.MAX_CLOSING_SEG_LEN_FACTOR\n this.init(distance)\n }\n addNextSegment(p, addStartPoint) {\n this._s0 = this._s1\n this._s1 = this._s2\n this._s2 = p\n this._seg0.setCoordinates(this._s0, this._s1)\n this.computeOffsetSegment(this._seg0, this._side, this._distance, this._offset0)\n this._seg1.setCoordinates(this._s1, this._s2)\n this.computeOffsetSegment(this._seg1, this._side, this._distance, this._offset1)\n if (this._s1.equals(this._s2)) return null\n const orientation = Orientation.index(this._s0, this._s1, this._s2)\n const outsideTurn = orientation === Orientation.CLOCKWISE && this._side === Position.LEFT || orientation === Orientation.COUNTERCLOCKWISE && this._side === Position.RIGHT\n if (orientation === 0) \n this.addCollinear(addStartPoint)\n else if (outsideTurn) \n this.addOutsideTurn(orientation, addStartPoint)\n else \n this.addInsideTurn(orientation, addStartPoint)\n \n }\n addLineEndCap(p0, p1) {\n const seg = new LineSegment(p0, p1)\n const offsetL = new LineSegment()\n this.computeOffsetSegment(seg, Position.LEFT, this._distance, offsetL)\n const offsetR = new LineSegment()\n this.computeOffsetSegment(seg, Position.RIGHT, this._distance, offsetR)\n const dx = p1.x - p0.x\n const dy = p1.y - p0.y\n const angle = Math.atan2(dy, dx)\n switch (this._bufParams.getEndCapStyle()) {\n case BufferParameters.CAP_ROUND:\n this._segList.addPt(offsetL.p1)\n this.addDirectedFillet(p1, angle + Math.PI / 2, angle - Math.PI / 2, Orientation.CLOCKWISE, this._distance)\n this._segList.addPt(offsetR.p1)\n break\n case BufferParameters.CAP_FLAT:\n this._segList.addPt(offsetL.p1)\n this._segList.addPt(offsetR.p1)\n break\n case BufferParameters.CAP_SQUARE:\n const squareCapSideOffset = new Coordinate()\n squareCapSideOffset.x = Math.abs(this._distance) * Math.cos(angle)\n squareCapSideOffset.y = Math.abs(this._distance) * Math.sin(angle)\n const squareCapLOffset = new Coordinate(offsetL.p1.x + squareCapSideOffset.x, offsetL.p1.y + squareCapSideOffset.y)\n const squareCapROffset = new Coordinate(offsetR.p1.x + squareCapSideOffset.x, offsetR.p1.y + squareCapSideOffset.y)\n this._segList.addPt(squareCapLOffset)\n this._segList.addPt(squareCapROffset)\n break\n }\n }\n getCoordinates() {\n const pts = this._segList.getCoordinates()\n return pts\n }\n addMitreJoin(p, offset0, offset1, distance) {\n const intPt = Intersection.intersection(offset0.p0, offset0.p1, offset1.p0, offset1.p1)\n if (intPt !== null) {\n const mitreRatio = distance <= 0.0 ? 1.0 : intPt.distance(p) / Math.abs(distance)\n if (mitreRatio <= this._bufParams.getMitreLimit()) {\n this._segList.addPt(intPt)\n return null\n }\n }\n this.addLimitedMitreJoin(offset0, offset1, distance, this._bufParams.getMitreLimit())\n }\n addOutsideTurn(orientation, addStartPoint) {\n if (this._offset0.p1.distance(this._offset1.p0) < this._distance * OffsetSegmentGenerator.OFFSET_SEGMENT_SEPARATION_FACTOR) {\n this._segList.addPt(this._offset0.p1)\n return null\n }\n if (this._bufParams.getJoinStyle() === BufferParameters.JOIN_MITRE) {\n this.addMitreJoin(this._s1, this._offset0, this._offset1, this._distance)\n } else if (this._bufParams.getJoinStyle() === BufferParameters.JOIN_BEVEL) {\n this.addBevelJoin(this._offset0, this._offset1)\n } else {\n if (addStartPoint) this._segList.addPt(this._offset0.p1)\n this.addCornerFillet(this._s1, this._offset0.p1, this._offset1.p0, orientation, this._distance)\n this._segList.addPt(this._offset1.p0)\n }\n }\n createSquare(p) {\n this._segList.addPt(new Coordinate(p.x + this._distance, p.y + this._distance))\n this._segList.addPt(new Coordinate(p.x + this._distance, p.y - this._distance))\n this._segList.addPt(new Coordinate(p.x - this._distance, p.y - this._distance))\n this._segList.addPt(new Coordinate(p.x - this._distance, p.y + this._distance))\n this._segList.closeRing()\n }\n addSegments(pt, isForward) {\n this._segList.addPts(pt, isForward)\n }\n addFirstSegment() {\n this._segList.addPt(this._offset1.p0)\n }\n addCornerFillet(p, p0, p1, direction, radius) {\n const dx0 = p0.x - p.x\n const dy0 = p0.y - p.y\n let startAngle = Math.atan2(dy0, dx0)\n const dx1 = p1.x - p.x\n const dy1 = p1.y - p.y\n const endAngle = Math.atan2(dy1, dx1)\n if (direction === Orientation.CLOCKWISE) {\n if (startAngle <= endAngle) startAngle += 2.0 * Math.PI\n } else {\n if (startAngle >= endAngle) startAngle -= 2.0 * Math.PI\n }\n this._segList.addPt(p0)\n this.addDirectedFillet(p, startAngle, endAngle, direction, radius)\n this._segList.addPt(p1)\n }\n addLastSegment() {\n this._segList.addPt(this._offset1.p1)\n }\n initSideSegments(s1, s2, side) {\n this._s1 = s1\n this._s2 = s2\n this._side = side\n this._seg1.setCoordinates(s1, s2)\n this.computeOffsetSegment(this._seg1, side, this._distance, this._offset1)\n }\n addLimitedMitreJoin(offset0, offset1, distance, mitreLimit) {\n const basePt = this._seg0.p1\n const ang0 = Angle.angle(basePt, this._seg0.p0)\n const angDiff = Angle.angleBetweenOriented(this._seg0.p0, basePt, this._seg1.p1)\n const angDiffHalf = angDiff / 2\n const midAng = Angle.normalize(ang0 + angDiffHalf)\n const mitreMidAng = Angle.normalize(midAng + Math.PI)\n const mitreDist = mitreLimit * distance\n const bevelDelta = mitreDist * Math.abs(Math.sin(angDiffHalf))\n const bevelHalfLen = distance - bevelDelta\n const bevelMidX = basePt.x + mitreDist * Math.cos(mitreMidAng)\n const bevelMidY = basePt.y + mitreDist * Math.sin(mitreMidAng)\n const bevelMidPt = new Coordinate(bevelMidX, bevelMidY)\n const mitreMidLine = new LineSegment(basePt, bevelMidPt)\n const bevelEndLeft = mitreMidLine.pointAlongOffset(1.0, bevelHalfLen)\n const bevelEndRight = mitreMidLine.pointAlongOffset(1.0, -bevelHalfLen)\n if (this._side === Position.LEFT) {\n this._segList.addPt(bevelEndLeft)\n this._segList.addPt(bevelEndRight)\n } else {\n this._segList.addPt(bevelEndRight)\n this._segList.addPt(bevelEndLeft)\n }\n }\n addDirectedFillet(p, startAngle, endAngle, direction, radius) {\n const directionFactor = direction === Orientation.CLOCKWISE ? -1 : 1\n const totalAngle = Math.abs(startAngle - endAngle)\n const nSegs = Math.trunc(totalAngle / this._filletAngleQuantum + 0.5)\n if (nSegs < 1) return null\n const angleInc = totalAngle / nSegs\n const pt = new Coordinate()\n for (let i = 0; i < nSegs; i++) {\n const angle = startAngle + directionFactor * i * angleInc\n pt.x = p.x + radius * Math.cos(angle)\n pt.y = p.y + radius * Math.sin(angle)\n this._segList.addPt(pt)\n }\n }\n computeOffsetSegment(seg, side, distance, offset) {\n const sideSign = side === Position.LEFT ? 1 : -1\n const dx = seg.p1.x - seg.p0.x\n const dy = seg.p1.y - seg.p0.y\n const len = Math.sqrt(dx * dx + dy * dy)\n const ux = sideSign * distance * dx / len\n const uy = sideSign * distance * dy / len\n offset.p0.x = seg.p0.x - uy\n offset.p0.y = seg.p0.y + ux\n offset.p1.x = seg.p1.x - uy\n offset.p1.y = seg.p1.y + ux\n }\n addInsideTurn(orientation, addStartPoint) {\n this._li.computeIntersection(this._offset0.p0, this._offset0.p1, this._offset1.p0, this._offset1.p1)\n if (this._li.hasIntersection()) {\n this._segList.addPt(this._li.getIntersection(0))\n } else {\n this._hasNarrowConcaveAngle = true\n if (this._offset0.p1.distance(this._offset1.p0) < this._distance * OffsetSegmentGenerator.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR) {\n this._segList.addPt(this._offset0.p1)\n } else {\n this._segList.addPt(this._offset0.p1)\n if (this._closingSegLengthFactor > 0) {\n const mid0 = new Coordinate((this._closingSegLengthFactor * this._offset0.p1.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset0.p1.y + this._s1.y) / (this._closingSegLengthFactor + 1))\n this._segList.addPt(mid0)\n const mid1 = new Coordinate((this._closingSegLengthFactor * this._offset1.p0.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset1.p0.y + this._s1.y) / (this._closingSegLengthFactor + 1))\n this._segList.addPt(mid1)\n } else {\n this._segList.addPt(this._s1)\n }\n this._segList.addPt(this._offset1.p0)\n }\n }\n }\n createCircle(p) {\n const pt = new Coordinate(p.x + this._distance, p.y)\n this._segList.addPt(pt)\n this.addDirectedFillet(p, 0.0, 2.0 * Math.PI, -1, this._distance)\n this._segList.closeRing()\n }\n addBevelJoin(offset0, offset1) {\n this._segList.addPt(offset0.p1)\n this._segList.addPt(offset1.p0)\n }\n init(distance) {\n this._distance = distance\n this._maxCurveSegmentError = distance * (1 - Math.cos(this._filletAngleQuantum / 2.0))\n this._segList = new OffsetSegmentString()\n this._segList.setPrecisionModel(this._precisionModel)\n this._segList.setMinimumVertexDistance(distance * OffsetSegmentGenerator.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)\n }\n addCollinear(addStartPoint) {\n this._li.computeIntersection(this._s0, this._s1, this._s1, this._s2)\n const numInt = this._li.getIntersectionNum()\n if (numInt >= 2) \n if (this._bufParams.getJoinStyle() === BufferParameters.JOIN_BEVEL || this._bufParams.getJoinStyle() === BufferParameters.JOIN_MITRE) {\n if (addStartPoint) this._segList.addPt(this._offset0.p1)\n this._segList.addPt(this._offset1.p0)\n } else {\n this.addCornerFillet(this._s1, this._offset0.p1, this._offset1.p0, Orientation.CLOCKWISE, this._distance)\n }\n \n }\n closeRing() {\n this._segList.closeRing()\n }\n hasNarrowConcaveAngle() {\n return this._hasNarrowConcaveAngle\n }\n}\nOffsetSegmentGenerator.OFFSET_SEGMENT_SEPARATION_FACTOR = 1.0E-3\nOffsetSegmentGenerator.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR = 1.0E-3\nOffsetSegmentGenerator.CURVE_VERTEX_SNAP_DISTANCE_FACTOR = 1.0E-6\nOffsetSegmentGenerator.MAX_CLOSING_SEG_LEN_FACTOR = 80\n","import BufferParameters from './BufferParameters.js'\nimport Position from '../../geomgraph/Position.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport BufferInputLineSimplifier from './BufferInputLineSimplifier.js'\nimport CoordinateArrays from '../../geom/CoordinateArrays.js'\nimport OffsetSegmentGenerator from './OffsetSegmentGenerator.js'\nexport default class OffsetCurveBuilder {\n constructor() {\n OffsetCurveBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._distance = 0.0\n this._precisionModel = null\n this._bufParams = null\n const precisionModel = arguments[0], bufParams = arguments[1]\n this._precisionModel = precisionModel\n this._bufParams = bufParams\n }\n static copyCoordinates(pts) {\n const copy = new Array(pts.length).fill(null)\n for (let i = 0; i < copy.length; i++) \n copy[i] = new Coordinate(pts[i])\n \n return copy\n }\n getOffsetCurve(inputPts, distance) {\n this._distance = distance\n if (distance === 0.0) return null\n const isRightSide = distance < 0.0\n const posDistance = Math.abs(distance)\n const segGen = this.getSegGen(posDistance)\n if (inputPts.length <= 1) \n this.computePointCurve(inputPts[0], segGen)\n else \n this.computeOffsetCurve(inputPts, isRightSide, segGen)\n \n const curvePts = segGen.getCoordinates()\n if (isRightSide) CoordinateArrays.reverse(curvePts)\n return curvePts\n }\n computeSingleSidedBufferCurve(inputPts, isRightSide, segGen) {\n const distTol = this.simplifyTolerance(this._distance)\n if (isRightSide) {\n segGen.addSegments(inputPts, true)\n const simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol)\n const n2 = simp2.length - 1\n segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = n2 - 2; i >= 0; i--) \n segGen.addNextSegment(simp2[i], true)\n \n } else {\n segGen.addSegments(inputPts, false)\n const simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n1 = simp1.length - 1\n segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = 2; i <= n1; i++) \n segGen.addNextSegment(simp1[i], true)\n \n }\n segGen.addLastSegment()\n segGen.closeRing()\n }\n computeRingBufferCurve(inputPts, side, segGen) {\n let distTol = this.simplifyTolerance(this._distance)\n if (side === Position.RIGHT) distTol = -distTol\n const simp = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n = simp.length - 1\n segGen.initSideSegments(simp[n - 1], simp[0], side)\n for (let i = 1; i <= n; i++) {\n const addStartPoint = i !== 1\n segGen.addNextSegment(simp[i], addStartPoint)\n }\n segGen.closeRing()\n }\n computeLineBufferCurve(inputPts, segGen) {\n const distTol = this.simplifyTolerance(this._distance)\n const simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n1 = simp1.length - 1\n segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT)\n for (let i = 2; i <= n1; i++) \n segGen.addNextSegment(simp1[i], true)\n \n segGen.addLastSegment()\n segGen.addLineEndCap(simp1[n1 - 1], simp1[n1])\n const simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol)\n const n2 = simp2.length - 1\n segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT)\n for (let i = n2 - 2; i >= 0; i--) \n segGen.addNextSegment(simp2[i], true)\n \n segGen.addLastSegment()\n segGen.addLineEndCap(simp2[1], simp2[0])\n segGen.closeRing()\n }\n computePointCurve(pt, segGen) {\n switch (this._bufParams.getEndCapStyle()) {\n case BufferParameters.CAP_ROUND:\n segGen.createCircle(pt)\n break\n case BufferParameters.CAP_SQUARE:\n segGen.createSquare(pt)\n break\n }\n }\n getLineCurve(inputPts, distance) {\n this._distance = distance\n if (this.isLineOffsetEmpty(distance)) return null\n const posDistance = Math.abs(distance)\n const segGen = this.getSegGen(posDistance)\n if (inputPts.length <= 1) {\n this.computePointCurve(inputPts[0], segGen)\n } else \n if (this._bufParams.isSingleSided()) {\n const isRightSide = distance < 0.0\n this.computeSingleSidedBufferCurve(inputPts, isRightSide, segGen)\n } else {\n this.computeLineBufferCurve(inputPts, segGen)\n }\n \n const lineCoord = segGen.getCoordinates()\n return lineCoord\n }\n getBufferParameters() {\n return this._bufParams\n }\n simplifyTolerance(bufDistance) {\n return bufDistance * this._bufParams.getSimplifyFactor()\n }\n getRingCurve(inputPts, side, distance) {\n this._distance = distance\n if (inputPts.length <= 2) return this.getLineCurve(inputPts, distance)\n if (distance === 0.0) \n return OffsetCurveBuilder.copyCoordinates(inputPts)\n \n const segGen = this.getSegGen(distance)\n this.computeRingBufferCurve(inputPts, side, segGen)\n return segGen.getCoordinates()\n }\n computeOffsetCurve(inputPts, isRightSide, segGen) {\n const distTol = this.simplifyTolerance(this._distance)\n if (isRightSide) {\n const simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol)\n const n2 = simp2.length - 1\n segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = n2 - 2; i >= 0; i--) \n segGen.addNextSegment(simp2[i], true)\n \n } else {\n const simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n1 = simp1.length - 1\n segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = 2; i <= n1; i++) \n segGen.addNextSegment(simp1[i], true)\n \n }\n segGen.addLastSegment()\n }\n isLineOffsetEmpty(distance) {\n if (distance === 0.0) return true\n if (distance < 0.0 && !this._bufParams.isSingleSided()) return true\n return false\n }\n getSegGen(distance) {\n return new OffsetSegmentGenerator(this._precisionModel, this._bufParams, distance)\n }\n}\n","import hasInterface from '../../../../../hasInterface.js'\nimport Position from '../../geomgraph/Position.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport DirectedEdge from '../../geomgraph/DirectedEdge.js'\nimport LineSegment from '../../geom/LineSegment.js'\nimport Comparable from '../../../../../java/lang/Comparable.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport List from '../../../../../java/util/List.js'\nexport default class SubgraphDepthLocater {\n constructor() {\n SubgraphDepthLocater.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._subgraphs = null\n this._seg = new LineSegment()\n const subgraphs = arguments[0]\n this._subgraphs = subgraphs\n }\n findStabbedSegments() {\n if (arguments.length === 1) {\n const stabbingRayLeftPt = arguments[0]\n const stabbedSegments = new ArrayList()\n for (let i = this._subgraphs.iterator(); i.hasNext(); ) {\n const bsg = i.next()\n const env = bsg.getEnvelope()\n if (stabbingRayLeftPt.y < env.getMinY() || stabbingRayLeftPt.y > env.getMaxY()) continue\n this.findStabbedSegments(stabbingRayLeftPt, bsg.getDirectedEdges(), stabbedSegments)\n }\n return stabbedSegments\n } else if (arguments.length === 3) {\n if (hasInterface(arguments[2], List) && (arguments[0] instanceof Coordinate && arguments[1] instanceof DirectedEdge)) {\n const stabbingRayLeftPt = arguments[0], dirEdge = arguments[1], stabbedSegments = arguments[2]\n const pts = dirEdge.getEdge().getCoordinates()\n for (let i = 0; i < pts.length - 1; i++) {\n this._seg.p0 = pts[i]\n this._seg.p1 = pts[i + 1]\n if (this._seg.p0.y > this._seg.p1.y) this._seg.reverse()\n const maxx = Math.max(this._seg.p0.x, this._seg.p1.x)\n if (maxx < stabbingRayLeftPt.x) continue\n if (this._seg.isHorizontal()) continue\n if (stabbingRayLeftPt.y < this._seg.p0.y || stabbingRayLeftPt.y > this._seg.p1.y) continue\n if (Orientation.index(this._seg.p0, this._seg.p1, stabbingRayLeftPt) === Orientation.RIGHT) continue\n let depth = dirEdge.getDepth(Position.LEFT)\n if (!this._seg.p0.equals(pts[i])) depth = dirEdge.getDepth(Position.RIGHT)\n const ds = new DepthSegment(this._seg, depth)\n stabbedSegments.add(ds)\n }\n } else if (hasInterface(arguments[2], List) && (arguments[0] instanceof Coordinate && hasInterface(arguments[1], List))) {\n const stabbingRayLeftPt = arguments[0], dirEdges = arguments[1], stabbedSegments = arguments[2]\n for (let i = dirEdges.iterator(); i.hasNext(); ) {\n const de = i.next()\n if (!de.isForward()) continue\n this.findStabbedSegments(stabbingRayLeftPt, de, stabbedSegments)\n }\n }\n }\n }\n getDepth(p) {\n const stabbedSegments = this.findStabbedSegments(p)\n if (stabbedSegments.size() === 0) return 0\n const ds = Collections.min(stabbedSegments)\n return ds._leftDepth\n }\n}\nclass DepthSegment {\n constructor() {\n DepthSegment.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._upwardSeg = null\n this._leftDepth = null\n const seg = arguments[0], depth = arguments[1]\n this._upwardSeg = new LineSegment(seg)\n this._leftDepth = depth\n }\n compareTo(obj) {\n const other = obj\n if (this._upwardSeg.minX() >= other._upwardSeg.maxX()) return 1\n if (this._upwardSeg.maxX() <= other._upwardSeg.minX()) return -1\n let orientIndex = this._upwardSeg.orientationIndex(other._upwardSeg)\n if (orientIndex !== 0) return orientIndex\n orientIndex = -1 * other._upwardSeg.orientationIndex(this._upwardSeg)\n if (orientIndex !== 0) return orientIndex\n return this._upwardSeg.compareTo(other._upwardSeg)\n }\n compareX(seg0, seg1) {\n const compare0 = seg0.p0.compareTo(seg1.p0)\n if (compare0 !== 0) return compare0\n return seg0.p1.compareTo(seg1.p1)\n }\n toString() {\n return this._upwardSeg.toString()\n }\n get interfaces_() {\n return [Comparable]\n }\n}\nSubgraphDepthLocater.DepthSegment = DepthSegment\n","import Exception from '../../../../java/lang/Exception.js'\nexport default class NotRepresentableException extends Exception {\n constructor() {\n super()\n NotRepresentableException.constructor_.apply(this, arguments)\n }\n static constructor_() {\n Exception.constructor_.call(this, 'Projective point not representable on the Cartesian plane.')\n }\n}\n","import NotRepresentableException from './NotRepresentableException.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nexport default class HCoordinate {\n constructor() {\n HCoordinate.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.x = null\n this.y = null\n this.w = null\n if (arguments.length === 0) {\n this.x = 0.0\n this.y = 0.0\n this.w = 1.0\n } else if (arguments.length === 1) {\n const p = arguments[0]\n this.x = p.x\n this.y = p.y\n this.w = 1.0\n } else if (arguments.length === 2) {\n if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const _x = arguments[0], _y = arguments[1]\n this.x = _x\n this.y = _y\n this.w = 1.0\n } else if (arguments[0] instanceof HCoordinate && arguments[1] instanceof HCoordinate) {\n const p1 = arguments[0], p2 = arguments[1]\n this.x = p1.y * p2.w - p2.y * p1.w\n this.y = p2.x * p1.w - p1.x * p2.w\n this.w = p1.x * p2.y - p2.x * p1.y\n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const p1 = arguments[0], p2 = arguments[1]\n this.x = p1.y - p2.y\n this.y = p2.x - p1.x\n this.w = p1.x * p2.y - p2.x * p1.y\n }\n } else if (arguments.length === 3) {\n const _x = arguments[0], _y = arguments[1], _w = arguments[2]\n this.x = _x\n this.y = _y\n this.w = _w\n } else if (arguments.length === 4) {\n const p1 = arguments[0], p2 = arguments[1], q1 = arguments[2], q2 = arguments[3]\n const px = p1.y - p2.y\n const py = p2.x - p1.x\n const pw = p1.x * p2.y - p2.x * p1.y\n const qx = q1.y - q2.y\n const qy = q2.x - q1.x\n const qw = q1.x * q2.y - q2.x * q1.y\n this.x = py * qw - qy * pw\n this.y = qx * pw - px * qw\n this.w = px * qy - qx * py\n }\n }\n getY() {\n const a = this.y / this.w\n if (Double.isNaN(a) || Double.isInfinite(a)) \n throw new NotRepresentableException()\n \n return a\n }\n getX() {\n const a = this.x / this.w\n if (Double.isNaN(a) || Double.isInfinite(a)) \n throw new NotRepresentableException()\n \n return a\n }\n getCoordinate() {\n const p = new Coordinate()\n p.x = this.getX()\n p.y = this.getY()\n return p\n }\n}\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport DD from '../math/DD.js'\nimport Angle from '../algorithm/Angle.js'\nimport HCoordinate from '../algorithm/HCoordinate.js'\nexport default class Triangle {\n constructor() {\n Triangle.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.p0 = null\n this.p1 = null\n this.p2 = null\n const p0 = arguments[0], p1 = arguments[1], p2 = arguments[2]\n this.p0 = p0\n this.p1 = p1\n this.p2 = p2\n }\n static area(a, b, c) {\n return Math.abs(((c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y)) / 2)\n }\n static signedArea(a, b, c) {\n return ((c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y)) / 2\n }\n static det(m00, m01, m10, m11) {\n return m00 * m11 - m01 * m10\n }\n static interpolateZ(p, v0, v1, v2) {\n const x0 = v0.x\n const y0 = v0.y\n const a = v1.x - x0\n const b = v2.x - x0\n const c = v1.y - y0\n const d = v2.y - y0\n const det = a * d - b * c\n const dx = p.x - x0\n const dy = p.y - y0\n const t = (d * dx - b * dy) / det\n const u = (-c * dx + a * dy) / det\n const z = v0.getZ() + t * (v1.getZ() - v0.getZ()) + u * (v2.getZ() - v0.getZ())\n return z\n }\n static longestSideLength(a, b, c) {\n const lenAB = a.distance(b)\n const lenBC = b.distance(c)\n const lenCA = c.distance(a)\n let maxLen = lenAB\n if (lenBC > maxLen) maxLen = lenBC\n if (lenCA > maxLen) maxLen = lenCA\n return maxLen\n }\n static circumcentreDD(a, b, c) {\n const ax = DD.valueOf(a.x).subtract(c.x)\n const ay = DD.valueOf(a.y).subtract(c.y)\n const bx = DD.valueOf(b.x).subtract(c.x)\n const by = DD.valueOf(b.y).subtract(c.y)\n const denom = DD.determinant(ax, ay, bx, by).multiply(2)\n const asqr = ax.sqr().add(ay.sqr())\n const bsqr = bx.sqr().add(by.sqr())\n const numx = DD.determinant(ay, asqr, by, bsqr)\n const numy = DD.determinant(ax, asqr, bx, bsqr)\n const ccx = DD.valueOf(c.x).subtract(numx.divide(denom)).doubleValue()\n const ccy = DD.valueOf(c.y).add(numy.divide(denom)).doubleValue()\n return new Coordinate(ccx, ccy)\n }\n static isAcute(a, b, c) {\n if (!Angle.isAcute(a, b, c)) return false\n if (!Angle.isAcute(b, c, a)) return false\n if (!Angle.isAcute(c, a, b)) return false\n return true\n }\n static circumcentre(a, b, c) {\n const cx = c.x\n const cy = c.y\n const ax = a.x - cx\n const ay = a.y - cy\n const bx = b.x - cx\n const by = b.y - cy\n const denom = 2 * Triangle.det(ax, ay, bx, by)\n const numx = Triangle.det(ay, ax * ax + ay * ay, by, bx * bx + by * by)\n const numy = Triangle.det(ax, ax * ax + ay * ay, bx, bx * bx + by * by)\n const ccx = cx - numx / denom\n const ccy = cy + numy / denom\n return new Coordinate(ccx, ccy)\n }\n static perpendicularBisector(a, b) {\n const dx = b.x - a.x\n const dy = b.y - a.y\n const l1 = new HCoordinate(a.x + dx / 2.0, a.y + dy / 2.0, 1.0)\n const l2 = new HCoordinate(a.x - dy + dx / 2.0, a.y + dx + dy / 2.0, 1.0)\n return new HCoordinate(l1, l2)\n }\n static angleBisector(a, b, c) {\n const len0 = b.distance(a)\n const len2 = b.distance(c)\n const frac = len0 / (len0 + len2)\n const dx = c.x - a.x\n const dy = c.y - a.y\n const splitPt = new Coordinate(a.x + frac * dx, a.y + frac * dy)\n return splitPt\n }\n static area3D(a, b, c) {\n const ux = b.x - a.x\n const uy = b.y - a.y\n const uz = b.getZ() - a.getZ()\n const vx = c.x - a.x\n const vy = c.y - a.y\n const vz = c.getZ() - a.getZ()\n const crossx = uy * vz - uz * vy\n const crossy = uz * vx - ux * vz\n const crossz = ux * vy - uy * vx\n const absSq = crossx * crossx + crossy * crossy + crossz * crossz\n const area3D = Math.sqrt(absSq) / 2\n return area3D\n }\n static centroid(a, b, c) {\n const x = (a.x + b.x + c.x) / 3\n const y = (a.y + b.y + c.y) / 3\n return new Coordinate(x, y)\n }\n static inCentre(a, b, c) {\n const len0 = b.distance(c)\n const len1 = a.distance(c)\n const len2 = a.distance(b)\n const circum = len0 + len1 + len2\n const inCentreX = (len0 * a.x + len1 * b.x + len2 * c.x) / circum\n const inCentreY = (len0 * a.y + len1 * b.y + len2 * c.y) / circum\n return new Coordinate(inCentreX, inCentreY)\n }\n area() {\n return Triangle.area(this.p0, this.p1, this.p2)\n }\n signedArea() {\n return Triangle.signedArea(this.p0, this.p1, this.p2)\n }\n interpolateZ(p) {\n if (p === null) throw new IllegalArgumentException('Supplied point is null.')\n return Triangle.interpolateZ(p, this.p0, this.p1, this.p2)\n }\n longestSideLength() {\n return Triangle.longestSideLength(this.p0, this.p1, this.p2)\n }\n isAcute() {\n return Triangle.isAcute(this.p0, this.p1, this.p2)\n }\n circumcentre() {\n return Triangle.circumcentre(this.p0, this.p1, this.p2)\n }\n area3D() {\n return Triangle.area3D(this.p0, this.p1, this.p2)\n }\n centroid() {\n return Triangle.centroid(this.p0, this.p1, this.p2)\n }\n inCentre() {\n return Triangle.inCentre(this.p0, this.p1, this.p2)\n }\n}\n","import Location from '../../geom/Location.js'\nimport LineString from '../../geom/LineString.js'\nimport Position from '../../geomgraph/Position.js'\nimport Point from '../../geom/Point.js'\nimport NodedSegmentString from '../../noding/NodedSegmentString.js'\nimport Polygon from '../../geom/Polygon.js'\nimport MultiPoint from '../../geom/MultiPoint.js'\nimport LinearRing from '../../geom/LinearRing.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport MultiPolygon from '../../geom/MultiPolygon.js'\nimport Label from '../../geomgraph/Label.js'\nimport GeometryCollection from '../../geom/GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../../java/lang/UnsupportedOperationException.js'\nimport CoordinateArrays from '../../geom/CoordinateArrays.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Distance from '../../algorithm/Distance.js'\nimport MultiLineString from '../../geom/MultiLineString.js'\nimport Triangle from '../../geom/Triangle.js'\nexport default class OffsetCurveSetBuilder {\n constructor() {\n OffsetCurveSetBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._inputGeom = null\n this._distance = null\n this._curveBuilder = null\n this._curveList = new ArrayList()\n const inputGeom = arguments[0], distance = arguments[1], curveBuilder = arguments[2]\n this._inputGeom = inputGeom\n this._distance = distance\n this._curveBuilder = curveBuilder\n }\n addRingSide(coord, offsetDistance, side, cwLeftLoc, cwRightLoc) {\n if (offsetDistance === 0.0 && coord.length < LinearRing.MINIMUM_VALID_SIZE) return null\n let leftLoc = cwLeftLoc\n let rightLoc = cwRightLoc\n if (coord.length >= LinearRing.MINIMUM_VALID_SIZE && Orientation.isCCW(coord)) {\n leftLoc = cwRightLoc\n rightLoc = cwLeftLoc\n side = Position.opposite(side)\n }\n const curve = this._curveBuilder.getRingCurve(coord, side, offsetDistance)\n this.addCurve(curve, leftLoc, rightLoc)\n }\n addRingBothSides(coord, distance) {\n this.addRingSide(coord, distance, Position.LEFT, Location.EXTERIOR, Location.INTERIOR)\n this.addRingSide(coord, distance, Position.RIGHT, Location.INTERIOR, Location.EXTERIOR)\n }\n addPoint(p) {\n if (this._distance <= 0.0) return null\n const coord = p.getCoordinates()\n const curve = this._curveBuilder.getLineCurve(coord, this._distance)\n this.addCurve(curve, Location.EXTERIOR, Location.INTERIOR)\n }\n addPolygon(p) {\n let offsetDistance = this._distance\n let offsetSide = Position.LEFT\n if (this._distance < 0.0) {\n offsetDistance = -this._distance\n offsetSide = Position.RIGHT\n }\n const shell = p.getExteriorRing()\n const shellCoord = CoordinateArrays.removeRepeatedPoints(shell.getCoordinates())\n if (this._distance < 0.0 && this.isErodedCompletely(shell, this._distance)) return null\n if (this._distance <= 0.0 && shellCoord.length < 3) return null\n this.addRingSide(shellCoord, offsetDistance, offsetSide, Location.EXTERIOR, Location.INTERIOR)\n for (let i = 0; i < p.getNumInteriorRing(); i++) {\n const hole = p.getInteriorRingN(i)\n const holeCoord = CoordinateArrays.removeRepeatedPoints(hole.getCoordinates())\n if (this._distance > 0.0 && this.isErodedCompletely(hole, -this._distance)) continue\n this.addRingSide(holeCoord, offsetDistance, Position.opposite(offsetSide), Location.INTERIOR, Location.EXTERIOR)\n }\n }\n isTriangleErodedCompletely(triangleCoord, bufferDistance) {\n const tri = new Triangle(triangleCoord[0], triangleCoord[1], triangleCoord[2])\n const inCentre = tri.inCentre()\n const distToCentre = Distance.pointToSegment(inCentre, tri.p0, tri.p1)\n return distToCentre < Math.abs(bufferDistance)\n }\n addLineString(line) {\n if (this._curveBuilder.isLineOffsetEmpty(this._distance)) return null\n const coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates())\n if (CoordinateArrays.isRing(coord) && !this._curveBuilder.getBufferParameters().isSingleSided()) {\n this.addRingBothSides(coord, this._distance)\n } else {\n const curve = this._curveBuilder.getLineCurve(coord, this._distance)\n this.addCurve(curve, Location.EXTERIOR, Location.INTERIOR)\n }\n }\n addCurve(coord, leftLoc, rightLoc) {\n if (coord === null || coord.length < 2) return null\n const e = new NodedSegmentString(coord, new Label(0, Location.BOUNDARY, leftLoc, rightLoc))\n this._curveList.add(e)\n }\n getCurves() {\n this.add(this._inputGeom)\n return this._curveList\n }\n add(g) {\n if (g.isEmpty()) return null\n if (g instanceof Polygon) this.addPolygon(g); else if (g instanceof LineString) this.addLineString(g); else if (g instanceof Point) this.addPoint(g); else if (g instanceof MultiPoint) this.addCollection(g); else if (g instanceof MultiLineString) this.addCollection(g); else if (g instanceof MultiPolygon) this.addCollection(g); else if (g instanceof GeometryCollection) this.addCollection(g); else throw new UnsupportedOperationException(g.getGeometryType())\n }\n isErodedCompletely(ring, bufferDistance) {\n const ringCoord = ring.getCoordinates()\n if (ringCoord.length < 4) return bufferDistance < 0\n if (ringCoord.length === 4) return this.isTriangleErodedCompletely(ringCoord, bufferDistance)\n const env = ring.getEnvelopeInternal()\n const envMinDimension = Math.min(env.getHeight(), env.getWidth())\n if (bufferDistance < 0.0 && 2 * Math.abs(bufferDistance) > envMinDimension) return true\n return false\n }\n addCollection(gc) {\n for (let i = 0; i < gc.getNumGeometries(); i++) {\n const g = gc.getGeometryN(i)\n this.add(g)\n }\n }\n}\n","export default class PointOnGeometryLocator {\n locate(p) {}\n}\n","import Iterator from '../../../../java/util/Iterator.js'\nimport NoSuchElementException from '../../../../java/util/NoSuchElementException.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nexport default class GeometryCollectionIterator {\n constructor() {\n GeometryCollectionIterator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._parent = null\n this._atStart = null\n this._max = null\n this._index = null\n this._subcollectionIterator = null\n const parent = arguments[0]\n this._parent = parent\n this._atStart = true\n this._index = 0\n this._max = parent.getNumGeometries()\n }\n static isAtomic(geom) {\n return !(geom instanceof GeometryCollection)\n }\n next() {\n if (this._atStart) {\n this._atStart = false\n if (GeometryCollectionIterator.isAtomic(this._parent)) this._index++\n return this._parent\n }\n if (this._subcollectionIterator !== null) \n if (this._subcollectionIterator.hasNext()) \n return this._subcollectionIterator.next()\n else \n this._subcollectionIterator = null\n \n \n if (this._index >= this._max) \n throw new NoSuchElementException()\n \n const obj = this._parent.getGeometryN(this._index++)\n if (obj instanceof GeometryCollection) {\n this._subcollectionIterator = new GeometryCollectionIterator(obj)\n return this._subcollectionIterator.next()\n }\n return obj\n }\n remove() {\n throw new UnsupportedOperationException(this.getClass().getName())\n }\n hasNext() {\n if (this._atStart) \n return true\n \n if (this._subcollectionIterator !== null) {\n if (this._subcollectionIterator.hasNext()) \n return true\n \n this._subcollectionIterator = null\n }\n if (this._index >= this._max) \n return false\n \n return true\n }\n get interfaces_() {\n return [Iterator]\n }\n}\n","import Location from '../../geom/Location.js'\nimport Polygon from '../../geom/Polygon.js'\nimport PointLocation from '../PointLocation.js'\nimport PointOnGeometryLocator from './PointOnGeometryLocator.js'\nimport GeometryCollectionIterator from '../../geom/GeometryCollectionIterator.js'\nimport GeometryCollection from '../../geom/GeometryCollection.js'\nexport default class SimplePointInAreaLocator {\n constructor() {\n SimplePointInAreaLocator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = null\n const geom = arguments[0]\n this._geom = geom\n }\n static locatePointInPolygon(p, poly) {\n if (poly.isEmpty()) return Location.EXTERIOR\n const shell = poly.getExteriorRing()\n const shellLoc = SimplePointInAreaLocator.locatePointInRing(p, shell)\n if (shellLoc !== Location.INTERIOR) return shellLoc\n for (let i = 0; i < poly.getNumInteriorRing(); i++) {\n const hole = poly.getInteriorRingN(i)\n const holeLoc = SimplePointInAreaLocator.locatePointInRing(p, hole)\n if (holeLoc === Location.BOUNDARY) return Location.BOUNDARY\n if (holeLoc === Location.INTERIOR) return Location.EXTERIOR\n }\n return Location.INTERIOR\n }\n static locatePointInRing(p, ring) {\n if (!ring.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n return PointLocation.locateInRing(p, ring.getCoordinates())\n }\n static containsPointInPolygon(p, poly) {\n return Location.EXTERIOR !== SimplePointInAreaLocator.locatePointInPolygon(p, poly)\n }\n static locateInGeometry(p, geom) {\n if (geom instanceof Polygon) \n return SimplePointInAreaLocator.locatePointInPolygon(p, geom)\n \n if (geom instanceof GeometryCollection) {\n const geomi = new GeometryCollectionIterator(geom)\n while (geomi.hasNext()) {\n const g2 = geomi.next()\n if (g2 !== geom) {\n const loc = SimplePointInAreaLocator.locateInGeometry(p, g2)\n if (loc !== Location.EXTERIOR) return loc\n }\n }\n }\n return Location.EXTERIOR\n }\n static isContained(p, geom) {\n return Location.EXTERIOR !== SimplePointInAreaLocator.locate(p, geom)\n }\n static locate(p, geom) {\n if (geom.isEmpty()) return Location.EXTERIOR\n if (!geom.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n return SimplePointInAreaLocator.locateInGeometry(p, geom)\n }\n locate(p) {\n return SimplePointInAreaLocator.locate(p, this._geom)\n }\n get interfaces_() {\n return [PointOnGeometryLocator]\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport System from '../../../../java/lang/System.js'\nimport SimplePointInAreaLocator from '../algorithm/locate/SimplePointInAreaLocator.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Assert from '../util/Assert.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class EdgeEndStar {\n constructor() {\n EdgeEndStar.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edgeMap = new TreeMap()\n this._edgeList = null\n this._ptInAreaLocation = [Location.NONE, Location.NONE]\n }\n getNextCW(ee) {\n this.getEdges()\n const i = this._edgeList.indexOf(ee)\n let iNextCW = i - 1\n if (i === 0) iNextCW = this._edgeList.size() - 1\n return this._edgeList.get(iNextCW)\n }\n propagateSideLabels(geomIndex) {\n let startLoc = Location.NONE\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n if (label.isArea(geomIndex) && label.getLocation(geomIndex, Position.LEFT) !== Location.NONE) startLoc = label.getLocation(geomIndex, Position.LEFT)\n }\n if (startLoc === Location.NONE) return null\n let currLoc = startLoc\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n if (label.getLocation(geomIndex, Position.ON) === Location.NONE) label.setLocation(geomIndex, Position.ON, currLoc)\n if (label.isArea(geomIndex)) {\n const leftLoc = label.getLocation(geomIndex, Position.LEFT)\n const rightLoc = label.getLocation(geomIndex, Position.RIGHT)\n if (rightLoc !== Location.NONE) {\n if (rightLoc !== currLoc) throw new TopologyException('side location conflict', e.getCoordinate())\n if (leftLoc === Location.NONE) \n Assert.shouldNeverReachHere('found single null side (at ' + e.getCoordinate() + ')')\n \n currLoc = leftLoc\n } else {\n Assert.isTrue(label.getLocation(geomIndex, Position.LEFT) === Location.NONE, 'found single null side')\n label.setLocation(geomIndex, Position.RIGHT, currLoc)\n label.setLocation(geomIndex, Position.LEFT, currLoc)\n }\n }\n }\n }\n getCoordinate() {\n const it = this.iterator()\n if (!it.hasNext()) return null\n const e = it.next()\n return e.getCoordinate()\n }\n print(out) {\n System.out.println('EdgeEndStar: ' + this.getCoordinate())\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n e.print(out)\n }\n }\n isAreaLabelsConsistent(geomGraph) {\n this.computeEdgeEndLabels(geomGraph.getBoundaryNodeRule())\n return this.checkAreaLabelsConsistent(0)\n }\n checkAreaLabelsConsistent(geomIndex) {\n const edges = this.getEdges()\n if (edges.size() <= 0) return true\n const lastEdgeIndex = edges.size() - 1\n const startLabel = edges.get(lastEdgeIndex).getLabel()\n const startLoc = startLabel.getLocation(geomIndex, Position.LEFT)\n Assert.isTrue(startLoc !== Location.NONE, 'Found unlabelled area edge')\n let currLoc = startLoc\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n Assert.isTrue(label.isArea(geomIndex), 'Found non-area edge')\n const leftLoc = label.getLocation(geomIndex, Position.LEFT)\n const rightLoc = label.getLocation(geomIndex, Position.RIGHT)\n if (leftLoc === rightLoc) \n return false\n \n if (rightLoc !== currLoc) \n return false\n \n currLoc = leftLoc\n }\n return true\n }\n findIndex(eSearch) {\n this.iterator()\n for (let i = 0; i < this._edgeList.size(); i++) {\n const e = this._edgeList.get(i)\n if (e === eSearch) return i\n }\n return -1\n }\n iterator() {\n return this.getEdges().iterator()\n }\n getEdges() {\n if (this._edgeList === null) \n this._edgeList = new ArrayList(this._edgeMap.values())\n \n return this._edgeList\n }\n getLocation(geomIndex, p, geom) {\n if (this._ptInAreaLocation[geomIndex] === Location.NONE) \n this._ptInAreaLocation[geomIndex] = SimplePointInAreaLocator.locate(p, geom[geomIndex].getGeometry())\n \n return this._ptInAreaLocation[geomIndex]\n }\n toString() {\n const buf = new StringBuffer()\n buf.append('EdgeEndStar: ' + this.getCoordinate())\n buf.append('\\n')\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n buf.append(e)\n buf.append('\\n')\n }\n return buf.toString()\n }\n computeEdgeEndLabels(boundaryNodeRule) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const ee = it.next()\n ee.computeLabel(boundaryNodeRule)\n }\n }\n computeLabelling(geomGraph) {\n this.computeEdgeEndLabels(geomGraph[0].getBoundaryNodeRule())\n this.propagateSideLabels(0)\n this.propagateSideLabels(1)\n const hasDimensionalCollapseEdge = [false, false]\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n for (let geomi = 0; geomi < 2; geomi++) \n if (label.isLine(geomi) && label.getLocation(geomi) === Location.BOUNDARY) hasDimensionalCollapseEdge[geomi] = true\n \n }\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n for (let geomi = 0; geomi < 2; geomi++) \n if (label.isAnyNull(geomi)) {\n let loc = Location.NONE\n if (hasDimensionalCollapseEdge[geomi]) {\n loc = Location.EXTERIOR\n } else {\n const p = e.getCoordinate()\n loc = this.getLocation(geomi, p, geomGraph)\n }\n label.setAllLocationsIfNull(geomi, loc)\n }\n \n }\n }\n getDegree() {\n return this._edgeMap.size()\n }\n insertEdgeEnd(e, obj) {\n this._edgeMap.put(e, obj)\n this._edgeList = null\n }\n}\n","import Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport EdgeEndStar from './EdgeEndStar.js'\nimport System from '../../../../java/lang/System.js'\nimport Label from './Label.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Quadrant from './Quadrant.js'\nimport Assert from '../util/Assert.js'\nexport default class DirectedEdgeStar extends EdgeEndStar {\n constructor() {\n super()\n DirectedEdgeStar.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._resultAreaEdgeList = null\n this._label = null\n this._SCANNING_FOR_INCOMING = 1\n this._LINKING_TO_OUTGOING = 2\n }\n linkResultDirectedEdges() {\n this.getResultAreaEdges()\n let firstOut = null\n let incoming = null\n let state = this._SCANNING_FOR_INCOMING\n for (let i = 0; i < this._resultAreaEdgeList.size(); i++) {\n const nextOut = this._resultAreaEdgeList.get(i)\n const nextIn = nextOut.getSym()\n if (!nextOut.getLabel().isArea()) continue\n if (firstOut === null && nextOut.isInResult()) firstOut = nextOut\n switch (state) {\n case this._SCANNING_FOR_INCOMING:\n if (!nextIn.isInResult()) continue\n incoming = nextIn\n state = this._LINKING_TO_OUTGOING\n break\n case this._LINKING_TO_OUTGOING:\n if (!nextOut.isInResult()) continue\n incoming.setNext(nextOut)\n state = this._SCANNING_FOR_INCOMING\n break\n }\n }\n if (state === this._LINKING_TO_OUTGOING) {\n if (firstOut === null) throw new TopologyException('no outgoing dirEdge found', this.getCoordinate())\n Assert.isTrue(firstOut.isInResult(), 'unable to link last incoming dirEdge')\n incoming.setNext(firstOut)\n }\n }\n insert(ee) {\n const de = ee\n this.insertEdgeEnd(de, de)\n }\n getRightmostEdge() {\n const edges = this.getEdges()\n const size = edges.size()\n if (size < 1) return null\n const de0 = edges.get(0)\n if (size === 1) return de0\n const deLast = edges.get(size - 1)\n const quad0 = de0.getQuadrant()\n const quad1 = deLast.getQuadrant()\n if (Quadrant.isNorthern(quad0) && Quadrant.isNorthern(quad1)) {\n return de0\n } else if (!Quadrant.isNorthern(quad0) && !Quadrant.isNorthern(quad1)) {\n return deLast\n } else {\n const nonHorizontalEdge = null\n if (de0.getDy() !== 0) return de0; else if (deLast.getDy() !== 0) return deLast\n }\n Assert.shouldNeverReachHere('found two horizontal edges incident on node')\n return null\n }\n print(out) {\n System.out.println('DirectedEdgeStar: ' + this.getCoordinate())\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n out.print('out ')\n de.print(out)\n out.println()\n out.print('in ')\n de.getSym().print(out)\n out.println()\n }\n }\n getResultAreaEdges() {\n if (this._resultAreaEdgeList !== null) return this._resultAreaEdgeList\n this._resultAreaEdgeList = new ArrayList()\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.isInResult() || de.getSym().isInResult()) this._resultAreaEdgeList.add(de)\n }\n return this._resultAreaEdgeList\n }\n updateLabelling(nodeLabel) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n const label = de.getLabel()\n label.setAllLocationsIfNull(0, nodeLabel.getLocation(0))\n label.setAllLocationsIfNull(1, nodeLabel.getLocation(1))\n }\n }\n linkAllDirectedEdges() {\n this.getEdges()\n let prevOut = null\n let firstIn = null\n for (let i = this._edgeList.size() - 1; i >= 0; i--) {\n const nextOut = this._edgeList.get(i)\n const nextIn = nextOut.getSym()\n if (firstIn === null) firstIn = nextIn\n if (prevOut !== null) nextIn.setNext(prevOut)\n prevOut = nextOut\n }\n firstIn.setNext(prevOut)\n }\n computeDepths() {\n if (arguments.length === 1) {\n const de = arguments[0]\n const edgeIndex = this.findIndex(de)\n const startDepth = de.getDepth(Position.LEFT)\n const targetLastDepth = de.getDepth(Position.RIGHT)\n const nextDepth = this.computeDepths(edgeIndex + 1, this._edgeList.size(), startDepth)\n const lastDepth = this.computeDepths(0, edgeIndex, nextDepth)\n if (lastDepth !== targetLastDepth) throw new TopologyException('depth mismatch at ' + de.getCoordinate())\n } else if (arguments.length === 3) {\n const startIndex = arguments[0], endIndex = arguments[1], startDepth = arguments[2]\n let currDepth = startDepth\n for (let i = startIndex; i < endIndex; i++) {\n const nextDe = this._edgeList.get(i)\n nextDe.setEdgeDepths(Position.RIGHT, currDepth)\n currDepth = nextDe.getDepth(Position.LEFT)\n }\n return currDepth\n }\n }\n mergeSymLabels() {\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n const label = de.getLabel()\n label.merge(de.getSym().getLabel())\n }\n }\n linkMinimalDirectedEdges(er) {\n let firstOut = null\n let incoming = null\n let state = this._SCANNING_FOR_INCOMING\n for (let i = this._resultAreaEdgeList.size() - 1; i >= 0; i--) {\n const nextOut = this._resultAreaEdgeList.get(i)\n const nextIn = nextOut.getSym()\n if (firstOut === null && nextOut.getEdgeRing() === er) firstOut = nextOut\n switch (state) {\n case this._SCANNING_FOR_INCOMING:\n if (nextIn.getEdgeRing() !== er) continue\n incoming = nextIn\n state = this._LINKING_TO_OUTGOING\n break\n case this._LINKING_TO_OUTGOING:\n if (nextOut.getEdgeRing() !== er) continue\n incoming.setNextMin(nextOut)\n state = this._SCANNING_FOR_INCOMING\n break\n }\n }\n if (state === this._LINKING_TO_OUTGOING) {\n Assert.isTrue(firstOut !== null, 'found null for first outgoing dirEdge')\n Assert.isTrue(firstOut.getEdgeRing() === er, 'unable to link last incoming dirEdge')\n incoming.setNextMin(firstOut)\n }\n }\n getOutgoingDegree() {\n if (arguments.length === 0) {\n let degree = 0\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.isInResult()) degree++\n }\n return degree\n } else if (arguments.length === 1) {\n const er = arguments[0]\n let degree = 0\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.getEdgeRing() === er) degree++\n }\n return degree\n }\n }\n getLabel() {\n return this._label\n }\n findCoveredLineEdges() {\n let startLoc = Location.NONE\n for (let it = this.iterator(); it.hasNext(); ) {\n const nextOut = it.next()\n const nextIn = nextOut.getSym()\n if (!nextOut.isLineEdge()) {\n if (nextOut.isInResult()) {\n startLoc = Location.INTERIOR\n break\n }\n if (nextIn.isInResult()) {\n startLoc = Location.EXTERIOR\n break\n }\n }\n }\n if (startLoc === Location.NONE) return null\n let currLoc = startLoc\n for (let it = this.iterator(); it.hasNext(); ) {\n const nextOut = it.next()\n const nextIn = nextOut.getSym()\n if (nextOut.isLineEdge()) {\n nextOut.getEdge().setCovered(currLoc === Location.INTERIOR)\n } else {\n if (nextOut.isInResult()) currLoc = Location.EXTERIOR\n if (nextIn.isInResult()) currLoc = Location.INTERIOR\n }\n }\n }\n computeLabelling(geom) {\n super.computeLabelling.call(this, geom)\n this._label = new Label(Location.NONE)\n for (let it = this.iterator(); it.hasNext(); ) {\n const ee = it.next()\n const e = ee.getEdge()\n const eLabel = e.getLabel()\n for (let i = 0; i < 2; i++) {\n const eLoc = eLabel.getLocation(i)\n if (eLoc === Location.INTERIOR || eLoc === Location.BOUNDARY) this._label.setLocation(i, Location.INTERIOR)\n }\n }\n }\n}\n","import DirectedEdgeStar from '../../geomgraph/DirectedEdgeStar.js'\nimport Node from '../../geomgraph/Node.js'\nimport NodeFactory from '../../geomgraph/NodeFactory.js'\nexport default class OverlayNodeFactory extends NodeFactory {\n constructor() {\n super()\n }\n createNode(coord) {\n return new Node(coord, new DirectedEdgeStar())\n }\n}\n","import Comparable from '../../../../java/lang/Comparable.js'\nimport CoordinateArrays from '../geom/CoordinateArrays.js'\nexport default class OrientedCoordinateArray {\n constructor() {\n OrientedCoordinateArray.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pts = null\n this._orientation = null\n const pts = arguments[0]\n this._pts = pts\n this._orientation = OrientedCoordinateArray.orientation(pts)\n }\n static orientation(pts) {\n return CoordinateArrays.increasingDirection(pts) === 1\n }\n static compareOriented(pts1, orientation1, pts2, orientation2) {\n const dir1 = orientation1 ? 1 : -1\n const dir2 = orientation2 ? 1 : -1\n const limit1 = orientation1 ? pts1.length : -1\n const limit2 = orientation2 ? pts2.length : -1\n let i1 = orientation1 ? 0 : pts1.length - 1\n let i2 = orientation2 ? 0 : pts2.length - 1\n while (true) {\n const compPt = pts1[i1].compareTo(pts2[i2])\n if (compPt !== 0) return compPt\n i1 += dir1\n i2 += dir2\n const done1 = i1 === limit1\n const done2 = i2 === limit2\n if (done1 && !done2) return -1\n if (!done1 && done2) return 1\n if (done1 && done2) return 0\n }\n }\n compareTo(o1) {\n const oca = o1\n const comp = OrientedCoordinateArray.compareOriented(this._pts, this._orientation, oca._pts, oca._orientation)\n return comp\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import OrientedCoordinateArray from '../noding/OrientedCoordinateArray.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class EdgeList {\n constructor() {\n EdgeList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edges = new ArrayList()\n this._ocaMap = new TreeMap()\n }\n print(out) {\n out.print('MULTILINESTRING ( ')\n for (let j = 0; j < this._edges.size(); j++) {\n const e = this._edges.get(j)\n if (j > 0) out.print(',')\n out.print('(')\n const pts = e.getCoordinates()\n for (let i = 0; i < pts.length; i++) {\n if (i > 0) out.print(',')\n out.print(pts[i].x + ' ' + pts[i].y)\n }\n out.println(')')\n }\n out.print(') ')\n }\n addAll(edgeColl) {\n for (let i = edgeColl.iterator(); i.hasNext(); ) \n this.add(i.next())\n \n }\n findEdgeIndex(e) {\n for (let i = 0; i < this._edges.size(); i++) \n if (this._edges.get(i).equals(e)) return i\n \n return -1\n }\n iterator() {\n return this._edges.iterator()\n }\n getEdges() {\n return this._edges\n }\n get(i) {\n return this._edges.get(i)\n }\n findEqualEdge(e) {\n const oca = new OrientedCoordinateArray(e.getCoordinates())\n const matchEdge = this._ocaMap.get(oca)\n return matchEdge\n }\n add(e) {\n this._edges.add(e)\n const oca = new OrientedCoordinateArray(e.getCoordinates())\n this._ocaMap.put(oca, e)\n }\n}\n","export default class SegmentIntersector {\n processIntersections(e0, segIndex0, e1, segIndex1) {}\n isDone() {}\n}\n","import SegmentIntersector from './SegmentIntersector.js'\nexport default class IntersectionAdder {\n constructor() {\n IntersectionAdder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hasIntersection = false\n this._hasProper = false\n this._hasProperInterior = false\n this._hasInterior = false\n this._properIntersectionPoint = null\n this._li = null\n this._isSelfIntersection = null\n this.numIntersections = 0\n this.numInteriorIntersections = 0\n this.numProperIntersections = 0\n this.numTests = 0\n const li = arguments[0]\n this._li = li\n }\n static isAdjacentSegments(i1, i2) {\n return Math.abs(i1 - i2) === 1\n }\n isTrivialIntersection(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1) \n if (this._li.getIntersectionNum() === 1) {\n if (IntersectionAdder.isAdjacentSegments(segIndex0, segIndex1)) return true\n if (e0.isClosed()) {\n const maxSegIndex = e0.size() - 1\n if (segIndex0 === 0 && segIndex1 === maxSegIndex || segIndex1 === 0 && segIndex0 === maxSegIndex) \n return true\n \n }\n }\n \n return false\n }\n getProperIntersectionPoint() {\n return this._properIntersectionPoint\n }\n hasProperInteriorIntersection() {\n return this._hasProperInterior\n }\n getLineIntersector() {\n return this._li\n }\n hasProperIntersection() {\n return this._hasProper\n }\n processIntersections(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1 && segIndex0 === segIndex1) return null\n this.numTests++\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) {\n this.numIntersections++\n if (this._li.isInteriorIntersection()) {\n this.numInteriorIntersections++\n this._hasInterior = true\n }\n if (!this.isTrivialIntersection(e0, segIndex0, e1, segIndex1)) {\n this._hasIntersection = true\n e0.addIntersections(this._li, segIndex0, 0)\n e1.addIntersections(this._li, segIndex1, 1)\n if (this._li.isProper()) {\n this.numProperIntersections++\n this._hasProper = true\n this._hasProperInterior = true\n }\n }\n }\n }\n hasIntersection() {\n return this._hasIntersection\n }\n isDone() {\n return false\n }\n hasInteriorIntersection() {\n return this._hasInterior\n }\n get interfaces_() {\n return [SegmentIntersector]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nexport default class EdgeIntersection {\n constructor() {\n EdgeIntersection.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.coord = null\n this.segmentIndex = null\n this.dist = null\n const coord = arguments[0], segmentIndex = arguments[1], dist = arguments[2]\n this.coord = new Coordinate(coord)\n this.segmentIndex = segmentIndex\n this.dist = dist\n }\n getSegmentIndex() {\n return this.segmentIndex\n }\n getCoordinate() {\n return this.coord\n }\n print(out) {\n out.print(this.coord)\n out.print(' seg # = ' + this.segmentIndex)\n out.println(' dist = ' + this.dist)\n }\n compareTo(obj) {\n const other = obj\n return this.compare(other.segmentIndex, other.dist)\n }\n isEndPoint(maxSegmentIndex) {\n if (this.segmentIndex === 0 && this.dist === 0.0) return true\n if (this.segmentIndex === maxSegmentIndex) return true\n return false\n }\n toString() {\n return this.coord + ' seg # = ' + this.segmentIndex + ' dist = ' + this.dist\n }\n getDistance() {\n return this.dist\n }\n compare(segmentIndex, dist) {\n if (this.segmentIndex < segmentIndex) return -1\n if (this.segmentIndex > segmentIndex) return 1\n if (this.dist < dist) return -1\n if (this.dist > dist) return 1\n return 0\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import EdgeIntersection from './EdgeIntersection.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Label from './Label.js'\nimport Edge from './Edge.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class EdgeIntersectionList {\n constructor() {\n EdgeIntersectionList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeMap = new TreeMap()\n this.edge = null\n const edge = arguments[0]\n this.edge = edge\n }\n print(out) {\n out.println('Intersections:')\n for (let it = this.iterator(); it.hasNext(); ) {\n const ei = it.next()\n ei.print(out)\n }\n }\n iterator() {\n return this._nodeMap.values().iterator()\n }\n addSplitEdges(edgeList) {\n this.addEndpoints()\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n const newEdge = this.createSplitEdge(eiPrev, ei)\n edgeList.add(newEdge)\n eiPrev = ei\n }\n }\n addEndpoints() {\n const maxSegIndex = this.edge.pts.length - 1\n this.add(this.edge.pts[0], 0, 0.0)\n this.add(this.edge.pts[maxSegIndex], maxSegIndex, 0.0)\n }\n createSplitEdge(ei0, ei1) {\n let npts = ei1.segmentIndex - ei0.segmentIndex + 2\n const lastSegStartPt = this.edge.pts[ei1.segmentIndex]\n const useIntPt1 = ei1.dist > 0.0 || !ei1.coord.equals2D(lastSegStartPt)\n if (!useIntPt1) \n npts--\n \n const pts = new Array(npts).fill(null)\n let ipt = 0\n pts[ipt++] = new Coordinate(ei0.coord)\n for (let i = ei0.segmentIndex + 1; i <= ei1.segmentIndex; i++) \n pts[ipt++] = this.edge.pts[i]\n \n if (useIntPt1) pts[ipt] = ei1.coord\n return new Edge(pts, new Label(this.edge._label))\n }\n add(intPt, segmentIndex, dist) {\n const eiNew = new EdgeIntersection(intPt, segmentIndex, dist)\n const ei = this._nodeMap.get(eiNew)\n if (ei !== null) \n return ei\n \n this._nodeMap.put(eiNew, eiNew)\n return eiNew\n }\n isIntersection(pt) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const ei = it.next()\n if (ei.coord.equals(pt)) return true\n }\n return false\n }\n}\n","import Location from './Location.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Dimension from './Dimension.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport StringBuilder from '../../../../java/lang/StringBuilder.js'\nexport default class IntersectionMatrix {\n constructor() {\n IntersectionMatrix.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._matrix = null\n if (arguments.length === 0) {\n this._matrix = Array(3).fill().map(() => Array(3))\n this.setAll(Dimension.FALSE)\n } else if (arguments.length === 1) {\n if (typeof arguments[0] === 'string') {\n const elements = arguments[0]\n IntersectionMatrix.constructor_.call(this)\n this.set(elements)\n } else if (arguments[0] instanceof IntersectionMatrix) {\n const other = arguments[0]\n IntersectionMatrix.constructor_.call(this)\n this._matrix[Location.INTERIOR][Location.INTERIOR] = other._matrix[Location.INTERIOR][Location.INTERIOR]\n this._matrix[Location.INTERIOR][Location.BOUNDARY] = other._matrix[Location.INTERIOR][Location.BOUNDARY]\n this._matrix[Location.INTERIOR][Location.EXTERIOR] = other._matrix[Location.INTERIOR][Location.EXTERIOR]\n this._matrix[Location.BOUNDARY][Location.INTERIOR] = other._matrix[Location.BOUNDARY][Location.INTERIOR]\n this._matrix[Location.BOUNDARY][Location.BOUNDARY] = other._matrix[Location.BOUNDARY][Location.BOUNDARY]\n this._matrix[Location.BOUNDARY][Location.EXTERIOR] = other._matrix[Location.BOUNDARY][Location.EXTERIOR]\n this._matrix[Location.EXTERIOR][Location.INTERIOR] = other._matrix[Location.EXTERIOR][Location.INTERIOR]\n this._matrix[Location.EXTERIOR][Location.BOUNDARY] = other._matrix[Location.EXTERIOR][Location.BOUNDARY]\n this._matrix[Location.EXTERIOR][Location.EXTERIOR] = other._matrix[Location.EXTERIOR][Location.EXTERIOR]\n }\n }\n }\n static matches() {\n if (Number.isInteger(arguments[0]) && typeof arguments[1] === 'string') {\n const actualDimensionValue = arguments[0], requiredDimensionSymbol = arguments[1]\n if (requiredDimensionSymbol === Dimension.SYM_DONTCARE) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_TRUE && (actualDimensionValue >= 0 || actualDimensionValue === Dimension.TRUE)) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_FALSE && actualDimensionValue === Dimension.FALSE) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_P && actualDimensionValue === Dimension.P) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_L && actualDimensionValue === Dimension.L) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_A && actualDimensionValue === Dimension.A) \n return true\n \n return false\n } else if (typeof arguments[0] === 'string' && typeof arguments[1] === 'string') {\n const actualDimensionSymbols = arguments[0], requiredDimensionSymbols = arguments[1]\n const m = new IntersectionMatrix(actualDimensionSymbols)\n return m.matches(requiredDimensionSymbols)\n }\n }\n static isTrue(actualDimensionValue) {\n if (actualDimensionValue >= 0 || actualDimensionValue === Dimension.TRUE) \n return true\n \n return false\n }\n isIntersects() {\n return !this.isDisjoint()\n }\n isCovers() {\n const hasPointInCommon = IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.BOUNDARY]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.BOUNDARY])\n return hasPointInCommon && this._matrix[Location.EXTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.BOUNDARY] === Dimension.FALSE\n }\n isCoveredBy() {\n const hasPointInCommon = IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.BOUNDARY]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.BOUNDARY])\n return hasPointInCommon && this._matrix[Location.INTERIOR][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.EXTERIOR] === Dimension.FALSE\n }\n set() {\n if (arguments.length === 1) {\n const dimensionSymbols = arguments[0]\n for (let i = 0; i < dimensionSymbols.length; i++) {\n const row = Math.trunc(i / 3)\n const col = i % 3\n this._matrix[row][col] = Dimension.toDimensionValue(dimensionSymbols.charAt(i))\n }\n } else if (arguments.length === 3) {\n const row = arguments[0], column = arguments[1], dimensionValue = arguments[2]\n this._matrix[row][column] = dimensionValue\n }\n }\n isContains() {\n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && this._matrix[Location.EXTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.BOUNDARY] === Dimension.FALSE\n }\n setAtLeast() {\n if (arguments.length === 1) {\n const minimumDimensionSymbols = arguments[0]\n for (let i = 0; i < minimumDimensionSymbols.length; i++) {\n const row = Math.trunc(i / 3)\n const col = i % 3\n this.setAtLeast(row, col, Dimension.toDimensionValue(minimumDimensionSymbols.charAt(i)))\n }\n } else if (arguments.length === 3) {\n const row = arguments[0], column = arguments[1], minimumDimensionValue = arguments[2]\n if (this._matrix[row][column] < minimumDimensionValue) \n this._matrix[row][column] = minimumDimensionValue\n \n }\n }\n setAtLeastIfValid(row, column, minimumDimensionValue) {\n if (row >= 0 && column >= 0) \n this.setAtLeast(row, column, minimumDimensionValue)\n \n }\n isWithin() {\n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && this._matrix[Location.INTERIOR][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.EXTERIOR] === Dimension.FALSE\n }\n isTouches(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA > dimensionOfGeometryB) \n return this.isTouches(dimensionOfGeometryB, dimensionOfGeometryA)\n \n if (dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.L || dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.L) \n return this._matrix[Location.INTERIOR][Location.INTERIOR] === Dimension.FALSE && (IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.BOUNDARY]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.BOUNDARY]))\n \n return false\n }\n isOverlaps(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.P || dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.A) \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.EXTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.EXTERIOR][Location.INTERIOR])\n \n if (dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.L) \n return this._matrix[Location.INTERIOR][Location.INTERIOR] === 1 && IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.EXTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.EXTERIOR][Location.INTERIOR])\n \n return false\n }\n isEquals(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA !== dimensionOfGeometryB) \n return false\n \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && this._matrix[Location.INTERIOR][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.BOUNDARY] === Dimension.FALSE\n }\n toString() {\n const builder = new StringBuilder('123456789')\n for (let ai = 0; ai < 3; ai++) \n for (let bi = 0; bi < 3; bi++) \n builder.setCharAt(3 * ai + bi, Dimension.toDimensionSymbol(this._matrix[ai][bi]))\n \n \n return builder.toString()\n }\n setAll(dimensionValue) {\n for (let ai = 0; ai < 3; ai++) \n for (let bi = 0; bi < 3; bi++) \n this._matrix[ai][bi] = dimensionValue\n \n \n }\n get(row, column) {\n return this._matrix[row][column]\n }\n transpose() {\n let temp = this._matrix[1][0]\n this._matrix[1][0] = this._matrix[0][1]\n this._matrix[0][1] = temp\n temp = this._matrix[2][0]\n this._matrix[2][0] = this._matrix[0][2]\n this._matrix[0][2] = temp\n temp = this._matrix[2][1]\n this._matrix[2][1] = this._matrix[1][2]\n this._matrix[1][2] = temp\n return this\n }\n matches(requiredDimensionSymbols) {\n if (requiredDimensionSymbols.length !== 9) \n throw new IllegalArgumentException('Should be length 9: ' + requiredDimensionSymbols)\n \n for (let ai = 0; ai < 3; ai++) \n for (let bi = 0; bi < 3; bi++) \n if (!IntersectionMatrix.matches(this._matrix[ai][bi], requiredDimensionSymbols.charAt(3 * ai + bi))) \n return false\n \n \n \n return true\n }\n add(im) {\n for (let i = 0; i < 3; i++) \n for (let j = 0; j < 3; j++) \n this.setAtLeast(i, j, im.get(i, j))\n \n \n }\n isDisjoint() {\n return this._matrix[Location.INTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.INTERIOR][Location.BOUNDARY] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.BOUNDARY] === Dimension.FALSE\n }\n isCrosses(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.L || dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.A) \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.EXTERIOR])\n \n if (dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.P || dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.P || dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.L) \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.EXTERIOR][Location.INTERIOR])\n \n if (dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.L) \n return this._matrix[Location.INTERIOR][Location.INTERIOR] === 0\n \n return false\n }\n get interfaces_() {\n return [Cloneable]\n }\n}\n","import Arrays from '../../../../java/util/Arrays.js'\nimport System from '../../../../java/lang/System.js'\nexport default class IntArrayList {\n constructor() {\n IntArrayList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._data = null\n this._size = 0\n if (arguments.length === 0) {\n IntArrayList.constructor_.call(this, 10)\n } else if (arguments.length === 1) {\n const initialCapacity = arguments[0]\n this._data = new Array(initialCapacity).fill(null)\n }\n }\n size() {\n return this._size\n }\n addAll(values) {\n if (values === null) return null\n if (values.length === 0) return null\n this.ensureCapacity(this._size + values.length)\n System.arraycopy(values, 0, this._data, this._size, values.length)\n this._size += values.length\n }\n ensureCapacity(capacity) {\n if (capacity <= this._data.length) return null\n const newLength = Math.max(capacity, this._data.length * 2)\n this._data = Arrays.copyOf(this._data, newLength)\n }\n toArray() {\n const array = new Array(this._size).fill(null)\n System.arraycopy(this._data, 0, array, 0, this._size)\n return array\n }\n add(value) {\n this.ensureCapacity(this._size + 1)\n this._data[this._size] = value\n ++ this._size\n }\n}\n","import IntArrayList from '../../util/IntArrayList.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Quadrant from '../Quadrant.js'\nexport default class MonotoneChainIndexer {\n static toIntArray(list) {\n const array = new Array(list.size()).fill(null)\n for (let i = 0; i < array.length; i++) \n array[i] = list.get(i).intValue()\n \n return array\n }\n getChainStartIndices(pts) {\n let start = 0\n const startIndexList = new IntArrayList(Math.trunc(pts.length / 2))\n startIndexList.add(start)\n do {\n const last = this.findChainEnd(pts, start)\n startIndexList.add(last)\n start = last\n } while (start < pts.length - 1)\n return startIndexList.toArray()\n }\n findChainEnd(pts, start) {\n const chainQuad = Quadrant.quadrant(pts[start], pts[start + 1])\n let last = start + 1\n while (last < pts.length) {\n const quad = Quadrant.quadrant(pts[last - 1], pts[last])\n if (quad !== chainQuad) break\n last++\n }\n return last - 1\n }\n OLDgetChainStartIndices(pts) {\n let start = 0\n const startIndexList = new ArrayList()\n startIndexList.add(start)\n do {\n const last = this.findChainEnd(pts, start)\n startIndexList.add(last)\n start = last\n } while (start < pts.length - 1)\n const startIndex = MonotoneChainIndexer.toIntArray(startIndexList)\n return startIndex\n }\n}\n","import MonotoneChainIndexer from './MonotoneChainIndexer.js'\nimport Envelope from '../../geom/Envelope.js'\nexport default class MonotoneChainEdge {\n constructor() {\n MonotoneChainEdge.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.e = null\n this.pts = null\n this.startIndex = null\n const e = arguments[0]\n this.e = e\n this.pts = e.getCoordinates()\n const mcb = new MonotoneChainIndexer()\n this.startIndex = mcb.getChainStartIndices(this.pts)\n }\n getCoordinates() {\n return this.pts\n }\n getMaxX(chainIndex) {\n const x1 = this.pts[this.startIndex[chainIndex]].x\n const x2 = this.pts[this.startIndex[chainIndex + 1]].x\n return x1 > x2 ? x1 : x2\n }\n getMinX(chainIndex) {\n const x1 = this.pts[this.startIndex[chainIndex]].x\n const x2 = this.pts[this.startIndex[chainIndex + 1]].x\n return x1 < x2 ? x1 : x2\n }\n computeIntersectsForChain() {\n if (arguments.length === 4) {\n const chainIndex0 = arguments[0], mce = arguments[1], chainIndex1 = arguments[2], si = arguments[3]\n this.computeIntersectsForChain(this.startIndex[chainIndex0], this.startIndex[chainIndex0 + 1], mce, mce.startIndex[chainIndex1], mce.startIndex[chainIndex1 + 1], si)\n } else if (arguments.length === 6) {\n const start0 = arguments[0], end0 = arguments[1], mce = arguments[2], start1 = arguments[3], end1 = arguments[4], ei = arguments[5]\n if (end0 - start0 === 1 && end1 - start1 === 1) {\n ei.addIntersections(this.e, start0, mce.e, start1)\n return null\n }\n if (!this.overlaps(start0, end0, mce, start1, end1)) return null\n const mid0 = Math.trunc((start0 + end0) / 2)\n const mid1 = Math.trunc((start1 + end1) / 2)\n if (start0 < mid0) {\n if (start1 < mid1) this.computeIntersectsForChain(start0, mid0, mce, start1, mid1, ei)\n if (mid1 < end1) this.computeIntersectsForChain(start0, mid0, mce, mid1, end1, ei)\n }\n if (mid0 < end0) {\n if (start1 < mid1) this.computeIntersectsForChain(mid0, end0, mce, start1, mid1, ei)\n if (mid1 < end1) this.computeIntersectsForChain(mid0, end0, mce, mid1, end1, ei)\n }\n }\n }\n overlaps(start0, end0, mce, start1, end1) {\n return Envelope.intersects(this.pts[start0], this.pts[end0], mce.pts[start1], mce.pts[end1])\n }\n getStartIndexes() {\n return this.startIndex\n }\n computeIntersects(mce, si) {\n for (let i = 0; i < this.startIndex.length - 1; i++) \n for (let j = 0; j < mce.startIndex.length - 1; j++) \n this.computeIntersectsForChain(i, mce, j, si)\n \n \n }\n}\n","import Location from '../geom/Location.js'\nimport Position from './Position.js'\nexport default class Depth {\n constructor() {\n Depth.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._depth = Array(2).fill().map(() => Array(3))\n for (let i = 0; i < 2; i++) \n for (let j = 0; j < 3; j++) \n this._depth[i][j] = Depth.NULL_VALUE\n \n \n }\n static depthAtLocation(location) {\n if (location === Location.EXTERIOR) return 0\n if (location === Location.INTERIOR) return 1\n return Depth.NULL_VALUE\n }\n getDepth(geomIndex, posIndex) {\n return this._depth[geomIndex][posIndex]\n }\n setDepth(geomIndex, posIndex, depthValue) {\n this._depth[geomIndex][posIndex] = depthValue\n }\n isNull() {\n if (arguments.length === 0) {\n for (let i = 0; i < 2; i++) \n for (let j = 0; j < 3; j++) \n if (this._depth[i][j] !== Depth.NULL_VALUE) return false\n \n \n return true\n } else if (arguments.length === 1) {\n const geomIndex = arguments[0]\n return this._depth[geomIndex][1] === Depth.NULL_VALUE\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], posIndex = arguments[1]\n return this._depth[geomIndex][posIndex] === Depth.NULL_VALUE\n }\n }\n normalize() {\n for (let i = 0; i < 2; i++) \n if (!this.isNull(i)) {\n let minDepth = this._depth[i][1]\n if (this._depth[i][2] < minDepth) minDepth = this._depth[i][2]\n if (minDepth < 0) minDepth = 0\n for (let j = 1; j < 3; j++) {\n let newValue = 0\n if (this._depth[i][j] > minDepth) newValue = 1\n this._depth[i][j] = newValue\n }\n }\n \n }\n getDelta(geomIndex) {\n return this._depth[geomIndex][Position.RIGHT] - this._depth[geomIndex][Position.LEFT]\n }\n getLocation(geomIndex, posIndex) {\n if (this._depth[geomIndex][posIndex] <= 0) return Location.EXTERIOR\n return Location.INTERIOR\n }\n toString() {\n return 'A: ' + this._depth[0][1] + ',' + this._depth[0][2] + ' B: ' + this._depth[1][1] + ',' + this._depth[1][2]\n }\n add() {\n if (arguments.length === 1) {\n const lbl = arguments[0]\n for (let i = 0; i < 2; i++) \n for (let j = 1; j < 3; j++) {\n const loc = lbl.getLocation(i, j)\n if (loc === Location.EXTERIOR || loc === Location.INTERIOR) \n if (this.isNull(i, j)) \n this._depth[i][j] = Depth.depthAtLocation(loc)\n else this._depth[i][j] += Depth.depthAtLocation(loc)\n \n }\n \n } else if (arguments.length === 3) {\n const geomIndex = arguments[0], posIndex = arguments[1], location = arguments[2]\n if (location === Location.INTERIOR) this._depth[geomIndex][posIndex]++\n }\n }\n}\nDepth.NULL_VALUE = -1\n","import EdgeIntersectionList from './EdgeIntersectionList.js'\nimport IntersectionMatrix from '../geom/IntersectionMatrix.js'\nimport MonotoneChainEdge from './index/MonotoneChainEdge.js'\nimport Position from './Position.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Label from './Label.js'\nimport Envelope from '../geom/Envelope.js'\nimport StringBuilder from '../../../../java/lang/StringBuilder.js'\nimport Depth from './Depth.js'\nimport GraphComponent from './GraphComponent.js'\nexport default class Edge extends GraphComponent {\n constructor() {\n super()\n Edge.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.pts = null\n this._env = null\n this.eiList = new EdgeIntersectionList(this)\n this._name = null\n this._mce = null\n this._isIsolated = true\n this._depth = new Depth()\n this._depthDelta = 0\n if (arguments.length === 1) {\n const pts = arguments[0]\n Edge.constructor_.call(this, pts, null)\n } else if (arguments.length === 2) {\n const pts = arguments[0], label = arguments[1]\n this.pts = pts\n this._label = label\n }\n }\n static updateIM() {\n if (arguments.length === 2 && (arguments[1] instanceof IntersectionMatrix && arguments[0] instanceof Label)) {\n const label = arguments[0], im = arguments[1]\n im.setAtLeastIfValid(label.getLocation(0, Position.ON), label.getLocation(1, Position.ON), 1)\n if (label.isArea()) {\n im.setAtLeastIfValid(label.getLocation(0, Position.LEFT), label.getLocation(1, Position.LEFT), 2)\n im.setAtLeastIfValid(label.getLocation(0, Position.RIGHT), label.getLocation(1, Position.RIGHT), 2)\n }\n } else {\n return super.updateIM.apply(this, arguments)\n }\n }\n getDepth() {\n return this._depth\n }\n getCollapsedEdge() {\n const newPts = new Array(2).fill(null)\n newPts[0] = this.pts[0]\n newPts[1] = this.pts[1]\n const newe = new Edge(newPts, Label.toLineLabel(this._label))\n return newe\n }\n isIsolated() {\n return this._isIsolated\n }\n getCoordinates() {\n return this.pts\n }\n setIsolated(isIsolated) {\n this._isIsolated = isIsolated\n }\n setName(name) {\n this._name = name\n }\n equals(o) {\n if (!(o instanceof Edge)) return false\n const e = o\n if (this.pts.length !== e.pts.length) return false\n let isEqualForward = true\n let isEqualReverse = true\n let iRev = this.pts.length\n for (let i = 0; i < this.pts.length; i++) {\n if (!this.pts[i].equals2D(e.pts[i])) \n isEqualForward = false\n \n if (!this.pts[i].equals2D(e.pts[-- iRev])) \n isEqualReverse = false\n \n if (!isEqualForward && !isEqualReverse) return false\n }\n return true\n }\n getCoordinate() {\n if (arguments.length === 0) {\n if (this.pts.length > 0) return this.pts[0]\n return null\n } else if (arguments.length === 1) {\n const i = arguments[0]\n return this.pts[i]\n }\n }\n print(out) {\n out.print('edge ' + this._name + ': ')\n out.print('LINESTRING (')\n for (let i = 0; i < this.pts.length; i++) {\n if (i > 0) out.print(',')\n out.print(this.pts[i].x + ' ' + this.pts[i].y)\n }\n out.print(') ' + this._label + ' ' + this._depthDelta)\n }\n computeIM(im) {\n Edge.updateIM(this._label, im)\n }\n isCollapsed() {\n if (!this._label.isArea()) return false\n if (this.pts.length !== 3) return false\n if (this.pts[0].equals(this.pts[2])) return true\n return false\n }\n isClosed() {\n return this.pts[0].equals(this.pts[this.pts.length - 1])\n }\n getMaximumSegmentIndex() {\n return this.pts.length - 1\n }\n getDepthDelta() {\n return this._depthDelta\n }\n getNumPoints() {\n return this.pts.length\n }\n printReverse(out) {\n out.print('edge ' + this._name + ': ')\n for (let i = this.pts.length - 1; i >= 0; i--) \n out.print(this.pts[i] + ' ')\n \n out.println('')\n }\n getMonotoneChainEdge() {\n if (this._mce === null) this._mce = new MonotoneChainEdge(this)\n return this._mce\n }\n getEnvelope() {\n if (this._env === null) {\n this._env = new Envelope()\n for (let i = 0; i < this.pts.length; i++) \n this._env.expandToInclude(this.pts[i])\n \n }\n return this._env\n }\n addIntersection(li, segmentIndex, geomIndex, intIndex) {\n const intPt = new Coordinate(li.getIntersection(intIndex))\n let normalizedSegmentIndex = segmentIndex\n let dist = li.getEdgeDistance(geomIndex, intIndex)\n const nextSegIndex = normalizedSegmentIndex + 1\n if (nextSegIndex < this.pts.length) {\n const nextPt = this.pts[nextSegIndex]\n if (intPt.equals2D(nextPt)) {\n normalizedSegmentIndex = nextSegIndex\n dist = 0.0\n }\n }\n const ei = this.eiList.add(intPt, normalizedSegmentIndex, dist)\n }\n toString() {\n const builder = new StringBuilder()\n builder.append('edge ' + this._name + ': ')\n builder.append('LINESTRING (')\n for (let i = 0; i < this.pts.length; i++) {\n if (i > 0) builder.append(',')\n builder.append(this.pts[i].x + ' ' + this.pts[i].y)\n }\n builder.append(') ' + this._label + ' ' + this._depthDelta)\n return builder.toString()\n }\n isPointwiseEqual(e) {\n if (this.pts.length !== e.pts.length) return false\n for (let i = 0; i < this.pts.length; i++) \n if (!this.pts[i].equals2D(e.pts[i])) \n return false\n \n \n return true\n }\n setDepthDelta(depthDelta) {\n this._depthDelta = depthDelta\n }\n getEdgeIntersectionList() {\n return this.eiList\n }\n addIntersections(li, segmentIndex, geomIndex) {\n for (let i = 0; i < li.getIntersectionNum(); i++) \n this.addIntersection(li, segmentIndex, geomIndex, i)\n \n }\n}\n","import Location from '../../geom/Location.js'\nimport BufferSubgraph from './BufferSubgraph.js'\nimport PolygonBuilder from '../overlay/PolygonBuilder.js'\nimport GeometryFactory from '../../geom/GeometryFactory.js'\nimport Position from '../../geomgraph/Position.js'\nimport MCIndexNoder from '../../noding/MCIndexNoder.js'\nimport OffsetCurveBuilder from './OffsetCurveBuilder.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport SubgraphDepthLocater from './SubgraphDepthLocater.js'\nimport OffsetCurveSetBuilder from './OffsetCurveSetBuilder.js'\nimport Label from '../../geomgraph/Label.js'\nimport OverlayNodeFactory from '../overlay/OverlayNodeFactory.js'\nimport EdgeList from '../../geomgraph/EdgeList.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nimport IntersectionAdder from '../../noding/IntersectionAdder.js'\nimport Edge from '../../geomgraph/Edge.js'\nimport PlanarGraph from '../../geomgraph/PlanarGraph.js'\nexport default class BufferBuilder {\n constructor() {\n BufferBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._bufParams = null\n this._workingPrecisionModel = null\n this._workingNoder = null\n this._geomFact = null\n this._graph = null\n this._edgeList = new EdgeList()\n const bufParams = arguments[0]\n this._bufParams = bufParams\n }\n static depthDelta(label) {\n const lLoc = label.getLocation(0, Position.LEFT)\n const rLoc = label.getLocation(0, Position.RIGHT)\n if (lLoc === Location.INTERIOR && rLoc === Location.EXTERIOR) return 1; else if (lLoc === Location.EXTERIOR && rLoc === Location.INTERIOR) return -1\n return 0\n }\n static convertSegStrings(it) {\n const fact = new GeometryFactory()\n const lines = new ArrayList()\n while (it.hasNext()) {\n const ss = it.next()\n const line = fact.createLineString(ss.getCoordinates())\n lines.add(line)\n }\n return fact.buildGeometry(lines)\n }\n setWorkingPrecisionModel(pm) {\n this._workingPrecisionModel = pm\n }\n insertUniqueEdge(e) {\n const existingEdge = this._edgeList.findEqualEdge(e)\n if (existingEdge !== null) {\n const existingLabel = existingEdge.getLabel()\n let labelToMerge = e.getLabel()\n if (!existingEdge.isPointwiseEqual(e)) {\n labelToMerge = new Label(e.getLabel())\n labelToMerge.flip()\n }\n existingLabel.merge(labelToMerge)\n const mergeDelta = BufferBuilder.depthDelta(labelToMerge)\n const existingDelta = existingEdge.getDepthDelta()\n const newDelta = existingDelta + mergeDelta\n existingEdge.setDepthDelta(newDelta)\n } else {\n this._edgeList.add(e)\n e.setDepthDelta(BufferBuilder.depthDelta(e.getLabel()))\n }\n }\n buildSubgraphs(subgraphList, polyBuilder) {\n const processedGraphs = new ArrayList()\n for (let i = subgraphList.iterator(); i.hasNext(); ) {\n const subgraph = i.next()\n const p = subgraph.getRightmostCoordinate()\n const locater = new SubgraphDepthLocater(processedGraphs)\n const outsideDepth = locater.getDepth(p)\n subgraph.computeDepth(outsideDepth)\n subgraph.findResultEdges()\n processedGraphs.add(subgraph)\n polyBuilder.add(subgraph.getDirectedEdges(), subgraph.getNodes())\n }\n }\n createSubgraphs(graph) {\n const subgraphList = new ArrayList()\n for (let i = graph.getNodes().iterator(); i.hasNext(); ) {\n const node = i.next()\n if (!node.isVisited()) {\n const subgraph = new BufferSubgraph()\n subgraph.create(node)\n subgraphList.add(subgraph)\n }\n }\n Collections.sort(subgraphList, Collections.reverseOrder())\n return subgraphList\n }\n createEmptyResultGeometry() {\n const emptyGeom = this._geomFact.createPolygon()\n return emptyGeom\n }\n getNoder(precisionModel) {\n if (this._workingNoder !== null) return this._workingNoder\n const noder = new MCIndexNoder()\n const li = new RobustLineIntersector()\n li.setPrecisionModel(precisionModel)\n noder.setSegmentIntersector(new IntersectionAdder(li))\n return noder\n }\n buffer(g, distance) {\n let precisionModel = this._workingPrecisionModel\n if (precisionModel === null) precisionModel = g.getPrecisionModel()\n this._geomFact = g.getFactory()\n const curveBuilder = new OffsetCurveBuilder(precisionModel, this._bufParams)\n const curveSetBuilder = new OffsetCurveSetBuilder(g, distance, curveBuilder)\n const bufferSegStrList = curveSetBuilder.getCurves()\n if (bufferSegStrList.size() <= 0) \n return this.createEmptyResultGeometry()\n \n this.computeNodedEdges(bufferSegStrList, precisionModel)\n this._graph = new PlanarGraph(new OverlayNodeFactory())\n this._graph.addEdges(this._edgeList.getEdges())\n const subgraphList = this.createSubgraphs(this._graph)\n const polyBuilder = new PolygonBuilder(this._geomFact)\n this.buildSubgraphs(subgraphList, polyBuilder)\n const resultPolyList = polyBuilder.getPolygons()\n if (resultPolyList.size() <= 0) \n return this.createEmptyResultGeometry()\n \n const resultGeom = this._geomFact.buildGeometry(resultPolyList)\n return resultGeom\n }\n computeNodedEdges(bufferSegStrList, precisionModel) {\n const noder = this.getNoder(precisionModel)\n noder.computeNodes(bufferSegStrList)\n const nodedSegStrings = noder.getNodedSubstrings()\n for (let i = nodedSegStrings.iterator(); i.hasNext(); ) {\n const segStr = i.next()\n const pts = segStr.getCoordinates()\n if (pts.length === 2 && pts[0].equals2D(pts[1])) continue\n const oldLabel = segStr.getData()\n const edge = new Edge(segStr.getCoordinates(), new Label(oldLabel))\n this.insertUniqueEdge(edge)\n }\n }\n setNoder(noder) {\n this._workingNoder = noder\n }\n}\n","import hasInterface from '../../../../hasInterface.js'\nimport Collection from '../../../../java/util/Collection.js'\nimport Noder from './Noder.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport NodedSegmentString from './NodedSegmentString.js'\nimport System from '../../../../java/lang/System.js'\nimport CoordinateArrays from '../geom/CoordinateArrays.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class ScaledNoder {\n constructor() {\n ScaledNoder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._noder = null\n this._scaleFactor = null\n this._offsetX = null\n this._offsetY = null\n this._isScaled = false\n if (arguments.length === 2) {\n const noder = arguments[0], scaleFactor = arguments[1]\n ScaledNoder.constructor_.call(this, noder, scaleFactor, 0, 0)\n } else if (arguments.length === 4) {\n const noder = arguments[0], scaleFactor = arguments[1], offsetX = arguments[2], offsetY = arguments[3]\n this._noder = noder\n this._scaleFactor = scaleFactor\n this._isScaled = !this.isIntegerPrecision()\n }\n }\n rescale() {\n if (hasInterface(arguments[0], Collection)) {\n const segStrings = arguments[0]\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n this.rescale(ss.getCoordinates())\n }\n } else if (arguments[0] instanceof Array) {\n const pts = arguments[0]\n for (let i = 0; i < pts.length; i++) {\n pts[i].x = pts[i].x / this._scaleFactor + this._offsetX\n pts[i].y = pts[i].y / this._scaleFactor + this._offsetY\n }\n if (pts.length === 2 && pts[0].equals2D(pts[1])) \n System.out.println(pts)\n \n }\n }\n scale() {\n if (hasInterface(arguments[0], Collection)) {\n const segStrings = arguments[0]\n const nodedSegmentStrings = new ArrayList(segStrings.size())\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n nodedSegmentStrings.add(new NodedSegmentString(this.scale(ss.getCoordinates()), ss.getData()))\n }\n return nodedSegmentStrings\n } else if (arguments[0] instanceof Array) {\n const pts = arguments[0]\n const roundPts = new Array(pts.length).fill(null)\n for (let i = 0; i < pts.length; i++) \n roundPts[i] = new Coordinate(Math.round((pts[i].x - this._offsetX) * this._scaleFactor), Math.round((pts[i].y - this._offsetY) * this._scaleFactor), pts[i].getZ())\n \n const roundPtsNoDup = CoordinateArrays.removeRepeatedPoints(roundPts)\n return roundPtsNoDup\n }\n }\n isIntegerPrecision() {\n return this._scaleFactor === 1.0\n }\n getNodedSubstrings() {\n const splitSS = this._noder.getNodedSubstrings()\n if (this._isScaled) this.rescale(splitSS)\n return splitSS\n }\n computeNodes(inputSegStrings) {\n let intSegStrings = inputSegStrings\n if (this._isScaled) intSegStrings = this.scale(inputSegStrings)\n this._noder.computeNodes(intSegStrings)\n }\n get interfaces_() {\n return [Noder]\n }\n}\n","import GeometryFactory from '../geom/GeometryFactory.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nimport RuntimeException from '../../../../java/lang/RuntimeException.js'\nexport default class NodingValidator {\n constructor() {\n NodingValidator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._segStrings = null\n const segStrings = arguments[0]\n this._segStrings = segStrings\n }\n checkEndPtVertexIntersections() {\n if (arguments.length === 0) {\n for (let i = this._segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n const pts = ss.getCoordinates()\n this.checkEndPtVertexIntersections(pts[0], this._segStrings)\n this.checkEndPtVertexIntersections(pts[pts.length - 1], this._segStrings)\n }\n } else if (arguments.length === 2) {\n const testPt = arguments[0], segStrings = arguments[1]\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n const pts = ss.getCoordinates()\n for (let j = 1; j < pts.length - 1; j++) \n if (pts[j].equals(testPt)) throw new RuntimeException('found endpt/interior pt intersection at index ' + j + ' :pt ' + testPt)\n \n }\n }\n }\n checkInteriorIntersections() {\n if (arguments.length === 0) {\n for (let i = this._segStrings.iterator(); i.hasNext(); ) {\n const ss0 = i.next()\n for (let j = this._segStrings.iterator(); j.hasNext(); ) {\n const ss1 = j.next()\n this.checkInteriorIntersections(ss0, ss1)\n }\n }\n } else if (arguments.length === 2) {\n const ss0 = arguments[0], ss1 = arguments[1]\n const pts0 = ss0.getCoordinates()\n const pts1 = ss1.getCoordinates()\n for (let i0 = 0; i0 < pts0.length - 1; i0++) \n for (let i1 = 0; i1 < pts1.length - 1; i1++) \n this.checkInteriorIntersections(ss0, i0, ss1, i1)\n \n \n } else if (arguments.length === 4) {\n const e0 = arguments[0], segIndex0 = arguments[1], e1 = arguments[2], segIndex1 = arguments[3]\n if (e0 === e1 && segIndex0 === segIndex1) return null\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) \n if (this._li.isProper() || this.hasInteriorIntersection(this._li, p00, p01) || this.hasInteriorIntersection(this._li, p10, p11)) \n throw new RuntimeException('found non-noded intersection at ' + p00 + '-' + p01 + ' and ' + p10 + '-' + p11)\n \n \n }\n }\n checkValid() {\n this.checkEndPtVertexIntersections()\n this.checkInteriorIntersections()\n this.checkCollapses()\n }\n checkCollapses() {\n if (arguments.length === 0) {\n for (let i = this._segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n this.checkCollapses(ss)\n }\n } else if (arguments.length === 1) {\n const ss = arguments[0]\n const pts = ss.getCoordinates()\n for (let i = 0; i < pts.length - 2; i++) \n this.checkCollapse(pts[i], pts[i + 1], pts[i + 2])\n \n }\n }\n hasInteriorIntersection(li, p0, p1) {\n for (let i = 0; i < li.getIntersectionNum(); i++) {\n const intPt = li.getIntersection(i)\n if (!(intPt.equals(p0) || intPt.equals(p1))) return true\n }\n return false\n }\n checkCollapse(p0, p1, p2) {\n if (p0.equals(p2)) throw new RuntimeException('found non-noded collapse at ' + NodingValidator.fact.createLineString([p0, p1, p2]))\n }\n}\nNodingValidator.fact = new GeometryFactory()\n","import Coordinate from '../../geom/Coordinate.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport Envelope from '../../geom/Envelope.js'\nimport Assert from '../../util/Assert.js'\nexport default class HotPixel {\n constructor() {\n HotPixel.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = null\n this._pt = null\n this._originalPt = null\n this._ptScaled = null\n this._p0Scaled = null\n this._p1Scaled = null\n this._scaleFactor = null\n this._minx = null\n this._maxx = null\n this._miny = null\n this._maxy = null\n this._corner = new Array(4).fill(null)\n this._safeEnv = null\n const pt = arguments[0], scaleFactor = arguments[1], li = arguments[2]\n this._originalPt = pt\n this._pt = pt\n this._scaleFactor = scaleFactor\n this._li = li\n if (scaleFactor <= 0) throw new IllegalArgumentException('Scale factor must be non-zero')\n if (scaleFactor !== 1.0) {\n this._pt = new Coordinate(this.scale(pt.x), this.scale(pt.y))\n this._p0Scaled = new Coordinate()\n this._p1Scaled = new Coordinate()\n }\n this.initCorners(this._pt)\n }\n intersectsScaled(p0, p1) {\n const segMinx = Math.min(p0.x, p1.x)\n const segMaxx = Math.max(p0.x, p1.x)\n const segMiny = Math.min(p0.y, p1.y)\n const segMaxy = Math.max(p0.y, p1.y)\n const isOutsidePixelEnv = this._maxx < segMinx || this._minx > segMaxx || this._maxy < segMiny || this._miny > segMaxy\n if (isOutsidePixelEnv) return false\n const intersects = this.intersectsToleranceSquare(p0, p1)\n Assert.isTrue(!(isOutsidePixelEnv && intersects), 'Found bad envelope test')\n return intersects\n }\n initCorners(pt) {\n const tolerance = 0.5\n this._minx = pt.x - tolerance\n this._maxx = pt.x + tolerance\n this._miny = pt.y - tolerance\n this._maxy = pt.y + tolerance\n this._corner[0] = new Coordinate(this._maxx, this._maxy)\n this._corner[1] = new Coordinate(this._minx, this._maxy)\n this._corner[2] = new Coordinate(this._minx, this._miny)\n this._corner[3] = new Coordinate(this._maxx, this._miny)\n }\n intersects(p0, p1) {\n if (this._scaleFactor === 1.0) return this.intersectsScaled(p0, p1)\n this.copyScaled(p0, this._p0Scaled)\n this.copyScaled(p1, this._p1Scaled)\n return this.intersectsScaled(this._p0Scaled, this._p1Scaled)\n }\n scale(val) {\n return Math.round(val * this._scaleFactor)\n }\n getCoordinate() {\n return this._originalPt\n }\n copyScaled(p, pScaled) {\n pScaled.x = this.scale(p.x)\n pScaled.y = this.scale(p.y)\n }\n getSafeEnvelope() {\n if (this._safeEnv === null) {\n const safeTolerance = HotPixel.SAFE_ENV_EXPANSION_FACTOR / this._scaleFactor\n this._safeEnv = new Envelope(this._originalPt.x - safeTolerance, this._originalPt.x + safeTolerance, this._originalPt.y - safeTolerance, this._originalPt.y + safeTolerance)\n }\n return this._safeEnv\n }\n intersectsPixelClosure(p0, p1) {\n this._li.computeIntersection(p0, p1, this._corner[0], this._corner[1])\n if (this._li.hasIntersection()) return true\n this._li.computeIntersection(p0, p1, this._corner[1], this._corner[2])\n if (this._li.hasIntersection()) return true\n this._li.computeIntersection(p0, p1, this._corner[2], this._corner[3])\n if (this._li.hasIntersection()) return true\n this._li.computeIntersection(p0, p1, this._corner[3], this._corner[0])\n if (this._li.hasIntersection()) return true\n return false\n }\n intersectsToleranceSquare(p0, p1) {\n let intersectsLeft = false\n let intersectsBottom = false\n this._li.computeIntersection(p0, p1, this._corner[0], this._corner[1])\n if (this._li.isProper()) return true\n this._li.computeIntersection(p0, p1, this._corner[1], this._corner[2])\n if (this._li.isProper()) return true\n if (this._li.hasIntersection()) intersectsLeft = true\n this._li.computeIntersection(p0, p1, this._corner[2], this._corner[3])\n if (this._li.isProper()) return true\n if (this._li.hasIntersection()) intersectsBottom = true\n this._li.computeIntersection(p0, p1, this._corner[3], this._corner[0])\n if (this._li.isProper()) return true\n if (intersectsLeft && intersectsBottom) return true\n if (p0.equals(this._pt)) return true\n if (p1.equals(this._pt)) return true\n return false\n }\n addSnappedNode(segStr, segIndex) {\n const p0 = segStr.getCoordinate(segIndex)\n const p1 = segStr.getCoordinate(segIndex + 1)\n if (this.intersects(p0, p1)) {\n segStr.addIntersection(this.getCoordinate(), segIndex)\n return true\n }\n return false\n }\n}\nHotPixel.SAFE_ENV_EXPANSION_FACTOR = 0.75\n","import LineSegment from '../../geom/LineSegment.js'\nexport default class MonotoneChainSelectAction {\n constructor() {\n MonotoneChainSelectAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.selectedSegment = new LineSegment()\n }\n select() {\n if (arguments.length === 1) {\n const seg = arguments[0]\n } else if (arguments.length === 2) {\n const mc = arguments[0], startIndex = arguments[1]\n mc.getLineSegment(startIndex, this.selectedSegment)\n this.select(this.selectedSegment)\n }\n }\n}\n","import MonotoneChainSelectAction from '../../index/chain/MonotoneChainSelectAction.js'\nimport MonotoneChain from '../../index/chain/MonotoneChain.js'\nimport ItemVisitor from '../../index/ItemVisitor.js'\nexport default class MCIndexPointSnapper {\n constructor() {\n MCIndexPointSnapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._index = null\n const index = arguments[0]\n this._index = index\n }\n snap() {\n if (arguments.length === 1) {\n const hotPixel = arguments[0]\n return this.snap(hotPixel, null, -1)\n } else if (arguments.length === 3) {\n const hotPixel = arguments[0], parentEdge = arguments[1], hotPixelVertexIndex = arguments[2]\n const pixelEnv = hotPixel.getSafeEnvelope()\n const hotPixelSnapAction = new HotPixelSnapAction(hotPixel, parentEdge, hotPixelVertexIndex)\n this._index.query(pixelEnv, new (class {\n get interfaces_() {\n return [ItemVisitor]\n }\n visitItem(item) {\n const testChain = item\n testChain.select(pixelEnv, hotPixelSnapAction)\n }\n })())\n return hotPixelSnapAction.isNodeAdded()\n }\n }\n}\nclass HotPixelSnapAction extends MonotoneChainSelectAction {\n constructor() {\n super()\n HotPixelSnapAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hotPixel = null\n this._parentEdge = null\n this._hotPixelVertexIndex = null\n this._isNodeAdded = false\n const hotPixel = arguments[0], parentEdge = arguments[1], hotPixelVertexIndex = arguments[2]\n this._hotPixel = hotPixel\n this._parentEdge = parentEdge\n this._hotPixelVertexIndex = hotPixelVertexIndex\n }\n isNodeAdded() {\n return this._isNodeAdded\n }\n select() {\n if (arguments.length === 2 && (Number.isInteger(arguments[1]) && arguments[0] instanceof MonotoneChain)) {\n const mc = arguments[0], startIndex = arguments[1]\n const ss = mc.getContext()\n if (this._parentEdge === ss) \n if (startIndex === this._hotPixelVertexIndex || startIndex + 1 === this._hotPixelVertexIndex) return null\n \n this._isNodeAdded |= this._hotPixel.addSnappedNode(ss, startIndex)\n } else {\n return super.select.apply(this, arguments)\n }\n }\n}\nMCIndexPointSnapper.HotPixelSnapAction = HotPixelSnapAction\n","import SegmentIntersector from './SegmentIntersector.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class InteriorIntersectionFinderAdder {\n constructor() {\n InteriorIntersectionFinderAdder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = null\n this._interiorIntersections = null\n const li = arguments[0]\n this._li = li\n this._interiorIntersections = new ArrayList()\n }\n processIntersections(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1 && segIndex0 === segIndex1) return null\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) \n if (this._li.isInteriorIntersection()) {\n for (let intIndex = 0; intIndex < this._li.getIntersectionNum(); intIndex++) \n this._interiorIntersections.add(this._li.getIntersection(intIndex))\n \n e0.addIntersections(this._li, segIndex0, 0)\n e1.addIntersections(this._li, segIndex1, 1)\n }\n \n }\n isDone() {\n return false\n }\n getInteriorIntersections() {\n return this._interiorIntersections\n }\n get interfaces_() {\n return [SegmentIntersector]\n }\n}\n","import NodingValidator from '../NodingValidator.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport Collection from '../../../../../java/util/Collection.js'\nimport Noder from '../Noder.js'\nimport MCIndexNoder from '../MCIndexNoder.js'\nimport NodedSegmentString from '../NodedSegmentString.js'\nimport HotPixel from './HotPixel.js'\nimport Exception from '../../../../../java/lang/Exception.js'\nimport MCIndexPointSnapper from './MCIndexPointSnapper.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nimport InteriorIntersectionFinderAdder from '../InteriorIntersectionFinderAdder.js'\nexport default class MCIndexSnapRounder {\n constructor() {\n MCIndexSnapRounder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pm = null\n this._li = null\n this._scaleFactor = null\n this._noder = null\n this._pointSnapper = null\n this._nodedSegStrings = null\n const pm = arguments[0]\n this._pm = pm\n this._li = new RobustLineIntersector()\n this._li.setPrecisionModel(pm)\n this._scaleFactor = pm.getScale()\n }\n checkCorrectness(inputSegmentStrings) {\n const resultSegStrings = NodedSegmentString.getNodedSubstrings(inputSegmentStrings)\n const nv = new NodingValidator(resultSegStrings)\n try {\n nv.checkValid()\n } catch (ex) {\n if (ex instanceof Exception) \n ex.printStackTrace()\n else throw ex\n } finally {}\n }\n getNodedSubstrings() {\n return NodedSegmentString.getNodedSubstrings(this._nodedSegStrings)\n }\n snapRound(segStrings, li) {\n const intersections = this.findInteriorIntersections(segStrings, li)\n this.computeIntersectionSnaps(intersections)\n this.computeVertexSnaps(segStrings)\n }\n findInteriorIntersections(segStrings, li) {\n const intFinderAdder = new InteriorIntersectionFinderAdder(li)\n this._noder.setSegmentIntersector(intFinderAdder)\n this._noder.computeNodes(segStrings)\n return intFinderAdder.getInteriorIntersections()\n }\n computeVertexSnaps() {\n if (hasInterface(arguments[0], Collection)) {\n const edges = arguments[0]\n for (let i0 = edges.iterator(); i0.hasNext(); ) {\n const edge0 = i0.next()\n this.computeVertexSnaps(edge0)\n }\n } else if (arguments[0] instanceof NodedSegmentString) {\n const e = arguments[0]\n const pts0 = e.getCoordinates()\n for (let i = 0; i < pts0.length; i++) {\n const hotPixel = new HotPixel(pts0[i], this._scaleFactor, this._li)\n const isNodeAdded = this._pointSnapper.snap(hotPixel, e, i)\n if (isNodeAdded) \n e.addIntersection(pts0[i], i)\n \n }\n }\n }\n computeNodes(inputSegmentStrings) {\n this._nodedSegStrings = inputSegmentStrings\n this._noder = new MCIndexNoder()\n this._pointSnapper = new MCIndexPointSnapper(this._noder.getIndex())\n this.snapRound(inputSegmentStrings, this._li)\n }\n computeIntersectionSnaps(snapPts) {\n for (let it = snapPts.iterator(); it.hasNext(); ) {\n const snapPt = it.next()\n const hotPixel = new HotPixel(snapPt, this._scaleFactor, this._li)\n this._pointSnapper.snap(hotPixel)\n }\n }\n get interfaces_() {\n return [Noder]\n }\n}\n","import BufferParameters from './BufferParameters.js'\nimport Geometry from '../../geom/Geometry.js'\nimport BufferBuilder from './BufferBuilder.js'\nimport ScaledNoder from '../../noding/ScaledNoder.js'\nimport TopologyException from '../../geom/TopologyException.js'\nimport MathUtil from '../../math/MathUtil.js'\nimport PrecisionModel from '../../geom/PrecisionModel.js'\nimport RuntimeException from '../../../../../java/lang/RuntimeException.js'\nimport MCIndexSnapRounder from '../../noding/snapround/MCIndexSnapRounder.js'\nexport default class BufferOp {\n constructor() {\n BufferOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._argGeom = null\n this._distance = null\n this._bufParams = new BufferParameters()\n this._resultGeometry = null\n this._saveException = null\n if (arguments.length === 1) {\n const g = arguments[0]\n this._argGeom = g\n } else if (arguments.length === 2) {\n const g = arguments[0], bufParams = arguments[1]\n this._argGeom = g\n this._bufParams = bufParams\n }\n }\n static bufferOp() {\n if (arguments.length === 2) {\n const g = arguments[0], distance = arguments[1]\n const gBuf = new BufferOp(g)\n const geomBuf = gBuf.getResultGeometry(distance)\n return geomBuf\n } else if (arguments.length === 3) {\n if (Number.isInteger(arguments[2]) && (arguments[0] instanceof Geometry && typeof arguments[1] === 'number')) {\n const g = arguments[0], distance = arguments[1], quadrantSegments = arguments[2]\n const bufOp = new BufferOp(g)\n bufOp.setQuadrantSegments(quadrantSegments)\n const geomBuf = bufOp.getResultGeometry(distance)\n return geomBuf\n } else if (arguments[2] instanceof BufferParameters && (arguments[0] instanceof Geometry && typeof arguments[1] === 'number')) {\n const g = arguments[0], distance = arguments[1], params = arguments[2]\n const bufOp = new BufferOp(g, params)\n const geomBuf = bufOp.getResultGeometry(distance)\n return geomBuf\n }\n } else if (arguments.length === 4) {\n const g = arguments[0], distance = arguments[1], quadrantSegments = arguments[2], endCapStyle = arguments[3]\n const bufOp = new BufferOp(g)\n bufOp.setQuadrantSegments(quadrantSegments)\n bufOp.setEndCapStyle(endCapStyle)\n const geomBuf = bufOp.getResultGeometry(distance)\n return geomBuf\n }\n }\n static precisionScaleFactor(g, distance, maxPrecisionDigits) {\n const env = g.getEnvelopeInternal()\n const envMax = MathUtil.max(Math.abs(env.getMaxX()), Math.abs(env.getMaxY()), Math.abs(env.getMinX()), Math.abs(env.getMinY()))\n const expandByDistance = distance > 0.0 ? distance : 0.0\n const bufEnvMax = envMax + 2 * expandByDistance\n const bufEnvPrecisionDigits = Math.trunc(Math.log(bufEnvMax) / Math.log(10) + 1.0)\n const minUnitLog10 = maxPrecisionDigits - bufEnvPrecisionDigits\n const scaleFactor = Math.pow(10.0, minUnitLog10)\n return scaleFactor\n }\n bufferFixedPrecision(fixedPM) {\n const noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)), fixedPM.getScale())\n const bufBuilder = new BufferBuilder(this._bufParams)\n bufBuilder.setWorkingPrecisionModel(fixedPM)\n bufBuilder.setNoder(noder)\n this._resultGeometry = bufBuilder.buffer(this._argGeom, this._distance)\n }\n bufferReducedPrecision() {\n if (arguments.length === 0) {\n for (let precDigits = BufferOp.MAX_PRECISION_DIGITS; precDigits >= 0; precDigits--) {\n try {\n this.bufferReducedPrecision(precDigits)\n } catch (ex) {\n if (ex instanceof TopologyException) \n this._saveException = ex\n else throw ex\n } finally {}\n if (this._resultGeometry !== null) return null\n }\n throw this._saveException\n } else if (arguments.length === 1) {\n const precisionDigits = arguments[0]\n const sizeBasedScaleFactor = BufferOp.precisionScaleFactor(this._argGeom, this._distance, precisionDigits)\n const fixedPM = new PrecisionModel(sizeBasedScaleFactor)\n this.bufferFixedPrecision(fixedPM)\n }\n }\n computeGeometry() {\n this.bufferOriginalPrecision()\n if (this._resultGeometry !== null) return null\n const argPM = this._argGeom.getFactory().getPrecisionModel()\n if (argPM.getType() === PrecisionModel.FIXED) this.bufferFixedPrecision(argPM); else this.bufferReducedPrecision()\n }\n setQuadrantSegments(quadrantSegments) {\n this._bufParams.setQuadrantSegments(quadrantSegments)\n }\n bufferOriginalPrecision() {\n try {\n const bufBuilder = new BufferBuilder(this._bufParams)\n this._resultGeometry = bufBuilder.buffer(this._argGeom, this._distance)\n } catch (ex) {\n if (ex instanceof RuntimeException) \n this._saveException = ex\n else throw ex\n } finally {}\n }\n getResultGeometry(distance) {\n this._distance = distance\n this.computeGeometry()\n return this._resultGeometry\n }\n setEndCapStyle(endCapStyle) {\n this._bufParams.setEndCapStyle(endCapStyle)\n }\n}\nBufferOp.CAP_ROUND = BufferParameters.CAP_ROUND\nBufferOp.CAP_BUTT = BufferParameters.CAP_FLAT\nBufferOp.CAP_FLAT = BufferParameters.CAP_FLAT\nBufferOp.CAP_SQUARE = BufferParameters.CAP_SQUARE\nBufferOp.MAX_PRECISION_DIGITS = 12\n","export default class BoundaryNodeRule {\n isInBoundary(boundaryCount) {}\n}\nclass Mod2BoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount % 2 === 1\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nclass EndPointBoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount > 0\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nclass MultiValentEndPointBoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount > 1\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nclass MonoValentEndPointBoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount === 1\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nBoundaryNodeRule.Mod2BoundaryNodeRule = Mod2BoundaryNodeRule\nBoundaryNodeRule.EndPointBoundaryNodeRule = EndPointBoundaryNodeRule\nBoundaryNodeRule.MultiValentEndPointBoundaryNodeRule = MultiValentEndPointBoundaryNodeRule\nBoundaryNodeRule.MonoValentEndPointBoundaryNodeRule = MonoValentEndPointBoundaryNodeRule\nBoundaryNodeRule.MOD2_BOUNDARY_RULE = new Mod2BoundaryNodeRule()\nBoundaryNodeRule.ENDPOINT_BOUNDARY_RULE = new EndPointBoundaryNodeRule()\nBoundaryNodeRule.MULTIVALENT_ENDPOINT_BOUNDARY_RULE = new MultiValentEndPointBoundaryNodeRule()\nBoundaryNodeRule.MONOVALENT_ENDPOINT_BOUNDARY_RULE = new MonoValentEndPointBoundaryNodeRule()\nBoundaryNodeRule.OGC_SFS_BOUNDARY_RULE = BoundaryNodeRule.MOD2_BOUNDARY_RULE\n","import Location from '../geom/Location.js'\nimport LineString from '../geom/LineString.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Point from '../geom/Point.js'\nimport Polygon from '../geom/Polygon.js'\nimport PointLocation from './PointLocation.js'\nimport BoundaryNodeRule from './BoundaryNodeRule.js'\nimport MultiPolygon from '../geom/MultiPolygon.js'\nimport GeometryCollectionIterator from '../geom/GeometryCollectionIterator.js'\nimport GeometryCollection from '../geom/GeometryCollection.js'\nimport MultiLineString from '../geom/MultiLineString.js'\nexport default class PointLocator {\n constructor() {\n PointLocator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._boundaryRule = BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE\n this._isIn = null\n this._numBoundaries = null\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const boundaryRule = arguments[0]\n if (boundaryRule === null) throw new IllegalArgumentException('Rule must be non-null')\n this._boundaryRule = boundaryRule\n }\n }\n locateInPolygonRing(p, ring) {\n if (!ring.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n return PointLocation.locateInRing(p, ring.getCoordinates())\n }\n intersects(p, geom) {\n return this.locate(p, geom) !== Location.EXTERIOR\n }\n updateLocationInfo(loc) {\n if (loc === Location.INTERIOR) this._isIn = true\n if (loc === Location.BOUNDARY) this._numBoundaries++\n }\n computeLocation(p, geom) {\n if (geom instanceof Point) \n this.updateLocationInfo(this.locateOnPoint(p, geom))\n \n if (geom instanceof LineString) {\n this.updateLocationInfo(this.locateOnLineString(p, geom))\n } else if (geom instanceof Polygon) {\n this.updateLocationInfo(this.locateInPolygon(p, geom))\n } else if (geom instanceof MultiLineString) {\n const ml = geom\n for (let i = 0; i < ml.getNumGeometries(); i++) {\n const l = ml.getGeometryN(i)\n this.updateLocationInfo(this.locateOnLineString(p, l))\n }\n } else if (geom instanceof MultiPolygon) {\n const mpoly = geom\n for (let i = 0; i < mpoly.getNumGeometries(); i++) {\n const poly = mpoly.getGeometryN(i)\n this.updateLocationInfo(this.locateInPolygon(p, poly))\n }\n } else if (geom instanceof GeometryCollection) {\n const geomi = new GeometryCollectionIterator(geom)\n while (geomi.hasNext()) {\n const g2 = geomi.next()\n if (g2 !== geom) this.computeLocation(p, g2)\n }\n }\n }\n locateOnPoint(p, pt) {\n const ptCoord = pt.getCoordinate()\n if (ptCoord.equals2D(p)) return Location.INTERIOR\n return Location.EXTERIOR\n }\n locateOnLineString(p, l) {\n if (!l.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n const seq = l.getCoordinateSequence()\n if (!l.isClosed()) \n if (p.equals(seq.getCoordinate(0)) || p.equals(seq.getCoordinate(seq.size() - 1))) \n return Location.BOUNDARY\n \n \n if (PointLocation.isOnLine(p, seq)) \n return Location.INTERIOR\n \n return Location.EXTERIOR\n }\n locateInPolygon(p, poly) {\n if (poly.isEmpty()) return Location.EXTERIOR\n const shell = poly.getExteriorRing()\n const shellLoc = this.locateInPolygonRing(p, shell)\n if (shellLoc === Location.EXTERIOR) return Location.EXTERIOR\n if (shellLoc === Location.BOUNDARY) return Location.BOUNDARY\n for (let i = 0; i < poly.getNumInteriorRing(); i++) {\n const hole = poly.getInteriorRingN(i)\n const holeLoc = this.locateInPolygonRing(p, hole)\n if (holeLoc === Location.INTERIOR) return Location.EXTERIOR\n if (holeLoc === Location.BOUNDARY) return Location.BOUNDARY\n }\n return Location.INTERIOR\n }\n locate(p, geom) {\n if (geom.isEmpty()) return Location.EXTERIOR\n if (geom instanceof LineString) \n return this.locateOnLineString(p, geom)\n else if (geom instanceof Polygon) \n return this.locateInPolygon(p, geom)\n \n this._isIn = false\n this._numBoundaries = 0\n this.computeLocation(p, geom)\n if (this._boundaryRule.isInBoundary(this._numBoundaries)) return Location.BOUNDARY\n if (this._numBoundaries > 0 || this._isIn) return Location.INTERIOR\n return Location.EXTERIOR\n }\n}\n","import WKTWriter from '../io/WKTWriter.js'\nimport CoordinateArraySequence from '../geom/impl/CoordinateArraySequence.js'\nimport Octant from './Octant.js'\nimport SegmentString from './SegmentString.js'\nexport default class BasicSegmentString {\n constructor() {\n BasicSegmentString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pts = null\n this._data = null\n const pts = arguments[0], data = arguments[1]\n this._pts = pts\n this._data = data\n }\n getCoordinates() {\n return this._pts\n }\n size() {\n return this._pts.length\n }\n getCoordinate(i) {\n return this._pts[i]\n }\n isClosed() {\n return this._pts[0].equals(this._pts[this._pts.length - 1])\n }\n getSegmentOctant(index) {\n if (index === this._pts.length - 1) return -1\n return Octant.octant(this.getCoordinate(index), this.getCoordinate(index + 1))\n }\n setData(data) {\n this._data = data\n }\n getData() {\n return this._data\n }\n toString() {\n return WKTWriter.toLineString(new CoordinateArraySequence(this._pts))\n }\n get interfaces_() {\n return [SegmentString]\n }\n}\n","import SegmentIntersector from './SegmentIntersector.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class NodingIntersectionFinder {\n constructor() {\n NodingIntersectionFinder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._findAllIntersections = false\n this._isCheckEndSegmentsOnly = false\n this._keepIntersections = true\n this._isInteriorIntersectionsOnly = false\n this._li = null\n this._interiorIntersection = null\n this._intSegments = null\n this._intersections = new ArrayList()\n this._intersectionCount = 0\n const li = arguments[0]\n this._li = li\n this._interiorIntersection = null\n }\n static createAllIntersectionsFinder(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setFindAllIntersections(true)\n return finder\n }\n static isInteriorVertexIntersection() {\n if (arguments.length === 4) {\n const p0 = arguments[0], p1 = arguments[1], isEnd0 = arguments[2], isEnd1 = arguments[3]\n if (isEnd0 && isEnd1) return false\n if (p0.equals2D(p1)) \n return true\n \n return false\n } else if (arguments.length === 8) {\n const p00 = arguments[0], p01 = arguments[1], p10 = arguments[2], p11 = arguments[3], isEnd00 = arguments[4], isEnd01 = arguments[5], isEnd10 = arguments[6], isEnd11 = arguments[7]\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p00, p10, isEnd00, isEnd10)) return true\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p00, p11, isEnd00, isEnd11)) return true\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p01, p10, isEnd01, isEnd10)) return true\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p01, p11, isEnd01, isEnd11)) return true\n return false\n }\n }\n static createInteriorIntersectionCounter(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setInteriorIntersectionsOnly(true)\n finder.setFindAllIntersections(true)\n finder.setKeepIntersections(false)\n return finder\n }\n static createIntersectionCounter(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setFindAllIntersections(true)\n finder.setKeepIntersections(false)\n return finder\n }\n static isEndSegment(segStr, index) {\n if (index === 0) return true\n if (index >= segStr.size() - 2) return true\n return false\n }\n static createAnyIntersectionFinder(li) {\n return new NodingIntersectionFinder(li)\n }\n static createInteriorIntersectionsFinder(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setFindAllIntersections(true)\n finder.setInteriorIntersectionsOnly(true)\n return finder\n }\n setCheckEndSegmentsOnly(isCheckEndSegmentsOnly) {\n this._isCheckEndSegmentsOnly = isCheckEndSegmentsOnly\n }\n getIntersectionSegments() {\n return this._intSegments\n }\n count() {\n return this._intersectionCount\n }\n getIntersections() {\n return this._intersections\n }\n setFindAllIntersections(findAllIntersections) {\n this._findAllIntersections = findAllIntersections\n }\n setKeepIntersections(keepIntersections) {\n this._keepIntersections = keepIntersections\n }\n getIntersection() {\n return this._interiorIntersection\n }\n processIntersections(e0, segIndex0, e1, segIndex1) {\n if (!this._findAllIntersections && this.hasIntersection()) return null\n const isSameSegString = e0 === e1\n const isSameSegment = isSameSegString && segIndex0 === segIndex1\n if (isSameSegment) return null\n if (this._isCheckEndSegmentsOnly) {\n const isEndSegPresent = NodingIntersectionFinder.isEndSegment(e0, segIndex0) || NodingIntersectionFinder.isEndSegment(e1, segIndex1)\n if (!isEndSegPresent) return null\n }\n const p00 = e0.getCoordinate(segIndex0)\n const p01 = e0.getCoordinate(segIndex0 + 1)\n const p10 = e1.getCoordinate(segIndex1)\n const p11 = e1.getCoordinate(segIndex1 + 1)\n const isEnd00 = segIndex0 === 0\n const isEnd01 = segIndex0 + 2 === e0.size()\n const isEnd10 = segIndex1 === 0\n const isEnd11 = segIndex1 + 2 === e1.size()\n this._li.computeIntersection(p00, p01, p10, p11)\n const isInteriorInt = this._li.hasIntersection() && this._li.isInteriorIntersection()\n let isInteriorVertexInt = false\n if (!this._isInteriorIntersectionsOnly) {\n const isAdjacentSegment = isSameSegString && Math.abs(segIndex1 - segIndex0) <= 1\n isInteriorVertexInt = !isAdjacentSegment && NodingIntersectionFinder.isInteriorVertexIntersection(p00, p01, p10, p11, isEnd00, isEnd01, isEnd10, isEnd11)\n }\n if (isInteriorInt || isInteriorVertexInt) {\n this._intSegments = new Array(4).fill(null)\n this._intSegments[0] = p00\n this._intSegments[1] = p01\n this._intSegments[2] = p10\n this._intSegments[3] = p11\n this._interiorIntersection = this._li.getIntersection(0)\n if (this._keepIntersections) this._intersections.add(this._interiorIntersection)\n this._intersectionCount++\n }\n }\n hasIntersection() {\n return this._interiorIntersection !== null\n }\n isDone() {\n if (this._findAllIntersections) return false\n return this._interiorIntersection !== null\n }\n setInteriorIntersectionsOnly(isInteriorIntersectionsOnly) {\n this._isInteriorIntersectionsOnly = isInteriorIntersectionsOnly\n }\n get interfaces_() {\n return [SegmentIntersector]\n }\n}\n","import WKTWriter from '../io/WKTWriter.js'\nimport MCIndexNoder from './MCIndexNoder.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nimport NodingIntersectionFinder from './NodingIntersectionFinder.js'\nexport default class FastNodingValidator {\n constructor() {\n FastNodingValidator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._segStrings = null\n this._findAllIntersections = false\n this._segInt = null\n this._isValid = true\n const segStrings = arguments[0]\n this._segStrings = segStrings\n }\n static computeIntersections(segStrings) {\n const nv = new FastNodingValidator(segStrings)\n nv.setFindAllIntersections(true)\n nv.isValid()\n return nv.getIntersections()\n }\n execute() {\n if (this._segInt !== null) return null\n this.checkInteriorIntersections()\n }\n getIntersections() {\n return this._segInt.getIntersections()\n }\n isValid() {\n this.execute()\n return this._isValid\n }\n setFindAllIntersections(findAllIntersections) {\n this._findAllIntersections = findAllIntersections\n }\n checkInteriorIntersections() {\n this._isValid = true\n this._segInt = new NodingIntersectionFinder(this._li)\n this._segInt.setFindAllIntersections(this._findAllIntersections)\n const noder = new MCIndexNoder()\n noder.setSegmentIntersector(this._segInt)\n noder.computeNodes(this._segStrings)\n if (this._segInt.hasIntersection()) {\n this._isValid = false\n return null\n }\n }\n checkValid() {\n this.execute()\n if (!this._isValid) throw new TopologyException(this.getErrorMessage(), this._segInt.getIntersection())\n }\n getErrorMessage() {\n if (this._isValid) return 'no intersections found'\n const intSegs = this._segInt.getIntersectionSegments()\n return 'found non-noded intersection between ' + WKTWriter.toLineString(intSegs[0], intSegs[1]) + ' and ' + WKTWriter.toLineString(intSegs[2], intSegs[3])\n }\n}\n","import BasicSegmentString from '../noding/BasicSegmentString.js'\nimport FastNodingValidator from '../noding/FastNodingValidator.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class EdgeNodingValidator {\n constructor() {\n EdgeNodingValidator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nv = null\n const edges = arguments[0]\n this._nv = new FastNodingValidator(EdgeNodingValidator.toSegmentStrings(edges))\n }\n static toSegmentStrings(edges) {\n const segStrings = new ArrayList()\n for (let i = edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n segStrings.add(new BasicSegmentString(e.getCoordinates(), e))\n }\n return segStrings\n }\n static checkValid(edges) {\n const validator = new EdgeNodingValidator(edges)\n validator.checkValid()\n }\n checkValid() {\n this._nv.checkValid()\n }\n}\n","import GeometryFactory from '../GeometryFactory.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class GeometryCollectionMapper {\n constructor() {\n GeometryCollectionMapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._mapOp = null\n const mapOp = arguments[0]\n this._mapOp = mapOp\n }\n static map(gc, op) {\n const mapper = new GeometryCollectionMapper(op)\n return mapper.map(gc)\n }\n map(gc) {\n const mapped = new ArrayList()\n for (let i = 0; i < gc.getNumGeometries(); i++) {\n const g = this._mapOp.map(gc.getGeometryN(i))\n if (!g.isEmpty()) mapped.add(g)\n }\n return gc.getFactory().createGeometryCollection(GeometryFactory.toGeometryArray(mapped))\n }\n}\n","import ArrayList from '../../../../../java/util/ArrayList.js'\nimport Assert from '../../util/Assert.js'\nimport OverlayOp from './OverlayOp.js'\nexport default class LineBuilder {\n constructor() {\n LineBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._op = null\n this._geometryFactory = null\n this._ptLocator = null\n this._lineEdgesList = new ArrayList()\n this._resultLineList = new ArrayList()\n const op = arguments[0], geometryFactory = arguments[1], ptLocator = arguments[2]\n this._op = op\n this._geometryFactory = geometryFactory\n this._ptLocator = ptLocator\n }\n collectLines(opCode) {\n for (let it = this._op.getGraph().getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n this.collectLineEdge(de, opCode, this._lineEdgesList)\n this.collectBoundaryTouchEdge(de, opCode, this._lineEdgesList)\n }\n }\n labelIsolatedLine(e, targetIndex) {\n const loc = this._ptLocator.locate(e.getCoordinate(), this._op.getArgGeometry(targetIndex))\n e.getLabel().setLocation(targetIndex, loc)\n }\n build(opCode) {\n this.findCoveredLineEdges()\n this.collectLines(opCode)\n this.buildLines(opCode)\n return this._resultLineList\n }\n collectLineEdge(de, opCode, edges) {\n const label = de.getLabel()\n const e = de.getEdge()\n if (de.isLineEdge()) \n if (!de.isVisited() && OverlayOp.isResultOfOp(label, opCode) && !e.isCovered()) {\n edges.add(e)\n de.setVisitedEdge(true)\n }\n \n }\n findCoveredLineEdges() {\n for (let nodeit = this._op.getGraph().getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().findCoveredLineEdges()\n }\n for (let it = this._op.getGraph().getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n const e = de.getEdge()\n if (de.isLineEdge() && !e.isCoveredSet()) {\n const isCovered = this._op.isCoveredByA(de.getCoordinate())\n e.setCovered(isCovered)\n }\n }\n }\n labelIsolatedLines(edgesList) {\n for (let it = edgesList.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n if (e.isIsolated()) \n if (label.isNull(0)) this.labelIsolatedLine(e, 0); else this.labelIsolatedLine(e, 1)\n \n }\n }\n buildLines(opCode) {\n for (let it = this._lineEdgesList.iterator(); it.hasNext(); ) {\n const e = it.next()\n const line = this._geometryFactory.createLineString(e.getCoordinates())\n this._resultLineList.add(line)\n e.setInResult(true)\n }\n }\n collectBoundaryTouchEdge(de, opCode, edges) {\n const label = de.getLabel()\n if (de.isLineEdge()) return null\n if (de.isVisited()) return null\n if (de.isInteriorAreaEdge()) return null\n if (de.getEdge().isInResult()) return null\n Assert.isTrue(!(de.isInResult() || de.getSym().isInResult()) || !de.getEdge().isInResult())\n if (OverlayOp.isResultOfOp(label, opCode) && opCode === OverlayOp.INTERSECTION) {\n edges.add(de.getEdge())\n de.setVisitedEdge(true)\n }\n }\n}\n","import ArrayList from '../../../../../java/util/ArrayList.js'\nimport OverlayOp from './OverlayOp.js'\nexport default class PointBuilder {\n constructor() {\n PointBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._op = null\n this._geometryFactory = null\n this._resultPointList = new ArrayList()\n const op = arguments[0], geometryFactory = arguments[1], ptLocator = arguments[2]\n this._op = op\n this._geometryFactory = geometryFactory\n }\n filterCoveredNodeToPoint(n) {\n const coord = n.getCoordinate()\n if (!this._op.isCoveredByLA(coord)) {\n const pt = this._geometryFactory.createPoint(coord)\n this._resultPointList.add(pt)\n }\n }\n extractNonCoveredResultNodes(opCode) {\n for (let nodeit = this._op.getGraph().getNodes().iterator(); nodeit.hasNext(); ) {\n const n = nodeit.next()\n if (n.isInResult()) continue\n if (n.isIncidentEdgeInResult()) continue\n if (n.getEdges().getDegree() === 0 || opCode === OverlayOp.INTERSECTION) {\n const label = n.getLabel()\n if (OverlayOp.isResultOfOp(label, opCode)) \n this.filterCoveredNodeToPoint(n)\n \n }\n }\n }\n build(opCode) {\n this.extractNonCoveredResultNodes(opCode)\n return this._resultPointList\n }\n}\n","import LineString from '../LineString.js'\nimport GeometryFactory from '../GeometryFactory.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport Point from '../Point.js'\nimport Polygon from '../Polygon.js'\nimport MultiPoint from '../MultiPoint.js'\nimport LinearRing from '../LinearRing.js'\nimport MultiPolygon from '../MultiPolygon.js'\nimport GeometryCollection from '../GeometryCollection.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport MultiLineString from '../MultiLineString.js'\nexport default class GeometryTransformer {\n constructor() {\n GeometryTransformer.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._inputGeom = null\n this._factory = null\n this._pruneEmptyGeometry = true\n this._preserveGeometryCollectionType = true\n this._preserveCollections = false\n this._preserveType = false\n }\n transformPoint(geom, parent) {\n return this._factory.createPoint(this.transformCoordinates(geom.getCoordinateSequence(), geom))\n }\n transformPolygon(geom, parent) {\n let isAllValidLinearRings = true\n const shell = this.transformLinearRing(geom.getExteriorRing(), geom)\n if (shell === null || !(shell instanceof LinearRing) || shell.isEmpty()) isAllValidLinearRings = false\n const holes = new ArrayList()\n for (let i = 0; i < geom.getNumInteriorRing(); i++) {\n const hole = this.transformLinearRing(geom.getInteriorRingN(i), geom)\n if (hole === null || hole.isEmpty()) \n continue\n \n if (!(hole instanceof LinearRing)) isAllValidLinearRings = false\n holes.add(hole)\n }\n if (isAllValidLinearRings) {\n return this._factory.createPolygon(shell, holes.toArray([]))\n } else {\n const components = new ArrayList()\n if (shell !== null) components.add(shell)\n components.addAll(holes)\n return this._factory.buildGeometry(components)\n }\n }\n createCoordinateSequence(coords) {\n return this._factory.getCoordinateSequenceFactory().create(coords)\n }\n getInputGeometry() {\n return this._inputGeom\n }\n transformMultiLineString(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transformLineString(geom.getGeometryN(i), geom)\n if (transformGeom === null) continue\n if (transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n return this._factory.buildGeometry(transGeomList)\n }\n transformCoordinates(coords, parent) {\n return this.copy(coords)\n }\n transformLineString(geom, parent) {\n return this._factory.createLineString(this.transformCoordinates(geom.getCoordinateSequence(), geom))\n }\n transformMultiPoint(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transformPoint(geom.getGeometryN(i), geom)\n if (transformGeom === null) continue\n if (transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n return this._factory.buildGeometry(transGeomList)\n }\n transformMultiPolygon(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transformPolygon(geom.getGeometryN(i), geom)\n if (transformGeom === null) continue\n if (transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n return this._factory.buildGeometry(transGeomList)\n }\n copy(seq) {\n return seq.copy()\n }\n transformGeometryCollection(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transform(geom.getGeometryN(i))\n if (transformGeom === null) continue\n if (this._pruneEmptyGeometry && transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n if (this._preserveGeometryCollectionType) return this._factory.createGeometryCollection(GeometryFactory.toGeometryArray(transGeomList))\n return this._factory.buildGeometry(transGeomList)\n }\n transform(inputGeom) {\n this._inputGeom = inputGeom\n this._factory = inputGeom.getFactory()\n if (inputGeom instanceof Point) return this.transformPoint(inputGeom, null)\n if (inputGeom instanceof MultiPoint) return this.transformMultiPoint(inputGeom, null)\n if (inputGeom instanceof LinearRing) return this.transformLinearRing(inputGeom, null)\n if (inputGeom instanceof LineString) return this.transformLineString(inputGeom, null)\n if (inputGeom instanceof MultiLineString) return this.transformMultiLineString(inputGeom, null)\n if (inputGeom instanceof Polygon) return this.transformPolygon(inputGeom, null)\n if (inputGeom instanceof MultiPolygon) return this.transformMultiPolygon(inputGeom, null)\n if (inputGeom instanceof GeometryCollection) return this.transformGeometryCollection(inputGeom, null)\n throw new IllegalArgumentException('Unknown Geometry subtype: ' + inputGeom.getGeometryType())\n }\n transformLinearRing(geom, parent) {\n const seq = this.transformCoordinates(geom.getCoordinateSequence(), geom)\n if (seq === null) return this._factory.createLinearRing(null)\n const seqSize = seq.size()\n if (seqSize > 0 && seqSize < 4 && !this._preserveType) return this._factory.createLineString(seq)\n return this._factory.createLinearRing(seq)\n }\n}\n","import LineString from '../../../geom/LineString.js'\nimport CoordinateList from '../../../geom/CoordinateList.js'\nimport Coordinate from '../../../geom/Coordinate.js'\nimport Double from '../../../../../../java/lang/Double.js'\nimport LineSegment from '../../../geom/LineSegment.js'\nexport default class LineStringSnapper {\n constructor() {\n LineStringSnapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._snapTolerance = 0.0\n this._srcPts = null\n this._seg = new LineSegment()\n this._allowSnappingToSourceVertices = false\n this._isClosed = false\n if (arguments[0] instanceof LineString && typeof arguments[1] === 'number') {\n const srcLine = arguments[0], snapTolerance = arguments[1]\n LineStringSnapper.constructor_.call(this, srcLine.getCoordinates(), snapTolerance)\n } else if (arguments[0] instanceof Array && typeof arguments[1] === 'number') {\n const srcPts = arguments[0], snapTolerance = arguments[1]\n this._srcPts = srcPts\n this._isClosed = LineStringSnapper.isClosed(srcPts)\n this._snapTolerance = snapTolerance\n }\n }\n static isClosed(pts) {\n if (pts.length <= 1) return false\n return pts[0].equals2D(pts[pts.length - 1])\n }\n snapVertices(srcCoords, snapPts) {\n const end = this._isClosed ? srcCoords.size() - 1 : srcCoords.size()\n for (let i = 0; i < end; i++) {\n const srcPt = srcCoords.get(i)\n const snapVert = this.findSnapForVertex(srcPt, snapPts)\n if (snapVert !== null) {\n srcCoords.set(i, new Coordinate(snapVert))\n if (i === 0 && this._isClosed) srcCoords.set(srcCoords.size() - 1, new Coordinate(snapVert))\n }\n }\n }\n findSnapForVertex(pt, snapPts) {\n for (let i = 0; i < snapPts.length; i++) {\n if (pt.equals2D(snapPts[i])) return null\n if (pt.distance(snapPts[i]) < this._snapTolerance) return snapPts[i]\n }\n return null\n }\n snapTo(snapPts) {\n const coordList = new CoordinateList(this._srcPts)\n this.snapVertices(coordList, snapPts)\n this.snapSegments(coordList, snapPts)\n const newPts = coordList.toCoordinateArray()\n return newPts\n }\n snapSegments(srcCoords, snapPts) {\n if (snapPts.length === 0) return null\n let distinctPtCount = snapPts.length\n if (snapPts[0].equals2D(snapPts[snapPts.length - 1])) distinctPtCount = snapPts.length - 1\n for (let i = 0; i < distinctPtCount; i++) {\n const snapPt = snapPts[i]\n const index = this.findSegmentIndexToSnap(snapPt, srcCoords)\n if (index >= 0) \n srcCoords.add(index + 1, new Coordinate(snapPt), false)\n \n }\n }\n findSegmentIndexToSnap(snapPt, srcCoords) {\n let minDist = Double.MAX_VALUE\n let snapIndex = -1\n for (let i = 0; i < srcCoords.size() - 1; i++) {\n this._seg.p0 = srcCoords.get(i)\n this._seg.p1 = srcCoords.get(i + 1)\n if (this._seg.p0.equals2D(snapPt) || this._seg.p1.equals2D(snapPt)) \n if (this._allowSnappingToSourceVertices) continue; else return -1\n \n const dist = this._seg.distance(snapPt)\n if (dist < this._snapTolerance && dist < minDist) {\n minDist = dist\n snapIndex = i\n }\n }\n return snapIndex\n }\n setAllowSnappingToSourceVertices(allowSnappingToSourceVertices) {\n this._allowSnappingToSourceVertices = allowSnappingToSourceVertices\n }\n}\n","import TreeSet from '../../../../../../java/util/TreeSet.js'\nimport GeometryTransformer from '../../../geom/util/GeometryTransformer.js'\nimport hasInterface from '../../../../../../hasInterface.js'\nimport Double from '../../../../../../java/lang/Double.js'\nimport LineStringSnapper from './LineStringSnapper.js'\nimport PrecisionModel from '../../../geom/PrecisionModel.js'\nimport Polygonal from '../../../geom/Polygonal.js'\nexport default class GeometrySnapper {\n constructor() {\n GeometrySnapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._srcGeom = null\n const srcGeom = arguments[0]\n this._srcGeom = srcGeom\n }\n static snap(g0, g1, snapTolerance) {\n const snapGeom = new Array(2).fill(null)\n const snapper0 = new GeometrySnapper(g0)\n snapGeom[0] = snapper0.snapTo(g1, snapTolerance)\n const snapper1 = new GeometrySnapper(g1)\n snapGeom[1] = snapper1.snapTo(snapGeom[0], snapTolerance)\n return snapGeom\n }\n static computeOverlaySnapTolerance() {\n if (arguments.length === 1) {\n const g = arguments[0]\n let snapTolerance = GeometrySnapper.computeSizeBasedSnapTolerance(g)\n const pm = g.getPrecisionModel()\n if (pm.getType() === PrecisionModel.FIXED) {\n const fixedSnapTol = 1 / pm.getScale() * 2 / 1.415\n if (fixedSnapTol > snapTolerance) snapTolerance = fixedSnapTol\n }\n return snapTolerance\n } else if (arguments.length === 2) {\n const g0 = arguments[0], g1 = arguments[1]\n return Math.min(GeometrySnapper.computeOverlaySnapTolerance(g0), GeometrySnapper.computeOverlaySnapTolerance(g1))\n }\n }\n static computeSizeBasedSnapTolerance(g) {\n const env = g.getEnvelopeInternal()\n const minDimension = Math.min(env.getHeight(), env.getWidth())\n const snapTol = minDimension * GeometrySnapper.SNAP_PRECISION_FACTOR\n return snapTol\n }\n static snapToSelf(geom, snapTolerance, cleanResult) {\n const snapper0 = new GeometrySnapper(geom)\n return snapper0.snapToSelf(snapTolerance, cleanResult)\n }\n snapTo(snapGeom, snapTolerance) {\n const snapPts = this.extractTargetCoordinates(snapGeom)\n const snapTrans = new SnapTransformer(snapTolerance, snapPts)\n return snapTrans.transform(this._srcGeom)\n }\n snapToSelf(snapTolerance, cleanResult) {\n const snapPts = this.extractTargetCoordinates(this._srcGeom)\n const snapTrans = new SnapTransformer(snapTolerance, snapPts, true)\n const snappedGeom = snapTrans.transform(this._srcGeom)\n let result = snappedGeom\n if (cleanResult && hasInterface(result, Polygonal)) \n result = snappedGeom.buffer(0)\n \n return result\n }\n computeSnapTolerance(ringPts) {\n const minSegLen = this.computeMinimumSegmentLength(ringPts)\n const snapTol = minSegLen / 10\n return snapTol\n }\n extractTargetCoordinates(g) {\n const ptSet = new TreeSet()\n const pts = g.getCoordinates()\n for (let i = 0; i < pts.length; i++) \n ptSet.add(pts[i])\n \n return ptSet.toArray(new Array(0).fill(null))\n }\n computeMinimumSegmentLength(pts) {\n let minSegLen = Double.MAX_VALUE\n for (let i = 0; i < pts.length - 1; i++) {\n const segLen = pts[i].distance(pts[i + 1])\n if (segLen < minSegLen) minSegLen = segLen\n }\n return minSegLen\n }\n}\nGeometrySnapper.SNAP_PRECISION_FACTOR = 1e-9\nclass SnapTransformer extends GeometryTransformer {\n constructor() {\n super()\n SnapTransformer.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._snapTolerance = null\n this._snapPts = null\n this._isSelfSnap = false\n if (arguments.length === 2) {\n const snapTolerance = arguments[0], snapPts = arguments[1]\n this._snapTolerance = snapTolerance\n this._snapPts = snapPts\n } else if (arguments.length === 3) {\n const snapTolerance = arguments[0], snapPts = arguments[1], isSelfSnap = arguments[2]\n this._snapTolerance = snapTolerance\n this._snapPts = snapPts\n this._isSelfSnap = isSelfSnap\n }\n }\n snapLine(srcPts, snapPts) {\n const snapper = new LineStringSnapper(srcPts, this._snapTolerance)\n snapper.setAllowSnappingToSourceVertices(this._isSelfSnap)\n return snapper.snapTo(snapPts)\n }\n transformCoordinates(coords, parent) {\n const srcPts = coords.toCoordinateArray()\n const newPts = this.snapLine(srcPts, this._snapPts)\n return this._factory.getCoordinateSequenceFactory().create(newPts)\n }\n}\n","import Double from '../../../../java/lang/Double.js'\nimport Long from '../../../../java/lang/Long.js'\nexport default class CommonBits {\n constructor() {\n this._isFirst = true\n this._commonMantissaBitsCount = 53\n this._commonBits = new Long()\n this._commonSignExp = null\n }\n\n getCommon() {\n return Double.longBitsToDouble(this._commonBits)\n }\n\n add(num) {\n const numBits = Double.doubleToLongBits(num)\n if (this._isFirst) {\n this._commonBits = numBits\n this._commonSignExp = CommonBits.signExpBits(this._commonBits)\n this._isFirst = false\n return null\n }\n const numSignExp = CommonBits.signExpBits(numBits)\n if (numSignExp !== this._commonSignExp) {\n this._commonBits.high = 0 | 0\n this._commonBits.low = 0 | 0\n return null\n }\n this._commonMantissaBitsCount = CommonBits.numCommonMostSigMantissaBits(this._commonBits, numBits)\n this._commonBits = CommonBits.zeroLowerBits(this._commonBits, 64 - (12 + this._commonMantissaBitsCount))\n }\n\n toString() {\n if (arguments.length === 1) {\n const bits = arguments[0]\n const x = Double.longBitsToDouble(bits)\n const numStr = Long.toBinaryString(bits)\n const padStr = '0000000000000000000000000000000000000000000000000000000000000000' + numStr\n const bitStr = padStr.substring(padStr.length - 64)\n const str = bitStr.substring(0, 1) + ' ' + bitStr.substring(1, 12) + '(exp) ' + bitStr.substring(12) + ' [ ' + x + ' ]'\n return str\n }\n }\n\n getClass() {\n return CommonBits\n }\n\n get interfaces_() {\n return []\n }\n\n static getBit(bits, i) {\n const mask = (1 << (i % 32))\n if (i < 32) return (bits.low & mask) !== 0 ? 1 : 0\n\n return (bits.high & mask) !== 0 ? 1 : 0\n }\n\n static signExpBits(num) {\n return num.high >>> 20\n }\n\n static zeroLowerBits(bits, nBits) {\n let prop = 'low'\n if (nBits > 32) {\n bits.low = 0 | 0\n nBits %= 32\n prop = 'high'\n }\n if (nBits > 0) {\n const mask = (nBits < 32) ? (~((1 << nBits) - 1)) : 0\n bits[prop] &= mask\n }\n return bits\n }\n\n static numCommonMostSigMantissaBits(num1, num2) {\n let count = 0\n for (let i = 52; i >= 0; i--) {\n if (CommonBits.getBit(num1, i) !== CommonBits.getBit(num2, i)) return count\n count++\n }\n return 52\n }\n}\n","import CommonBits from './CommonBits.js'\nimport CoordinateFilter from '../geom/CoordinateFilter.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport CoordinateSequenceFilter from '../geom/CoordinateSequenceFilter.js'\nexport default class CommonBitsRemover {\n constructor() {\n CommonBitsRemover.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._commonCoord = null\n this._ccFilter = new CommonCoordinateFilter()\n }\n addCommonBits(geom) {\n const trans = new Translater(this._commonCoord)\n geom.apply(trans)\n geom.geometryChanged()\n }\n removeCommonBits(geom) {\n if (this._commonCoord.x === 0.0 && this._commonCoord.y === 0.0) return geom\n const invCoord = new Coordinate(this._commonCoord)\n invCoord.x = -invCoord.x\n invCoord.y = -invCoord.y\n const trans = new Translater(invCoord)\n geom.apply(trans)\n geom.geometryChanged()\n return geom\n }\n getCommonCoordinate() {\n return this._commonCoord\n }\n add(geom) {\n geom.apply(this._ccFilter)\n this._commonCoord = this._ccFilter.getCommonCoordinate()\n }\n}\nclass CommonCoordinateFilter {\n constructor() {\n CommonCoordinateFilter.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._commonBitsX = new CommonBits()\n this._commonBitsY = new CommonBits()\n }\n filter(coord) {\n this._commonBitsX.add(coord.x)\n this._commonBitsY.add(coord.y)\n }\n getCommonCoordinate() {\n return new Coordinate(this._commonBitsX.getCommon(), this._commonBitsY.getCommon())\n }\n get interfaces_() {\n return [CoordinateFilter]\n }\n}\nclass Translater {\n constructor() {\n Translater.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.trans = null\n const trans = arguments[0]\n this.trans = trans\n }\n filter(seq, i) {\n const xp = seq.getOrdinate(i, 0) + this.trans.x\n const yp = seq.getOrdinate(i, 1) + this.trans.y\n seq.setOrdinate(i, 0, xp)\n seq.setOrdinate(i, 1, yp)\n }\n isDone() {\n return false\n }\n isGeometryChanged() {\n return true\n }\n get interfaces_() {\n return [CoordinateSequenceFilter]\n }\n}\nCommonBitsRemover.CommonCoordinateFilter = CommonCoordinateFilter\nCommonBitsRemover.Translater = Translater\n","import GeometrySnapper from './GeometrySnapper.js'\nimport System from '../../../../../../java/lang/System.js'\nimport CommonBitsRemover from '../../../precision/CommonBitsRemover.js'\nimport OverlayOp from '../OverlayOp.js'\nexport default class SnapOverlayOp {\n constructor() {\n SnapOverlayOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = new Array(2).fill(null)\n this._snapTolerance = null\n this._cbr = null\n const g1 = arguments[0], g2 = arguments[1]\n this._geom[0] = g1\n this._geom[1] = g2\n this.computeSnapTolerance()\n }\n static overlayOp(g0, g1, opCode) {\n const op = new SnapOverlayOp(g0, g1)\n return op.getResultGeometry(opCode)\n }\n static union(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.UNION)\n }\n static intersection(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.INTERSECTION)\n }\n static symDifference(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.SYMDIFFERENCE)\n }\n static difference(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.DIFFERENCE)\n }\n selfSnap(geom) {\n const snapper0 = new GeometrySnapper(geom)\n const snapGeom = snapper0.snapTo(geom, this._snapTolerance)\n return snapGeom\n }\n removeCommonBits(geom) {\n this._cbr = new CommonBitsRemover()\n this._cbr.add(geom[0])\n this._cbr.add(geom[1])\n const remGeom = new Array(2).fill(null)\n remGeom[0] = this._cbr.removeCommonBits(geom[0].copy())\n remGeom[1] = this._cbr.removeCommonBits(geom[1].copy())\n return remGeom\n }\n prepareResult(geom) {\n this._cbr.addCommonBits(geom)\n return geom\n }\n getResultGeometry(opCode) {\n const prepGeom = this.snap(this._geom)\n const result = OverlayOp.overlayOp(prepGeom[0], prepGeom[1], opCode)\n return this.prepareResult(result)\n }\n checkValid(g) {\n if (!g.isValid()) \n System.out.println('Snapped geometry is invalid')\n \n }\n computeSnapTolerance() {\n this._snapTolerance = GeometrySnapper.computeOverlaySnapTolerance(this._geom[0], this._geom[1])\n }\n snap(geom) {\n const remGeom = this.removeCommonBits(geom)\n const snapGeom = GeometrySnapper.snap(remGeom[0], remGeom[1], this._snapTolerance)\n return snapGeom\n }\n}\n","import SnapOverlayOp from './SnapOverlayOp.js'\nimport RuntimeException from '../../../../../../java/lang/RuntimeException.js'\nimport OverlayOp from '../OverlayOp.js'\nexport default class SnapIfNeededOverlayOp {\n constructor() {\n SnapIfNeededOverlayOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = new Array(2).fill(null)\n const g1 = arguments[0], g2 = arguments[1]\n this._geom[0] = g1\n this._geom[1] = g2\n }\n static overlayOp(g0, g1, opCode) {\n const op = new SnapIfNeededOverlayOp(g0, g1)\n return op.getResultGeometry(opCode)\n }\n static union(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.UNION)\n }\n static intersection(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.INTERSECTION)\n }\n static symDifference(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.SYMDIFFERENCE)\n }\n static difference(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.DIFFERENCE)\n }\n getResultGeometry(opCode) {\n let result = null\n let isSuccess = false\n let savedException = null\n try {\n result = OverlayOp.overlayOp(this._geom[0], this._geom[1], opCode)\n const isValid = true\n if (isValid) isSuccess = true\n } catch (ex) {\n if (ex instanceof RuntimeException) \n savedException = ex\n else throw ex\n } finally {}\n if (!isSuccess) \n try {\n result = SnapOverlayOp.overlayOp(this._geom[0], this._geom[1], opCode)\n } catch (ex) {\n if (ex instanceof RuntimeException) \n throw savedException\n else throw ex\n } finally {}\n \n return result\n }\n}\n","export default class MonotoneChain {\n constructor() {\n MonotoneChain.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.mce = null\n this.chainIndex = null\n const mce = arguments[0], chainIndex = arguments[1]\n this.mce = mce\n this.chainIndex = chainIndex\n }\n computeIntersections(mc, si) {\n this.mce.computeIntersectsForChain(this.chainIndex, mc.mce, mc.chainIndex, si)\n }\n}\n","import Comparable from '../../../../../java/lang/Comparable.js'\nexport default class SweepLineEvent {\n constructor() {\n SweepLineEvent.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._label = null\n this._xValue = null\n this._eventType = null\n this._insertEvent = null\n this._deleteEventIndex = null\n this._obj = null\n if (arguments.length === 2) {\n const x = arguments[0], insertEvent = arguments[1]\n this._eventType = SweepLineEvent.DELETE\n this._xValue = x\n this._insertEvent = insertEvent\n } else if (arguments.length === 3) {\n const label = arguments[0], x = arguments[1], obj = arguments[2]\n this._eventType = SweepLineEvent.INSERT\n this._label = label\n this._xValue = x\n this._obj = obj\n }\n }\n isDelete() {\n return this._eventType === SweepLineEvent.DELETE\n }\n setDeleteEventIndex(deleteEventIndex) {\n this._deleteEventIndex = deleteEventIndex\n }\n getObject() {\n return this._obj\n }\n compareTo(o) {\n const pe = o\n if (this._xValue < pe._xValue) return -1\n if (this._xValue > pe._xValue) return 1\n if (this._eventType < pe._eventType) return -1\n if (this._eventType > pe._eventType) return 1\n return 0\n }\n getInsertEvent() {\n return this._insertEvent\n }\n isInsert() {\n return this._eventType === SweepLineEvent.INSERT\n }\n isSameLabel(ev) {\n if (this._label === null) return false\n return this._label === ev._label\n }\n getDeleteEventIndex() {\n return this._deleteEventIndex\n }\n get interfaces_() {\n return [Comparable]\n }\n}\nSweepLineEvent.INSERT = 1\nSweepLineEvent.DELETE = 2\n","export default class SegmentIntersector {\n constructor() {\n SegmentIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hasIntersection = false\n this._hasProper = false\n this._hasProperInterior = false\n this._properIntersectionPoint = null\n this._li = null\n this._includeProper = null\n this._recordIsolated = null\n this._isSelfIntersection = null\n this._numIntersections = 0\n this.numTests = 0\n this._bdyNodes = null\n this._isDone = false\n this._isDoneWhenProperInt = false\n const li = arguments[0], includeProper = arguments[1], recordIsolated = arguments[2]\n this._li = li\n this._includeProper = includeProper\n this._recordIsolated = recordIsolated\n }\n static isAdjacentSegments(i1, i2) {\n return Math.abs(i1 - i2) === 1\n }\n isTrivialIntersection(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1) \n if (this._li.getIntersectionNum() === 1) {\n if (SegmentIntersector.isAdjacentSegments(segIndex0, segIndex1)) return true\n if (e0.isClosed()) {\n const maxSegIndex = e0.getNumPoints() - 1\n if (segIndex0 === 0 && segIndex1 === maxSegIndex || segIndex1 === 0 && segIndex0 === maxSegIndex) \n return true\n \n }\n }\n \n return false\n }\n getProperIntersectionPoint() {\n return this._properIntersectionPoint\n }\n setIsDoneIfProperInt(isDoneWhenProperInt) {\n this._isDoneWhenProperInt = isDoneWhenProperInt\n }\n hasProperInteriorIntersection() {\n return this._hasProperInterior\n }\n isBoundaryPointInternal(li, bdyNodes) {\n for (let i = bdyNodes.iterator(); i.hasNext(); ) {\n const node = i.next()\n const pt = node.getCoordinate()\n if (li.isIntersection(pt)) return true\n }\n return false\n }\n hasProperIntersection() {\n return this._hasProper\n }\n hasIntersection() {\n return this._hasIntersection\n }\n isDone() {\n return this._isDone\n }\n isBoundaryPoint(li, bdyNodes) {\n if (bdyNodes === null) return false\n if (this.isBoundaryPointInternal(li, bdyNodes[0])) return true\n if (this.isBoundaryPointInternal(li, bdyNodes[1])) return true\n return false\n }\n setBoundaryNodes(bdyNodes0, bdyNodes1) {\n this._bdyNodes = new Array(2).fill(null)\n this._bdyNodes[0] = bdyNodes0\n this._bdyNodes[1] = bdyNodes1\n }\n addIntersections(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1 && segIndex0 === segIndex1) return null\n this.numTests++\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) {\n if (this._recordIsolated) {\n e0.setIsolated(false)\n e1.setIsolated(false)\n }\n this._numIntersections++\n if (!this.isTrivialIntersection(e0, segIndex0, e1, segIndex1)) {\n this._hasIntersection = true\n if (this._includeProper || !this._li.isProper()) {\n e0.addIntersections(this._li, segIndex0, 0)\n e1.addIntersections(this._li, segIndex1, 1)\n }\n if (this._li.isProper()) {\n this._properIntersectionPoint = this._li.getIntersection(0).copy()\n this._hasProper = true\n if (this._isDoneWhenProperInt) \n this._isDone = true\n \n if (!this.isBoundaryPoint(this._li, this._bdyNodes)) this._hasProperInterior = true\n }\n }\n }\n }\n}\n","import hasInterface from '../../../../../hasInterface.js'\nimport MonotoneChain from './MonotoneChain.js'\nimport SweepLineEvent from './SweepLineEvent.js'\nimport EdgeSetIntersector from './EdgeSetIntersector.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport SegmentIntersector from './SegmentIntersector.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport List from '../../../../../java/util/List.js'\nexport default class SimpleMCSweepLineIntersector extends EdgeSetIntersector {\n constructor() {\n super()\n SimpleMCSweepLineIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.events = new ArrayList()\n this.nOverlaps = null\n }\n prepareEvents() {\n Collections.sort(this.events)\n for (let i = 0; i < this.events.size(); i++) {\n const ev = this.events.get(i)\n if (ev.isDelete()) \n ev.getInsertEvent().setDeleteEventIndex(i)\n \n }\n }\n computeIntersections() {\n if (arguments.length === 1) {\n const si = arguments[0]\n this.nOverlaps = 0\n this.prepareEvents()\n for (let i = 0; i < this.events.size(); i++) {\n const ev = this.events.get(i)\n if (ev.isInsert()) \n this.processOverlaps(i, ev.getDeleteEventIndex(), ev, si)\n \n if (si.isDone()) \n break\n \n }\n } else if (arguments.length === 3) {\n if (arguments[2] instanceof SegmentIntersector && (hasInterface(arguments[0], List) && hasInterface(arguments[1], List))) {\n const edges0 = arguments[0], edges1 = arguments[1], si = arguments[2]\n this.addEdges(edges0, edges0)\n this.addEdges(edges1, edges1)\n this.computeIntersections(si)\n } else if (typeof arguments[2] === 'boolean' && (hasInterface(arguments[0], List) && arguments[1] instanceof SegmentIntersector)) {\n const edges = arguments[0], si = arguments[1], testAllSegments = arguments[2]\n if (testAllSegments) this.addEdges(edges, null); else this.addEdges(edges)\n this.computeIntersections(si)\n }\n }\n }\n addEdge(edge, edgeSet) {\n const mce = edge.getMonotoneChainEdge()\n const startIndex = mce.getStartIndexes()\n for (let i = 0; i < startIndex.length - 1; i++) {\n const mc = new MonotoneChain(mce, i)\n const insertEvent = new SweepLineEvent(edgeSet, mce.getMinX(i), mc)\n this.events.add(insertEvent)\n this.events.add(new SweepLineEvent(mce.getMaxX(i), insertEvent))\n }\n }\n processOverlaps(start, end, ev0, si) {\n const mc0 = ev0.getObject()\n for (let i = start; i < end; i++) {\n const ev1 = this.events.get(i)\n if (ev1.isInsert()) {\n const mc1 = ev1.getObject()\n if (!ev0.isSameLabel(ev1)) {\n mc0.computeIntersections(mc1, si)\n this.nOverlaps++\n }\n }\n }\n }\n addEdges() {\n if (arguments.length === 1) {\n const edges = arguments[0]\n for (let i = edges.iterator(); i.hasNext(); ) {\n const edge = i.next()\n this.addEdge(edge, edge)\n }\n } else if (arguments.length === 2) {\n const edges = arguments[0], edgeSet = arguments[1]\n for (let i = edges.iterator(); i.hasNext(); ) {\n const edge = i.next()\n this.addEdge(edge, edgeSet)\n }\n }\n }\n}\n","export default class EdgeSetIntersector {}\n","import WKTWriter from '../../io/WKTWriter.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Double from '../../../../../java/lang/Double.js'\nimport Comparator from '../../../../../java/util/Comparator.js'\nexport default class IntervalRTreeNode {\n constructor() {\n IntervalRTreeNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._min = Double.POSITIVE_INFINITY\n this._max = Double.NEGATIVE_INFINITY\n }\n getMin() {\n return this._min\n }\n intersects(queryMin, queryMax) {\n if (this._min > queryMax || this._max < queryMin) return false\n return true\n }\n getMax() {\n return this._max\n }\n toString() {\n return WKTWriter.toLineString(new Coordinate(this._min, 0), new Coordinate(this._max, 0))\n }\n}\nclass NodeComparator {\n compare(o1, o2) {\n const n1 = o1\n const n2 = o2\n const mid1 = (n1._min + n1._max) / 2\n const mid2 = (n2._min + n2._max) / 2\n if (mid1 < mid2) return -1\n if (mid1 > mid2) return 1\n return 0\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nIntervalRTreeNode.NodeComparator = NodeComparator\n","import IntervalRTreeNode from './IntervalRTreeNode.js'\nexport default class IntervalRTreeLeafNode extends IntervalRTreeNode {\n constructor() {\n super()\n IntervalRTreeLeafNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._item = null\n const min = arguments[0], max = arguments[1], item = arguments[2]\n this._min = min\n this._max = max\n this._item = item\n }\n query(queryMin, queryMax, visitor) {\n if (!this.intersects(queryMin, queryMax)) return null\n visitor.visitItem(this._item)\n }\n}\n","import IntervalRTreeNode from './IntervalRTreeNode.js'\nexport default class IntervalRTreeBranchNode extends IntervalRTreeNode {\n constructor() {\n super()\n IntervalRTreeBranchNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._node1 = null\n this._node2 = null\n const n1 = arguments[0], n2 = arguments[1]\n this._node1 = n1\n this._node2 = n2\n this.buildExtent(this._node1, this._node2)\n }\n buildExtent(n1, n2) {\n this._min = Math.min(n1._min, n2._min)\n this._max = Math.max(n1._max, n2._max)\n }\n query(queryMin, queryMax, visitor) {\n if (!this.intersects(queryMin, queryMax)) \n return null\n \n if (this._node1 !== null) this._node1.query(queryMin, queryMax, visitor)\n if (this._node2 !== null) this._node2.query(queryMin, queryMax, visitor)\n }\n}\n","import WKTWriter from '../../io/WKTWriter.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport IntervalRTreeLeafNode from './IntervalRTreeLeafNode.js'\nimport IntervalRTreeNode from './IntervalRTreeNode.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport System from '../../../../../java/lang/System.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport IntervalRTreeBranchNode from './IntervalRTreeBranchNode.js'\nexport default class SortedPackedIntervalRTree {\n constructor() {\n SortedPackedIntervalRTree.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._leaves = new ArrayList()\n this._root = null\n this._level = 0\n }\n buildTree() {\n Collections.sort(this._leaves, new IntervalRTreeNode.NodeComparator())\n let src = this._leaves\n let temp = null\n let dest = new ArrayList()\n while (true) {\n this.buildLevel(src, dest)\n if (dest.size() === 1) return dest.get(0)\n temp = src\n src = dest\n dest = temp\n }\n }\n insert(min, max, item) {\n if (this._root !== null) throw new IllegalStateException('Index cannot be added to once it has been queried')\n this._leaves.add(new IntervalRTreeLeafNode(min, max, item))\n }\n query(min, max, visitor) {\n this.init()\n if (this._root === null) return null\n this._root.query(min, max, visitor)\n }\n buildRoot() {\n if (this._root !== null) return null\n this._root = this.buildTree()\n }\n printNode(node) {\n System.out.println(WKTWriter.toLineString(new Coordinate(node._min, this._level), new Coordinate(node._max, this._level)))\n }\n init() {\n if (this._root !== null) return null\n if (this._leaves.size() === 0) return null\n this.buildRoot()\n }\n buildLevel(src, dest) {\n this._level++\n dest.clear()\n for (let i = 0; i < src.size(); i += 2) {\n const n1 = src.get(i)\n const n2 = i + 1 < src.size() ? src.get(i) : null\n if (n2 === null) {\n dest.add(n1)\n } else {\n const node = new IntervalRTreeBranchNode(src.get(i), src.get(i + 1))\n dest.add(node)\n }\n }\n }\n}\n","import LineString from '../LineString.js'\nimport Geometry from '../Geometry.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport Collection from '../../../../../java/util/Collection.js'\nimport LinearRing from '../LinearRing.js'\nimport GeometryComponentFilter from '../GeometryComponentFilter.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class LinearComponentExtracter {\n constructor() {\n LinearComponentExtracter.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._lines = null\n this._isForcedToLineString = false\n if (arguments.length === 1) {\n const lines = arguments[0]\n this._lines = lines\n } else if (arguments.length === 2) {\n const lines = arguments[0], isForcedToLineString = arguments[1]\n this._lines = lines\n this._isForcedToLineString = isForcedToLineString\n }\n }\n static getGeometry() {\n if (arguments.length === 1) {\n const geom = arguments[0]\n return geom.getFactory().buildGeometry(LinearComponentExtracter.getLines(geom))\n } else if (arguments.length === 2) {\n const geom = arguments[0], forceToLineString = arguments[1]\n return geom.getFactory().buildGeometry(LinearComponentExtracter.getLines(geom, forceToLineString))\n }\n }\n static getLines() {\n if (arguments.length === 1) {\n const geom = arguments[0]\n return LinearComponentExtracter.getLines(geom, false)\n } else if (arguments.length === 2) {\n if (hasInterface(arguments[0], Collection) && hasInterface(arguments[1], Collection)) {\n const geoms = arguments[0], lines = arguments[1]\n for (let i = geoms.iterator(); i.hasNext(); ) {\n const g = i.next()\n LinearComponentExtracter.getLines(g, lines)\n }\n return lines\n } else if (arguments[0] instanceof Geometry && typeof arguments[1] === 'boolean') {\n const geom = arguments[0], forceToLineString = arguments[1]\n const lines = new ArrayList()\n geom.apply(new LinearComponentExtracter(lines, forceToLineString))\n return lines\n } else if (arguments[0] instanceof Geometry && hasInterface(arguments[1], Collection)) {\n const geom = arguments[0], lines = arguments[1]\n if (geom instanceof LineString) \n lines.add(geom)\n else \n geom.apply(new LinearComponentExtracter(lines))\n \n return lines\n }\n } else if (arguments.length === 3) {\n if (typeof arguments[2] === 'boolean' && (hasInterface(arguments[0], Collection) && hasInterface(arguments[1], Collection))) {\n const geoms = arguments[0], lines = arguments[1], forceToLineString = arguments[2]\n for (let i = geoms.iterator(); i.hasNext(); ) {\n const g = i.next()\n LinearComponentExtracter.getLines(g, lines, forceToLineString)\n }\n return lines\n } else if (typeof arguments[2] === 'boolean' && (arguments[0] instanceof Geometry && hasInterface(arguments[1], Collection))) {\n const geom = arguments[0], lines = arguments[1], forceToLineString = arguments[2]\n geom.apply(new LinearComponentExtracter(lines, forceToLineString))\n return lines\n }\n }\n }\n filter(geom) {\n if (this._isForcedToLineString && geom instanceof LinearRing) {\n const line = geom.getFactory().createLineString(geom.getCoordinateSequence())\n this._lines.add(line)\n return null\n }\n if (geom instanceof LineString) this._lines.add(geom)\n }\n setForceToLineString(isForcedToLineString) {\n this._isForcedToLineString = isForcedToLineString\n }\n get interfaces_() {\n return [GeometryComponentFilter]\n }\n}\n","import ItemVisitor from './ItemVisitor.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class ArrayListVisitor {\n constructor() {\n ArrayListVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._items = new ArrayList()\n }\n visitItem(item) {\n this._items.add(item)\n }\n getItems() {\n return this._items\n }\n get interfaces_() {\n return [ItemVisitor]\n }\n}\n","import hasInterface from '../../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport ItemVisitor from '../../index/ItemVisitor.js'\nimport PointOnGeometryLocator from './PointOnGeometryLocator.js'\nimport LinearRing from '../../geom/LinearRing.js'\nimport SortedPackedIntervalRTree from '../../index/intervalrtree/SortedPackedIntervalRTree.js'\nimport LineSegment from '../../geom/LineSegment.js'\nimport Polygonal from '../../geom/Polygonal.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport LinearComponentExtracter from '../../geom/util/LinearComponentExtracter.js'\nimport ArrayListVisitor from '../../index/ArrayListVisitor.js'\nimport RayCrossingCounter from '../RayCrossingCounter.js'\nexport default class IndexedPointInAreaLocator {\n constructor() {\n IndexedPointInAreaLocator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = null\n this._index = null\n const g = arguments[0]\n if (!(hasInterface(g, Polygonal) || g instanceof LinearRing)) throw new IllegalArgumentException('Argument must be Polygonal or LinearRing')\n this._geom = g\n }\n locate(p) {\n if (this._index === null) {\n this._index = new IntervalIndexedGeometry(this._geom)\n this._geom = null\n }\n const rcc = new RayCrossingCounter(p)\n const visitor = new SegmentVisitor(rcc)\n this._index.query(p.y, p.y, visitor)\n return rcc.getLocation()\n }\n get interfaces_() {\n return [PointOnGeometryLocator]\n }\n}\nclass SegmentVisitor {\n constructor() {\n SegmentVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._counter = null\n const counter = arguments[0]\n this._counter = counter\n }\n visitItem(item) {\n const seg = item\n this._counter.countSegment(seg.getCoordinate(0), seg.getCoordinate(1))\n }\n get interfaces_() {\n return [ItemVisitor]\n }\n}\nclass IntervalIndexedGeometry {\n constructor() {\n IntervalIndexedGeometry.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._isEmpty = false\n this._index = new SortedPackedIntervalRTree()\n const geom = arguments[0]\n if (geom.isEmpty()) this._isEmpty = true; else this.init(geom)\n }\n init(geom) {\n const lines = LinearComponentExtracter.getLines(geom)\n for (let i = lines.iterator(); i.hasNext(); ) {\n const line = i.next()\n const pts = line.getCoordinates()\n this.addLine(pts)\n }\n }\n addLine(pts) {\n for (let i = 1; i < pts.length; i++) {\n const seg = new LineSegment(pts[i - 1], pts[i])\n const min = Math.min(seg.p0.y, seg.p1.y)\n const max = Math.max(seg.p0.y, seg.p1.y)\n this._index.insert(min, max, seg)\n }\n }\n query() {\n if (arguments.length === 2) {\n const min = arguments[0], max = arguments[1]\n if (this._isEmpty) return new ArrayList()\n const visitor = new ArrayListVisitor()\n this._index.query(min, max, visitor)\n return visitor.getItems()\n } else if (arguments.length === 3) {\n const min = arguments[0], max = arguments[1], visitor = arguments[2]\n if (this._isEmpty) return null\n this._index.query(min, max, visitor)\n }\n }\n}\nIndexedPointInAreaLocator.SegmentVisitor = SegmentVisitor\nIndexedPointInAreaLocator.IntervalIndexedGeometry = IntervalIndexedGeometry\n","import PointLocator from '../algorithm/PointLocator.js'\nimport Location from '../geom/Location.js'\nimport LineString from '../geom/LineString.js'\nimport HashMap from '../../../../java/util/HashMap.js'\nimport Geometry from '../geom/Geometry.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Position from './Position.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Point from '../geom/Point.js'\nimport Polygon from '../geom/Polygon.js'\nimport MultiPoint from '../geom/MultiPoint.js'\nimport SimpleMCSweepLineIntersector from './index/SimpleMCSweepLineIntersector.js'\nimport LinearRing from '../geom/LinearRing.js'\nimport BoundaryNodeRule from '../algorithm/BoundaryNodeRule.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport SegmentIntersector from './index/SegmentIntersector.js'\nimport MultiPolygon from '../geom/MultiPolygon.js'\nimport Label from './Label.js'\nimport GeometryCollection from '../geom/GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport CoordinateArrays from '../geom/CoordinateArrays.js'\nimport Polygonal from '../geom/Polygonal.js'\nimport IndexedPointInAreaLocator from '../algorithm/locate/IndexedPointInAreaLocator.js'\nimport Assert from '../util/Assert.js'\nimport Edge from './Edge.js'\nimport MultiLineString from '../geom/MultiLineString.js'\nimport PlanarGraph from './PlanarGraph.js'\nexport default class GeometryGraph extends PlanarGraph {\n constructor() {\n super()\n GeometryGraph.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._parentGeom = null\n this._lineEdgeMap = new HashMap()\n this._boundaryNodeRule = null\n this._useBoundaryDeterminationRule = true\n this._argIndex = null\n this._boundaryNodes = null\n this._hasTooFewPoints = false\n this._invalidPoint = null\n this._areaPtLocator = null\n this._ptLocator = new PointLocator()\n if (arguments.length === 2) {\n const argIndex = arguments[0], parentGeom = arguments[1]\n GeometryGraph.constructor_.call(this, argIndex, parentGeom, BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE)\n } else if (arguments.length === 3) {\n const argIndex = arguments[0], parentGeom = arguments[1], boundaryNodeRule = arguments[2]\n this._argIndex = argIndex\n this._parentGeom = parentGeom\n this._boundaryNodeRule = boundaryNodeRule\n if (parentGeom !== null) \n this.add(parentGeom)\n \n }\n }\n static determineBoundary(boundaryNodeRule, boundaryCount) {\n return boundaryNodeRule.isInBoundary(boundaryCount) ? Location.BOUNDARY : Location.INTERIOR\n }\n insertBoundaryPoint(argIndex, coord) {\n const n = this._nodes.addNode(coord)\n const lbl = n.getLabel()\n let boundaryCount = 1\n let loc = Location.NONE\n loc = lbl.getLocation(argIndex, Position.ON)\n if (loc === Location.BOUNDARY) boundaryCount++\n const newLoc = GeometryGraph.determineBoundary(this._boundaryNodeRule, boundaryCount)\n lbl.setLocation(argIndex, newLoc)\n }\n computeSelfNodes() {\n if (arguments.length === 2) {\n const li = arguments[0], computeRingSelfNodes = arguments[1]\n return this.computeSelfNodes(li, computeRingSelfNodes, false)\n } else if (arguments.length === 3) {\n const li = arguments[0], computeRingSelfNodes = arguments[1], isDoneIfProperInt = arguments[2]\n const si = new SegmentIntersector(li, true, false)\n si.setIsDoneIfProperInt(isDoneIfProperInt)\n const esi = this.createEdgeSetIntersector()\n const isRings = this._parentGeom instanceof LinearRing || this._parentGeom instanceof Polygon || this._parentGeom instanceof MultiPolygon\n const computeAllSegments = computeRingSelfNodes || !isRings\n esi.computeIntersections(this._edges, si, computeAllSegments)\n this.addSelfIntersectionNodes(this._argIndex)\n return si\n }\n }\n computeSplitEdges(edgelist) {\n for (let i = this._edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n e.eiList.addSplitEdges(edgelist)\n }\n }\n computeEdgeIntersections(g, li, includeProper) {\n const si = new SegmentIntersector(li, includeProper, true)\n si.setBoundaryNodes(this.getBoundaryNodes(), g.getBoundaryNodes())\n const esi = this.createEdgeSetIntersector()\n esi.computeIntersections(this._edges, g._edges, si)\n return si\n }\n getGeometry() {\n return this._parentGeom\n }\n getBoundaryNodeRule() {\n return this._boundaryNodeRule\n }\n hasTooFewPoints() {\n return this._hasTooFewPoints\n }\n addPoint() {\n if (arguments[0] instanceof Point) {\n const p = arguments[0]\n const coord = p.getCoordinate()\n this.insertPoint(this._argIndex, coord, Location.INTERIOR)\n } else if (arguments[0] instanceof Coordinate) {\n const pt = arguments[0]\n this.insertPoint(this._argIndex, pt, Location.INTERIOR)\n }\n }\n addPolygon(p) {\n this.addPolygonRing(p.getExteriorRing(), Location.EXTERIOR, Location.INTERIOR)\n for (let i = 0; i < p.getNumInteriorRing(); i++) {\n const hole = p.getInteriorRingN(i)\n this.addPolygonRing(hole, Location.INTERIOR, Location.EXTERIOR)\n }\n }\n addEdge(e) {\n this.insertEdge(e)\n const coord = e.getCoordinates()\n this.insertPoint(this._argIndex, coord[0], Location.BOUNDARY)\n this.insertPoint(this._argIndex, coord[coord.length - 1], Location.BOUNDARY)\n }\n addLineString(line) {\n const coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates())\n if (coord.length < 2) {\n this._hasTooFewPoints = true\n this._invalidPoint = coord[0]\n return null\n }\n const e = new Edge(coord, new Label(this._argIndex, Location.INTERIOR))\n this._lineEdgeMap.put(line, e)\n this.insertEdge(e)\n Assert.isTrue(coord.length >= 2, 'found LineString with single point')\n this.insertBoundaryPoint(this._argIndex, coord[0])\n this.insertBoundaryPoint(this._argIndex, coord[coord.length - 1])\n }\n getInvalidPoint() {\n return this._invalidPoint\n }\n getBoundaryPoints() {\n const coll = this.getBoundaryNodes()\n const pts = new Array(coll.size()).fill(null)\n let i = 0\n for (let it = coll.iterator(); it.hasNext(); ) {\n const node = it.next()\n pts[i++] = node.getCoordinate().copy()\n }\n return pts\n }\n getBoundaryNodes() {\n if (this._boundaryNodes === null) this._boundaryNodes = this._nodes.getBoundaryNodes(this._argIndex)\n return this._boundaryNodes\n }\n addSelfIntersectionNode(argIndex, coord, loc) {\n if (this.isBoundaryNode(argIndex, coord)) return null\n if (loc === Location.BOUNDARY && this._useBoundaryDeterminationRule) this.insertBoundaryPoint(argIndex, coord); else this.insertPoint(argIndex, coord, loc)\n }\n addPolygonRing(lr, cwLeft, cwRight) {\n if (lr.isEmpty()) return null\n const coord = CoordinateArrays.removeRepeatedPoints(lr.getCoordinates())\n if (coord.length < 4) {\n this._hasTooFewPoints = true\n this._invalidPoint = coord[0]\n return null\n }\n let left = cwLeft\n let right = cwRight\n if (Orientation.isCCW(coord)) {\n left = cwRight\n right = cwLeft\n }\n const e = new Edge(coord, new Label(this._argIndex, Location.BOUNDARY, left, right))\n this._lineEdgeMap.put(lr, e)\n this.insertEdge(e)\n this.insertPoint(this._argIndex, coord[0], Location.BOUNDARY)\n }\n insertPoint(argIndex, coord, onLocation) {\n const n = this._nodes.addNode(coord)\n const lbl = n.getLabel()\n if (lbl === null) \n n._label = new Label(argIndex, onLocation)\n else lbl.setLocation(argIndex, onLocation)\n }\n createEdgeSetIntersector() {\n return new SimpleMCSweepLineIntersector()\n }\n addSelfIntersectionNodes(argIndex) {\n for (let i = this._edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n const eLoc = e.getLabel().getLocation(argIndex)\n for (let eiIt = e.eiList.iterator(); eiIt.hasNext(); ) {\n const ei = eiIt.next()\n this.addSelfIntersectionNode(argIndex, ei.coord, eLoc)\n }\n }\n }\n add() {\n if (arguments.length === 1 && arguments[0] instanceof Geometry) {\n const g = arguments[0]\n if (g.isEmpty()) return null\n if (g instanceof MultiPolygon) this._useBoundaryDeterminationRule = false\n if (g instanceof Polygon) this.addPolygon(g); else if (g instanceof LineString) this.addLineString(g); else if (g instanceof Point) this.addPoint(g); else if (g instanceof MultiPoint) this.addCollection(g); else if (g instanceof MultiLineString) this.addCollection(g); else if (g instanceof MultiPolygon) this.addCollection(g); else if (g instanceof GeometryCollection) this.addCollection(g); else throw new UnsupportedOperationException(g.getGeometryType())\n } else {\n return super.add.apply(this, arguments)\n }\n }\n addCollection(gc) {\n for (let i = 0; i < gc.getNumGeometries(); i++) {\n const g = gc.getGeometryN(i)\n this.add(g)\n }\n }\n locate(pt) {\n if (hasInterface(this._parentGeom, Polygonal) && this._parentGeom.getNumGeometries() > 50) {\n if (this._areaPtLocator === null) \n this._areaPtLocator = new IndexedPointInAreaLocator(this._parentGeom)\n \n return this._areaPtLocator.locate(pt)\n }\n return this._ptLocator.locate(pt, this._parentGeom)\n }\n findEdge() {\n if (arguments.length === 1 && arguments[0] instanceof LineString) {\n const line = arguments[0]\n return this._lineEdgeMap.get(line)\n } else {\n return super.findEdge.apply(this, arguments)\n }\n }\n}\n","import BoundaryNodeRule from '../algorithm/BoundaryNodeRule.js'\nimport GeometryGraph from '../geomgraph/GeometryGraph.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nexport default class GeometryGraphOperation {\n constructor() {\n GeometryGraphOperation.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._resultPrecisionModel = null\n this._arg = null\n if (arguments.length === 1) {\n const g0 = arguments[0]\n this.setComputationPrecision(g0.getPrecisionModel())\n this._arg = new Array(1).fill(null)\n this._arg[0] = new GeometryGraph(0, g0)\n \n } else if (arguments.length === 2) {\n const g0 = arguments[0], g1 = arguments[1]\n GeometryGraphOperation.constructor_.call(this, g0, g1, BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE)\n } else if (arguments.length === 3) {\n const g0 = arguments[0], g1 = arguments[1], boundaryNodeRule = arguments[2]\n if (g0.getPrecisionModel().compareTo(g1.getPrecisionModel()) >= 0) this.setComputationPrecision(g0.getPrecisionModel()); else this.setComputationPrecision(g1.getPrecisionModel())\n this._arg = new Array(2).fill(null)\n this._arg[0] = new GeometryGraph(0, g0, boundaryNodeRule)\n this._arg[1] = new GeometryGraph(1, g1, boundaryNodeRule)\n }\n }\n getArgGeometry(i) {\n return this._arg[i].getGeometry()\n }\n setComputationPrecision(pm) {\n this._resultPrecisionModel = pm\n this._li.setPrecisionModel(this._resultPrecisionModel)\n }\n}\n","import PointLocator from '../../algorithm/PointLocator.js'\nimport Location from '../../geom/Location.js'\nimport EdgeNodingValidator from '../../geomgraph/EdgeNodingValidator.js'\nimport GeometryCollectionMapper from '../../geom/util/GeometryCollectionMapper.js'\nimport PolygonBuilder from './PolygonBuilder.js'\nimport Position from '../../geomgraph/Position.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport LineBuilder from './LineBuilder.js'\nimport PointBuilder from './PointBuilder.js'\nimport SnapIfNeededOverlayOp from './snap/SnapIfNeededOverlayOp.js'\nimport Label from '../../geomgraph/Label.js'\nimport OverlayNodeFactory from './OverlayNodeFactory.js'\nimport GeometryGraphOperation from '../GeometryGraphOperation.js'\nimport EdgeList from '../../geomgraph/EdgeList.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Assert from '../../util/Assert.js'\nimport PlanarGraph from '../../geomgraph/PlanarGraph.js'\nexport default class OverlayOp extends GeometryGraphOperation {\n constructor() {\n super()\n OverlayOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._ptLocator = new PointLocator()\n this._geomFact = null\n this._resultGeom = null\n this._graph = null\n this._edgeList = new EdgeList()\n this._resultPolyList = new ArrayList()\n this._resultLineList = new ArrayList()\n this._resultPointList = new ArrayList()\n const g0 = arguments[0], g1 = arguments[1]\n GeometryGraphOperation.constructor_.call(this, g0, g1)\n this._graph = new PlanarGraph(new OverlayNodeFactory())\n this._geomFact = g0.getFactory()\n }\n static overlayOp(geom0, geom1, opCode) {\n const gov = new OverlayOp(geom0, geom1)\n const geomOv = gov.getResultGeometry(opCode)\n return geomOv\n }\n static union(geom, other) {\n if (geom.isEmpty() || other.isEmpty()) {\n if (geom.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, geom, other, geom.getFactory())\n if (geom.isEmpty()) return other.copy()\n if (other.isEmpty()) return geom.copy()\n }\n if (geom.isGeometryCollection() || other.isGeometryCollection()) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.UNION)\n }\n static intersection(geom, other) {\n if (geom.isEmpty() || other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.INTERSECTION, geom, other, geom.getFactory())\n if (geom.isGeometryCollection()) {\n const g2 = other\n return GeometryCollectionMapper.map(geom, new (class {\n get interfaces_() {\n return [MapOp]\n }\n map(g) {\n return OverlayOp.intersection(g, g2)\n }\n })())\n }\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.INTERSECTION)\n }\n static symDifference(geom, other) {\n if (geom.isEmpty() || other.isEmpty()) {\n if (geom.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.SYMDIFFERENCE, geom, other, geom.getFactory())\n if (geom.isEmpty()) return other.copy()\n if (other.isEmpty()) return geom.copy()\n }\n if (geom.isGeometryCollection() || other.isGeometryCollection()) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.SYMDIFFERENCE)\n }\n static resultDimension(opCode, g0, g1) {\n const dim0 = g0.getDimension()\n const dim1 = g1.getDimension()\n let resultDimension = -1\n switch (opCode) {\n case OverlayOp.INTERSECTION:\n resultDimension = Math.min(dim0, dim1)\n break\n case OverlayOp.UNION:\n resultDimension = Math.max(dim0, dim1)\n break\n case OverlayOp.DIFFERENCE:\n resultDimension = dim0\n break\n case OverlayOp.SYMDIFFERENCE:\n resultDimension = Math.max(dim0, dim1)\n break\n }\n return resultDimension\n }\n static createEmptyResult(overlayOpCode, a, b, geomFact) {\n let result = null\n const resultDim = OverlayOp.resultDimension(overlayOpCode, a, b)\n return result = geomFact.createEmpty(resultDim)\n }\n static difference(geom, other) {\n if (geom.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.DIFFERENCE, geom, other, geom.getFactory())\n if (other.isEmpty()) return geom.copy()\n if (geom.isGeometryCollection() || other.isGeometryCollection()) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.DIFFERENCE)\n }\n static isResultOfOp() {\n if (arguments.length === 2) {\n const label = arguments[0], opCode = arguments[1]\n const loc0 = label.getLocation(0)\n const loc1 = label.getLocation(1)\n return OverlayOp.isResultOfOp(loc0, loc1, opCode)\n } else if (arguments.length === 3) {\n let loc0 = arguments[0], loc1 = arguments[1], overlayOpCode = arguments[2]\n if (loc0 === Location.BOUNDARY) loc0 = Location.INTERIOR\n if (loc1 === Location.BOUNDARY) loc1 = Location.INTERIOR\n switch (overlayOpCode) {\n case OverlayOp.INTERSECTION:\n return loc0 === Location.INTERIOR && loc1 === Location.INTERIOR\n case OverlayOp.UNION:\n return loc0 === Location.INTERIOR || loc1 === Location.INTERIOR\n case OverlayOp.DIFFERENCE:\n return loc0 === Location.INTERIOR && loc1 !== Location.INTERIOR\n case OverlayOp.SYMDIFFERENCE:\n return loc0 === Location.INTERIOR && loc1 !== Location.INTERIOR || loc0 !== Location.INTERIOR && loc1 === Location.INTERIOR\n }\n return false\n }\n }\n insertUniqueEdge(e) {\n const existingEdge = this._edgeList.findEqualEdge(e)\n if (existingEdge !== null) {\n const existingLabel = existingEdge.getLabel()\n let labelToMerge = e.getLabel()\n if (!existingEdge.isPointwiseEqual(e)) {\n labelToMerge = new Label(e.getLabel())\n labelToMerge.flip()\n }\n const depth = existingEdge.getDepth()\n if (depth.isNull()) \n depth.add(existingLabel)\n \n depth.add(labelToMerge)\n existingLabel.merge(labelToMerge)\n } else {\n this._edgeList.add(e)\n }\n }\n getGraph() {\n return this._graph\n }\n cancelDuplicateResultEdges() {\n for (let it = this._graph.getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n const sym = de.getSym()\n if (de.isInResult() && sym.isInResult()) {\n de.setInResult(false)\n sym.setInResult(false)\n }\n }\n }\n isCoveredByLA(coord) {\n if (this.isCovered(coord, this._resultLineList)) return true\n if (this.isCovered(coord, this._resultPolyList)) return true\n return false\n }\n computeGeometry(resultPointList, resultLineList, resultPolyList, opcode) {\n const geomList = new ArrayList()\n geomList.addAll(resultPointList)\n geomList.addAll(resultLineList)\n geomList.addAll(resultPolyList)\n if (geomList.isEmpty()) return OverlayOp.createEmptyResult(opcode, this._arg[0].getGeometry(), this._arg[1].getGeometry(), this._geomFact)\n return this._geomFact.buildGeometry(geomList)\n }\n mergeSymLabels() {\n for (let nodeit = this._graph.getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().mergeSymLabels()\n }\n }\n isCovered(coord, geomList) {\n for (let it = geomList.iterator(); it.hasNext(); ) {\n const geom = it.next()\n const loc = this._ptLocator.locate(coord, geom)\n if (loc !== Location.EXTERIOR) return true\n }\n return false\n }\n replaceCollapsedEdges() {\n const newEdges = new ArrayList()\n for (let it = this._edgeList.iterator(); it.hasNext(); ) {\n const e = it.next()\n if (e.isCollapsed()) {\n it.remove()\n newEdges.add(e.getCollapsedEdge())\n }\n }\n this._edgeList.addAll(newEdges)\n }\n updateNodeLabelling() {\n for (let nodeit = this._graph.getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n const lbl = node.getEdges().getLabel()\n node.getLabel().merge(lbl)\n }\n }\n getResultGeometry(overlayOpCode) {\n this.computeOverlay(overlayOpCode)\n return this._resultGeom\n }\n insertUniqueEdges(edges) {\n for (let i = edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n this.insertUniqueEdge(e)\n }\n }\n computeOverlay(opCode) {\n this.copyPoints(0)\n this.copyPoints(1)\n this._arg[0].computeSelfNodes(this._li, false)\n this._arg[1].computeSelfNodes(this._li, false)\n this._arg[0].computeEdgeIntersections(this._arg[1], this._li, true)\n const baseSplitEdges = new ArrayList()\n this._arg[0].computeSplitEdges(baseSplitEdges)\n this._arg[1].computeSplitEdges(baseSplitEdges)\n const splitEdges = baseSplitEdges\n this.insertUniqueEdges(baseSplitEdges)\n this.computeLabelsFromDepths()\n this.replaceCollapsedEdges()\n EdgeNodingValidator.checkValid(this._edgeList.getEdges())\n this._graph.addEdges(this._edgeList.getEdges())\n this.computeLabelling()\n this.labelIncompleteNodes()\n this.findResultAreaEdges(opCode)\n this.cancelDuplicateResultEdges()\n const polyBuilder = new PolygonBuilder(this._geomFact)\n polyBuilder.add(this._graph)\n this._resultPolyList = polyBuilder.getPolygons()\n const lineBuilder = new LineBuilder(this, this._geomFact, this._ptLocator)\n this._resultLineList = lineBuilder.build(opCode)\n const pointBuilder = new PointBuilder(this, this._geomFact, this._ptLocator)\n this._resultPointList = pointBuilder.build(opCode)\n this._resultGeom = this.computeGeometry(this._resultPointList, this._resultLineList, this._resultPolyList, opCode)\n }\n labelIncompleteNode(n, targetIndex) {\n const loc = this._ptLocator.locate(n.getCoordinate(), this._arg[targetIndex].getGeometry())\n n.getLabel().setLocation(targetIndex, loc)\n }\n copyPoints(argIndex) {\n for (let i = this._arg[argIndex].getNodeIterator(); i.hasNext(); ) {\n const graphNode = i.next()\n const newNode = this._graph.addNode(graphNode.getCoordinate())\n newNode.setLabel(argIndex, graphNode.getLabel().getLocation(argIndex))\n }\n }\n findResultAreaEdges(opCode) {\n for (let it = this._graph.getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n const label = de.getLabel()\n if (label.isArea() && !de.isInteriorAreaEdge() && OverlayOp.isResultOfOp(label.getLocation(0, Position.RIGHT), label.getLocation(1, Position.RIGHT), opCode)) \n de.setInResult(true)\n \n }\n }\n computeLabelsFromDepths() {\n for (let it = this._edgeList.iterator(); it.hasNext(); ) {\n const e = it.next()\n const lbl = e.getLabel()\n const depth = e.getDepth()\n if (!depth.isNull()) {\n depth.normalize()\n for (let i = 0; i < 2; i++) \n if (!lbl.isNull(i) && lbl.isArea() && !depth.isNull(i)) \n if (depth.getDelta(i) === 0) {\n lbl.toLine(i)\n } else {\n Assert.isTrue(!depth.isNull(i, Position.LEFT), 'depth of LEFT side has not been initialized')\n lbl.setLocation(i, Position.LEFT, depth.getLocation(i, Position.LEFT))\n Assert.isTrue(!depth.isNull(i, Position.RIGHT), 'depth of RIGHT side has not been initialized')\n lbl.setLocation(i, Position.RIGHT, depth.getLocation(i, Position.RIGHT))\n }\n \n \n }\n }\n }\n computeLabelling() {\n for (let nodeit = this._graph.getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().computeLabelling(this._arg)\n }\n this.mergeSymLabels()\n this.updateNodeLabelling()\n }\n labelIncompleteNodes() {\n for (let ni = this._graph.getNodes().iterator(); ni.hasNext(); ) {\n const n = ni.next()\n const label = n.getLabel()\n if (n.isIsolated()) \n if (label.isNull(0)) this.labelIncompleteNode(n, 0); else this.labelIncompleteNode(n, 1)\n \n n.getEdges().updateLabelling(label)\n }\n }\n isCoveredByA(coord) {\n if (this.isCovered(coord, this._resultPolyList)) return true\n return false\n }\n}\nOverlayOp.INTERSECTION = 1\nOverlayOp.UNION = 2\nOverlayOp.DIFFERENCE = 3\nOverlayOp.SYMDIFFERENCE = 4\n","import EdgeEnd from '../../geomgraph/EdgeEnd.js'\nimport Label from '../../geomgraph/Label.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class EdgeEndBuilder {\n createEdgeEndForNext(edge, l, eiCurr, eiNext) {\n const iNext = eiCurr.segmentIndex + 1\n if (iNext >= edge.getNumPoints() && eiNext === null) return null\n let pNext = edge.getCoordinate(iNext)\n if (eiNext !== null && eiNext.segmentIndex === eiCurr.segmentIndex) pNext = eiNext.coord\n const e = new EdgeEnd(edge, eiCurr.coord, pNext, new Label(edge.getLabel()))\n l.add(e)\n }\n createEdgeEndForPrev(edge, l, eiCurr, eiPrev) {\n let iPrev = eiCurr.segmentIndex\n if (eiCurr.dist === 0.0) {\n if (iPrev === 0) return null\n iPrev--\n }\n let pPrev = edge.getCoordinate(iPrev)\n if (eiPrev !== null && eiPrev.segmentIndex >= iPrev) pPrev = eiPrev.coord\n const label = new Label(edge.getLabel())\n label.flip()\n const e = new EdgeEnd(edge, eiCurr.coord, pPrev, label)\n l.add(e)\n }\n computeEdgeEnds() {\n if (arguments.length === 1) {\n const edges = arguments[0]\n const l = new ArrayList()\n for (let i = edges; i.hasNext(); ) {\n const e = i.next()\n this.computeEdgeEnds(e, l)\n }\n return l\n } else if (arguments.length === 2) {\n const edge = arguments[0], l = arguments[1]\n const eiList = edge.getEdgeIntersectionList()\n eiList.addEndpoints()\n const it = eiList.iterator()\n let eiPrev = null\n let eiCurr = null\n if (!it.hasNext()) return null\n let eiNext = it.next()\n do {\n eiPrev = eiCurr\n eiCurr = eiNext\n eiNext = null\n if (it.hasNext()) eiNext = it.next()\n if (eiCurr !== null) {\n this.createEdgeEndForPrev(edge, l, eiCurr, eiPrev)\n this.createEdgeEndForNext(edge, l, eiCurr, eiNext)\n }\n } while (eiCurr !== null)\n }\n }\n}\n","import Location from '../../geom/Location.js'\nimport EdgeEnd from '../../geomgraph/EdgeEnd.js'\nimport Position from '../../geomgraph/Position.js'\nimport GeometryGraph from '../../geomgraph/GeometryGraph.js'\nimport Label from '../../geomgraph/Label.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Edge from '../../geomgraph/Edge.js'\nexport default class EdgeEndBundle extends EdgeEnd {\n constructor() {\n super()\n EdgeEndBundle.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edgeEnds = new ArrayList()\n if (arguments.length === 1) {\n const e = arguments[0]\n EdgeEndBundle.constructor_.call(this, null, e)\n } else if (arguments.length === 2) {\n const boundaryNodeRule = arguments[0], e = arguments[1]\n EdgeEnd.constructor_.call(this, e.getEdge(), e.getCoordinate(), e.getDirectedCoordinate(), new Label(e.getLabel()))\n this.insert(e)\n }\n }\n insert(e) {\n this._edgeEnds.add(e)\n }\n print(out) {\n out.println('EdgeEndBundle--> Label: ' + this._label)\n for (let it = this.iterator(); it.hasNext(); ) {\n const ee = it.next()\n ee.print(out)\n out.println()\n }\n }\n iterator() {\n return this._edgeEnds.iterator()\n }\n getEdgeEnds() {\n return this._edgeEnds\n }\n computeLabelOn(geomIndex, boundaryNodeRule) {\n let boundaryCount = 0\n let foundInterior = false\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const loc = e.getLabel().getLocation(geomIndex)\n if (loc === Location.BOUNDARY) boundaryCount++\n if (loc === Location.INTERIOR) foundInterior = true\n }\n let loc = Location.NONE\n if (foundInterior) loc = Location.INTERIOR\n if (boundaryCount > 0) \n loc = GeometryGraph.determineBoundary(boundaryNodeRule, boundaryCount)\n \n this._label.setLocation(geomIndex, loc)\n }\n computeLabelSide(geomIndex, side) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n if (e.getLabel().isArea()) {\n const loc = e.getLabel().getLocation(geomIndex, side)\n if (loc === Location.INTERIOR) {\n this._label.setLocation(geomIndex, side, Location.INTERIOR)\n return null\n } else if (loc === Location.EXTERIOR) {\n this._label.setLocation(geomIndex, side, Location.EXTERIOR)\n }\n }\n }\n }\n getLabel() {\n return this._label\n }\n computeLabelSides(geomIndex) {\n this.computeLabelSide(geomIndex, Position.LEFT)\n this.computeLabelSide(geomIndex, Position.RIGHT)\n }\n updateIM(im) {\n Edge.updateIM(this._label, im)\n }\n computeLabel(boundaryNodeRule) {\n let isArea = false\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n if (e.getLabel().isArea()) isArea = true\n }\n if (isArea) this._label = new Label(Location.NONE, Location.NONE, Location.NONE); else this._label = new Label(Location.NONE)\n for (let i = 0; i < 2; i++) {\n this.computeLabelOn(i, boundaryNodeRule)\n if (isArea) this.computeLabelSides(i)\n }\n }\n}\n","import EdgeEndStar from '../../geomgraph/EdgeEndStar.js'\nimport EdgeEndBundle from './EdgeEndBundle.js'\nexport default class EdgeEndBundleStar extends EdgeEndStar {\n constructor() {\n super()\n }\n updateIM(im) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const esb = it.next()\n esb.updateIM(im)\n }\n }\n insert(e) {\n let eb = this._edgeMap.get(e)\n if (eb === null) {\n eb = new EdgeEndBundle(e)\n this.insertEdgeEnd(e, eb)\n } else {\n eb.insert(e)\n }\n }\n}\n","import Node from '../../geomgraph/Node.js'\nexport default class RelateNode extends Node {\n constructor() {\n super()\n RelateNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const coord = arguments[0], edges = arguments[1]\n Node.constructor_.call(this, coord, edges)\n }\n updateIMFromEdges(im) {\n this._edges.updateIM(im)\n }\n computeIM(im) {\n im.setAtLeastIfValid(this._label.getLocation(0), this._label.getLocation(1), 0)\n }\n}\n","import EdgeEndBundleStar from './EdgeEndBundleStar.js'\nimport RelateNode from './RelateNode.js'\nimport NodeFactory from '../../geomgraph/NodeFactory.js'\nexport default class RelateNodeFactory extends NodeFactory {\n constructor() {\n super()\n }\n createNode(coord) {\n return new RelateNode(coord, new EdgeEndBundleStar())\n }\n}\n","import PointLocator from '../../algorithm/PointLocator.js'\nimport Location from '../../geom/Location.js'\nimport IntersectionMatrix from '../../geom/IntersectionMatrix.js'\nimport EdgeEndBuilder from './EdgeEndBuilder.js'\nimport NodeMap from '../../geomgraph/NodeMap.js'\nimport RelateNodeFactory from './RelateNodeFactory.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nimport Assert from '../../util/Assert.js'\nexport default class RelateComputer {\n constructor() {\n RelateComputer.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._ptLocator = new PointLocator()\n this._arg = null\n this._nodes = new NodeMap(new RelateNodeFactory())\n this._im = null\n this._isolatedEdges = new ArrayList()\n this._invalidPoint = null\n const arg = arguments[0]\n this._arg = arg\n }\n insertEdgeEnds(ee) {\n for (let i = ee.iterator(); i.hasNext(); ) {\n const e = i.next()\n this._nodes.add(e)\n }\n }\n computeProperIntersectionIM(intersector, im) {\n const dimA = this._arg[0].getGeometry().getDimension()\n const dimB = this._arg[1].getGeometry().getDimension()\n const hasProper = intersector.hasProperIntersection()\n const hasProperInterior = intersector.hasProperInteriorIntersection()\n if (dimA === 2 && dimB === 2) {\n if (hasProper) im.setAtLeast('212101212')\n } else if (dimA === 2 && dimB === 1) {\n if (hasProper) im.setAtLeast('FFF0FFFF2')\n if (hasProperInterior) im.setAtLeast('1FFFFF1FF')\n } else if (dimA === 1 && dimB === 2) {\n if (hasProper) im.setAtLeast('F0FFFFFF2')\n if (hasProperInterior) im.setAtLeast('1F1FFFFFF')\n } else if (dimA === 1 && dimB === 1) {\n if (hasProperInterior) im.setAtLeast('0FFFFFFFF')\n }\n }\n labelIsolatedEdges(thisIndex, targetIndex) {\n for (let ei = this._arg[thisIndex].getEdgeIterator(); ei.hasNext(); ) {\n const e = ei.next()\n if (e.isIsolated()) {\n this.labelIsolatedEdge(e, targetIndex, this._arg[targetIndex].getGeometry())\n this._isolatedEdges.add(e)\n }\n }\n }\n labelIsolatedEdge(e, targetIndex, target) {\n if (target.getDimension() > 0) {\n const loc = this._ptLocator.locate(e.getCoordinate(), target)\n e.getLabel().setAllLocations(targetIndex, loc)\n } else {\n e.getLabel().setAllLocations(targetIndex, Location.EXTERIOR)\n }\n }\n computeIM() {\n const im = new IntersectionMatrix()\n im.set(Location.EXTERIOR, Location.EXTERIOR, 2)\n if (!this._arg[0].getGeometry().getEnvelopeInternal().intersects(this._arg[1].getGeometry().getEnvelopeInternal())) {\n this.computeDisjointIM(im)\n return im\n }\n this._arg[0].computeSelfNodes(this._li, false)\n this._arg[1].computeSelfNodes(this._li, false)\n const intersector = this._arg[0].computeEdgeIntersections(this._arg[1], this._li, false)\n this.computeIntersectionNodes(0)\n this.computeIntersectionNodes(1)\n this.copyNodesAndLabels(0)\n this.copyNodesAndLabels(1)\n this.labelIsolatedNodes()\n this.computeProperIntersectionIM(intersector, im)\n const eeBuilder = new EdgeEndBuilder()\n const ee0 = eeBuilder.computeEdgeEnds(this._arg[0].getEdgeIterator())\n this.insertEdgeEnds(ee0)\n const ee1 = eeBuilder.computeEdgeEnds(this._arg[1].getEdgeIterator())\n this.insertEdgeEnds(ee1)\n this.labelNodeEdges()\n this.labelIsolatedEdges(0, 1)\n this.labelIsolatedEdges(1, 0)\n this.updateIM(im)\n return im\n }\n labelNodeEdges() {\n for (let ni = this._nodes.iterator(); ni.hasNext(); ) {\n const node = ni.next()\n node.getEdges().computeLabelling(this._arg)\n }\n }\n copyNodesAndLabels(argIndex) {\n for (let i = this._arg[argIndex].getNodeIterator(); i.hasNext(); ) {\n const graphNode = i.next()\n const newNode = this._nodes.addNode(graphNode.getCoordinate())\n newNode.setLabel(argIndex, graphNode.getLabel().getLocation(argIndex))\n }\n }\n labelIntersectionNodes(argIndex) {\n for (let i = this._arg[argIndex].getEdgeIterator(); i.hasNext(); ) {\n const e = i.next()\n const eLoc = e.getLabel().getLocation(argIndex)\n for (let eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {\n const ei = eiIt.next()\n const n = this._nodes.find(ei.coord)\n if (n.getLabel().isNull(argIndex)) \n if (eLoc === Location.BOUNDARY) n.setLabelBoundary(argIndex); else n.setLabel(argIndex, Location.INTERIOR)\n \n }\n }\n }\n labelIsolatedNode(n, targetIndex) {\n const loc = this._ptLocator.locate(n.getCoordinate(), this._arg[targetIndex].getGeometry())\n n.getLabel().setAllLocations(targetIndex, loc)\n }\n computeIntersectionNodes(argIndex) {\n for (let i = this._arg[argIndex].getEdgeIterator(); i.hasNext(); ) {\n const e = i.next()\n const eLoc = e.getLabel().getLocation(argIndex)\n for (let eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {\n const ei = eiIt.next()\n const n = this._nodes.addNode(ei.coord)\n if (eLoc === Location.BOUNDARY) n.setLabelBoundary(argIndex); else \n if (n.getLabel().isNull(argIndex)) n.setLabel(argIndex, Location.INTERIOR)\n \n }\n }\n }\n labelIsolatedNodes() {\n for (let ni = this._nodes.iterator(); ni.hasNext(); ) {\n const n = ni.next()\n const label = n.getLabel()\n Assert.isTrue(label.getGeometryCount() > 0, 'node with empty label found')\n if (n.isIsolated()) \n if (label.isNull(0)) this.labelIsolatedNode(n, 0); else this.labelIsolatedNode(n, 1)\n \n }\n }\n updateIM(im) {\n for (let ei = this._isolatedEdges.iterator(); ei.hasNext(); ) {\n const e = ei.next()\n e.updateIM(im)\n }\n for (let ni = this._nodes.iterator(); ni.hasNext(); ) {\n const node = ni.next()\n node.updateIM(im)\n node.updateIMFromEdges(im)\n }\n }\n computeDisjointIM(im) {\n const ga = this._arg[0].getGeometry()\n if (!ga.isEmpty()) {\n im.set(Location.INTERIOR, Location.EXTERIOR, ga.getDimension())\n im.set(Location.BOUNDARY, Location.EXTERIOR, ga.getBoundaryDimension())\n }\n const gb = this._arg[1].getGeometry()\n if (!gb.isEmpty()) {\n im.set(Location.EXTERIOR, Location.INTERIOR, gb.getDimension())\n im.set(Location.EXTERIOR, Location.BOUNDARY, gb.getBoundaryDimension())\n }\n }\n}\n","import LineString from '../../geom/LineString.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Point from '../../geom/Point.js'\nimport Polygon from '../../geom/Polygon.js'\nexport default class RectangleContains {\n constructor() {\n RectangleContains.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectEnv = null\n const rectangle = arguments[0]\n this._rectEnv = rectangle.getEnvelopeInternal()\n }\n static contains(rectangle, b) {\n const rc = new RectangleContains(rectangle)\n return rc.contains(b)\n }\n isContainedInBoundary(geom) {\n if (geom instanceof Polygon) return false\n if (geom instanceof Point) return this.isPointContainedInBoundary(geom)\n if (geom instanceof LineString) return this.isLineStringContainedInBoundary(geom)\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const comp = geom.getGeometryN(i)\n if (!this.isContainedInBoundary(comp)) return false\n }\n return true\n }\n isLineSegmentContainedInBoundary(p0, p1) {\n if (p0.equals(p1)) return this.isPointContainedInBoundary(p0)\n if (p0.x === p1.x) {\n if (p0.x === this._rectEnv.getMinX() || p0.x === this._rectEnv.getMaxX()) return true\n } else if (p0.y === p1.y) {\n if (p0.y === this._rectEnv.getMinY() || p0.y === this._rectEnv.getMaxY()) return true\n }\n return false\n }\n isLineStringContainedInBoundary(line) {\n const seq = line.getCoordinateSequence()\n const p0 = new Coordinate()\n const p1 = new Coordinate()\n for (let i = 0; i < seq.size() - 1; i++) {\n seq.getCoordinate(i, p0)\n seq.getCoordinate(i + 1, p1)\n if (!this.isLineSegmentContainedInBoundary(p0, p1)) return false\n }\n return true\n }\n isPointContainedInBoundary() {\n if (arguments[0] instanceof Point) {\n const point = arguments[0]\n return this.isPointContainedInBoundary(point.getCoordinate())\n } else if (arguments[0] instanceof Coordinate) {\n const pt = arguments[0]\n return pt.x === this._rectEnv.getMinX() || pt.x === this._rectEnv.getMaxX() || pt.y === this._rectEnv.getMinY() || pt.y === this._rectEnv.getMaxY()\n }\n }\n contains(geom) {\n if (!this._rectEnv.contains(geom.getEnvelopeInternal())) return false\n if (this.isContainedInBoundary(geom)) return false\n return true\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport RobustLineIntersector from './RobustLineIntersector.js'\nimport Envelope from '../geom/Envelope.js'\nexport default class RectangleLineIntersector {\n constructor() {\n RectangleLineIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._rectEnv = null\n this._diagUp0 = null\n this._diagUp1 = null\n this._diagDown0 = null\n this._diagDown1 = null\n const rectEnv = arguments[0]\n this._rectEnv = rectEnv\n this._diagUp0 = new Coordinate(rectEnv.getMinX(), rectEnv.getMinY())\n this._diagUp1 = new Coordinate(rectEnv.getMaxX(), rectEnv.getMaxY())\n this._diagDown0 = new Coordinate(rectEnv.getMinX(), rectEnv.getMaxY())\n this._diagDown1 = new Coordinate(rectEnv.getMaxX(), rectEnv.getMinY())\n }\n intersects(p0, p1) {\n const segEnv = new Envelope(p0, p1)\n if (!this._rectEnv.intersects(segEnv)) return false\n if (this._rectEnv.intersects(p0)) return true\n if (this._rectEnv.intersects(p1)) return true\n if (p0.compareTo(p1) > 0) {\n const tmp = p0\n p0 = p1\n p1 = tmp\n }\n let isSegUpwards = false\n if (p1.y > p0.y) isSegUpwards = true\n if (isSegUpwards) \n this._li.computeIntersection(p0, p1, this._diagDown0, this._diagDown1)\n else \n this._li.computeIntersection(p0, p1, this._diagUp0, this._diagUp1)\n \n if (this._li.hasIntersection()) return true\n return false\n }\n}\n","import GeometryCollection from '../GeometryCollection.js'\nexport default class ShortCircuitedGeometryVisitor {\n constructor() {\n ShortCircuitedGeometryVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._isDone = false\n }\n applyTo(geom) {\n for (let i = 0; i < geom.getNumGeometries() && !this._isDone; i++) {\n const element = geom.getGeometryN(i)\n if (!(element instanceof GeometryCollection)) {\n this.visit(element)\n if (this.isDone()) {\n this._isDone = true\n return null\n }\n } else {\n this.applyTo(element)\n }\n }\n }\n}\n","import Coordinate from '../../geom/Coordinate.js'\nimport Polygon from '../../geom/Polygon.js'\nimport RectangleLineIntersector from '../../algorithm/RectangleLineIntersector.js'\nimport ShortCircuitedGeometryVisitor from '../../geom/util/ShortCircuitedGeometryVisitor.js'\nimport SimplePointInAreaLocator from '../../algorithm/locate/SimplePointInAreaLocator.js'\nimport LinearComponentExtracter from '../../geom/util/LinearComponentExtracter.js'\nexport default class RectangleIntersects {\n constructor() {\n RectangleIntersects.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectangle = null\n this._rectEnv = null\n const rectangle = arguments[0]\n this._rectangle = rectangle\n this._rectEnv = rectangle.getEnvelopeInternal()\n }\n static intersects(rectangle, b) {\n const rp = new RectangleIntersects(rectangle)\n return rp.intersects(b)\n }\n intersects(geom) {\n if (!this._rectEnv.intersects(geom.getEnvelopeInternal())) return false\n const visitor = new EnvelopeIntersectsVisitor(this._rectEnv)\n visitor.applyTo(geom)\n if (visitor.intersects()) return true\n const ecpVisitor = new GeometryContainsPointVisitor(this._rectangle)\n ecpVisitor.applyTo(geom)\n if (ecpVisitor.containsPoint()) return true\n const riVisitor = new RectangleIntersectsSegmentVisitor(this._rectangle)\n riVisitor.applyTo(geom)\n if (riVisitor.intersects()) return true\n return false\n }\n}\nclass EnvelopeIntersectsVisitor extends ShortCircuitedGeometryVisitor {\n constructor() {\n super()\n EnvelopeIntersectsVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectEnv = null\n this._intersects = false\n const rectEnv = arguments[0]\n this._rectEnv = rectEnv\n }\n isDone() {\n return this._intersects === true\n }\n visit(element) {\n const elementEnv = element.getEnvelopeInternal()\n if (!this._rectEnv.intersects(elementEnv)) \n return null\n \n if (this._rectEnv.contains(elementEnv)) {\n this._intersects = true\n return null\n }\n if (elementEnv.getMinX() >= this._rectEnv.getMinX() && elementEnv.getMaxX() <= this._rectEnv.getMaxX()) {\n this._intersects = true\n return null\n }\n if (elementEnv.getMinY() >= this._rectEnv.getMinY() && elementEnv.getMaxY() <= this._rectEnv.getMaxY()) {\n this._intersects = true\n return null\n }\n }\n intersects() {\n return this._intersects\n }\n}\nclass GeometryContainsPointVisitor extends ShortCircuitedGeometryVisitor {\n constructor() {\n super()\n GeometryContainsPointVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectSeq = null\n this._rectEnv = null\n this._containsPoint = false\n const rectangle = arguments[0]\n this._rectSeq = rectangle.getExteriorRing().getCoordinateSequence()\n this._rectEnv = rectangle.getEnvelopeInternal()\n }\n isDone() {\n return this._containsPoint === true\n }\n visit(geom) {\n if (!(geom instanceof Polygon)) return null\n const elementEnv = geom.getEnvelopeInternal()\n if (!this._rectEnv.intersects(elementEnv)) return null\n const rectPt = new Coordinate()\n for (let i = 0; i < 4; i++) {\n this._rectSeq.getCoordinate(i, rectPt)\n if (!elementEnv.contains(rectPt)) continue\n if (SimplePointInAreaLocator.containsPointInPolygon(rectPt, geom)) {\n this._containsPoint = true\n return null\n }\n }\n }\n containsPoint() {\n return this._containsPoint\n }\n}\nclass RectangleIntersectsSegmentVisitor extends ShortCircuitedGeometryVisitor {\n constructor() {\n super()\n RectangleIntersectsSegmentVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectEnv = null\n this._rectIntersector = null\n this._hasIntersection = false\n this._p0 = new Coordinate()\n this._p1 = new Coordinate()\n const rectangle = arguments[0]\n this._rectEnv = rectangle.getEnvelopeInternal()\n this._rectIntersector = new RectangleLineIntersector(this._rectEnv)\n }\n intersects() {\n return this._hasIntersection\n }\n isDone() {\n return this._hasIntersection === true\n }\n visit(geom) {\n const elementEnv = geom.getEnvelopeInternal()\n if (!this._rectEnv.intersects(elementEnv)) return null\n const lines = LinearComponentExtracter.getLines(geom)\n this.checkIntersectionWithLineStrings(lines)\n }\n checkIntersectionWithLineStrings(lines) {\n for (let i = lines.iterator(); i.hasNext(); ) {\n const testLine = i.next()\n this.checkIntersectionWithSegments(testLine)\n if (this._hasIntersection) return null\n }\n }\n checkIntersectionWithSegments(testLine) {\n const seq1 = testLine.getCoordinateSequence()\n for (let j = 1; j < seq1.size(); j++) {\n seq1.getCoordinate(j - 1, this._p0)\n seq1.getCoordinate(j, this._p1)\n if (this._rectIntersector.intersects(this._p0, this._p1)) {\n this._hasIntersection = true\n return null\n }\n }\n }\n}\n","import RelateComputer from './RelateComputer.js'\nimport GeometryGraphOperation from '../GeometryGraphOperation.js'\nimport RectangleContains from '../predicate/RectangleContains.js'\nimport RectangleIntersects from '../predicate/RectangleIntersects.js'\nexport default class RelateOp extends GeometryGraphOperation {\n constructor() {\n super()\n RelateOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._relate = null\n if (arguments.length === 2) {\n const g0 = arguments[0], g1 = arguments[1]\n GeometryGraphOperation.constructor_.call(this, g0, g1)\n this._relate = new RelateComputer(this._arg)\n } else if (arguments.length === 3) {\n const g0 = arguments[0], g1 = arguments[1], boundaryNodeRule = arguments[2]\n GeometryGraphOperation.constructor_.call(this, g0, g1, boundaryNodeRule)\n this._relate = new RelateComputer(this._arg)\n }\n }\n static covers(g1, g2) {\n if (g2.getDimension() === 2 && g1.getDimension() < 2) \n return false\n \n if (g2.getDimension() === 1 && g1.getDimension() < 1 && g2.getLength() > 0.0) \n return false\n \n if (!g1.getEnvelopeInternal().covers(g2.getEnvelopeInternal())) return false\n if (g1.isRectangle()) \n return true\n \n return new RelateOp(g1, g2).getIntersectionMatrix().isCovers()\n }\n static intersects(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n if (g1.isRectangle()) \n return RectangleIntersects.intersects(g1, g2)\n \n if (g2.isRectangle()) \n return RectangleIntersects.intersects(g2, g1)\n \n if (g1.isGeometryCollection() || g2.isGeometryCollection()) {\n const r = false\n for (let i = 0; i < g1.getNumGeometries(); i++) \n for (let j = 0; j < g2.getNumGeometries(); j++) \n if (g1.getGeometryN(i).intersects(g2.getGeometryN(j))) \n return true\n \n \n \n return false\n }\n return new RelateOp(g1, g2).getIntersectionMatrix().isIntersects()\n }\n static touches(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n return new RelateOp(g1, g2).getIntersectionMatrix().isTouches(g1.getDimension(), g2.getDimension())\n }\n static equalsTopo(g1, g2) {\n if (!g1.getEnvelopeInternal().equals(g2.getEnvelopeInternal())) return false\n return RelateOp.relate(g1, g2).isEquals(g1.getDimension(), g2.getDimension())\n }\n static relate() {\n if (arguments.length === 2) {\n const a = arguments[0], b = arguments[1]\n const relOp = new RelateOp(a, b)\n const im = relOp.getIntersectionMatrix()\n return im\n } else if (arguments.length === 3) {\n const a = arguments[0], b = arguments[1], boundaryNodeRule = arguments[2]\n const relOp = new RelateOp(a, b, boundaryNodeRule)\n const im = relOp.getIntersectionMatrix()\n return im\n }\n }\n static overlaps(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n return new RelateOp(g1, g2).getIntersectionMatrix().isOverlaps(g1.getDimension(), g2.getDimension())\n }\n static crosses(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n return new RelateOp(g1, g2).getIntersectionMatrix().isCrosses(g1.getDimension(), g2.getDimension())\n }\n static contains(g1, g2) {\n if (g2.getDimension() === 2 && g1.getDimension() < 2) \n return false\n \n if (g2.getDimension() === 1 && g1.getDimension() < 1 && g2.getLength() > 0.0) \n return false\n \n if (!g1.getEnvelopeInternal().contains(g2.getEnvelopeInternal())) return false\n if (g1.isRectangle()) \n return RectangleContains.contains(g1, g2)\n \n return new RelateOp(g1, g2).getIntersectionMatrix().isContains()\n }\n getIntersectionMatrix() {\n return this._relate.computeIM()\n }\n}\n","import SnapIfNeededOverlayOp from '../overlay/snap/SnapIfNeededOverlayOp.js'\nimport OverlayOp from '../overlay/OverlayOp.js'\nexport default class UnionOp {\n get interfaces_() {\n return []\n }\n\n getClass() {\n return UnionOp\n }\n\n static union(g, other) {\n if (g.isEmpty() || other.isEmpty()) {\n if (g.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, g, other, g.getFactory())\n if (g.isEmpty()) return other.copy()\n if (other.isEmpty()) return g.copy()\n }\n g.checkNotGeometryCollection(g)\n g.checkNotGeometryCollection(other)\n return SnapIfNeededOverlayOp.overlayOp(g, other, OverlayOp.UNION)\n }\n}\n","import Coordinate from \"jsts/org/locationtech/jts/geom/Coordinate.js\";\nimport GeometryFactory from \"jsts/org/locationtech/jts/geom/GeometryFactory.js\";\nimport PrecisionModel from \"jsts/org/locationtech/jts/geom/PrecisionModel.js\";\nimport WKTReader from \"jsts/org/locationtech/jts/io/WKTReader.js\";\nimport WKTWriter from \"jsts/org/locationtech/jts/io/WKTWriter.js\";\nimport { BufferOp } from \"jsts/org/locationtech/jts/operation/buffer\";\nimport OverlayOp from \"jsts/org/locationtech/jts/operation/overlay/OverlayOp.js\";\nimport RelateOp from \"jsts/org/locationtech/jts/operation/relate/RelateOp.js\";\nimport UnionOp from \"jsts/org/locationtech/jts/operation/union/UnionOp.js\";\n\n// TODO: various geometry patched functions don't show up in node module\n// see jsts monkey.js for patching\n\nexport const difference = (g1, g2) => {\n return OverlayOp.difference(g1, g2);\n};\n\nexport const intersects = (g1, g2) => {\n return RelateOp.intersects(g1, g2);\n};\n\nexport const touches = (g1, g2) => {\n return RelateOp.touches(g1, g2);\n};\n\nexport const union = (g1, g2) => {\n return UnionOp.union(g1, g2);\n};\n\nexport const intersection = (g1, g2) => {\n return OverlayOp.intersection(g1, g2);\n};\n\nexport const contains = (g1, g2) => {\n return RelateOp.contains(g1, g2);\n};\n\nexport const expandGeometry = (geometry, distance) => {\n return BufferOp.bufferOp(geometry, distance).norm();\n};\n\nexport const geometryToWkt = (geometry) => {\n if (!geometry) {\n return null;\n }\n const precisionModel = new PrecisionModel();\n const factory = new GeometryFactory(precisionModel);\n const wktWriter = new WKTWriter(factory);\n return wktWriter.write(geometry);\n};\n\nexport const wktToGeometry = (wkt) => {\n if (!wkt) {\n return null;\n }\n const wktReader = new WKTReader();\n return wktReader.read(wkt);\n};\n\n// {x, y, height, width}\nexport const rectToPolygon = (rect) => {\n const reader = new WKTReader();\n const polyString = rectToWKTPolygonString(rect);\n return reader.read(polyString);\n};\n\n// {x, y, height, width}\nexport const rectToWKTPolygonString = (rect) => {\n const p = [\n rect.x,\n rect.y,\n rect.x + rect.width,\n rect.y,\n rect.x + rect.width,\n rect.y + rect.height,\n rect.x,\n rect.y + rect.height,\n // close off poly\n rect.x,\n rect.y,\n ];\n return `POLYGON((${p[0]} ${p[1]}, ${p[2]} ${p[3]}, ${p[4]} ${p[5]}, ${p[6]} ${p[7]}, ${p[8]} ${p[9]}))`;\n};\n\nexport const twoPointsToLineString = (x1, y1, x2, y2) => {\n return new GeometryFactory().createLineString([\n new Coordinate(x1, y1),\n new Coordinate(x2, y2),\n ]);\n};\n\n// [[x,y]...]\nexport const pointsToPolygon = (points) => {\n const coords = points.map((p) => new Coordinate(p[0], p[1]));\n return new GeometryFactory().createPolygon(coords);\n};\n\nexport const slope = (x1, y1, x2, y2) => {\n if (x1 === x2) {\n // vertical line has undefined slope\n return Infinity;\n }\n return (y2 - y1) / (x2 - x1);\n};\n\nexport const inverseSlope = (slope) => {\n if (slope === Infinity) {\n // vertical line; inverse/perpendicular is horizontal\n return 0.0;\n }\n if (slope === 0) {\n // horizontal line; inverse/pendendicular is vertical\n return Infinity;\n }\n return -1.0 / slope;\n};\n\nexport const distanceBetweenPoints = (x1, y1, x2, y2) => {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n};\n\nexport const comparePoints = (x1, y1, x2, y2) => {\n if (x1 < x2 || (x1 === x2 && y1 < y2)) {\n // less than\n return -1;\n } else if (x1 === x2 && y1 === y2) {\n // equal\n return 0;\n } else {\n // greater than\n return 1;\n }\n};\n\nexport const lesserPoint = (x1, y1, x2, y2) => {\n if (comparePoints(x1, y1, x2, y2) === -1) {\n return [x1, y1];\n }\n return [x2, y2];\n};\n\nexport const greaterPoint = (x1, y1, x2, y2) => {\n if (comparePoints(x1, y1, x2, y2) !== -1) {\n return [x1, y1];\n }\n return [x2, y2];\n};\n\nexport const rectangleForSegment = (thickness, x1, y1, x2, y2) => {\n const m = slope(x1, y1, x2, y2);\n const rectDelta = thickness / 2.0;\n\n // slope is delta y / delta x\n if (m === 0) {\n // door is horizontal\n return [\n x1,\n y1 + rectDelta,\n x2,\n y1 + rectDelta,\n x2,\n y1 - rectDelta,\n x1,\n y1 - rectDelta,\n ];\n }\n if (m === Infinity) {\n // door is vertical\n return [\n x1 - rectDelta,\n y1,\n x1 - rectDelta,\n y2,\n x2 + rectDelta,\n y2,\n x2 + rectDelta,\n y1,\n ];\n }\n\n // https://math.stackexchange.com/questions/656500/given-a-point-slope-and-a-distance-along-that-slope-easily-find-a-second-p/656512\n const theta = Math.atan(m);\n // flipped dx/dy and +/- to make things work\n const dy = rectDelta * Math.cos(theta);\n const dx = rectDelta * Math.sin(theta);\n return [\n // lower right - more x, more y\n x1 - dx,\n y1 + dy,\n // upper right - more x, less y\n x2 - dx,\n y2 + dy,\n // upper left - less x, less y\n x2 + dx,\n y2 - dy,\n // lower left - less x, more y\n x1 + dx,\n y1 - dy,\n // close the polygon\n x1 + dy,\n y1 - dx,\n ];\n};\n","import { makeWalls } from \"./wallmaker.js\";\nimport * as geo from \"./geo-utils.js\";\nimport { defaultConfig } from \"./themes.js\";\n\nexport class DungeonState {\n static FLAG_KEY = \"dungeonState\";\n\n constructor(geometry, themeAreas, doors, secretDoors, interiorWalls, config) {\n this.geometry = geometry;\n this.themeAreas = themeAreas;\n this.doors = doors;\n this.secretDoors = secretDoors;\n this.interiorWalls = interiorWalls;\n this.config = config;\n }\n\n static startState() {\n return new DungeonState(null, [], [], [], [], defaultConfig());\n }\n\n clone() {\n return new DungeonState(\n this.geometry ? this.geometry.copy() : null,\n JSON.parse(JSON.stringify(this.themeAreas)),\n JSON.parse(JSON.stringify(this.doors)),\n this.secretDoors ? [...this.secretDoors] : [],\n this.interiorWalls ? [...this.interiorWalls] : [],\n JSON.parse(JSON.stringify(this.config))\n );\n }\n\n /* -------------------------------------------- */\n\n toString() {\n return JSON.stringify({\n // serialize the geometry object as a WKT string\n wkt: geo.geometryToWkt(this.geometry),\n themeAreas: this.themeAreas,\n doors: this.doors,\n secretDoors: this.secretDoors,\n interiorWalls: this.interiorWalls,\n config: this.config,\n });\n }\n\n // TODO: implement as fromJSON?\n static fromString(s) {\n if (!s) {\n return DungeonState.startState();\n }\n const obj = JSON.parse(s);\n const geometry = geo.wktToGeometry(obj.wkt);\n const themeAreas = obj.themeAreas ? obj.themeAreas : [];\n const doors = obj.doors ? obj.doors : [];\n const secretDoors = obj.secretDoors ? obj.secretDoors : [];\n const interiorWalls = obj.interiorWalls ? obj.interiorWalls : [];\n // fill in any new defaults\n const config = foundry.utils.mergeObject(defaultConfig(), obj.config);\n return new DungeonState(\n geometry,\n themeAreas,\n doors,\n secretDoors,\n interiorWalls,\n config\n );\n }\n\n /* -------------------------------------------- */\n\n async saveToJournalEntry(journalEntry) {\n const serialized = this.toString();\n // update walls before we update the journal\n await makeWalls(this);\n await journalEntry.update({\n content: serialized,\n });\n }\n\n static async loadFromJournalEntry(journalEntry) {\n if (journalEntry.data.content) {\n console.log(`Loading dungeon from JournalEntry ${journalEntry.name}`);\n return DungeonState.fromString(journalEntry.data.content);\n } else {\n console.log(\"Loading dungeon from start state\");\n return DungeonState.startState();\n }\n }\n}\n","/*!\n * pixi-filters - v4.1.5\n * Compiled Wed, 29 Sep 2021 14:05:57 UTC\n *\n * pixi-filters is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nvar __filters=function(e,n,t,r,o,i,l,a){\"use strict\";var s=function(e,n){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function u(e,n){function t(){this.constructor=e}s(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var f=function(){return(f=Object.assign||function(e){for(var n,t=arguments,r=1,o=arguments.length;r 0.0) {\\n c.rgb /= c.a;\\n\\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\\n rgb.r *= red;\\n rgb.g *= green;\\n rgb.b *= blue;\\n c.rgb = rgb * brightness;\\n\\n c.rgb *= c.a;\\n }\\n\\n gl_FragColor = c * alpha;\\n}\\n\")||this;return t.gamma=1,t.saturation=1,t.contrast=1,t.brightness=1,t.red=1,t.green=1,t.blue=1,t.alpha=1,Object.assign(t,n),t}return u(n,e),n.prototype.apply=function(e,n,t,r){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,n,t,r)},n}(n.Filter),p=function(e){function n(n){void 0===n&&(n=.5);var t=e.call(this,c,\"\\nuniform sampler2D uSampler;\\nvarying vec2 vTextureCoord;\\n\\nuniform float threshold;\\n\\nvoid main() {\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n\\n // A simple & fast algorithm for getting brightness.\\n // It's inaccuracy , but good enought for this feature.\\n float _max = max(max(color.r, color.g), color.b);\\n float _min = min(min(color.r, color.g), color.b);\\n float brightness = (_max + _min) * 0.5;\\n\\n if(brightness > threshold) {\\n gl_FragColor = color;\\n } else {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\\n }\\n}\\n\")||this;return t.threshold=n,t}return u(n,e),Object.defineProperty(n.prototype,\"threshold\",{get:function(){return this.uniforms.threshold},set:function(e){this.uniforms.threshold=e},enumerable:!1,configurable:!0}),n}(n.Filter),d=function(e){function n(n,r,o){void 0===n&&(n=4),void 0===r&&(r=3),void 0===o&&(o=!1);var i=e.call(this,c,o?\"\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec2 uOffset;\\nuniform vec4 filterClamp;\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n\\n // Sample top left pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Sample top right pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Sample bottom right pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Sample bottom left pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Average\\n color *= 0.25;\\n\\n gl_FragColor = color;\\n}\\n\":\"\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec2 uOffset;\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n\\n // Sample top left pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\\n\\n // Sample top right pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\\n\\n // Sample bottom right pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\\n\\n // Sample bottom left pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\\n\\n // Average\\n color *= 0.25;\\n\\n gl_FragColor = color;\\n}\")||this;return i._kernels=[],i._blur=4,i._quality=3,i.uniforms.uOffset=new Float32Array(2),i._pixelSize=new t.Point,i.pixelSize=1,i._clamp=o,Array.isArray(n)?i.kernels=n:(i._blur=n,i.quality=r),i}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i=this._pixelSize.x/n._frame.width,l=this._pixelSize.y/n._frame.height;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*i,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,n,t,r);else{for(var a=e.getFilterTexture(),s=n,u=a,f=void 0,c=this._quality-1,m=0;m0)for(var r=e,o=e/n,i=1;i0?(this._kernels=e,this._quality=e.length,this._blur=Math.max.apply(Math,e)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"clamp\",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"pixelSize\",{get:function(){return this._pixelSize},set:function(e){\"number\"==typeof e?(this._pixelSize.x=e,this._pixelSize.y=e):Array.isArray(e)?(this._pixelSize.x=e[0],this._pixelSize.y=e[1]):e instanceof t.Point?(this._pixelSize.x=e.x,this._pixelSize.y=e.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"quality\",{get:function(){return this._quality},set:function(e){this._quality=Math.max(1,Math.round(e)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blur\",{get:function(){return this._blur},set:function(e){this._blur=e,this._generateKernels()},enumerable:!1,configurable:!0}),n}(n.Filter),h=function(e){function n(t){var o=e.call(this,c,\"uniform sampler2D uSampler;\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D bloomTexture;\\nuniform float bloomScale;\\nuniform float brightness;\\n\\nvoid main() {\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n color.rgb *= brightness;\\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\\n bloomColor.rgb *= bloomScale;\\n gl_FragColor = color + bloomColor;\\n}\\n\")||this;o.bloomScale=1,o.brightness=1,o._resolution=r.settings.FILTER_RESOLUTION,\"number\"==typeof t&&(t={threshold:t});var i=Object.assign(n.defaults,t);o.bloomScale=i.bloomScale,o.brightness=i.brightness;var l=i.kernels,a=i.blur,s=i.quality,u=i.pixelSize,f=i.resolution;return o._extractFilter=new p(i.threshold),o._extractFilter.resolution=f,o._blurFilter=l?new d(l):new d(a,s),o.pixelSize=u,o.resolution=f,o}return u(n,e),n.prototype.apply=function(e,n,t,r,o){var i=e.getFilterTexture();this._extractFilter.apply(e,n,i,1,o);var l=e.getFilterTexture();this._blurFilter.apply(e,i,l,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,e.applyFilter(this,n,t,r),e.returnFilterTexture(l),e.returnFilterTexture(i)},Object.defineProperty(n.prototype,\"resolution\",{get:function(){return this._resolution},set:function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"threshold\",{get:function(){return this._extractFilter.threshold},set:function(e){this._extractFilter.threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"kernels\",{get:function(){return this._blurFilter.kernels},set:function(e){this._blurFilter.kernels=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blur\",{get:function(){return this._blurFilter.blur},set:function(e){this._blurFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"quality\",{get:function(){return this._blurFilter.quality},set:function(e){this._blurFilter.quality=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"pixelSize\",{get:function(){return this._blurFilter.pixelSize},set:function(e){this._blurFilter.pixelSize=e},enumerable:!1,configurable:!0}),n.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:r.settings.FILTER_RESOLUTION},n}(n.Filter),g=function(e){function n(n){void 0===n&&(n=8);var t=e.call(this,c,\"varying vec2 vTextureCoord;\\n\\nuniform vec4 filterArea;\\nuniform float pixelSize;\\nuniform sampler2D uSampler;\\n\\nvec2 mapCoord( vec2 coord )\\n{\\n coord *= filterArea.xy;\\n coord += filterArea.zw;\\n\\n return coord;\\n}\\n\\nvec2 unmapCoord( vec2 coord )\\n{\\n coord -= filterArea.zw;\\n coord /= filterArea.xy;\\n\\n return coord;\\n}\\n\\nvec2 pixelate(vec2 coord, vec2 size)\\n{\\n return floor( coord / size ) * size;\\n}\\n\\nvec2 getMod(vec2 coord, vec2 size)\\n{\\n return mod( coord , size) / size;\\n}\\n\\nfloat character(float n, vec2 p)\\n{\\n p = floor(p*vec2(4.0, -4.0) + 2.5);\\n\\n if (clamp(p.x, 0.0, 4.0) == p.x)\\n {\\n if (clamp(p.y, 0.0, 4.0) == p.y)\\n {\\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\\n }\\n }\\n return 0.0;\\n}\\n\\nvoid main()\\n{\\n vec2 coord = mapCoord(vTextureCoord);\\n\\n // get the rounded color..\\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\\n pixCoord = unmapCoord(pixCoord);\\n\\n vec4 color = texture2D(uSampler, pixCoord);\\n\\n // determine the character to use\\n float gray = (color.r + color.g + color.b) / 3.0;\\n\\n float n = 65536.0; // .\\n if (gray > 0.2) n = 65600.0; // :\\n if (gray > 0.3) n = 332772.0; // *\\n if (gray > 0.4) n = 15255086.0; // o\\n if (gray > 0.5) n = 23385164.0; // &\\n if (gray > 0.6) n = 15252014.0; // 8\\n if (gray > 0.7) n = 13199452.0; // @\\n if (gray > 0.8) n = 11512810.0; // #\\n\\n // get the mod..\\n vec2 modd = getMod(coord, vec2(pixelSize));\\n\\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\\n\\n}\\n\")||this;return t.size=n,t}return u(n,e),Object.defineProperty(n.prototype,\"size\",{get:function(){return this.uniforms.pixelSize},set:function(e){this.uniforms.pixelSize=e},enumerable:!1,configurable:!0}),n}(n.Filter),v=function(e){function n(n){var t=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\n\\nuniform float transformX;\\nuniform float transformY;\\nuniform vec3 lightColor;\\nuniform float lightAlpha;\\nuniform vec3 shadowColor;\\nuniform float shadowAlpha;\\n\\nvoid main(void) {\\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n float light = texture2D(uSampler, vTextureCoord - transform).a;\\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\\n\\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\\n gl_FragColor = vec4(color.rgb * color.a, color.a);\\n}\\n\")||this;return t._thickness=2,t._angle=0,t.uniforms.lightColor=new Float32Array(3),t.uniforms.shadowColor=new Float32Array(3),Object.assign(t,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},n),t.padding=1,t}return u(n,e),n.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(n.prototype,\"rotation\",{get:function(){return this._angle/t.DEG_TO_RAD},set:function(e){this._angle=e*t.DEG_TO_RAD,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"thickness\",{get:function(){return this._thickness},set:function(e){this._thickness=e,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lightColor\",{get:function(){return o.rgb2hex(this.uniforms.lightColor)},set:function(e){o.hex2rgb(e,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lightAlpha\",{get:function(){return this.uniforms.lightAlpha},set:function(e){this.uniforms.lightAlpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"shadowColor\",{get:function(){return o.rgb2hex(this.uniforms.shadowColor)},set:function(e){o.hex2rgb(e,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"shadowAlpha\",{get:function(){return this.uniforms.shadowAlpha},set:function(e){this.uniforms.shadowAlpha=e},enumerable:!1,configurable:!0}),n}(n.Filter),y=function(e){function n(n,o,s,u){void 0===n&&(n=2),void 0===o&&(o=4),void 0===s&&(s=r.settings.FILTER_RESOLUTION),void 0===u&&(u=5);var f,c,m=e.call(this)||this;return\"number\"==typeof n?(f=n,c=n):n instanceof t.Point?(f=n.x,c=n.y):Array.isArray(n)&&(f=n[0],c=n[1]),m.blurXFilter=new a.BlurFilterPass(!0,f,o,s,u),m.blurYFilter=new a.BlurFilterPass(!1,c,o,s,u),m.blurYFilter.blendMode=i.BLEND_MODES.SCREEN,m.defaultFilter=new l.AlphaFilter,m}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=e.getFilterTexture();this.defaultFilter.apply(e,n,t,r),this.blurXFilter.apply(e,n,o,1),this.blurYFilter.apply(e,o,t,0),e.returnFilterTexture(o)},Object.defineProperty(n.prototype,\"blur\",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blurX\",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blurY\",{get:function(){return this.blurYFilter.blur},set:function(e){this.blurYFilter.blur=e},enumerable:!1,configurable:!0}),n}(n.Filter),b=function(e){function n(t){var r=e.call(this,c,\"uniform float radius;\\nuniform float strength;\\nuniform vec2 center;\\nuniform sampler2D uSampler;\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\nuniform vec2 dimensions;\\n\\nvoid main()\\n{\\n vec2 coord = vTextureCoord * filterArea.xy;\\n coord -= center * dimensions.xy;\\n float distance = length(coord);\\n if (distance < radius) {\\n float percent = distance / radius;\\n if (strength > 0.0) {\\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\\n } else {\\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\\n }\\n }\\n coord += center * dimensions.xy;\\n coord /= filterArea.xy;\\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\\n vec4 color = texture2D(uSampler, clampedCoord);\\n if (coord != clampedCoord) {\\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\\n }\\n\\n gl_FragColor = color;\\n}\\n\")||this;return r.uniforms.dimensions=new Float32Array(2),Object.assign(r,n.defaults,t),r}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=n.filterFrame,i=o.width,l=o.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.radius},set:function(e){this.uniforms.radius=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"strength\",{get:function(){return this.uniforms.strength},set:function(e){this.uniforms.strength=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.center},set:function(e){this.uniforms.center=e},enumerable:!1,configurable:!0}),n.defaults={center:[.5,.5],radius:100,strength:1},n}(n.Filter),x=function(e){function t(n,t,r){void 0===t&&(t=!1),void 0===r&&(r=1);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform sampler2D colorMap;\\nuniform float _mix;\\nuniform float _size;\\nuniform float _sliceSize;\\nuniform float _slicePixelSize;\\nuniform float _sliceInnerSize;\\nvoid main() {\\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\\n\\n vec4 adjusted;\\n if (color.a > 0.0) {\\n color.rgb /= color.a;\\n float innerWidth = _size - 1.0;\\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\\n float s0 = xOffset + (zSlice0 * _sliceSize);\\n float s1 = xOffset + (zSlice1 * _sliceSize);\\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\\n float zOffset = fract(color.b * innerWidth);\\n adjusted = mix(slice0Color, slice1Color, zOffset);\\n\\n color.rgb *= color.a;\\n }\\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\\n\\n}\")||this;return o.mix=1,o._size=0,o._sliceSize=0,o._slicePixelSize=0,o._sliceInnerSize=0,o._nearest=!1,o._scaleMode=null,o._colorMap=null,o._scaleMode=null,o.nearest=t,o.mix=r,o.colorMap=n,o}return u(t,e),t.prototype.apply=function(e,n,t,r){this.uniforms._mix=this.mix,e.applyFilter(this,n,t,r)},Object.defineProperty(t.prototype,\"colorSize\",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"colorMap\",{get:function(){return this._colorMap},set:function(e){var t;e&&(e instanceof n.Texture||(e=n.Texture.from(e)),(null===(t=e)||void 0===t?void 0:t.baseTexture)&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=i.MIPMAP_MODES.OFF,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"nearest\",{get:function(){return this._nearest},set:function(e){this._nearest=e,this._scaleMode=e?i.SCALE_MODES.NEAREST:i.SCALE_MODES.LINEAR;var n=this._colorMap;n&&n.baseTexture&&(n.baseTexture._glTextures={},n.baseTexture.scaleMode=this._scaleMode,n.baseTexture.mipmap=i.MIPMAP_MODES.OFF,n._updateID++,n.baseTexture.emit(\"update\",n.baseTexture))},enumerable:!1,configurable:!0}),t.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit(\"update\",e.baseTexture),this.colorMap=e)},t.prototype.destroy=function(n){void 0===n&&(n=!1),this._colorMap&&this._colorMap.destroy(n),e.prototype.destroy.call(this)},t}(n.Filter),_=function(e){function n(n,t){void 0===n&&(n=0),void 0===t&&(t=1);var r=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec3 color;\\nuniform float alpha;\\n\\nvoid main(void) {\\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\\n gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a);\\n}\\n\")||this;return r._color=0,r._alpha=1,r.uniforms.color=new Float32Array(3),r.color=n,r.alpha=t,r}return u(n,e),Object.defineProperty(n.prototype,\"color\",{get:function(){return this._color},set:function(e){var n=this.uniforms.color;\"number\"==typeof e?(o.hex2rgb(e,n),this._color=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],this._color=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"alpha\",{get:function(){return this._alpha},set:function(e){this.uniforms.alpha=e,this._alpha=e},enumerable:!1,configurable:!0}),n}(n.Filter),C=function(e){function n(n,t,r){void 0===n&&(n=16711680),void 0===t&&(t=0),void 0===r&&(r=.4);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec3 originalColor;\\nuniform vec3 newColor;\\nuniform float epsilon;\\nvoid main(void) {\\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\\n float colorDistance = length(colorDiff);\\n float doReplace = step(colorDistance, epsilon);\\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\\n}\\n\")||this;return o._originalColor=16711680,o._newColor=0,o.uniforms.originalColor=new Float32Array(3),o.uniforms.newColor=new Float32Array(3),o.originalColor=n,o.newColor=t,o.epsilon=r,o}return u(n,e),Object.defineProperty(n.prototype,\"originalColor\",{get:function(){return this._originalColor},set:function(e){var n=this.uniforms.originalColor;\"number\"==typeof e?(o.hex2rgb(e,n),this._originalColor=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],this._originalColor=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"newColor\",{get:function(){return this._newColor},set:function(e){var n=this.uniforms.newColor;\"number\"==typeof e?(o.hex2rgb(e,n),this._newColor=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],this._newColor=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"epsilon\",{get:function(){return this.uniforms.epsilon},set:function(e){this.uniforms.epsilon=e},enumerable:!1,configurable:!0}),n}(n.Filter),S=function(e){function n(n,t,r){void 0===t&&(t=200),void 0===r&&(r=200);var o=e.call(this,c,\"precision mediump float;\\n\\nvarying mediump vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec2 texelSize;\\nuniform float matrix[9];\\n\\nvoid main(void)\\n{\\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\\n\\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\\n\\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\\n\\n gl_FragColor =\\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\\n\\n gl_FragColor.a = c22.a;\\n}\\n\")||this;return o.uniforms.texelSize=new Float32Array(2),o.uniforms.matrix=new Float32Array(9),void 0!==n&&(o.matrix=n),o.width=t,o.height=r,o}return u(n,e),Object.defineProperty(n.prototype,\"matrix\",{get:function(){return this.uniforms.matrix},set:function(e){var n=this;e.forEach((function(e,t){n.uniforms.matrix[t]=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"width\",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(e){this.uniforms.texelSize[0]=1/e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"height\",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(e){this.uniforms.texelSize[1]=1/e},enumerable:!1,configurable:!0}),n}(n.Filter),F=function(e){function n(){return e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\\n\\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\\n\\n if (lum < 1.00)\\n {\\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.75)\\n {\\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.50)\\n {\\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.3)\\n {\\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n}\\n\")||this}return u(n,e),n}(n.Filter),z=function(e){function n(t){var r=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\nuniform vec2 dimensions;\\n\\nconst float SQRT_2 = 1.414213;\\n\\nconst float light = 1.0;\\n\\nuniform float curvature;\\nuniform float lineWidth;\\nuniform float lineContrast;\\nuniform bool verticalLine;\\nuniform float noise;\\nuniform float noiseSize;\\n\\nuniform float vignetting;\\nuniform float vignettingAlpha;\\nuniform float vignettingBlur;\\n\\nuniform float seed;\\nuniform float time;\\n\\nfloat rand(vec2 co) {\\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\\n}\\n\\nvoid main(void)\\n{\\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\\n vec2 dir = vec2(vTextureCoord.xy - vec2(0.5, 0.5)) * filterArea.xy / dimensions;\\n\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n vec3 rgb = gl_FragColor.rgb;\\n\\n if (noise > 0.0 && noiseSize > 0.0)\\n {\\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\\n rgb += _noise * noise;\\n }\\n\\n if (lineWidth > 0.0)\\n {\\n float _c = curvature > 0. ? curvature : 1.;\\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\\n vec2 uv = dir * k;\\n\\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\\n rgb *= j;\\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\\n rgb *= 0.99 + ceil(segment) * 0.015;\\n }\\n\\n if (vignetting > 0.0)\\n {\\n float outter = SQRT_2 - vignetting * SQRT_2;\\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\\n }\\n\\n gl_FragColor.rgb = rgb;\\n}\\n\")||this;return r.time=0,r.seed=0,r.uniforms.dimensions=new Float32Array(2),Object.assign(r,n.defaults,t),r}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=n.filterFrame,i=o.width,l=o.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"curvature\",{get:function(){return this.uniforms.curvature},set:function(e){this.uniforms.curvature=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lineWidth\",{get:function(){return this.uniforms.lineWidth},set:function(e){this.uniforms.lineWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lineContrast\",{get:function(){return this.uniforms.lineContrast},set:function(e){this.uniforms.lineContrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"verticalLine\",{get:function(){return this.uniforms.verticalLine},set:function(e){this.uniforms.verticalLine=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noise\",{get:function(){return this.uniforms.noise},set:function(e){this.uniforms.noise=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noiseSize\",{get:function(){return this.uniforms.noiseSize},set:function(e){this.uniforms.noiseSize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignetting\",{get:function(){return this.uniforms.vignetting},set:function(e){this.uniforms.vignetting=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingAlpha\",{get:function(){return this.uniforms.vignettingAlpha},set:function(e){this.uniforms.vignettingAlpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingBlur\",{get:function(){return this.uniforms.vignettingBlur},set:function(e){this.uniforms.vignettingBlur=e},enumerable:!1,configurable:!0}),n.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},n}(n.Filter),O=function(e){function n(n,t){void 0===n&&(n=1),void 0===t&&(t=5);var r=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform vec4 filterArea;\\nuniform sampler2D uSampler;\\n\\nuniform float angle;\\nuniform float scale;\\n\\nfloat pattern()\\n{\\n float s = sin(angle), c = cos(angle);\\n vec2 tex = vTextureCoord * filterArea.xy;\\n vec2 point = vec2(\\n c * tex.x - s * tex.y,\\n s * tex.x + c * tex.y\\n ) * scale;\\n return (sin(point.x) * sin(point.y)) * 4.0;\\n}\\n\\nvoid main()\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n float average = (color.r + color.g + color.b) / 3.0;\\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\\n}\\n\")||this;return r.scale=n,r.angle=t,r}return u(n,e),Object.defineProperty(n.prototype,\"scale\",{get:function(){return this.uniforms.scale},set:function(e){this.uniforms.scale=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"angle\",{get:function(){return this.uniforms.angle},set:function(e){this.uniforms.angle=e},enumerable:!1,configurable:!0}),n}(n.Filter),P=function(e){function i(o){var l=e.call(this)||this;l.angle=45,l._distance=5,l._resolution=r.settings.FILTER_RESOLUTION;var a=o?f(f({},i.defaults),o):i.defaults,s=a.kernels,u=a.blur,m=a.quality,p=a.pixelSize,h=a.resolution;l._tintFilter=new n.Filter(c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform float alpha;\\nuniform vec3 color;\\n\\nuniform vec2 shift;\\nuniform vec4 inputSize;\\n\\nvoid main(void){\\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\\n\\n // Premultiply alpha\\n sample.rgb = color.rgb * sample.a;\\n\\n // alpha user alpha\\n sample *= alpha;\\n\\n gl_FragColor = sample;\\n}\"),l._tintFilter.uniforms.color=new Float32Array(4),l._tintFilter.uniforms.shift=new t.Point,l._tintFilter.resolution=h,l._blurFilter=s?new d(s):new d(u,m),l.pixelSize=p,l.resolution=h;var g=a.shadowOnly,v=a.rotation,y=a.distance,b=a.alpha,x=a.color;return l.shadowOnly=g,l.rotation=v,l.distance=y,l.alpha=b,l.color=x,l._updatePadding(),l}return u(i,e),i.prototype.apply=function(e,n,t,r){var o=e.getFilterTexture();this._tintFilter.apply(e,n,o,1),this._blurFilter.apply(e,o,t,r),!0!==this.shadowOnly&&e.applyFilter(this,n,t,0),e.returnFilterTexture(o)},i.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},i.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},Object.defineProperty(i.prototype,\"resolution\",{get:function(){return this._resolution},set:function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"distance\",{get:function(){return this._distance},set:function(e){this._distance=e,this._updatePadding(),this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"rotation\",{get:function(){return this.angle/t.DEG_TO_RAD},set:function(e){this.angle=e*t.DEG_TO_RAD,this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"alpha\",{get:function(){return this._tintFilter.uniforms.alpha},set:function(e){this._tintFilter.uniforms.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"color\",{get:function(){return o.rgb2hex(this._tintFilter.uniforms.color)},set:function(e){o.hex2rgb(e,this._tintFilter.uniforms.color)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"kernels\",{get:function(){return this._blurFilter.kernels},set:function(e){this._blurFilter.kernels=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"blur\",{get:function(){return this._blurFilter.blur},set:function(e){this._blurFilter.blur=e,this._updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"quality\",{get:function(){return this._blurFilter.quality},set:function(e){this._blurFilter.quality=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"pixelSize\",{get:function(){return this._blurFilter.pixelSize},set:function(e){this._blurFilter.pixelSize=e},enumerable:!1,configurable:!0}),i.defaults={rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:r.settings.FILTER_RESOLUTION},i}(n.Filter),A=function(e){function n(n){void 0===n&&(n=5);var t=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float strength;\\nuniform vec4 filterArea;\\n\\n\\nvoid main(void)\\n{\\n\\tvec2 onePixel = vec2(1.0 / filterArea);\\n\\n\\tvec4 color;\\n\\n\\tcolor.rgb = vec3(0.5);\\n\\n\\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\\n\\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\\n\\n\\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\\n\\n\\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\\n\\n\\tgl_FragColor = vec4(color.rgb * alpha, alpha);\\n}\\n\")||this;return t.strength=n,t}return u(n,e),Object.defineProperty(n.prototype,\"strength\",{get:function(){return this.uniforms.strength},set:function(e){this.uniforms.strength=e},enumerable:!1,configurable:!0}),n}(n.Filter),T=function(e){function r(t){var o=e.call(this,c,\"// precision highp float;\\n\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\nuniform vec2 dimensions;\\nuniform float aspect;\\n\\nuniform sampler2D displacementMap;\\nuniform float offset;\\nuniform float sinDir;\\nuniform float cosDir;\\nuniform int fillMode;\\n\\nuniform float seed;\\nuniform vec2 red;\\nuniform vec2 green;\\nuniform vec2 blue;\\n\\nconst int TRANSPARENT = 0;\\nconst int ORIGINAL = 1;\\nconst int LOOP = 2;\\nconst int CLAMP = 3;\\nconst int MIRROR = 4;\\n\\nvoid main(void)\\n{\\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\\n\\n if (coord.x > 1.0 || coord.y > 1.0) {\\n return;\\n }\\n\\n float cx = coord.x - 0.5;\\n float cy = (coord.y - 0.5) * aspect;\\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\\n\\n // displacementMap: repeat\\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\\n\\n // displacementMap: mirror\\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\\n\\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\\n\\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\\n\\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\\n\\n if (fillMode == CLAMP) {\\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\\n } else {\\n if( coord.x > filterClamp.z ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.x -= filterClamp.z;\\n } else if (fillMode == MIRROR) {\\n coord.x = filterClamp.z * 2.0 - coord.x;\\n }\\n } else if( coord.x < filterClamp.x ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.x += filterClamp.z;\\n } else if (fillMode == MIRROR) {\\n coord.x *= -filterClamp.z;\\n }\\n }\\n\\n if( coord.y > filterClamp.w ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.y -= filterClamp.w;\\n } else if (fillMode == MIRROR) {\\n coord.y = filterClamp.w * 2.0 - coord.y;\\n }\\n } else if( coord.y < filterClamp.y ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.y += filterClamp.w;\\n } else if (fillMode == MIRROR) {\\n coord.y *= -filterClamp.w;\\n }\\n }\\n }\\n\\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\\n gl_FragColor.a = texture2D(uSampler, coord).a;\\n}\\n\")||this;return o.offset=100,o.fillMode=r.TRANSPARENT,o.average=!1,o.seed=0,o.minSize=8,o.sampleSize=512,o._slices=0,o._offsets=new Float32Array(1),o._sizes=new Float32Array(1),o._direction=-1,o.uniforms.dimensions=new Float32Array(2),o._canvas=document.createElement(\"canvas\"),o._canvas.width=4,o._canvas.height=o.sampleSize,o.texture=n.Texture.from(o._canvas,{scaleMode:i.SCALE_MODES.NEAREST}),Object.assign(o,r.defaults,t),o}return u(r,e),r.prototype.apply=function(e,n,t,r){var o=n.filterFrame,i=o.width,l=o.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,this.uniforms.aspect=l/i,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,n,t,r)},r.prototype._randomizeSizes=function(){var e=this._sizes,n=this._slices-1,t=this.sampleSize,r=Math.min(this.minSize/t,.9/this._slices);if(this.average){for(var o=this._slices,i=1,l=0;l0;n--){var t=Math.random()*n>>0,r=e[n];e[n]=e[t],e[t]=r}},r.prototype._randomizeOffsets=function(){for(var e=0;e0?e:0,s=e<0?-e:0;r.fillStyle=\"rgba(\"+a+\", \"+s+\", 0, 1)\",r.fillRect(0,o>>0,n,l+1>>0),o+=l}t.baseTexture.update(),this.uniforms.displacementMap=t},Object.defineProperty(r.prototype,\"sizes\",{get:function(){return this._sizes},set:function(e){for(var n=Math.min(this._slices,e.length),t=0;t>0)},Object.defineProperty(n.prototype,\"offset\",{get:function(){return this.uniforms.uOffset},set:function(e){this.uniforms.uOffset=e},enumerable:!1,configurable:!0}),n}(n.Filter),M=function(e){function n(n,t,r){void 0===t&&(t=.05),void 0===r&&(r=n.length);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform float epsilon;\\n\\nconst int MAX_COLORS = %maxColors%;\\n\\nuniform vec3 originalColors[MAX_COLORS];\\nuniform vec3 targetColors[MAX_COLORS];\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n\\n float alpha = gl_FragColor.a;\\n if (alpha < 0.0001)\\n {\\n return;\\n }\\n\\n vec3 color = gl_FragColor.rgb / alpha;\\n\\n for(int i = 0; i < MAX_COLORS; i++)\\n {\\n vec3 origColor = originalColors[i];\\n if (origColor.r < 0.0)\\n {\\n break;\\n }\\n vec3 colorDiff = origColor - color;\\n if (length(colorDiff) < epsilon)\\n {\\n vec3 targetColor = targetColors[i];\\n gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\\n return;\\n }\\n }\\n}\\n\".replace(/%maxColors%/g,r.toFixed(0)))||this;return o._replacements=[],o._maxColors=0,o.epsilon=t,o._maxColors=r,o.uniforms.originalColors=new Float32Array(3*r),o.uniforms.targetColors=new Float32Array(3*r),o.replacements=n,o}return u(n,e),Object.defineProperty(n.prototype,\"replacements\",{get:function(){return this._replacements},set:function(e){var n=this.uniforms.originalColors,t=this.uniforms.targetColors,r=e.length;if(r>this._maxColors)throw new Error(\"Length of replacements (\"+r+\") exceeds the maximum colors length (\"+this._maxColors+\")\");n[3*r]=-1;for(var i=0;i 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\\n}\\n\\n\\nvoid main()\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n vec3 color = gl_FragColor.rgb;\\n\\n if (sepia > 0.0)\\n {\\n float gray = (color.x + color.y + color.z) / 3.0;\\n vec3 grayscale = vec3(gray);\\n\\n color = Overlay(SEPIA_RGB, grayscale);\\n\\n color = grayscale + sepia * (color - grayscale);\\n }\\n\\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\\n\\n if (vignetting > 0.0)\\n {\\n float outter = SQRT_2 - vignetting * SQRT_2;\\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\\n dir.y *= dimensions.y / dimensions.x;\\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\\n }\\n\\n if (scratchDensity > seed && scratch != 0.0)\\n {\\n float phase = seed * 256.0;\\n float s = mod(floor(phase), 2.0);\\n float dist = 1.0 / scratchDensity;\\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\\n if (d < seed * 0.6 + 0.4)\\n {\\n highp float period = scratchDensity * 10.0;\\n\\n float xx = coord.x * period + phase;\\n float aa = abs(mod(xx, 0.5) * 4.0);\\n float bb = mod(floor(xx / 0.5), 2.0);\\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\\n\\n float kk = 2.0 * period;\\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\\n float dh = dw * kk;\\n\\n float tine = (yy - (2.0 - dh));\\n\\n if (tine > 0.0) {\\n float _sign = sign(scratch);\\n\\n tine = s * tine / period + scratch + 0.1;\\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\\n\\n color.rgb *= tine;\\n }\\n }\\n }\\n\\n if (noise > 0.0 && noiseSize > 0.0)\\n {\\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\\n // float _noise = snoise(d) * 0.5;\\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\\n color += _noise * noise;\\n }\\n\\n gl_FragColor.rgb = color;\\n}\\n\")||this;return o.seed=0,o.uniforms.dimensions=new Float32Array(2),\"number\"==typeof t?(o.seed=t,t=void 0):o.seed=r,Object.assign(o,n.defaults,t),o}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i;this.uniforms.dimensions[0]=null===(o=n.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=n.filterFrame)||void 0===i?void 0:i.height,this.uniforms.seed=this.seed,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"sepia\",{get:function(){return this.uniforms.sepia},set:function(e){this.uniforms.sepia=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noise\",{get:function(){return this.uniforms.noise},set:function(e){this.uniforms.noise=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noiseSize\",{get:function(){return this.uniforms.noiseSize},set:function(e){this.uniforms.noiseSize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"scratch\",{get:function(){return this.uniforms.scratch},set:function(e){this.uniforms.scratch=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"scratchDensity\",{get:function(){return this.uniforms.scratchDensity},set:function(e){this.uniforms.scratchDensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"scratchWidth\",{get:function(){return this.uniforms.scratchWidth},set:function(e){this.uniforms.scratchWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignetting\",{get:function(){return this.uniforms.vignetting},set:function(e){this.uniforms.vignetting=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingAlpha\",{get:function(){return this.uniforms.vignettingAlpha},set:function(e){this.uniforms.vignettingAlpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingBlur\",{get:function(){return this.uniforms.vignettingBlur},set:function(e){this.uniforms.vignettingBlur=e},enumerable:!1,configurable:!0}),n.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},n}(n.Filter),E=function(e){function n(t,r,o){void 0===t&&(t=1),void 0===r&&(r=0),void 0===o&&(o=.1);var i=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec2 thickness;\\nuniform vec4 outlineColor;\\nuniform vec4 filterClamp;\\n\\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\\n\\nvoid main(void) {\\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\\n vec4 curColor;\\n float maxAlpha = 0.;\\n vec2 displaced;\\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\\n maxAlpha = max(maxAlpha, curColor.a);\\n }\\n float resultAlpha = max(maxAlpha, ownColor.a);\\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\\n}\\n\".replace(/\\$\\{angleStep\\}/,n.getAngleStep(o)))||this;return i._thickness=1,i.uniforms.thickness=new Float32Array([0,0]),i.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(i,{thickness:t,color:r,quality:o}),i}return u(n,e),n.getAngleStep=function(e){var t=Math.max(e*n.MAX_SAMPLES,n.MIN_SAMPLES);return(2*Math.PI/t).toFixed(7)},n.prototype.apply=function(e,n,t,r){this.uniforms.thickness[0]=this._thickness/n._frame.width,this.uniforms.thickness[1]=this._thickness/n._frame.height,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"color\",{get:function(){return o.rgb2hex(this.uniforms.outlineColor)},set:function(e){o.hex2rgb(e,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"thickness\",{get:function(){return this._thickness},set:function(e){this._thickness=e,this.padding=e},enumerable:!1,configurable:!0}),n.MIN_SAMPLES=1,n.MAX_SAMPLES=100,n}(n.Filter),I=function(e){function n(n){void 0===n&&(n=10);var t=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec2 size;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\n\\nvec2 mapCoord( vec2 coord )\\n{\\n coord *= filterArea.xy;\\n coord += filterArea.zw;\\n\\n return coord;\\n}\\n\\nvec2 unmapCoord( vec2 coord )\\n{\\n coord -= filterArea.zw;\\n coord /= filterArea.xy;\\n\\n return coord;\\n}\\n\\nvec2 pixelate(vec2 coord, vec2 size)\\n{\\n\\treturn floor( coord / size ) * size;\\n}\\n\\nvoid main(void)\\n{\\n vec2 coord = mapCoord(vTextureCoord);\\n\\n coord = pixelate(coord, size);\\n\\n coord = unmapCoord(coord);\\n\\n gl_FragColor = texture2D(uSampler, coord);\\n}\\n\")||this;return t.size=n,t}return u(n,e),Object.defineProperty(n.prototype,\"size\",{get:function(){return this.uniforms.size},set:function(e){\"number\"==typeof e&&(e=[e,e]),this.uniforms.size=e},enumerable:!1,configurable:!0}),n}(n.Filter),k=function(e){function n(n,t,r,o){void 0===n&&(n=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===o&&(o=-1);var i=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\n\\nuniform float uRadian;\\nuniform vec2 uCenter;\\nuniform float uRadius;\\nuniform int uKernelSize;\\n\\nconst int MAX_KERNEL_SIZE = 2048;\\n\\nvoid main(void)\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n\\n if (uKernelSize == 0)\\n {\\n gl_FragColor = color;\\n return;\\n }\\n\\n float aspect = filterArea.y / filterArea.x;\\n vec2 center = uCenter.xy / filterArea.xy;\\n float gradient = uRadius / filterArea.x * 0.3;\\n float radius = uRadius / filterArea.x - gradient * 0.5;\\n int k = uKernelSize - 1;\\n\\n vec2 coord = vTextureCoord;\\n vec2 dir = vec2(center - coord);\\n float dist = length(vec2(dir.x, dir.y * aspect));\\n\\n float radianStep = uRadian;\\n if (radius >= 0.0 && dist > radius) {\\n float delta = dist - radius;\\n float gap = gradient;\\n float scale = 1.0 - abs(delta / gap);\\n if (scale <= 0.0) {\\n gl_FragColor = color;\\n return;\\n }\\n radianStep *= scale;\\n }\\n radianStep /= float(k);\\n\\n float s = sin(radianStep);\\n float c = cos(radianStep);\\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\\n\\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\\n if (i == k) {\\n break;\\n }\\n\\n coord -= center;\\n coord.y *= aspect;\\n coord = rotationMatrix * coord;\\n coord.y /= aspect;\\n coord += center;\\n\\n vec4 sample = texture2D(uSampler, coord);\\n\\n // switch to pre-multiplied alpha to correctly blur transparent images\\n // sample.rgb *= sample.a;\\n\\n color += sample;\\n }\\n\\n gl_FragColor = color / float(uKernelSize);\\n}\\n\")||this;return i._angle=0,i.angle=n,i.center=t,i.kernelSize=r,i.radius=o,i}return u(n,e),n.prototype.apply=function(e,n,t,r){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"angle\",{get:function(){return this._angle},set:function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.uCenter},set:function(e){this.uniforms.uCenter=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.uRadius},set:function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},enumerable:!1,configurable:!0}),n}(n.Filter),L=function(e){function n(t){var r=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\nuniform vec2 dimensions;\\n\\nuniform bool mirror;\\nuniform float boundary;\\nuniform vec2 amplitude;\\nuniform vec2 waveLength;\\nuniform vec2 alpha;\\nuniform float time;\\n\\nfloat rand(vec2 co) {\\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\\n}\\n\\nvoid main(void)\\n{\\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\\n vec2 coord = pixelCoord / dimensions;\\n\\n if (coord.y < boundary) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n\\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\\n float areaY = boundary * dimensions.y / filterArea.y;\\n float v = areaY + areaY - vTextureCoord.y;\\n float y = mirror ? v : vTextureCoord.y;\\n\\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\\n\\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\\n x = clamp(x, filterClamp.x, filterClamp.z);\\n\\n vec4 color = texture2D(uSampler, vec2(x, y));\\n\\n gl_FragColor = color * _alpha;\\n}\\n\")||this;return r.time=0,r.uniforms.amplitude=new Float32Array(2),r.uniforms.waveLength=new Float32Array(2),r.uniforms.alpha=new Float32Array(2),r.uniforms.dimensions=new Float32Array(2),Object.assign(r,n.defaults,t),r}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i;this.uniforms.dimensions[0]=null===(o=n.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=n.filterFrame)||void 0===i?void 0:i.height,this.uniforms.time=this.time,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"mirror\",{get:function(){return this.uniforms.mirror},set:function(e){this.uniforms.mirror=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"boundary\",{get:function(){return this.uniforms.boundary},set:function(e){this.uniforms.boundary=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"amplitude\",{get:function(){return this.uniforms.amplitude},set:function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"waveLength\",{get:function(){return this.uniforms.waveLength},set:function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"alpha\",{get:function(){return this.uniforms.alpha},set:function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},enumerable:!1,configurable:!0}),n.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},n}(n.Filter),N=function(e){function n(n,t,r){void 0===n&&(n=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]);var o=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\nuniform vec2 red;\\nuniform vec2 green;\\nuniform vec2 blue;\\n\\nvoid main(void)\\n{\\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\\n}\\n\")||this;return o.red=n,o.green=t,o.blue=r,o}return u(n,e),Object.defineProperty(n.prototype,\"red\",{get:function(){return this.uniforms.red},set:function(e){this.uniforms.red=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"green\",{get:function(){return this.uniforms.green},set:function(e){this.uniforms.green=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blue\",{get:function(){return this.uniforms.blue},set:function(e){this.uniforms.blue=e},enumerable:!1,configurable:!0}),n}(n.Filter),X=function(e){function n(t,r,o){void 0===t&&(t=[0,0]),void 0===o&&(o=0);var i=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\n\\nuniform vec2 center;\\n\\nuniform float amplitude;\\nuniform float wavelength;\\n// uniform float power;\\nuniform float brightness;\\nuniform float speed;\\nuniform float radius;\\n\\nuniform float time;\\n\\nconst float PI = 3.14159;\\n\\nvoid main()\\n{\\n float halfWavelength = wavelength * 0.5 / filterArea.x;\\n float maxRadius = radius / filterArea.x;\\n float currentRadius = time * speed / filterArea.x;\\n\\n float fade = 1.0;\\n\\n if (maxRadius > 0.0) {\\n if (currentRadius > maxRadius) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\\n }\\n\\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\\n dir.y *= filterArea.y / filterArea.x;\\n float dist = length(dir);\\n\\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n\\n vec2 diffUV = normalize(dir);\\n\\n float diff = (dist - currentRadius) / halfWavelength;\\n\\n float p = 1.0 - pow(abs(diff), 2.0);\\n\\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\\n\\n vec2 offset = diffUV * powDiff / filterArea.xy;\\n\\n // Do clamp :\\n vec2 coord = vTextureCoord + offset;\\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\\n vec4 color = texture2D(uSampler, clampedCoord);\\n if (coord != clampedCoord) {\\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\\n }\\n\\n // No clamp :\\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\\n\\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\\n\\n gl_FragColor = color;\\n}\\n\")||this;return i.center=t,Object.assign(i,n.defaults,r),i.time=o,i}return u(n,e),n.prototype.apply=function(e,n,t,r){this.uniforms.time=this.time,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.center},set:function(e){this.uniforms.center=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"amplitude\",{get:function(){return this.uniforms.amplitude},set:function(e){this.uniforms.amplitude=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"wavelength\",{get:function(){return this.uniforms.wavelength},set:function(e){this.uniforms.wavelength=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"brightness\",{get:function(){return this.uniforms.brightness},set:function(e){this.uniforms.brightness=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"speed\",{get:function(){return this.uniforms.speed},set:function(e){this.uniforms.speed=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.radius},set:function(e){this.uniforms.radius=e},enumerable:!1,configurable:!0}),n.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},n}(n.Filter),B=function(e){function n(n,t,r){void 0===t&&(t=0),void 0===r&&(r=1);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform sampler2D uLightmap;\\nuniform vec4 filterArea;\\nuniform vec2 dimensions;\\nuniform vec4 ambientColor;\\nvoid main() {\\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\\n vec4 light = texture2D(uLightmap, lightCoord);\\n vec3 ambient = ambientColor.rgb * ambientColor.a;\\n vec3 intensity = ambient + light.rgb;\\n vec3 finalColor = diffuseColor.rgb * intensity;\\n gl_FragColor = vec4(finalColor, diffuseColor.a);\\n}\\n\")||this;return o._color=0,o.uniforms.dimensions=new Float32Array(2),o.uniforms.ambientColor=new Float32Array([0,0,0,r]),o.texture=n,o.color=t,o}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i;this.uniforms.dimensions[0]=null===(o=n.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=n.filterFrame)||void 0===i?void 0:i.height,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"texture\",{get:function(){return this.uniforms.uLightmap},set:function(e){this.uniforms.uLightmap=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"color\",{get:function(){return this._color},set:function(e){var n=this.uniforms.ambientColor;\"number\"==typeof e?(o.hex2rgb(e,n),this._color=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],this._color=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"alpha\",{get:function(){return this.uniforms.ambientColor[3]},set:function(e){this.uniforms.ambientColor[3]=e},enumerable:!1,configurable:!0}),n}(n.Filter),G=function(e){function n(n,r,o,i){void 0===n&&(n=100),void 0===r&&(r=600);var l=e.call(this,c,\"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float blur;\\nuniform float gradientBlur;\\nuniform vec2 start;\\nuniform vec2 end;\\nuniform vec2 delta;\\nuniform vec2 texSize;\\n\\nfloat random(vec3 scale, float seed)\\n{\\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\\n}\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n float total = 0.0;\\n\\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\\n\\n for (float t = -30.0; t <= 30.0; t++)\\n {\\n float percent = (t + offset - 0.5) / 30.0;\\n float weight = 1.0 - abs(percent);\\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\\n sample.rgb *= sample.a;\\n color += sample * weight;\\n total += weight;\\n }\\n\\n color /= total;\\n color.rgb /= color.a + 0.00001;\\n\\n gl_FragColor = color;\\n}\\n\")||this;return l.uniforms.blur=n,l.uniforms.gradientBlur=r,l.uniforms.start=o||new t.Point(0,window.innerHeight/2),l.uniforms.end=i||new t.Point(600,window.innerHeight/2),l.uniforms.delta=new t.Point(30,30),l.uniforms.texSize=new t.Point(window.innerWidth,window.innerHeight),l.updateDelta(),l}return u(n,e),n.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(n.prototype,\"blur\",{get:function(){return this.uniforms.blur},set:function(e){this.uniforms.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"gradientBlur\",{get:function(){return this.uniforms.gradientBlur},set:function(e){this.uniforms.gradientBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"start\",{get:function(){return this.uniforms.start},set:function(e){this.uniforms.start=e,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"end\",{get:function(){return this.uniforms.end},set:function(e){this.uniforms.end=e,this.updateDelta()},enumerable:!1,configurable:!0}),n}(n.Filter),K=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(n,e),n.prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,t=Math.sqrt(e*e+n*n);this.uniforms.delta.x=e/t,this.uniforms.delta.y=n/t},n}(G),q=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(n,e),n.prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,t=Math.sqrt(e*e+n*n);this.uniforms.delta.x=-n/t,this.uniforms.delta.y=e/t},n}(G),W=function(e){function n(n,t,r,o){void 0===n&&(n=100),void 0===t&&(t=600);var i=e.call(this)||this;return i.tiltShiftXFilter=new K(n,t,r,o),i.tiltShiftYFilter=new q(n,t,r,o),i}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=e.getFilterTexture();this.tiltShiftXFilter.apply(e,n,o,1),this.tiltShiftYFilter.apply(e,o,t,r),e.returnFilterTexture(o)},Object.defineProperty(n.prototype,\"blur\",{get:function(){return this.tiltShiftXFilter.blur},set:function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"gradientBlur\",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"start\",{get:function(){return this.tiltShiftXFilter.start},set:function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"end\",{get:function(){return this.tiltShiftXFilter.end},set:function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},enumerable:!1,configurable:!0}),n}(n.Filter),Y=function(e){function n(t){var r=e.call(this,c,\"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float radius;\\nuniform float angle;\\nuniform vec2 offset;\\nuniform vec4 filterArea;\\n\\nvec2 mapCoord( vec2 coord )\\n{\\n coord *= filterArea.xy;\\n coord += filterArea.zw;\\n\\n return coord;\\n}\\n\\nvec2 unmapCoord( vec2 coord )\\n{\\n coord -= filterArea.zw;\\n coord /= filterArea.xy;\\n\\n return coord;\\n}\\n\\nvec2 twist(vec2 coord)\\n{\\n coord -= offset;\\n\\n float dist = length(coord);\\n\\n if (dist < radius)\\n {\\n float ratioDist = (radius - dist) / radius;\\n float angleMod = ratioDist * ratioDist * angle;\\n float s = sin(angleMod);\\n float c = cos(angleMod);\\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\\n }\\n\\n coord += offset;\\n\\n return coord;\\n}\\n\\nvoid main(void)\\n{\\n\\n vec2 coord = mapCoord(vTextureCoord);\\n\\n coord = twist(coord);\\n\\n coord = unmapCoord(coord);\\n\\n gl_FragColor = texture2D(uSampler, coord );\\n\\n}\\n\")||this;return Object.assign(r,n.defaults,t),r}return u(n,e),Object.defineProperty(n.prototype,\"offset\",{get:function(){return this.uniforms.offset},set:function(e){this.uniforms.offset=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.radius},set:function(e){this.uniforms.radius=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"angle\",{get:function(){return this.uniforms.angle},set:function(e){this.uniforms.angle=e},enumerable:!1,configurable:!0}),n.defaults={radius:200,angle:4,padding:20,offset:new t.Point},n}(n.Filter),Z=function(e){function n(t){var r,o=Object.assign(n.defaults,t),i=o.maxKernelSize,l=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o= 0.0 && dist > radius) { // radius < 0 means it's infinity\\n delta = dist - radius;\\n gap = gradient;\\n }\\n\\n if (delta > 0.0) {\\n float normalCount = gap / filterArea.x;\\n delta = (normalCount - delta) / normalCount;\\n countLimit *= delta;\\n strength *= delta;\\n if (countLimit < 1.0)\\n {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n }\\n\\n // randomize the lookup values to hide the fixed number of samples\\n float offset = rand(vTextureCoord, 0.0);\\n\\n float total = 0.0;\\n vec4 color = vec4(0.0);\\n\\n dir *= strength;\\n\\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\\n float percent = (t + offset) / MAX_KERNEL_SIZE;\\n float weight = 4.0 * (percent - percent * percent);\\n vec2 p = vTextureCoord + dir * percent;\\n vec4 sample = texture2D(uSampler, p);\\n\\n // switch to pre-multiplied alpha to correctly blur transparent images\\n // sample.rgb *= sample.a;\\n\\n color += sample * weight;\\n total += weight;\\n\\n if (t > countLimit){\\n break;\\n }\\n }\\n\\n color /= total;\\n // switch back from pre-multiplied alpha\\n // color.rgb /= color.a + 0.00001;\\n\\n gl_FragColor = color;\\n}\\n\".replace(\"${maxKernelSize}\",i.toFixed(1)))||this,Object.assign(r,l),r}return u(n,e),Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.uCenter},set:function(e){this.uniforms.uCenter=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"strength\",{get:function(){return this.uniforms.uStrength},set:function(e){this.uniforms.uStrength=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"innerRadius\",{get:function(){return this.uniforms.uInnerRadius},set:function(e){this.uniforms.uInnerRadius=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.uRadius},set:function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},enumerable:!1,configurable:!0}),n.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},n}(n.Filter);return e.AdjustmentFilter=m,e.AdvancedBloomFilter=h,e.AsciiFilter=g,e.BevelFilter=v,e.BloomFilter=y,e.BulgePinchFilter=b,e.CRTFilter=z,e.ColorMapFilter=x,e.ColorOverlayFilter=_,e.ColorReplaceFilter=C,e.ConvolutionFilter=S,e.CrossHatchFilter=F,e.DotFilter=O,e.DropShadowFilter=P,e.EmbossFilter=A,e.GlitchFilter=T,e.GlowFilter=w,e.GodrayFilter=D,e.KawaseBlurFilter=d,e.MotionBlurFilter=j,e.MultiColorReplaceFilter=M,e.OldFilmFilter=R,e.OutlineFilter=E,e.PixelateFilter=I,e.RGBSplitFilter=N,e.RadialBlurFilter=k,e.ReflectionFilter=L,e.ShockwaveFilter=X,e.SimpleLightmapFilter=B,e.TiltShiftAxisFilter=G,e.TiltShiftFilter=W,e.TiltShiftXFilter=K,e.TiltShiftYFilter=q,e.TwistFilter=Y,e.ZoomBlurFilter=Z,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters);Object.assign(PIXI.filters,__filters);\n//# sourceMappingURL=pixi-filters.js.map\n","import * as geo from \"./geo-utils.js\";\nimport { getTheme } from \"./themes.js\";\n// importing a local copy of PIXI filters, to avoid a long chain of npm pixi dependencies\nimport \"./lib/pixi-filters.min.js\";\n\nexport const render = async (container, state) => {\n container.clear();\n await addBackgroundImage(container, state.config);\n // floor render pass, no additional clipping\n await renderPass(container, state);\n // draw theme-painted areas as additional render passes\n await drawThemeAreas(container, state);\n};\n\nconst drawThemeAreas = async (container, state) => {\n for (let area of state.themeAreas) {\n const theme = getTheme(area.themeKey);\n if (!theme) {\n console.log(`No such ${area.themeType} theme: ${area.themeKey}`);\n continue;\n }\n // TODO: hacky way to pass down the actual theme to paint\n const areaState = state.clone();\n // TODO: how should we deal with different wall thicknesses, door colors, etc\n // which look jarring/off when two different themes meet up\n areaState.config = theme.config;\n // TODO: for now, just keep certain values from the main state config,\n // so the dungeon walls etc look consistent at meet up areas\n areaState.config.doorColor = state.config.doorColor;\n areaState.config.doorFillColor = state.config.doorFillColor;\n areaState.config.doorFillOpacity = state.config.doorFillOpacity;\n areaState.config.doorThickness = state.config.doorThickness;\n areaState.config.wallColor = state.config.wallColor;\n areaState.config.wallThickness = state.config.wallThickness;\n areaState.config.exteriorShadowOpacity = 0.0; // don't draw additional exterior shadows\n\n // mask for our area shape\n const areaContainer = new PIXI.Container();\n const areaMask = new PIXI.Graphics();\n areaMask.beginFill(0xffffff, 1.0);\n areaMask.drawPolygon(area.points.flat());\n areaMask.endFill();\n areaContainer.mask = areaMask;\n\n // render the theme, clipping to our rectangle\n const clipPoly = geo.pointsToPolygon(area.points);\n await renderPass(areaContainer, areaState, { clipPoly });\n\n container.addChild(areaMask);\n container.addChild(areaContainer);\n }\n};\n\nconst renderPass = async (container, state, options = {}) => {\n const floorGfx = new PIXI.Graphics();\n const interiorShadowGfx = new PIXI.Graphics();\n const wallGfx = new PIXI.Graphics();\n\n if (state.geometry) {\n // maybe draw an outer surrounding blurred shadow\n addExteriorShadow(container, state.config, state.geometry);\n\n // use a mask to clip the tiled background and interior shadows\n const clipMask = new PIXI.Graphics();\n drawMultiPolygonMask(clipMask, state.geometry);\n container.addChild(clipMask);\n\n interiorShadowGfx.mask = clipMask;\n // apply alpha filter once for entire shadow graphics, so overlaps aren't additive\n const alphaFilter = new PIXI.filters.AlphaFilter(\n state.config.interiorShadowOpacity\n );\n const blurFilter = new PIXI.filters.BlurFilter();\n interiorShadowGfx.filters = [alphaFilter, blurFilter];\n\n // maybe add a tiled background\n if (state.config.floorTexture) {\n // TODO: having both clipMask / clipPoly parameters is confusing.\n await addTiledBackground(\n container,\n clipMask,\n state.config.floorTexture,\n state.config.floorTextureTint,\n state.geometry,\n options.clipPoly\n );\n }\n\n // draw the dungeon geometry room(s)\n drawMultiPolygonRoom(\n floorGfx,\n interiorShadowGfx,\n wallGfx,\n state.config,\n state.geometry\n );\n }\n\n // TODO: need to apply texture to interior walls, too\n\n const wallMask = new PIXI.Graphics();\n const maskConfig = JSON.parse(JSON.stringify(state.config));\n maskConfig.wallColor = \"#000000\";\n\n // draw interior walls\n for (let wall of state.interiorWalls) {\n drawInteriorWallShadow(interiorShadowGfx, state.config, wall);\n if (state.config.wallTexture) {\n drawInteriorWall(wallMask, maskConfig, wall);\n } else {\n drawInteriorWall(wallGfx, state.config, wall);\n }\n }\n\n // draw doors\n for (let door of state.doors) {\n drawDoorShadow(interiorShadowGfx, state.config, door);\n drawDoor(wallGfx, wallMask, state.config, door);\n }\n for (let secretDoor of state.secretDoors) {\n drawInteriorWallShadow(interiorShadowGfx, state.config, secretDoor);\n drawSecretDoor(wallGfx, wallMask, state.config, secretDoor);\n }\n\n // layer everything properly\n container.addChild(floorGfx);\n container.addChild(interiorShadowGfx);\n if (state.config.wallTexture) {\n drawMultiPolygonWallMask(\n wallMask,\n state.geometry,\n state.config.wallThickness\n );\n container.addChild(wallMask);\n // expand our geometry, so we add sprites\n // under the half of the wall thickness that expands past the geometry\n const expandedGeometry = geo.expandGeometry(\n state.geometry,\n state.config.wallThickness / 2.0\n );\n await addTiledBackground(\n container,\n wallMask,\n state.config.wallTexture,\n state.config.wallTextureTint,\n expandedGeometry,\n options.clipPoly\n );\n }\n container.addChild(wallGfx);\n};\n\n/** Try-catch wrapper around loadTexture. */\nconst getTexture = async (path) => {\n try {\n const texture = await loadTexture(path);\n return texture;\n } catch (error) {\n console.log(error);\n }\n};\n\n/** Possibly add a background image. */\nconst addBackgroundImage = async (container, config) => {\n if (config.backgroundImage) {\n // mimicking MapLayer._drawBackground() behavior\n const texture = await getTexture(config.backgroundImage);\n if (texture?.valid) {\n const d = canvas.dimensions;\n const bg = new PIXI.Sprite(texture);\n bg.position.set(d.paddingX - d.shiftX, d.paddingY - d.shiftY);\n // resize the background image to match the scene dimensions\n bg.width = d.sceneWidth;\n bg.height = d.sceneHeight;\n maybeStartSpriteVideo(bg);\n container.addChild(bg);\n }\n }\n};\n\nconst maybeStartSpriteVideo = (sprite) => {\n // if video, start playing it\n const source = sprite.texture.baseTexture.resource.source;\n const isVideo = source && source.tagName === \"VIDEO\";\n if (isVideo) {\n source.loop = true;\n source.volume = game.settings.get(\"core\", \"globalAmbientVolume\");\n game.video.play(source);\n }\n};\n\n/** Add an exterior blurred shadow. */\nconst addExteriorShadow = (container, config, geometry) => {\n if (\n !config.exteriorShadowThickness ||\n !config.exteriorShadowOpacity ||\n !geometry\n ) {\n return;\n }\n for (let i = 0; i < geometry.getNumGeometries(); i++) {\n const poly = geometry.getGeometryN(i);\n addExteriorShadowForPoly(container, config, poly);\n }\n};\n\n/** Add an exterior blurred shadow for the given polygon. */\nconst addExteriorShadowForPoly = (container, config, poly) => {\n const outerShadow = new PIXI.Graphics();\n // normalize the expanded buffer to remove any oddities\n //const expanded = poly.buffer(config.exteriorShadowThickness).norm();\n const expanded = geo.expandGeometry(poly, config.exteriorShadowThickness);\n outerShadow.beginFill(\n PIXI.utils.string2hex(config.exteriorShadowColor),\n config.exteriorShadowOpacity\n );\n outerShadow.drawPolygon(\n expanded\n .getCoordinates()\n .map((c) => [c.x, c.y])\n .flat()\n );\n outerShadow.endFill();\n const blurFilter = new PIXI.filters.BlurFilter();\n outerShadow.filters = [blurFilter];\n container.addChild(outerShadow);\n};\n\n/** Add TilingSprites for floor or wall texture. */\nconst addTiledBackground = async (\n container,\n mask,\n texturePath,\n textureTint,\n geometry,\n clipPoly\n) => {\n const texture = await getTexture(texturePath);\n if (!texture?.valid) {\n return;\n }\n\n // assume square textures\n const textureSize = texture.width;\n // allow for scene padding in our total height/width\n const height = canvas.scene.data.height * (1 + 2 * canvas.scene.data.padding);\n const width = canvas.scene.data.width * (1 + 2 * canvas.scene.data.padding);\n const rows = Math.ceil(height / textureSize);\n const cols = Math.ceil(width / textureSize);\n\n const bg = new PIXI.Container();\n for (let row = 0; row < rows; row++) {\n for (let col = 0; col < cols; col++) {\n // only create a sprite if this row/col rectangle intersects with our map geometry\n const rect = geo.pointsToPolygon([\n [col * textureSize, row * textureSize],\n [(col + 1) * textureSize, row * textureSize],\n [(col + 1) * textureSize, (row + 1) * textureSize],\n [col * textureSize, (row + 1) * textureSize],\n [col * textureSize, row * textureSize],\n ]);\n if (\n (!clipPoly || geo.intersects(clipPoly, rect)) &&\n geo.intersects(geometry, rect) &&\n !geo.touches(geometry, rect)\n ) {\n const sprite = new PIXI.TilingSprite(texture, textureSize, textureSize);\n sprite.x = col * textureSize;\n sprite.y = row * textureSize;\n if (textureTint) {\n sprite.tint = foundry.utils.colorStringToHex(textureTint);\n }\n maybeStartSpriteVideo(sprite);\n bg.addChild(sprite);\n }\n }\n }\n bg.mask = mask;\n container.addChild(bg);\n};\n\nconst drawPolygonMask = (gfx, poly) => {\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n gfx.beginFill(0xffffff, 1.0);\n gfx.drawPolygon(flatCoords);\n gfx.endFill();\n\n const numHoles = poly.getNumInteriorRing();\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n gfx.lineStyle(0, 0x000000, 1.0, 1, 0.5);\n gfx.beginHole();\n gfx.drawPolygon(flatCoords);\n gfx.endHole();\n }\n};\n\nconst drawMultiPolygonMask = (gfx, multi) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n drawPolygonMask(gfx, poly);\n }\n};\n\nconst drawPolygonWallMask = (gfx, poly, wallThickness) => {\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n gfx.lineStyle(wallThickness, PIXI.utils.string2hex(\"#000000\"), 1.0, 0.5);\n gfx.drawPolygon(flatCoords);\n\n const numHoles = poly.getNumInteriorRing();\n // for (let i = 0; i < numHoles; i++) {\n // const hole = poly.getInteriorRingN(i);\n // const coords = hole.getCoordinates();\n // const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n // gfx.beginHole();\n // gfx.drawPolygon(flatCoords);\n // gfx.endHole();\n // }\n\n // draw interior hole walls/shadows\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n\n // draw hole wall poly\n gfx.lineStyle(wallThickness, PIXI.utils.string2hex(\"#000000\"), 1.0);\n gfx.drawPolygon(flatCoords);\n }\n};\n\nconst drawMultiPolygonWallMask = (gfx, multi, wallThickness) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n drawPolygonWallMask(gfx, poly, wallThickness);\n }\n};\n\nconst drawMultiPolygonRoom = (\n floorGfx,\n interiorShadowGfx,\n wallGfx,\n config,\n multi\n) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n drawPolygonRoom(floorGfx, interiorShadowGfx, wallGfx, config, poly);\n }\n};\n\nconst drawPolygonRoom = (\n floorGfx,\n interiorShadowGfx,\n wallGfx,\n config,\n poly\n) => {\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n\n // if no floor texture is specified, draw a solid-color floor\n if (!config.floorTexture) {\n floorGfx.beginFill(PIXI.utils.string2hex(config.floorColor), 1.0);\n floorGfx.drawPolygon(flatCoords);\n floorGfx.endFill();\n }\n\n // cut out holes\n const numHoles = poly.getNumInteriorRing();\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n floorGfx.lineStyle(0, 0x000000, 1.0, 1, 0.5);\n floorGfx.beginHole();\n floorGfx.drawPolygon(flatCoords);\n floorGfx.endHole();\n }\n\n // draw inner wall drop shadows\n if (config.interiorShadowOpacity) {\n // TODO: don't need to set this multiple times... bubble up?\n // TODO: there's a weird lag or visual artifact happening between the inner blur shadow and the solid line wall,\n // that sometimes leaves an unshadowed or lighter pixel line/area next to the wall.\n // To (partially) work around that, draw a wider shadow from the middle of the wall, rather than inside.\n interiorShadowGfx.lineStyle({\n width: config.wallThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n });\n interiorShadowGfx.drawPolygon(flatCoords);\n }\n\n // draw outer wall poly\n if (!config.wallTexture) {\n wallGfx.lineStyle(\n config.wallThickness,\n PIXI.utils.string2hex(config.wallColor),\n 1.0,\n 0.5\n );\n wallGfx.drawPolygon(flatCoords);\n }\n\n // draw interior hole walls/shadows\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n\n // draw hole wall outer drop shadows\n interiorShadowGfx.drawPolygon(flatCoords);\n\n // draw hole wall poly\n if (!config.wallTexture) {\n wallGfx.lineStyle(\n config.wallThickness,\n PIXI.utils.string2hex(config.wallColor),\n 1.0\n );\n wallGfx.drawPolygon(flatCoords);\n }\n }\n};\n\n// [x1, y1, x2, y2]\nconst drawInteriorWall = (wallGfx, config, wall) => {\n wallGfx.lineStyle({\n width: config.wallThickness,\n color: PIXI.utils.string2hex(config.wallColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n wallGfx.moveTo(wall[0], wall[1]);\n wallGfx.lineTo(wall[2], wall[3]);\n};\n\nconst drawInteriorWallShadow = (gfx, config, wall) => {\n gfx.lineStyle({\n // wide enough to be exposed on either side\n width: config.wallThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n cap: \"round\",\n });\n gfx.moveTo(wall[2], wall[3]);\n gfx.lineTo(wall[0], wall[1]);\n};\n\n// [x1, y1, x2, y2]\nconst drawDoor = (wallGfx, wallMask, config, door) => {\n // calculate some door dimensions\n const totalLength = geo.distanceBetweenPoints(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const jambLength = 20;\n const rectLength = totalLength - 2 * jambLength;\n const jambFraction = jambLength / totalLength;\n const rectFraction = rectLength / totalLength;\n const rectEndFraction = jambFraction + rectFraction;\n const deltaX = door[2] - door[0];\n const deltaY = door[3] - door[1];\n const jamb1End = [\n door[0] + deltaX * jambFraction,\n door[1] + deltaY * jambFraction,\n ];\n const rectEnd = [\n door[0] + deltaX * rectEndFraction,\n door[1] + deltaY * rectEndFraction,\n ];\n const doorRect = geo.rectangleForSegment(\n config.doorThickness,\n jamb1End[0],\n jamb1End[1],\n rectEnd[0],\n rectEnd[1]\n );\n\n // draw the door jamb at wall thickness, either into the texture mask or onto the wall graphics\n const wallColor = config.wallTexture ? \"#000000\" : config.wallColor;\n wallGfx.lineStyle({\n width: config.wallThickness,\n color: PIXI.utils.string2hex(wallColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n if (config.wallTexture) {\n wallMask.moveTo(door[0], door[1]);\n // left jamb\n wallMask.lineTo(jamb1End[0], jamb1End[1]);\n // right jamb\n wallMask.moveTo(rectEnd[0], rectEnd[1]);\n wallMask.lineTo(door[2], door[3]);\n } else {\n wallGfx.moveTo(door[0], door[1]);\n // left jamb\n wallGfx.lineTo(jamb1End[0], jamb1End[1]);\n // right jamb\n wallGfx.moveTo(rectEnd[0], rectEnd[1]);\n wallGfx.lineTo(door[2], door[3]);\n }\n // door rectangle\n if (config.doorFillOpacity) {\n wallGfx.beginFill(\n PIXI.utils.string2hex(config.doorFillColor),\n config.doorFillOpacity\n );\n }\n // door rectangle is drawn at a different line thickness\n wallGfx.lineStyle(\n config.doorLineThickness,\n PIXI.utils.string2hex(config.doorColor),\n 1.0,\n 0.5\n );\n wallGfx.drawPolygon(\n doorRect[0],\n doorRect[1],\n doorRect[2],\n doorRect[3],\n doorRect[4],\n doorRect[5],\n doorRect[6],\n doorRect[7],\n doorRect[0],\n doorRect[1]\n );\n if (config.doorFillColor) {\n wallGfx.endFill();\n }\n};\n\nconst drawSecretDoor = (wallGfx, wallMask, config, door) => {\n const isGM = game.user.isGM;\n if (\n (isGM && config.secretDoorStyleGM === \"door\") ||\n (!isGM && config.secretDoorStylePlayer === \"door\")\n ) {\n // TODO: need to draw door shadow. where?\n drawDoor(wallGfx, wallMask, config, door);\n return;\n }\n\n const totalLength = geo.distanceBetweenPoints(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const rectLength = 40.0;\n const jambLength = (totalLength - rectLength) / 2.0;\n const jambFraction = jambLength / totalLength;\n const rectFraction = rectLength / totalLength;\n const rectEndFraction = jambFraction + rectFraction;\n const deltaX = door[2] - door[0];\n const deltaY = door[3] - door[1];\n const jamb1End = [\n door[0] + deltaX * jambFraction,\n door[1] + deltaY * jambFraction,\n ];\n const middle = [door[0] + deltaX * 0.5, door[1] + deltaY * 0.5];\n const rectEnd = [\n door[0] + deltaX * rectEndFraction,\n door[1] + deltaY * rectEndFraction,\n ];\n const doorRect = geo.rectangleForSegment(\n 30.0,\n jamb1End[0],\n jamb1End[1],\n rectEnd[0],\n rectEnd[1]\n );\n\n // draw a wall across the door opening\n const wallColor = config.wallTexture ? \"#000000\" : config.wallColor;\n wallGfx.lineStyle({\n width: config.wallThickness,\n color: PIXI.utils.string2hex(wallColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n if (config.wallTexture) {\n wallMask.moveTo(door[0], door[1]);\n wallMask.lineTo(door[2], door[3]);\n } else {\n wallGfx.moveTo(door[0], door[1]);\n wallGfx.lineTo(door[2], door[3]);\n }\n\n // possibly draw an additional S-shape through the wall\n if (\n (isGM && config.secretDoorStyleGM === \"secret\") ||\n (!isGM && config.secretDoorStylePlayer === \"secret\")\n ) {\n const midRect = geo.rectangleForSegment(\n 50.0,\n jamb1End[0],\n jamb1End[1],\n middle[0],\n middle[1]\n );\n const midRect2 = geo.rectangleForSegment(\n 50.0,\n middle[0],\n middle[1],\n rectEnd[0],\n rectEnd[1]\n );\n wallGfx.lineStyle({\n width: 5.0,\n color: PIXI.utils.string2hex(config.secretDoorSColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n wallGfx.moveTo(doorRect[6], doorRect[7]);\n wallGfx.bezierCurveTo(\n midRect[0],\n midRect[1],\n midRect[2],\n midRect[3],\n middle[0],\n middle[1]\n );\n wallGfx.bezierCurveTo(\n midRect2[6],\n midRect2[7],\n midRect2[4],\n midRect2[5],\n doorRect[2],\n doorRect[3]\n );\n }\n};\n\nconst drawDoorShadow = (gfx, config, door) => {\n // TODO: DRY up these repeated dimension calculations\n const totalLength = geo.distanceBetweenPoints(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const jambLength = 20;\n const rectLength = totalLength - 2 * jambLength;\n const jambFraction = jambLength / totalLength;\n const rectFraction = rectLength / totalLength;\n const rectEndFraction = jambFraction + rectFraction;\n const deltaX = door[2] - door[0];\n const deltaY = door[3] - door[1];\n const jamb1End = [\n door[0] + deltaX * jambFraction,\n door[1] + deltaY * jambFraction,\n ];\n const rectEnd = [\n door[0] + deltaX * rectEndFraction,\n door[1] + deltaY * rectEndFraction,\n ];\n const doorRect = geo.rectangleForSegment(\n config.doorThickness,\n jamb1End[0],\n jamb1End[1],\n rectEnd[0],\n rectEnd[1]\n );\n\n gfx.lineStyle({\n // wide enough to be exposed on either side\n width: config.wallThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n });\n\n // left jamb\n gfx.moveTo(door[2], door[3]);\n gfx.lineTo(rectEnd[0], rectEnd[1]);\n\n // right jamb\n gfx.moveTo(jamb1End[0], jamb1End[1]);\n gfx.lineTo(door[0], door[1]);\n\n gfx.lineStyle({\n // wide enough to be exposed on either side\n width: config.doorLineThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n });\n\n // door rectangle\n gfx.drawPolygon(\n doorRect[0],\n doorRect[1],\n doorRect[2],\n doorRect[3],\n doorRect[4],\n doorRect[5],\n doorRect[6],\n doorRect[7],\n doorRect[0],\n doorRect[1]\n );\n};\n","import { DungeonState } from \"./dungeonstate.js\";\nimport { render } from \"./renderer.js\";\nimport * as geo from \"./geo-utils.js\";\nimport { getThemePainterThemeKey } from \"./themes.js\";\n\n/**\n * @extends {PlaceableObject}\n */\n// TODO: does Dungeon even need to be a PlaceableObject? Or could it just extend PIXI.Container?\nexport class Dungeon extends PlaceableObject {\n // expects JournalEntry for constructor\n constructor(journalEntry, note) {\n // note will be saved as this.document\n super(note);\n this.journalEntry = journalEntry;\n // time-ordered array of DungeonStates\n this.history = [DungeonState.startState()];\n this.historyIndex = 0;\n }\n\n /* -------------------------------------------- */\n\n // TODO: figure out what documentName / embeddedName / type we should be using\n /** @inheritdoc */\n static embeddedName = \"Drawing\";\n\n /* -------------------------------------------- */\n\n deleteAll() {\n // keep our most recent config around\n const lastState = this.state();\n const resetState = DungeonState.startState();\n resetState.config = lastState.config;\n this.history = [resetState];\n this.historyIndex = 0;\n this.history[this.historyIndex].saveToJournalEntry(this.journalEntry);\n this.refresh();\n }\n\n state() {\n return this.history[this.historyIndex];\n }\n\n /* -------------------------------------------- */\n /* Rendering */\n /* -------------------------------------------- */\n\n /** @override */\n draw() {\n this.refresh();\n return this;\n }\n\n /** @override */\n refresh() {\n render(this, this.state());\n }\n\n async maybeRefresh(journalEntry) {\n if (journalEntry.id === this.journalEntry.id) {\n const savedState = await DungeonState.loadFromJournalEntry(\n this.journalEntry\n );\n // update state, but don't save to journal\n await this.pushState(savedState, false);\n }\n }\n\n /* -------------------------------------------- */\n\n async loadFromJournalEntry() {\n const savedState = await DungeonState.loadFromJournalEntry(\n this.journalEntry\n );\n this.history = [savedState];\n this.historyIndex = 0;\n await this.refresh();\n }\n\n /* -------------------------------------------- */\n\n async undo() {\n this.historyIndex = Math.max(0, this.historyIndex - 1);\n await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry);\n await this.refresh();\n }\n\n async redo() {\n this.historyIndex = Math.min(\n this.history.length - 1,\n this.historyIndex + 1\n );\n await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry);\n await this.refresh();\n }\n\n /* -------------------------------------------- */\n\n async pushState(newState, saveToJournalEntry = true) {\n // throw away any history states after current\n for (let i = this.history.length - 1; i > this.historyIndex; i--) {\n this.history.pop();\n }\n // and add our new state\n this.history.push(newState);\n this.historyIndex++;\n\n if (saveToJournalEntry) {\n await newState.saveToJournalEntry(this.journalEntry);\n }\n await this.refresh();\n }\n\n async setConfig(config) {\n const newState = this.state().clone();\n newState.config = config;\n await this.pushState(newState);\n }\n\n async addDoor(x1, y1, x2, y2) {\n await this._addDoor(x1, y1, x2, y2, \"doors\");\n }\n\n async addSecretDoor(x1, y1, x2, y2) {\n await this._addDoor(x1, y1, x2, y2, \"secretDoors\");\n }\n\n async _addDoor(x1, y1, x2, y2, doorProperty) {\n const newState = this.history[this.historyIndex].clone();\n const doorPoly = geo.twoPointsToLineString(x1, y1, x2, y2);\n\n // possibly split interior walls\n const wallsToDelete = [];\n const wallsToAdd = [];\n for (let wall of newState.interiorWalls) {\n const wallPoly = geo.twoPointsToLineString(\n wall[0],\n wall[1],\n wall[2],\n wall[3]\n );\n const contains = geo.contains(wallPoly, doorPoly);\n if (contains) {\n wallsToDelete.push(wall);\n // make sure points are consistently ordered\n const w1 = geo.lesserPoint(wall[0], wall[1], wall[2], wall[3]);\n const w2 = geo.greaterPoint(wall[0], wall[1], wall[2], wall[3]);\n const d1 = geo.lesserPoint(x1, y1, x2, y2);\n const d2 = geo.greaterPoint(x1, y1, x2, y2);\n wallsToAdd.push([w1[0], w1[1], d1[0], d1[1]]);\n wallsToAdd.push([d2[0], d2[1], w2[0], w2[1]]);\n }\n }\n newState.interiorWalls = newState.interiorWalls.filter(\n (w) => wallsToDelete.indexOf(w) === -1\n );\n newState.interiorWalls = newState.interiorWalls.concat(wallsToAdd);\n newState[doorProperty].push([x1, y1, x2, y2]);\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async subtractDoors(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const doorsToKeep = this.history[this.historyIndex].doors.filter((d) => {\n const doorPoly = geo.twoPointsToLineString(d[0], d[1], d[2], d[3]);\n return !geo.intersects(rectPoly, doorPoly);\n });\n if (doorsToKeep.length != this.history[this.historyIndex].doors.length) {\n const newState = this.history[this.historyIndex].clone();\n newState.doors = doorsToKeep;\n await this.pushState(newState);\n }\n }\n\n /**\n * Split the wall if it's drawn over an existing door.\n *\n * @returns [[x1, y1, x2, y2], ...]\n */\n _maybeSplitWall(x1, y1, x2, y2, doors) {\n // TODO: this logic doesn't handle two doors side by side\n const wallPoly = geo.twoPointsToLineString(x1, y1, x2, y2);\n for (let door of doors) {\n const doorPoly = geo.twoPointsToLineString(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const contains = geo.contains(wallPoly, doorPoly);\n if (contains) {\n // make sure points are consistently ordered\n const w1 = geo.lesserPoint(x1, y1, x2, y2);\n const w2 = geo.greaterPoint(x1, y1, x2, y2);\n const d1 = geo.lesserPoint(door[0], door[1], door[2], door[3]);\n const d2 = geo.greaterPoint(door[0], door[1], door[2], door[3]);\n return [\n [w1[0], w1[1], d1[0], d1[1]],\n [d2[0], d2[1], w2[0], w2[1]],\n ];\n }\n }\n // wall didn't contain any door, so return as-is\n return [[x1, y1, x2, y2]];\n }\n\n async addInteriorWall(x1, y1, x2, y2) {\n const newState = this.history[this.historyIndex].clone();\n const wallsToAdd = this._maybeSplitWall(x1, y1, x2, y2, newState.doors);\n newState.interiorWalls = newState.interiorWalls.concat(wallsToAdd);\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async subtractInteriorWalls(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const wallsToKeep = this.history[this.historyIndex].interiorWalls.filter(\n (w) => {\n const wallPoly = geo.twoPointsToLineString(w[0], w[1], w[2], w[3]);\n return !geo.intersects(rectPoly, wallPoly);\n }\n );\n if (\n wallsToKeep.length != this.history[this.historyIndex].interiorWalls.length\n ) {\n const newState = this.history[this.historyIndex].clone();\n newState.interiorWalls = wallsToKeep;\n await this.pushState(newState);\n }\n }\n\n // {x:, y:, height:, width:}\n async subtractDoorsAndInteriorWalls(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const oldState = this.history[this.historyIndex];\n const doorsToKeep = oldState.doors.filter((d) => {\n const doorPoly = geo.twoPointsToLineString(d[0], d[1], d[2], d[3]);\n return !geo.intersects(rectPoly, doorPoly);\n });\n const secretDoorsToKeep = oldState.secretDoors.filter((d) => {\n const doorPoly = geo.twoPointsToLineString(d[0], d[1], d[2], d[3]);\n return !geo.intersects(rectPoly, doorPoly);\n });\n const wallsToKeep = oldState.interiorWalls.filter((w) => {\n const wallPoly = geo.twoPointsToLineString(w[0], w[1], w[2], w[3]);\n return !geo.intersects(rectPoly, wallPoly);\n });\n if (\n doorsToKeep.length != oldState.doors.length ||\n secretDoorsToKeep.length != oldState.secretDoors.length ||\n wallsToKeep.length != oldState.interiorWalls.length\n ) {\n const newState = oldState.clone();\n newState.doors = doorsToKeep;\n newState.secretDoors = secretDoorsToKeep;\n newState.interiorWalls = wallsToKeep;\n await this.pushState(newState);\n }\n }\n\n async _addPoly(poly) {\n const oldState = this.history[this.historyIndex];\n const newState = oldState.clone();\n if (newState.geometry) {\n newState.geometry = geo.union(newState.geometry, poly);\n const touches = geo.touches(oldState.geometry, poly);\n if (touches) {\n const intersection = geo.intersection(oldState.geometry, poly);\n const coordinates = intersection.getCoordinates();\n // TODO: do we need to handle more complicated overlaps, GeometryCollection etc?\n // this coordinate 2-step is flimsy\n if (coordinates.length > 1 && coordinates.length % 2 === 0) {\n for (let i = 0; i < coordinates.length; i += 2) {\n const wallsToAdd = this._maybeSplitWall(\n coordinates[i].x,\n coordinates[i].y,\n coordinates[i + 1].x,\n coordinates[i + 1].y,\n newState.doors\n );\n newState.interiorWalls = newState.interiorWalls.concat(wallsToAdd);\n }\n }\n } else {\n // also nuke any interior walls in this new poly\n const wallsToKeep = newState.interiorWalls.filter((w) => {\n const wallPoly = geo.twoPointsToLineString(w[0], w[1], w[2], w[3]);\n return !geo.intersects(poly, wallPoly);\n });\n if (wallsToKeep.length != newState.interiorWalls.length) {\n newState.interiorWalls = wallsToKeep;\n }\n }\n } else {\n newState.geometry = poly;\n }\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async addRectangle(rect) {\n const poly = geo.rectToPolygon(rect);\n this._addPoly(poly);\n }\n\n // {x:, y:, height:, width:}\n async subtractRectangle(rect) {\n // only makes sense to subtract if we have geometry\n if (!this.history[this.historyIndex].geometry) {\n return;\n }\n const poly = geo.rectToPolygon(rect);\n // and if the poly intersects existing geometry\n if (!geo.intersects(this.history[this.historyIndex].geometry, poly)) {\n return;\n }\n const newState = this.history[this.historyIndex].clone();\n newState.geometry = geo.difference(newState.geometry, poly);\n await this.pushState(newState);\n }\n\n // [[x,y]...]\n async addPolygon(points) {\n try {\n const poly = geo.pointsToPolygon(points);\n await this._addPoly(poly);\n } catch (error) {\n console.log(error);\n }\n }\n\n /**\n * @param {Object} rect\n * @param {Number} rect.x\n * @param {Number} rect.y\n * @param {Number} rect.height\n * @param {Number} rect.width\n */\n async addThemeArea(points) {\n try {\n // make sure we can create a polygon from the points\n geo.pointsToPolygon(points);\n } catch (error) {\n console.log(error);\n return;\n }\n\n const themeKey = getThemePainterThemeKey();\n const newArea = {\n points,\n themeKey,\n };\n const newState = this.history[this.historyIndex].clone();\n newState.themeAreas.push(newArea);\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async removeThemeAreas(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const areasToKeep = this.history[this.historyIndex].themeAreas.filter(\n (a) => {\n try {\n const areaPoly = geo.pointsToPolygon(a.points);\n return !geo.intersects(rectPoly, areaPoly);\n } catch (error) {\n console.log(error);\n return false;\n }\n }\n );\n if (\n areasToKeep.length != this.history[this.historyIndex].themeAreas.length\n ) {\n const newState = this.history[this.historyIndex].clone();\n newState.themeAreas = areasToKeep;\n await this.pushState(newState);\n }\n }\n}\n","import * as constants from \"./constants.js\";\nimport { Dungeon } from \"./dungeon.js\";\n\nconst FOLDER_NAME = \"Dungeon Draw\";\n\nconst findDungeonEntryAndNote = () => {\n for (const note of canvas.scene.notes) {\n const journalEntry = game.journal.get(note.data.entryId);\n if (journalEntry) {\n const flag = journalEntry.getFlag(\n constants.MODULE_NAME,\n \"dungeonVersion\"\n );\n if (flag) {\n return { journalEntry, note };\n }\n }\n }\n return { journalEntry: null, note: null };\n};\n\nconst createDungeonEntryAndNote = async () => {\n const journalEntry = await createDungeonEntry();\n const note = await createDungeonNote(journalEntry);\n return { journalEntry, note };\n};\n\nconst createDungeonEntry = async () => {\n let folder = game.folders\n .filter((f) => f.data.type === \"JournalEntry\" && f.name === FOLDER_NAME)\n .pop();\n if (!folder) {\n folder = await Folder.create({\n name: FOLDER_NAME,\n type: \"JournalEntry\",\n });\n }\n\n const journalEntry = await JournalEntry.create({\n name: canvas.scene.name,\n folder: folder.id,\n flags: {\n \"dungeon-draw\": {\n // extract string constant somewhere\n dungeonVersion: \"1.0\",\n },\n },\n });\n return journalEntry;\n};\n\nconst createDungeonNote = async (journalEntry) => {\n await canvas.scene.createEmbeddedDocuments(\"Note\", [\n {\n entryId: journalEntry.id,\n fontSize: 20,\n icon: \"icons/svg/cave.svg\",\n iconSize: 32,\n textAnchor: 1,\n textColor: \"#FFFFFF\",\n x: 50,\n y: 50,\n iconTint: \"\",\n text: \"Dungeon Draw\",\n flags: {},\n },\n ]);\n};\n\n/**\n *\n * @extends {PlaceablesLayer}\n */\nexport class DungeonLayer extends PlaceablesLayer {\n static LAYER_NAME = \"dungeon\";\n\n constructor() {\n super();\n this.dungeonContainer = null;\n this.dungeon = null;\n }\n\n /** @inheritdoc */\n static get layerOptions() {\n return foundry.utils.mergeObject(super.layerOptions, {\n name: DungeonLayer.LAYER_NAME,\n // canDragCreate: game.user.isGM,\n canDragCreate: true,\n zIndex: -1, // under tiles and background image\n });\n }\n\n // TODO: figure out what documentName / embeddedName / type we should be using\n /** @inheritdoc */\n static documentName = \"Drawing\";\n\n /**\n * Get initial data for a new drawing.\n * Start with some global defaults, apply user default config, then apply mandatory overrides per tool.\n * @param {Object} origin The initial coordinate\n * @return {Object} The new drawing data\n */\n _getNewDrawingData(origin) {\n const tool = game.activeTool;\n const data = {\n fillColor: game.user.color,\n strokeColor: game.user.color,\n strokeWidth: 8,\n };\n // Mandatory additions\n data.x = origin.x;\n data.y = origin.y;\n data.author = game.user.id;\n // Tool-based settings\n switch (tool) {\n case \"addrect\":\n case \"subtractdoor\":\n case \"subtractrect\":\n case \"themeeraser\":\n data.type = CONST.DRAWING_TYPES.RECTANGLE;\n data.points = [];\n break;\n case \"adddoor\":\n case \"addpoly\":\n case \"addsecretdoor\":\n case \"addwall\":\n case \"themepainter\":\n data.type = CONST.DRAWING_TYPES.POLYGON;\n data.points = [[0, 0]];\n break;\n case \"ellipse\":\n data.type = CONST.DRAWING_TYPES.ELLIPSE;\n data.points = [];\n break;\n }\n return data;\n }\n\n /** @override */\n async deleteAll() {\n const type = this.constructor.documentName;\n if (!game.user.isGM) {\n throw new Error(\n `You do not have permission to delete ${type} objects from the Scene.`\n );\n }\n return Dialog.confirm({\n title: game.i18n.localize(\"CONTROLS.ClearAll\"),\n content: `

${game.i18n.format(\"CONTROLS.ClearAllHint\", { type })}

`,\n yes: () => this._deleteAll(),\n });\n }\n\n // actually delete everything\n async _deleteAll() {\n this.dungeon?.deleteAll();\n }\n\n /* -------------------------------------------- */\n\n async loadDungeon() {\n const { journalEntry, note } = await findDungeonEntryAndNote();\n if (journalEntry) {\n this.dungeon = new Dungeon(journalEntry, note);\n await this.dungeon.loadFromJournalEntry();\n // add dungeon underneath any placeables or drawing preview\n this.addChildAt(this.dungeon, 0);\n } else {\n // no journal entry and note found, so make sure dungeon is nulled on this layer\n this.dungeon = null;\n }\n }\n\n async createNewDungeon() {\n await createDungeonEntryAndNote();\n await this.loadDungeon();\n }\n\n /* -------------------------------------------- */\n /* Rendering */\n /* -------------------------------------------- */\n\n /** @inheritdoc */\n async draw() {\n await super.draw();\n return this;\n }\n\n /* -------------------------------------------- */\n /* Event Listeners and Handlers */\n /* -------------------------------------------- */\n\n /** @override */\n async _onClickLeft(event) {\n const { preview, createState, originalEvent } = event.data;\n\n // Continue polygon point placement\n if (createState >= 1 && preview.isPolygon) {\n let point = event.data.destination;\n if (!originalEvent.shiftKey)\n point = canvas.grid.getSnappedPosition(\n point.x,\n point.y,\n this.gridPrecision\n );\n preview._addPoint(point, false);\n preview._chain = true; // Note that we are now in chain mode\n return preview.refresh();\n }\n\n await super._onClickLeft(event);\n }\n\n /** @override */\n _onClickLeft2(event) {\n const { createState, preview } = event.data;\n\n // Conclude polygon placement with double-click\n if (createState >= 1 && preview.isPolygon) {\n event.data.createState = 2;\n return this._onDragLeftDrop(event);\n }\n\n super._onClickLeft2(event);\n }\n\n /** @override */\n async _onDragLeftStart(event) {\n await super._onDragLeftStart(event);\n\n // we use a Drawing as our preview, but then on end-drag/completion,\n // update our single Dungeon instance.\n const data = this._getNewDrawingData(event.data.origin);\n const document = new DrawingDocument(data, { parent: canvas.scene });\n const drawing = new Drawing(document);\n event.data.preview = this.preview.addChild(drawing);\n return drawing.draw();\n }\n\n /** @override */\n _onDragLeftMove(event) {\n const { preview, createState } = event.data;\n if (!preview) {\n return;\n }\n if (preview.parent === null) {\n // In theory this should never happen, but rarely does\n this.preview.addChild(preview);\n }\n if (createState >= 1) {\n preview._onMouseDraw(event);\n if (\n preview.data.type !== CONST.DRAWING_TYPES.POLYGON ||\n game.activeTool === \"adddoor\" ||\n game.activeTool === \"addsecretdoor\" ||\n game.activeTool === \"addwall\"\n ) {\n event.data.createState = 2;\n }\n }\n }\n\n /** @override */\n async _onDragLeftDrop(event) {\n const { createState, destination, origin, preview } = event.data;\n\n // Successful drawing completion\n if (createState === 2) {\n // create a new dungeon if we don't already have one\n if (!this.dungeon) {\n await this.createNewDungeon();\n }\n\n const distance = Math.hypot(\n destination.x - origin.x,\n destination.y - origin.y\n );\n const minDistance = distance >= canvas.dimensions.size / 8;\n const completePolygon =\n preview.isPolygon && preview.data.points.length > 2;\n\n if (game.activeTool === \"adddoor\") {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n await this.dungeon.addDoor(\n data.x,\n data.y,\n data.x + data.points[1][0],\n data.y + data.points[1][1]\n );\n }\n if (game.activeTool === \"addsecretdoor\") {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n await this.dungeon.addSecretDoor(\n data.x,\n data.y,\n data.x + data.points[1][0],\n data.y + data.points[1][1]\n );\n } else if (game.activeTool === \"addwall\") {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n await this.dungeon.addInteriorWall(\n data.x,\n data.y,\n data.x + data.points[1][0],\n data.y + data.points[1][1]\n );\n } else if (minDistance || completePolygon) {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n const createData = this.constructor.placeableClass.normalizeShape(data);\n\n if (game.activeTool === \"addpoly\") {\n const length = createData.points.length;\n if (\n length > 2 &&\n (createData.points[0][0] !== createData.points[length - 1][0] ||\n createData.points[0][1] !== createData.points[length - 1][1])\n ) {\n // auto-close the polygon\n createData.points.push(createData.points[0]);\n }\n const offsetPoints = createData.points.map((p) => [\n p[0] + createData.x,\n p[1] + createData.y,\n ]);\n await this.dungeon.addPolygon(offsetPoints);\n } else if (game.activeTool === \"addrect\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.addRectangle(rect);\n } else if (game.activeTool === \"subtractdoor\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.subtractDoorsAndInteriorWalls(rect);\n } else if (game.activeTool === \"themeeraser\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.removeThemeAreas(rect);\n } else if (game.activeTool === \"themepainter\") {\n const length = createData.points.length;\n if (\n length > 2 &&\n (createData.points[0][0] !== createData.points[length - 1][0] ||\n createData.points[0][1] !== createData.points[length - 1][1])\n ) {\n // auto-close the polygon\n createData.points.push(createData.points[0]);\n }\n const offsetPoints = createData.points.map((p) => [\n p[0] + createData.x,\n p[1] + createData.y,\n ]);\n await this.dungeon.addThemeArea(offsetPoints);\n } else if (game.activeTool === \"subtractrect\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.subtractRectangle(rect);\n }\n }\n\n // Cancel the preview\n return this._onDragLeftCancel(event);\n }\n\n // In-progress polygon\n if (createState === 1 && preview.isPolygon) {\n event.data.originalEvent.preventDefault();\n if (preview._chain) {\n return;\n }\n return this._onClickLeft(event);\n }\n\n // Incomplete drawing\n return this._onDragLeftCancel(event);\n }\n}\n","import { ConfigSheet } from \"./configsheet.js\";\nimport { DungeonLayer } from \"./dungeonlayer.js\";\nimport * as constants from \"./constants.js\";\n\nexport class DungeonDraw {\n static init() {\n console.log(\"***** DUNGEON DRAW *****\");\n game.settings.register(constants.MODULE_NAME, \"releaseNotesVersion\", {\n name: \"Last version we showed release notes.\",\n scope: \"client\",\n default: \"\",\n type: String,\n config: false,\n });\n game.settings.register(constants.MODULE_NAME, \"customThemes\", {\n name: \"Custom themes.\",\n scope: \"client\",\n default: \"{}\",\n type: String,\n config: false,\n });\n game.settings.register(\n constants.MODULE_NAME,\n constants.SETTING_THEME_PAINTER_THEME,\n {\n name: \"Theme painter theme key.\",\n scope: \"client\",\n default: \"module.cavern\",\n type: String,\n config: false,\n }\n );\n }\n\n static ready() {\n DungeonDraw.maybeShowReleaseNotes();\n }\n\n static async maybeShowReleaseNotes() {\n if (!game.user.isGM) {\n // GMs only\n return;\n }\n const moduleVersion = game.modules.get(constants.MODULE_NAME).data.version;\n const settingsVersion = game.settings.get(\n constants.MODULE_NAME,\n \"releaseNotesVersion\"\n );\n if (moduleVersion === settingsVersion) {\n // they've already seen it\n return;\n }\n const resp = await fetch(\"modules/dungeon-draw/CHANGELOG.md\");\n const changelog = await resp.text();\n // keep only the most recent changelog section\n const firstChangelog = \"#\" + changelog.split(\"#\")[1];\n // show it in a Dialog\n const html = await renderTemplate(\n \"modules/dungeon-draw/templates/release-notes.html\",\n {\n data: {\n version: moduleVersion,\n changelog: firstChangelog,\n },\n }\n );\n const dialog = new Dialog(\n {\n title: game.i18n.localize(\"DD.ReleaseNotes\"),\n content: html,\n buttons: {\n roll: {\n icon: '',\n label: \"OK\",\n },\n },\n },\n {\n width: 600,\n }\n );\n dialog.render(true);\n // mark this version as shown\n await game.settings.set(\n constants.MODULE_NAME,\n \"releaseNotesVersion\",\n moduleVersion\n );\n }\n\n static getSceneControlButtons(controls) {\n CONFIG.Canvas.layers.dungeon = DungeonLayer;\n CONFIG.Dungeon = {\n //documentClass: DungeonDocument,\n layerClass: DungeonLayer,\n //sheetClass: DungeonConfig\n };\n\n controls.push({\n name: \"dungeondraw\",\n title: \"DD.SceneControlTitle\",\n layer: DungeonLayer.LAYER_NAME,\n icon: \"fas fa-dungeon\",\n visible: game.user.isTrusted,\n tools: [\n {\n name: \"addrect\",\n title: \"DD.ButtonTitleAddRect\",\n icon: \"fas fa-plus-square\",\n },\n {\n name: \"subtractrect\",\n title: \"DD.ButtonTitleSubtractRect\",\n icon: \"fas fa-minus-square\",\n },\n {\n name: \"addpoly\",\n title: \"DD.ButtonTitleAddPoly\",\n icon: \"fas fa-draw-polygon\",\n },\n {\n name: \"addwall\",\n title: \"DD.ButtonTitleAddWall\",\n icon: \"fas fa-bars\",\n },\n {\n name: \"adddoor\",\n title: \"DD.ButtonTitleAddDoor\",\n icon: \"fas fa-door-open\",\n },\n {\n name: \"addsecretdoor\",\n title: \"DD.ButtonTitleAddSecretDoor\",\n icon: \"fas fa-mask\",\n },\n {\n name: \"subtractdoor\",\n title: \"DD.ButtonTitleSubtractDoorsAndWalls\",\n icon: \"fas fa-window-close\",\n },\n {\n name: \"themepainter\",\n title: \"DD.ButtonTitleThemePainter\",\n icon: \"fas fa-brush\",\n },\n {\n name: \"themeeraser\",\n title: \"DD.ButtonTitleThemeEraser\",\n icon: \"fas fa-eraser\",\n },\n {\n name: \"undo\",\n title: \"DD.ButtonTitleUndo\",\n icon: \"fas fa-undo\",\n onClick: async () => {\n await canvas.dungeon.dungeon.undo();\n },\n button: true,\n },\n {\n name: \"redo\",\n title: \"DD.ButtonTitleRedo\",\n icon: \"fas fa-redo\",\n onClick: async () => {\n await canvas.dungeon.dungeon.redo();\n },\n button: true,\n },\n {\n name: \"config\",\n title: \"DD.ButtonTitleConfig\",\n icon: \"fas fa-cog\",\n onClick: () => new ConfigSheet().render(true),\n button: true,\n },\n {\n name: \"clear\",\n title: \"DD.ButtonTitleClear\",\n icon: \"fas fa-trash\",\n // visible: isGM,\n visible: true,\n onClick: () => canvas.dungeon.deleteAll(),\n button: true,\n },\n ],\n activeTool: \"addrect\",\n });\n }\n\n static async canvasReady(canvas) {\n await canvas.dungeon.loadDungeon();\n }\n\n static async updateJournalEntry(document, change, options, userId) {\n if (game.user.id !== userId) {\n // if somebody else changed the backing JournalEntry, we need to refresh\n await canvas.dungeon.dungeon?.maybeRefresh(document);\n }\n }\n}\n\nHooks.on(\"init\", DungeonDraw.init);\nHooks.on(\"ready\", DungeonDraw.ready);\nHooks.on(\"getSceneControlButtons\", DungeonDraw.getSceneControlButtons);\nHooks.on(\"canvasReady\", DungeonDraw.canvasReady);\nHooks.on(\"updateJournalEntry\", DungeonDraw.updateJournalEntry);\n"],"names":["MODULE_NAME","getTheme","themeKey","splits","split","type","key","getCustomThemes","themes","customThemesString","game","settings","get","constants.MODULE_NAME","JSON","parse","e","console","log","setCustomThemes","customThemes","themesString","stringify","set","getThemePainterThemeKey","default","name","config","backgroundImage","doorColor","doorFillColor","doorFillOpacity","doorLineThickness","doorThickness","exteriorShadowColor","exteriorShadowThickness","exteriorShadowOpacity","floorColor","floorTexture","floorTextureTint","interiorShadowColor","interiorShadowThickness","interiorShadowOpacity","sceneBackgroundColor","sceneGridColor","sceneGridOpacity","secretDoorSColor","secretDoorStyleGM","secretDoorStylePlayer","wallColor","wallTexture","wallTextureTint","wallThickness","arcPavement","foundry","utils","mergeObject","basicBlack","cavern","checkerboard","cobblestone","dirt","dungeonSquares","grass","groovyCarpet","hexagon","marble","metalGrid","metalSquares","moldvayBlue","neonBlueprint","ruddyPaper","water","woodPlanks","ThemeSheet","FormApplication","constructor","super","this","defaultOptions","id","classes","template","width","height","tabs","navSelector","contentSelector","initial","title","i18n","localize","getData","theme","themeName","async","event","formData","ConfigSheet","activeTab","_tabs","active","canvas","dungeon","state","customThemeKeys","Object","keys","sort","themeKeys","themePainterThemeKey","customThemeName","themePainterTheme","setConfig","user","isGM","scene","update","backgroundColor","gridAlpha","sceneGridAlpha","gridColor","options","close","preview","removeChildren","activateListeners","html","find","click","_onResetDefaults","bind","_onThemeNameClick","_onSaveAsThemeClick","_onEditThemeClick","_onCopyThemeClick","_onDeleteThemeClick","change","_onThemePainterThemeSelect","preventDefault","refresh","render","themeRow","$","currentTarget","parent","data","newConfig","saveAsThemeName","closest","children","val","_getSubmitData","oldTheme","newTheme","newName","num","done","setThemePainterThemeKey","deleteAllWalls","walls","getEmbeddedCollection","ids","wall","getFlag","push","deleteEmbeddedDocuments","error","makeWallsFromMulti","multi","i","getNumGeometries","poly","getGeometryN","makeWallsFromPoly","wallData","x1","y1","x2","y2","c","flags","dungeonVersion","doorData","door","secretDoorData","allWalls","coords","getExteriorRing","getCoordinates","length","x","y","numHoles","getNumInteriorRing","getInteriorRingN","createEmbeddedDocuments","makeInteriorWalls","makeDoors","doors","allDoors","makeSecretDoors","NumberUtil","static","tolerance","Math","abs","Exception","Error","message","toString","IllegalArgumentException","Long","high","low","mask","result","Double","Comparable","Clonable","Comparator","Serializable","NaN","isNaN","n","Number","isInfinite","isFinite","MAX_VALUE","POSITIVE_INFINITY","NEGATIVE_INFINITY","Float64Array","Int32Array","EXP_BIT_MASK","f64buf","i32buf","buffer","doubleToLongBits","value","longBitsToDouble","bits","BIAS","log2","floor","pow","MAX_REL_BITS_INTEGER","f","skip","sign","exp","Infinity","fract","RuntimeException","AssertionFailedException","constructor_","apply","arguments","call","Assert","shouldNeverReachHere","assertion","isTrue","expectedValue","actualValue","equals","kBuf","ArrayBuffer","kBufAsF64","kBufAsI32","Coordinate","z","getZ","NULL_ORDINATE","getM","setOrdinate","ordinateIndex","X","Y","Z","setZ","equals2D","other","equalsWithTolerance","setM","m","M","getOrdinate","equals3D","equalInZ","setX","compareTo","o","getX","clone","CloneNotSupportedException","copy","distance3D","dx","dy","dz","sqrt","getY","setY","distance","hashCode","setCoordinate","interfaces_","Cloneable","DimensionalComparator","_dimensionsToTest","dimensionsToTest","a","b","compare","c1","c2","compX","compY","indexOf","CoordinateSequence","index","hasM","mIndex","getDimension","getMeasures","hasZ","size","getCoordinate","getCoordinateCopy","createCoordinate","expandEnvelope","env","toCoordinateArray","CoordinateSequenceFactory","create","Array","hasInterface","dimension","GeometryComponentFilter","filter","geom","Envelope","_minx","_maxx","_miny","_maxy","init","p","p1","p2","q","q1","q2","minq","min","maxq","max","minp","maxp","getArea","getWidth","getHeight","otherEnvelope","isNull","getMaxX","getMaxY","getMinX","getMinY","intersection","intersects","intMinX","intMinY","intMaxX","intMaxY","covers","getDiameter","w","h","expandToInclude","minExtent","translate","transX","transY","setToNull","disjoint","maxExtent","expandBy","deltaX","deltaY","contains","centre","Geometry","isGeometryCollection","getTypeCode","TYPECODE_GEOMETRYCOLLECTION","getFactory","_factory","isRectangle","equalsExact","geometryChanged","geometryChangedFilter","geometryChangedAction","_envelope","equalsNorm","g","norm","getLength","isEmpty","compareToSameClass","comp","getUserData","_userData","getSRID","_SRID","getEnvelope","toGeometry","getEnvelopeInternal","checkNotGeometryCollection","equal","normalize","reverse","res","reverseInternal","envelope","setSRID","copyInternal","getPrecisionModel","computeEnvelopeInternal","SRID","setUserData","userData","iterator","j","hasNext","aElement","next","bElement","comparison","isEquivalentClass","getClass","isGeometryCollectionOrDerived","TYPECODE_MULTIPOINT","TYPECODE_MULTILINESTRING","TYPECODE_MULTIPOLYGON","geometries","array","factory","TYPECODE_POINT","TYPECODE_LINESTRING","TYPECODE_LINEARRING","TYPECODE_POLYGON","TYPENAME_POINT","TYPENAME_MULTIPOINT","TYPENAME_LINESTRING","TYPENAME_LINEARRING","TYPENAME_MULTILINESTRING","TYPENAME_POLYGON","TYPENAME_MULTIPOLYGON","TYPENAME_GEOMETRYCOLLECTION","CoordinateFilter","coord","Lineal","CoordinateSequences","src","srcPos","dest","destPos","minDim","dim","seq","isInteger","indexOfFirstCoordinate","scroll","isRing","firstCoordinate","ensureRing","last","k","cs1","cs2","cs1Size","d","v1","v2","minCoordinateIndex","to","minCoordIndex","minCoord","testCoord","fact","newseq","mid","trunc","swap","tmp","copyCoord","createClosedRing","coordinate","UnsupportedOperationException","Character","toUpperCase","Dimension","dimensionValue","FALSE","SYM_FALSE","TRUE","SYM_TRUE","DONTCARE","SYM_DONTCARE","P","SYM_P","L","SYM_L","A","SYM_A","dimensionSymbol","GeometryFilter","CoordinateSequenceFilter","isDone","isGeometryChanged","LineString","_points","points","isClosed","isSimple","otherLineString","getBoundaryDimension","getCoordinateN","getNumPoints","createLineString","getEndPoint","getPointN","pts","len","x0","y0","ofLine","line","getBoundary","getGeometryType","getCoordinateSequence","getCoordinateSequenceFactory","isCoordinate","pt","getStartPoint","createPoint","Puntal","Point","_coordinates","coordinates","IllegalStateException","point","createGeometryCollection","Area","ring","ofRingSigned","sum","p0","Collection","add","addAll","toArray","remove","IndexOutOfBoundsException","List","NoSuchElementException","ArrayList","ensureCapacity","splice","clear","element","oldElement","Iterator","comparator","slice","Symbol","values","arrayList","position","Arrays","t","r","concat","original","newLength","StringBuffer","str","append","setCharAt","substr","Integer","intValue","DD","_hi","_lo","dd","hi","lo","determinant","valueOf","multiply","selfSubtract","selfMultiply","strlen","isWhitespace","charAt","isNegative","signCh","numDigits","numBeforeDec","hasDecimalChar","ch","isDigit","TEN","selfAdd","expStr","substring","parseInt","ex","NumberFormatException","val2","numDecPlaces","scale","divide","negate","xAbs","xLog10","xMag","buf","le","extractSignificantDigits","insertDecimalPoint","magnitude","mag","gt","lt","ONE","decimalPointPos","MAX_PRINT_DIGITS","digit","rebiasBy10","digitChar","subtract","continueExtractingDigits","remMag","sqr","doubleValue","isZero","getSpecialNumberString","selfDivide","yhi","ylo","hc","tc","hy","ty","C","U","u","SPLIT","dump","createNaN","ge","s","reciprocal","ceil","fhi","flo","rint","setValue","ax","axdd","d2","H","S","T","zhi","zlo","hx","tx","selfSqr","toStandardNotation","toSciNotation","specialStr","fill","sigDigits","stringOfChar","numZeroes","SCI_NOT_ZERO","digits","SCI_NOT_EXPONENT_CHAR","trailingDigits","digitsWithDecimal","isPositive","signum","PI","TWO_PI","PI_2","E","EPS","CGAlgorithmsDD","orientationIndexFilter","dx1","dy1","dx2","dy2","px","py","pw","qx","qy","qw","xInt","yInt","pa","pb","pc","detsum","detleft","detright","det","errbound","DP_SAFE_EPSILON","Orientation","orientationIndex","nPts","hiPt","hiIndex","iPrev","iNext","prev","disc","isCCW","CLOCKWISE","RIGHT","COUNTERCLOCKWISE","LEFT","COLLINEAR","STRAIGHT","Polygonal","Polygon","_shell","_holes","shell","holes","createLinearRing","hasNullElements","hasNonEmptyElements","shellCoordinates","childCoordinates","area","ofRing","shellCopy","holeCopies","prevX","prevY","otherPolygon","thisShell","otherPolygonShell","normalized","clockwise","createPolygon","numPoints","convexHull","otherShell","shellComp","nHole1","nHole2","thisHole","otherHole","holeComp","createMultiLineString","rings","Set","SortedSet","TreeSet","GeometryCollection","_geometries","otherCollection","numGeometries","reversed","buildGeometry","theseElements","asList","otherElements","gc","n1","n2","thisGeom","otherGeom","MultiPoint","isValid","LinearRing","validateConstruction","MINIMUM_VALID_SIZE","CoordinateXY","CoordinateXYM","_m","CoordinateXYZM","Coordinates","measures","CoordinateList","allowRepeated","isChanged","coordArrayType","obj","start","end","inc","closeRing","duplicate","MathUtil","ln","LOG_10","v3","v4","System","CoordinateArrays","testPts","testPt","newCoordinates","arraycopy","coord1","coord2","coordinateComparator","coordList","hasRepeatedPoints","nonNull","newCoord","srcStart","destStart","pts1","pts2","clamp","npts","extractPts","iPts","ForwardComparator","o1","o2","BidirectionalComparator","forwardComp","isEqualReversed","OLDcompare","dir1","increasingDirection","dir2","i1","i2","comparePt","StringBuilder","CoordinateArraySequence","_dimension","_measures","coordSeq","cloneCoordinates","strBuilder","CoordinateArraySequenceFactory","instanceObject","readResolve","instance","spatial","MultiPolygon","polygons","allRings","allRingsArray","Map","put","entrySet","HashSet","map","has","from","current","HashMap","MapInterface","it","hashSet","entries","forEach","entry","PrecisionModel","_modelType","_scale","FLOATING","Type","modelType","FIXED","setScale","pm","pm1","pm2","otherPrecisionModel","getMaximumSignificantDigits","otherSigDigits","getScale","isFloating","FLOATING_SINGLE","getType","description","makePrecise","round","maxSigDigits","_name","nameToTypeMap","maximumPreciseValue","MultiLineString","lineStrings","GeometryFactory","_precisionModel","_coordinateSequenceFactory","coordinateSequenceFactory","precisionModel","getDefaultCoordinateSequenceFactory","multiPolygons","multiPolygonArray","geometryArray","multiLineStrings","multiLineStringArray","lineStringArray","multiPoints","multiPointArray","linearRings","linearRingArray","pointArray","polygonArray","exemplar","createEmpty","geomList","geomType","isHeterogeneous","hasGeometryCollection","partType","toGeometryArray","geom0","createMultiPolygon","toPolygonArray","toLineStringArray","createMultiPoint","toPointArray","createMultiPointFromCoords","ptSeq","GeometryLayout","GeometryType","POINT","LINE_STRING","LINEAR_RING","POLYGON","MULTI_POINT","MULTI_LINE_STRING","MULTI_POLYGON","GEOMETRY_COLLECTION","CIRCLE","TokenType","WKTGeometryType","Lexer","wkt","index_","isAlpha_","isNumeric_","opt_decimal","undefined","isWhiteSpace_","nextChar_","nextToken","readNumber_","readText_","decimal","scientificNotation","parseFloat","Parser","lexer","lexer_","token_","layout_","consume_","isTokenType","match","isMatch","parseGeometry_","parseGeometryLayout_","layout","dimToken","dimInfo","parseGeometryCollectionText_","isEmptyGeometry_","formatErrorMessage_","parsePointText_","parsePoint_","parseLineStringText_","parsePointList_","parsePolygonText_","parseLineStringTextList_","parseMultiPointText_","parsePointTextList_","parseMultiLineStringText_","parseMultiPolygonText_","parsePolygonTextList_","dimensions","token","o2c","ordinates","ca2p","components","encodePointGeometry","cs","join","encodeLineStringGeometry","ii","encodePolygonGeometry","GeometryEncoder","encode","geometryEncoder","encodeGeometryLayout","WKTParser","geometryFactory","read","write","geometry","WKTReader","parser","WKTWriter","BufferParameters","_quadrantSegments","DEFAULT_QUADRANT_SEGMENTS","_endCapStyle","CAP_ROUND","_joinStyle","JOIN_ROUND","_mitreLimit","DEFAULT_MITRE_LIMIT","_isSingleSided","_simplifyFactor","DEFAULT_SIMPLIFY_FACTOR","quadrantSegments","setQuadrantSegments","endCapStyle","setEndCapStyle","joinStyle","mitreLimit","setJoinStyle","setMitreLimit","quadSegs","alpha","cos","getEndCapStyle","isSingleSided","JOIN_BEVEL","JOIN_MITRE","getJoinStyle","setSimplifyFactor","simplifyFactor","getSimplifyFactor","getQuadrantSegments","getMitreLimit","setSingleSided","CAP_FLAT","CAP_SQUARE","Location","locationValue","EXTERIOR","BOUNDARY","INTERIOR","NONE","Position","ON","EmptyStackException","Stack","pop","peek","empty","search","RightmostEdgeFinder","_minIndex","_minCoord","_minDe","_orientedDe","getRightmostSide","de","side","getRightmostSideOfSegment","checkForRightmostCoordinate","findRightmostEdgeAtVertex","getEdge","pPrev","pNext","orientation","usePrev","pos","findRightmostEdgeAtNode","star","getNode","getEdges","getRightmostEdge","isForward","getSym","findEdge","dirEdgeList","TopologyException","msg","LinkedList","addLast","removeFirst","shift","BufferSubgraph","_finder","_dirEdgeList","_nodes","_rightMostCoord","_env","clearVisitedEdges","setVisited","getRightmostCoordinate","computeNodeDepth","startEdge","isVisited","computeDepths","copySymDepths","computeDepth","outsideDepth","getLabel","setEdgeDepths","node","addReachable","findResultEdges","getDepth","isInteriorAreaEdge","setInResult","nodesVisited","nodeQueue","startNode","sym","adjNode","graph","edgeEnv","nodeStack","setDepth","symNode","getNodes","getDirectedEdges","Intersection","minX0","minY0","maxX0","maxY0","minX1","minY1","maxX1","maxY1","midx","midy","p1x","p1y","p2x","p2y","q1x","q1y","q2x","q2y","Distance","B","D","pointToSegment","noIntersection","denom","r_num","len2","minDistance","dist","LineIntersector","_result","_inputLines","_intPt","_intLineIndex","_isProper","_pa","_pb","pdx","pdy","getIndexAlongSegment","segmentIndex","intIndex","computeIntLineIndex","getTopologySummary","catBuilder","isEndPoint","isCollinear","computeIntersection","p3","p4","computeIntersect","getIntersectionNum","getEdgeDistance","isProper","hasIntersection","setPrecisionModel","isInteriorIntersection","inputLineIndex","getIntersection","NO_INTERSECTION","computeEdgeDistance","COLLINEAR_INTERSECTION","toLineString","getEndpoint","ptIndex","isIntersection","getIntersectionAlongSegment","DONT_INTERSECT","DO_INTERSECT","POINT_INTERSECTION","RobustLineIntersector","nearestPt","minDist","isInSegmentEnvelopes","intPt","env0","env1","intersectionSafe","nearestEndpoint","checkDD","intPtDD","isIn","out","println","computeCollinearIntersection","p1q1p2","p1q2p2","q1p1q2","q1p2q2","Pq1","Pq2","Qp1","Qp2","RayCrossingCounter","_p","_crossingCount","_isPointOnSegment","counter","countSegment","isOnSegment","getLocation","minx","maxx","orient","isPointInPolygon","PointLocation","lineIntersector","locatePointInRing","locateInRing","TopologyLocation","location","on","gl","left","right","setAllLocations","locValue","setAllLocationsIfNull","isLine","merge","newLoc","getLocations","flip","temp","toLocationSymbol","setLocations","posIndex","isArea","isAnyNull","setLocation","locIndex","isEqualOnSide","allPositionsEqual","loc","Label","elt","onLoc","lbl","geomIndex","leftLoc","rightLoc","label","lineLabel","getGeometryCount","count","toLine","EdgeRing","_startDe","_maxNodeDegree","_edges","_pts","_label","_ring","_isHole","_geometryFactory","computePoints","computeRing","isIsolated","isFirstEdge","getEdgeRing","mergeLabel","addPoints","setEdgeRing","getNext","getLinearRing","computeMaxNodeDegree","degree","getOutgoingDegree","edge","edgePts","startIndex","isHole","containsPoint","isInRing","addHole","isShell","getMaxNodeDegree","getShell","deLabel","setShell","toPolygon","holeLR","MinimalEdgeRing","er","setMinEdgeRing","getNextMin","MaximalEdgeRing","buildMinimalRings","minEdgeRings","getMinEdgeRing","minEr","linkDirectedEdgesForMinimalEdgeRings","linkMinimalDirectedEdges","GraphComponent","_isInResult","_isCovered","_isCoveredSet","_isVisited","isInResult","isCovered","isCoveredSet","setLabel","setCovered","updateIM","im","computeIM","Node","_coord","edges","isIncidentEdgeInResult","print","computeMergedLocation","label2","eltIndex","nLoc","argIndex","onLocation","insert","setNode","setLabelBoundary","SortedMap","colorOf","color","parentOf","setColor","leftOf","rightOf","TreeMap","root_","size_","cmp","getValue","getKey","oldValue","fixAfterInsertion","rotateLeft","rotateRight","getFirstEntry","successor","l","containsKey","NodeMap","nodeMap","nodeFact","addNode","createNode","getBoundaryNodes","bdyNodes","Quadrant","quad","NE","NW","quad1","quad2","halfPlane","SE","SW","EdgeEnd","_edge","_node","_p0","_p1","_dx","_dy","_quadrant","compareDirection","getDy","angle","atan2","className","getName","lastDotPos","lastIndexOf","getDirectedCoordinate","getDx","getQuadrant","computeLabel","boundaryNodeRule","quadrant","DirectedEdge","_isForward","_sym","_next","_nextMin","_edgeRing","_minEdgeRing","_depth","computeDirectedLabel","currLocation","nextLocation","depthVal","setNextMin","nextMin","getDepthDelta","minEdgeRing","isLineEdge","isExteriorIfArea0","isExteriorIfArea1","edgeRing","depthDelta","printEdge","printReverse","setSym","setVisitedEdge","depth","directionFactor","oppositePos","opposite","oppositeDepth","setNext","NodeFactory","PlanarGraph","_edgeEndList","nodes","nodeit","linkResultDirectedEdges","printEdges","eiList","getNodeIterator","debugPrintln","isBoundaryNode","linkAllDirectedEdges","matchInSameDirection","ep0","ep1","getEdgeEnds","debugPrint","getEdgeIterator","findEdgeInSameDirection","eCoord","insertEdge","findEdgeEnd","ee","addEdges","edgesToAdd","de1","de2","PolygonBuilder","_shellList","testEr","shellList","testRing","testEnv","minShell","minShellEnv","tryShell","tryShellRing","tryShellEnv","ptNotInList","isContained","sortShellsAndHoles","edgeRings","freeHoleList","computePolygons","resultPolyList","placeFreeHoles","hole","findEdgeRingContaining","buildMinimalEdgeRings","maxEdgeRings","findShell","placePolygonHoles","buildMaximalEdgeRings","dirEdges","getPolygons","shellCount","Boundable","getBounds","ItemBoundable","_bounds","_item","bounds","item","getItem","PriorityQueue","_size","_items","poll","minItem","reorder","child","SpatialIndex","itemEnv","query","AbstractNode","_childBoundables","_level","level","getLevel","getChildBoundables","addChildBoundable","childBoundable","computeBounds","Collections","reverseOrder","alen","singletonList","EnvelopeDistance","ax1","ay1","ax2","ay2","bx1","by1","bx2","by2","env2","miny","maxy","aminx","aminy","amaxx","amaxy","bminx","bminy","bmaxx","bmaxy","maxDistance","BoundablePair","_boundable1","_boundable2","_distance","_itemDistance","boundable1","boundable2","itemDistance","maximumDistance","expandToQueue","priQ","isComp1","isComposite","isComp2","expand","isLeaves","nd","bndComposite","bndOther","isFlipped","bp","getDistance","getBoundable","ItemVisitor","visitItem","AbstractSTRtree","_root","_built","_itemBoundables","_nodeCapacity","DEFAULT_NODE_CAPACITY","nodeCapacity","queryInternal","searchBounds","visitor","childBoundables","getIntersectsOp","matches","getNodeCapacity","lastNode","build","removeItem","childToRemove","itemsTree","valuesTree","valuesTreeForNode","valuesTreeForChild","boundablesAtLevel","boundables","top","boundable","createHigherLevels","getRoot","found","childToPrune","boundablesOfALevel","parentBoundables","createParentBoundables","maxChildDepth","childDepth","newLevel","sortedChildBoundables","getComparator","IntersectsOp","ItemDistance","item1","item2","STRtree","avg","kNearestNeighbors","items","createParentBoundablesFromVerticalSlices","verticalSlices","createParentBoundablesFromVerticalSlice","nearestNeighbourK","initBndPair","distanceLowerBound","bndPair","pairDistance","getItems","STRtreeNode","intersectsOp","sliceCount","sliceCapacity","slices","boundablesAddedToSlice","searchEnv","yComparator","minLeafCount","xComparator","nearestNeighbour","itemDist","minPair","tree","bnd","isWithinDistance","distanceUpperBound","compareDoubles","centreX","centreY","aBounds","bBounds","SegmentPointComparator","octant","xSign","relativeSign","ySign","compareValue","compareSign0","compareSign1","SegmentNode","_segString","_segmentOctant","_isInterior","segString","segmentOctant","maxSegmentIndex","isInterior","SegmentNodeList","_nodeMap","getSplitCoordinates","addEndpoints","eiPrev","ei","addEdgeCoordinates","addCollapsedNodes","collapsedVertexIndexes","findCollapsesFromInsertedNodes","findCollapsesFromExistingVertices","vertexIndex","createSplitEdgePts","ei0","ei1","lastSegStartPt","useIntPt1","ipt","addSplitEdges","edgeList","newEdge","createSplitEdge","findCollapseIndex","collapsedVertexIndex","numVerticesBetween","maxSegIndex","NodedSegmentString","eiNew","getSegmentOctant","checkSplitEdgesCorrectness","splitEdges","pt0","splitnPts","ptn","Octant","adx","ady","SegmentString","setData","NodableSegmentString","addIntersection","_nodeList","_data","segStrings","resultEdgelist","getNodedSubstrings","getNodeList","safeOctant","addIntersectionNode","normalizedSegmentIndex","nextSegIndex","nextPt","addIntersections","li","LineSegment","ls","minX","seg","orient0","orient1","geomFactory","isVertical","project","projectionFactor","pf0","pf1","newp0","newp1","distancePerpendicular","pointToLinePerpendicular","minY","midPoint","closestPoints","closestPt","close00","closestPoint","close01","close10","close11","factor","maxX","comp0","equalsTopo","lineIntersection","maxY","pointAlongOffset","segmentLengthFraction","offsetDistance","segx","segy","ux","uy","setCoordinates","segmentFraction","inputPt","segFrac","isHorizontal","reflect","A2plusB2","A2subB2","segmentToSegment","pointAlong","bits0","hash0","bits1","MonotoneChainOverlapAction","_overlapSeg1","_overlapSeg2","overlap","start1","mc2","start2","getLineSegment","MonotoneChain","_start","_end","_context","_id","context","computeSelect","start0","end0","mcs","select","computeOverlaps","mc","mco","end1","overlaps","mid0","mid1","setId","getEndIndex","getStartIndex","getContext","getId","MonotoneChainBuilder","safeStart","chainQuad","getChains","mcList","chainStart","chainEnd","findChainEnd","Noder","computeNodes","SinglePassNoder","_segInt","segInt","setSegmentIntersector","MCIndexNoder","_monoChains","_index","_idCounter","_nodedSegStrings","_nOverlaps","si","getMonotoneChains","getIndex","segStr","inputSegStrings","intersectChains","overlapAction","SegmentOverlapAction","queryChain","testChain","_si","ss1","ss2","processIntersections","BufferInputLineSimplifier","_inputLine","_distanceTol","_isDeleted","_angleOrientation","inputLine","distanceTol","simplify","isDeletable","i0","isConcave","isShallow","isShallowSampled","deleteShallowConcavities","midIndex","findNextNonDeletedIndex","lastIndex","isMiddleVertexDeleted","DELETE","isShallowConcavity","NUM_PTS_TO_CHECK","collapseLine","INIT","KEEP","OffsetSegmentString","_ptList","_minimimVertexDistance","COORDINATE_ARRAY_TYPE","addPt","bufPt","isRedundant","addPts","lastPt","startPt","setMinimumVertexDistance","minimimVertexDistance","Angle","radians","PI_TIMES_2","dx0","dy0","anglePrev","angleNext","tip1","tail","tip2","a1","a2","diff","ang1","ang2","delAngle","angleDegrees","crossproduct","sin","angDel","PI_OVER_2","PI_OVER_4","OffsetSegmentGenerator","_maxCurveSegmentError","_filletAngleQuantum","_closingSegLengthFactor","_segList","_bufParams","_li","_s0","_s1","_s2","_seg0","_seg1","_offset0","_offset1","_side","_hasNarrowConcaveAngle","bufParams","MAX_CLOSING_SEG_LEN_FACTOR","addNextSegment","addStartPoint","computeOffsetSegment","outsideTurn","addCollinear","addOutsideTurn","addInsideTurn","addLineEndCap","offsetL","offsetR","addDirectedFillet","squareCapSideOffset","squareCapLOffset","squareCapROffset","addMitreJoin","offset0","offset1","addLimitedMitreJoin","OFFSET_SEGMENT_SEPARATION_FACTOR","addBevelJoin","addCornerFillet","createSquare","addSegments","addFirstSegment","direction","radius","startAngle","endAngle","addLastSegment","initSideSegments","s1","s2","basePt","ang0","angDiffHalf","angleBetweenOriented","midAng","mitreMidAng","mitreDist","bevelHalfLen","bevelMidX","bevelMidY","bevelMidPt","mitreMidLine","bevelEndLeft","bevelEndRight","totalAngle","nSegs","angleInc","offset","sideSign","INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR","createCircle","CURVE_VERTEX_SNAP_DISTANCE_FACTOR","hasNarrowConcaveAngle","OffsetCurveBuilder","getOffsetCurve","inputPts","isRightSide","posDistance","segGen","getSegGen","computePointCurve","computeOffsetCurve","curvePts","computeSingleSidedBufferCurve","distTol","simplifyTolerance","simp2","simp1","computeRingBufferCurve","simp","computeLineBufferCurve","getLineCurve","isLineOffsetEmpty","getBufferParameters","bufDistance","getRingCurve","copyCoordinates","SubgraphDepthLocater","_subgraphs","_seg","subgraphs","findStabbedSegments","stabbingRayLeftPt","stabbedSegments","bsg","dirEdge","ds","DepthSegment","_leftDepth","_upwardSeg","orientIndex","compareX","seg0","seg1","compare0","NotRepresentableException","HCoordinate","_x","_y","_w","Triangle","m00","m01","m10","m11","v0","lenAB","lenBC","lenCA","maxLen","ay","bx","by","asqr","bsqr","numx","numy","ccx","ccy","isAcute","cx","cy","l1","l2","len0","frac","uz","vx","vy","vz","crossx","crossy","crossz","absSq","len1","circum","inCentreX","inCentreY","signedArea","interpolateZ","longestSideLength","circumcentre","area3D","centroid","inCentre","OffsetCurveSetBuilder","_inputGeom","_curveBuilder","_curveList","inputGeom","curveBuilder","addRingSide","cwLeftLoc","cwRightLoc","curve","addCurve","addRingBothSides","addPoint","addPolygon","offsetSide","shellCoord","removeRepeatedPoints","isErodedCompletely","holeCoord","isTriangleErodedCompletely","triangleCoord","bufferDistance","tri","addLineString","getCurves","addCollection","ringCoord","envMinDimension","PointOnGeometryLocator","locate","GeometryCollectionIterator","_parent","_atStart","_max","_subcollectionIterator","isAtomic","SimplePointInAreaLocator","_geom","shellLoc","holeLoc","locatePointInPolygon","geomi","g2","locateInGeometry","EdgeEndStar","_edgeMap","_edgeList","_ptInAreaLocation","getNextCW","iNextCW","propagateSideLabels","startLoc","currLoc","isAreaLabelsConsistent","geomGraph","computeEdgeEndLabels","getBoundaryNodeRule","checkAreaLabelsConsistent","lastEdgeIndex","findIndex","eSearch","getGeometry","computeLabelling","hasDimensionalCollapseEdge","getDegree","insertEdgeEnd","DirectedEdgeStar","_resultAreaEdgeList","_SCANNING_FOR_INCOMING","_LINKING_TO_OUTGOING","getResultAreaEdges","firstOut","incoming","nextOut","nextIn","de0","deLast","quad0","isNorthern","updateLabelling","nodeLabel","prevOut","firstIn","edgeIndex","startDepth","targetLastDepth","nextDepth","endIndex","currDepth","nextDe","mergeSymLabels","findCoveredLineEdges","eLabel","eLoc","OverlayNodeFactory","OrientedCoordinateArray","_orientation","orientation1","orientation2","limit1","limit2","compPt","done1","done2","oca","compareOriented","EdgeList","_ocaMap","edgeColl","findEdgeIndex","findEqualEdge","SegmentIntersector","e0","segIndex0","e1","segIndex1","IntersectionAdder","_hasIntersection","_hasProper","_hasProperInterior","_hasInterior","_properIntersectionPoint","_isSelfIntersection","numIntersections","numInteriorIntersections","numProperIntersections","numTests","isTrivialIntersection","isAdjacentSegments","getProperIntersectionPoint","hasProperInteriorIntersection","getLineIntersector","hasProperIntersection","p00","p01","p10","p11","hasInteriorIntersection","EdgeIntersection","getSegmentIndex","EdgeIntersectionList","Edge","IntersectionMatrix","_matrix","setAll","elements","actualDimensionValue","requiredDimensionSymbol","requiredDimensionSymbols","isIntersects","isDisjoint","isCovers","isCoveredBy","dimensionSymbols","row","col","toDimensionValue","column","isContains","setAtLeast","minimumDimensionSymbols","minimumDimensionValue","setAtLeastIfValid","isWithin","isTouches","dimensionOfGeometryA","dimensionOfGeometryB","isOverlaps","isEquals","builder","ai","bi","toDimensionSymbol","transpose","isCrosses","IntArrayList","initialCapacity","capacity","copyOf","MonotoneChainIndexer","list","getChainStartIndices","startIndexList","OLDgetChainStartIndices","toIntArray","MonotoneChainEdge","mcb","chainIndex","computeIntersectsForChain","chainIndex0","mce","chainIndex1","getStartIndexes","computeIntersects","Depth","NULL_VALUE","depthValue","minDepth","newValue","getDelta","depthAtLocation","_mce","_isIsolated","_depthDelta","getCollapsedEdge","newPts","toLineLabel","setIsolated","setName","isEqualForward","isEqualReverse","iRev","isCollapsed","getMaximumSegmentIndex","getMonotoneChainEdge","isPointwiseEqual","setDepthDelta","getEdgeIntersectionList","BufferBuilder","_workingPrecisionModel","_workingNoder","_geomFact","_graph","lLoc","rLoc","lines","ss","setWorkingPrecisionModel","insertUniqueEdge","existingEdge","existingLabel","labelToMerge","mergeDelta","newDelta","buildSubgraphs","subgraphList","polyBuilder","processedGraphs","subgraph","createSubgraphs","createEmptyResultGeometry","getNoder","noder","bufferSegStrList","computeNodedEdges","oldLabel","setNoder","ScaledNoder","_noder","_scaleFactor","_offsetX","_offsetY","_isScaled","scaleFactor","isIntegerPrecision","rescale","nodedSegmentStrings","roundPts","splitSS","intSegStrings","NodingValidator","_segStrings","checkEndPtVertexIntersections","checkInteriorIntersections","ss0","pts0","checkValid","checkCollapses","checkCollapse","HotPixel","_pt","_originalPt","_ptScaled","_p0Scaled","_p1Scaled","_corner","_safeEnv","initCorners","intersectsScaled","segMinx","segMaxx","segMiny","segMaxy","isOutsidePixelEnv","intersectsToleranceSquare","copyScaled","pScaled","getSafeEnvelope","safeTolerance","SAFE_ENV_EXPANSION_FACTOR","intersectsPixelClosure","intersectsLeft","intersectsBottom","addSnappedNode","segIndex","MonotoneChainSelectAction","selectedSegment","MCIndexPointSnapper","snap","hotPixel","parentEdge","hotPixelVertexIndex","pixelEnv","hotPixelSnapAction","HotPixelSnapAction","isNodeAdded","_hotPixel","_parentEdge","_hotPixelVertexIndex","_isNodeAdded","InteriorIntersectionFinderAdder","_interiorIntersections","getInteriorIntersections","MCIndexSnapRounder","_pm","_pointSnapper","checkCorrectness","inputSegmentStrings","resultSegStrings","nv","printStackTrace","snapRound","intersections","findInteriorIntersections","computeIntersectionSnaps","computeVertexSnaps","intFinderAdder","edge0","snapPts","snapPt","BufferOp","_argGeom","_resultGeometry","_saveException","getResultGeometry","bufOp","maxPrecisionDigits","bufEnvMax","minUnitLog10","bufferFixedPrecision","fixedPM","bufBuilder","bufferReducedPrecision","precDigits","MAX_PRECISION_DIGITS","precisionDigits","sizeBasedScaleFactor","precisionScaleFactor","computeGeometry","bufferOriginalPrecision","argPM","CAP_BUTT","BoundaryNodeRule","isInBoundary","boundaryCount","Mod2BoundaryNodeRule","EndPointBoundaryNodeRule","MultiValentEndPointBoundaryNodeRule","MonoValentEndPointBoundaryNodeRule","MOD2_BOUNDARY_RULE","ENDPOINT_BOUNDARY_RULE","MULTIVALENT_ENDPOINT_BOUNDARY_RULE","MONOVALENT_ENDPOINT_BOUNDARY_RULE","OGC_SFS_BOUNDARY_RULE","PointLocator","_boundaryRule","_isIn","_numBoundaries","boundaryRule","locateInPolygonRing","updateLocationInfo","computeLocation","locateOnPoint","locateOnLineString","locateInPolygon","ml","mpoly","isOnLine","BasicSegmentString","NodingIntersectionFinder","_findAllIntersections","_isCheckEndSegmentsOnly","_keepIntersections","_isInteriorIntersectionsOnly","_interiorIntersection","_intSegments","_intersections","_intersectionCount","finder","setFindAllIntersections","isEnd1","isEnd00","isEnd01","isEnd10","isEnd11","isInteriorVertexIntersection","setInteriorIntersectionsOnly","setKeepIntersections","setCheckEndSegmentsOnly","isCheckEndSegmentsOnly","getIntersectionSegments","getIntersections","findAllIntersections","keepIntersections","isSameSegString","isEndSegment","isInteriorInt","isInteriorVertexInt","isInteriorIntersectionsOnly","FastNodingValidator","_isValid","execute","getErrorMessage","intSegs","EdgeNodingValidator","_nv","toSegmentStrings","GeometryCollectionMapper","_mapOp","mapOp","op","mapped","LineBuilder","_op","_ptLocator","_lineEdgesList","_resultLineList","ptLocator","collectLines","opCode","getGraph","collectLineEdge","collectBoundaryTouchEdge","labelIsolatedLine","targetIndex","getArgGeometry","buildLines","OverlayOp","isResultOfOp","isCoveredByA","labelIsolatedLines","edgesList","INTERSECTION","PointBuilder","_resultPointList","filterCoveredNodeToPoint","isCoveredByLA","extractNonCoveredResultNodes","GeometryTransformer","_pruneEmptyGeometry","_preserveGeometryCollectionType","_preserveCollections","_preserveType","transformPoint","transformCoordinates","transformPolygon","isAllValidLinearRings","transformLinearRing","createCoordinateSequence","getInputGeometry","transformMultiLineString","transGeomList","transformGeom","transformLineString","transformMultiPoint","transformMultiPolygon","transformGeometryCollection","transform","seqSize","LineStringSnapper","_snapTolerance","_srcPts","_allowSnappingToSourceVertices","_isClosed","srcLine","snapTolerance","srcPts","snapVertices","srcCoords","srcPt","snapVert","findSnapForVertex","snapTo","snapSegments","distinctPtCount","findSegmentIndexToSnap","snapIndex","setAllowSnappingToSourceVertices","allowSnappingToSourceVertices","GeometrySnapper","_srcGeom","srcGeom","g0","g1","snapGeom","snapper0","snapper1","computeSizeBasedSnapTolerance","fixedSnapTol","computeOverlaySnapTolerance","SNAP_PRECISION_FACTOR","cleanResult","snapToSelf","extractTargetCoordinates","SnapTransformer","snappedGeom","computeSnapTolerance","ringPts","computeMinimumSegmentLength","ptSet","minSegLen","segLen","_snapPts","_isSelfSnap","isSelfSnap","snapLine","snapper","CommonBits","_isFirst","_commonMantissaBitsCount","_commonBits","_commonSignExp","getCommon","numBits","signExpBits","numCommonMostSigMantissaBits","zeroLowerBits","padStr","toBinaryString","bitStr","nBits","prop","num1","num2","getBit","CommonBitsRemover","_commonCoord","_ccFilter","CommonCoordinateFilter","addCommonBits","trans","Translater","removeCommonBits","invCoord","getCommonCoordinate","_commonBitsX","_commonBitsY","xp","yp","SnapOverlayOp","_cbr","overlayOp","UNION","SYMDIFFERENCE","DIFFERENCE","selfSnap","remGeom","prepareResult","prepGeom","SnapIfNeededOverlayOp","isSuccess","savedException","computeIntersections","SweepLineEvent","_xValue","_eventType","_insertEvent","_deleteEventIndex","_obj","insertEvent","INSERT","isDelete","setDeleteEventIndex","deleteEventIndex","getObject","pe","getInsertEvent","isInsert","isSameLabel","ev","getDeleteEventIndex","_includeProper","_recordIsolated","_numIntersections","_bdyNodes","_isDone","_isDoneWhenProperInt","includeProper","recordIsolated","setIsDoneIfProperInt","isDoneWhenProperInt","isBoundaryPointInternal","isBoundaryPoint","setBoundaryNodes","bdyNodes0","bdyNodes1","SimpleMCSweepLineIntersector","events","nOverlaps","prepareEvents","processOverlaps","edges0","edges1","addEdge","edgeSet","ev0","mc0","ev1","mc1","IntervalRTreeNode","_min","getMin","queryMin","queryMax","getMax","NodeComparator","mid2","IntervalRTreeLeafNode","IntervalRTreeBranchNode","_node1","_node2","buildExtent","SortedPackedIntervalRTree","_leaves","buildTree","buildLevel","buildRoot","printNode","LinearComponentExtracter","_lines","_isForcedToLineString","isForcedToLineString","getLines","forceToLineString","setForceToLineString","ArrayListVisitor","IndexedPointInAreaLocator","IntervalIndexedGeometry","rcc","SegmentVisitor","_counter","_isEmpty","addLine","GeometryGraph","_parentGeom","_lineEdgeMap","_boundaryNodeRule","_useBoundaryDeterminationRule","_argIndex","_boundaryNodes","_hasTooFewPoints","_invalidPoint","_areaPtLocator","parentGeom","insertBoundaryPoint","determineBoundary","computeSelfNodes","computeRingSelfNodes","isDoneIfProperInt","esi","createEdgeSetIntersector","isRings","computeAllSegments","addSelfIntersectionNodes","computeSplitEdges","edgelist","computeEdgeIntersections","hasTooFewPoints","insertPoint","addPolygonRing","getInvalidPoint","getBoundaryPoints","coll","addSelfIntersectionNode","lr","cwLeft","cwRight","eiIt","GeometryGraphOperation","_resultPrecisionModel","_arg","setComputationPrecision","_resultGeom","_resultPolyList","geom1","createEmptyResult","MapOp","dim0","dim1","resultDimension","overlayOpCode","geomFact","resultDim","loc0","loc1","cancelDuplicateResultEdges","resultPointList","resultLineList","opcode","replaceCollapsedEdges","newEdges","updateNodeLabelling","computeOverlay","insertUniqueEdges","copyPoints","baseSplitEdges","computeLabelsFromDepths","labelIncompleteNodes","findResultAreaEdges","lineBuilder","pointBuilder","labelIncompleteNode","graphNode","ni","EdgeEndBuilder","createEdgeEndForNext","eiCurr","eiNext","createEdgeEndForPrev","computeEdgeEnds","EdgeEndBundle","_edgeEnds","computeLabelOn","foundInterior","computeLabelSide","computeLabelSides","EdgeEndBundleStar","eb","RelateNode","updateIMFromEdges","RelateNodeFactory","RelateComputer","_im","_isolatedEdges","arg","insertEdgeEnds","computeProperIntersectionIM","intersector","dimA","dimB","hasProper","hasProperInterior","labelIsolatedEdges","thisIndex","labelIsolatedEdge","target","computeDisjointIM","computeIntersectionNodes","copyNodesAndLabels","labelIsolatedNodes","eeBuilder","ee0","ee1","labelNodeEdges","labelIntersectionNodes","labelIsolatedNode","ga","gb","RectangleContains","_rectEnv","rectangle","isContainedInBoundary","isPointContainedInBoundary","isLineStringContainedInBoundary","isLineSegmentContainedInBoundary","RectangleLineIntersector","_diagUp0","_diagUp1","_diagDown0","_diagDown1","rectEnv","segEnv","isSegUpwards","ShortCircuitedGeometryVisitor","applyTo","visit","RectangleIntersects","_rectangle","EnvelopeIntersectsVisitor","ecpVisitor","GeometryContainsPointVisitor","riVisitor","RectangleIntersectsSegmentVisitor","_intersects","elementEnv","_rectSeq","_containsPoint","rectPt","containsPointInPolygon","_rectIntersector","checkIntersectionWithLineStrings","testLine","checkIntersectionWithSegments","seq1","RelateOp","_relate","getIntersectionMatrix","relate","UnionOp","touches","expandGeometry","bufferOp","geometryToWkt","rectToPolygon","rect","reader","polyString","rectToWKTPolygonString","twoPointsToLineString","pointsToPolygon","distanceBetweenPoints","comparePoints","lesserPoint","greaterPoint","rectangleForSegment","thickness","slope","rectDelta","theta","atan","DungeonState","themeAreas","secretDoors","interiorWalls","geo.geometryToWkt","startState","journalEntry","serialized","makeWalls","content","fromString","__filters","setPrototypeOf","__proto__","prototype","hasOwnProperty","assign","gamma","saturation","contrast","brightness","red","green","blue","uniforms","applyFilter","Filter","threshold","defineProperty","enumerable","configurable","_kernels","_blur","_quality","uOffset","Float32Array","_pixelSize","pixelSize","_clamp","isArray","kernels","quality","_frame","getFilterTexture","returnFilterTexture","_updatePadding","padding","reduce","_generateKernels","bloomScale","_resolution","FILTER_RESOLUTION","defaults","blur","resolution","_extractFilter","_blurFilter","bloomTexture","v","_thickness","_angle","lightColor","shadowColor","rotation","lightAlpha","shadowAlpha","_updateTransform","transformX","transformY","DEG_TO_RAD","rgb2hex","hex2rgb","blurXFilter","BlurFilterPass","blurYFilter","blendMode","BLEND_MODES","SCREEN","defaultFilter","AlphaFilter","filterFrame","strength","center","mix","_sliceSize","_slicePixelSize","_sliceInnerSize","_nearest","_scaleMode","_colorMap","nearest","colorMap","_mix","Texture","baseTexture","scaleMode","mipmap","MIPMAP_MODES","OFF","SCALE_MODES","NEAREST","LINEAR","_glTextures","_updateID","emit","updateColorMap","destroy","_","_color","_alpha","_originalColor","_newColor","originalColor","newColor","epsilon","texelSize","matrix","F","time","seed","curvature","lineWidth","lineContrast","verticalLine","noise","noiseSize","vignetting","vignettingAlpha","vignettingBlur","O","_tintFilter","shadowOnly","_updateShift","fillMode","TRANSPARENT","average","minSize","sampleSize","_slices","_offsets","_sizes","_direction","_canvas","document","createElement","texture","aspect","_randomizeSizes","random","shuffle","_randomizeOffsets","redraw","clearRect","fillStyle","fillRect","displacementMap","slicesWidth","slicesOffset","sinDir","cosDir","ORIGINAL","LOOP","CLAMP","MIRROR","outerStrength","innerStrength","knockout","replace","toFixed","glowColor","parallel","_angleLight","gain","lacunarity","light","kernelSize","uVelocity","_velocity","ObservablePoint","velocityChanged","setVelocity","velocity","uKernelSize","copyFrom","_replacements","_maxColors","originalColors","targetColors","replacements","R","sepia","scratch","scratchDensity","scratchWidth","getAngleStep","outlineColor","MAX_SAMPLES","MIN_SAMPLES","I","uRadian","uCenter","uRadius","amplitude","waveLength","mirror","boundary","N","wavelength","speed","ambientColor","uLightmap","G","gradientBlur","window","innerHeight","delta","texSize","innerWidth","updateDelta","K","W","tiltShiftXFilter","tiltShiftYFilter","maxKernelSize","getOwnPropertySymbols","propertyIsEnumerable","uStrength","uInnerRadius","innerRadius","AdjustmentFilter","AdvancedBloomFilter","AsciiFilter","BevelFilter","BloomFilter","BulgePinchFilter","CRTFilter","ColorMapFilter","ColorOverlayFilter","ColorReplaceFilter","ConvolutionFilter","CrossHatchFilter","DotFilter","DropShadowFilter","EmbossFilter","GlitchFilter","GlowFilter","GodrayFilter","KawaseBlurFilter","MotionBlurFilter","MultiColorReplaceFilter","OldFilmFilter","OutlineFilter","PixelateFilter","RGBSplitFilter","RadialBlurFilter","ReflectionFilter","ShockwaveFilter","SimpleLightmapFilter","TiltShiftAxisFilter","TiltShiftFilter","TiltShiftXFilter","TiltShiftYFilter","TwistFilter","ZoomBlurFilter","PIXI","filters","drawThemeAreas","container","themeType","areaState","areaContainer","Container","areaMask","Graphics","beginFill","drawPolygon","flat","endFill","clipPoly","geo.pointsToPolygon","renderPass","addChild","floorGfx","interiorShadowGfx","wallGfx","addExteriorShadow","clipMask","drawMultiPolygonMask","alphaFilter","blurFilter","BlurFilter","addTiledBackground","drawMultiPolygonRoom","wallMask","maskConfig","drawInteriorWallShadow","drawInteriorWall","drawDoorShadow","drawDoor","secretDoor","drawSecretDoor","drawMultiPolygonWallMask","expandedGeometry","geo.expandGeometry","getTexture","path","loadTexture","addBackgroundImage","valid","bg","Sprite","paddingX","shiftX","paddingY","shiftY","sceneWidth","sceneHeight","maybeStartSpriteVideo","sprite","source","resource","tagName","loop","volume","video","play","addExteriorShadowForPoly","outerShadow","expanded","string2hex","texturePath","textureTint","textureSize","rows","cols","geo.intersects","geo.touches","TilingSprite","tint","colorStringToHex","drawPolygonMask","gfx","flatCoords","lineStyle","beginHole","endHole","drawPolygonWallMask","drawPolygonRoom","alignment","cap","moveTo","lineTo","totalLength","geo.distanceBetweenPoints","jambFraction","rectEndFraction","jamb1End","rectEnd","doorRect","geo.rectangleForSegment","middle","midRect","midRect2","bezierCurveTo","Dungeon","PlaceableObject","note","history","historyIndex","deleteAll","lastState","resetState","saveToJournalEntry","draw","savedState","loadFromJournalEntry","pushState","newState","_addDoor","doorProperty","doorPoly","geo.twoPointsToLineString","wallsToDelete","wallsToAdd","wallPoly","geo.contains","w1","geo.lesserPoint","w2","geo.greaterPoint","d1","rectPoly","geo.rectToPolygon","doorsToKeep","_maybeSplitWall","wallsToKeep","oldState","secretDoorsToKeep","union","geo.intersection","_addPoly","difference","newArea","areasToKeep","areaPoly","createDungeonEntry","folder","folders","Folder","JournalEntry","createDungeonNote","entryId","fontSize","icon","iconSize","textAnchor","textColor","iconTint","text","DungeonLayer","PlaceablesLayer","dungeonContainer","layerOptions","LAYER_NAME","canDragCreate","zIndex","_getNewDrawingData","origin","tool","activeTool","fillColor","strokeColor","strokeWidth","author","CONST","DRAWING_TYPES","RECTANGLE","ELLIPSE","documentName","Dialog","confirm","format","yes","_deleteAll","notes","journal","findDungeonEntryAndNote","addChildAt","createDungeonEntryAndNote","loadDungeon","createState","originalEvent","isPolygon","destination","shiftKey","grid","getSnappedPosition","gridPrecision","_addPoint","_chain","_onClickLeft","_onClickLeft2","_onDragLeftDrop","_onDragLeftStart","DrawingDocument","drawing","Drawing","_onDragLeftMove","_onMouseDraw","createNewDungeon","hypot","completePolygon","toObject","addDoor","addSecretDoor","addInteriorWall","createData","placeableClass","normalizeShape","offsetPoints","addRectangle","subtractDoorsAndInteriorWalls","removeThemeAreas","addThemeArea","subtractRectangle","_onDragLeftCancel","DungeonDraw","register","scope","String","maybeShowReleaseNotes","moduleVersion","modules","version","resp","fetch","firstChangelog","renderTemplate","changelog","buttons","roll","controls","CONFIG","Canvas","layers","layerClass","layer","visible","isTrusted","tools","onClick","undo","button","redo","userId","maybeRefresh","Hooks","ready","getSceneControlButtons","canvasReady","updateJournalEntry"],"mappings":"AACO,MAAMA,EAAc,eC+BdC,EAAYC,IACvB,MAAMC,EAASD,EAASE,MAAM,KACxBC,EAAOF,EAAO,GACdG,EAAMH,EAAO,GACnB,GAAa,WAATE,EAAmB,CAErB,OADqBE,IACDD,GAEtB,OAAOE,EAAOF,IAGHC,EAAkB,KAC7B,IACE,MAAME,EAAqBC,KAAKC,SAASC,IACvCC,EACA,gBAEF,OAAOC,KAAKC,MAAMN,GAClB,MAAOO,GAEP,OADAC,QAAQC,IAAIF,GACL,KAIEG,EAAmBC,IAC9B,MAAMC,EAAeP,KAAKQ,UAAUF,GACpCV,KAAKC,SAASY,IAAIV,EAAuB,eAAgBQ,IAG9CG,EAA0B,IAC9Bd,KAAKC,SAASC,IACnBC,ED7DuC,qBC0E9BL,EAAS,CACpBiB,QAAS,CACPC,KAAM,UACNC,OA5EK,CACLC,gBAAiB,GACjBC,UAAW,UACXC,cAAe,UACfC,gBAAiB,EACjBC,kBAAmB,EACnBC,cAAe,GACfC,oBAAqB,UACrBC,wBAAyB,GACzBC,sBAAuB,GACvBC,WAAY,UACZC,aAAc,GACdC,iBAAkB,GAClBC,oBAAqB,UACrBC,wBAAyB,EACzBC,sBAAuB,GACvBC,qBAAsB,UACtBC,eAAgB,UAChBC,iBAAkB,GAClBC,iBAAkB,UAClBC,kBAAmB,SACnBC,sBAAuB,OACvBC,UAAW,UACXC,YAAa,GACbC,gBAAiB,GACjBC,cAAe,IAqDjBC,YAAa,CACX3B,KAAM,eACNC,OAAQ2B,QAAQC,MAAMC,YAhFjB,CACL5B,gBAAiB,GACjBC,UAAW,UACXC,cAAe,UACfC,gBAAiB,EACjBC,kBAAmB,EACnBC,cAAe,GACfC,oBAAqB,UACrBC,wBAAyB,GACzBC,sB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AyBrG,SACjBA,EAAOC,QAAQmqG,cAGvB/jG,gCAAgC6wF,EAAU/0F,EAAQf,EAASitG,GACrDj0G,KAAKwG,KAAKlC,KAAO2vG,SAEbruG,OAAOC,QAAQA,SAASquG,aAAapX,KAKjDqX,MAAM1mE,GAAG,OAAQ4kE,GAAYr9F,MAC7Bm/F,MAAM1mE,GAAG,QAAS4kE,GAAY+B,OAC9BD,MAAM1mE,GAAG,yBAA0B4kE,GAAYgC,wBAC/CF,MAAM1mE,GAAG,cAAe4kE,GAAYiC,aACpCH,MAAM1mE,GAAG,qBAAsB4kE,GAAYkC"} \ No newline at end of file +{"version":3,"file":"dungeondraw-bundle.min.js","sources":["../src/constants.js","../src/themes.js","../src/themesheet.js","../src/configsheet.js","../src/wallmaker.js","../node_modules/jsts/org/locationtech/jts/util/NumberUtil.js","../node_modules/jsts/java/lang/Exception.js","../node_modules/jsts/java/lang/IllegalArgumentException.js","../node_modules/jsts/java/lang/Long.js","../node_modules/jsts/java/lang/Double.js","../node_modules/jsts/java/lang/Comparable.js","../node_modules/jsts/java/lang/Cloneable.js","../node_modules/jsts/java/util/Comparator.js","../node_modules/jsts/java/io/Serializable.js","../node_modules/jsts/java/lang/RuntimeException.js","../node_modules/jsts/org/locationtech/jts/util/AssertionFailedException.js","../node_modules/jsts/org/locationtech/jts/util/Assert.js","../node_modules/jsts/org/locationtech/jts/geom/Coordinate.js","../node_modules/jsts/hasInterface.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequence.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequenceFactory.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryComponentFilter.js","../node_modules/jsts/org/locationtech/jts/geom/Envelope.js","../node_modules/jsts/org/locationtech/jts/geom/Geometry.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateFilter.js","../node_modules/jsts/org/locationtech/jts/geom/Lineal.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequences.js","../node_modules/jsts/java/lang/UnsupportedOperationException.js","../node_modules/jsts/java/lang/Character.js","../node_modules/jsts/org/locationtech/jts/geom/Dimension.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryFilter.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateSequenceFilter.js","../node_modules/jsts/org/locationtech/jts/geom/LineString.js","../node_modules/jsts/org/locationtech/jts/algorithm/Length.js","../node_modules/jsts/org/locationtech/jts/geom/Puntal.js","../node_modules/jsts/org/locationtech/jts/geom/Point.js","../node_modules/jsts/org/locationtech/jts/algorithm/Area.js","../node_modules/jsts/java/util/Collection.js","../node_modules/jsts/java/lang/IndexOutOfBoundsException.js","../node_modules/jsts/java/util/List.js","../node_modules/jsts/java/util/NoSuchElementException.js","../node_modules/jsts/java/util/ArrayList.js","../node_modules/jsts/java/util/Arrays.js","../node_modules/jsts/java/lang/StringBuffer.js","../node_modules/jsts/java/lang/Integer.js","../node_modules/jsts/org/locationtech/jts/math/DD.js","../node_modules/jsts/org/locationtech/jts/algorithm/CGAlgorithmsDD.js","../node_modules/jsts/org/locationtech/jts/algorithm/Orientation.js","../node_modules/jsts/org/locationtech/jts/geom/Polygonal.js","../node_modules/jsts/org/locationtech/jts/geom/Polygon.js","../node_modules/jsts/java/util/Set.js","../node_modules/jsts/java/util/SortedSet.js","../node_modules/jsts/java/util/TreeSet.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryCollection.js","../node_modules/jsts/org/locationtech/jts/geom/MultiPoint.js","../node_modules/jsts/org/locationtech/jts/geom/LinearRing.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateXY.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateXYM.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateXYZM.js","../node_modules/jsts/org/locationtech/jts/geom/Coordinates.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateList.js","../node_modules/jsts/org/locationtech/jts/math/MathUtil.js","../node_modules/jsts/java/lang/System.js","../node_modules/jsts/org/locationtech/jts/geom/CoordinateArrays.js","../node_modules/jsts/java/lang/StringBuilder.js","../node_modules/jsts/org/locationtech/jts/geom/impl/CoordinateArraySequence.js","../node_modules/jsts/org/locationtech/jts/geom/impl/CoordinateArraySequenceFactory.js","../node_modules/jsts/org/locationtech/jts/geom/MultiPolygon.js","../node_modules/jsts/java/util/Map.js","../node_modules/jsts/java/util/HashSet.js","../node_modules/jsts/java/util/HashMap.js","../node_modules/jsts/org/locationtech/jts/geom/PrecisionModel.js","../node_modules/jsts/org/locationtech/jts/geom/MultiLineString.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryFactory.js","../node_modules/jsts/org/locationtech/jts/io/WKTParser.js","../node_modules/jsts/org/locationtech/jts/io/WKTReader.js","../node_modules/jsts/org/locationtech/jts/io/WKTWriter.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferParameters.js","../node_modules/jsts/org/locationtech/jts/geom/Location.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Position.js","../node_modules/jsts/java/util/EmptyStackException.js","../node_modules/jsts/java/util/Stack.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/RightmostEdgeFinder.js","../node_modules/jsts/org/locationtech/jts/geom/TopologyException.js","../node_modules/jsts/java/util/LinkedList.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferSubgraph.js","../node_modules/jsts/org/locationtech/jts/algorithm/Intersection.js","../node_modules/jsts/org/locationtech/jts/algorithm/Distance.js","../node_modules/jsts/org/locationtech/jts/algorithm/LineIntersector.js","../node_modules/jsts/org/locationtech/jts/algorithm/RobustLineIntersector.js","../node_modules/jsts/org/locationtech/jts/algorithm/RayCrossingCounter.js","../node_modules/jsts/org/locationtech/jts/algorithm/PointLocation.js","../node_modules/jsts/org/locationtech/jts/geomgraph/TopologyLocation.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Label.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeRing.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/MinimalEdgeRing.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/MaximalEdgeRing.js","../node_modules/jsts/org/locationtech/jts/geomgraph/GraphComponent.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Node.js","../node_modules/jsts/java/util/SortedMap.js","../node_modules/jsts/java/util/TreeMap.js","../node_modules/jsts/org/locationtech/jts/geomgraph/NodeMap.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Quadrant.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeEnd.js","../node_modules/jsts/org/locationtech/jts/geomgraph/DirectedEdge.js","../node_modules/jsts/org/locationtech/jts/geomgraph/NodeFactory.js","../node_modules/jsts/org/locationtech/jts/geomgraph/PlanarGraph.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/PolygonBuilder.js","../node_modules/jsts/org/locationtech/jts/index/strtree/Boundable.js","../node_modules/jsts/org/locationtech/jts/index/strtree/ItemBoundable.js","../node_modules/jsts/org/locationtech/jts/util/PriorityQueue.js","../node_modules/jsts/org/locationtech/jts/index/SpatialIndex.js","../node_modules/jsts/org/locationtech/jts/index/strtree/AbstractNode.js","../node_modules/jsts/java/util/Collections.js","../node_modules/jsts/org/locationtech/jts/index/strtree/EnvelopeDistance.js","../node_modules/jsts/org/locationtech/jts/index/strtree/BoundablePair.js","../node_modules/jsts/org/locationtech/jts/index/ItemVisitor.js","../node_modules/jsts/org/locationtech/jts/index/strtree/AbstractSTRtree.js","../node_modules/jsts/org/locationtech/jts/index/strtree/ItemDistance.js","../node_modules/jsts/org/locationtech/jts/index/strtree/STRtree.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentPointComparator.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentNode.js","../node_modules/jsts/java/util/Iterator.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentNodeList.js","../node_modules/jsts/org/locationtech/jts/noding/Octant.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentString.js","../node_modules/jsts/org/locationtech/jts/noding/NodableSegmentString.js","../node_modules/jsts/org/locationtech/jts/noding/NodedSegmentString.js","../node_modules/jsts/org/locationtech/jts/geom/LineSegment.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChainOverlapAction.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChain.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChainBuilder.js","../node_modules/jsts/org/locationtech/jts/noding/Noder.js","../node_modules/jsts/org/locationtech/jts/noding/SinglePassNoder.js","../node_modules/jsts/org/locationtech/jts/noding/MCIndexNoder.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferInputLineSimplifier.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetSegmentString.js","../node_modules/jsts/org/locationtech/jts/algorithm/Angle.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetSegmentGenerator.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetCurveBuilder.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/SubgraphDepthLocater.js","../node_modules/jsts/org/locationtech/jts/algorithm/NotRepresentableException.js","../node_modules/jsts/org/locationtech/jts/algorithm/HCoordinate.js","../node_modules/jsts/org/locationtech/jts/geom/Triangle.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/OffsetCurveSetBuilder.js","../node_modules/jsts/org/locationtech/jts/algorithm/locate/PointOnGeometryLocator.js","../node_modules/jsts/org/locationtech/jts/geom/GeometryCollectionIterator.js","../node_modules/jsts/org/locationtech/jts/algorithm/locate/SimplePointInAreaLocator.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeEndStar.js","../node_modules/jsts/org/locationtech/jts/geomgraph/DirectedEdgeStar.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/OverlayNodeFactory.js","../node_modules/jsts/org/locationtech/jts/noding/OrientedCoordinateArray.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeList.js","../node_modules/jsts/org/locationtech/jts/noding/SegmentIntersector.js","../node_modules/jsts/org/locationtech/jts/noding/IntersectionAdder.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeIntersection.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeIntersectionList.js","../node_modules/jsts/org/locationtech/jts/geom/IntersectionMatrix.js","../node_modules/jsts/org/locationtech/jts/util/IntArrayList.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/MonotoneChainIndexer.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/MonotoneChainEdge.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Depth.js","../node_modules/jsts/org/locationtech/jts/geomgraph/Edge.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferBuilder.js","../node_modules/jsts/org/locationtech/jts/noding/ScaledNoder.js","../node_modules/jsts/org/locationtech/jts/noding/NodingValidator.js","../node_modules/jsts/org/locationtech/jts/noding/snapround/HotPixel.js","../node_modules/jsts/org/locationtech/jts/index/chain/MonotoneChainSelectAction.js","../node_modules/jsts/org/locationtech/jts/noding/snapround/MCIndexPointSnapper.js","../node_modules/jsts/org/locationtech/jts/noding/InteriorIntersectionFinderAdder.js","../node_modules/jsts/org/locationtech/jts/noding/snapround/MCIndexSnapRounder.js","../node_modules/jsts/org/locationtech/jts/operation/buffer/BufferOp.js","../node_modules/jsts/org/locationtech/jts/algorithm/BoundaryNodeRule.js","../node_modules/jsts/org/locationtech/jts/algorithm/PointLocator.js","../node_modules/jsts/org/locationtech/jts/noding/BasicSegmentString.js","../node_modules/jsts/org/locationtech/jts/noding/NodingIntersectionFinder.js","../node_modules/jsts/org/locationtech/jts/noding/FastNodingValidator.js","../node_modules/jsts/org/locationtech/jts/geomgraph/EdgeNodingValidator.js","../node_modules/jsts/org/locationtech/jts/geom/util/GeometryCollectionMapper.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/LineBuilder.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/PointBuilder.js","../node_modules/jsts/org/locationtech/jts/geom/util/GeometryTransformer.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/LineStringSnapper.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/GeometrySnapper.js","../node_modules/jsts/org/locationtech/jts/precision/CommonBits.js","../node_modules/jsts/org/locationtech/jts/precision/CommonBitsRemover.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/SnapOverlayOp.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/snap/SnapIfNeededOverlayOp.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/MonotoneChain.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/SweepLineEvent.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/SegmentIntersector.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/SimpleMCSweepLineIntersector.js","../node_modules/jsts/org/locationtech/jts/geomgraph/index/EdgeSetIntersector.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/IntervalRTreeNode.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/IntervalRTreeLeafNode.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/IntervalRTreeBranchNode.js","../node_modules/jsts/org/locationtech/jts/index/intervalrtree/SortedPackedIntervalRTree.js","../node_modules/jsts/org/locationtech/jts/geom/util/LinearComponentExtracter.js","../node_modules/jsts/org/locationtech/jts/index/ArrayListVisitor.js","../node_modules/jsts/org/locationtech/jts/algorithm/locate/IndexedPointInAreaLocator.js","../node_modules/jsts/org/locationtech/jts/geomgraph/GeometryGraph.js","../node_modules/jsts/org/locationtech/jts/operation/GeometryGraphOperation.js","../node_modules/jsts/org/locationtech/jts/operation/overlay/OverlayOp.js","../node_modules/jsts/org/locationtech/jts/operation/relate/EdgeEndBuilder.js","../node_modules/jsts/org/locationtech/jts/operation/relate/EdgeEndBundle.js","../node_modules/jsts/org/locationtech/jts/operation/relate/EdgeEndBundleStar.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateNode.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateNodeFactory.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateComputer.js","../node_modules/jsts/org/locationtech/jts/operation/predicate/RectangleContains.js","../node_modules/jsts/org/locationtech/jts/algorithm/RectangleLineIntersector.js","../node_modules/jsts/org/locationtech/jts/geom/util/ShortCircuitedGeometryVisitor.js","../node_modules/jsts/org/locationtech/jts/operation/predicate/RectangleIntersects.js","../node_modules/jsts/org/locationtech/jts/operation/relate/RelateOp.js","../node_modules/jsts/org/locationtech/jts/operation/union/UnionOp.js","../src/geo-utils.js","../src/dungeonstate.js","../src/lib/pixi-filters.min.js","../src/renderer.js","../src/dungeon.js","../src/dungeonlayer.js","../src/dungeondraw.js"],"sourcesContent":["// module name from module.json\nexport const MODULE_NAME = \"dungeon-draw\";\nexport const SETTING_THEME_PAINTER_THEME = \"themePainterTheme\";\n","import * as constants from \"./constants.js\";\n\nexport const defaultConfig = () => {\n return {\n backgroundImage: \"\",\n doorColor: \"#000000\",\n doorFillColor: \"#ffffff\",\n doorFillOpacity: 1.0,\n doorLineThickness: 8,\n doorThickness: 25,\n exteriorShadowColor: \"#000000\",\n exteriorShadowThickness: 20,\n exteriorShadowOpacity: 0.5,\n floorColor: \"#F2EDDF\",\n floorTexture: \"\",\n floorTextureTint: \"\",\n interiorShadowColor: \"#000000\",\n interiorShadowThickness: 8,\n interiorShadowOpacity: 0.5,\n sceneBackgroundColor: \"#999999\",\n sceneGridColor: \"#000000\",\n sceneGridOpacity: 0.2,\n secretDoorSColor: \"#ffffff\",\n secretDoorStyleGM: \"secret\",\n secretDoorStylePlayer: \"wall\",\n wallColor: \"#000000\",\n wallTexture: \"\",\n wallTextureTint: \"\",\n wallThickness: 8,\n };\n};\n\nexport const getTheme = (themeKey) => {\n const splits = themeKey.split(\".\");\n const type = splits[0];\n const key = splits[1];\n if (type === \"custom\") {\n const customThemes = getCustomThemes();\n return customThemes[key];\n }\n return themes[key];\n};\n\nexport const getCustomThemes = () => {\n try {\n const customThemesString = game.settings.get(\n constants.MODULE_NAME,\n \"customThemes\"\n );\n return JSON.parse(customThemesString);\n } catch (e) {\n console.log(e);\n return {};\n }\n};\n\nexport const setCustomThemes = (customThemes) => {\n const themesString = JSON.stringify(customThemes);\n game.settings.set(constants.MODULE_NAME, \"customThemes\", themesString);\n};\n\nexport const getThemePainterThemeKey = () => {\n return game.settings.get(\n constants.MODULE_NAME,\n constants.SETTING_THEME_PAINTER_THEME\n );\n};\n\nexport const setThemePainterThemeKey = (themeKey) => {\n return game.settings.set(\n constants.MODULE_NAME,\n constants.SETTING_THEME_PAINTER_THEME,\n themeKey\n );\n};\n\nexport const themes = {\n default: {\n name: \"Default\",\n config: defaultConfig(),\n },\n arcPavement: {\n name: \"Arc Pavement\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#111111\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Arc_Pavement_001_basecolor.jpg\",\n wallColor: \"#111111\",\n wallThickness: 12,\n }),\n },\n basicBlack: {\n name: \"Basic Black\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#0D0D0D\",\n doorFillOpacity: 0.0,\n exteriorShadowOpacity: 0,\n interiorShadowOpacity: 0,\n floorColor: \"#FFFFFF\",\n sceneBackgroundColor: \"#0D0D0D\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#0D0D0D\",\n wallColor: \"#0D0D0D\",\n }),\n },\n cavern: {\n name: \"Cavern\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#2B2D2F\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Stylized_Stone_Floor_002_bw.jpg\",\n wallColor: \"#2B2D2F\",\n wallThickness: 12,\n }),\n },\n checkerboard: {\n name: \"Checkerboard\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorFillColor: \"#C2BFB0\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/sci_fi_texture_150_by_llexandro_d939vk9.png\",\n secretDoorSColor: \"#C2BFB0\",\n wallThickness: 10,\n }),\n },\n cobblestone: {\n name: \"Cobblestone\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#222222\",\n doorFillColor: \"#FFFFFF\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Cobblestone_001_COLOR.jpg\",\n secretDoorSColor: \"#FFFFFF\",\n wallColor: \"#222222\",\n wallThickness: 12,\n }),\n },\n dirt: {\n name: \"Dirt\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#1a1714\",\n doorFillColor: \"#8d7862\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Ground_Dirt_007_basecolor.jpg\",\n secretDoorSColor: \"#8d7862\",\n wallColor: \"#1a1714\",\n wallThickness: 10,\n }),\n },\n dungeonSquares: {\n name: \"Dungeon Squares\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#111111\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/outdoor+stone+tiles+pavement.jpg\",\n wallColor: \"#111111\",\n wallThickness: 12,\n }),\n },\n grass: {\n name: \"Grass\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#72471d\",\n doorFillColor: \"#eee8c1\",\n floorTexture: \"modules/dungeon-draw/assets/textures/Grass_001_COLOR.jpg\",\n secretDoorSColor: \"#eee8c1\",\n wallColor: \"#72471d\",\n wallThickness: 10,\n }),\n },\n groovyCarpet: {\n name: \"Groovy Carpet\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#2B2D2F\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Fabric_Rug_006_basecolor.jpg\",\n wallColor: \"#2B2D2F\",\n wallThickness: 12,\n }),\n },\n hexagon: {\n name: \"Hexagons\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#282828\",\n doorFillColor: \"#D1BD8A\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Rocks_Hexagons_002_basecolor.jpg\",\n secretDoorSColor: \"#D1BD8A\",\n wallColor: \"#282828\",\n wallThickness: 12,\n }),\n },\n marble: {\n name: \"Marble\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#686882\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Marble_Tiles_001_basecolor.jpg\",\n wallColor: \"#686882\",\n }),\n },\n metalGrid: {\n name: \"Metal Grid\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#27251A\",\n doorFillColor: \"#AAAAAA\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Sci-fi_Floor_002_basecolor.jpg\",\n secretDoorSColor: \"#AAAAAA\",\n wallColor: \"#27251A\",\n }),\n },\n metalSquares: {\n name: \"Metal Squares\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorFillColor: \"#C0C0C0\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/sci_fi_texture_212_by_llexandro_dcuxgum.png\",\n secretDoorSColor: \"#C0C0C0\",\n }),\n },\n moldvayBlue: {\n name: \"Moldvay Blue\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#3A9FF2\",\n doorFillOpacity: 0.0,\n doorThickness: 35,\n exteriorShadowOpacity: 0,\n floorColor: \"#FFFFFF\",\n interiorShadowOpacity: 0,\n sceneBackgroundColor: \"#3A9FF2\",\n sceneGridColor: \"#3A9FF2\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#3A9FF2\",\n wallColor: \"#3A9FF2\",\n }),\n },\n neonBlueprint: {\n name: \"Neon Blueprint\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#3A9FF2\",\n doorFillOpacity: 0.0,\n doorThickness: 35,\n exteriorShadowColor: \"#18495E\",\n floorColor: \"#142A3B\",\n interiorShadowColor: \"#1B7FAB\",\n sceneBackgroundColor: \"#171008\",\n sceneGridColor: \"#4C89A1\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#3A9FF2\",\n wallColor: \"#63C9E6\",\n wallThickness: 4,\n }),\n },\n ruddyPaper: {\n name: \"Ruddy Paper\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#913B55\",\n doorFillColor: \"#FADEE6\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Paper_Recycled_001_COLOR.jpg\",\n floorTextureTint: \"#F9FAE6\",\n exteriorShadowOpacity: 0,\n interiorShadowOpacity: 0,\n sceneBackgroundColor: \"#EBD3BC\",\n sceneGridColor: \"#594026\",\n sceneGridOpacity: 1.0,\n secretDoorSColor: \"#913B55\",\n wallColor: \"#9A6D54\",\n }),\n },\n water: {\n name: \"Water\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#203246\",\n floorTexture: \"modules/dungeon-draw/assets/textures/Water_001_COLOR.jpg\",\n wallColor: \"#203246\",\n wallThickness: 5,\n }),\n },\n woodPlanks: {\n name: \"Wood Planks\",\n config: foundry.utils.mergeObject(defaultConfig(), {\n doorColor: \"#332211\",\n floorTexture:\n \"modules/dungeon-draw/assets/textures/Old_Wooden_Plank_Seamless_Texture_765.jpg\",\n wallColor: \"#332211\",\n wallTexture: \"modules/dungeon-draw/assets/textures/Bark_002_bw.jpg\",\n wallTextureTint: \"#7e5935\",\n wallThickness: 15,\n }),\n },\n};\n","// TODO: fix this circular dependency\n// import { ConfigSheet } from \"./configsheet.js\";\nimport { getCustomThemes, setCustomThemes } from \"./themes.js\";\n\n/**\n * Sheet for Theme editing.\n *\n * @extends {FormApplication}\n */\nexport class ThemeSheet extends FormApplication {\n constructor(themeKey) {\n super();\n this.themeKey = themeKey;\n }\n\n static get defaultOptions() {\n return foundry.utils.mergeObject(super.defaultOptions, {\n id: \"dd-theme-sheet\",\n classes: [\"sheet\"],\n template: \"modules/dungeon-draw/templates/theme-sheet.html\",\n width: 480,\n height: 880,\n tabs: [\n { navSelector: \".tabs\", contentSelector: \"form\", initial: \"position\" },\n ],\n });\n }\n\n /** @override */\n get title() {\n return game.i18n.localize(\"DD.ThemeSheetTitle\");\n }\n\n /** @override */\n getData() {\n const customThemes = getCustomThemes();\n const theme = customThemes[this.themeKey];\n return {\n config: theme.config,\n themeName: theme.name,\n };\n }\n\n /* -------------------------------------------- */\n\n /** @override */\n async _updateObject(event, formData) {\n const customThemes = getCustomThemes();\n const themeName = formData.themeName;\n delete formData.themeName;\n // overwrite the theme at our key\n customThemes[this.themeKey] = {\n name: themeName,\n config: formData,\n };\n setCustomThemes(customThemes);\n // force already-open config sheet to re-render\n // TODO: fix this circular dependency\n // new ConfigSheet(\"themes\").render(true);\n }\n}\n","import {\n defaultConfig,\n getCustomThemes,\n getThemePainterThemeKey,\n setCustomThemes,\n setThemePainterThemeKey,\n themes,\n} from \"./themes.js\";\nimport { ThemeSheet } from \"./themesheet.js\";\n\n/**\n * Sheet for dungeon config/settings.\n *\n * @extends {FormApplication}\n */\nexport class ConfigSheet extends FormApplication {\n constructor(activeTab = \"settings\") {\n super();\n this._tabs[0].active = activeTab;\n }\n\n static get defaultOptions() {\n return foundry.utils.mergeObject(super.defaultOptions, {\n id: \"dd-config-sheet\",\n classes: [\"sheet\"],\n template: \"modules/dungeon-draw/templates/config-sheet.html\",\n width: 480,\n height: 970,\n tabs: [\n { navSelector: \".tabs\", contentSelector: \"form\", initial: \"position\" },\n ],\n });\n }\n\n /** @override */\n get title() {\n return game.i18n.localize(\"DD.ConfigSheetTitle\");\n }\n\n /** @override */\n getData() {\n let config = canvas.dungeon.dungeon?.state().config;\n if (!config) {\n config = defaultConfig();\n }\n const customThemes = getCustomThemes();\n const customThemeKeys = Object.keys(customThemes).sort();\n const themeKeys = Object.keys(themes).sort();\n const themePainterThemeKey = getThemePainterThemeKey();\n return {\n config,\n customThemes,\n customThemeKeys,\n themes,\n themeKeys,\n themePainterThemeKey,\n };\n }\n\n /* -------------------------------------------- */\n\n /** @override */\n async _updateObject(event, formData) {\n // TODO: handle customThemeName vs. config better\n delete formData.customThemeName;\n delete formData.themePainterTheme;\n console.log(\"*** formData\");\n console.log(formData);\n canvas.dungeon.dungeon?.setConfig(formData);\n if (game.user.isGM) {\n // need GM privs to update scene\n await canvas.scene.update({\n backgroundColor: formData.sceneBackgroundColor,\n gridAlpha: formData.sceneGridAlpha,\n gridColor: formData.sceneGridColor,\n });\n }\n }\n\n /* -------------------------------------------- */\n\n /** @override */\n async close(options) {\n await super.close(options);\n if (this.preview) {\n this.preview.removeChildren();\n this.preview = null;\n }\n }\n\n /* -------------------------------------------- */\n /* Event Listeners and Handlers */\n /* -------------------------------------------- */\n\n /** @override */\n activateListeners(html) {\n super.activateListeners(html);\n html\n .find('button[name=\"resetDefault\"]')\n .click(this._onResetDefaults.bind(this));\n html.find(\".dd-theme-name\").click(this._onThemeNameClick.bind(this));\n html\n .find(\".dd-save-as-theme-button\")\n .click(this._onSaveAsThemeClick.bind(this));\n html.find(\".dd-theme-edit\").click(this._onEditThemeClick.bind(this));\n html.find(\".dd-theme-copy\").click(this._onCopyThemeClick.bind(this));\n html.find(\".dd-theme-delete\").click(this._onDeleteThemeClick.bind(this));\n html\n .find('select[name=\"themePainterThemeKey\"]')\n .change(this._onThemePainterThemeSelect.bind(this));\n }\n\n /* -------------------------------------------- */\n\n /**\n * Reset the user Drawing configuration settings to their default values\n * @param {PointerEvent} event The originating mouse-click event\n * @protected\n */\n _onResetDefaults(event) {\n event.preventDefault();\n canvas.dungeon.dungeon?.setConfig(defaultConfig());\n canvas.dungeon.dungeon.refresh();\n this.render();\n }\n\n async _onThemeNameClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).parent(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n const isCustom = themeRow.data(\"themetype\") === \"custom\";\n let theme;\n if (isCustom) {\n const customThemes = getCustomThemes();\n theme = customThemes[themeKey];\n } else {\n theme = themes[themeKey];\n }\n const newConfig = { ...theme.config };\n await canvas.dungeon.dungeon?.setConfig(newConfig);\n if (game.user.isGM) {\n // need GM privs to update scene\n await canvas.scene.update({\n backgroundColor: newConfig.sceneBackgroundColor,\n gridAlpha: newConfig.sceneGridAlpha,\n gridColor: newConfig.sceneGridColor,\n });\n }\n this.render();\n }\n\n async _onSaveAsThemeClick(event) {\n event.preventDefault();\n const input = $(event.currentTarget)\n .closest(\".form-fields\")\n .children(\".saveAsThemeName\");\n const saveAsThemeName = input.val();\n const formData = this._getSubmitData();\n // TODO: handle saveAsThemeName better\n delete formData.saveAsThemeName;\n delete formData.themePainterThemeKey;\n const customThemes = getCustomThemes();\n customThemes[saveAsThemeName] = {\n name: saveAsThemeName,\n config: formData,\n };\n setCustomThemes(customThemes);\n this._tabs[0].active = \"themes\";\n this.render();\n }\n\n async _onEditThemeClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).closest(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n new ThemeSheet(themeKey).render(true);\n }\n\n _onCopyThemeClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).closest(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n const customThemes = getCustomThemes();\n const oldTheme = customThemes[themeKey];\n const newTheme = JSON.parse(JSON.stringify(oldTheme));\n // deal with possible name collisions\n let num = 1;\n let newName;\n let done = false;\n while (!done) {\n newName = `${oldTheme.name} (${num})`;\n if (newName in customThemes) {\n num++;\n } else {\n done = true;\n }\n }\n newTheme.name = newName;\n customThemes[newName] = newTheme;\n setCustomThemes(customThemes);\n this.render();\n }\n\n _onDeleteThemeClick(event) {\n event.preventDefault();\n const themeRow = $(event.currentTarget).closest(\".dd-theme-row\");\n const themeKey = themeRow.data(\"theme\");\n const customThemes = getCustomThemes();\n delete customThemes[themeKey];\n setCustomThemes(customThemes);\n this.render();\n }\n\n _onThemePainterThemeSelect(event) {\n const themeKey = $(event.currentTarget).val();\n setThemePainterThemeKey(themeKey);\n }\n}\n","import * as constants from \"./constants.js\";\n\nexport const makeWalls = async (state) => {\n if (!game.user.isGM) {\n // need GM privs to delete/create walls\n return;\n }\n await deleteAllWalls();\n if (state.geometry) {\n await makeWallsFromMulti(state.geometry);\n }\n await makeInteriorWalls(state.interiorWalls);\n await makeDoors(state.doors);\n await makeSecretDoors(state.secretDoors);\n};\n\nconst deleteAllWalls = async () => {\n try {\n // scene.update() triggers a redraw,\n // which causes an infinite loop of redraw/refresh.\n // so avoid it :P\n const walls = canvas.scene.getEmbeddedCollection(\"Wall\");\n const ids = [];\n for (const wall of walls) {\n const flag = wall.getFlag(constants.MODULE_NAME, \"dungeonVersion\");\n if (flag) {\n ids.push(wall.id);\n }\n }\n await canvas.scene.deleteEmbeddedDocuments(\"Wall\", ids);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst makeWallsFromMulti = async (multi) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n await makeWallsFromPoly(poly);\n }\n};\n\nconst wallData = (x1, y1, x2, y2) => {\n return {\n // From Foundry API docs:\n // \"The wall coordinates, a length-4 array of finite numbers [x0,y0,x1,y1]\"\n c: [x1, y1, x2, y2],\n flags: {\n \"dungeon-draw\": {\n // extract string constant somewhere\n dungeonVersion: \"1.0\",\n },\n },\n };\n};\n\nconst doorData = (x1, y1, x2, y2) => {\n const data = wallData(x1, y1, x2, y2);\n data.door = 1; // door\n return data;\n};\n\nconst secretDoorData = (x1, y1, x2, y2) => {\n const data = wallData(x1, y1, x2, y2);\n data.door = 2; // secret\n return data;\n};\n\nconst makeWallsFromPoly = async (poly) => {\n const allWalls = [];\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n for (let i = 0; i < coords.length - 1; i++) {\n // constants.MODULE_NAME\n const data = wallData(\n coords[i].x,\n coords[i].y,\n coords[i + 1].x,\n coords[i + 1].y\n );\n allWalls.push(data);\n }\n const numHoles = poly.getNumInteriorRing();\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n for (let i = 0; i < coords.length - 1; i++) {\n const data = wallData(\n coords[i].x,\n coords[i].y,\n coords[i + 1].x,\n coords[i + 1].y\n );\n allWalls.push(data);\n }\n }\n if (allWalls.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allWalls);\n }\n};\n\n/** [[x1,y1,x2,y2],...] */\nconst makeInteriorWalls = async (walls) => {\n const allWalls = [];\n for (const wall of walls) {\n const data = wallData(wall[0], wall[1], wall[2], wall[3]);\n allWalls.push(data);\n }\n if (allWalls.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allWalls);\n }\n};\n\n/** [[x1,y1,x2,y2],...] */\nconst makeDoors = async (doors) => {\n const allDoors = [];\n for (const door of doors) {\n const data = doorData(door[0], door[1], door[2], door[3]);\n allDoors.push(data);\n }\n if (allDoors.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allDoors);\n }\n};\n\n/** [[x1,y1,x2,y2],...] */\nconst makeSecretDoors = async (doors) => {\n const allDoors = [];\n for (const door of doors) {\n const data = secretDoorData(door[0], door[1], door[2], door[3]);\n allDoors.push(data);\n }\n if (allDoors.length) {\n await canvas.scene.createEmbeddedDocuments(\"Wall\", allDoors);\n }\n};\n","export default class NumberUtil {\n static equalsWithTolerance(x1, x2, tolerance) {\n return Math.abs(x1 - x2) <= tolerance\n }\n}\n","export default class Exception extends Error {\n constructor(message) {\n super(message)\n this.name = Object.keys({ Exception })[0]\n }\n toString() {\n return this.message\n }\n}\n","import Exception from './Exception.js'\n\nexport default class IllegalArgumentException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ IllegalArgumentException })[0]\n }\n}\n","export default class Long {\n constructor(high, low) {\n this.low = low || 0\n this.high = high || 0\n }\n\n static toBinaryString(i) {\n let mask\n let result = ''\n for (mask = 0x80000000; mask > 0; mask >>>= 1)\n result += (i.high & mask) === mask ? '1' : '0'\n for (mask = 0x80000000; mask > 0; mask >>>= 1)\n result += (i.low & mask) === mask ? '1' : '0'\n return result\n }\n}\n","import Long from './Long.js'\n\nexport default function Double() { }\n\nDouble.NaN = NaN\nDouble.isNaN = n => Number.isNaN(n)\nDouble.isInfinite = n => !Number.isFinite(n)\nDouble.MAX_VALUE = Number.MAX_VALUE\nDouble.POSITIVE_INFINITY = Number.POSITIVE_INFINITY\nDouble.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY\n\nif (typeof Float64Array === 'function' &&\n typeof Int32Array === 'function')\n// Simple and fast conversion between double and long bits\n// using TypedArrays and ArrayViewBuffers.\n\n (function() {\n const EXP_BIT_MASK = 0x7ff00000\n const SIGNIF_BIT_MASK = 0xFFFFF\n const f64buf = new Float64Array(1)\n const i32buf = new Int32Array(f64buf.buffer)\n Double.doubleToLongBits = function(value) {\n f64buf[0] = value\n let low = i32buf[0] | 0\n let high = i32buf[1] | 0\n // Check for NaN based on values of bit fields, maximum\n // exponent and nonzero significand.\n if (((high & EXP_BIT_MASK) === EXP_BIT_MASK) &&\n ((high & SIGNIF_BIT_MASK) !== 0) &&\n (low !== 0)) {\n low = 0 | 0\n high = 0x7ff80000 | 0\n }\n return new Long(high, low)\n }\n Double.longBitsToDouble = function(bits) {\n i32buf[0] = bits.low\n i32buf[1] = bits.high\n return f64buf[0]\n }\n })()\nelse\n// More complex and slower fallback implementation using\n// math and the divide-by-two and multiply-by-two algorithms.\n\n (function() {\n const BIAS = 1023\n const log2 = Math.log2\n const floor = Math.floor\n const pow = Math.pow\n const MAX_REL_BITS_INTEGER = (function() {\n for (let i = 53; i > 0; i--) {\n const bits = pow(2, i) - 1\n if (floor(log2(bits)) + 1 === i) return bits\n }\n return 0\n })()\n Double.doubleToLongBits = function(value) {\n let x, y, f, bits, skip\n let sign, exp, high, low\n\n // Get the sign bit and absolute value.\n if (value < 0 || 1 / value === Number.NEGATIVE_INFINITY) {\n sign = (1 << 31)\n value = (-value)\n } else {\n sign = 0\n }\n\n // Handle some special values.\n if (value === 0) {\n // Handle zeros (+/-0).\n low = 0 | 0\n high = sign // exponent: 00..00, significand: 00..00\n return new Long(high, low)\n }\n\n if (value === Infinity) {\n // Handle infinity (only positive values for value possible).\n low = 0 | 0\n high = sign | 0x7ff00000 // exponent: 11..11, significand: 00..00\n return new Long(high, low)\n }\n\n if (value !== value) { // eslint-disable-line\n // Handle NaNs (boiled down to only one distinct NaN).\n low = 0 | 0\n high = 0x7ff80000 // exponent: 11..11, significand: 10..00\n return new Long(high, low)\n }\n\n // Preinitialize variables, that are not neccessarily set by\n // the algorithm.\n bits = 0\n low = 0 | 0\n\n // Get the (always positive) integer part of value.\n x = floor(value)\n\n // Process the integer part if it's greater than 1. Zero requires\n // no bits at all, 1 represents the implicit (hidden) leading bit,\n // which must not be written as well.\n if (x > 1)\n // If we can reliably determine the number of bits required for\n // the integer part,\n\n if (x <= MAX_REL_BITS_INTEGER) {\n // get the number of bits required to represent it minus 1\n bits = floor(log2(x)) /* + 1 - 1 */\n // and simply copy/shift the integer bits into low and high.\n // That's much faster than the divide-by-two algorithm (saves\n // up to ~60%).\n // We always need to mask out the most significant bit, which\n // is the implicit (aka hidden) bit.\n if (bits <= 20) {\n // The simple case in which the integer fits into the\n // lower 20 bits of the high word is worth to be handled\n // separately (saves ~25%).\n low = 0 | 0\n high = (x << (20 - bits)) & 0xfffff\n } else {\n // Here, the integer part is split into low and high.\n // Since its value may require more than 32 bits, we\n // cannot use bitwise operators (which implicitly cast\n // to Int32), but use arithmetic operators % and / to\n // get low and high parts. The uppper 20 bits go to high,\n // the remaining bits (in f) to low.\n f = bits - 20\n // Like (1 << f) but safe with even more than 32 bits.\n y = pow(2, f)\n low = (x % y) << (32 - f)\n high = (x / y) & 0xfffff\n }\n } else {\n // For greater values, we must use the much slower divide-by-two\n // algorithm. Bits are generated from right to left, that is from\n // least to most significant bit. For each bit, we left-shift both\n // low and high by one and carry bit #0 from high to #31 in low.\n // The next bit is then copied into bit #19 in high, the leftmost\n // bit of the double's significand.\n\n // Preserve x for later user, so work with f.\n f = x\n low = 0 | 0\n for (;;) {\n y = f / 2\n f = floor(y)\n if (f === 0)\n // We just found the most signigicant (1-)bit, which\n // is the implicit bit and so, not stored in the double\n // value. So, it's time to leave the loop.\n break\n\n // Count this bit, shift low and carry bit #0 from high.\n bits++\n low >>>= 1\n low |= (high & 0x1) << 31\n // Shift high.\n high >>>= 1\n if (y !== f)\n // Copy the new bit into bit #19 in high (only required if 1).\n high |= 0x80000\n }\n }\n\n // Bias the exponent.\n exp = bits + BIAS\n\n // If the integer part is zero, we've not yet seen the implicit\n // leading bit. Variable skip is later used while processing the\n // fractional part (if any).\n skip = (x === 0)\n\n // Get fraction only into x.\n x = value - x\n\n // If some significand bits are still left to be filled and\n // the fractional part is not zero, convert the fraction using\n // the multiply-by-2 algorithm.\n if (bits < 52 && x !== 0) {\n // Initialize 'buffer' f, into which newly created bits get\n // shifted from right to left.\n f = 0\n\n for (;;) {\n y = x * 2\n if (y >= 1) {\n // This is a new 1-bit. Add and count this bit, if not\n // prohibited by skip.\n x = y - 1\n if (!skip) {\n f <<= 1\n f |= 1\n bits++\n } else {\n // Otherwise, decrement the exponent and unset\n // skip, so that all following bits get written.\n exp--\n skip = false\n }\n } else {\n // This is a new 0-bit. Add and count this bit, if not\n // prohibited by skip.\n x = y\n if (!skip) {\n f <<= 1\n bits++\n } else if (--exp === 0) {\n // Otherwise we've just decremented the exponent. If the\n // biased exponent is zero now (-1023), we process a\n // subnormal number, which has no impled leading 1-bit.\n // So, count this 0-bit and unset skip to write out\n // all the following bits.\n bits++\n skip = false\n }\n }\n if (bits === 20) {\n // When 20 bits have been created in total, we're done with\n // the high word. Copy the bits from 'buffer' f into high\n // and reset 'buffer' f. Following bits will end up in the\n // low word.\n high |= f\n f = 0\n } else if (bits === 52) {\n // When 52 bits have been created in total, we're done with\n // low word as well. Copy the bits from 'buffer' f into low\n // and exit the loop.\n low |= f\n break\n }\n if (y === 1) {\n // When y is exactly 1, there is no remainder and the process\n // is complete (the number is finite). Copy the bits from\n // 'buffer' f into either low or high and exit the loop.\n if (bits < 20)\n high |= (f << (20 - bits))\n else if (bits < 52) low |= (f << (52 - bits))\n\n break\n }\n }\n }\n\n // Copy/shift the exponent and sign bits into the high word.\n high |= (exp << 20)\n high |= sign\n\n return new Long(high, low)\n }\n Double.longBitsToDouble = function(bits) {\n let i\n let x, exp, fract\n const high = bits.high\n const low = bits.low\n\n // Extract the sign.\n const sign = (high & (1 << 31)) ? -1 : 1\n\n // Extract the unbiased exponent.\n exp = ((high & 0x7ff00000) >> 20) - BIAS\n\n // Calculate the fraction from left to right. Start\n // off with the 20 lower bits from the high word.\n fract = 0\n x = (1 << 19)\n for (i = 1; i <= 20; i++) {\n if (high & x) fract += pow(2, -i)\n\n x >>>= 1\n }\n // Continue with all 32 bits from the low word.\n x = (1 << 31)\n for (i = 21; i <= 52; i++) {\n if (low & x) fract += pow(2, -i)\n\n x >>>= 1\n }\n\n // Handle special values.\n // Check for zero and subnormal values.\n if (exp === -BIAS) {\n if (fract === 0)\n // +/-1.0 * 0.0 => +/-0.0\n return sign * 0\n\n exp = -1022\n } else if (exp === BIAS + 1) { // Check for +/-Infinity or NaN.\n if (fract === 0)\n // +/-1.0 / 0.0 => +/-Infinity\n return sign / 0\n\n return NaN\n } else { // Nothing special? Seems to be a normal number.\n // Add the implicit leading bit (1*2^0).\n fract += 1\n }\n\n return sign * fract * pow(2, exp)\n }\n })()\n","export default function Comparable() {}\n","export default function Clonable() {}\n","export default function Comparator() {}\n","export default function Serializable() {}\n","import Exception from './Exception.js'\n\nexport default class RuntimeException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ RuntimeException })[0]\n }\n}\n","import RuntimeException from '../../../../java/lang/RuntimeException.js'\nexport default class AssertionFailedException extends RuntimeException {\n constructor() {\n super()\n AssertionFailedException.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {\n RuntimeException.constructor_.call(this)\n } else if (arguments.length === 1) {\n const message = arguments[0]\n RuntimeException.constructor_.call(this, message)\n }\n }\n}\n","import AssertionFailedException from './AssertionFailedException.js'\nexport default class Assert {\n static shouldNeverReachHere() {\n if (arguments.length === 0) {\n Assert.shouldNeverReachHere(null)\n } else if (arguments.length === 1) {\n const message = arguments[0]\n throw new AssertionFailedException('Should never reach here' + (message !== null ? ': ' + message : ''))\n }\n }\n static isTrue() {\n if (arguments.length === 1) {\n const assertion = arguments[0]\n Assert.isTrue(assertion, null)\n } else if (arguments.length === 2) {\n const assertion = arguments[0], message = arguments[1]\n if (!assertion) \n if (message === null) \n throw new AssertionFailedException()\n else \n throw new AssertionFailedException(message)\n \n \n }\n }\n static equals() {\n if (arguments.length === 2) {\n const expectedValue = arguments[0], actualValue = arguments[1]\n Assert.equals(expectedValue, actualValue, null)\n } else if (arguments.length === 3) {\n const expectedValue = arguments[0], actualValue = arguments[1], message = arguments[2]\n if (!actualValue.equals(expectedValue)) \n throw new AssertionFailedException('Expected ' + expectedValue + ' but encountered ' + actualValue + (message !== null ? ': ' + message : ''))\n \n }\n }\n}\n","import NumberUtil from '../util/NumberUtil.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport Comparator from '../../../../java/util/Comparator.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Assert from '../util/Assert.js'\n\nconst kBuf = new ArrayBuffer(8)\nconst kBufAsF64 = new Float64Array(kBuf)\nconst kBufAsI32 = new Int32Array(kBuf)\n\nexport default class Coordinate {\n constructor() {\n Coordinate.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.x = null\n this.y = null\n this.z = null\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this, 0.0, 0.0)\n } else if (arguments.length === 1) {\n const c = arguments[0]\n Coordinate.constructor_.call(this, c.x, c.y, c.getZ())\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n Coordinate.constructor_.call(this, x, y, Coordinate.NULL_ORDINATE)\n } else if (arguments.length === 3) {\n const x = arguments[0], y = arguments[1], z = arguments[2]\n this.x = x\n this.y = y\n this.z = z\n }\n }\n static hashCode(n) {\n kBufAsF64[0] = n\n return kBufAsI32[0] ^ kBufAsI32[1]\n }\n getM() {\n return Double.NaN\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case Coordinate.X:\n this.x = value\n break\n case Coordinate.Y:\n this.y = value\n break\n case Coordinate.Z:\n this.setZ(value)\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n equals2D() {\n if (arguments.length === 1) {\n const other = arguments[0]\n if (this.x !== other.x) \n return false\n \n if (this.y !== other.y) \n return false\n \n return true\n } else if (arguments.length === 2) {\n const c = arguments[0], tolerance = arguments[1]\n if (!NumberUtil.equalsWithTolerance(this.x, c.x, tolerance)) \n return false\n \n if (!NumberUtil.equalsWithTolerance(this.y, c.y, tolerance)) \n return false\n \n return true\n }\n }\n setM(m) {\n throw new IllegalArgumentException('Invalid ordinate index: ' + Coordinate.M)\n }\n getZ() {\n return this.z\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case Coordinate.X:\n return this.x\n case Coordinate.Y:\n return this.y\n case Coordinate.Z:\n return this.getZ()\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n equals3D(other) {\n return this.x === other.x && this.y === other.y && (this.getZ() === other.getZ() || Double.isNaN(this.getZ()) && Double.isNaN(other.getZ()))\n }\n equals(other) {\n if (!(other instanceof Coordinate)) \n return false\n \n return this.equals2D(other)\n }\n equalInZ(c, tolerance) {\n return NumberUtil.equalsWithTolerance(this.getZ(), c.getZ(), tolerance)\n }\n setX(x) {\n this.x = x\n }\n compareTo(o) {\n const other = o\n if (this.x < other.x) return -1\n if (this.x > other.x) return 1\n if (this.y < other.y) return -1\n if (this.y > other.y) return 1\n return 0\n }\n getX() {\n return this.x\n }\n setZ(z) {\n this.z = z\n }\n clone() {\n try {\n const coord = null\n return coord\n } catch (e) {\n if (e instanceof CloneNotSupportedException) {\n Assert.shouldNeverReachHere('this shouldn\\'t happen because this class is Cloneable')\n return null\n } else {\n throw e\n }\n } finally {}\n }\n copy() {\n return new Coordinate(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ', ' + this.getZ() + ')'\n }\n distance3D(c) {\n const dx = this.x - c.x\n const dy = this.y - c.y\n const dz = this.getZ() - c.getZ()\n return Math.sqrt(dx * dx + dy * dy + dz * dz)\n }\n getY() {\n return this.y\n }\n setY(y) {\n this.y = y\n }\n distance(c) {\n const dx = this.x - c.x\n const dy = this.y - c.y\n return Math.sqrt(dx * dx + dy * dy)\n }\n hashCode() {\n let result = 17\n result = 37 * result + Coordinate.hashCode(this.x)\n result = 37 * result + Coordinate.hashCode(this.y)\n return result\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n }\n get interfaces_() {\n return [Comparable, Cloneable, Serializable]\n }\n}\nclass DimensionalComparator {\n constructor() {\n DimensionalComparator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._dimensionsToTest = 2\n if (arguments.length === 0) {\n DimensionalComparator.constructor_.call(this, 2)\n } else if (arguments.length === 1) {\n const dimensionsToTest = arguments[0]\n if (dimensionsToTest !== 2 && dimensionsToTest !== 3) throw new IllegalArgumentException('only 2 or 3 dimensions may be specified')\n this._dimensionsToTest = dimensionsToTest\n }\n }\n static compare(a, b) {\n if (a < b) return -1\n if (a > b) return 1\n if (Double.isNaN(a)) {\n if (Double.isNaN(b)) return 0\n return -1\n }\n if (Double.isNaN(b)) return 1\n return 0\n }\n compare(c1, c2) {\n const compX = DimensionalComparator.compare(c1.x, c2.x)\n if (compX !== 0) return compX\n const compY = DimensionalComparator.compare(c1.y, c2.y)\n if (compY !== 0) return compY\n if (this._dimensionsToTest <= 2) return 0\n const compZ = DimensionalComparator.compare(c1.getZ(), c2.getZ())\n return compZ\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nCoordinate.DimensionalComparator = DimensionalComparator\nCoordinate.NULL_ORDINATE = Double.NaN\nCoordinate.X = 0\nCoordinate.Y = 1\nCoordinate.Z = 2\nCoordinate.M = 3\n","export default function(o, i) {\n return o.interfaces_ && o.interfaces_.indexOf(i) > -1\n}\n","import Double from '../../../../java/lang/Double.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nexport default class CoordinateSequence {\n getM(index) {\n if (this.hasM()) {\n const mIndex = this.getDimension() - this.getMeasures()\n return this.getOrdinate(index, mIndex)\n } else {\n return Double.NaN\n }\n }\n setOrdinate(index, ordinateIndex, value) {}\n getZ(index) {\n if (this.hasZ()) \n return this.getOrdinate(index, 2)\n else \n return Double.NaN\n \n }\n size() {}\n getOrdinate(index, ordinateIndex) {}\n getCoordinate() {\n if (arguments.length === 1) {\n const i = arguments[0]\n } else if (arguments.length === 2) {\n const index = arguments[0], coord = arguments[1]\n }\n }\n getCoordinateCopy(i) {}\n createCoordinate() {}\n getDimension() {}\n hasM() {\n return this.getMeasures() > 0\n }\n getX(index) {}\n hasZ() {\n return this.getDimension() - this.getMeasures() > 2\n }\n getMeasures() {\n return 0\n }\n expandEnvelope(env) {}\n copy() {}\n getY(index) {}\n toCoordinateArray() {}\n get interfaces_() {\n return [Cloneable]\n }\n}\nCoordinateSequence.X = 0\nCoordinateSequence.Y = 1\nCoordinateSequence.Z = 2\nCoordinateSequence.M = 3\n","import hasInterface from '../../../../hasInterface.js'\nimport CoordinateSequence from './CoordinateSequence.js'\nexport default class CoordinateSequenceFactory {\n create() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordSeq = arguments[0]\n }\n } else if (arguments.length === 2) {\n const size = arguments[0], dimension = arguments[1]\n } else if (arguments.length === 3) {\n const size = arguments[0], dimension = arguments[1], measures = arguments[2]\n return this.create(size, dimension)\n }\n }\n}\n","export default class GeometryComponentFilter {\n filter(geom) {}\n}\n","import Coordinate from './Coordinate.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nexport default class Envelope {\n constructor() {\n Envelope.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._minx = null\n this._maxx = null\n this._miny = null\n this._maxy = null\n if (arguments.length === 0) {\n this.init()\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n this.init(p.x, p.x, p.y, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const env = arguments[0]\n this.init(env)\n }\n } else if (arguments.length === 2) {\n const p1 = arguments[0], p2 = arguments[1]\n this.init(p1.x, p2.x, p1.y, p2.y)\n } else if (arguments.length === 4) {\n const x1 = arguments[0], x2 = arguments[1], y1 = arguments[2], y2 = arguments[3]\n this.init(x1, x2, y1, y2)\n }\n }\n static intersects() {\n if (arguments.length === 3) {\n const p1 = arguments[0], p2 = arguments[1], q = arguments[2]\n if (q.x >= (p1.x < p2.x ? p1.x : p2.x) && q.x <= (p1.x > p2.x ? p1.x : p2.x) && (q.y >= (p1.y < p2.y ? p1.y : p2.y) && q.y <= (p1.y > p2.y ? p1.y : p2.y))) \n return true\n \n return false\n } else if (arguments.length === 4) {\n const p1 = arguments[0], p2 = arguments[1], q1 = arguments[2], q2 = arguments[3]\n let minq = Math.min(q1.x, q2.x)\n let maxq = Math.max(q1.x, q2.x)\n let minp = Math.min(p1.x, p2.x)\n let maxp = Math.max(p1.x, p2.x)\n if (minp > maxq) return false\n if (maxp < minq) return false\n minq = Math.min(q1.y, q2.y)\n maxq = Math.max(q1.y, q2.y)\n minp = Math.min(p1.y, p2.y)\n maxp = Math.max(p1.y, p2.y)\n if (minp > maxq) return false\n if (maxp < minq) return false\n return true\n }\n }\n getArea() {\n return this.getWidth() * this.getHeight()\n }\n equals(other) {\n if (!(other instanceof Envelope)) \n return false\n \n const otherEnvelope = other\n if (this.isNull()) \n return otherEnvelope.isNull()\n \n return this._maxx === otherEnvelope.getMaxX() && this._maxy === otherEnvelope.getMaxY() && this._minx === otherEnvelope.getMinX() && this._miny === otherEnvelope.getMinY()\n }\n intersection(env) {\n if (this.isNull() || env.isNull() || !this.intersects(env)) return new Envelope()\n const intMinX = this._minx > env._minx ? this._minx : env._minx\n const intMinY = this._miny > env._miny ? this._miny : env._miny\n const intMaxX = this._maxx < env._maxx ? this._maxx : env._maxx\n const intMaxY = this._maxy < env._maxy ? this._maxy : env._maxy\n return new Envelope(intMinX, intMaxX, intMinY, intMaxY)\n }\n isNull() {\n return this._maxx < this._minx\n }\n getMaxX() {\n return this._maxx\n }\n covers() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return this.covers(p.x, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n if (this.isNull() || other.isNull()) \n return false\n \n return other.getMinX() >= this._minx && other.getMaxX() <= this._maxx && other.getMinY() >= this._miny && other.getMaxY() <= this._maxy\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n if (this.isNull()) return false\n return x >= this._minx && x <= this._maxx && y >= this._miny && y <= this._maxy\n }\n }\n intersects() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n if (this.isNull() || other.isNull()) \n return false\n \n return !(other._minx > this._maxx || other._maxx < this._minx || other._miny > this._maxy || other._maxy < this._miny)\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return this.intersects(p.x, p.y)\n }\n } else if (arguments.length === 2) {\n if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const a = arguments[0], b = arguments[1]\n if (this.isNull()) \n return false\n \n const envminx = a.x < b.x ? a.x : b.x\n if (envminx > this._maxx) return false\n const envmaxx = a.x > b.x ? a.x : b.x\n if (envmaxx < this._minx) return false\n const envminy = a.y < b.y ? a.y : b.y\n if (envminy > this._maxy) return false\n const envmaxy = a.y > b.y ? a.y : b.y\n if (envmaxy < this._miny) return false\n return true\n } else if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const x = arguments[0], y = arguments[1]\n if (this.isNull()) return false\n return !(x > this._maxx || x < this._minx || y > this._maxy || y < this._miny)\n }\n }\n }\n getMinY() {\n return this._miny\n }\n getDiameter() {\n if (this.isNull()) \n return 0\n \n const w = this.getWidth()\n const h = this.getHeight()\n return Math.sqrt(w * w + h * h)\n }\n getMinX() {\n return this._minx\n }\n expandToInclude() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n this.expandToInclude(p.x, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n if (other.isNull()) \n return null\n \n if (this.isNull()) {\n this._minx = other.getMinX()\n this._maxx = other.getMaxX()\n this._miny = other.getMinY()\n this._maxy = other.getMaxY()\n } else {\n if (other._minx < this._minx) \n this._minx = other._minx\n \n if (other._maxx > this._maxx) \n this._maxx = other._maxx\n \n if (other._miny < this._miny) \n this._miny = other._miny\n \n if (other._maxy > this._maxy) \n this._maxy = other._maxy\n \n }\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n if (this.isNull()) {\n this._minx = x\n this._maxx = x\n this._miny = y\n this._maxy = y\n } else {\n if (x < this._minx) \n this._minx = x\n \n if (x > this._maxx) \n this._maxx = x\n \n if (y < this._miny) \n this._miny = y\n \n if (y > this._maxy) \n this._maxy = y\n \n }\n }\n }\n minExtent() {\n if (this.isNull()) return 0.0\n const w = this.getWidth()\n const h = this.getHeight()\n if (w < h) return w\n return h\n }\n getWidth() {\n if (this.isNull()) \n return 0\n \n return this._maxx - this._minx\n }\n compareTo(o) {\n const env = o\n if (this.isNull()) {\n if (env.isNull()) return 0\n return -1\n } else {\n if (env.isNull()) return 1\n }\n if (this._minx < env._minx) return -1\n if (this._minx > env._minx) return 1\n if (this._miny < env._miny) return -1\n if (this._miny > env._miny) return 1\n if (this._maxx < env._maxx) return -1\n if (this._maxx > env._maxx) return 1\n if (this._maxy < env._maxy) return -1\n if (this._maxy > env._maxy) return 1\n return 0\n }\n translate(transX, transY) {\n if (this.isNull()) \n return null\n \n this.init(this.getMinX() + transX, this.getMaxX() + transX, this.getMinY() + transY, this.getMaxY() + transY)\n }\n copy() {\n return new Envelope(this)\n }\n toString() {\n return 'Env[' + this._minx + ' : ' + this._maxx + ', ' + this._miny + ' : ' + this._maxy + ']'\n }\n setToNull() {\n this._minx = 0\n this._maxx = -1\n this._miny = 0\n this._maxy = -1\n }\n disjoint(other) {\n if (this.isNull() || other.isNull()) \n return true\n \n return other._minx > this._maxx || other._maxx < this._minx || other._miny > this._maxy || other._maxy < this._miny\n }\n getHeight() {\n if (this.isNull()) \n return 0\n \n return this._maxy - this._miny\n }\n maxExtent() {\n if (this.isNull()) return 0.0\n const w = this.getWidth()\n const h = this.getHeight()\n if (w > h) return w\n return h\n }\n expandBy() {\n if (arguments.length === 1) {\n const distance = arguments[0]\n this.expandBy(distance, distance)\n } else if (arguments.length === 2) {\n const deltaX = arguments[0], deltaY = arguments[1]\n if (this.isNull()) return null\n this._minx -= deltaX\n this._maxx += deltaX\n this._miny -= deltaY\n this._maxy += deltaY\n if (this._minx > this._maxx || this._miny > this._maxy) this.setToNull()\n }\n }\n contains() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Envelope) {\n const other = arguments[0]\n return this.covers(other)\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return this.covers(p)\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n return this.covers(x, y)\n }\n }\n centre() {\n if (this.isNull()) return null\n return new Coordinate((this.getMinX() + this.getMaxX()) / 2.0, (this.getMinY() + this.getMaxY()) / 2.0)\n }\n init() {\n if (arguments.length === 0) {\n this.setToNull()\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n this.init(p.x, p.x, p.y, p.y)\n } else if (arguments[0] instanceof Envelope) {\n const env = arguments[0]\n this._minx = env._minx\n this._maxx = env._maxx\n this._miny = env._miny\n this._maxy = env._maxy\n }\n } else if (arguments.length === 2) {\n const p1 = arguments[0], p2 = arguments[1]\n this.init(p1.x, p2.x, p1.y, p2.y)\n } else if (arguments.length === 4) {\n const x1 = arguments[0], x2 = arguments[1], y1 = arguments[2], y2 = arguments[3]\n if (x1 < x2) {\n this._minx = x1\n this._maxx = x2\n } else {\n this._minx = x2\n this._maxx = x1\n }\n if (y1 < y2) {\n this._miny = y1\n this._maxy = y2\n } else {\n this._miny = y2\n this._maxy = y1\n }\n }\n }\n getMaxY() {\n return this._maxy\n }\n distance(env) {\n if (this.intersects(env)) return 0\n let dx = 0.0\n if (this._maxx < env._minx) dx = env._minx - this._maxx; else if (this._minx > env._maxx) dx = this._minx - env._maxx\n let dy = 0.0\n if (this._maxy < env._miny) dy = env._miny - this._maxy; else if (this._miny > env._maxy) dy = this._miny - env._maxy\n if (dx === 0.0) return dy\n if (dy === 0.0) return dx\n return Math.sqrt(dx * dx + dy * dy)\n }\n hashCode() {\n let result = 17\n result = 37 * result + Coordinate.hashCode(this._minx)\n result = 37 * result + Coordinate.hashCode(this._maxx)\n result = 37 * result + Coordinate.hashCode(this._miny)\n result = 37 * result + Coordinate.hashCode(this._maxy)\n return result\n }\n get interfaces_() {\n return [Comparable, Serializable]\n }\n}\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Envelope from './Envelope.js'\nexport default class Geometry {\n constructor() {\n Geometry.constructor_.apply(this, arguments)\n }\n\n isGeometryCollection() {\n return this.getTypeCode() === Geometry.TYPECODE_GEOMETRYCOLLECTION\n }\n\n getFactory() {\n return this._factory\n }\n\n getGeometryN(n) {\n return this\n }\n\n getArea() {\n return 0.0\n }\n\n isRectangle() {\n return false\n }\n\n equalsExact(other) {\n return this === other || this.equalsExact(other, 0)\n }\n\n geometryChanged() {\n this.apply(Geometry.geometryChangedFilter)\n }\n\n geometryChangedAction() {\n this._envelope = null\n }\n\n equalsNorm(g) {\n if (g === null) return false\n return this.norm().equalsExact(g.norm())\n }\n\n getLength() {\n return 0.0\n }\n\n getNumGeometries() {\n return 1\n }\n\n compareTo() {\n let other\n if (arguments.length === 1) {\n const o = arguments[0]\n other = o\n if (this.getTypeCode() !== other.getTypeCode()) return this.getTypeCode() - other.getTypeCode()\n\n if (this.isEmpty() && other.isEmpty()) return 0\n\n if (this.isEmpty()) return -1\n\n if (other.isEmpty()) return 1\n\n return this.compareToSameClass(o)\n } else if (arguments.length === 2) {\n const o = arguments[0]; const comp = arguments[1]\n other = o\n if (this.getTypeCode() !== other.getTypeCode()) return this.getTypeCode() - other.getTypeCode()\n\n if (this.isEmpty() && other.isEmpty()) return 0\n\n if (this.isEmpty()) return -1\n\n if (other.isEmpty()) return 1\n\n return this.compareToSameClass(o, comp)\n }\n }\n\n getUserData() {\n return this._userData\n }\n\n getSRID() {\n return this._SRID\n }\n\n getEnvelope() {\n return this.getFactory().toGeometry(this.getEnvelopeInternal())\n }\n\n checkNotGeometryCollection(g) {\n if (g.getTypeCode() === Geometry.TYPECODE_GEOMETRYCOLLECTION) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n }\n\n equal(a, b, tolerance) {\n if (tolerance === 0) return a.equals(b)\n\n return a.distance(b) <= tolerance\n }\n\n norm() {\n const copy = this.copy()\n copy.normalize()\n return copy\n }\n\n reverse() {\n const res = this.reverseInternal()\n if (this.envelope != null) res.envelope = this.envelope.copy()\n\n res.setSRID(this.getSRID())\n return res\n }\n\n copy() {\n const copy = this.copyInternal()\n copy.envelope = this._envelope == null ? null : this._envelope.copy()\n copy._SRID = this._SRID\n copy._userData = this._userData\n return copy\n }\n\n getPrecisionModel() {\n return this._factory.getPrecisionModel()\n }\n\n getEnvelopeInternal() {\n if (this._envelope === null) this._envelope = this.computeEnvelopeInternal()\n\n return new Envelope(this._envelope)\n }\n\n setSRID(SRID) {\n this._SRID = SRID\n }\n\n setUserData(userData) {\n this._userData = userData\n }\n\n compare(a, b) {\n const i = a.iterator()\n const j = b.iterator()\n while (i.hasNext() && j.hasNext()) {\n const aElement = i.next()\n const bElement = j.next()\n const comparison = aElement.compareTo(bElement)\n if (comparison !== 0) return comparison\n }\n if (i.hasNext()) return 1\n\n if (j.hasNext()) return -1\n\n return 0\n }\n\n hashCode() {\n return this.getEnvelopeInternal().hashCode()\n }\n\n isEquivalentClass(other) {\n return this.getClass() === other.getClass()\n }\n\n isGeometryCollectionOrDerived() {\n if (this.getTypeCode() === Geometry.TYPECODE_GEOMETRYCOLLECTION || this.getTypeCode() === Geometry.TYPECODE_MULTIPOINT || this.getTypeCode() === Geometry.TYPECODE_MULTILINESTRING || this.getTypeCode() === Geometry.TYPECODE_MULTIPOLYGON) return true\n\n return false\n }\n\n get interfaces_() {\n return [Cloneable, Comparable, Serializable]\n }\n\n getClass() {\n return Geometry\n }\n\n static hasNonEmptyElements(geometries) {\n for (let i = 0; i < geometries.length; i++)\n if (!geometries[i].isEmpty()) return true\n\n return false\n }\n\n static hasNullElements(array) {\n for (let i = 0; i < array.length; i++)\n if (array[i] === null) return true\n\n return false\n }\n}\nGeometry.constructor_ = function(factory) {\n if (!factory) return\n this._envelope = null\n this._userData = null\n this._factory = factory\n this._SRID = factory.getSRID()\n}\nGeometry.TYPECODE_POINT = 0\nGeometry.TYPECODE_MULTIPOINT = 1\nGeometry.TYPECODE_LINESTRING = 2\nGeometry.TYPECODE_LINEARRING = 3\nGeometry.TYPECODE_MULTILINESTRING = 4\nGeometry.TYPECODE_POLYGON = 5\nGeometry.TYPECODE_MULTIPOLYGON = 6\nGeometry.TYPECODE_GEOMETRYCOLLECTION = 7\nGeometry.TYPENAME_POINT = 'Point'\nGeometry.TYPENAME_MULTIPOINT = 'MultiPoint'\nGeometry.TYPENAME_LINESTRING = 'LineString'\nGeometry.TYPENAME_LINEARRING = 'LinearRing'\nGeometry.TYPENAME_MULTILINESTRING = 'MultiLineString'\nGeometry.TYPENAME_POLYGON = 'Polygon'\nGeometry.TYPENAME_MULTIPOLYGON = 'MultiPolygon'\nGeometry.TYPENAME_GEOMETRYCOLLECTION = 'GeometryCollection'\nGeometry.geometryChangedFilter = {\n get interfaces_() {\n return [GeometryComponentFilter]\n },\n filter(geom) {\n geom.geometryChangedAction()\n }\n}\n","export default class CoordinateFilter {\n filter(coord) {}\n}\n","export default class Lineal {}\n","import hasInterface from '../../../../hasInterface.js'\nimport Coordinate from './Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport CoordinateSequence from './CoordinateSequence.js'\nexport default class CoordinateSequences {\n static copyCoord(src, srcPos, dest, destPos) {\n const minDim = Math.min(src.getDimension(), dest.getDimension())\n for (let dim = 0; dim < minDim; dim++) \n dest.setOrdinate(destPos, dim, src.getOrdinate(srcPos, dim))\n \n }\n static isRing(seq) {\n const n = seq.size()\n if (n === 0) return true\n if (n <= 3) return false\n return seq.getOrdinate(0, CoordinateSequence.X) === seq.getOrdinate(n - 1, CoordinateSequence.X) && seq.getOrdinate(0, CoordinateSequence.Y) === seq.getOrdinate(n - 1, CoordinateSequence.Y)\n }\n static scroll() {\n if (arguments.length === 2) {\n if (hasInterface(arguments[0], CoordinateSequence) && Number.isInteger(arguments[1])) {\n const seq = arguments[0], indexOfFirstCoordinate = arguments[1]\n CoordinateSequences.scroll(seq, indexOfFirstCoordinate, CoordinateSequences.isRing(seq))\n } else if (hasInterface(arguments[0], CoordinateSequence) && arguments[1] instanceof Coordinate) {\n const seq = arguments[0], firstCoordinate = arguments[1]\n const i = CoordinateSequences.indexOf(firstCoordinate, seq)\n if (i <= 0) return null\n CoordinateSequences.scroll(seq, i)\n }\n } else if (arguments.length === 3) {\n const seq = arguments[0], indexOfFirstCoordinate = arguments[1], ensureRing = arguments[2]\n const i = indexOfFirstCoordinate\n if (i <= 0) return null\n const copy = seq.copy()\n const last = ensureRing ? seq.size() - 1 : seq.size()\n for (let j = 0; j < last; j++) \n for (let k = 0; k < seq.getDimension(); k++) seq.setOrdinate(j, k, copy.getOrdinate((indexOfFirstCoordinate + j) % last, k))\n \n if (ensureRing) \n for (let k = 0; k < seq.getDimension(); k++) seq.setOrdinate(last, k, seq.getOrdinate(0, k))\n \n }\n }\n static isEqual(cs1, cs2) {\n const cs1Size = cs1.size()\n const cs2Size = cs2.size()\n if (cs1Size !== cs2Size) return false\n const dim = Math.min(cs1.getDimension(), cs2.getDimension())\n for (let i = 0; i < cs1Size; i++) \n for (let d = 0; d < dim; d++) {\n const v1 = cs1.getOrdinate(i, d)\n const v2 = cs2.getOrdinate(i, d)\n if (cs1.getOrdinate(i, d) === cs2.getOrdinate(i, d)) continue\n if (Double.isNaN(v1) && Double.isNaN(v2)) continue\n return false\n }\n \n return true\n }\n static minCoordinateIndex() {\n if (arguments.length === 1) {\n const seq = arguments[0]\n return CoordinateSequences.minCoordinateIndex(seq, 0, seq.size() - 1)\n } else if (arguments.length === 3) {\n const seq = arguments[0], from = arguments[1], to = arguments[2]\n let minCoordIndex = -1\n let minCoord = null\n for (let i = from; i <= to; i++) {\n const testCoord = seq.getCoordinate(i)\n if (minCoord === null || minCoord.compareTo(testCoord) > 0) {\n minCoord = testCoord\n minCoordIndex = i\n }\n }\n return minCoordIndex\n }\n }\n static extend(fact, seq, size) {\n const newseq = fact.create(size, seq.getDimension())\n const n = seq.size()\n CoordinateSequences.copy(seq, 0, newseq, 0, n)\n if (n > 0) \n for (let i = n; i < size; i++) CoordinateSequences.copy(seq, n - 1, newseq, i, 1)\n \n return newseq\n }\n static reverse(seq) {\n const last = seq.size() - 1\n const mid = Math.trunc(last / 2)\n for (let i = 0; i <= mid; i++) \n CoordinateSequences.swap(seq, i, last - i)\n \n }\n static swap(seq, i, j) {\n if (i === j) return null\n for (let dim = 0; dim < seq.getDimension(); dim++) {\n const tmp = seq.getOrdinate(i, dim)\n seq.setOrdinate(i, dim, seq.getOrdinate(j, dim))\n seq.setOrdinate(j, dim, tmp)\n }\n }\n static copy(src, srcPos, dest, destPos, length) {\n for (let i = 0; i < length; i++) \n CoordinateSequences.copyCoord(src, srcPos + i, dest, destPos + i)\n \n }\n static ensureValidRing(fact, seq) {\n const n = seq.size()\n if (n === 0) return seq\n if (n <= 3) return CoordinateSequences.createClosedRing(fact, seq, 4)\n const isClosed = seq.getOrdinate(0, CoordinateSequence.X) === seq.getOrdinate(n - 1, CoordinateSequence.X) && seq.getOrdinate(0, CoordinateSequence.Y) === seq.getOrdinate(n - 1, CoordinateSequence.Y)\n if (isClosed) return seq\n return CoordinateSequences.createClosedRing(fact, seq, n + 1)\n }\n static indexOf(coordinate, seq) {\n for (let i = 0; i < seq.size(); i++) \n if (coordinate.x === seq.getOrdinate(i, CoordinateSequence.X) && coordinate.y === seq.getOrdinate(i, CoordinateSequence.Y)) \n return i\n \n \n return -1\n }\n static createClosedRing(fact, seq, size) {\n const newseq = fact.create(size, seq.getDimension())\n const n = seq.size()\n CoordinateSequences.copy(seq, 0, newseq, 0, n)\n for (let i = n; i < size; i++) CoordinateSequences.copy(seq, 0, newseq, i, 1)\n return newseq\n }\n static minCoordinate(seq) {\n let minCoord = null\n for (let i = 0; i < seq.size(); i++) {\n const testCoord = seq.getCoordinate(i)\n if (minCoord === null || minCoord.compareTo(testCoord) > 0) \n minCoord = testCoord\n \n }\n return minCoord\n }\n}\n","import Exception from './Exception.js'\n\nexport default class UnsupportedOperationException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ UnsupportedOperationException })[0]\n }\n}\n","export default class Character {\n static isWhitespace(c) {\n return ((c <= 32 && c >= 0) || c === 127)\n }\n\n static toUpperCase(c) {\n return c.toUpperCase()\n }\n}\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Character from '../../../../java/lang/Character.js'\nexport default class Dimension {\n static toDimensionSymbol(dimensionValue) {\n switch (dimensionValue) {\n case Dimension.FALSE:\n return Dimension.SYM_FALSE\n case Dimension.TRUE:\n return Dimension.SYM_TRUE\n case Dimension.DONTCARE:\n return Dimension.SYM_DONTCARE\n case Dimension.P:\n return Dimension.SYM_P\n case Dimension.L:\n return Dimension.SYM_L\n case Dimension.A:\n return Dimension.SYM_A\n }\n throw new IllegalArgumentException('Unknown dimension value: ' + dimensionValue)\n }\n static toDimensionValue(dimensionSymbol) {\n switch (Character.toUpperCase(dimensionSymbol)) {\n case Dimension.SYM_FALSE:\n return Dimension.FALSE\n case Dimension.SYM_TRUE:\n return Dimension.TRUE\n case Dimension.SYM_DONTCARE:\n return Dimension.DONTCARE\n case Dimension.SYM_P:\n return Dimension.P\n case Dimension.SYM_L:\n return Dimension.L\n case Dimension.SYM_A:\n return Dimension.A\n }\n throw new IllegalArgumentException('Unknown dimension symbol: ' + dimensionSymbol)\n }\n}\nDimension.P = 0\nDimension.L = 1\nDimension.A = 2\nDimension.FALSE = -1\nDimension.TRUE = -2\nDimension.DONTCARE = -3\nDimension.SYM_FALSE = 'F'\nDimension.SYM_TRUE = 'T'\nDimension.SYM_DONTCARE = '*'\nDimension.SYM_P = '0'\nDimension.SYM_L = '1'\nDimension.SYM_A = '2'\n","export default class GeometryFilter {\n filter(geom) {}\n}\n","export default class CoordinateSequenceFilter {\n filter(seq, i) {}\n isDone() {}\n isGeometryChanged() {}\n}\n","import Geometry from './Geometry.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Length from '../algorithm/Length.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Lineal from './Lineal.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport Dimension from './Dimension.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nimport Envelope from './Envelope.js'\nexport default class LineString extends Geometry {\n constructor() {\n super()\n LineString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._points = null\n if (arguments.length === 0) {} else if (arguments.length === 2) {\n const points = arguments[0], factory = arguments[1]\n Geometry.constructor_.call(this, factory)\n this.init(points)\n }\n }\n computeEnvelopeInternal() {\n if (this.isEmpty()) \n return new Envelope()\n \n return this._points.expandEnvelope(new Envelope())\n }\n isRing() {\n return this.isClosed() && this.isSimple()\n }\n getCoordinates() {\n return this._points.toCoordinateArray()\n }\n copyInternal() {\n return new LineString(this._points.copy(), this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n const otherLineString = other\n if (this._points.size() !== otherLineString._points.size()) \n return false\n \n for (let i = 0; i < this._points.size(); i++) \n if (!this.equal(this._points.getCoordinate(i), otherLineString._points.getCoordinate(i), tolerance)) \n return false\n \n \n return true\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {\n for (let i = 0; i < Math.trunc(this._points.size() / 2); i++) {\n const j = this._points.size() - 1 - i\n if (!this._points.getCoordinate(i).equals(this._points.getCoordinate(j))) {\n if (this._points.getCoordinate(i).compareTo(this._points.getCoordinate(j)) > 0) {\n const copy = this._points.copy()\n CoordinateSequences.reverse(copy)\n this._points = copy\n }\n return null\n }\n }\n }\n getCoordinate() {\n if (this.isEmpty()) return null\n return this._points.getCoordinate(0)\n }\n getBoundaryDimension() {\n if (this.isClosed()) \n return Dimension.FALSE\n \n return 0\n }\n isClosed() {\n if (this.isEmpty()) \n return false\n \n return this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints() - 1))\n }\n reverseInternal() {\n const seq = this._points.copy()\n CoordinateSequences.reverse(seq)\n return this.getFactory().createLineString(seq)\n }\n getEndPoint() {\n if (this.isEmpty()) \n return null\n \n return this.getPointN(this.getNumPoints() - 1)\n }\n getTypeCode() {\n return Geometry.TYPECODE_LINESTRING\n }\n getDimension() {\n return 1\n }\n getLength() {\n return Length.ofLine(this._points)\n }\n getNumPoints() {\n return this._points.size()\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const o = arguments[0]\n const line = o\n let i = 0\n let j = 0\n while (i < this._points.size() && j < line._points.size()) {\n const comparison = this._points.getCoordinate(i).compareTo(line._points.getCoordinate(j))\n if (comparison !== 0) \n return comparison\n \n i++\n j++\n }\n if (i < this._points.size()) \n return 1\n \n if (j < line._points.size()) \n return -1\n \n return 0\n } else if (arguments.length === 2) {\n const o = arguments[0], comp = arguments[1]\n const line = o\n return comp.compare(this._points, line._points)\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n for (let i = 0; i < this._points.size(); i++) \n filter.filter(this._points.getCoordinate(i))\n \n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n if (this._points.size() === 0) return null\n for (let i = 0; i < this._points.size(); i++) {\n filter.filter(this._points, i)\n if (filter.isDone()) break\n }\n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n }\n }\n getBoundary() {\n throw new UnsupportedOperationException()\n }\n isEquivalentClass(other) {\n return other instanceof LineString\n }\n getCoordinateN(n) {\n return this._points.getCoordinate(n)\n }\n getGeometryType() {\n return Geometry.TYPENAME_LINESTRING\n }\n getCoordinateSequence() {\n return this._points\n }\n isEmpty() {\n return this._points.size() === 0\n }\n init(points) {\n if (points === null) \n points = this.getFactory().getCoordinateSequenceFactory().create([])\n \n if (points.size() === 1) \n throw new IllegalArgumentException('Invalid number of points in LineString (found ' + points.size() + ' - must be 0 or >= 2)')\n \n this._points = points\n }\n isCoordinate(pt) {\n for (let i = 0; i < this._points.size(); i++) \n if (this._points.getCoordinate(i).equals(pt)) \n return true\n \n \n return false\n }\n getStartPoint() {\n if (this.isEmpty()) \n return null\n \n return this.getPointN(0)\n }\n getPointN(n) {\n return this.getFactory().createPoint(this._points.getCoordinate(n))\n }\n get interfaces_() {\n return [Lineal]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nexport default class Length {\n static ofLine(pts) {\n const n = pts.size()\n if (n <= 1) return 0.0\n let len = 0.0\n const p = new Coordinate()\n pts.getCoordinate(0, p)\n let x0 = p.x\n let y0 = p.y\n for (let i = 1; i < n; i++) {\n pts.getCoordinate(i, p)\n const x1 = p.x\n const y1 = p.y\n const dx = x1 - x0\n const dy = y1 - y0\n len += Math.sqrt(dx * dx + dy * dy)\n x0 = x1\n y0 = y1\n }\n return len\n }\n}\n","export default class Puntal {}\n","import Geometry from './Geometry.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Dimension from './Dimension.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nimport Puntal from './Puntal.js'\nimport Envelope from './Envelope.js'\nimport Assert from '../util/Assert.js'\nexport default class Point extends Geometry {\n constructor() {\n super()\n Point.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._coordinates = null\n const coordinates = arguments[0], factory = arguments[1]\n Geometry.constructor_.call(this, factory)\n this.init(coordinates)\n }\n computeEnvelopeInternal() {\n if (this.isEmpty()) \n return new Envelope()\n \n const env = new Envelope()\n env.expandToInclude(this._coordinates.getX(0), this._coordinates.getY(0))\n return env\n }\n getCoordinates() {\n return this.isEmpty() ? [] : [this.getCoordinate()]\n }\n copyInternal() {\n return new Point(this._coordinates.copy(), this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n if (this.isEmpty() && other.isEmpty()) \n return true\n \n if (this.isEmpty() !== other.isEmpty()) \n return false\n \n return this.equal(other.getCoordinate(), this.getCoordinate(), tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {}\n getCoordinate() {\n return this._coordinates.size() !== 0 ? this._coordinates.getCoordinate(0) : null\n }\n getBoundaryDimension() {\n return Dimension.FALSE\n }\n reverseInternal() {\n return this.getFactory().createPoint(this._coordinates.copy())\n }\n getTypeCode() {\n return Geometry.TYPECODE_POINT\n }\n getDimension() {\n return 0\n }\n getNumPoints() {\n return this.isEmpty() ? 0 : 1\n }\n getX() {\n if (this.getCoordinate() === null) \n throw new IllegalStateException('getX called on empty Point')\n \n return this.getCoordinate().x\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const other = arguments[0]\n const point = other\n return this.getCoordinate().compareTo(point.getCoordinate())\n } else if (arguments.length === 2) {\n const other = arguments[0], comp = arguments[1]\n const point = other\n return comp.compare(this._coordinates, point._coordinates)\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n if (this.isEmpty()) \n return null\n \n filter.filter(this.getCoordinate())\n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n if (this.isEmpty()) return null\n filter.filter(this._coordinates, 0)\n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n }\n }\n getBoundary() {\n return this.getFactory().createGeometryCollection()\n }\n getGeometryType() {\n return Geometry.TYPENAME_POINT\n }\n getCoordinateSequence() {\n return this._coordinates\n }\n getY() {\n if (this.getCoordinate() === null) \n throw new IllegalStateException('getY called on empty Point')\n \n return this.getCoordinate().y\n }\n isEmpty() {\n return this._coordinates.size() === 0\n }\n init(coordinates) {\n if (coordinates === null) \n coordinates = this.getFactory().getCoordinateSequenceFactory().create([])\n \n Assert.isTrue(coordinates.size() <= 1)\n this._coordinates = coordinates\n }\n isSimple() {\n return true\n }\n get interfaces_() {\n return [Puntal]\n }\n}\n","import hasInterface from '../../../../hasInterface.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nexport default class Area {\n static ofRing() {\n if (arguments[0] instanceof Array) {\n const ring = arguments[0]\n return Math.abs(Area.ofRingSigned(ring))\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const ring = arguments[0]\n return Math.abs(Area.ofRingSigned(ring))\n }\n }\n static ofRingSigned() {\n if (arguments[0] instanceof Array) {\n const ring = arguments[0]\n if (ring.length < 3) return 0.0\n let sum = 0.0\n const x0 = ring[0].x\n for (let i = 1; i < ring.length - 1; i++) {\n const x = ring[i].x - x0\n const y1 = ring[i + 1].y\n const y2 = ring[i - 1].y\n sum += x * (y2 - y1)\n }\n return sum / 2.0\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const ring = arguments[0]\n const n = ring.size()\n if (n < 3) return 0.0\n const p0 = new Coordinate()\n const p1 = new Coordinate()\n const p2 = new Coordinate()\n ring.getCoordinate(0, p1)\n ring.getCoordinate(1, p2)\n const x0 = p1.x\n p2.x -= x0\n let sum = 0.0\n for (let i = 1; i < n - 1; i++) {\n p0.y = p1.y\n p1.x = p2.x\n p1.y = p2.y\n ring.getCoordinate(i + 1, p2)\n p2.x -= x0\n sum += p1.x * (p0.y - p2.y)\n }\n return sum / 2.0\n }\n }\n}\n","/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Collection.html\n */\nexport default class Collection {\n /**\n * Ensures that this collection contains the specified element (optional\n * operation).\n * @param {Object} e\n * @return {boolean}\n */\n add() { }\n /**\n * Appends all of the elements in the specified collection to the end of this\n * list, in the order that they are returned by the specified collection's\n * iterator (optional operation).\n * @param {javascript.util.Collection} c\n * @return {boolean}\n */\n addAll() { }\n /**\n * Returns true if this collection contains no elements.\n * @return {boolean}\n */\n isEmpty() { }\n /**\n * Returns an iterator over the elements in this collection.\n * @return {javascript.util.Iterator}\n */\n iterator() { }\n /**\n * Returns an iterator over the elements in this collection.\n * @return {number}\n */\n size() { }\n /**\n * Returns an array containing all of the elements in this collection.\n * @return {Array}\n */\n toArray() { }\n /**\n * Removes a single instance of the specified element from this collection if it\n * is present. (optional)\n * @param {Object} e\n * @return {boolean}\n */\n remove() { }\n}\n","import Exception from './Exception.js'\n\nexport default class IndexOutOfBoundsException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ IndexOutOfBoundsException })[0]\n } \n}","import Collection from './Collection.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/List.html\n */\nexport default class List extends Collection {\n /**\n * Returns the element at the specified position in this list.\n * @param {number} index\n * @return {Object}\n */\n get() { }\n /**\n * Replaces the element at the specified position in this list with the\n * specified element (optional operation).\n * @param {number} index\n * @param {Object} e\n * @return {Object}\n */\n set() { }\n /**\n * Returns true if this collection contains no elements.\n * @return {boolean}\n */\n isEmpty() { }\n}\n","import Exception from '../lang/Exception.js'\n\nexport default class NoSuchElementException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ NoSuchElementException })[0]\n }\n}","import Collection from './Collection.js'\nimport IndexOutOfBoundsException from '../lang/IndexOutOfBoundsException.js'\nimport List from './List.js'\nimport NoSuchElementException from './NoSuchElementException.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html\n */\nexport default class ArrayList extends List {\n\n constructor(o) {\n super()\n this.array = []\n if (o instanceof Collection) this.addAll(o)\n }\n\n get interfaces_() {\n return [List, Collection]\n }\n\n ensureCapacity() { }\n\n add(e) {\n if (arguments.length === 1)\n this.array.push(e)\n else\n this.array.splice(arguments[0], 0, arguments[1])\n return true\n }\n\n clear() {\n this.array = []\n }\n\n addAll(c) {\n for (const e of c)\n this.array.push(e)\n }\n\n set(index, element) {\n const oldElement = this.array[index]\n this.array[index] = element\n return oldElement\n }\n\n iterator() {\n return new Iterator(this)\n }\n\n get(index) {\n if (index < 0 || index >= this.size())\n throw new IndexOutOfBoundsException()\n return this.array[index]\n }\n\n isEmpty() {\n return this.array.length === 0\n }\n\n sort(comparator) {\n if (comparator)\n this.array.sort((a, b) => comparator.compare(a, b))\n else this.array.sort()\n }\n\n size() {\n return this.array.length\n }\n\n toArray() {\n return this.array.slice()\n }\n\n remove(o) {\n for (let i = 0, len = this.array.length; i < len; i++)\n if (this.array[i] === o)\n return !!this.array.splice(i, 1)\n return false\n }\n\n [Symbol.iterator]() {\n return this.array.values()\n }\n}\n\nclass Iterator {\n constructor(arrayList) {\n this.arrayList = arrayList\n this.position = 0\n }\n\n next() {\n if (this.position === this.arrayList.size())\n throw new NoSuchElementException()\n return this.arrayList.get(this.position++)\n }\n\n hasNext() {\n return this.position < this.arrayList.size()\n }\n\n set(element) {\n return this.arrayList.set(this.position - 1, element)\n }\n\n remove() {\n this.arrayList.remove(this.arrayList.get(this.position))\n }\n}\n","import ArrayList from './ArrayList.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Arrays.html\n */\nexport default class Arrays {\n static sort() {\n const a = arguments[0]\n if (arguments.length === 1) {\n a.sort((a, b) => a.compareTo(b))\n } else if (arguments.length === 2) {\n a.sort((a, b) => arguments[1].compare(a, b))\n } else if (arguments.length === 3) {\n const t = a.slice(arguments[1], arguments[2])\n t.sort()\n const r = a.slice(0, arguments[1]).concat(t, a.slice(arguments[2], a.length))\n a.splice(0, a.length)\n for (const e of r)\n a.push(e)\n } else if (arguments.length === 4) {\n const t = a.slice(arguments[1], arguments[2])\n t.sort((a, b) => arguments[3].compare(a, b))\n const r = a.slice(0, arguments[1]).concat(t, a.slice(arguments[2], a.length))\n a.splice(0, a.length)\n for (const e of r)\n a.push(e)\n }\n }\n\n /**\n * @param {Array} array\n * @return {ArrayList}\n */\n static asList(array) {\n const arrayList = new ArrayList()\n for (const e of array)\n arrayList.add(e)\n return arrayList\n }\n\n static copyOf(original, newLength) {\n return original.slice(0, newLength)\n }\n}\n","export default class StringBuffer {\n constructor(str) {\n this.str = str\n }\n append(e) {\n this.str += e\n }\n setCharAt(i, c) {\n this.str = this.str.substr(0, i) + c + this.str.substr(i + 1)\n }\n toString() {\n return this.str\n }\n}","export default class Integer {\n constructor(value) {\n this.value = value\n }\n\n intValue() {\n return this.value\n }\n\n compareTo(o) {\n if (this.value < o)\n return -1\n if (this.value > o)\n return 1\n return 0\n }\n\n static compare(x, y) {\n if (x < y)\n return -1\n if (x > y)\n return 1\n return 0\n }\n\n static isNan(n) {\n return Number.isNaN(n)\n }\n\n static valueOf(value) {\n return new Integer(value)\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Integer from '../../../../java/lang/Integer.js'\nimport Character from '../../../../java/lang/Character.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nexport default class DD {\n constructor() {\n DD.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hi = 0.0\n this._lo = 0.0\n if (arguments.length === 0) {\n this.init(0.0)\n } else if (arguments.length === 1) {\n if (typeof arguments[0] === 'number') {\n const x = arguments[0]\n this.init(x)\n } else if (arguments[0] instanceof DD) {\n const dd = arguments[0]\n this.init(dd)\n } else if (typeof arguments[0] === 'string') {\n const str = arguments[0]\n DD.constructor_.call(this, DD.parse(str))\n }\n } else if (arguments.length === 2) {\n const hi = arguments[0], lo = arguments[1]\n this.init(hi, lo)\n }\n }\n static determinant() {\n if (typeof arguments[3] === 'number' && (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number'))) {\n const x1 = arguments[0], y1 = arguments[1], x2 = arguments[2], y2 = arguments[3]\n return DD.determinant(DD.valueOf(x1), DD.valueOf(y1), DD.valueOf(x2), DD.valueOf(y2))\n } else if (arguments[3] instanceof DD && (arguments[2] instanceof DD && (arguments[0] instanceof DD && arguments[1] instanceof DD))) {\n const x1 = arguments[0], y1 = arguments[1], x2 = arguments[2], y2 = arguments[3]\n const det = x1.multiply(y2).selfSubtract(y1.multiply(x2))\n return det\n }\n }\n static sqr(x) {\n return DD.valueOf(x).selfMultiply(x)\n }\n static valueOf() {\n if (typeof arguments[0] === 'string') {\n const str = arguments[0]\n return DD.parse(str)\n } else if (typeof arguments[0] === 'number') {\n const x = arguments[0]\n return new DD(x)\n }\n }\n static sqrt(x) {\n return DD.valueOf(x).sqrt()\n }\n static parse(str) {\n let i = 0\n const strlen = str.length\n while (Character.isWhitespace(str.charAt(i))) i++\n let isNegative = false\n if (i < strlen) {\n const signCh = str.charAt(i)\n if (signCh === '-' || signCh === '+') {\n i++\n if (signCh === '-') isNegative = true\n }\n }\n const val = new DD()\n let numDigits = 0\n let numBeforeDec = 0\n let exp = 0\n let hasDecimalChar = false\n while (true) {\n if (i >= strlen) break\n const ch = str.charAt(i)\n i++\n if (Character.isDigit(ch)) {\n const d = ch - '0'\n val.selfMultiply(DD.TEN)\n val.selfAdd(d)\n numDigits++\n continue\n }\n if (ch === '.') {\n numBeforeDec = numDigits\n hasDecimalChar = true\n continue\n }\n if (ch === 'e' || ch === 'E') {\n const expStr = str.substring(i)\n try {\n exp = Integer.parseInt(expStr)\n } catch (ex) {\n if (ex instanceof NumberFormatException) \n throw new NumberFormatException('Invalid exponent ' + expStr + ' in string ' + str)\n else throw ex\n } finally {}\n break\n }\n throw new NumberFormatException('Unexpected character \\'' + ch + '\\' at position ' + i + ' in string ' + str)\n }\n let val2 = val\n if (!hasDecimalChar) numBeforeDec = numDigits\n const numDecPlaces = numDigits - numBeforeDec - exp\n if (numDecPlaces === 0) {\n val2 = val\n } else if (numDecPlaces > 0) {\n const scale = DD.TEN.pow(numDecPlaces)\n val2 = val.divide(scale)\n } else if (numDecPlaces < 0) {\n const scale = DD.TEN.pow(-numDecPlaces)\n val2 = val.multiply(scale)\n }\n if (isNegative) \n return val2.negate()\n \n return val2\n }\n static createNaN() {\n return new DD(Double.NaN, Double.NaN)\n }\n static copy(dd) {\n return new DD(dd)\n }\n static magnitude(x) {\n const xAbs = Math.abs(x)\n const xLog10 = Math.log(xAbs) / Math.log(10)\n let xMag = Math.trunc(Math.floor(xLog10))\n const xApprox = Math.pow(10, xMag)\n if (xApprox * 10 <= xAbs) xMag += 1\n return xMag\n }\n static stringOfChar(ch, len) {\n const buf = new StringBuffer()\n for (let i = 0; i < len; i++) \n buf.append(ch)\n \n return buf.toString()\n }\n le(y) {\n return this._hi < y._hi || this._hi === y._hi && this._lo <= y._lo\n }\n extractSignificantDigits(insertDecimalPoint, magnitude) {\n let y = this.abs()\n let mag = DD.magnitude(y._hi)\n const scale = DD.TEN.pow(mag)\n y = y.divide(scale)\n if (y.gt(DD.TEN)) {\n y = y.divide(DD.TEN)\n mag += 1\n } else if (y.lt(DD.ONE)) {\n y = y.multiply(DD.TEN)\n mag -= 1\n }\n const decimalPointPos = mag + 1\n const buf = new StringBuffer()\n const numDigits = DD.MAX_PRINT_DIGITS - 1\n for (let i = 0; i <= numDigits; i++) {\n if (insertDecimalPoint && i === decimalPointPos) \n buf.append('.')\n \n const digit = Math.trunc(y._hi)\n if (digit < 0 || digit > 9) {}\n if (digit < 0) \n break\n \n let rebiasBy10 = false\n let digitChar = 0\n if (digit > 9) {\n rebiasBy10 = true\n digitChar = '9'\n } else {\n digitChar = '0' + digit\n }\n buf.append(digitChar)\n y = y.subtract(DD.valueOf(digit)).multiply(DD.TEN)\n if (rebiasBy10) y.selfAdd(DD.TEN)\n let continueExtractingDigits = true\n const remMag = DD.magnitude(y._hi)\n if (remMag < 0 && Math.abs(remMag) >= numDigits - i) continueExtractingDigits = false\n if (!continueExtractingDigits) break\n }\n magnitude[0] = mag\n return buf.toString()\n }\n sqr() {\n return this.multiply(this)\n }\n doubleValue() {\n return this._hi + this._lo\n }\n subtract() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.add(y.negate())\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return this.add(-y)\n }\n }\n equals() {\n if (arguments.length === 1 && arguments[0] instanceof DD) {\n const y = arguments[0]\n return this._hi === y._hi && this._lo === y._lo\n }\n }\n isZero() {\n return this._hi === 0.0 && this._lo === 0.0\n }\n selfSubtract() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n if (this.isNaN()) return this\n return this.selfAdd(-y._hi, -y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n if (this.isNaN()) return this\n return this.selfAdd(-y, 0.0)\n }\n }\n getSpecialNumberString() {\n if (this.isZero()) return '0.0'\n if (this.isNaN()) return 'NaN '\n return null\n }\n min(x) {\n if (this.le(x)) \n return this\n else \n return x\n \n }\n selfDivide() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.selfDivide(y._hi, y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return this.selfDivide(y, 0.0)\n }\n } else if (arguments.length === 2) {\n const yhi = arguments[0], ylo = arguments[1]\n let hc = null, tc = null, hy = null, ty = null, C = null, c = null, U = null, u = null\n C = this._hi / yhi\n c = DD.SPLIT * C\n hc = c - C\n u = DD.SPLIT * yhi\n hc = c - hc\n tc = C - hc\n hy = u - yhi\n U = C * yhi\n hy = u - hy\n ty = yhi - hy\n u = hc * hy - U + hc * ty + tc * hy + tc * ty\n c = (this._hi - U - u + this._lo - C * ylo) / yhi\n u = C + c\n this._hi = u\n this._lo = C - u + c\n return this\n }\n }\n dump() {\n return 'DD<' + this._hi + ', ' + this._lo + '>'\n }\n divide() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n let hc = null, tc = null, hy = null, ty = null, C = null, c = null, U = null, u = null\n C = this._hi / y._hi\n c = DD.SPLIT * C\n hc = c - C\n u = DD.SPLIT * y._hi\n hc = c - hc\n tc = C - hc\n hy = u - y._hi\n U = C * y._hi\n hy = u - hy\n ty = y._hi - hy\n u = hc * hy - U + hc * ty + tc * hy + tc * ty\n c = (this._hi - U - u + this._lo - C * y._lo) / y._hi\n u = C + c\n const zhi = u\n const zlo = C - u + c\n return new DD(zhi, zlo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n if (Double.isNaN(y)) return DD.createNaN()\n return DD.copy(this).selfDivide(y, 0.0)\n }\n }\n ge(y) {\n return this._hi > y._hi || this._hi === y._hi && this._lo >= y._lo\n }\n pow(exp) {\n if (exp === 0.0) return DD.valueOf(1.0)\n let r = new DD(this)\n let s = DD.valueOf(1.0)\n let n = Math.abs(exp)\n if (n > 1) \n while (n > 0) {\n if (n % 2 === 1) \n s.selfMultiply(r)\n \n n /= 2\n if (n > 0) r = r.sqr()\n }\n else \n s = r\n \n if (exp < 0) return s.reciprocal()\n return s\n }\n ceil() {\n if (this.isNaN()) return DD.NaN\n const fhi = Math.ceil(this._hi)\n let flo = 0.0\n if (fhi === this._hi) \n flo = Math.ceil(this._lo)\n \n return new DD(fhi, flo)\n }\n compareTo(o) {\n const other = o\n if (this._hi < other._hi) return -1\n if (this._hi > other._hi) return 1\n if (this._lo < other._lo) return -1\n if (this._lo > other._lo) return 1\n return 0\n }\n rint() {\n if (this.isNaN()) return this\n const plus5 = this.add(0.5)\n return plus5.floor()\n }\n setValue() {\n if (arguments[0] instanceof DD) {\n const value = arguments[0]\n this.init(value)\n return this\n } else if (typeof arguments[0] === 'number') {\n const value = arguments[0]\n this.init(value)\n return this\n }\n }\n max(x) {\n if (this.ge(x)) \n return this\n else \n return x\n \n }\n sqrt() {\n if (this.isZero()) return DD.valueOf(0.0)\n if (this.isNegative()) \n return DD.NaN\n \n const x = 1.0 / Math.sqrt(this._hi)\n const ax = this._hi * x\n const axdd = DD.valueOf(ax)\n const diffSq = this.subtract(axdd.sqr())\n const d2 = diffSq._hi * (x * 0.5)\n return axdd.add(d2)\n }\n selfAdd() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.selfAdd(y._hi, y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n let H = null, h = null, S = null, s = null, e = null, f = null\n S = this._hi + y\n e = S - this._hi\n s = S - e\n s = y - e + (this._hi - s)\n f = s + this._lo\n H = S + f\n h = f + (S - H)\n this._hi = H + h\n this._lo = h + (H - this._hi)\n return this\n }\n } else if (arguments.length === 2) {\n const yhi = arguments[0], ylo = arguments[1]\n let H = null, h = null, T = null, t = null, S = null, s = null, e = null, f = null\n S = this._hi + yhi\n T = this._lo + ylo\n e = S - this._hi\n f = T - this._lo\n s = S - e\n t = T - f\n s = yhi - e + (this._hi - s)\n t = ylo - f + (this._lo - t)\n e = s + T\n H = S + e\n h = e + (S - H)\n e = t + h\n const zhi = H + e\n const zlo = e + (H - zhi)\n this._hi = zhi\n this._lo = zlo\n return this\n }\n }\n selfMultiply() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return this.selfMultiply(y._hi, y._lo)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return this.selfMultiply(y, 0.0)\n }\n } else if (arguments.length === 2) {\n const yhi = arguments[0], ylo = arguments[1]\n let hx = null, tx = null, hy = null, ty = null, C = null, c = null\n C = DD.SPLIT * this._hi\n hx = C - this._hi\n c = DD.SPLIT * yhi\n hx = C - hx\n tx = this._hi - hx\n hy = c - yhi\n C = this._hi * yhi\n hy = c - hy\n ty = yhi - hy\n c = hx * hy - C + hx * ty + tx * hy + tx * ty + (this._hi * ylo + this._lo * yhi)\n const zhi = C + c\n hx = C - zhi\n const zlo = c + hx\n this._hi = zhi\n this._lo = zlo\n return this\n }\n }\n selfSqr() {\n return this.selfMultiply(this)\n }\n floor() {\n if (this.isNaN()) return DD.NaN\n const fhi = Math.floor(this._hi)\n let flo = 0.0\n if (fhi === this._hi) \n flo = Math.floor(this._lo)\n \n return new DD(fhi, flo)\n }\n negate() {\n if (this.isNaN()) return this\n return new DD(-this._hi, -this._lo)\n }\n clone() {\n try {\n return null\n } catch (ex) {\n if (ex instanceof CloneNotSupportedException) \n return null\n else throw ex\n } finally {}\n }\n multiply() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n if (y.isNaN()) return DD.createNaN()\n return DD.copy(this).selfMultiply(y)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n if (Double.isNaN(y)) return DD.createNaN()\n return DD.copy(this).selfMultiply(y, 0.0)\n }\n }\n isNaN() {\n return Double.isNaN(this._hi)\n }\n intValue() {\n return Math.trunc(this._hi)\n }\n toString() {\n const mag = DD.magnitude(this._hi)\n if (mag >= -3 && mag <= 20) return this.toStandardNotation()\n return this.toSciNotation()\n }\n toStandardNotation() {\n const specialStr = this.getSpecialNumberString()\n if (specialStr !== null) return specialStr\n const magnitude = new Array(1).fill(null)\n const sigDigits = this.extractSignificantDigits(true, magnitude)\n const decimalPointPos = magnitude[0] + 1\n let num = sigDigits\n if (sigDigits.charAt(0) === '.') {\n num = '0' + sigDigits\n } else if (decimalPointPos < 0) {\n num = '0.' + DD.stringOfChar('0', -decimalPointPos) + sigDigits\n } else if (sigDigits.indexOf('.') === -1) {\n const numZeroes = decimalPointPos - sigDigits.length\n const zeroes = DD.stringOfChar('0', numZeroes)\n num = sigDigits + zeroes + '.0'\n }\n if (this.isNegative()) return '-' + num\n return num\n }\n reciprocal() {\n let hc = null, tc = null, hy = null, ty = null, C = null, c = null, U = null, u = null\n C = 1.0 / this._hi\n c = DD.SPLIT * C\n hc = c - C\n u = DD.SPLIT * this._hi\n hc = c - hc\n tc = C - hc\n hy = u - this._hi\n U = C * this._hi\n hy = u - hy\n ty = this._hi - hy\n u = hc * hy - U + hc * ty + tc * hy + tc * ty\n c = (1.0 - U - u - C * this._lo) / this._hi\n const zhi = C + c\n const zlo = C - zhi + c\n return new DD(zhi, zlo)\n }\n toSciNotation() {\n if (this.isZero()) return DD.SCI_NOT_ZERO\n const specialStr = this.getSpecialNumberString()\n if (specialStr !== null) return specialStr\n const magnitude = new Array(1).fill(null)\n const digits = this.extractSignificantDigits(false, magnitude)\n const expStr = DD.SCI_NOT_EXPONENT_CHAR + magnitude[0]\n if (digits.charAt(0) === '0') \n throw new IllegalStateException('Found leading zero: ' + digits)\n \n let trailingDigits = ''\n if (digits.length > 1) trailingDigits = digits.substring(1)\n const digitsWithDecimal = digits.charAt(0) + '.' + trailingDigits\n if (this.isNegative()) return '-' + digitsWithDecimal + expStr\n return digitsWithDecimal + expStr\n }\n abs() {\n if (this.isNaN()) return DD.NaN\n if (this.isNegative()) return this.negate()\n return new DD(this)\n }\n isPositive() {\n return this._hi > 0.0 || this._hi === 0.0 && this._lo > 0.0\n }\n lt(y) {\n return this._hi < y._hi || this._hi === y._hi && this._lo < y._lo\n }\n add() {\n if (arguments[0] instanceof DD) {\n const y = arguments[0]\n return DD.copy(this).selfAdd(y)\n } else if (typeof arguments[0] === 'number') {\n const y = arguments[0]\n return DD.copy(this).selfAdd(y)\n }\n }\n init() {\n if (arguments.length === 1) {\n if (typeof arguments[0] === 'number') {\n const x = arguments[0]\n this._hi = x\n this._lo = 0.0\n } else if (arguments[0] instanceof DD) {\n const dd = arguments[0]\n this._hi = dd._hi\n this._lo = dd._lo\n }\n } else if (arguments.length === 2) {\n const hi = arguments[0], lo = arguments[1]\n this._hi = hi\n this._lo = lo\n }\n }\n gt(y) {\n return this._hi > y._hi || this._hi === y._hi && this._lo > y._lo\n }\n isNegative() {\n return this._hi < 0.0 || this._hi === 0.0 && this._lo < 0.0\n }\n trunc() {\n if (this.isNaN()) return DD.NaN\n if (this.isPositive()) return this.floor(); else return this.ceil()\n }\n signum() {\n if (this._hi > 0) return 1\n if (this._hi < 0) return -1\n if (this._lo > 0) return 1\n if (this._lo < 0) return -1\n return 0\n }\n get interfaces_() {\n return [Serializable, Comparable, Cloneable]\n }\n}\nDD.PI = new DD(3.141592653589793116e+00, 1.224646799147353207e-16)\nDD.TWO_PI = new DD(6.283185307179586232e+00, 2.449293598294706414e-16)\nDD.PI_2 = new DD(1.570796326794896558e+00, 6.123233995736766036e-17)\nDD.E = new DD(2.718281828459045091e+00, 1.445646891729250158e-16)\nDD.NaN = new DD(Double.NaN, Double.NaN)\nDD.EPS = 1.23259516440783e-32\nDD.SPLIT = 134217729.0\nDD.MAX_PRINT_DIGITS = 32\nDD.TEN = DD.valueOf(10.0)\nDD.ONE = DD.valueOf(1.0)\nDD.SCI_NOT_EXPONENT_CHAR = 'E'\nDD.SCI_NOT_ZERO = '0.0E0'\n","import Coordinate from '../geom/Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport DD from '../math/DD.js'\nexport default class CGAlgorithmsDD {\n static orientationIndex(p1, p2, q) {\n const index = CGAlgorithmsDD.orientationIndexFilter(p1, p2, q)\n if (index <= 1) return index\n const dx1 = DD.valueOf(p2.x).selfAdd(-p1.x)\n const dy1 = DD.valueOf(p2.y).selfAdd(-p1.y)\n const dx2 = DD.valueOf(q.x).selfAdd(-p2.x)\n const dy2 = DD.valueOf(q.y).selfAdd(-p2.y)\n return dx1.selfMultiply(dy2).selfSubtract(dy1.selfMultiply(dx2)).signum()\n }\n static signOfDet2x2() {\n if (arguments[3] instanceof DD && (arguments[2] instanceof DD && (arguments[0] instanceof DD && arguments[1] instanceof DD))) {\n const x1 = arguments[0], y1 = arguments[1], x2 = arguments[2], y2 = arguments[3]\n const det = x1.multiply(y2).selfSubtract(y1.multiply(x2))\n return det.signum()\n } else if (typeof arguments[3] === 'number' && (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number'))) {\n const dx1 = arguments[0], dy1 = arguments[1], dx2 = arguments[2], dy2 = arguments[3]\n const x1 = DD.valueOf(dx1)\n const y1 = DD.valueOf(dy1)\n const x2 = DD.valueOf(dx2)\n const y2 = DD.valueOf(dy2)\n const det = x1.multiply(y2).selfSubtract(y1.multiply(x2))\n return det.signum()\n }\n }\n static intersection(p1, p2, q1, q2) {\n const px = new DD(p1.y).selfSubtract(p2.y)\n const py = new DD(p2.x).selfSubtract(p1.x)\n const pw = new DD(p1.x).selfMultiply(p2.y).selfSubtract(new DD(p2.x).selfMultiply(p1.y))\n const qx = new DD(q1.y).selfSubtract(q2.y)\n const qy = new DD(q2.x).selfSubtract(q1.x)\n const qw = new DD(q1.x).selfMultiply(q2.y).selfSubtract(new DD(q2.x).selfMultiply(q1.y))\n const x = py.multiply(qw).selfSubtract(qy.multiply(pw))\n const y = qx.multiply(pw).selfSubtract(px.multiply(qw))\n const w = px.multiply(qy).selfSubtract(qx.multiply(py))\n const xInt = x.selfDivide(w).doubleValue()\n const yInt = y.selfDivide(w).doubleValue()\n if (Double.isNaN(xInt) || (Double.isInfinite(xInt) || Double.isNaN(yInt)) || Double.isInfinite(yInt)) \n return null\n \n return new Coordinate(xInt, yInt)\n }\n static orientationIndexFilter(pa, pb, pc) {\n let detsum = null\n const detleft = (pa.x - pc.x) * (pb.y - pc.y)\n const detright = (pa.y - pc.y) * (pb.x - pc.x)\n const det = detleft - detright\n if (detleft > 0.0) \n if (detright <= 0.0) \n return CGAlgorithmsDD.signum(det)\n else \n detsum = detleft + detright\n \n else if (detleft < 0.0) \n if (detright >= 0.0) \n return CGAlgorithmsDD.signum(det)\n else \n detsum = -detleft - detright\n \n else \n return CGAlgorithmsDD.signum(det)\n \n const errbound = CGAlgorithmsDD.DP_SAFE_EPSILON * detsum\n if (det >= errbound || -det >= errbound) \n return CGAlgorithmsDD.signum(det)\n \n return 2\n }\n static signum(x) {\n if (x > 0) return 1\n if (x < 0) return -1\n return 0\n }\n}\nCGAlgorithmsDD.DP_SAFE_EPSILON = 1e-15\n","import hasInterface from '../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport CGAlgorithmsDD from './CGAlgorithmsDD.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nexport default class Orientation {\n static index(p1, p2, q) {\n return CGAlgorithmsDD.orientationIndex(p1, p2, q)\n }\n static isCCW() {\n if (arguments[0] instanceof Array) {\n const ring = arguments[0]\n const nPts = ring.length - 1\n if (nPts < 3) throw new IllegalArgumentException('Ring has fewer than 4 points, so orientation cannot be determined')\n let hiPt = ring[0]\n let hiIndex = 0\n for (let i = 1; i <= nPts; i++) {\n const p = ring[i]\n if (p.y > hiPt.y) {\n hiPt = p\n hiIndex = i\n }\n }\n let iPrev = hiIndex\n do {\n iPrev = iPrev - 1\n if (iPrev < 0) iPrev = nPts\n } while (ring[iPrev].equals2D(hiPt) && iPrev !== hiIndex)\n let iNext = hiIndex\n do \n iNext = (iNext + 1) % nPts\n while (ring[iNext].equals2D(hiPt) && iNext !== hiIndex)\n const prev = ring[iPrev]\n const next = ring[iNext]\n if (prev.equals2D(hiPt) || next.equals2D(hiPt) || prev.equals2D(next)) return false\n const disc = Orientation.index(prev, hiPt, next)\n let isCCW = null\n if (disc === 0) \n isCCW = prev.x > next.x\n else \n isCCW = disc > 0\n \n return isCCW\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const ring = arguments[0]\n const nPts = ring.size() - 1\n if (nPts < 3) throw new IllegalArgumentException('Ring has fewer than 4 points, so orientation cannot be determined')\n let hiPt = ring.getCoordinate(0)\n let hiIndex = 0\n for (let i = 1; i <= nPts; i++) {\n const p = ring.getCoordinate(i)\n if (p.y > hiPt.y) {\n hiPt = p\n hiIndex = i\n }\n }\n let prev = null\n let iPrev = hiIndex\n do {\n iPrev = iPrev - 1\n if (iPrev < 0) iPrev = nPts\n prev = ring.getCoordinate(iPrev)\n } while (prev.equals2D(hiPt) && iPrev !== hiIndex)\n let next = null\n let iNext = hiIndex\n do {\n iNext = (iNext + 1) % nPts\n next = ring.getCoordinate(iNext)\n } while (next.equals2D(hiPt) && iNext !== hiIndex)\n if (prev.equals2D(hiPt) || next.equals2D(hiPt) || prev.equals2D(next)) return false\n const disc = Orientation.index(prev, hiPt, next)\n let isCCW = null\n if (disc === 0) \n isCCW = prev.x > next.x\n else \n isCCW = disc > 0\n \n return isCCW\n }\n }\n}\nOrientation.CLOCKWISE = -1\nOrientation.RIGHT = Orientation.CLOCKWISE\nOrientation.COUNTERCLOCKWISE = 1\nOrientation.LEFT = Orientation.COUNTERCLOCKWISE\nOrientation.COLLINEAR = 0\nOrientation.STRAIGHT = Orientation.COLLINEAR\n","export default class Polygonal {}\n","import Area from '../algorithm/Area.js'\nimport Geometry from './Geometry.js'\nimport Arrays from '../../../../java/util/Arrays.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Polygonal from './Polygonal.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nexport default class Polygon extends Geometry {\n constructor() {\n super()\n Polygon.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._shell = null\n this._holes = null\n let shell = arguments[0], holes = arguments[1], factory = arguments[2]\n Geometry.constructor_.call(this, factory)\n if (shell === null) \n shell = this.getFactory().createLinearRing()\n \n if (holes === null) \n holes = []\n \n if (Geometry.hasNullElements(holes)) \n throw new IllegalArgumentException('holes must not contain null elements')\n \n if (shell.isEmpty() && Geometry.hasNonEmptyElements(holes)) \n throw new IllegalArgumentException('shell is empty but holes are not')\n \n this._shell = shell\n this._holes = holes\n }\n computeEnvelopeInternal() {\n return this._shell.getEnvelopeInternal()\n }\n getCoordinates() {\n if (this.isEmpty()) \n return []\n \n const coordinates = new Array(this.getNumPoints()).fill(null)\n let k = -1\n const shellCoordinates = this._shell.getCoordinates()\n for (let x = 0; x < shellCoordinates.length; x++) {\n k++\n coordinates[k] = shellCoordinates[x]\n }\n for (let i = 0; i < this._holes.length; i++) {\n const childCoordinates = this._holes[i].getCoordinates()\n for (let j = 0; j < childCoordinates.length; j++) {\n k++\n coordinates[k] = childCoordinates[j]\n }\n }\n return coordinates\n }\n getArea() {\n let area = 0.0\n area += Area.ofRing(this._shell.getCoordinateSequence())\n for (let i = 0; i < this._holes.length; i++) \n area -= Area.ofRing(this._holes[i].getCoordinateSequence())\n \n return area\n }\n copyInternal() {\n const shellCopy = this._shell.copy()\n const holeCopies = new Array(this._holes.length).fill(null)\n for (let i = 0; i < this._holes.length; i++) \n holeCopies[i] = this._holes[i].copy()\n \n return new Polygon(shellCopy, holeCopies, this._factory)\n }\n isRectangle() {\n if (this.getNumInteriorRing() !== 0) return false\n if (this._shell === null) return false\n if (this._shell.getNumPoints() !== 5) return false\n const seq = this._shell.getCoordinateSequence()\n const env = this.getEnvelopeInternal()\n for (let i = 0; i < 5; i++) {\n const x = seq.getX(i)\n if (!(x === env.getMinX() || x === env.getMaxX())) return false\n const y = seq.getY(i)\n if (!(y === env.getMinY() || y === env.getMaxY())) return false\n }\n let prevX = seq.getX(0)\n let prevY = seq.getY(0)\n for (let i = 1; i <= 4; i++) {\n const x = seq.getX(i)\n const y = seq.getY(i)\n const xChanged = x !== prevX\n const yChanged = y !== prevY\n if (xChanged === yChanged) return false\n prevX = x\n prevY = y\n }\n return true\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n const otherPolygon = other\n const thisShell = this._shell\n const otherPolygonShell = otherPolygon._shell\n if (!thisShell.equalsExact(otherPolygonShell, tolerance)) \n return false\n \n if (this._holes.length !== otherPolygon._holes.length) \n return false\n \n for (let i = 0; i < this._holes.length; i++) \n if (!this._holes[i].equalsExact(otherPolygon._holes[i], tolerance)) \n return false\n \n \n return true\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {\n if (arguments.length === 0) {\n this._shell = this.normalized(this._shell, true)\n for (let i = 0; i < this._holes.length; i++) \n this._holes[i] = this.normalized(this._holes[i], false)\n \n Arrays.sort(this._holes)\n } else if (arguments.length === 2) {\n const ring = arguments[0], clockwise = arguments[1]\n if (ring.isEmpty()) \n return null\n \n const seq = ring.getCoordinateSequence()\n const minCoordinateIndex = CoordinateSequences.minCoordinateIndex(seq, 0, seq.size() - 2)\n CoordinateSequences.scroll(seq, minCoordinateIndex, true)\n if (Orientation.isCCW(seq) === clockwise) CoordinateSequences.reverse(seq)\n }\n }\n getCoordinate() {\n return this._shell.getCoordinate()\n }\n getNumInteriorRing() {\n return this._holes.length\n }\n getBoundaryDimension() {\n return 1\n }\n reverseInternal() {\n const shell = this.getExteriorRing().reverse()\n const holes = new Array(this.getNumInteriorRing()).fill(null)\n for (let i = 0; i < holes.length; i++) \n holes[i] = this.getInteriorRingN(i).reverse()\n \n return this.getFactory().createPolygon(shell, holes)\n }\n getTypeCode() {\n return Geometry.TYPECODE_POLYGON\n }\n getDimension() {\n return 2\n }\n getLength() {\n let len = 0.0\n len += this._shell.getLength()\n for (let i = 0; i < this._holes.length; i++) \n len += this._holes[i].getLength()\n \n return len\n }\n getNumPoints() {\n let numPoints = this._shell.getNumPoints()\n for (let i = 0; i < this._holes.length; i++) \n numPoints += this._holes[i].getNumPoints()\n \n return numPoints\n }\n convexHull() {\n return this.getExteriorRing().convexHull()\n }\n normalized(ring, clockwise) {\n const res = ring.copy()\n this.normalize(res, clockwise)\n return res\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const o = arguments[0]\n const thisShell = this._shell\n const otherShell = o._shell\n return thisShell.compareToSameClass(otherShell)\n } else if (arguments.length === 2) {\n const o = arguments[0], comp = arguments[1]\n const poly = o\n const thisShell = this._shell\n const otherShell = poly._shell\n const shellComp = thisShell.compareToSameClass(otherShell, comp)\n if (shellComp !== 0) return shellComp\n const nHole1 = this.getNumInteriorRing()\n const nHole2 = poly.getNumInteriorRing()\n let i = 0\n while (i < nHole1 && i < nHole2) {\n const thisHole = this.getInteriorRingN(i)\n const otherHole = poly.getInteriorRingN(i)\n const holeComp = thisHole.compareToSameClass(otherHole, comp)\n if (holeComp !== 0) return holeComp\n i++\n }\n if (i < nHole1) return 1\n if (i < nHole2) return -1\n return 0\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n this._shell.apply(filter)\n for (let i = 0; i < this._holes.length; i++) \n this._holes[i].apply(filter)\n \n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n this._shell.apply(filter)\n if (!filter.isDone()) \n for (let i = 0; i < this._holes.length; i++) {\n this._holes[i].apply(filter)\n if (filter.isDone()) break\n }\n \n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n this._shell.apply(filter)\n for (let i = 0; i < this._holes.length; i++) \n this._holes[i].apply(filter)\n \n }\n }\n getBoundary() {\n if (this.isEmpty()) \n return this.getFactory().createMultiLineString()\n \n const rings = new Array(this._holes.length + 1).fill(null)\n rings[0] = this._shell\n for (let i = 0; i < this._holes.length; i++) \n rings[i + 1] = this._holes[i]\n \n if (rings.length <= 1) return this.getFactory().createLinearRing(rings[0].getCoordinateSequence())\n return this.getFactory().createMultiLineString(rings)\n }\n getGeometryType() {\n return Geometry.TYPENAME_POLYGON\n }\n getExteriorRing() {\n return this._shell\n }\n isEmpty() {\n return this._shell.isEmpty()\n }\n getInteriorRingN(n) {\n return this._holes[n]\n }\n get interfaces_() {\n return [Polygonal]\n }\n}\n","import Collection from './Collection.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Set.html\n *\n * @extends {Collection}\n * @constructor\n * @private\n */\nexport default class Set extends Collection {\n /**\n * Returns true if this set contains the specified element. More formally,\n * returns true if and only if this set contains an element e such that (o==null ?\n * e==null : o.equals(e)).\n * @param {Object} e\n * @return {boolean}\n */\n contains() { }\n}\n","import Set from './Set.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html\n */\nexport default class SortedSet extends Set {}\n","import Collection from './Collection.js'\nimport NoSuchElementException from './NoSuchElementException.js'\nimport UnsupportedOperationException from '../lang/UnsupportedOperationException.js'\nimport SortedSet from './SortedSet.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/TreeSet.html\n */\nexport default class TreeSet extends SortedSet {\n constructor(o) {\n super()\n this.array = []\n if (o instanceof Collection)\n this.addAll(o)\n }\n\n contains(o) {\n for (const e of this.array)\n if (e.compareTo(o) === 0)\n return true\n return false\n }\n\n add(o) {\n if (this.contains(o))\n return false\n for (let i = 0, len = this.array.length; i < len; i++) {\n const e = this.array[i]\n if (e.compareTo(o) === 1)\n return !!this.array.splice(i, 0, o)\n }\n this.array.push(o)\n return true\n }\n\n addAll(c) {\n for (const e of c)\n this.add(e)\n return true\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n\n size() {\n return this.array.length\n }\n\n isEmpty() {\n return this.array.length === 0\n }\n\n toArray() {\n return this.array.slice()\n }\n\n iterator() {\n return new Iterator(this.array)\n }\n}\n\nclass Iterator {\n constructor(array) {\n this.array = array\n this.position = 0\n }\n\n next() {\n if (this.position === this.array.length)\n throw new NoSuchElementException()\n return this.array[this.position++]\n }\n\n hasNext() {\n return this.position < this.array.length\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n}\n","import TreeSet from '../../../../java/util/TreeSet.js'\nimport Geometry from './Geometry.js'\nimport Arrays from '../../../../java/util/Arrays.js'\nimport CoordinateFilter from './CoordinateFilter.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport GeometryComponentFilter from './GeometryComponentFilter.js'\nimport Dimension from './Dimension.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport GeometryFilter from './GeometryFilter.js'\nimport CoordinateSequenceFilter from './CoordinateSequenceFilter.js'\nimport Envelope from './Envelope.js'\nimport Assert from '../util/Assert.js'\nexport default class GeometryCollection extends Geometry {\n constructor() {\n super()\n GeometryCollection.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geometries = null\n if (arguments.length === 0) {} else if (arguments.length === 2) {\n let geometries = arguments[0], factory = arguments[1]\n Geometry.constructor_.call(this, factory)\n if (geometries === null) \n geometries = []\n \n if (Geometry.hasNullElements(geometries)) \n throw new IllegalArgumentException('geometries must not contain null elements')\n \n this._geometries = geometries\n }\n }\n computeEnvelopeInternal() {\n const envelope = new Envelope()\n for (let i = 0; i < this._geometries.length; i++) \n envelope.expandToInclude(this._geometries[i].getEnvelopeInternal())\n \n return envelope\n }\n getGeometryN(n) {\n return this._geometries[n]\n }\n getCoordinates() {\n const coordinates = new Array(this.getNumPoints()).fill(null)\n let k = -1\n for (let i = 0; i < this._geometries.length; i++) {\n const childCoordinates = this._geometries[i].getCoordinates()\n for (let j = 0; j < childCoordinates.length; j++) {\n k++\n coordinates[k] = childCoordinates[j]\n }\n }\n return coordinates\n }\n getArea() {\n let area = 0.0\n for (let i = 0; i < this._geometries.length; i++) \n area += this._geometries[i].getArea()\n \n return area\n }\n copyInternal() {\n const geometries = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < geometries.length; i++) \n geometries[i] = this._geometries[i].copy()\n \n return new GeometryCollection(geometries, this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n const otherCollection = other\n if (this._geometries.length !== otherCollection._geometries.length) \n return false\n \n for (let i = 0; i < this._geometries.length; i++) \n if (!this._geometries[i].equalsExact(otherCollection._geometries[i], tolerance)) \n return false\n \n \n return true\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n normalize() {\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].normalize()\n \n Arrays.sort(this._geometries)\n }\n getCoordinate() {\n if (this.isEmpty()) return null\n return this._geometries[0].getCoordinate()\n }\n getBoundaryDimension() {\n let dimension = Dimension.FALSE\n for (let i = 0; i < this._geometries.length; i++) \n dimension = Math.max(dimension, this._geometries[i].getBoundaryDimension())\n \n return dimension\n }\n reverseInternal() {\n const numGeometries = this._geometries.length\n const reversed = new ArrayList(numGeometries)\n for (let i = 0; i < numGeometries; i++) \n reversed.add(this._geometries[i].reverse())\n \n return this.getFactory().buildGeometry(reversed)\n }\n getTypeCode() {\n return Geometry.TYPECODE_GEOMETRYCOLLECTION\n }\n getDimension() {\n let dimension = Dimension.FALSE\n for (let i = 0; i < this._geometries.length; i++) \n dimension = Math.max(dimension, this._geometries[i].getDimension())\n \n return dimension\n }\n getLength() {\n let sum = 0.0\n for (let i = 0; i < this._geometries.length; i++) \n sum += this._geometries[i].getLength()\n \n return sum\n }\n getNumPoints() {\n let numPoints = 0\n for (let i = 0; i < this._geometries.length; i++) \n numPoints += this._geometries[i].getNumPoints()\n \n return numPoints\n }\n getNumGeometries() {\n return this._geometries.length\n }\n compareToSameClass() {\n if (arguments.length === 1) {\n const o = arguments[0]\n const theseElements = new TreeSet(Arrays.asList(this._geometries))\n const otherElements = new TreeSet(Arrays.asList(o._geometries))\n return this.compare(theseElements, otherElements)\n } else if (arguments.length === 2) {\n const o = arguments[0], comp = arguments[1]\n const gc = o\n const n1 = this.getNumGeometries()\n const n2 = gc.getNumGeometries()\n let i = 0\n while (i < n1 && i < n2) {\n const thisGeom = this.getGeometryN(i)\n const otherGeom = gc.getGeometryN(i)\n const holeComp = thisGeom.compareToSameClass(otherGeom, comp)\n if (holeComp !== 0) return holeComp\n i++\n }\n if (i < n1) return 1\n if (i < n2) return -1\n return 0\n }\n }\n apply() {\n if (hasInterface(arguments[0], CoordinateFilter)) {\n const filter = arguments[0]\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].apply(filter)\n \n } else if (hasInterface(arguments[0], CoordinateSequenceFilter)) {\n const filter = arguments[0]\n if (this._geometries.length === 0) return null\n for (let i = 0; i < this._geometries.length; i++) {\n this._geometries[i].apply(filter)\n if (filter.isDone()) \n break\n \n }\n if (filter.isGeometryChanged()) this.geometryChanged()\n } else if (hasInterface(arguments[0], GeometryFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].apply(filter)\n \n } else if (hasInterface(arguments[0], GeometryComponentFilter)) {\n const filter = arguments[0]\n filter.filter(this)\n for (let i = 0; i < this._geometries.length; i++) \n this._geometries[i].apply(filter)\n \n }\n }\n getBoundary() {\n Geometry.checkNotGeometryCollection(this)\n Assert.shouldNeverReachHere()\n return null\n }\n getGeometryType() {\n return Geometry.TYPENAME_GEOMETRYCOLLECTION\n }\n isEmpty() {\n for (let i = 0; i < this._geometries.length; i++) \n if (!this._geometries[i].isEmpty()) \n return false\n \n \n return true\n }\n}\n","import Geometry from './Geometry.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport Dimension from './Dimension.js'\nimport Puntal from './Puntal.js'\nexport default class MultiPoint extends GeometryCollection {\n constructor() {\n super()\n MultiPoint.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const points = arguments[0], factory = arguments[1]\n GeometryCollection.constructor_.call(this, points, factory)\n }\n copyInternal() {\n const points = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < points.length; i++) \n points[i] = this._geometries[i].copy()\n \n return new MultiPoint(points, this._factory)\n }\n isValid() {\n return true\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n return super.equalsExact.call(this, other, tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n getCoordinate() {\n if (arguments.length === 1 && Number.isInteger(arguments[0])) {\n const n = arguments[0]\n return this._geometries[n].getCoordinate()\n } else {\n return super.getCoordinate.apply(this, arguments)\n }\n }\n getBoundaryDimension() {\n return Dimension.FALSE\n }\n getTypeCode() {\n return Geometry.TYPECODE_MULTIPOINT\n }\n getDimension() {\n return 0\n }\n getBoundary() {\n return this.getFactory().createGeometryCollection()\n }\n getGeometryType() {\n return Geometry.TYPENAME_MULTIPOINT\n }\n get interfaces_() {\n return [Puntal]\n }\n}\n","import LineString from './LineString.js'\nimport Geometry from './Geometry.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport Dimension from './Dimension.js'\nexport default class LinearRing extends LineString {\n constructor() {\n super()\n LinearRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const points = arguments[0], factory = arguments[1]\n LineString.constructor_.call(this, points, factory)\n this.validateConstruction()\n }\n copyInternal() {\n return new LinearRing(this._points.copy(), this._factory)\n }\n getBoundaryDimension() {\n return Dimension.FALSE\n }\n isClosed() {\n if (this.isEmpty()) \n return true\n \n return super.isClosed.call(this)\n }\n reverseInternal() {\n const seq = this._points.copy()\n CoordinateSequences.reverse(seq)\n return this.getFactory().createLinearRing(seq)\n }\n getTypeCode() {\n return Geometry.TYPECODE_LINEARRING\n }\n validateConstruction() {\n if (!this.isEmpty() && !super.isClosed.call(this)) \n throw new IllegalArgumentException('Points of LinearRing do not form a closed linestring')\n \n if (this.getCoordinateSequence().size() >= 1 && this.getCoordinateSequence().size() < LinearRing.MINIMUM_VALID_SIZE) \n throw new IllegalArgumentException('Invalid number of points in LinearRing (found ' + this.getCoordinateSequence().size() + ' - must be 0 or >= 4)')\n \n }\n getGeometryType() {\n return Geometry.TYPENAME_LINEARRING\n }\n}\nLinearRing.MINIMUM_VALID_SIZE = 4\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class CoordinateXY extends Coordinate {\n constructor() {\n super()\n CoordinateXY.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this)\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof CoordinateXY) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n }\n } else if (arguments.length === 2) {\n const x = arguments[0], y = arguments[1]\n Coordinate.constructor_.call(this, x, y, Coordinate.NULL_ORDINATE)\n }\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case CoordinateXY.X:\n this.x = value\n break\n case CoordinateXY.Y:\n this.y = value\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n getZ() {\n return Coordinate.NULL_ORDINATE\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case CoordinateXY.X:\n return this.x\n case CoordinateXY.Y:\n return this.y\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n setZ(z) {\n throw new IllegalArgumentException('CoordinateXY dimension 2 does not support z-ordinate')\n }\n copy() {\n return new CoordinateXY(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ')'\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n }\n}\nCoordinateXY.X = 0\nCoordinateXY.Y = 1\nCoordinateXY.Z = -1\nCoordinateXY.M = -1\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class CoordinateXYM extends Coordinate {\n constructor() {\n super()\n CoordinateXYM.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._m = null\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this)\n this._m = 0.0\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof CoordinateXYM) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n this._m = coord._m\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord.x, coord.y)\n this._m = this.getM()\n }\n } else if (arguments.length === 3) {\n const x = arguments[0], y = arguments[1], m = arguments[2]\n Coordinate.constructor_.call(this, x, y, Coordinate.NULL_ORDINATE)\n this._m = m\n }\n }\n getM() {\n return this._m\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case CoordinateXYM.X:\n this.x = value\n break\n case CoordinateXYM.Y:\n this.y = value\n break\n case CoordinateXYM.M:\n this._m = value\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n setM(m) {\n this._m = m\n }\n getZ() {\n return Coordinate.NULL_ORDINATE\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case CoordinateXYM.X:\n return this.x\n case CoordinateXYM.Y:\n return this.y\n case CoordinateXYM.M:\n return this._m\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n setZ(z) {\n throw new IllegalArgumentException('CoordinateXY dimension 2 does not support z-ordinate')\n }\n copy() {\n return new CoordinateXYM(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ' m=' + this.getM() + ')'\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n this._m = other.getM()\n }\n}\nCoordinateXYM.X = 0\nCoordinateXYM.Y = 1\nCoordinateXYM.Z = -1\nCoordinateXYM.M = 2\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class CoordinateXYZM extends Coordinate {\n constructor() {\n super()\n CoordinateXYZM.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._m = null\n if (arguments.length === 0) {\n Coordinate.constructor_.call(this)\n this._m = 0.0\n } else if (arguments.length === 1) {\n if (arguments[0] instanceof CoordinateXYZM) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord)\n this._m = coord._m\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n Coordinate.constructor_.call(this, coord)\n this._m = this.getM()\n }\n } else if (arguments.length === 4) {\n const x = arguments[0], y = arguments[1], z = arguments[2], m = arguments[3]\n Coordinate.constructor_.call(this, x, y, z)\n this._m = m\n }\n }\n getM() {\n return this._m\n }\n setOrdinate(ordinateIndex, value) {\n switch (ordinateIndex) {\n case Coordinate.X:\n this.x = value\n break\n case Coordinate.Y:\n this.y = value\n break\n case Coordinate.Z:\n this.z = value\n break\n case Coordinate.M:\n this._m = value\n break\n default:\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n }\n setM(m) {\n this._m = m\n }\n getOrdinate(ordinateIndex) {\n switch (ordinateIndex) {\n case Coordinate.X:\n return this.x\n case Coordinate.Y:\n return this.y\n case Coordinate.Z:\n return this.getZ()\n case Coordinate.M:\n return this.getM()\n }\n throw new IllegalArgumentException('Invalid ordinate index: ' + ordinateIndex)\n }\n copy() {\n return new CoordinateXYZM(this)\n }\n toString() {\n return '(' + this.x + ', ' + this.y + ', ' + this.getZ() + ' m=' + this.getM() + ')'\n }\n setCoordinate(other) {\n this.x = other.x\n this.y = other.y\n this.z = other.getZ()\n this._m = other.getM()\n }\n}\n","import CoordinateXY from './CoordinateXY.js'\nimport Coordinate from './Coordinate.js'\nimport CoordinateXYM from './CoordinateXYM.js'\nimport CoordinateXYZM from './CoordinateXYZM.js'\nexport default class Coordinates {\n static measures(coordinate) {\n if (coordinate instanceof CoordinateXY) \n return 0\n else if (coordinate instanceof CoordinateXYM) \n return 1\n else if (coordinate instanceof CoordinateXYZM) \n return 1\n else if (coordinate instanceof Coordinate) \n return 0\n \n return 0\n }\n static dimension(coordinate) {\n if (coordinate instanceof CoordinateXY) \n return 2\n else if (coordinate instanceof CoordinateXYM) \n return 3\n else if (coordinate instanceof CoordinateXYZM) \n return 4\n else if (coordinate instanceof Coordinate) \n return 3\n \n return 3\n }\n static create() {\n if (arguments.length === 1) {\n const dimension = arguments[0]\n return Coordinates.create(dimension, 0)\n } else if (arguments.length === 2) {\n const dimension = arguments[0], measures = arguments[1]\n if (dimension === 2) \n return new CoordinateXY()\n else if (dimension === 3 && measures === 0) \n return new Coordinate()\n else if (dimension === 3 && measures === 1) \n return new CoordinateXYM()\n else if (dimension === 4 && measures === 1) \n return new CoordinateXYZM()\n \n return new Coordinate()\n }\n }\n}\n","import hasInterface from '../../../../hasInterface.js'\nimport Collection from '../../../../java/util/Collection.js'\nimport Coordinate from './Coordinate.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class CoordinateList extends ArrayList {\n constructor() {\n super()\n CoordinateList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const coord = arguments[0]\n this.ensureCapacity(coord.length)\n this.add(coord, true)\n } else if (arguments.length === 2) {\n const coord = arguments[0], allowRepeated = arguments[1]\n this.ensureCapacity(coord.length)\n this.add(coord, allowRepeated)\n }\n }\n getCoordinate(i) {\n return this.get(i)\n }\n addAll() {\n if (arguments.length === 2 && (typeof arguments[1] === 'boolean' && hasInterface(arguments[0], Collection))) {\n const coll = arguments[0], allowRepeated = arguments[1]\n let isChanged = false\n for (let i = coll.iterator(); i.hasNext(); ) {\n this.add(i.next(), allowRepeated)\n isChanged = true\n }\n return isChanged\n } else {\n return super.addAll.apply(this, arguments)\n }\n }\n clone() {\n const clone = super.clone.call(this)\n for (let i = 0; i < this.size(); i++) \n clone.add(i, this.get(i).clone())\n \n return clone\n }\n toCoordinateArray() {\n if (arguments.length === 0) {\n return this.toArray(CoordinateList.coordArrayType)\n } else if (arguments.length === 1) {\n const isForward = arguments[0]\n if (isForward) \n return this.toArray(CoordinateList.coordArrayType)\n \n const size = this.size()\n const pts = new Array(size).fill(null)\n for (let i = 0; i < size; i++) \n pts[i] = this.get(size - i - 1)\n \n return pts\n }\n }\n add() {\n if (arguments.length === 1) {\n const coord = arguments[0]\n return super.add.call(this, coord)\n } else if (arguments.length === 2) {\n if (arguments[0] instanceof Array && typeof arguments[1] === 'boolean') {\n const coord = arguments[0], allowRepeated = arguments[1]\n this.add(coord, allowRepeated, true)\n return true\n } else if (arguments[0] instanceof Coordinate && typeof arguments[1] === 'boolean') {\n const coord = arguments[0], allowRepeated = arguments[1]\n if (!allowRepeated) \n if (this.size() >= 1) {\n const last = this.get(this.size() - 1)\n if (last.equals2D(coord)) return null\n }\n \n super.add.call(this, coord)\n } else if (arguments[0] instanceof Object && typeof arguments[1] === 'boolean') {\n const obj = arguments[0], allowRepeated = arguments[1]\n this.add(obj, allowRepeated)\n return true\n }\n } else if (arguments.length === 3) {\n if (typeof arguments[2] === 'boolean' && (arguments[0] instanceof Array && typeof arguments[1] === 'boolean')) {\n const coord = arguments[0], allowRepeated = arguments[1], direction = arguments[2]\n if (direction) \n for (let i = 0; i < coord.length; i++) \n this.add(coord[i], allowRepeated)\n \n else \n for (let i = coord.length - 1; i >= 0; i--) \n this.add(coord[i], allowRepeated)\n \n \n return true\n } else if (typeof arguments[2] === 'boolean' && (Number.isInteger(arguments[0]) && arguments[1] instanceof Coordinate)) {\n const i = arguments[0], coord = arguments[1], allowRepeated = arguments[2]\n if (!allowRepeated) {\n const size = this.size()\n if (size > 0) {\n if (i > 0) {\n const prev = this.get(i - 1)\n if (prev.equals2D(coord)) return null\n }\n if (i < size) {\n const next = this.get(i)\n if (next.equals2D(coord)) return null\n }\n }\n }\n super.add.call(this, i, coord)\n }\n } else if (arguments.length === 4) {\n const coord = arguments[0], allowRepeated = arguments[1], start = arguments[2], end = arguments[3]\n let inc = 1\n if (start > end) inc = -1\n for (let i = start; i !== end; i += inc) \n this.add(coord[i], allowRepeated)\n \n return true\n }\n }\n closeRing() {\n if (this.size() > 0) {\n const duplicate = this.get(0).copy()\n this.add(duplicate, false)\n }\n }\n}\nCoordinateList.coordArrayType = new Array(0).fill(null)\n","import Double from '../../../../java/lang/Double.js'\nexport default class MathUtil {\n static log10(x) {\n const ln = Math.log(x)\n if (Double.isInfinite(ln)) return ln\n if (Double.isNaN(ln)) return ln\n return ln / MathUtil.LOG_10\n }\n static min(v1, v2, v3, v4) {\n let min = v1\n if (v2 < min) min = v2\n if (v3 < min) min = v3\n if (v4 < min) min = v4\n return min\n }\n static clamp() {\n if (typeof arguments[2] === 'number' && (typeof arguments[0] === 'number' && typeof arguments[1] === 'number')) {\n const x = arguments[0], min = arguments[1], max = arguments[2]\n if (x < min) return min\n if (x > max) return max\n return x\n } else if (Number.isInteger(arguments[2]) && (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1]))) {\n const x = arguments[0], min = arguments[1], max = arguments[2]\n if (x < min) return min\n if (x > max) return max\n return x\n }\n }\n static wrap(index, max) {\n if (index < 0) \n return max - -index % max\n \n return index % max\n }\n static max() {\n if (arguments.length === 3) {\n const v1 = arguments[0], v2 = arguments[1], v3 = arguments[2]\n let max = v1\n if (v2 > max) max = v2\n if (v3 > max) max = v3\n return max\n } else if (arguments.length === 4) {\n const v1 = arguments[0], v2 = arguments[1], v3 = arguments[2], v4 = arguments[3]\n let max = v1\n if (v2 > max) max = v2\n if (v3 > max) max = v3\n if (v4 > max) max = v4\n return max\n }\n }\n static average(x1, x2) {\n return (x1 + x2) / 2.0\n }\n}\nMathUtil.LOG_10 = Math.log(10)\n","export default class System {\n static arraycopy(src, srcPos, dest, destPos, len) {\n let c = 0\n for (let i = srcPos; i < srcPos + len; i++) {\n dest[destPos + c] = src[i]\n c++\n }\n }\n\n static getProperty(name) {\n return {\n 'line.separator': '\\n'\n }[name]\n }\n}\n","import CoordinateList from './CoordinateList.js'\nimport Coordinates from './Coordinates.js'\nimport MathUtil from '../math/MathUtil.js'\nimport System from '../../../../java/lang/System.js'\nimport Comparator from '../../../../java/util/Comparator.js'\nimport Envelope from './Envelope.js'\nexport default class CoordinateArrays {\n static isRing(pts) {\n if (pts.length < 4) return false\n if (!pts[0].equals2D(pts[pts.length - 1])) return false\n return true\n }\n static ptNotInList(testPts, pts) {\n for (let i = 0; i < testPts.length; i++) {\n const testPt = testPts[i]\n if (CoordinateArrays.indexOf(testPt, pts) < 0) return testPt\n }\n return null\n }\n static scroll(coordinates, firstCoordinate) {\n const i = CoordinateArrays.indexOf(firstCoordinate, coordinates)\n if (i < 0) return null\n const newCoordinates = new Array(coordinates.length).fill(null)\n System.arraycopy(coordinates, i, newCoordinates, 0, coordinates.length - i)\n System.arraycopy(coordinates, 0, newCoordinates, coordinates.length - i, i)\n System.arraycopy(newCoordinates, 0, coordinates, 0, coordinates.length)\n }\n static equals() {\n if (arguments.length === 2) {\n const coord1 = arguments[0], coord2 = arguments[1]\n if (coord1 === coord2) return true\n if (coord1 === null || coord2 === null) return false\n if (coord1.length !== coord2.length) return false\n for (let i = 0; i < coord1.length; i++) \n if (!coord1[i].equals(coord2[i])) return false\n \n return true\n } else if (arguments.length === 3) {\n const coord1 = arguments[0], coord2 = arguments[1], coordinateComparator = arguments[2]\n if (coord1 === coord2) return true\n if (coord1 === null || coord2 === null) return false\n if (coord1.length !== coord2.length) return false\n for (let i = 0; i < coord1.length; i++) \n if (coordinateComparator.compare(coord1[i], coord2[i]) !== 0) return false\n \n return true\n }\n }\n static intersection(coordinates, env) {\n const coordList = new CoordinateList()\n for (let i = 0; i < coordinates.length; i++) \n if (env.intersects(coordinates[i])) coordList.add(coordinates[i], true)\n \n return coordList.toCoordinateArray()\n }\n static measures(pts) {\n if (pts === null || pts.length === 0) \n return 0\n \n let measures = 0\n for (const coordinate of pts) \n measures = Math.max(measures, Coordinates.measures(coordinate))\n \n return measures\n }\n static hasRepeatedPoints(coord) {\n for (let i = 1; i < coord.length; i++) \n if (coord[i - 1].equals(coord[i])) \n return true\n \n \n return false\n }\n static removeRepeatedPoints(coord) {\n if (!CoordinateArrays.hasRepeatedPoints(coord)) return coord\n const coordList = new CoordinateList(coord, false)\n return coordList.toCoordinateArray()\n }\n static reverse(coord) {\n const last = coord.length - 1\n const mid = Math.trunc(last / 2)\n for (let i = 0; i <= mid; i++) {\n const tmp = coord[i]\n coord[i] = coord[last - i]\n coord[last - i] = tmp\n }\n }\n static removeNull(coord) {\n let nonNull = 0\n for (let i = 0; i < coord.length; i++) \n if (coord[i] !== null) nonNull++\n \n const newCoord = new Array(nonNull).fill(null)\n if (nonNull === 0) return newCoord\n let j = 0\n for (let i = 0; i < coord.length; i++) \n if (coord[i] !== null) newCoord[j++] = coord[i]\n \n return newCoord\n }\n static copyDeep() {\n if (arguments.length === 1) {\n const coordinates = arguments[0]\n const copy = new Array(coordinates.length).fill(null)\n for (let i = 0; i < coordinates.length; i++) \n copy[i] = coordinates[i].copy()\n \n return copy\n } else if (arguments.length === 5) {\n const src = arguments[0], srcStart = arguments[1], dest = arguments[2], destStart = arguments[3], length = arguments[4]\n for (let i = 0; i < length; i++) \n dest[destStart + i] = src[srcStart + i].copy()\n \n }\n }\n static isEqualReversed(pts1, pts2) {\n for (let i = 0; i < pts1.length; i++) {\n const p1 = pts1[i]\n const p2 = pts2[pts1.length - i - 1]\n if (p1.compareTo(p2) !== 0) return false\n }\n return true\n }\n static envelope(coordinates) {\n const env = new Envelope()\n for (let i = 0; i < coordinates.length; i++) \n env.expandToInclude(coordinates[i])\n \n return env\n }\n static toCoordinateArray(coordList) {\n return coordList.toArray(CoordinateArrays.coordArrayType)\n }\n static dimension(pts) {\n if (pts === null || pts.length === 0) \n return 3\n \n let dimension = 0\n for (const coordinate of pts) \n dimension = Math.max(dimension, Coordinates.dimension(coordinate))\n \n return dimension\n }\n static atLeastNCoordinatesOrNothing(n, c) {\n return c.length >= n ? c : []\n }\n static indexOf(coordinate, coordinates) {\n for (let i = 0; i < coordinates.length; i++) \n if (coordinate.equals(coordinates[i])) \n return i\n \n \n return -1\n }\n static increasingDirection(pts) {\n for (let i = 0; i < Math.trunc(pts.length / 2); i++) {\n const j = pts.length - 1 - i\n const comp = pts[i].compareTo(pts[j])\n if (comp !== 0) return comp\n }\n return 1\n }\n static compare(pts1, pts2) {\n let i = 0\n while (i < pts1.length && i < pts2.length) {\n const compare = pts1[i].compareTo(pts2[i])\n if (compare !== 0) return compare\n i++\n }\n if (i < pts2.length) return -1\n if (i < pts1.length) return 1\n return 0\n }\n static minCoordinate(coordinates) {\n let minCoord = null\n for (let i = 0; i < coordinates.length; i++) \n if (minCoord === null || minCoord.compareTo(coordinates[i]) > 0) \n minCoord = coordinates[i]\n \n \n return minCoord\n }\n static extract(pts, start, end) {\n start = MathUtil.clamp(start, 0, pts.length)\n end = MathUtil.clamp(end, -1, pts.length)\n let npts = end - start + 1\n if (end < 0) npts = 0\n if (start >= pts.length) npts = 0\n if (end < start) npts = 0\n const extractPts = new Array(npts).fill(null)\n if (npts === 0) return extractPts\n let iPts = 0\n for (let i = start; i <= end; i++) \n extractPts[iPts++] = pts[i]\n \n return extractPts\n }\n}\nclass ForwardComparator {\n compare(o1, o2) {\n const pts1 = o1\n const pts2 = o2\n return CoordinateArrays.compare(pts1, pts2)\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nclass BidirectionalComparator {\n compare(o1, o2) {\n const pts1 = o1\n const pts2 = o2\n if (pts1.length < pts2.length) return -1\n if (pts1.length > pts2.length) return 1\n if (pts1.length === 0) return 0\n const forwardComp = CoordinateArrays.compare(pts1, pts2)\n const isEqualRev = CoordinateArrays.isEqualReversed(pts1, pts2)\n if (isEqualRev) return 0\n return forwardComp\n }\n OLDcompare(o1, o2) {\n const pts1 = o1\n const pts2 = o2\n if (pts1.length < pts2.length) return -1\n if (pts1.length > pts2.length) return 1\n if (pts1.length === 0) return 0\n const dir1 = CoordinateArrays.increasingDirection(pts1)\n const dir2 = CoordinateArrays.increasingDirection(pts2)\n let i1 = dir1 > 0 ? 0 : pts1.length - 1\n let i2 = dir2 > 0 ? 0 : pts1.length - 1\n for (let i = 0; i < pts1.length; i++) {\n const comparePt = pts1[i1].compareTo(pts2[i2])\n if (comparePt !== 0) return comparePt\n i1 += dir1\n i2 += dir2\n }\n return 0\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nCoordinateArrays.ForwardComparator = ForwardComparator\nCoordinateArrays.BidirectionalComparator = BidirectionalComparator\nCoordinateArrays.coordArrayType = new Array(0).fill(null)\n","export default class StringBuilder {\n constructor(str) {\n this.str = str\n }\n append(e) {\n this.str += e\n }\n setCharAt(i, c) {\n this.str = this.str.substr(0, i) + c + this.str.substr(i + 1)\n }\n toString() {\n return this.str\n }\n}","import hasInterface from '../../../../../hasInterface.js'\nimport Coordinate from '../Coordinate.js'\nimport Double from '../../../../../java/lang/Double.js'\nimport Coordinates from '../Coordinates.js'\nimport CoordinateSequence from '../CoordinateSequence.js'\nimport CoordinateArrays from '../CoordinateArrays.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport StringBuilder from '../../../../../java/lang/StringBuilder.js'\nexport default class CoordinateArraySequence {\n constructor() {\n CoordinateArraySequence.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._dimension = 3\n this._measures = 0\n this._coordinates = null\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n CoordinateArraySequence.constructor_.call(this, coordinates, CoordinateArrays.dimension(coordinates), CoordinateArrays.measures(coordinates))\n } else if (Number.isInteger(arguments[0])) {\n const size = arguments[0]\n this._coordinates = new Array(size).fill(null)\n for (let i = 0; i < size; i++) \n this._coordinates[i] = new Coordinate()\n \n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordSeq = arguments[0]\n if (coordSeq === null) {\n this._coordinates = new Array(0).fill(null)\n return null\n }\n this._dimension = coordSeq.getDimension()\n this._measures = coordSeq.getMeasures()\n this._coordinates = new Array(coordSeq.size()).fill(null)\n for (let i = 0; i < this._coordinates.length; i++) \n this._coordinates[i] = coordSeq.getCoordinateCopy(i)\n \n }\n } else if (arguments.length === 2) {\n if (arguments[0] instanceof Array && Number.isInteger(arguments[1])) {\n const coordinates = arguments[0], dimension = arguments[1]\n CoordinateArraySequence.constructor_.call(this, coordinates, dimension, CoordinateArrays.measures(coordinates))\n } else if (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1])) {\n const size = arguments[0], dimension = arguments[1]\n this._coordinates = new Array(size).fill(null)\n this._dimension = dimension\n for (let i = 0; i < size; i++) \n this._coordinates[i] = Coordinates.create(dimension)\n \n }\n } else if (arguments.length === 3) {\n if (Number.isInteger(arguments[2]) && (arguments[0] instanceof Array && Number.isInteger(arguments[1]))) {\n const coordinates = arguments[0], dimension = arguments[1], measures = arguments[2]\n this._dimension = dimension\n this._measures = measures\n if (coordinates === null) \n this._coordinates = new Array(0).fill(null)\n else \n this._coordinates = coordinates\n \n } else if (Number.isInteger(arguments[2]) && (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1]))) {\n const size = arguments[0], dimension = arguments[1], measures = arguments[2]\n this._coordinates = new Array(size).fill(null)\n this._dimension = dimension\n this._measures = measures\n for (let i = 0; i < size; i++) \n this._coordinates[i] = this.createCoordinate()\n \n }\n }\n }\n getM(index) {\n if (this.hasM()) \n return this._coordinates[index].getM()\n else \n return Double.NaN\n \n }\n setOrdinate(index, ordinateIndex, value) {\n switch (ordinateIndex) {\n case CoordinateSequence.X:\n this._coordinates[index].x = value\n break\n case CoordinateSequence.Y:\n this._coordinates[index].y = value\n break\n default:\n this._coordinates[index].setOrdinate(ordinateIndex, value)\n }\n }\n getZ(index) {\n if (this.hasZ()) \n return this._coordinates[index].getZ()\n else \n return Double.NaN\n \n }\n size() {\n return this._coordinates.length\n }\n getOrdinate(index, ordinateIndex) {\n switch (ordinateIndex) {\n case CoordinateSequence.X:\n return this._coordinates[index].x\n case CoordinateSequence.Y:\n return this._coordinates[index].y\n default:\n return this._coordinates[index].getOrdinate(ordinateIndex)\n }\n }\n getCoordinate() {\n if (arguments.length === 1) {\n const i = arguments[0]\n return this._coordinates[i]\n } else if (arguments.length === 2) {\n const index = arguments[0], coord = arguments[1]\n coord.setCoordinate(this._coordinates[index])\n }\n }\n getCoordinateCopy(i) {\n const copy = this.createCoordinate()\n copy.setCoordinate(this._coordinates[i])\n return copy\n }\n createCoordinate() {\n return Coordinates.create(this.getDimension(), this.getMeasures())\n }\n getDimension() {\n return this._dimension\n }\n getX(index) {\n return this._coordinates[index].x\n }\n getMeasures() {\n return this._measures\n }\n expandEnvelope(env) {\n for (let i = 0; i < this._coordinates.length; i++) \n env.expandToInclude(this._coordinates[i])\n \n return env\n }\n copy() {\n const cloneCoordinates = new Array(this.size()).fill(null)\n for (let i = 0; i < this._coordinates.length; i++) {\n const duplicate = this.createCoordinate()\n duplicate.setCoordinate(this._coordinates[i])\n cloneCoordinates[i] = duplicate\n }\n return new CoordinateArraySequence(cloneCoordinates, this._dimension, this._measures)\n }\n toString() {\n if (this._coordinates.length > 0) {\n const strBuilder = new StringBuilder(17 * this._coordinates.length)\n strBuilder.append('(')\n strBuilder.append(this._coordinates[0])\n for (let i = 1; i < this._coordinates.length; i++) {\n strBuilder.append(', ')\n strBuilder.append(this._coordinates[i])\n }\n strBuilder.append(')')\n return strBuilder.toString()\n } else {\n return '()'\n }\n }\n getY(index) {\n return this._coordinates[index].y\n }\n toCoordinateArray() {\n return this._coordinates\n }\n get interfaces_() {\n return [CoordinateSequence, Serializable]\n }\n}\n","import CoordinateSequenceFactory from '../CoordinateSequenceFactory.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport CoordinateArraySequence from './CoordinateArraySequence.js'\nimport CoordinateSequence from '../CoordinateSequence.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nexport default class CoordinateArraySequenceFactory {\n static instance() {\n return CoordinateArraySequenceFactory.instanceObject\n }\n readResolve() {\n return CoordinateArraySequenceFactory.instance()\n }\n create() {\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n return new CoordinateArraySequence(coordinates)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordSeq = arguments[0]\n return new CoordinateArraySequence(coordSeq)\n }\n } else if (arguments.length === 2) {\n let size = arguments[0], dimension = arguments[1]\n if (dimension > 3) dimension = 3\n if (dimension < 2) dimension = 2\n return new CoordinateArraySequence(size, dimension)\n } else if (arguments.length === 3) {\n let size = arguments[0], dimension = arguments[1], measures = arguments[2]\n let spatial = dimension - measures\n if (measures > 1) \n measures = 1\n \n if (spatial > 3) \n spatial = 3\n \n if (spatial < 2) spatial = 2\n return new CoordinateArraySequence(size, spatial + measures, measures)\n }\n }\n get interfaces_() {\n return [CoordinateSequenceFactory, Serializable]\n }\n}\nCoordinateArraySequenceFactory.instanceObject = new CoordinateArraySequenceFactory()\n","import Geometry from './Geometry.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport Polygonal from './Polygonal.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class MultiPolygon extends GeometryCollection {\n constructor() {\n super()\n MultiPolygon.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const polygons = arguments[0], factory = arguments[1]\n GeometryCollection.constructor_.call(this, polygons, factory)\n }\n copyInternal() {\n const polygons = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < polygons.length; i++) \n polygons[i] = this._geometries[i].copy()\n \n return new MultiPolygon(polygons, this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n return super.equalsExact.call(this, other, tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n getBoundaryDimension() {\n return 1\n }\n getTypeCode() {\n return Geometry.TYPECODE_MULTIPOLYGON\n }\n getDimension() {\n return 2\n }\n getBoundary() {\n if (this.isEmpty()) \n return this.getFactory().createMultiLineString()\n \n const allRings = new ArrayList()\n for (let i = 0; i < this._geometries.length; i++) {\n const polygon = this._geometries[i]\n const rings = polygon.getBoundary()\n for (let j = 0; j < rings.getNumGeometries(); j++) \n allRings.add(rings.getGeometryN(j))\n \n }\n const allRingsArray = new Array(allRings.size()).fill(null)\n return this.getFactory().createMultiLineString(allRings.toArray(allRingsArray))\n }\n getGeometryType() {\n return Geometry.TYPENAME_MULTIPOLYGON\n }\n get interfaces_() {\n return [Polygonal]\n }\n}\n","/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Map.html\n */\nexport default class Map {\n /**\n * Returns the value to which the specified key is mapped, or null if this map\n * contains no mapping for the key.\n * @param {Object} key\n * @return {Object}\n */\n get() { }\n\n /**\n * Associates the specified value with the specified key in this map (optional\n * operation).\n * @param {Object} key\n * @param {Object} value\n * @return {Object}\n */\n put() { }\n\n /**\n * Returns the number of key-value mappings in this map.\n * @return {number}\n */\n size() { }\n\n /**\n * Returns a Collection view of the values contained in this map.\n * @return {javascript.util.Collection}\n */\n values() { }\n\n /**\n * Returns a {@link Set} view of the mappings contained in this map.\n * The set is backed by the map, so changes to the map are\n * reflected in the set, and vice-versa. If the map is modified\n * while an iteration over the set is in progress (except through\n * the iterator's own remove operation, or through the\n * setValue operation on a map entry returned by the\n * iterator) the results of the iteration are undefined. The set\n * supports element removal, which removes the corresponding\n * mapping from the map, via the Iterator.remove,\n * Set.remove, removeAll, retainAll and\n * clear operations. It does not support the\n * add or addAll operations.\n *\n * @return {Set} a set view of the mappings contained in this map\n */\n entrySet() { }\n}\n","import Collection from './Collection.js'\nimport NoSuchElementException from './NoSuchElementException.js'\nimport UnsupportedOperationException from '../lang/UnsupportedOperationException.js'\nimport Set from './Set.js'\n\n/**\n * @see http://docs.oracle.com/javase/6/docs/api/java/util/HashSet.html\n */\nexport default class HashSet extends Set {\n constructor(o) {\n super()\n this.map = new Map()\n if (o instanceof Collection)\n this.addAll(o)\n }\n\n contains(o) {\n const hashCode = o.hashCode ? o.hashCode() : o\n if (this.map.has(hashCode))\n return true\n return false\n }\n\n add(o) {\n const hashCode = o.hashCode ? o.hashCode() : o\n if (this.map.has(hashCode))\n return false\n return !!this.map.set(hashCode, o)\n }\n\n addAll(c) {\n for (const e of c)\n this.add(e)\n return true\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n\n size() {\n return this.map.size\n }\n\n isEmpty() {\n return this.map.size === 0\n }\n\n toArray() {\n return Array.from(this.map.values())\n }\n\n iterator() {\n return new Iterator(this.map)\n }\n\n [Symbol.iterator]() {\n return this.map\n }\n}\n\nclass Iterator {\n constructor(map) {\n this.iterator = map.values()\n const { done, value } = this.iterator.next()\n this.done = done\n this.value = value\n }\n\n next() {\n if (this.done)\n throw new NoSuchElementException()\n const current = this.value\n const { done, value } = this.iterator.next()\n this.done = done\n this.value = value\n return current\n }\n\n hasNext() {\n return !this.done\n }\n\n remove() {\n throw new UnsupportedOperationException()\n }\n}\n","import ArrayList from './ArrayList.js'\nimport MapInterface from './Map.js'\nimport HashSet from './HashSet.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/HashMap.html\n */\nexport default class HashMap extends MapInterface {\n constructor() {\n super()\n this.map = new Map()\n }\n\n get(key) {\n return this.map.get(key) || null\n }\n\n put(key, value) {\n this.map.set(key, value)\n return value\n }\n\n values() {\n const arrayList = new ArrayList()\n const it = this.map.values()\n let o = it.next()\n while (!o.done) {\n arrayList.add(o.value)\n o = it.next()\n }\n return arrayList\n }\n\n entrySet() {\n const hashSet = new HashSet()\n this.map.entries().forEach(entry => hashSet.add(entry))\n return hashSet\n }\n\n size() {\n return this.map.size()\n }\n}\n","import HashMap from '../../../../java/util/HashMap.js'\nimport Coordinate from './Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Integer from '../../../../java/lang/Integer.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nexport default class PrecisionModel {\n constructor() {\n PrecisionModel.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._modelType = null\n this._scale = null\n if (arguments.length === 0) \n this._modelType = PrecisionModel.FLOATING\n else if (arguments.length === 1) \n if (arguments[0] instanceof Type) {\n const modelType = arguments[0]\n this._modelType = modelType\n if (modelType === PrecisionModel.FIXED) \n this.setScale(1.0)\n \n } else if (typeof arguments[0] === 'number') {\n const scale = arguments[0]\n this._modelType = PrecisionModel.FIXED\n this.setScale(scale)\n } else if (arguments[0] instanceof PrecisionModel) {\n const pm = arguments[0]\n this._modelType = pm._modelType\n this._scale = pm._scale\n }\n \n }\n static mostPrecise(pm1, pm2) {\n if (pm1.compareTo(pm2) >= 0) return pm1\n return pm2\n }\n equals(other) {\n if (!(other instanceof PrecisionModel)) \n return false\n \n const otherPrecisionModel = other\n return this._modelType === otherPrecisionModel._modelType && this._scale === otherPrecisionModel._scale\n }\n compareTo(o) {\n const other = o\n const sigDigits = this.getMaximumSignificantDigits()\n const otherSigDigits = other.getMaximumSignificantDigits()\n return Integer.compare(sigDigits, otherSigDigits)\n }\n getScale() {\n return this._scale\n }\n isFloating() {\n return this._modelType === PrecisionModel.FLOATING || this._modelType === PrecisionModel.FLOATING_SINGLE\n }\n getType() {\n return this._modelType\n }\n toString() {\n let description = 'UNKNOWN'\n if (this._modelType === PrecisionModel.FLOATING) \n description = 'Floating'\n else if (this._modelType === PrecisionModel.FLOATING_SINGLE) \n description = 'Floating-Single'\n else if (this._modelType === PrecisionModel.FIXED) \n description = 'Fixed (Scale=' + this.getScale() + ')'\n \n return description\n }\n makePrecise() {\n if (typeof arguments[0] === 'number') {\n const val = arguments[0]\n if (Double.isNaN(val)) return val\n if (this._modelType === PrecisionModel.FLOATING_SINGLE) {\n const floatSingleVal = val\n return floatSingleVal\n }\n if (this._modelType === PrecisionModel.FIXED) \n return Math.round(val * this._scale) / this._scale\n \n return val\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n if (this._modelType === PrecisionModel.FLOATING) return null\n coord.x = this.makePrecise(coord.x)\n coord.y = this.makePrecise(coord.y)\n }\n }\n getMaximumSignificantDigits() {\n let maxSigDigits = 16\n if (this._modelType === PrecisionModel.FLOATING) \n maxSigDigits = 16\n else if (this._modelType === PrecisionModel.FLOATING_SINGLE) \n maxSigDigits = 6\n else if (this._modelType === PrecisionModel.FIXED) \n maxSigDigits = 1 + Math.trunc(Math.ceil(Math.log(this.getScale()) / Math.log(10)))\n \n return maxSigDigits\n }\n setScale(scale) {\n this._scale = Math.abs(scale)\n }\n get interfaces_() {\n return [Serializable, Comparable]\n }\n}\nclass Type {\n constructor() {\n Type.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._name = null\n const name = arguments[0]\n this._name = name\n Type.nameToTypeMap.put(name, this)\n }\n readResolve() {\n return Type.nameToTypeMap.get(this._name)\n }\n toString() {\n return this._name\n }\n get interfaces_() {\n return [Serializable]\n }\n}\nType.nameToTypeMap = new HashMap()\nPrecisionModel.Type = Type\nPrecisionModel.FIXED = new Type('FIXED')\nPrecisionModel.FLOATING = new Type('FLOATING')\nPrecisionModel.FLOATING_SINGLE = new Type('FLOATING SINGLE')\nPrecisionModel.maximumPreciseValue = 9007199254740992.0\n","import Geometry from './Geometry.js'\nimport Lineal from './Lineal.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport Dimension from './Dimension.js'\nexport default class MultiLineString extends GeometryCollection {\n constructor() {\n super()\n MultiLineString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const lineStrings = arguments[0], factory = arguments[1]\n GeometryCollection.constructor_.call(this, lineStrings, factory)\n }\n copyInternal() {\n const lineStrings = new Array(this._geometries.length).fill(null)\n for (let i = 0; i < lineStrings.length; i++) \n lineStrings[i] = this._geometries[i].copy()\n \n return new MultiLineString(lineStrings, this._factory)\n }\n equalsExact() {\n if (arguments.length === 2 && (typeof arguments[1] === 'number' && arguments[0] instanceof Geometry)) {\n const other = arguments[0], tolerance = arguments[1]\n if (!this.isEquivalentClass(other)) \n return false\n \n return super.equalsExact.call(this, other, tolerance)\n } else {\n return super.equalsExact.apply(this, arguments)\n }\n }\n getBoundaryDimension() {\n if (this.isClosed()) \n return Dimension.FALSE\n \n return 0\n }\n isClosed() {\n if (this.isEmpty()) \n return false\n \n for (let i = 0; i < this._geometries.length; i++) \n if (!this._geometries[i].isClosed()) \n return false\n \n \n return true\n }\n getTypeCode() {\n return Geometry.TYPECODE_MULTILINESTRING\n }\n getDimension() {\n return 1\n }\n getBoundary() {\n throw new UnsupportedOperationException()\n }\n getGeometryType() {\n return Geometry.TYPENAME_MULTILINESTRING\n }\n get interfaces_() {\n return [Lineal]\n }\n}\n","import CoordinateSequenceFactory from './CoordinateSequenceFactory.js'\nimport LineString from './LineString.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Point from './Point.js'\nimport Polygon from './Polygon.js'\nimport MultiPoint from './MultiPoint.js'\nimport LinearRing from './LinearRing.js'\nimport CoordinateArraySequenceFactory from './impl/CoordinateArraySequenceFactory.js'\nimport MultiPolygon from './MultiPolygon.js'\nimport CoordinateSequences from './CoordinateSequences.js'\nimport CoordinateSequence from './CoordinateSequence.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport PrecisionModel from './PrecisionModel.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Assert from '../util/Assert.js'\nimport MultiLineString from './MultiLineString.js'\nexport default class GeometryFactory {\n constructor() {\n GeometryFactory.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._precisionModel = null\n this._coordinateSequenceFactory = null\n this._SRID = null\n if (arguments.length === 0) {\n GeometryFactory.constructor_.call(this, new PrecisionModel(), 0)\n } else if (arguments.length === 1) {\n if (hasInterface(arguments[0], CoordinateSequenceFactory)) {\n const coordinateSequenceFactory = arguments[0]\n GeometryFactory.constructor_.call(this, new PrecisionModel(), 0, coordinateSequenceFactory)\n } else if (arguments[0] instanceof PrecisionModel) {\n const precisionModel = arguments[0]\n GeometryFactory.constructor_.call(this, precisionModel, 0, GeometryFactory.getDefaultCoordinateSequenceFactory())\n }\n } else if (arguments.length === 2) {\n const precisionModel = arguments[0], SRID = arguments[1]\n GeometryFactory.constructor_.call(this, precisionModel, SRID, GeometryFactory.getDefaultCoordinateSequenceFactory())\n } else if (arguments.length === 3) {\n const precisionModel = arguments[0], SRID = arguments[1], coordinateSequenceFactory = arguments[2]\n this._precisionModel = precisionModel\n this._coordinateSequenceFactory = coordinateSequenceFactory\n this._SRID = SRID\n }\n }\n static toMultiPolygonArray(multiPolygons) {\n const multiPolygonArray = new Array(multiPolygons.size()).fill(null)\n return multiPolygons.toArray(multiPolygonArray)\n }\n static toGeometryArray(geometries) {\n if (geometries === null) return null\n const geometryArray = new Array(geometries.size()).fill(null)\n return geometries.toArray(geometryArray)\n }\n static getDefaultCoordinateSequenceFactory() {\n return CoordinateArraySequenceFactory.instance()\n }\n static toMultiLineStringArray(multiLineStrings) {\n const multiLineStringArray = new Array(multiLineStrings.size()).fill(null)\n return multiLineStrings.toArray(multiLineStringArray)\n }\n static toLineStringArray(lineStrings) {\n const lineStringArray = new Array(lineStrings.size()).fill(null)\n return lineStrings.toArray(lineStringArray)\n }\n static toMultiPointArray(multiPoints) {\n const multiPointArray = new Array(multiPoints.size()).fill(null)\n return multiPoints.toArray(multiPointArray)\n }\n static toLinearRingArray(linearRings) {\n const linearRingArray = new Array(linearRings.size()).fill(null)\n return linearRings.toArray(linearRingArray)\n }\n static toPointArray(points) {\n const pointArray = new Array(points.size()).fill(null)\n return points.toArray(pointArray)\n }\n static toPolygonArray(polygons) {\n const polygonArray = new Array(polygons.size()).fill(null)\n return polygons.toArray(polygonArray)\n }\n static createPointFromInternalCoord(coord, exemplar) {\n exemplar.getPrecisionModel().makePrecise(coord)\n return exemplar.getFactory().createPoint(coord)\n }\n createEmpty(dimension) {\n switch (dimension) {\n case -1:\n return this.createGeometryCollection()\n case 0:\n return this.createPoint()\n case 1:\n return this.createLineString()\n case 2:\n return this.createPolygon()\n default:\n throw new IllegalArgumentException('Invalid dimension: ' + dimension)\n }\n }\n toGeometry(envelope) {\n if (envelope.isNull()) \n return this.createPoint()\n \n if (envelope.getMinX() === envelope.getMaxX() && envelope.getMinY() === envelope.getMaxY()) \n return this.createPoint(new Coordinate(envelope.getMinX(), envelope.getMinY()))\n \n if (envelope.getMinX() === envelope.getMaxX() || envelope.getMinY() === envelope.getMaxY()) \n return this.createLineString([new Coordinate(envelope.getMinX(), envelope.getMinY()), new Coordinate(envelope.getMaxX(), envelope.getMaxY())])\n \n return this.createPolygon(this.createLinearRing([new Coordinate(envelope.getMinX(), envelope.getMinY()), new Coordinate(envelope.getMinX(), envelope.getMaxY()), new Coordinate(envelope.getMaxX(), envelope.getMaxY()), new Coordinate(envelope.getMaxX(), envelope.getMinY()), new Coordinate(envelope.getMinX(), envelope.getMinY())]), null)\n }\n createLineString() {\n if (arguments.length === 0) \n return this.createLineString(this.getCoordinateSequenceFactory().create([]))\n else if (arguments.length === 1) \n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n return this.createLineString(coordinates !== null ? this.getCoordinateSequenceFactory().create(coordinates) : null)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n return new LineString(coordinates, this)\n }\n \n }\n createMultiLineString() {\n if (arguments.length === 0) {\n return new MultiLineString(null, this)\n } else if (arguments.length === 1) {\n const lineStrings = arguments[0]\n return new MultiLineString(lineStrings, this)\n }\n }\n buildGeometry(geomList) {\n let geomType = null\n let isHeterogeneous = false\n let hasGeometryCollection = false\n for (let i = geomList.iterator(); i.hasNext(); ) {\n const geom = i.next()\n const partType = geom.getTypeCode()\n if (geomType === null) \n geomType = partType\n \n if (partType !== geomType) \n isHeterogeneous = true\n \n if (geom instanceof GeometryCollection) hasGeometryCollection = true\n }\n if (geomType === null) \n return this.createGeometryCollection()\n \n if (isHeterogeneous || hasGeometryCollection) \n return this.createGeometryCollection(GeometryFactory.toGeometryArray(geomList))\n \n const geom0 = geomList.iterator().next()\n const isCollection = geomList.size() > 1\n if (isCollection) {\n if (geom0 instanceof Polygon) \n return this.createMultiPolygon(GeometryFactory.toPolygonArray(geomList))\n else if (geom0 instanceof LineString) \n return this.createMultiLineString(GeometryFactory.toLineStringArray(geomList))\n else if (geom0 instanceof Point) \n return this.createMultiPoint(GeometryFactory.toPointArray(geomList))\n \n Assert.shouldNeverReachHere('Unhandled geometry type: ' + geom0.getGeometryType())\n }\n return geom0\n }\n createMultiPointFromCoords(coordinates) {\n return this.createMultiPoint(coordinates !== null ? this.getCoordinateSequenceFactory().create(coordinates) : null)\n }\n createPoint() {\n if (arguments.length === 0) \n return this.createPoint(this.getCoordinateSequenceFactory().create([]))\n else if (arguments.length === 1) \n if (arguments[0] instanceof Coordinate) {\n const coordinate = arguments[0]\n return this.createPoint(coordinate !== null ? this.getCoordinateSequenceFactory().create([coordinate]) : null)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n return new Point(coordinates, this)\n }\n \n }\n getCoordinateSequenceFactory() {\n return this._coordinateSequenceFactory\n }\n createPolygon() {\n if (arguments.length === 0) {\n return this.createPolygon(null, null)\n } else if (arguments.length === 1) {\n if (hasInterface(arguments[0], CoordinateSequence)) {\n const shell = arguments[0]\n return this.createPolygon(this.createLinearRing(shell))\n } else if (arguments[0] instanceof Array) {\n const shell = arguments[0]\n return this.createPolygon(this.createLinearRing(shell))\n } else if (arguments[0] instanceof LinearRing) {\n const shell = arguments[0]\n return this.createPolygon(shell, null)\n }\n } else if (arguments.length === 2) {\n const shell = arguments[0], holes = arguments[1]\n return new Polygon(shell, holes, this)\n }\n }\n getSRID() {\n return this._SRID\n }\n createGeometryCollection() {\n if (arguments.length === 0) {\n return new GeometryCollection(null, this)\n } else if (arguments.length === 1) {\n const geometries = arguments[0]\n return new GeometryCollection(geometries, this)\n }\n }\n getPrecisionModel() {\n return this._precisionModel\n }\n createLinearRing() {\n if (arguments.length === 0) \n return this.createLinearRing(this.getCoordinateSequenceFactory().create([]))\n else if (arguments.length === 1) \n if (arguments[0] instanceof Array) {\n const coordinates = arguments[0]\n return this.createLinearRing(coordinates !== null ? this.getCoordinateSequenceFactory().create(coordinates) : null)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n return new LinearRing(coordinates, this)\n }\n \n }\n createMultiPolygon() {\n if (arguments.length === 0) {\n return new MultiPolygon(null, this)\n } else if (arguments.length === 1) {\n const polygons = arguments[0]\n return new MultiPolygon(polygons, this)\n }\n }\n createMultiPoint() {\n if (arguments.length === 0) \n return new MultiPoint(null, this)\n else if (arguments.length === 1) \n if (arguments[0] instanceof Array) {\n const point = arguments[0]\n return new MultiPoint(point, this)\n } else if (hasInterface(arguments[0], CoordinateSequence)) {\n const coordinates = arguments[0]\n if (coordinates === null) \n return this.createMultiPoint(new Array(0).fill(null))\n \n const points = new Array(coordinates.size()).fill(null)\n for (let i = 0; i < coordinates.size(); i++) {\n const ptSeq = this.getCoordinateSequenceFactory().create(1, coordinates.getDimension(), coordinates.getMeasures())\n CoordinateSequences.copy(coordinates, i, ptSeq, 0, 1)\n points[i] = this.createPoint(ptSeq)\n }\n return this.createMultiPoint(points)\n }\n \n }\n get interfaces_() {\n return [Serializable]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport GeometryFactory from '../geom/GeometryFactory.js'\n\n/**\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available. Supported values are `'XY'`,\n * `'XYZ'`, `'XYM'`, `'XYZM'`.\n * @enum {string}\n */\nconst GeometryLayout = {\n XY: 'XY',\n XYZ: 'XYZ',\n XYM: 'XYM',\n XYZM: 'XYZM',\n}\n\n/**\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, `'Circle'`.\n * @enum {string}\n */\nconst GeometryType = {\n POINT: 'Point',\n LINE_STRING: 'LineString',\n LINEAR_RING: 'LinearRing',\n POLYGON: 'Polygon',\n MULTI_POINT: 'MultiPoint',\n MULTI_LINE_STRING: 'MultiLineString',\n MULTI_POLYGON: 'MultiPolygon',\n GEOMETRY_COLLECTION: 'GeometryCollection',\n CIRCLE: 'Circle',\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into\n * multiple features on reading.\n */\n\n/**\n * @typedef {Object} Token\n * @property {number} type\n * @property {number|string} [value]\n * @property {number} position\n */\n\n/**\n * @const\n * @type {string}\n */\nconst EMPTY = 'EMPTY'\n\n/**\n * @const\n * @type {string}\n */\nconst Z = 'Z'\n\n/**\n * @const\n * @type {string}\n */\nconst M = 'M'\n\n/**\n * @const\n * @type {string}\n */\nconst ZM = 'ZM'\n\n/**\n * @const\n * @enum {number}\n */\nconst TokenType = {\n TEXT: 1,\n LEFT_PAREN: 2,\n RIGHT_PAREN: 3,\n NUMBER: 4,\n COMMA: 5,\n EOF: 6,\n}\n\n/**\n * @const\n * @type {Object}\n */\nconst WKTGeometryType = {}\nfor (const type in GeometryType)\n WKTGeometryType[type] = GeometryType[type].toUpperCase()\n\n\n/**\n * Class to tokenize a WKT string.\n */\nclass Lexer {\n /**\n * @param {string} wkt WKT string.\n */\n constructor(wkt) {\n /**\n * @type {string}\n */\n this.wkt = wkt\n\n /**\n * @type {number}\n * @private\n */\n this.index_ = -1\n }\n\n /**\n * @param {string} c Character.\n * @return {boolean} Whether the character is alphabetic.\n * @private\n */\n isAlpha_(c) {\n return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')\n }\n\n /**\n * @param {string} c Character.\n * @param {boolean=} opt_decimal Whether the string number\n * contains a dot, i.e. is a decimal number.\n * @return {boolean} Whether the character is numeric.\n * @private\n */\n isNumeric_(c, opt_decimal) {\n const decimal = opt_decimal !== undefined ? opt_decimal : false\n return (c >= '0' && c <= '9') || (c == '.' && !decimal)\n }\n\n /**\n * @param {string} c Character.\n * @return {boolean} Whether the character is whitespace.\n * @private\n */\n isWhiteSpace_(c) {\n return c == ' ' || c == '\\t' || c == '\\r' || c == '\\n'\n }\n\n /**\n * @return {string} Next string character.\n * @private\n */\n nextChar_() {\n return this.wkt.charAt(++this.index_)\n }\n\n /**\n * Fetch and return the next token.\n * @return {!Token} Next string token.\n */\n nextToken() {\n const c = this.nextChar_()\n const position = this.index_\n /** @type {number|string} */\n let value = c\n let type\n\n if (c == '(') {\n type = TokenType.LEFT_PAREN\n } else if (c == ',') {\n type = TokenType.COMMA\n } else if (c == ')') {\n type = TokenType.RIGHT_PAREN\n } else if (this.isNumeric_(c) || c == '-') {\n type = TokenType.NUMBER\n value = this.readNumber_()\n } else if (this.isAlpha_(c)) {\n type = TokenType.TEXT\n value = this.readText_()\n } else if (this.isWhiteSpace_(c)) {\n return this.nextToken()\n } else if (c === '') {\n type = TokenType.EOF\n } else {\n throw new Error('Unexpected character: ' + c)\n }\n\n return { position: position, value: value, type: type }\n }\n\n /**\n * @return {number} Numeric token value.\n * @private\n */\n readNumber_() {\n let c\n const index = this.index_\n let decimal = false\n let scientificNotation = false\n do {\n if (c == '.')\n decimal = true\n else if (c == 'e' || c == 'E')\n scientificNotation = true\n c = this.nextChar_()\n } while (\n this.isNumeric_(c, decimal) ||\n // if we haven't detected a scientific number before, 'e' or 'E'\n // hint that we should continue to read\n (!scientificNotation && (c == 'e' || c == 'E')) ||\n // once we know that we have a scientific number, both '-' and '+'\n // are allowed\n (scientificNotation && (c == '-' || c == '+'))\n )\n return parseFloat(this.wkt.substring(index, this.index_--))\n }\n\n /**\n * @return {string} String token value.\n * @private\n */\n readText_() {\n let c\n const index = this.index_\n do\n c = this.nextChar_()\n while (this.isAlpha_(c))\n return this.wkt.substring(index, this.index_--).toUpperCase()\n }\n}\n\n/**\n * Class to parse the tokens from the WKT string.\n */\nclass Parser {\n /**\n * @param {Lexer} lexer The lexer.\n */\n constructor(lexer, factory) {\n /**\n * @type {Lexer}\n * @private\n */\n this.lexer_ = lexer\n\n /**\n * @type {Token}\n * @private\n */\n this.token_\n\n /**\n * @type {import(\"../geom/GeometryLayout.js\").default}\n * @private\n */\n this.layout_ = GeometryLayout.XY\n\n this.factory = factory\n }\n\n /**\n * Fetch the next token form the lexer and replace the active token.\n * @private\n */\n consume_() {\n this.token_ = this.lexer_.nextToken()\n }\n\n /**\n * Tests if the given type matches the type of the current token.\n * @param {TokenType} type Token type.\n * @return {boolean} Whether the token matches the given type.\n */\n isTokenType(type) {\n const isMatch = this.token_.type == type\n return isMatch\n }\n\n /**\n * If the given type matches the current token, consume it.\n * @param {TokenType} type Token type.\n * @return {boolean} Whether the token matches the given type.\n */\n match(type) {\n const isMatch = this.isTokenType(type)\n if (isMatch) \n this.consume_()\n return isMatch\n }\n\n /**\n * Try to parse the tokens provided by the lexer.\n * @return {import(\"../geom/Geometry.js\").default} The geometry.\n */\n parse() {\n this.consume_()\n const geometry = this.parseGeometry_()\n return geometry\n }\n\n /**\n * Try to parse the dimensional info.\n * @return {import(\"../geom/GeometryLayout.js\").default} The layout.\n * @private\n */\n parseGeometryLayout_() {\n let layout = GeometryLayout.XY\n const dimToken = this.token_\n if (this.isTokenType(TokenType.TEXT)) {\n const dimInfo = dimToken.value\n if (dimInfo === Z)\n layout = GeometryLayout.XYZ\n else if (dimInfo === M)\n layout = GeometryLayout.XYM\n else if (dimInfo === ZM)\n layout = GeometryLayout.XYZM\n if (layout !== GeometryLayout.XY)\n this.consume_()\n }\n return layout\n }\n\n /**\n * @return {!Array} A collection of geometries.\n * @private\n */\n parseGeometryCollectionText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const geometries = []\n do\n geometries.push(this.parseGeometry_())\n while (this.match(TokenType.COMMA))\n if (this.match(TokenType.RIGHT_PAREN)) \n return geometries\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {Array} All values in a point.\n * @private\n */\n parsePointText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePoint_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return null\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>} All points in a linestring.\n * @private\n */\n parseLineStringText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePointList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>>} All points in a polygon.\n * @private\n */\n parsePolygonText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parseLineStringTextList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>} All points in a multipoint.\n * @private\n */\n parseMultiPointText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n let coordinates\n if (this.token_.type == TokenType.LEFT_PAREN) \n coordinates = this.parsePointTextList_()\n else\n coordinates = this.parsePointList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>>} All linestring points\n * in a multilinestring.\n * @private\n */\n parseMultiLineStringText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parseLineStringTextList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>>>} All polygon points in a multipolygon.\n * @private\n */\n parseMultiPolygonText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePolygonTextList_()\n if (this.match(TokenType.RIGHT_PAREN)) \n return coordinates\n } else if (this.isEmptyGeometry_()) {\n return []\n }\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array} A point.\n * @private\n */\n parsePoint_() {\n const coordinates = []\n const dimensions = this.layout_.length\n for (let i = 0; i < dimensions; ++i) {\n const token = this.token_\n if (this.match(TokenType.NUMBER)) \n coordinates.push(/** @type {number} */(token.value))\n else\n break\n }\n if (coordinates.length == dimensions) \n return coordinates\n throw new Error(this.formatErrorMessage_())\n }\n\n /**\n * @return {!Array>} An array of points.\n * @private\n */\n parsePointList_() {\n const coordinates = [this.parsePoint_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parsePoint_())\n return coordinates\n }\n\n /**\n * @return {!Array>} An array of points.\n * @private\n */\n parsePointTextList_() {\n const coordinates = [this.parsePointText_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parsePointText_())\n return coordinates\n }\n\n /**\n * @return {!Array>>} An array of points.\n * @private\n */\n parseLineStringTextList_() {\n const coordinates = [this.parseLineStringText_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parseLineStringText_())\n return coordinates\n }\n\n /**\n * @return {!Array>>>} An array of points.\n * @private\n */\n parsePolygonTextList_() {\n const coordinates = [this.parsePolygonText_()]\n while (this.match(TokenType.COMMA))\n coordinates.push(this.parsePolygonText_())\n return coordinates\n }\n\n /**\n * @return {boolean} Whether the token implies an empty geometry.\n * @private\n */\n isEmptyGeometry_() {\n const isEmpty =\n this.isTokenType(TokenType.TEXT) && this.token_.value == EMPTY\n if (isEmpty)\n this.consume_()\n return isEmpty\n }\n\n /**\n * Create an error message for an unexpected token error.\n * @return {string} Error message.\n * @private\n */\n formatErrorMessage_() {\n return (\n 'Unexpected `' +\n this.token_.value +\n '` at position ' +\n this.token_.position +\n ' in `' +\n this.lexer_.wkt +\n '`'\n )\n }\n\n /**\n * @return {!import(\"../geom/Geometry.js\").default} The geometry.\n * @private\n */\n parseGeometry_() {\n const factory = this.factory\n\n const o2c = ordinates => new Coordinate(...ordinates)\n const ca2p = coordinates => {\n const rings = coordinates.map(a => factory.createLinearRing(a.map(o2c)))\n if (rings.length > 1)\n return factory.createPolygon(rings[0], rings.slice(1))\n else\n return factory.createPolygon(rings[0])\n }\n\n const token = this.token_\n if (this.match(TokenType.TEXT)) {\n const geomType = token.value\n this.layout_ = this.parseGeometryLayout_()\n if (geomType == 'GEOMETRYCOLLECTION') {\n const geometries = this.parseGeometryCollectionText_()\n return factory.createGeometryCollection(geometries)\n } else {\n switch (geomType) {\n case 'POINT': {\n const ordinates = this.parsePointText_()\n if (!ordinates)\n return factory.createPoint()\n return factory.createPoint(new Coordinate(...ordinates))\n }\n case 'LINESTRING': {\n const coordinates = this.parseLineStringText_()\n const components = coordinates.map(o2c)\n return factory.createLineString(components)\n }\n case 'LINEARRING': {\n const coordinates = this.parseLineStringText_()\n const components = coordinates.map(o2c)\n return factory.createLinearRing(components)\n }\n case 'POLYGON': {\n const coordinates = this.parsePolygonText_()\n if (!coordinates || coordinates.length === 0)\n return factory.createPolygon()\n return ca2p(coordinates)\n }\n case 'MULTIPOINT': {\n const coordinates = this.parseMultiPointText_()\n if (!coordinates || coordinates.length === 0)\n return factory.createMultiPoint()\n const components = coordinates.map(o2c).map(c => factory.createPoint(c))\n return factory.createMultiPoint(components)\n }\n case 'MULTILINESTRING': {\n const coordinates = this.parseMultiLineStringText_()\n const components = coordinates.map(a => factory.createLineString(a.map(o2c)))\n return factory.createMultiLineString(components)\n }\n case 'MULTIPOLYGON': {\n const coordinates = this.parseMultiPolygonText_()\n if (!coordinates || coordinates.length === 0)\n return factory.createMultiPolygon()\n const polygons = coordinates.map(ca2p)\n return factory.createMultiPolygon(polygons)\n }\n default: {\n throw new Error('Invalid geometry type: ' + geomType)\n }\n }\n }\n }\n throw new Error(this.formatErrorMessage_())\n }\n}\n\n/**\n * @param {Point} geom Point geometry.\n * @return {string} Coordinates part of Point as WKT.\n */\nfunction encodePointGeometry(geom) {\n if (geom.isEmpty())\n return ''\n const c = geom.getCoordinate()\n const cs = [c.x, c.y]\n if (c.z !== undefined && !Number.isNaN(c.z))\n cs.push(c.z)\n if (c.m !== undefined && !Number.isNaN(c.m))\n cs.push(c.m)\n return cs.join(' ')\n}\n\n/**\n * @param {MultiPoint} geom MultiPoint geometry.\n * @return {string} Coordinates part of MultiPoint as WKT.\n */\nfunction encodeMultiPointGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push('(' + encodePointGeometry(geom.getGeometryN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {GeometryCollection} geom GeometryCollection geometry.\n * @return {string} Coordinates part of GeometryCollection as WKT.\n */\nfunction encodeGeometryCollectionGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push(encode(geom.getGeometryN(i)))\n return array.join(', ')\n}\n\n/**\n * @param {LineString|import(\"../geom/LinearRing.js\").default} geom LineString geometry.\n * @return {string} Coordinates part of LineString as WKT.\n */\nfunction encodeLineStringGeometry(geom) {\n const coordinates = geom.getCoordinates()\n .map(c => {\n const a = [c.x, c.y]\n if (c.z !== undefined && !Number.isNaN(c.z))\n a.push(c.z)\n if (c.m !== undefined && !Number.isNaN(c.m))\n a.push(c.m)\n return a\n })\n const array = []\n for (let i = 0, ii = coordinates.length; i < ii; ++i) \n array.push(coordinates[i].join(' '))\n return array.join(', ')\n}\n\n/**\n * @param {MultiLineString} geom MultiLineString geometry.\n * @return {string} Coordinates part of MultiLineString as WKT.\n */\nfunction encodeMultiLineStringGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push('(' + encodeLineStringGeometry(geom.getGeometryN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {Polygon} geom Polygon geometry.\n * @return {string} Coordinates part of Polygon as WKT.\n */\nfunction encodePolygonGeometry(geom) {\n const array = []\n array.push('(' + encodeLineStringGeometry(geom.getExteriorRing()) + ')')\n for (let i = 0, ii = geom.getNumInteriorRing(); i < ii; ++i) \n array.push('(' + encodeLineStringGeometry(geom.getInteriorRingN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {MultiPolygon} geom MultiPolygon geometry.\n * @return {string} Coordinates part of MultiPolygon as WKT.\n */\nfunction encodeMultiPolygonGeometry(geom) {\n const array = []\n for (let i = 0, ii = geom.getNumGeometries(); i < ii; ++i) \n array.push('(' + encodePolygonGeometry(geom.getGeometryN(i)) + ')')\n return array.join(', ')\n}\n\n/**\n * @param {Geometry} geom Geometry geometry.\n * @return {string} Potential dimensional information for WKT type.\n */\nfunction encodeGeometryLayout(geom) {\n let dimInfo = ''\n if (geom.isEmpty())\n return dimInfo\n const c = geom.getCoordinate()\n if (c.z !== undefined && !Number.isNaN(c.z))\n dimInfo += Z\n if (c.m !== undefined && !Number.isNaN(c.m))\n dimInfo += M\n return dimInfo\n}\n\n/**\n * @const\n * @type {Object}\n */\nconst GeometryEncoder = {\n 'Point': encodePointGeometry,\n 'LineString': encodeLineStringGeometry,\n 'LinearRing': encodeLineStringGeometry,\n 'Polygon': encodePolygonGeometry,\n 'MultiPoint': encodeMultiPointGeometry,\n 'MultiLineString': encodeMultiLineStringGeometry,\n 'MultiPolygon': encodeMultiPolygonGeometry,\n 'GeometryCollection': encodeGeometryCollectionGeometry,\n}\n\n/**\n * Encode a geometry as WKT.\n * @param {!import(\"../geom/Geometry.js\").default} geom The geometry to encode.\n * @return {string} WKT string for the geometry.\n */\nfunction encode(geom) {\n let type = geom.getGeometryType()\n const geometryEncoder = GeometryEncoder[type]\n type = type.toUpperCase()\n const dimInfo = encodeGeometryLayout(geom)\n if (dimInfo.length > 0) \n type += ' ' + dimInfo\n if (geom.isEmpty()) \n return type + ' ' + EMPTY\n const enc = geometryEncoder(geom)\n return type + ' (' + enc + ')'\n}\n\n/**\n * Class for reading and writing Well-Known Text.\n *\n * NOTE: Adapted from OpenLayers.\n */\n\nexport default class WKTParser {\n /** Create a new parser for WKT\n *\n * @param {GeometryFactory} geometryFactory\n * @return An instance of WKTParser.\n * @private\n */\n constructor(geometryFactory) {\n this.geometryFactory = geometryFactory || new GeometryFactory()\n this.precisionModel = this.geometryFactory.getPrecisionModel()\n }\n\n /**\n * Deserialize a WKT string and return a geometry. Supports WKT for POINT,\n * MULTIPOINT, LINESTRING, LINEARRING, MULTILINESTRING, POLYGON, MULTIPOLYGON,\n * and GEOMETRYCOLLECTION.\n *\n * @param {String} wkt A WKT string.\n * @return {Geometry} A geometry instance.\n * @private\n */\n read(wkt) {\n const lexer = new Lexer(wkt)\n const parser = new Parser(lexer, this.geometryFactory)\n const geometry = parser.parse()\n return geometry\n }\n\n /**\n * Serialize a geometry into a WKT string.\n *\n * @param {Geometry} geometry A feature or array of features.\n * @return {String} The WKT string representation of the input geometries.\n * @private\n */\n write(geometry) {\n return encode(geometry)\n }\n}\n","/**\n * @module org/locationtech/jts/io/WKTReader\n */\n\nimport GeometryFactory from '../geom/GeometryFactory.js'\nimport WKTParser from './WKTParser.js'\n\n/**\n * Converts a geometry in Well-Known Text format to a {@link Geometry}.\n *

\n * WKTReader supports extracting Geometry objects\n * from either {@link Reader}s or {@link String}s. This allows it to function\n * as a parser to read Geometry objects from text blocks embedded\n * in other data formats (e.g. XML).\n */\n\nexport default class WKTReader {\n /**\n * A WKTReader is parameterized by a GeometryFactory,\n * to allow it to create Geometry objects of the appropriate\n * implementation. In particular, the GeometryFactory determines\n * the PrecisionModel and SRID that is used.\n * @param {GeometryFactory} geometryFactory\n */\n constructor(geometryFactory) {\n this.parser = new WKTParser(geometryFactory || new GeometryFactory())\n }\n\n /**\n * Reads a Well-Known Text representation of a {@link Geometry}\n *\n * @param {string}\n * wkt a string (see the OpenGIS Simple Features\n * Specification).\n * @return {Geometry} a Geometry read from\n * string.\n * @memberof module:org/locationtech/jts/io/WKTReader#\n */\n read(wkt) {\n return this.parser.read(wkt)\n }\n}\n","/**\n * @module org/locationtech/jts/io/WKTWriter\n */\n\nimport WKTParser from './WKTParser.js'\n\n/**\n * Writes the Well-Known Text representation of a {@link Geometry}. The\n * Well-Known Text format is defined in the OGC Simple Features\n * Specification for SQL.\n *

\n * The WKTWriter outputs coordinates rounded to the precision\n * model. Only the maximum number of decimal places necessary to represent the\n * ordinates to the required precision will be output.\n *

\n * The SFS WKT spec does not define a special tag for {@link LinearRing}s.\n * Under the spec, rings are output as LINESTRINGs.\n */\nexport default class WKTWriter {\n /**\n * @param {GeometryFactory} geometryFactory\n */\n constructor(geometryFactory) {\n this.parser = new WKTParser(geometryFactory)\n }\n\n /**\n * Converts a Geometry to its Well-known Text representation.\n *\n * @param {Geometry} geometry a Geometry to process.\n * @return {string} a string (see the OpenGIS Simple\n * Features Specification).\n * @memberof module:org/locationtech/jts/io/WKTWriter#\n */\n write(geometry) {\n return this.parser.write(geometry)\n }\n\n /**\n * Generates the WKT for a LINESTRING specified by two\n * {@link Coordinate}s.\n *\n * @param p0 the first coordinate.\n * @param p1 the second coordinate.\n *\n * @return the WKT.\n * @private\n */\n static toLineString(p0, p1) {\n if (arguments.length !== 2) throw new Error('Not implemented')\n\n return 'LINESTRING ( ' + p0.x + ' ' + p0.y + ', ' + p1.x + ' ' + p1.y + ' )'\n }\n}\n","export default class BufferParameters {\n constructor() {\n BufferParameters.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._quadrantSegments = BufferParameters.DEFAULT_QUADRANT_SEGMENTS\n this._endCapStyle = BufferParameters.CAP_ROUND\n this._joinStyle = BufferParameters.JOIN_ROUND\n this._mitreLimit = BufferParameters.DEFAULT_MITRE_LIMIT\n this._isSingleSided = false\n this._simplifyFactor = BufferParameters.DEFAULT_SIMPLIFY_FACTOR\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const quadrantSegments = arguments[0]\n this.setQuadrantSegments(quadrantSegments)\n } else if (arguments.length === 2) {\n const quadrantSegments = arguments[0], endCapStyle = arguments[1]\n this.setQuadrantSegments(quadrantSegments)\n this.setEndCapStyle(endCapStyle)\n } else if (arguments.length === 4) {\n const quadrantSegments = arguments[0], endCapStyle = arguments[1], joinStyle = arguments[2], mitreLimit = arguments[3]\n this.setQuadrantSegments(quadrantSegments)\n this.setEndCapStyle(endCapStyle)\n this.setJoinStyle(joinStyle)\n this.setMitreLimit(mitreLimit)\n }\n }\n static bufferDistanceError(quadSegs) {\n const alpha = Math.PI / 2.0 / quadSegs\n return 1 - Math.cos(alpha / 2.0)\n }\n getEndCapStyle() {\n return this._endCapStyle\n }\n isSingleSided() {\n return this._isSingleSided\n }\n setQuadrantSegments(quadSegs) {\n this._quadrantSegments = quadSegs\n if (this._quadrantSegments === 0) this._joinStyle = BufferParameters.JOIN_BEVEL\n if (this._quadrantSegments < 0) {\n this._joinStyle = BufferParameters.JOIN_MITRE\n this._mitreLimit = Math.abs(this._quadrantSegments)\n }\n if (quadSegs <= 0) \n this._quadrantSegments = 1\n \n if (this._joinStyle !== BufferParameters.JOIN_ROUND) \n this._quadrantSegments = BufferParameters.DEFAULT_QUADRANT_SEGMENTS\n \n }\n getJoinStyle() {\n return this._joinStyle\n }\n setJoinStyle(joinStyle) {\n this._joinStyle = joinStyle\n }\n setSimplifyFactor(simplifyFactor) {\n this._simplifyFactor = simplifyFactor < 0 ? 0 : simplifyFactor\n }\n getSimplifyFactor() {\n return this._simplifyFactor\n }\n getQuadrantSegments() {\n return this._quadrantSegments\n }\n setEndCapStyle(endCapStyle) {\n this._endCapStyle = endCapStyle\n }\n getMitreLimit() {\n return this._mitreLimit\n }\n setMitreLimit(mitreLimit) {\n this._mitreLimit = mitreLimit\n }\n setSingleSided(isSingleSided) {\n this._isSingleSided = isSingleSided\n }\n}\nBufferParameters.CAP_ROUND = 1\nBufferParameters.CAP_FLAT = 2\nBufferParameters.CAP_SQUARE = 3\nBufferParameters.JOIN_ROUND = 1\nBufferParameters.JOIN_MITRE = 2\nBufferParameters.JOIN_BEVEL = 3\nBufferParameters.DEFAULT_QUADRANT_SEGMENTS = 8\nBufferParameters.DEFAULT_MITRE_LIMIT = 5.0\nBufferParameters.DEFAULT_SIMPLIFY_FACTOR = 0.01\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class Location {\n static toLocationSymbol(locationValue) {\n switch (locationValue) {\n case Location.EXTERIOR:\n return 'e'\n case Location.BOUNDARY:\n return 'b'\n case Location.INTERIOR:\n return 'i'\n case Location.NONE:\n return '-'\n }\n throw new IllegalArgumentException('Unknown location value: ' + locationValue)\n }\n}\nLocation.INTERIOR = 0\nLocation.BOUNDARY = 1\nLocation.EXTERIOR = 2\nLocation.NONE = -1\n","export default class Position {\n static opposite(position) {\n if (position === Position.LEFT) return Position.RIGHT\n if (position === Position.RIGHT) return Position.LEFT\n return position\n }\n}\nPosition.ON = 0\nPosition.LEFT = 1\nPosition.RIGHT = 2\n","import Exception from '../lang/Exception.js'\n\nexport default class EmptyStackException extends Exception {\n constructor(message) {\n super(message)\n this.name = Object.keys({ EmptyStackException })[0]\n }\n}\n","import EmptyStackException from './EmptyStackException.js'\nimport IndexOutOfBoundsException from '../lang/IndexOutOfBoundsException.js'\nimport List from './List.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Stack.html\n */\nexport default class Stack extends List {\n constructor() {\n super()\n this.array = []\n }\n\n add(e) {\n this.array.push(e)\n return true\n }\n\n get(index) {\n if (index < 0 || index >= this.size())\n throw new IndexOutOfBoundsException()\n return this.array[index]\n }\n\n /**\n * Pushes an item onto the top of this stack.\n * @param {Object} e\n * @return {Object}\n */\n push(e) {\n this.array.push(e)\n return e\n }\n\n /**\n * Removes the object at the top of this stack and returns that object as the value of this function.\n * @return {Object}\n */\n pop() {\n if (this.array.length === 0)\n throw new EmptyStackException()\n return this.array.pop()\n }\n\n /**\n * Looks at the object at the top of this stack without removing it from the\n * stack.\n * @return {Object}\n */\n peek() {\n if (this.array.length === 0)\n throw new EmptyStackException()\n return this.array[this.array.length - 1]\n }\n\n /**\n * Tests if this stack is empty.\n * @return {boolean} true if and only if this stack contains no items; false\n * otherwise.\n */\n empty() {\n return this.array.length === 0\n }\n\n /**\n * @return {boolean}\n */\n isEmpty() {\n return this.empty()\n }\n\n /**\n * Returns the 1-based position where an object is on this stack. If the object\n * o occurs as an item in this stack, this method returns the distance from the\n * top of the stack of the occurrence nearest the top of the stack; the topmost\n * item on the stack is considered to be at distance 1. The equals method is\n * used to compare o to the items in this stack.\n *\n * NOTE: does not currently actually use equals. (=== is used)\n *\n * @param {Object} o\n * @return {number} the 1-based position from the top of the stack where the\n * object is located; the return value -1 indicates that the object is\n * not on the stack.\n */\n search(o) {\n return this.array.indexOf(o)\n }\n\n /**\n * @return {number}\n */\n size() {\n return this.array.length\n }\n\n /**\n * @return {Array}\n */\n toArray() {\n return this.array.slice()\n }\n}\n","import Position from '../../geomgraph/Position.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Assert from '../../util/Assert.js'\nexport default class RightmostEdgeFinder {\n constructor() {\n RightmostEdgeFinder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._minIndex = -1\n this._minCoord = null\n this._minDe = null\n this._orientedDe = null\n }\n getCoordinate() {\n return this._minCoord\n }\n getRightmostSide(de, index) {\n let side = this.getRightmostSideOfSegment(de, index)\n if (side < 0) side = this.getRightmostSideOfSegment(de, index - 1)\n if (side < 0) {\n this._minCoord = null\n this.checkForRightmostCoordinate(de)\n }\n return side\n }\n findRightmostEdgeAtVertex() {\n const pts = this._minDe.getEdge().getCoordinates()\n Assert.isTrue(this._minIndex > 0 && this._minIndex < pts.length, 'rightmost point expected to be interior vertex of edge')\n const pPrev = pts[this._minIndex - 1]\n const pNext = pts[this._minIndex + 1]\n const orientation = Orientation.index(this._minCoord, pNext, pPrev)\n let usePrev = false\n if (pPrev.y < this._minCoord.y && pNext.y < this._minCoord.y && orientation === Orientation.COUNTERCLOCKWISE) \n usePrev = true\n else if (pPrev.y > this._minCoord.y && pNext.y > this._minCoord.y && orientation === Orientation.CLOCKWISE) \n usePrev = true\n \n if (usePrev) \n this._minIndex = this._minIndex - 1\n \n }\n getRightmostSideOfSegment(de, i) {\n const e = de.getEdge()\n const coord = e.getCoordinates()\n if (i < 0 || i + 1 >= coord.length) return -1\n if (coord[i].y === coord[i + 1].y) return -1\n let pos = Position.LEFT\n if (coord[i].y < coord[i + 1].y) pos = Position.RIGHT\n return pos\n }\n getEdge() {\n return this._orientedDe\n }\n checkForRightmostCoordinate(de) {\n const coord = de.getEdge().getCoordinates()\n for (let i = 0; i < coord.length - 1; i++) \n if (this._minCoord === null || coord[i].x > this._minCoord.x) {\n this._minDe = de\n this._minIndex = i\n this._minCoord = coord[i]\n }\n \n }\n findRightmostEdgeAtNode() {\n const node = this._minDe.getNode()\n const star = node.getEdges()\n this._minDe = star.getRightmostEdge()\n if (!this._minDe.isForward()) {\n this._minDe = this._minDe.getSym()\n this._minIndex = this._minDe.getEdge().getCoordinates().length - 1\n }\n }\n findEdge(dirEdgeList) {\n for (let i = dirEdgeList.iterator(); i.hasNext(); ) {\n const de = i.next()\n if (!de.isForward()) continue\n this.checkForRightmostCoordinate(de)\n }\n Assert.isTrue(this._minIndex !== 0 || this._minCoord.equals(this._minDe.getCoordinate()), 'inconsistency in rightmost processing')\n if (this._minIndex === 0) \n this.findRightmostEdgeAtNode()\n else \n this.findRightmostEdgeAtVertex()\n \n this._orientedDe = this._minDe\n const rightmostSide = this.getRightmostSide(this._minDe, this._minIndex)\n if (rightmostSide === Position.LEFT) \n this._orientedDe = this._minDe.getSym()\n \n }\n}\n","import Coordinate from './Coordinate.js'\nimport RuntimeException from '../../../../java/lang/RuntimeException.js'\n\nexport default class TopologyException extends RuntimeException {\n constructor(msg, pt) {\n super(pt ? msg + ' [ ' + pt + ' ]' : msg)\n this.pt = pt ? new Coordinate(pt) : undefined\n this.name = Object.keys({ TopologyException })[0]\n }\n getCoordinate() {\n return this.pt\n }\n}\n","export default class LinkedList {\n constructor() {\n this.array = []\n }\n\n addLast(e) {\n this.array.push(e)\n }\n\n removeFirst() {\n return this.array.shift()\n }\n\n isEmpty() {\n return this.array.length === 0\n }\n}\n","import HashSet from '../../../../../java/util/HashSet.js'\nimport Position from '../../geomgraph/Position.js'\nimport Stack from '../../../../../java/util/Stack.js'\nimport RightmostEdgeFinder from './RightmostEdgeFinder.js'\nimport TopologyException from '../../geom/TopologyException.js'\nimport LinkedList from '../../../../../java/util/LinkedList.js'\nimport Comparable from '../../../../../java/lang/Comparable.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Envelope from '../../geom/Envelope.js'\nexport default class BufferSubgraph {\n constructor() {\n BufferSubgraph.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._finder = null\n this._dirEdgeList = new ArrayList()\n this._nodes = new ArrayList()\n this._rightMostCoord = null\n this._env = null\n this._finder = new RightmostEdgeFinder()\n }\n clearVisitedEdges() {\n for (let it = this._dirEdgeList.iterator(); it.hasNext(); ) {\n const de = it.next()\n de.setVisited(false)\n }\n }\n getRightmostCoordinate() {\n return this._rightMostCoord\n }\n computeNodeDepth(n) {\n let startEdge = null\n for (let i = n.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n if (de.isVisited() || de.getSym().isVisited()) {\n startEdge = de\n break\n }\n }\n if (startEdge === null) throw new TopologyException('unable to find edge to compute depths at ' + n.getCoordinate())\n n.getEdges().computeDepths(startEdge)\n for (let i = n.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n de.setVisited(true)\n this.copySymDepths(de)\n }\n }\n computeDepth(outsideDepth) {\n this.clearVisitedEdges()\n const de = this._finder.getEdge()\n const n = de.getNode()\n const label = de.getLabel()\n de.setEdgeDepths(Position.RIGHT, outsideDepth)\n this.copySymDepths(de)\n this.computeDepths(de)\n }\n create(node) {\n this.addReachable(node)\n this._finder.findEdge(this._dirEdgeList)\n this._rightMostCoord = this._finder.getCoordinate()\n }\n findResultEdges() {\n for (let it = this._dirEdgeList.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.getDepth(Position.RIGHT) >= 1 && de.getDepth(Position.LEFT) <= 0 && !de.isInteriorAreaEdge()) \n de.setInResult(true)\n \n }\n }\n computeDepths(startEdge) {\n const nodesVisited = new HashSet()\n const nodeQueue = new LinkedList()\n const startNode = startEdge.getNode()\n nodeQueue.addLast(startNode)\n nodesVisited.add(startNode)\n startEdge.setVisited(true)\n while (!nodeQueue.isEmpty()) {\n const n = nodeQueue.removeFirst()\n nodesVisited.add(n)\n this.computeNodeDepth(n)\n for (let i = n.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n const sym = de.getSym()\n if (sym.isVisited()) continue\n const adjNode = sym.getNode()\n if (!nodesVisited.contains(adjNode)) {\n nodeQueue.addLast(adjNode)\n nodesVisited.add(adjNode)\n }\n }\n }\n }\n compareTo(o) {\n const graph = o\n if (this._rightMostCoord.x < graph._rightMostCoord.x) \n return -1\n \n if (this._rightMostCoord.x > graph._rightMostCoord.x) \n return 1\n \n return 0\n }\n getEnvelope() {\n if (this._env === null) {\n const edgeEnv = new Envelope()\n for (let it = this._dirEdgeList.iterator(); it.hasNext(); ) {\n const dirEdge = it.next()\n const pts = dirEdge.getEdge().getCoordinates()\n for (let i = 0; i < pts.length - 1; i++) \n edgeEnv.expandToInclude(pts[i])\n \n }\n this._env = edgeEnv\n }\n return this._env\n }\n addReachable(startNode) {\n const nodeStack = new Stack()\n nodeStack.add(startNode)\n while (!nodeStack.empty()) {\n const node = nodeStack.pop()\n this.add(node, nodeStack)\n }\n }\n copySymDepths(de) {\n const sym = de.getSym()\n sym.setDepth(Position.LEFT, de.getDepth(Position.RIGHT))\n sym.setDepth(Position.RIGHT, de.getDepth(Position.LEFT))\n }\n add(node, nodeStack) {\n node.setVisited(true)\n this._nodes.add(node)\n for (let i = node.getEdges().iterator(); i.hasNext(); ) {\n const de = i.next()\n this._dirEdgeList.add(de)\n const sym = de.getSym()\n const symNode = sym.getNode()\n if (!symNode.isVisited()) nodeStack.push(symNode)\n }\n }\n getNodes() {\n return this._nodes\n }\n getDirectedEdges() {\n return this._dirEdgeList\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nexport default class Intersection {\n static intersection(p1, p2, q1, q2) {\n const minX0 = p1.x < p2.x ? p1.x : p2.x\n const minY0 = p1.y < p2.y ? p1.y : p2.y\n const maxX0 = p1.x > p2.x ? p1.x : p2.x\n const maxY0 = p1.y > p2.y ? p1.y : p2.y\n const minX1 = q1.x < q2.x ? q1.x : q2.x\n const minY1 = q1.y < q2.y ? q1.y : q2.y\n const maxX1 = q1.x > q2.x ? q1.x : q2.x\n const maxY1 = q1.y > q2.y ? q1.y : q2.y\n const intMinX = minX0 > minX1 ? minX0 : minX1\n const intMaxX = maxX0 < maxX1 ? maxX0 : maxX1\n const intMinY = minY0 > minY1 ? minY0 : minY1\n const intMaxY = maxY0 < maxY1 ? maxY0 : maxY1\n const midx = (intMinX + intMaxX) / 2.0\n const midy = (intMinY + intMaxY) / 2.0\n const p1x = p1.x - midx\n const p1y = p1.y - midy\n const p2x = p2.x - midx\n const p2y = p2.y - midy\n const q1x = q1.x - midx\n const q1y = q1.y - midy\n const q2x = q2.x - midx\n const q2y = q2.y - midy\n const px = p1y - p2y\n const py = p2x - p1x\n const pw = p1x * p2y - p2x * p1y\n const qx = q1y - q2y\n const qy = q2x - q1x\n const qw = q1x * q2y - q2x * q1y\n const x = py * qw - qy * pw\n const y = qx * pw - px * qw\n const w = px * qy - qx * py\n const xInt = x / w\n const yInt = y / w\n if (Double.isNaN(xInt) || (Double.isInfinite(xInt) || Double.isNaN(yInt)) || Double.isInfinite(yInt)) \n return null\n \n return new Coordinate(xInt + midx, yInt + midy)\n }\n}\n","import IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport MathUtil from '../math/MathUtil.js'\nimport Envelope from '../geom/Envelope.js'\nexport default class Distance {\n static segmentToSegment(A, B, C, D) {\n if (A.equals(B)) return Distance.pointToSegment(A, C, D)\n if (C.equals(D)) return Distance.pointToSegment(D, A, B)\n let noIntersection = false\n if (!Envelope.intersects(A, B, C, D)) {\n noIntersection = true\n } else {\n const denom = (B.x - A.x) * (D.y - C.y) - (B.y - A.y) * (D.x - C.x)\n if (denom === 0) {\n noIntersection = true\n } else {\n const r_num = (A.y - C.y) * (D.x - C.x) - (A.x - C.x) * (D.y - C.y)\n const s_num = (A.y - C.y) * (B.x - A.x) - (A.x - C.x) * (B.y - A.y)\n const s = s_num / denom\n const r = r_num / denom\n if (r < 0 || r > 1 || s < 0 || s > 1) \n noIntersection = true\n \n }\n }\n if (noIntersection) \n return MathUtil.min(Distance.pointToSegment(A, C, D), Distance.pointToSegment(B, C, D), Distance.pointToSegment(C, A, B), Distance.pointToSegment(D, A, B))\n \n return 0.0\n }\n static pointToSegment(p, A, B) {\n if (A.x === B.x && A.y === B.y) return p.distance(A)\n const len2 = (B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)\n const r = ((p.x - A.x) * (B.x - A.x) + (p.y - A.y) * (B.y - A.y)) / len2\n if (r <= 0.0) return p.distance(A)\n if (r >= 1.0) return p.distance(B)\n const s = ((A.y - p.y) * (B.x - A.x) - (A.x - p.x) * (B.y - A.y)) / len2\n return Math.abs(s) * Math.sqrt(len2)\n }\n static pointToLinePerpendicular(p, A, B) {\n const len2 = (B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)\n const s = ((A.y - p.y) * (B.x - A.x) - (A.x - p.x) * (B.y - A.y)) / len2\n return Math.abs(s) * Math.sqrt(len2)\n }\n static pointToSegmentString(p, line) {\n if (line.length === 0) throw new IllegalArgumentException('Line array must contain at least one vertex')\n let minDistance = p.distance(line[0])\n for (let i = 0; i < line.length - 1; i++) {\n const dist = Distance.pointToSegment(p, line[i], line[i + 1])\n if (dist < minDistance) \n minDistance = dist\n \n }\n return minDistance\n }\n}\n","import WKTWriter from '../io/WKTWriter.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Assert from '../util/Assert.js'\nimport StringBuilder from '../../../../java/lang/StringBuilder.js'\nexport default class LineIntersector {\n constructor() {\n LineIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._result = null\n this._inputLines = Array(2).fill().map(() => Array(2))\n this._intPt = new Array(2).fill(null)\n this._intLineIndex = null\n this._isProper = null\n this._pa = null\n this._pb = null\n this._precisionModel = null\n this._intPt[0] = new Coordinate()\n this._intPt[1] = new Coordinate()\n this._pa = this._intPt[0]\n this._pb = this._intPt[1]\n this._result = 0\n }\n static computeEdgeDistance(p, p0, p1) {\n const dx = Math.abs(p1.x - p0.x)\n const dy = Math.abs(p1.y - p0.y)\n let dist = -1.0\n if (p.equals(p0)) {\n dist = 0.0\n } else if (p.equals(p1)) {\n if (dx > dy) dist = dx; else dist = dy\n } else {\n const pdx = Math.abs(p.x - p0.x)\n const pdy = Math.abs(p.y - p0.y)\n if (dx > dy) dist = pdx; else dist = pdy\n if (dist === 0.0 && !p.equals(p0)) \n dist = Math.max(pdx, pdy)\n \n }\n Assert.isTrue(!(dist === 0.0 && !p.equals(p0)), 'Bad distance calculation')\n return dist\n }\n static nonRobustComputeEdgeDistance(p, p1, p2) {\n const dx = p.x - p1.x\n const dy = p.y - p1.y\n const dist = Math.sqrt(dx * dx + dy * dy)\n Assert.isTrue(!(dist === 0.0 && !p.equals(p1)), 'Invalid distance calculation')\n return dist\n }\n getIndexAlongSegment(segmentIndex, intIndex) {\n this.computeIntLineIndex()\n return this._intLineIndex[segmentIndex][intIndex]\n }\n getTopologySummary() {\n const catBuilder = new StringBuilder()\n if (this.isEndPoint()) catBuilder.append(' endpoint')\n if (this._isProper) catBuilder.append(' proper')\n if (this.isCollinear()) catBuilder.append(' collinear')\n return catBuilder.toString()\n }\n computeIntersection(p1, p2, p3, p4) {\n this._inputLines[0][0] = p1\n this._inputLines[0][1] = p2\n this._inputLines[1][0] = p3\n this._inputLines[1][1] = p4\n this._result = this.computeIntersect(p1, p2, p3, p4)\n }\n getIntersectionNum() {\n return this._result\n }\n computeIntLineIndex() {\n if (arguments.length === 0) {\n if (this._intLineIndex === null) {\n this._intLineIndex = Array(2).fill().map(() => Array(2))\n this.computeIntLineIndex(0)\n this.computeIntLineIndex(1)\n }\n } else if (arguments.length === 1) {\n const segmentIndex = arguments[0]\n const dist0 = this.getEdgeDistance(segmentIndex, 0)\n const dist1 = this.getEdgeDistance(segmentIndex, 1)\n if (dist0 > dist1) {\n this._intLineIndex[segmentIndex][0] = 0\n this._intLineIndex[segmentIndex][1] = 1\n } else {\n this._intLineIndex[segmentIndex][0] = 1\n this._intLineIndex[segmentIndex][1] = 0\n }\n }\n }\n isProper() {\n return this.hasIntersection() && this._isProper\n }\n setPrecisionModel(precisionModel) {\n this._precisionModel = precisionModel\n }\n isInteriorIntersection() {\n if (arguments.length === 0) {\n if (this.isInteriorIntersection(0)) return true\n if (this.isInteriorIntersection(1)) return true\n return false\n } else if (arguments.length === 1) {\n const inputLineIndex = arguments[0]\n for (let i = 0; i < this._result; i++) \n if (!(this._intPt[i].equals2D(this._inputLines[inputLineIndex][0]) || this._intPt[i].equals2D(this._inputLines[inputLineIndex][1]))) \n return true\n \n \n return false\n }\n }\n getIntersection(intIndex) {\n return this._intPt[intIndex]\n }\n isEndPoint() {\n return this.hasIntersection() && !this._isProper\n }\n hasIntersection() {\n return this._result !== LineIntersector.NO_INTERSECTION\n }\n getEdgeDistance(segmentIndex, intIndex) {\n const dist = LineIntersector.computeEdgeDistance(this._intPt[intIndex], this._inputLines[segmentIndex][0], this._inputLines[segmentIndex][1])\n return dist\n }\n isCollinear() {\n return this._result === LineIntersector.COLLINEAR_INTERSECTION\n }\n toString() {\n return WKTWriter.toLineString(this._inputLines[0][0], this._inputLines[0][1]) + ' - ' + WKTWriter.toLineString(this._inputLines[1][0], this._inputLines[1][1]) + this.getTopologySummary()\n }\n getEndpoint(segmentIndex, ptIndex) {\n return this._inputLines[segmentIndex][ptIndex]\n }\n isIntersection(pt) {\n for (let i = 0; i < this._result; i++) \n if (this._intPt[i].equals2D(pt)) \n return true\n \n \n return false\n }\n getIntersectionAlongSegment(segmentIndex, intIndex) {\n this.computeIntLineIndex()\n return this._intPt[this._intLineIndex[segmentIndex][intIndex]]\n }\n}\nLineIntersector.DONT_INTERSECT = 0\nLineIntersector.DO_INTERSECT = 1\nLineIntersector.COLLINEAR = 2\nLineIntersector.NO_INTERSECTION = 0\nLineIntersector.POINT_INTERSECTION = 1\nLineIntersector.COLLINEAR_INTERSECTION = 2\n","import Coordinate from '../geom/Coordinate.js'\nimport Orientation from './Orientation.js'\nimport Intersection from './Intersection.js'\nimport CGAlgorithmsDD from './CGAlgorithmsDD.js'\nimport System from '../../../../java/lang/System.js'\nimport Envelope from '../geom/Envelope.js'\nimport Distance from './Distance.js'\nimport LineIntersector from './LineIntersector.js'\nexport default class RobustLineIntersector extends LineIntersector {\n constructor() {\n super()\n }\n static nearestEndpoint(p1, p2, q1, q2) {\n let nearestPt = p1\n let minDist = Distance.pointToSegment(p1, q1, q2)\n let dist = Distance.pointToSegment(p2, q1, q2)\n if (dist < minDist) {\n minDist = dist\n nearestPt = p2\n }\n dist = Distance.pointToSegment(q1, p1, p2)\n if (dist < minDist) {\n minDist = dist\n nearestPt = q1\n }\n dist = Distance.pointToSegment(q2, p1, p2)\n if (dist < minDist) {\n minDist = dist\n nearestPt = q2\n }\n return nearestPt\n }\n isInSegmentEnvelopes(intPt) {\n const env0 = new Envelope(this._inputLines[0][0], this._inputLines[0][1])\n const env1 = new Envelope(this._inputLines[1][0], this._inputLines[1][1])\n return env0.contains(intPt) && env1.contains(intPt)\n }\n computeIntersection() {\n if (arguments.length === 3) {\n const p = arguments[0], p1 = arguments[1], p2 = arguments[2]\n this._isProper = false\n if (Envelope.intersects(p1, p2, p)) \n if (Orientation.index(p1, p2, p) === 0 && Orientation.index(p2, p1, p) === 0) {\n this._isProper = true\n if (p.equals(p1) || p.equals(p2)) \n this._isProper = false\n \n this._result = LineIntersector.POINT_INTERSECTION\n return null\n }\n \n this._result = LineIntersector.NO_INTERSECTION\n } else {\n return super.computeIntersection.apply(this, arguments)\n }\n }\n intersection(p1, p2, q1, q2) {\n let intPt = this.intersectionSafe(p1, p2, q1, q2)\n if (!this.isInSegmentEnvelopes(intPt)) \n intPt = new Coordinate(RobustLineIntersector.nearestEndpoint(p1, p2, q1, q2))\n \n if (this._precisionModel !== null) \n this._precisionModel.makePrecise(intPt)\n \n return intPt\n }\n checkDD(p1, p2, q1, q2, intPt) {\n const intPtDD = CGAlgorithmsDD.intersection(p1, p2, q1, q2)\n const isIn = this.isInSegmentEnvelopes(intPtDD)\n System.out.println('DD in env = ' + isIn + ' --------------------- ' + intPtDD)\n if (intPt.distance(intPtDD) > 0.0001) \n System.out.println('Distance = ' + intPt.distance(intPtDD))\n \n }\n intersectionSafe(p1, p2, q1, q2) {\n let intPt = Intersection.intersection(p1, p2, q1, q2)\n if (intPt === null) intPt = RobustLineIntersector.nearestEndpoint(p1, p2, q1, q2)\n return intPt\n }\n computeCollinearIntersection(p1, p2, q1, q2) {\n const p1q1p2 = Envelope.intersects(p1, p2, q1)\n const p1q2p2 = Envelope.intersects(p1, p2, q2)\n const q1p1q2 = Envelope.intersects(q1, q2, p1)\n const q1p2q2 = Envelope.intersects(q1, q2, p2)\n if (p1q1p2 && p1q2p2) {\n this._intPt[0] = q1\n this._intPt[1] = q2\n return LineIntersector.COLLINEAR_INTERSECTION\n }\n if (q1p1q2 && q1p2q2) {\n this._intPt[0] = p1\n this._intPt[1] = p2\n return LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q1p2 && q1p1q2) {\n this._intPt[0] = q1\n this._intPt[1] = p1\n return q1.equals(p1) && !p1q2p2 && !q1p2q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q1p2 && q1p2q2) {\n this._intPt[0] = q1\n this._intPt[1] = p2\n return q1.equals(p2) && !p1q2p2 && !q1p1q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q2p2 && q1p1q2) {\n this._intPt[0] = q2\n this._intPt[1] = p1\n return q2.equals(p1) && !p1q1p2 && !q1p2q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n if (p1q2p2 && q1p2q2) {\n this._intPt[0] = q2\n this._intPt[1] = p2\n return q2.equals(p2) && !p1q1p2 && !q1p1q2 ? LineIntersector.POINT_INTERSECTION : LineIntersector.COLLINEAR_INTERSECTION\n }\n return LineIntersector.NO_INTERSECTION\n }\n computeIntersect(p1, p2, q1, q2) {\n this._isProper = false\n if (!Envelope.intersects(p1, p2, q1, q2)) return LineIntersector.NO_INTERSECTION\n const Pq1 = Orientation.index(p1, p2, q1)\n const Pq2 = Orientation.index(p1, p2, q2)\n if (Pq1 > 0 && Pq2 > 0 || Pq1 < 0 && Pq2 < 0) \n return LineIntersector.NO_INTERSECTION\n \n const Qp1 = Orientation.index(q1, q2, p1)\n const Qp2 = Orientation.index(q1, q2, p2)\n if (Qp1 > 0 && Qp2 > 0 || Qp1 < 0 && Qp2 < 0) \n return LineIntersector.NO_INTERSECTION\n \n const collinear = Pq1 === 0 && Pq2 === 0 && Qp1 === 0 && Qp2 === 0\n if (collinear) \n return this.computeCollinearIntersection(p1, p2, q1, q2)\n \n if (Pq1 === 0 || Pq2 === 0 || Qp1 === 0 || Qp2 === 0) {\n this._isProper = false\n if (p1.equals2D(q1) || p1.equals2D(q2)) \n this._intPt[0] = p1\n else if (p2.equals2D(q1) || p2.equals2D(q2)) \n this._intPt[0] = p2\n else if (Pq1 === 0) \n this._intPt[0] = new Coordinate(q1)\n else if (Pq2 === 0) \n this._intPt[0] = new Coordinate(q2)\n else if (Qp1 === 0) \n this._intPt[0] = new Coordinate(p1)\n else if (Qp2 === 0) \n this._intPt[0] = new Coordinate(p2)\n \n } else {\n this._isProper = true\n this._intPt[0] = this.intersection(p1, p2, q1, q2)\n }\n return LineIntersector.POINT_INTERSECTION\n }\n}\n","import Location from '../geom/Location.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Orientation from './Orientation.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nexport default class RayCrossingCounter {\n constructor() {\n RayCrossingCounter.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._p = null\n this._crossingCount = 0\n this._isPointOnSegment = false\n const p = arguments[0]\n this._p = p\n }\n static locatePointInRing() {\n if (arguments[0] instanceof Coordinate && hasInterface(arguments[1], CoordinateSequence)) {\n const p = arguments[0], ring = arguments[1]\n const counter = new RayCrossingCounter(p)\n const p1 = new Coordinate()\n const p2 = new Coordinate()\n for (let i = 1; i < ring.size(); i++) {\n ring.getCoordinate(i, p1)\n ring.getCoordinate(i - 1, p2)\n counter.countSegment(p1, p2)\n if (counter.isOnSegment()) return counter.getLocation()\n }\n return counter.getLocation()\n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Array) {\n const p = arguments[0], ring = arguments[1]\n const counter = new RayCrossingCounter(p)\n for (let i = 1; i < ring.length; i++) {\n const p1 = ring[i]\n const p2 = ring[i - 1]\n counter.countSegment(p1, p2)\n if (counter.isOnSegment()) return counter.getLocation()\n }\n return counter.getLocation()\n }\n }\n countSegment(p1, p2) {\n if (p1.x < this._p.x && p2.x < this._p.x) return null\n if (this._p.x === p2.x && this._p.y === p2.y) {\n this._isPointOnSegment = true\n return null\n }\n if (p1.y === this._p.y && p2.y === this._p.y) {\n let minx = p1.x\n let maxx = p2.x\n if (minx > maxx) {\n minx = p2.x\n maxx = p1.x\n }\n if (this._p.x >= minx && this._p.x <= maxx) \n this._isPointOnSegment = true\n \n return null\n }\n if (p1.y > this._p.y && p2.y <= this._p.y || p2.y > this._p.y && p1.y <= this._p.y) {\n let orient = Orientation.index(p1, p2, this._p)\n if (orient === Orientation.COLLINEAR) {\n this._isPointOnSegment = true\n return null\n }\n if (p2.y < p1.y) \n orient = -orient\n \n if (orient === Orientation.LEFT) \n this._crossingCount++\n \n }\n }\n isPointInPolygon() {\n return this.getLocation() !== Location.EXTERIOR\n }\n getLocation() {\n if (this._isPointOnSegment) return Location.BOUNDARY\n if (this._crossingCount % 2 === 1) \n return Location.INTERIOR\n \n return Location.EXTERIOR\n }\n isOnSegment() {\n return this._isPointOnSegment\n }\n}\n","import Location from '../geom/Location.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport CoordinateSequence from '../geom/CoordinateSequence.js'\nimport RobustLineIntersector from './RobustLineIntersector.js'\nimport RayCrossingCounter from './RayCrossingCounter.js'\nexport default class PointLocation {\n static isOnLine() {\n if (arguments[0] instanceof Coordinate && hasInterface(arguments[1], CoordinateSequence)) {\n const p = arguments[0], line = arguments[1]\n const lineIntersector = new RobustLineIntersector()\n const p0 = new Coordinate()\n const p1 = new Coordinate()\n const n = line.size()\n for (let i = 1; i < n; i++) {\n line.getCoordinate(i - 1, p0)\n line.getCoordinate(i, p1)\n lineIntersector.computeIntersection(p, p0, p1)\n if (lineIntersector.hasIntersection()) \n return true\n \n }\n return false\n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Array) {\n const p = arguments[0], line = arguments[1]\n const lineIntersector = new RobustLineIntersector()\n for (let i = 1; i < line.length; i++) {\n const p0 = line[i - 1]\n const p1 = line[i]\n lineIntersector.computeIntersection(p, p0, p1)\n if (lineIntersector.hasIntersection()) \n return true\n \n }\n return false\n }\n }\n static locateInRing(p, ring) {\n return RayCrossingCounter.locatePointInRing(p, ring)\n }\n static isInRing(p, ring) {\n return PointLocation.locateInRing(p, ring) !== Location.EXTERIOR\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Location from '../geom/Location.js'\nimport Position from './Position.js'\nexport default class TopologyLocation {\n constructor() {\n TopologyLocation.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.location = null\n if (arguments.length === 1) {\n if (arguments[0] instanceof Array) {\n const location = arguments[0]\n this.init(location.length)\n } else if (Number.isInteger(arguments[0])) {\n const on = arguments[0]\n this.init(1)\n this.location[Position.ON] = on\n } else if (arguments[0] instanceof TopologyLocation) {\n const gl = arguments[0]\n this.init(gl.location.length)\n if (gl !== null) \n for (let i = 0; i < this.location.length; i++) \n this.location[i] = gl.location[i]\n \n \n }\n } else if (arguments.length === 3) {\n const on = arguments[0], left = arguments[1], right = arguments[2]\n this.init(3)\n this.location[Position.ON] = on\n this.location[Position.LEFT] = left\n this.location[Position.RIGHT] = right\n }\n }\n setAllLocations(locValue) {\n for (let i = 0; i < this.location.length; i++) \n this.location[i] = locValue\n \n }\n isNull() {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] !== Location.NONE) return false\n \n return true\n }\n setAllLocationsIfNull(locValue) {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] === Location.NONE) this.location[i] = locValue\n \n }\n isLine() {\n return this.location.length === 1\n }\n merge(gl) {\n if (gl.location.length > this.location.length) {\n const newLoc = new Array(3).fill(null)\n newLoc[Position.ON] = this.location[Position.ON]\n newLoc[Position.LEFT] = Location.NONE\n newLoc[Position.RIGHT] = Location.NONE\n this.location = newLoc\n }\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] === Location.NONE && i < gl.location.length) this.location[i] = gl.location[i]\n \n }\n getLocations() {\n return this.location\n }\n flip() {\n if (this.location.length <= 1) return null\n const temp = this.location[Position.LEFT]\n this.location[Position.LEFT] = this.location[Position.RIGHT]\n this.location[Position.RIGHT] = temp\n }\n toString() {\n const buf = new StringBuffer()\n if (this.location.length > 1) buf.append(Location.toLocationSymbol(this.location[Position.LEFT]))\n buf.append(Location.toLocationSymbol(this.location[Position.ON]))\n if (this.location.length > 1) buf.append(Location.toLocationSymbol(this.location[Position.RIGHT]))\n return buf.toString()\n }\n setLocations(on, left, right) {\n this.location[Position.ON] = on\n this.location[Position.LEFT] = left\n this.location[Position.RIGHT] = right\n }\n get(posIndex) {\n if (posIndex < this.location.length) return this.location[posIndex]\n return Location.NONE\n }\n isArea() {\n return this.location.length > 1\n }\n isAnyNull() {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] === Location.NONE) return true\n \n return false\n }\n setLocation() {\n if (arguments.length === 1) {\n const locValue = arguments[0]\n this.setLocation(Position.ON, locValue)\n } else if (arguments.length === 2) {\n const locIndex = arguments[0], locValue = arguments[1]\n this.location[locIndex] = locValue\n }\n }\n init(size) {\n this.location = new Array(size).fill(null)\n this.setAllLocations(Location.NONE)\n }\n isEqualOnSide(le, locIndex) {\n return this.location[locIndex] === le.location[locIndex]\n }\n allPositionsEqual(loc) {\n for (let i = 0; i < this.location.length; i++) \n if (this.location[i] !== loc) return false\n \n return true\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport TopologyLocation from './TopologyLocation.js'\nexport default class Label {\n constructor() {\n Label.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.elt = new Array(2).fill(null)\n if (arguments.length === 1) {\n if (Number.isInteger(arguments[0])) {\n const onLoc = arguments[0]\n this.elt[0] = new TopologyLocation(onLoc)\n this.elt[1] = new TopologyLocation(onLoc)\n } else if (arguments[0] instanceof Label) {\n const lbl = arguments[0]\n this.elt[0] = new TopologyLocation(lbl.elt[0])\n this.elt[1] = new TopologyLocation(lbl.elt[1])\n }\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], onLoc = arguments[1]\n this.elt[0] = new TopologyLocation(Location.NONE)\n this.elt[1] = new TopologyLocation(Location.NONE)\n this.elt[geomIndex].setLocation(onLoc)\n } else if (arguments.length === 3) {\n const onLoc = arguments[0], leftLoc = arguments[1], rightLoc = arguments[2]\n this.elt[0] = new TopologyLocation(onLoc, leftLoc, rightLoc)\n this.elt[1] = new TopologyLocation(onLoc, leftLoc, rightLoc)\n } else if (arguments.length === 4) {\n const geomIndex = arguments[0], onLoc = arguments[1], leftLoc = arguments[2], rightLoc = arguments[3]\n this.elt[0] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE)\n this.elt[1] = new TopologyLocation(Location.NONE, Location.NONE, Location.NONE)\n this.elt[geomIndex].setLocations(onLoc, leftLoc, rightLoc)\n }\n }\n static toLineLabel(label) {\n const lineLabel = new Label(Location.NONE)\n for (let i = 0; i < 2; i++) \n lineLabel.setLocation(i, label.getLocation(i))\n \n return lineLabel\n }\n getGeometryCount() {\n let count = 0\n if (!this.elt[0].isNull()) count++\n if (!this.elt[1].isNull()) count++\n return count\n }\n setAllLocations(geomIndex, location) {\n this.elt[geomIndex].setAllLocations(location)\n }\n isNull(geomIndex) {\n return this.elt[geomIndex].isNull()\n }\n setAllLocationsIfNull() {\n if (arguments.length === 1) {\n const location = arguments[0]\n this.setAllLocationsIfNull(0, location)\n this.setAllLocationsIfNull(1, location)\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], location = arguments[1]\n this.elt[geomIndex].setAllLocationsIfNull(location)\n }\n }\n isLine(geomIndex) {\n return this.elt[geomIndex].isLine()\n }\n merge(lbl) {\n for (let i = 0; i < 2; i++) \n if (this.elt[i] === null && lbl.elt[i] !== null) \n this.elt[i] = new TopologyLocation(lbl.elt[i])\n else \n this.elt[i].merge(lbl.elt[i])\n \n \n }\n flip() {\n this.elt[0].flip()\n this.elt[1].flip()\n }\n getLocation() {\n if (arguments.length === 1) {\n const geomIndex = arguments[0]\n return this.elt[geomIndex].get(Position.ON)\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], posIndex = arguments[1]\n return this.elt[geomIndex].get(posIndex)\n }\n }\n toString() {\n const buf = new StringBuffer()\n if (this.elt[0] !== null) {\n buf.append('A:')\n buf.append(this.elt[0].toString())\n }\n if (this.elt[1] !== null) {\n buf.append(' B:')\n buf.append(this.elt[1].toString())\n }\n return buf.toString()\n }\n isArea() {\n if (arguments.length === 0) {\n return this.elt[0].isArea() || this.elt[1].isArea()\n } else if (arguments.length === 1) {\n const geomIndex = arguments[0]\n return this.elt[geomIndex].isArea()\n }\n }\n isAnyNull(geomIndex) {\n return this.elt[geomIndex].isAnyNull()\n }\n setLocation() {\n if (arguments.length === 2) {\n const geomIndex = arguments[0], location = arguments[1]\n this.elt[geomIndex].setLocation(Position.ON, location)\n } else if (arguments.length === 3) {\n const geomIndex = arguments[0], posIndex = arguments[1], location = arguments[2]\n this.elt[geomIndex].setLocation(posIndex, location)\n }\n }\n isEqualOnSide(lbl, side) {\n return this.elt[0].isEqualOnSide(lbl.elt[0], side) && this.elt[1].isEqualOnSide(lbl.elt[1], side)\n }\n allPositionsEqual(geomIndex, loc) {\n return this.elt[geomIndex].allPositionsEqual(loc)\n }\n toLine(geomIndex) {\n if (this.elt[geomIndex].isArea()) this.elt[geomIndex] = new TopologyLocation(this.elt[geomIndex].location[0])\n }\n}\n","import Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport PointLocation from '../algorithm/PointLocation.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport Label from './Label.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Assert from '../util/Assert.js'\nexport default class EdgeRing {\n constructor() {\n EdgeRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._startDe = null\n this._maxNodeDegree = -1\n this._edges = new ArrayList()\n this._pts = new ArrayList()\n this._label = new Label(Location.NONE)\n this._ring = null\n this._isHole = null\n this._shell = null\n this._holes = new ArrayList()\n this._geometryFactory = null\n if (arguments.length === 0) {} else if (arguments.length === 2) {\n const start = arguments[0], geometryFactory = arguments[1]\n this._geometryFactory = geometryFactory\n this.computePoints(start)\n this.computeRing()\n }\n }\n computeRing() {\n if (this._ring !== null) return null\n const coord = new Array(this._pts.size()).fill(null)\n for (let i = 0; i < this._pts.size(); i++) \n coord[i] = this._pts.get(i)\n \n this._ring = this._geometryFactory.createLinearRing(coord)\n this._isHole = Orientation.isCCW(this._ring.getCoordinates())\n }\n isIsolated() {\n return this._label.getGeometryCount() === 1\n }\n computePoints(start) {\n this._startDe = start\n let de = start\n let isFirstEdge = true\n do {\n if (de === null) throw new TopologyException('Found null DirectedEdge')\n if (de.getEdgeRing() === this) throw new TopologyException('Directed Edge visited twice during ring-building at ' + de.getCoordinate())\n this._edges.add(de)\n const label = de.getLabel()\n Assert.isTrue(label.isArea())\n this.mergeLabel(label)\n this.addPoints(de.getEdge(), de.isForward(), isFirstEdge)\n isFirstEdge = false\n this.setEdgeRing(de, this)\n de = this.getNext(de)\n } while (de !== this._startDe)\n }\n getLinearRing() {\n return this._ring\n }\n getCoordinate(i) {\n return this._pts.get(i)\n }\n computeMaxNodeDegree() {\n this._maxNodeDegree = 0\n let de = this._startDe\n do {\n const node = de.getNode()\n const degree = node.getEdges().getOutgoingDegree(this)\n if (degree > this._maxNodeDegree) this._maxNodeDegree = degree\n de = this.getNext(de)\n } while (de !== this._startDe)\n this._maxNodeDegree *= 2\n }\n addPoints(edge, isForward, isFirstEdge) {\n const edgePts = edge.getCoordinates()\n if (isForward) {\n let startIndex = 1\n if (isFirstEdge) startIndex = 0\n for (let i = startIndex; i < edgePts.length; i++) \n this._pts.add(edgePts[i])\n \n } else {\n let startIndex = edgePts.length - 2\n if (isFirstEdge) startIndex = edgePts.length - 1\n for (let i = startIndex; i >= 0; i--) \n this._pts.add(edgePts[i])\n \n }\n }\n isHole() {\n return this._isHole\n }\n setInResult() {\n let de = this._startDe\n do {\n de.getEdge().setInResult(true)\n de = de.getNext()\n } while (de !== this._startDe)\n }\n containsPoint(p) {\n const shell = this.getLinearRing()\n const env = shell.getEnvelopeInternal()\n if (!env.contains(p)) return false\n if (!PointLocation.isInRing(p, shell.getCoordinates())) return false\n for (let i = this._holes.iterator(); i.hasNext(); ) {\n const hole = i.next()\n if (hole.containsPoint(p)) return false\n }\n return true\n }\n addHole(ring) {\n this._holes.add(ring)\n }\n isShell() {\n return this._shell === null\n }\n getLabel() {\n return this._label\n }\n getEdges() {\n return this._edges\n }\n getMaxNodeDegree() {\n if (this._maxNodeDegree < 0) this.computeMaxNodeDegree()\n return this._maxNodeDegree\n }\n getShell() {\n return this._shell\n }\n mergeLabel() {\n if (arguments.length === 1) {\n const deLabel = arguments[0]\n this.mergeLabel(deLabel, 0)\n this.mergeLabel(deLabel, 1)\n } else if (arguments.length === 2) {\n const deLabel = arguments[0], geomIndex = arguments[1]\n const loc = deLabel.getLocation(geomIndex, Position.RIGHT)\n if (loc === Location.NONE) return null\n if (this._label.getLocation(geomIndex) === Location.NONE) {\n this._label.setLocation(geomIndex, loc)\n return null\n }\n }\n }\n setShell(shell) {\n this._shell = shell\n if (shell !== null) shell.addHole(this)\n }\n toPolygon(geometryFactory) {\n const holeLR = new Array(this._holes.size()).fill(null)\n for (let i = 0; i < this._holes.size(); i++) \n holeLR[i] = this._holes.get(i).getLinearRing()\n \n const poly = geometryFactory.createPolygon(this.getLinearRing(), holeLR)\n return poly\n }\n}\n","import EdgeRing from '../../geomgraph/EdgeRing.js'\nexport default class MinimalEdgeRing extends EdgeRing {\n constructor() {\n super()\n MinimalEdgeRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const start = arguments[0], geometryFactory = arguments[1]\n EdgeRing.constructor_.call(this, start, geometryFactory)\n }\n setEdgeRing(de, er) {\n de.setMinEdgeRing(er)\n }\n getNext(de) {\n return de.getNextMin()\n }\n}\n","import MinimalEdgeRing from './MinimalEdgeRing.js'\nimport EdgeRing from '../../geomgraph/EdgeRing.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class MaximalEdgeRing extends EdgeRing {\n constructor() {\n super()\n MaximalEdgeRing.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const start = arguments[0], geometryFactory = arguments[1]\n EdgeRing.constructor_.call(this, start, geometryFactory)\n }\n buildMinimalRings() {\n const minEdgeRings = new ArrayList()\n let de = this._startDe\n do {\n if (de.getMinEdgeRing() === null) {\n const minEr = new MinimalEdgeRing(de, this._geometryFactory)\n minEdgeRings.add(minEr)\n }\n de = de.getNext()\n } while (de !== this._startDe)\n return minEdgeRings\n }\n setEdgeRing(de, er) {\n de.setEdgeRing(er)\n }\n linkDirectedEdgesForMinimalEdgeRings() {\n let de = this._startDe\n do {\n const node = de.getNode()\n node.getEdges().linkMinimalDirectedEdges(this)\n de = de.getNext()\n } while (de !== this._startDe)\n }\n getNext(de) {\n return de.getNext()\n }\n}\n","import Assert from '../util/Assert.js'\nexport default class GraphComponent {\n constructor() {\n GraphComponent.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._label = null\n this._isInResult = false\n this._isCovered = false\n this._isCoveredSet = false\n this._isVisited = false\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const label = arguments[0]\n this._label = label\n }\n }\n setVisited(isVisited) {\n this._isVisited = isVisited\n }\n setInResult(isInResult) {\n this._isInResult = isInResult\n }\n isCovered() {\n return this._isCovered\n }\n isCoveredSet() {\n return this._isCoveredSet\n }\n setLabel(label) {\n this._label = label\n }\n getLabel() {\n return this._label\n }\n setCovered(isCovered) {\n this._isCovered = isCovered\n this._isCoveredSet = true\n }\n updateIM(im) {\n Assert.isTrue(this._label.getGeometryCount() >= 2, 'found partial label')\n this.computeIM(im)\n }\n isInResult() {\n return this._isInResult\n }\n isVisited() {\n return this._isVisited\n }\n}\n","import Location from '../geom/Location.js'\nimport Label from './Label.js'\nimport GraphComponent from './GraphComponent.js'\nexport default class Node extends GraphComponent {\n constructor() {\n super()\n Node.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._coord = null\n this._edges = null\n const coord = arguments[0], edges = arguments[1]\n this._coord = coord\n this._edges = edges\n this._label = new Label(0, Location.NONE)\n }\n isIncidentEdgeInResult() {\n for (let it = this.getEdges().getEdges().iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.getEdge().isInResult()) return true\n }\n return false\n }\n isIsolated() {\n return this._label.getGeometryCount() === 1\n }\n getCoordinate() {\n return this._coord\n }\n print(out) {\n out.println('node ' + this._coord + ' lbl: ' + this._label)\n }\n computeIM(im) {}\n computeMergedLocation(label2, eltIndex) {\n let loc = Location.NONE\n loc = this._label.getLocation(eltIndex)\n if (!label2.isNull(eltIndex)) {\n const nLoc = label2.getLocation(eltIndex)\n if (loc !== Location.BOUNDARY) loc = nLoc\n }\n return loc\n }\n setLabel() {\n if (arguments.length === 2 && (Number.isInteger(arguments[1]) && Number.isInteger(arguments[0]))) {\n const argIndex = arguments[0], onLocation = arguments[1]\n if (this._label === null) \n this._label = new Label(argIndex, onLocation)\n else this._label.setLocation(argIndex, onLocation)\n } else {\n return super.setLabel.apply(this, arguments)\n }\n }\n getEdges() {\n return this._edges\n }\n mergeLabel() {\n if (arguments[0] instanceof Node) {\n const n = arguments[0]\n this.mergeLabel(n._label)\n } else if (arguments[0] instanceof Label) {\n const label2 = arguments[0]\n for (let i = 0; i < 2; i++) {\n const loc = this.computeMergedLocation(label2, i)\n const thisLoc = this._label.getLocation(i)\n if (thisLoc === Location.NONE) this._label.setLocation(i, loc)\n }\n }\n }\n add(e) {\n this._edges.insert(e)\n e.setNode(this)\n }\n setLabelBoundary(argIndex) {\n if (this._label === null) return null\n let loc = Location.NONE\n if (this._label !== null) loc = this._label.getLocation(argIndex)\n let newLoc = null\n switch (loc) {\n case Location.BOUNDARY:\n newLoc = Location.INTERIOR\n break\n case Location.INTERIOR:\n newLoc = Location.BOUNDARY\n break\n default:\n newLoc = Location.BOUNDARY\n break\n }\n this._label.setLocation(argIndex, newLoc)\n }\n}\n","import Map from './Map.js'\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/SortedMap.html\n */\nexport default class SortedMap extends Map {}\n","import ArrayList from './ArrayList.js'\nimport SortedMap from './SortedMap.js'\nimport HashSet from './HashSet.js'\n\nconst BLACK = 0\nconst RED = 1\n\nfunction colorOf(p) {\n return (p == null ? BLACK : p.color)\n}\nfunction parentOf(p) {\n return (p == null ? null : p.parent)\n}\nfunction setColor(p, c) {\n if (p !== null) p.color = c\n}\nfunction leftOf(p) {\n return (p == null ? null : p.left)\n}\nfunction rightOf(p) {\n return (p == null ? null : p.right)\n}\n\n/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/TreeMap.html\n */\nexport default class TreeMap extends SortedMap {\n constructor() {\n super()\n this.root_ = null\n this.size_ = 0\n }\n\n get(key) {\n let p = this.root_\n while (p !== null) {\n const cmp = key.compareTo(p.key)\n if (cmp < 0)\n p = p.left\n else if (cmp > 0)\n p = p.right\n else return p.value\n }\n return null\n }\n\n put(key, value) {\n if (this.root_ === null) {\n this.root_ = {\n key: key,\n value: value,\n left: null,\n right: null,\n parent: null,\n color: BLACK,\n getValue() {\n return this.value\n },\n getKey() {\n return this.key\n }\n }\n this.size_ = 1\n return null\n }\n let t = this.root_; let parent; let cmp\n do {\n parent = t\n cmp = key.compareTo(t.key)\n if (cmp < 0) {\n t = t.left\n } else if (cmp > 0) {\n t = t.right\n } else {\n const oldValue = t.value\n t.value = value\n return oldValue\n }\n } while (t !== null)\n const e = {\n key: key,\n left: null,\n right: null,\n value: value,\n parent: parent,\n color: BLACK,\n getValue() {\n return this.value\n },\n getKey() {\n return this.key\n }\n }\n if (cmp < 0)\n parent.left = e\n else parent.right = e\n\n this.fixAfterInsertion(e)\n this.size_++\n return null\n }\n\n /**\n * @param {Object} x\n */\n fixAfterInsertion(x) {\n let y\n x.color = RED\n while (x != null && x !== this.root_ && x.parent.color === RED)\n if (parentOf(x) === leftOf(parentOf(parentOf(x)))) {\n y = rightOf(parentOf(parentOf(x)))\n if (colorOf(y) === RED) {\n setColor(parentOf(x), BLACK)\n setColor(y, BLACK)\n setColor(parentOf(parentOf(x)), RED)\n x = parentOf(parentOf(x))\n } else {\n if (x === rightOf(parentOf(x))) {\n x = parentOf(x)\n this.rotateLeft(x)\n }\n setColor(parentOf(x), BLACK)\n setColor(parentOf(parentOf(x)), RED)\n this.rotateRight(parentOf(parentOf(x)))\n }\n } else {\n y = leftOf(parentOf(parentOf(x)))\n if (colorOf(y) === RED) {\n setColor(parentOf(x), BLACK)\n setColor(y, BLACK)\n setColor(parentOf(parentOf(x)), RED)\n x = parentOf(parentOf(x))\n } else {\n if (x === leftOf(parentOf(x))) {\n x = parentOf(x)\n this.rotateRight(x)\n }\n setColor(parentOf(x), BLACK)\n setColor(parentOf(parentOf(x)), RED)\n this.rotateLeft(parentOf(parentOf(x)))\n }\n }\n\n this.root_.color = BLACK\n }\n\n values() {\n const arrayList = new ArrayList()\n let p = this.getFirstEntry()\n if (p !== null) {\n arrayList.add(p.value)\n while ((p = TreeMap.successor(p)) !== null)\n arrayList.add(p.value)\n }\n return arrayList\n }\n\n entrySet() {\n const hashSet = new HashSet()\n let p = this.getFirstEntry()\n if (p !== null) {\n hashSet.add(p)\n while ((p = TreeMap.successor(p)) !== null)\n hashSet.add(p)\n }\n return hashSet\n }\n\n /**\n * @param {Object} p\n */\n rotateLeft(p) {\n if (p != null) {\n const r = p.right\n p.right = r.left\n if (r.left != null)\n r.left.parent = p\n r.parent = p.parent\n if (p.parent == null)\n this.root_ = r\n else if (p.parent.left === p)\n p.parent.left = r\n else\n p.parent.right = r\n r.left = p\n p.parent = r\n }\n }\n\n /**\n * @param {Object} p\n */\n rotateRight(p) {\n if (p != null) {\n const l = p.left\n p.left = l.right\n if (l.right != null)\n l.right.parent = p\n l.parent = p.parent\n if (p.parent == null)\n this.root_ = l\n else if (p.parent.right === p)\n p.parent.right = l\n else\n p.parent.left = l\n l.right = p\n p.parent = l\n }\n }\n\n /**\n * @return {Object}\n */\n getFirstEntry() {\n let p = this.root_\n if (p != null)\n while (p.left != null) p = p.left\n return p\n }\n\n /**\n * @param {Object} t\n * @return {Object}\n * @private\n */\n static successor(t) {\n let p\n if (t === null) {\n return null\n } else if (t.right !== null) {\n p = t.right\n while (p.left !== null)\n p = p.left\n return p\n } else {\n p = t.parent\n let ch = t\n while (p !== null && ch === p.right) {\n ch = p\n p = p.parent\n }\n return p\n }\n }\n\n size() {\n return this.size_\n }\n\n containsKey(key) {\n let p = this.root_\n while (p !== null) {\n const cmp = key.compareTo(p.key)\n if (cmp < 0)\n p = p.left\n else if (cmp > 0)\n p = p.right\n else return true\n }\n return false\n }\n}\n","import Location from '../geom/Location.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Node from './Node.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class NodeMap {\n constructor() {\n NodeMap.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.nodeMap = new TreeMap()\n this.nodeFact = null\n const nodeFact = arguments[0]\n this.nodeFact = nodeFact\n }\n find(coord) {\n return this.nodeMap.get(coord)\n }\n addNode() {\n if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n let node = this.nodeMap.get(coord)\n if (node === null) {\n node = this.nodeFact.createNode(coord)\n this.nodeMap.put(coord, node)\n }\n return node\n } else if (arguments[0] instanceof Node) {\n const n = arguments[0]\n const node = this.nodeMap.get(n.getCoordinate())\n if (node === null) {\n this.nodeMap.put(n.getCoordinate(), n)\n return n\n }\n node.mergeLabel(n)\n return node\n }\n }\n print(out) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const n = it.next()\n n.print(out)\n }\n }\n iterator() {\n return this.nodeMap.values().iterator()\n }\n values() {\n return this.nodeMap.values()\n }\n getBoundaryNodes(geomIndex) {\n const bdyNodes = new ArrayList()\n for (let i = this.iterator(); i.hasNext(); ) {\n const node = i.next()\n if (node.getLabel().getLocation(geomIndex) === Location.BOUNDARY) bdyNodes.add(node)\n }\n return bdyNodes\n }\n add(e) {\n const p = e.getCoordinate()\n const n = this.addNode(p)\n n.add(e)\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class Quadrant {\n static isNorthern(quad) {\n return quad === Quadrant.NE || quad === Quadrant.NW\n }\n static isOpposite(quad1, quad2) {\n if (quad1 === quad2) return false\n const diff = (quad1 - quad2 + 4) % 4\n if (diff === 2) return true\n return false\n }\n static commonHalfPlane(quad1, quad2) {\n if (quad1 === quad2) return quad1\n const diff = (quad1 - quad2 + 4) % 4\n if (diff === 2) return -1\n const min = quad1 < quad2 ? quad1 : quad2\n const max = quad1 > quad2 ? quad1 : quad2\n if (min === 0 && max === 3) return 3\n return min\n }\n static isInHalfPlane(quad, halfPlane) {\n if (halfPlane === Quadrant.SE) \n return quad === Quadrant.SE || quad === Quadrant.SW\n \n return quad === halfPlane || quad === halfPlane + 1\n }\n static quadrant() {\n if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const dx = arguments[0], dy = arguments[1]\n if (dx === 0.0 && dy === 0.0) throw new IllegalArgumentException('Cannot compute the quadrant for point ( ' + dx + ', ' + dy + ' )')\n if (dx >= 0.0) \n if (dy >= 0.0) return Quadrant.NE; else return Quadrant.SE\n else \n if (dy >= 0.0) return Quadrant.NW; else return Quadrant.SW\n \n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const p0 = arguments[0], p1 = arguments[1]\n if (p1.x === p0.x && p1.y === p0.y) throw new IllegalArgumentException('Cannot compute the quadrant for two identical points ' + p0)\n if (p1.x >= p0.x) \n if (p1.y >= p0.y) return Quadrant.NE; else return Quadrant.SE\n else \n if (p1.y >= p0.y) return Quadrant.NW; else return Quadrant.SW\n \n }\n }\n}\nQuadrant.NE = 0\nQuadrant.NW = 1\nQuadrant.SW = 2\nQuadrant.SE = 3\n","import Orientation from '../algorithm/Orientation.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport Quadrant from './Quadrant.js'\nimport Assert from '../util/Assert.js'\nexport default class EdgeEnd {\n constructor() {\n EdgeEnd.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edge = null\n this._label = null\n this._node = null\n this._p0 = null\n this._p1 = null\n this._dx = null\n this._dy = null\n this._quadrant = null\n if (arguments.length === 1) {\n const edge = arguments[0]\n this._edge = edge\n } else if (arguments.length === 3) {\n const edge = arguments[0], p0 = arguments[1], p1 = arguments[2]\n EdgeEnd.constructor_.call(this, edge, p0, p1, null)\n } else if (arguments.length === 4) {\n const edge = arguments[0], p0 = arguments[1], p1 = arguments[2], label = arguments[3]\n EdgeEnd.constructor_.call(this, edge)\n this.init(p0, p1)\n this._label = label\n }\n }\n compareDirection(e) {\n if (this._dx === e._dx && this._dy === e._dy) return 0\n if (this._quadrant > e._quadrant) return 1\n if (this._quadrant < e._quadrant) return -1\n return Orientation.index(e._p0, e._p1, this._p1)\n }\n getDy() {\n return this._dy\n }\n getCoordinate() {\n return this._p0\n }\n setNode(node) {\n this._node = node\n }\n print(out) {\n const angle = Math.atan2(this._dy, this._dx)\n const className = this.getClass().getName()\n const lastDotPos = className.lastIndexOf('.')\n const name = className.substring(lastDotPos + 1)\n out.print(' ' + name + ': ' + this._p0 + ' - ' + this._p1 + ' ' + this._quadrant + ':' + angle + ' ' + this._label)\n }\n compareTo(obj) {\n const e = obj\n return this.compareDirection(e)\n }\n getDirectedCoordinate() {\n return this._p1\n }\n getDx() {\n return this._dx\n }\n getLabel() {\n return this._label\n }\n getEdge() {\n return this._edge\n }\n getQuadrant() {\n return this._quadrant\n }\n getNode() {\n return this._node\n }\n toString() {\n const angle = Math.atan2(this._dy, this._dx)\n const className = this.getClass().getName()\n const lastDotPos = className.lastIndexOf('.')\n const name = className.substring(lastDotPos + 1)\n return ' ' + name + ': ' + this._p0 + ' - ' + this._p1 + ' ' + this._quadrant + ':' + angle + ' ' + this._label\n }\n computeLabel(boundaryNodeRule) {}\n init(p0, p1) {\n this._p0 = p0\n this._p1 = p1\n this._dx = p1.x - p0.x\n this._dy = p1.y - p0.y\n this._quadrant = Quadrant.quadrant(this._dx, this._dy)\n Assert.isTrue(!(this._dx === 0 && this._dy === 0), 'EdgeEnd with identical endpoints found')\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import Location from '../geom/Location.js'\nimport EdgeEnd from './EdgeEnd.js'\nimport Position from './Position.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport Label from './Label.js'\nexport default class DirectedEdge extends EdgeEnd {\n constructor() {\n super()\n DirectedEdge.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._isForward = null\n this._isInResult = false\n this._isVisited = false\n this._sym = null\n this._next = null\n this._nextMin = null\n this._edgeRing = null\n this._minEdgeRing = null\n this._depth = [0, -999, -999]\n const edge = arguments[0], isForward = arguments[1]\n EdgeEnd.constructor_.call(this, edge)\n this._isForward = isForward\n if (isForward) {\n this.init(edge.getCoordinate(0), edge.getCoordinate(1))\n } else {\n const n = edge.getNumPoints() - 1\n this.init(edge.getCoordinate(n), edge.getCoordinate(n - 1))\n }\n this.computeDirectedLabel()\n }\n static depthFactor(currLocation, nextLocation) {\n if (currLocation === Location.EXTERIOR && nextLocation === Location.INTERIOR) return 1; else if (currLocation === Location.INTERIOR && nextLocation === Location.EXTERIOR) return -1\n return 0\n }\n getNextMin() {\n return this._nextMin\n }\n getDepth(position) {\n return this._depth[position]\n }\n setVisited(isVisited) {\n this._isVisited = isVisited\n }\n computeDirectedLabel() {\n this._label = new Label(this._edge.getLabel())\n if (!this._isForward) this._label.flip()\n }\n getNext() {\n return this._next\n }\n setDepth(position, depthVal) {\n if (this._depth[position] !== -999) \n if (this._depth[position] !== depthVal) throw new TopologyException('assigned depths do not match', this.getCoordinate())\n \n this._depth[position] = depthVal\n }\n isInteriorAreaEdge() {\n let isInteriorAreaEdge = true\n for (let i = 0; i < 2; i++) \n if (!(this._label.isArea(i) && this._label.getLocation(i, Position.LEFT) === Location.INTERIOR && this._label.getLocation(i, Position.RIGHT) === Location.INTERIOR)) \n isInteriorAreaEdge = false\n \n \n return isInteriorAreaEdge\n }\n setNextMin(nextMin) {\n this._nextMin = nextMin\n }\n print(out) {\n super.print.call(this, out)\n out.print(' ' + this._depth[Position.LEFT] + '/' + this._depth[Position.RIGHT])\n out.print(' (' + this.getDepthDelta() + ')')\n if (this._isInResult) out.print(' inResult')\n }\n setMinEdgeRing(minEdgeRing) {\n this._minEdgeRing = minEdgeRing\n }\n isLineEdge() {\n const isLine = this._label.isLine(0) || this._label.isLine(1)\n const isExteriorIfArea0 = !this._label.isArea(0) || this._label.allPositionsEqual(0, Location.EXTERIOR)\n const isExteriorIfArea1 = !this._label.isArea(1) || this._label.allPositionsEqual(1, Location.EXTERIOR)\n return isLine && isExteriorIfArea0 && isExteriorIfArea1\n }\n setEdgeRing(edgeRing) {\n this._edgeRing = edgeRing\n }\n getMinEdgeRing() {\n return this._minEdgeRing\n }\n getDepthDelta() {\n let depthDelta = this._edge.getDepthDelta()\n if (!this._isForward) depthDelta = -depthDelta\n return depthDelta\n }\n setInResult(isInResult) {\n this._isInResult = isInResult\n }\n getSym() {\n return this._sym\n }\n isForward() {\n return this._isForward\n }\n getEdge() {\n return this._edge\n }\n printEdge(out) {\n this.print(out)\n out.print(' ')\n if (this._isForward) this._edge.print(out); else this._edge.printReverse(out)\n }\n setSym(de) {\n this._sym = de\n }\n setVisitedEdge(isVisited) {\n this.setVisited(isVisited)\n this._sym.setVisited(isVisited)\n }\n setEdgeDepths(position, depth) {\n let depthDelta = this.getEdge().getDepthDelta()\n if (!this._isForward) depthDelta = -depthDelta\n let directionFactor = 1\n if (position === Position.LEFT) directionFactor = -1\n const oppositePos = Position.opposite(position)\n const delta = depthDelta * directionFactor\n const oppositeDepth = depth + delta\n this.setDepth(position, depth)\n this.setDepth(oppositePos, oppositeDepth)\n }\n getEdgeRing() {\n return this._edgeRing\n }\n isInResult() {\n return this._isInResult\n }\n setNext(next) {\n this._next = next\n }\n isVisited() {\n return this._isVisited\n }\n}\n","import Node from './Node.js'\nexport default class NodeFactory {\n createNode(coord) {\n return new Node(coord, null)\n }\n}\n","import Location from '../geom/Location.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Node from './Node.js'\nimport NodeMap from './NodeMap.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport DirectedEdge from './DirectedEdge.js'\nimport System from '../../../../java/lang/System.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Quadrant from './Quadrant.js'\nimport NodeFactory from './NodeFactory.js'\nexport default class PlanarGraph {\n constructor() {\n PlanarGraph.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edges = new ArrayList()\n this._nodes = null\n this._edgeEndList = new ArrayList()\n if (arguments.length === 0) {\n this._nodes = new NodeMap(new NodeFactory())\n } else if (arguments.length === 1) {\n const nodeFact = arguments[0]\n this._nodes = new NodeMap(nodeFact)\n }\n }\n static linkResultDirectedEdges(nodes) {\n for (let nodeit = nodes.iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().linkResultDirectedEdges()\n }\n }\n printEdges(out) {\n out.println('Edges:')\n for (let i = 0; i < this._edges.size(); i++) {\n out.println('edge ' + i + ':')\n const e = this._edges.get(i)\n e.print(out)\n e.eiList.print(out)\n }\n }\n find(coord) {\n return this._nodes.find(coord)\n }\n addNode() {\n if (arguments[0] instanceof Node) {\n const node = arguments[0]\n return this._nodes.addNode(node)\n } else if (arguments[0] instanceof Coordinate) {\n const coord = arguments[0]\n return this._nodes.addNode(coord)\n }\n }\n getNodeIterator() {\n return this._nodes.iterator()\n }\n linkResultDirectedEdges() {\n for (let nodeit = this._nodes.iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().linkResultDirectedEdges()\n }\n }\n debugPrintln(o) {\n System.out.println(o)\n }\n isBoundaryNode(geomIndex, coord) {\n const node = this._nodes.find(coord)\n if (node === null) return false\n const label = node.getLabel()\n if (label !== null && label.getLocation(geomIndex) === Location.BOUNDARY) return true\n return false\n }\n linkAllDirectedEdges() {\n for (let nodeit = this._nodes.iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().linkAllDirectedEdges()\n }\n }\n matchInSameDirection(p0, p1, ep0, ep1) {\n if (!p0.equals(ep0)) return false\n if (Orientation.index(p0, p1, ep1) === Orientation.COLLINEAR && Quadrant.quadrant(p0, p1) === Quadrant.quadrant(ep0, ep1)) return true\n return false\n }\n getEdgeEnds() {\n return this._edgeEndList\n }\n debugPrint(o) {\n System.out.print(o)\n }\n getEdgeIterator() {\n return this._edges.iterator()\n }\n findEdgeInSameDirection(p0, p1) {\n for (let i = 0; i < this._edges.size(); i++) {\n const e = this._edges.get(i)\n const eCoord = e.getCoordinates()\n if (this.matchInSameDirection(p0, p1, eCoord[0], eCoord[1])) return e\n if (this.matchInSameDirection(p0, p1, eCoord[eCoord.length - 1], eCoord[eCoord.length - 2])) return e\n }\n return null\n }\n insertEdge(e) {\n this._edges.add(e)\n }\n findEdgeEnd(e) {\n for (let i = this.getEdgeEnds().iterator(); i.hasNext(); ) {\n const ee = i.next()\n if (ee.getEdge() === e) return ee\n }\n return null\n }\n addEdges(edgesToAdd) {\n for (let it = edgesToAdd.iterator(); it.hasNext(); ) {\n const e = it.next()\n this._edges.add(e)\n const de1 = new DirectedEdge(e, true)\n const de2 = new DirectedEdge(e, false)\n de1.setSym(de2)\n de2.setSym(de1)\n this.add(de1)\n this.add(de2)\n }\n }\n add(e) {\n this._nodes.add(e)\n this._edgeEndList.add(e)\n }\n getNodes() {\n return this._nodes.values()\n }\n findEdge(p0, p1) {\n for (let i = 0; i < this._edges.size(); i++) {\n const e = this._edges.get(i)\n const eCoord = e.getCoordinates()\n if (p0.equals(eCoord[0]) && p1.equals(eCoord[1])) return e\n }\n return null\n }\n}\n","import PointLocation from '../../algorithm/PointLocation.js'\nimport TopologyException from '../../geom/TopologyException.js'\nimport MaximalEdgeRing from './MaximalEdgeRing.js'\nimport CoordinateArrays from '../../geom/CoordinateArrays.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Assert from '../../util/Assert.js'\nimport PlanarGraph from '../../geomgraph/PlanarGraph.js'\nexport default class PolygonBuilder {\n constructor() {\n PolygonBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geometryFactory = null\n this._shellList = new ArrayList()\n const geometryFactory = arguments[0]\n this._geometryFactory = geometryFactory\n }\n static findEdgeRingContaining(testEr, shellList) {\n const testRing = testEr.getLinearRing()\n const testEnv = testRing.getEnvelopeInternal()\n let testPt = testRing.getCoordinateN(0)\n let minShell = null\n let minShellEnv = null\n for (let it = shellList.iterator(); it.hasNext(); ) {\n const tryShell = it.next()\n const tryShellRing = tryShell.getLinearRing()\n const tryShellEnv = tryShellRing.getEnvelopeInternal()\n if (tryShellEnv.equals(testEnv)) continue\n if (!tryShellEnv.contains(testEnv)) continue\n testPt = CoordinateArrays.ptNotInList(testRing.getCoordinates(), tryShellRing.getCoordinates())\n let isContained = false\n if (PointLocation.isInRing(testPt, tryShellRing.getCoordinates())) isContained = true\n if (isContained) \n if (minShell === null || minShellEnv.contains(tryShellEnv)) {\n minShell = tryShell\n minShellEnv = minShell.getLinearRing().getEnvelopeInternal()\n }\n \n }\n return minShell\n }\n sortShellsAndHoles(edgeRings, shellList, freeHoleList) {\n for (let it = edgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (er.isHole()) \n freeHoleList.add(er)\n else \n shellList.add(er)\n \n }\n }\n computePolygons(shellList) {\n const resultPolyList = new ArrayList()\n for (let it = shellList.iterator(); it.hasNext(); ) {\n const er = it.next()\n const poly = er.toPolygon(this._geometryFactory)\n resultPolyList.add(poly)\n }\n return resultPolyList\n }\n placeFreeHoles(shellList, freeHoleList) {\n for (let it = freeHoleList.iterator(); it.hasNext(); ) {\n const hole = it.next()\n if (hole.getShell() === null) {\n const shell = PolygonBuilder.findEdgeRingContaining(hole, shellList)\n if (shell === null) throw new TopologyException('unable to assign hole to a shell', hole.getCoordinate(0))\n hole.setShell(shell)\n }\n }\n }\n buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList) {\n const edgeRings = new ArrayList()\n for (let it = maxEdgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (er.getMaxNodeDegree() > 2) {\n er.linkDirectedEdgesForMinimalEdgeRings()\n const minEdgeRings = er.buildMinimalRings()\n const shell = this.findShell(minEdgeRings)\n if (shell !== null) {\n this.placePolygonHoles(shell, minEdgeRings)\n shellList.add(shell)\n } else {\n freeHoleList.addAll(minEdgeRings)\n }\n } else {\n edgeRings.add(er)\n }\n }\n return edgeRings\n }\n buildMaximalEdgeRings(dirEdges) {\n const maxEdgeRings = new ArrayList()\n for (let it = dirEdges.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.isInResult() && de.getLabel().isArea()) \n if (de.getEdgeRing() === null) {\n const er = new MaximalEdgeRing(de, this._geometryFactory)\n maxEdgeRings.add(er)\n er.setInResult()\n }\n \n }\n return maxEdgeRings\n }\n placePolygonHoles(shell, minEdgeRings) {\n for (let it = minEdgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (er.isHole()) \n er.setShell(shell)\n \n }\n }\n getPolygons() {\n const resultPolyList = this.computePolygons(this._shellList)\n return resultPolyList\n }\n findShell(minEdgeRings) {\n let shellCount = 0\n let shell = null\n for (let it = minEdgeRings.iterator(); it.hasNext(); ) {\n const er = it.next()\n if (!er.isHole()) {\n shell = er\n shellCount++\n }\n }\n Assert.isTrue(shellCount <= 1, 'found two shells in MinimalEdgeRing list')\n return shell\n }\n add() {\n if (arguments.length === 1) {\n const graph = arguments[0]\n this.add(graph.getEdgeEnds(), graph.getNodes())\n } else if (arguments.length === 2) {\n const dirEdges = arguments[0], nodes = arguments[1]\n PlanarGraph.linkResultDirectedEdges(nodes)\n const maxEdgeRings = this.buildMaximalEdgeRings(dirEdges)\n const freeHoleList = new ArrayList()\n const edgeRings = this.buildMinimalEdgeRings(maxEdgeRings, this._shellList, freeHoleList)\n this.sortShellsAndHoles(edgeRings, this._shellList, freeHoleList)\n this.placeFreeHoles(this._shellList, freeHoleList)\n }\n }\n}\n","export default class Boundable {\n getBounds() {}\n}\n","import Boundable from './Boundable.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nexport default class ItemBoundable {\n constructor() {\n ItemBoundable.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._bounds = null\n this._item = null\n const bounds = arguments[0], item = arguments[1]\n this._bounds = bounds\n this._item = item\n }\n getItem() {\n return this._item\n }\n getBounds() {\n return this._bounds\n }\n get interfaces_() {\n return [Boundable, Serializable]\n }\n}\n","import ArrayList from '../../../../java/util/ArrayList.js'\nexport default class PriorityQueue {\n constructor() {\n PriorityQueue.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._size = null\n this._items = null\n this._size = 0\n this._items = new ArrayList()\n this._items.add(null)\n }\n poll() {\n if (this.isEmpty()) return null\n const minItem = this._items.get(1)\n this._items.set(1, this._items.get(this._size))\n this._size -= 1\n this.reorder(1)\n return minItem\n }\n size() {\n return this._size\n }\n reorder(hole) {\n let child = null\n const tmp = this._items.get(hole)\n for (; hole * 2 <= this._size; hole = child) {\n child = hole * 2\n if (child !== this._size && this._items.get(child + 1).compareTo(this._items.get(child)) < 0) child++\n if (this._items.get(child).compareTo(tmp) < 0) this._items.set(hole, this._items.get(child)); else break\n }\n this._items.set(hole, tmp)\n }\n clear() {\n this._size = 0\n this._items.clear()\n }\n peek() {\n if (this.isEmpty()) return null\n const minItem = this._items.get(1)\n return minItem\n }\n isEmpty() {\n return this._size === 0\n }\n add(x) {\n this._items.add(null)\n this._size += 1\n let hole = this._size\n this._items.set(0, x)\n for (; x.compareTo(this._items.get(Math.trunc(hole / 2))) < 0; hole /= 2) \n this._items.set(hole, this._items.get(Math.trunc(hole / 2)))\n \n this._items.set(hole, x)\n }\n}\n","export default class SpatialIndex {\n insert(itemEnv, item) {}\n remove(itemEnv, item) {}\n query() {\n if (arguments.length === 1) {\n const searchEnv = arguments[0]\n } else if (arguments.length === 2) {\n const searchEnv = arguments[0], visitor = arguments[1]\n }\n }\n}\n","import Boundable from './Boundable.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport Assert from '../../util/Assert.js'\nexport default class AbstractNode {\n constructor() {\n AbstractNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._childBoundables = new ArrayList()\n this._bounds = null\n this._level = null\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const level = arguments[0]\n this._level = level\n }\n }\n getLevel() {\n return this._level\n }\n size() {\n return this._childBoundables.size()\n }\n getChildBoundables() {\n return this._childBoundables\n }\n addChildBoundable(childBoundable) {\n Assert.isTrue(this._bounds === null)\n this._childBoundables.add(childBoundable)\n }\n isEmpty() {\n return this._childBoundables.isEmpty()\n }\n getBounds() {\n if (this._bounds === null) \n this._bounds = this.computeBounds()\n \n return this._bounds\n }\n get interfaces_() {\n return [Boundable, Serializable]\n }\n}\n","import Arrays from './Arrays.js'\nimport ArrayList from './ArrayList.js'\n\nconst Collections = {\n reverseOrder: function() {\n return {\n compare(a, b) {\n return b.compareTo(a)\n }\n }\n },\n min: function(l) {\n Collections.sort(l)\n return l.get(0)\n },\n sort: function(l, c) {\n const a = l.toArray()\n if (c)\n Arrays.sort(a, c)\n else\n Arrays.sort(a)\n const i = l.iterator()\n for (let pos = 0, alen = a.length; pos < alen; pos++) {\n i.next()\n i.set(a[pos])\n }\n },\n singletonList: function(o) {\n const arrayList = new ArrayList()\n arrayList.add(o)\n return arrayList\n }\n}\n\nexport default Collections\n","export default class EnvelopeDistance {\n static maxDistance(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n let dist = EnvelopeDistance.distance(ax1, ay1, bx1, by1)\n dist = Math.max(dist, EnvelopeDistance.distance(ax1, ay1, bx2, by2))\n dist = Math.max(dist, EnvelopeDistance.distance(ax2, ay2, bx1, by1))\n dist = Math.max(dist, EnvelopeDistance.distance(ax2, ay2, bx2, by2))\n return dist\n }\n static distance(x1, y1, x2, y2) {\n const dx = x2 - x1\n const dy = y2 - y1\n return Math.sqrt(dx * dx + dy * dy)\n }\n static maximumDistance(env1, env2) {\n const minx = Math.min(env1.getMinX(), env2.getMinX())\n const miny = Math.min(env1.getMinY(), env2.getMinY())\n const maxx = Math.max(env1.getMaxX(), env2.getMaxX())\n const maxy = Math.max(env1.getMaxY(), env2.getMaxY())\n return EnvelopeDistance.distance(minx, miny, maxx, maxy)\n }\n static minMaxDistance(a, b) {\n const aminx = a.getMinX()\n const aminy = a.getMinY()\n const amaxx = a.getMaxX()\n const amaxy = a.getMaxY()\n const bminx = b.getMinX()\n const bminy = b.getMinY()\n const bmaxx = b.getMaxX()\n const bmaxy = b.getMaxY()\n let dist = EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bminx, bminy, bminx, bmaxy)\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, aminx, amaxy, bmaxx, bmaxy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bminx, bminy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(aminx, aminy, amaxx, aminy, bmaxx, bmaxy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bminx, bminy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, aminx, amaxy, bmaxx, bmaxy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bminx, bminy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bminx, bminy, bmaxx, bminy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bmaxx, bmaxy, bminx, bmaxy))\n dist = Math.min(dist, EnvelopeDistance.maxDistance(amaxx, amaxy, amaxx, aminy, bmaxx, bmaxy, bmaxx, bminy))\n return dist\n }\n}\n","import IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport AbstractNode from './AbstractNode.js'\nimport EnvelopeDistance from './EnvelopeDistance.js'\nimport Comparable from '../../../../../java/lang/Comparable.js'\nexport default class BoundablePair {\n constructor() {\n BoundablePair.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._boundable1 = null\n this._boundable2 = null\n this._distance = null\n this._itemDistance = null\n const boundable1 = arguments[0], boundable2 = arguments[1], itemDistance = arguments[2]\n this._boundable1 = boundable1\n this._boundable2 = boundable2\n this._itemDistance = itemDistance\n this._distance = this.distance()\n }\n static area(b) {\n return b.getBounds().getArea()\n }\n static isComposite(item) {\n return item instanceof AbstractNode\n }\n maximumDistance() {\n return EnvelopeDistance.maximumDistance(this._boundable1.getBounds(), this._boundable2.getBounds())\n }\n expandToQueue(priQ, minDistance) {\n const isComp1 = BoundablePair.isComposite(this._boundable1)\n const isComp2 = BoundablePair.isComposite(this._boundable2)\n if (isComp1 && isComp2) {\n if (BoundablePair.area(this._boundable1) > BoundablePair.area(this._boundable2)) {\n this.expand(this._boundable1, this._boundable2, false, priQ, minDistance)\n return null\n } else {\n this.expand(this._boundable2, this._boundable1, true, priQ, minDistance)\n return null\n }\n } else if (isComp1) {\n this.expand(this._boundable1, this._boundable2, false, priQ, minDistance)\n return null\n } else if (isComp2) {\n this.expand(this._boundable2, this._boundable1, true, priQ, minDistance)\n return null\n }\n throw new IllegalArgumentException('neither boundable is composite')\n }\n isLeaves() {\n return !(BoundablePair.isComposite(this._boundable1) || BoundablePair.isComposite(this._boundable2))\n }\n compareTo(o) {\n const nd = o\n if (this._distance < nd._distance) return -1\n if (this._distance > nd._distance) return 1\n return 0\n }\n expand(bndComposite, bndOther, isFlipped, priQ, minDistance) {\n const children = bndComposite.getChildBoundables()\n for (let i = children.iterator(); i.hasNext(); ) {\n const child = i.next()\n let bp = null\n if (isFlipped) \n bp = new BoundablePair(bndOther, child, this._itemDistance)\n else \n bp = new BoundablePair(child, bndOther, this._itemDistance)\n \n if (bp.getDistance() < minDistance) \n priQ.add(bp)\n \n }\n }\n getBoundable(i) {\n if (i === 0) return this._boundable1\n return this._boundable2\n }\n getDistance() {\n return this._distance\n }\n distance() {\n if (this.isLeaves()) \n return this._itemDistance.distance(this._boundable1, this._boundable2)\n \n return this._boundable1.getBounds().distance(this._boundable2.getBounds())\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","export default class ItemVisitor {\n visitItem(item) {}\n}\n","import ItemBoundable from './ItemBoundable.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport ItemVisitor from '../ItemVisitor.js'\nimport AbstractNode from './AbstractNode.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport Assert from '../../util/Assert.js'\nimport List from '../../../../../java/util/List.js'\nexport default class AbstractSTRtree {\n constructor() {\n AbstractSTRtree.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._root = null\n this._built = false\n this._itemBoundables = new ArrayList()\n this._nodeCapacity = null\n if (arguments.length === 0) {\n AbstractSTRtree.constructor_.call(this, AbstractSTRtree.DEFAULT_NODE_CAPACITY)\n } else if (arguments.length === 1) {\n const nodeCapacity = arguments[0]\n Assert.isTrue(nodeCapacity > 1, 'Node capacity must be greater than 1')\n this._nodeCapacity = nodeCapacity\n }\n }\n static compareDoubles(a, b) {\n return a > b ? 1 : a < b ? -1 : 0\n }\n queryInternal() {\n if (hasInterface(arguments[2], ItemVisitor) && (arguments[0] instanceof Object && arguments[1] instanceof AbstractNode)) {\n const searchBounds = arguments[0], node = arguments[1], visitor = arguments[2]\n const childBoundables = node.getChildBoundables()\n for (let i = 0; i < childBoundables.size(); i++) {\n const childBoundable = childBoundables.get(i)\n if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) \n continue\n \n if (childBoundable instanceof AbstractNode) \n this.queryInternal(searchBounds, childBoundable, visitor)\n else if (childBoundable instanceof ItemBoundable) \n visitor.visitItem(childBoundable.getItem())\n else \n Assert.shouldNeverReachHere()\n \n }\n } else if (hasInterface(arguments[2], List) && (arguments[0] instanceof Object && arguments[1] instanceof AbstractNode)) {\n const searchBounds = arguments[0], node = arguments[1], matches = arguments[2]\n const childBoundables = node.getChildBoundables()\n for (let i = 0; i < childBoundables.size(); i++) {\n const childBoundable = childBoundables.get(i)\n if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) \n continue\n \n if (childBoundable instanceof AbstractNode) \n this.queryInternal(searchBounds, childBoundable, matches)\n else if (childBoundable instanceof ItemBoundable) \n matches.add(childBoundable.getItem())\n else \n Assert.shouldNeverReachHere()\n \n }\n }\n }\n getNodeCapacity() {\n return this._nodeCapacity\n }\n lastNode(nodes) {\n return nodes.get(nodes.size() - 1)\n }\n size() {\n if (arguments.length === 0) {\n if (this.isEmpty()) \n return 0\n \n this.build()\n return this.size(this._root)\n } else if (arguments.length === 1) {\n const node = arguments[0]\n let size = 0\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof AbstractNode) \n size += this.size(childBoundable)\n else if (childBoundable instanceof ItemBoundable) \n size += 1\n \n }\n return size\n }\n }\n removeItem(node, item) {\n let childToRemove = null\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof ItemBoundable) \n if (childBoundable.getItem() === item) childToRemove = childBoundable\n \n }\n if (childToRemove !== null) {\n node.getChildBoundables().remove(childToRemove)\n return true\n }\n return false\n }\n itemsTree() {\n if (arguments.length === 0) {\n this.build()\n const valuesTree = this.itemsTree(this._root)\n if (valuesTree === null) return new ArrayList()\n return valuesTree\n } else if (arguments.length === 1) {\n const node = arguments[0]\n const valuesTreeForNode = new ArrayList()\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof AbstractNode) {\n const valuesTreeForChild = this.itemsTree(childBoundable)\n if (valuesTreeForChild !== null) valuesTreeForNode.add(valuesTreeForChild)\n } else if (childBoundable instanceof ItemBoundable) {\n valuesTreeForNode.add(childBoundable.getItem())\n } else {\n Assert.shouldNeverReachHere()\n }\n }\n if (valuesTreeForNode.size() <= 0) return null\n return valuesTreeForNode\n }\n }\n insert(bounds, item) {\n Assert.isTrue(!this._built, 'Cannot insert items into an STR packed R-tree after it has been built.')\n this._itemBoundables.add(new ItemBoundable(bounds, item))\n }\n boundablesAtLevel() {\n if (arguments.length === 1) {\n const level = arguments[0]\n const boundables = new ArrayList()\n this.boundablesAtLevel(level, this._root, boundables)\n return boundables\n } else if (arguments.length === 3) {\n const level = arguments[0], top = arguments[1], boundables = arguments[2]\n Assert.isTrue(level > -2)\n if (top.getLevel() === level) {\n boundables.add(top)\n return null\n }\n for (let i = top.getChildBoundables().iterator(); i.hasNext(); ) {\n const boundable = i.next()\n if (boundable instanceof AbstractNode) {\n this.boundablesAtLevel(level, boundable, boundables)\n } else {\n Assert.isTrue(boundable instanceof ItemBoundable)\n if (level === -1) \n boundables.add(boundable)\n \n }\n }\n return null\n }\n }\n query() {\n if (arguments.length === 1) {\n const searchBounds = arguments[0]\n this.build()\n const matches = new ArrayList()\n if (this.isEmpty()) \n return matches\n \n if (this.getIntersectsOp().intersects(this._root.getBounds(), searchBounds)) \n this.queryInternal(searchBounds, this._root, matches)\n \n return matches\n } else if (arguments.length === 2) {\n const searchBounds = arguments[0], visitor = arguments[1]\n this.build()\n if (this.isEmpty()) \n return null\n \n if (this.getIntersectsOp().intersects(this._root.getBounds(), searchBounds)) \n this.queryInternal(searchBounds, this._root, visitor)\n \n }\n }\n build() {\n if (this._built) return null\n this._root = this._itemBoundables.isEmpty() ? this.createNode(0) : this.createHigherLevels(this._itemBoundables, -1)\n this._itemBoundables = null\n this._built = true\n }\n getRoot() {\n this.build()\n return this._root\n }\n remove() {\n if (arguments.length === 2) {\n const searchBounds = arguments[0], item = arguments[1]\n this.build()\n if (this.getIntersectsOp().intersects(this._root.getBounds(), searchBounds)) \n return this.remove(searchBounds, this._root, item)\n \n return false\n } else if (arguments.length === 3) {\n const searchBounds = arguments[0], node = arguments[1], item = arguments[2]\n let found = this.removeItem(node, item)\n if (found) return true\n let childToPrune = null\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (!this.getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) \n continue\n \n if (childBoundable instanceof AbstractNode) {\n found = this.remove(searchBounds, childBoundable, item)\n if (found) {\n childToPrune = childBoundable\n break\n }\n }\n }\n if (childToPrune !== null) \n if (childToPrune.getChildBoundables().isEmpty()) \n node.getChildBoundables().remove(childToPrune)\n \n \n return found\n }\n }\n createHigherLevels(boundablesOfALevel, level) {\n Assert.isTrue(!boundablesOfALevel.isEmpty())\n const parentBoundables = this.createParentBoundables(boundablesOfALevel, level + 1)\n if (parentBoundables.size() === 1) \n return parentBoundables.get(0)\n \n return this.createHigherLevels(parentBoundables, level + 1)\n }\n depth() {\n if (arguments.length === 0) {\n if (this.isEmpty()) \n return 0\n \n this.build()\n return this.depth(this._root)\n } else if (arguments.length === 1) {\n const node = arguments[0]\n let maxChildDepth = 0\n for (let i = node.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (childBoundable instanceof AbstractNode) {\n const childDepth = this.depth(childBoundable)\n if (childDepth > maxChildDepth) maxChildDepth = childDepth\n }\n }\n return maxChildDepth + 1\n }\n }\n createParentBoundables(childBoundables, newLevel) {\n Assert.isTrue(!childBoundables.isEmpty())\n const parentBoundables = new ArrayList()\n parentBoundables.add(this.createNode(newLevel))\n const sortedChildBoundables = new ArrayList(childBoundables)\n Collections.sort(sortedChildBoundables, this.getComparator())\n for (let i = sortedChildBoundables.iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (this.lastNode(parentBoundables).getChildBoundables().size() === this.getNodeCapacity()) \n parentBoundables.add(this.createNode(newLevel))\n \n this.lastNode(parentBoundables).addChildBoundable(childBoundable)\n }\n return parentBoundables\n }\n isEmpty() {\n if (!this._built) return this._itemBoundables.isEmpty()\n return this._root.isEmpty()\n }\n get interfaces_() {\n return [Serializable]\n }\n}\nfunction IntersectsOp() {}\nAbstractSTRtree.IntersectsOp = IntersectsOp\nAbstractSTRtree.DEFAULT_NODE_CAPACITY = 10\n","export default class ItemDistance {\n distance(item1, item2) {}\n}\n","import ItemBoundable from './ItemBoundable.js'\nimport PriorityQueue from '../../util/PriorityQueue.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport SpatialIndex from '../SpatialIndex.js'\nimport AbstractNode from './AbstractNode.js'\nimport Double from '../../../../../java/lang/Double.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport BoundablePair from './BoundablePair.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Comparator from '../../../../../java/util/Comparator.js'\nimport Serializable from '../../../../../java/io/Serializable.js'\nimport Envelope from '../../geom/Envelope.js'\nimport Assert from '../../util/Assert.js'\nimport AbstractSTRtree from './AbstractSTRtree.js'\nimport ItemDistance from './ItemDistance.js'\nexport default class STRtree extends AbstractSTRtree {\n constructor() {\n super()\n STRtree.constructor_.apply(this, arguments)\n }\n static constructor_() {\n if (arguments.length === 0) {\n STRtree.constructor_.call(this, STRtree.DEFAULT_NODE_CAPACITY)\n } else if (arguments.length === 1) {\n const nodeCapacity = arguments[0]\n AbstractSTRtree.constructor_.call(this, nodeCapacity)\n }\n }\n static centreX(e) {\n return STRtree.avg(e.getMinX(), e.getMaxX())\n }\n static avg(a, b) {\n return (a + b) / 2\n }\n static getItems(kNearestNeighbors) {\n const items = new Array(kNearestNeighbors.size()).fill(null)\n let count = 0\n while (!kNearestNeighbors.isEmpty()) {\n const bp = kNearestNeighbors.poll()\n items[count] = bp.getBoundable(0).getItem()\n count++\n }\n return items\n }\n static centreY(e) {\n return STRtree.avg(e.getMinY(), e.getMaxY())\n }\n createParentBoundablesFromVerticalSlices(verticalSlices, newLevel) {\n Assert.isTrue(verticalSlices.length > 0)\n const parentBoundables = new ArrayList()\n for (let i = 0; i < verticalSlices.length; i++) \n parentBoundables.addAll(this.createParentBoundablesFromVerticalSlice(verticalSlices[i], newLevel))\n \n return parentBoundables\n }\n nearestNeighbourK() {\n if (arguments.length === 2) {\n const initBndPair = arguments[0], k = arguments[1]\n return this.nearestNeighbourK(initBndPair, Double.POSITIVE_INFINITY, k)\n } else if (arguments.length === 3) {\n const initBndPair = arguments[0], maxDistance = arguments[1], k = arguments[2]\n let distanceLowerBound = maxDistance\n const priQ = new PriorityQueue()\n priQ.add(initBndPair)\n const kNearestNeighbors = new PriorityQueue()\n while (!priQ.isEmpty() && distanceLowerBound >= 0.0) {\n const bndPair = priQ.poll()\n const pairDistance = bndPair.getDistance()\n if (pairDistance >= distanceLowerBound) \n break\n \n if (bndPair.isLeaves()) \n if (kNearestNeighbors.size() < k) {\n kNearestNeighbors.add(bndPair)\n } else {\n const bp1 = kNearestNeighbors.peek()\n if (bp1.getDistance() > pairDistance) {\n kNearestNeighbors.poll()\n kNearestNeighbors.add(bndPair)\n }\n const bp2 = kNearestNeighbors.peek()\n distanceLowerBound = bp2.getDistance()\n }\n else \n bndPair.expandToQueue(priQ, distanceLowerBound)\n \n }\n return STRtree.getItems(kNearestNeighbors)\n }\n }\n createNode(level) {\n return new STRtreeNode(level)\n }\n size() {\n if (arguments.length === 0) \n return super.size.call(this)\n else return super.size.apply(this, arguments)\n }\n insert() {\n if (arguments.length === 2 && (arguments[1] instanceof Object && arguments[0] instanceof Envelope)) {\n const itemEnv = arguments[0], item = arguments[1]\n if (itemEnv.isNull()) \n return null\n \n super.insert.call(this, itemEnv, item)\n } else {\n return super.insert.apply(this, arguments)\n }\n }\n getIntersectsOp() {\n return STRtree.intersectsOp\n }\n verticalSlices(childBoundables, sliceCount) {\n const sliceCapacity = Math.trunc(Math.ceil(childBoundables.size() / sliceCount))\n const slices = new Array(sliceCount).fill(null)\n const i = childBoundables.iterator()\n for (let j = 0; j < sliceCount; j++) {\n slices[j] = new ArrayList()\n let boundablesAddedToSlice = 0\n while (i.hasNext() && boundablesAddedToSlice < sliceCapacity) {\n const childBoundable = i.next()\n slices[j].add(childBoundable)\n boundablesAddedToSlice++\n }\n }\n return slices\n }\n query() {\n if (arguments.length === 1) {\n const searchEnv = arguments[0]\n return super.query.call(this, searchEnv)\n } else if (arguments.length === 2) {\n const searchEnv = arguments[0], visitor = arguments[1]\n super.query.call(this, searchEnv, visitor)\n }\n }\n getComparator() {\n return STRtree.yComparator\n }\n createParentBoundablesFromVerticalSlice(childBoundables, newLevel) {\n return super.createParentBoundables.call(this, childBoundables, newLevel)\n }\n remove() {\n if (arguments.length === 2 && (arguments[1] instanceof Object && arguments[0] instanceof Envelope)) {\n const itemEnv = arguments[0], item = arguments[1]\n return super.remove.call(this, itemEnv, item)\n } else {\n return super.remove.apply(this, arguments)\n }\n }\n depth() {\n if (arguments.length === 0) \n return super.depth.call(this)\n else return super.depth.apply(this, arguments)\n }\n createParentBoundables(childBoundables, newLevel) {\n Assert.isTrue(!childBoundables.isEmpty())\n const minLeafCount = Math.trunc(Math.ceil(childBoundables.size() / this.getNodeCapacity()))\n const sortedChildBoundables = new ArrayList(childBoundables)\n Collections.sort(sortedChildBoundables, STRtree.xComparator)\n const verticalSlices = this.verticalSlices(sortedChildBoundables, Math.trunc(Math.ceil(Math.sqrt(minLeafCount))))\n return this.createParentBoundablesFromVerticalSlices(verticalSlices, newLevel)\n }\n nearestNeighbour() {\n if (arguments.length === 1) {\n if (hasInterface(arguments[0], ItemDistance)) {\n const itemDist = arguments[0]\n if (this.isEmpty()) return null\n const bp = new BoundablePair(this.getRoot(), this.getRoot(), itemDist)\n return this.nearestNeighbour(bp)\n } else if (arguments[0] instanceof BoundablePair) {\n const initBndPair = arguments[0]\n let distanceLowerBound = Double.POSITIVE_INFINITY\n let minPair = null\n const priQ = new PriorityQueue()\n priQ.add(initBndPair)\n while (!priQ.isEmpty() && distanceLowerBound > 0.0) {\n const bndPair = priQ.poll()\n const pairDistance = bndPair.getDistance()\n if (pairDistance >= distanceLowerBound) break\n if (bndPair.isLeaves()) {\n distanceLowerBound = pairDistance\n minPair = bndPair\n } else {\n bndPair.expandToQueue(priQ, distanceLowerBound)\n }\n }\n if (minPair === null) return null\n return [minPair.getBoundable(0).getItem(), minPair.getBoundable(1).getItem()]\n }\n } else if (arguments.length === 2) {\n const tree = arguments[0], itemDist = arguments[1]\n if (this.isEmpty() || tree.isEmpty()) return null\n const bp = new BoundablePair(this.getRoot(), tree.getRoot(), itemDist)\n return this.nearestNeighbour(bp)\n } else if (arguments.length === 3) {\n const env = arguments[0], item = arguments[1], itemDist = arguments[2]\n const bnd = new ItemBoundable(env, item)\n const bp = new BoundablePair(this.getRoot(), bnd, itemDist)\n return this.nearestNeighbour(bp)[0]\n } else if (arguments.length === 4) {\n const env = arguments[0], item = arguments[1], itemDist = arguments[2], k = arguments[3]\n const bnd = new ItemBoundable(env, item)\n const bp = new BoundablePair(this.getRoot(), bnd, itemDist)\n return this.nearestNeighbourK(bp, k)\n }\n }\n isWithinDistance() {\n if (arguments.length === 2) {\n const initBndPair = arguments[0], maxDistance = arguments[1]\n let distanceUpperBound = Double.POSITIVE_INFINITY\n const priQ = new PriorityQueue()\n priQ.add(initBndPair)\n while (!priQ.isEmpty()) {\n const bndPair = priQ.poll()\n const pairDistance = bndPair.getDistance()\n if (pairDistance > maxDistance) return false\n if (bndPair.maximumDistance() <= maxDistance) return true\n if (bndPair.isLeaves()) {\n distanceUpperBound = pairDistance\n if (distanceUpperBound <= maxDistance) return true\n } else {\n bndPair.expandToQueue(priQ, distanceUpperBound)\n }\n }\n return false\n } else if (arguments.length === 3) {\n const tree = arguments[0], itemDist = arguments[1], maxDistance = arguments[2]\n const bp = new BoundablePair(this.getRoot(), tree.getRoot(), itemDist)\n return this.isWithinDistance(bp, maxDistance)\n }\n }\n get interfaces_() {\n return [SpatialIndex, Serializable]\n }\n}\nclass STRtreeNode extends AbstractNode {\n constructor() {\n super()\n STRtreeNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const level = arguments[0]\n AbstractNode.constructor_.call(this, level)\n }\n computeBounds() {\n let bounds = null\n for (let i = this.getChildBoundables().iterator(); i.hasNext(); ) {\n const childBoundable = i.next()\n if (bounds === null) \n bounds = new Envelope(childBoundable.getBounds())\n else \n bounds.expandToInclude(childBoundable.getBounds())\n \n }\n return bounds\n }\n}\nSTRtree.STRtreeNode = STRtreeNode\nSTRtree.xComparator = new (class {\n get interfaces_() {\n return [Comparator]\n }\n compare(o1, o2) {\n return AbstractSTRtree.compareDoubles(STRtree.centreX(o1.getBounds()), STRtree.centreX(o2.getBounds()))\n }\n})()\nSTRtree.yComparator = new (class {\n get interfaces_() {\n return [Comparator]\n }\n compare(o1, o2) {\n return AbstractSTRtree.compareDoubles(STRtree.centreY(o1.getBounds()), STRtree.centreY(o2.getBounds()))\n }\n})()\nSTRtree.intersectsOp = new (class {\n get interfaces_() {\n return [IntersectsOp]\n }\n intersects(aBounds, bBounds) {\n return aBounds.intersects(bBounds)\n }\n})()\nSTRtree.DEFAULT_NODE_CAPACITY = 10\n","import Assert from '../util/Assert.js'\nexport default class SegmentPointComparator {\n static relativeSign(x0, x1) {\n if (x0 < x1) return -1\n if (x0 > x1) return 1\n return 0\n }\n static compare(octant, p0, p1) {\n if (p0.equals2D(p1)) return 0\n const xSign = SegmentPointComparator.relativeSign(p0.x, p1.x)\n const ySign = SegmentPointComparator.relativeSign(p0.y, p1.y)\n switch (octant) {\n case 0:\n return SegmentPointComparator.compareValue(xSign, ySign)\n case 1:\n return SegmentPointComparator.compareValue(ySign, xSign)\n case 2:\n return SegmentPointComparator.compareValue(ySign, -xSign)\n case 3:\n return SegmentPointComparator.compareValue(-xSign, ySign)\n case 4:\n return SegmentPointComparator.compareValue(-xSign, -ySign)\n case 5:\n return SegmentPointComparator.compareValue(-ySign, -xSign)\n case 6:\n return SegmentPointComparator.compareValue(-ySign, xSign)\n case 7:\n return SegmentPointComparator.compareValue(xSign, -ySign)\n }\n Assert.shouldNeverReachHere('invalid octant value')\n return 0\n }\n static compareValue(compareSign0, compareSign1) {\n if (compareSign0 < 0) return -1\n if (compareSign0 > 0) return 1\n if (compareSign1 < 0) return -1\n if (compareSign1 > 0) return 1\n return 0\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport SegmentPointComparator from './SegmentPointComparator.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nexport default class SegmentNode {\n constructor() {\n SegmentNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._segString = null\n this.coord = null\n this.segmentIndex = null\n this._segmentOctant = null\n this._isInterior = null\n const segString = arguments[0], coord = arguments[1], segmentIndex = arguments[2], segmentOctant = arguments[3]\n this._segString = segString\n this.coord = new Coordinate(coord)\n this.segmentIndex = segmentIndex\n this._segmentOctant = segmentOctant\n this._isInterior = !coord.equals2D(segString.getCoordinate(segmentIndex))\n }\n getCoordinate() {\n return this.coord\n }\n print(out) {\n out.print(this.coord)\n out.print(' seg # = ' + this.segmentIndex)\n }\n compareTo(obj) {\n const other = obj\n if (this.segmentIndex < other.segmentIndex) return -1\n if (this.segmentIndex > other.segmentIndex) return 1\n if (this.coord.equals2D(other.coord)) return 0\n if (!this._isInterior) return -1\n if (!other._isInterior) return 1\n return SegmentPointComparator.compare(this._segmentOctant, this.coord, other.coord)\n }\n isEndPoint(maxSegmentIndex) {\n if (this.segmentIndex === 0 && !this._isInterior) return true\n if (this.segmentIndex === maxSegmentIndex) return true\n return false\n }\n toString() {\n return this.segmentIndex + ':' + this.coord.toString()\n }\n isInterior() {\n return this._isInterior\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","/**\n * @see http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html\n * @constructor\n * @private\n */\nexport default class Iterator {\n /**\n * Returns true if the iteration has more elements.\n * @return {boolean}\n */\n hasNext() {}\n\n /**\n * Returns the next element in the iteration.\n * @return {Object}\n */\n next() {}\n\n /**\n * Removes from the underlying collection the last element returned by the\n * iterator (optional operation).\n */\n remove() {}\n}\n","import CoordinateList from '../geom/CoordinateList.js'\nimport SegmentNode from './SegmentNode.js'\nimport Iterator from '../../../../java/util/Iterator.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport NodedSegmentString from './NodedSegmentString.js'\nimport Integer from '../../../../java/lang/Integer.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport RuntimeException from '../../../../java/lang/RuntimeException.js'\nimport Assert from '../util/Assert.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class SegmentNodeList {\n constructor() {\n SegmentNodeList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeMap = new TreeMap()\n this._edge = null\n const edge = arguments[0]\n this._edge = edge\n }\n getSplitCoordinates() {\n const coordList = new CoordinateList()\n this.addEndpoints()\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n this.addEdgeCoordinates(eiPrev, ei, coordList)\n eiPrev = ei\n }\n return coordList.toCoordinateArray()\n }\n addCollapsedNodes() {\n const collapsedVertexIndexes = new ArrayList()\n this.findCollapsesFromInsertedNodes(collapsedVertexIndexes)\n this.findCollapsesFromExistingVertices(collapsedVertexIndexes)\n for (let it = collapsedVertexIndexes.iterator(); it.hasNext(); ) {\n const vertexIndex = it.next().intValue()\n this.add(this._edge.getCoordinate(vertexIndex), vertexIndex)\n }\n }\n createSplitEdgePts(ei0, ei1) {\n let npts = ei1.segmentIndex - ei0.segmentIndex + 2\n if (npts === 2) return [new Coordinate(ei0.coord), new Coordinate(ei1.coord)]\n const lastSegStartPt = this._edge.getCoordinate(ei1.segmentIndex)\n const useIntPt1 = ei1.isInterior() || !ei1.coord.equals2D(lastSegStartPt)\n if (!useIntPt1) \n npts--\n \n const pts = new Array(npts).fill(null)\n let ipt = 0\n pts[ipt++] = new Coordinate(ei0.coord)\n for (let i = ei0.segmentIndex + 1; i <= ei1.segmentIndex; i++) \n pts[ipt++] = this._edge.getCoordinate(i)\n \n if (useIntPt1) pts[ipt] = new Coordinate(ei1.coord)\n return pts\n }\n print(out) {\n out.println('Intersections:')\n for (let it = this.iterator(); it.hasNext(); ) {\n const ei = it.next()\n ei.print(out)\n }\n }\n findCollapsesFromExistingVertices(collapsedVertexIndexes) {\n for (let i = 0; i < this._edge.size() - 2; i++) {\n const p0 = this._edge.getCoordinate(i)\n const p1 = this._edge.getCoordinate(i + 1)\n const p2 = this._edge.getCoordinate(i + 2)\n if (p0.equals2D(p2)) \n collapsedVertexIndexes.add(Integer.valueOf(i + 1))\n \n }\n }\n addEdgeCoordinates(ei0, ei1, coordList) {\n const pts = this.createSplitEdgePts(ei0, ei1)\n coordList.add(pts, false)\n }\n iterator() {\n return this._nodeMap.values().iterator()\n }\n addSplitEdges(edgeList) {\n this.addEndpoints()\n this.addCollapsedNodes()\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n const newEdge = this.createSplitEdge(eiPrev, ei)\n edgeList.add(newEdge)\n eiPrev = ei\n }\n }\n findCollapseIndex(ei0, ei1, collapsedVertexIndex) {\n if (!ei0.coord.equals2D(ei1.coord)) return false\n let numVerticesBetween = ei1.segmentIndex - ei0.segmentIndex\n if (!ei1.isInterior()) \n numVerticesBetween--\n \n if (numVerticesBetween === 1) {\n collapsedVertexIndex[0] = ei0.segmentIndex + 1\n return true\n }\n return false\n }\n findCollapsesFromInsertedNodes(collapsedVertexIndexes) {\n const collapsedVertexIndex = new Array(1).fill(null)\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n const isCollapsed = this.findCollapseIndex(eiPrev, ei, collapsedVertexIndex)\n if (isCollapsed) collapsedVertexIndexes.add(Integer.valueOf(collapsedVertexIndex[0]))\n eiPrev = ei\n }\n }\n getEdge() {\n return this._edge\n }\n addEndpoints() {\n const maxSegIndex = this._edge.size() - 1\n this.add(this._edge.getCoordinate(0), 0)\n this.add(this._edge.getCoordinate(maxSegIndex), maxSegIndex)\n }\n createSplitEdge(ei0, ei1) {\n const pts = this.createSplitEdgePts(ei0, ei1)\n return new NodedSegmentString(pts, this._edge.getData())\n }\n add(intPt, segmentIndex) {\n const eiNew = new SegmentNode(this._edge, intPt, segmentIndex, this._edge.getSegmentOctant(segmentIndex))\n const ei = this._nodeMap.get(eiNew)\n if (ei !== null) {\n Assert.isTrue(ei.coord.equals2D(intPt), 'Found equal nodes with different coordinates')\n return ei\n }\n this._nodeMap.put(eiNew, eiNew)\n return eiNew\n }\n checkSplitEdgesCorrectness(splitEdges) {\n const edgePts = this._edge.getCoordinates()\n const split0 = splitEdges.get(0)\n const pt0 = split0.getCoordinate(0)\n if (!pt0.equals2D(edgePts[0])) throw new RuntimeException('bad split edge start point at ' + pt0)\n const splitn = splitEdges.get(splitEdges.size() - 1)\n const splitnPts = splitn.getCoordinates()\n const ptn = splitnPts[splitnPts.length - 1]\n if (!ptn.equals2D(edgePts[edgePts.length - 1])) throw new RuntimeException('bad split edge end point at ' + ptn)\n }\n}\nclass NodeVertexIterator {\n constructor() {\n NodeVertexIterator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeList = null\n this._edge = null\n this._nodeIt = null\n this._currNode = null\n this._nextNode = null\n this._currSegIndex = 0\n const nodeList = arguments[0]\n this._nodeList = nodeList\n this._edge = nodeList.getEdge()\n this._nodeIt = nodeList.iterator()\n this.readNextNode()\n }\n next() {\n if (this._currNode === null) {\n this._currNode = this._nextNode\n this._currSegIndex = this._currNode.segmentIndex\n this.readNextNode()\n return this._currNode\n }\n if (this._nextNode === null) return null\n if (this._nextNode.segmentIndex === this._currNode.segmentIndex) {\n this._currNode = this._nextNode\n this._currSegIndex = this._currNode.segmentIndex\n this.readNextNode()\n return this._currNode\n }\n if (this._nextNode.segmentIndex > this._currNode.segmentIndex) {}\n return null\n }\n remove() {\n throw new UnsupportedOperationException(this.getClass().getName())\n }\n hasNext() {\n if (this._nextNode === null) return false\n return true\n }\n readNextNode() {\n if (this._nodeIt.hasNext()) this._nextNode = this._nodeIt.next(); else this._nextNode = null\n }\n get interfaces_() {\n return [Iterator]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nexport default class Octant {\n static octant() {\n if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const dx = arguments[0], dy = arguments[1]\n if (dx === 0.0 && dy === 0.0) throw new IllegalArgumentException('Cannot compute the octant for point ( ' + dx + ', ' + dy + ' )')\n const adx = Math.abs(dx)\n const ady = Math.abs(dy)\n if (dx >= 0) \n if (dy >= 0) \n if (adx >= ady) return 0; else return 1\n else \n if (adx >= ady) return 7; else return 6\n \n else \n if (dy >= 0) \n if (adx >= ady) return 3; else return 2\n else \n if (adx >= ady) return 4; else return 5\n \n \n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const p0 = arguments[0], p1 = arguments[1]\n const dx = p1.x - p0.x\n const dy = p1.y - p0.y\n if (dx === 0.0 && dy === 0.0) throw new IllegalArgumentException('Cannot compute the octant for two identical points ' + p0)\n return Octant.octant(dx, dy)\n }\n }\n}\n","export default class SegmentString {\n getCoordinates() {}\n size() {}\n getCoordinate(i) {}\n isClosed() {}\n setData(data) {}\n getData() {}\n}\n","import SegmentString from './SegmentString.js'\nexport default class NodableSegmentString {\n addIntersection(intPt, segmentIndex) {}\n get interfaces_() {\n return [SegmentString]\n }\n}\n","import SegmentNodeList from './SegmentNodeList.js'\nimport WKTWriter from '../io/WKTWriter.js'\nimport CoordinateArraySequence from '../geom/impl/CoordinateArraySequence.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Octant from './Octant.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport NodableSegmentString from './NodableSegmentString.js'\nexport default class NodedSegmentString {\n constructor() {\n NodedSegmentString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeList = new SegmentNodeList(this)\n this._pts = null\n this._data = null\n const pts = arguments[0], data = arguments[1]\n this._pts = pts\n this._data = data\n }\n static getNodedSubstrings() {\n if (arguments.length === 1) {\n const segStrings = arguments[0]\n const resultEdgelist = new ArrayList()\n NodedSegmentString.getNodedSubstrings(segStrings, resultEdgelist)\n return resultEdgelist\n } else if (arguments.length === 2) {\n const segStrings = arguments[0], resultEdgelist = arguments[1]\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n ss.getNodeList().addSplitEdges(resultEdgelist)\n }\n }\n }\n getCoordinates() {\n return this._pts\n }\n size() {\n return this._pts.length\n }\n getCoordinate(i) {\n return this._pts[i]\n }\n isClosed() {\n return this._pts[0].equals(this._pts[this._pts.length - 1])\n }\n getSegmentOctant(index) {\n if (index === this._pts.length - 1) return -1\n return this.safeOctant(this.getCoordinate(index), this.getCoordinate(index + 1))\n }\n setData(data) {\n this._data = data\n }\n safeOctant(p0, p1) {\n if (p0.equals2D(p1)) return 0\n return Octant.octant(p0, p1)\n }\n getData() {\n return this._data\n }\n addIntersection() {\n if (arguments.length === 2) {\n const intPt = arguments[0], segmentIndex = arguments[1]\n this.addIntersectionNode(intPt, segmentIndex)\n } else if (arguments.length === 4) {\n const li = arguments[0], segmentIndex = arguments[1], geomIndex = arguments[2], intIndex = arguments[3]\n const intPt = new Coordinate(li.getIntersection(intIndex))\n this.addIntersection(intPt, segmentIndex)\n }\n }\n toString() {\n return WKTWriter.toLineString(new CoordinateArraySequence(this._pts))\n }\n getNodeList() {\n return this._nodeList\n }\n addIntersectionNode(intPt, segmentIndex) {\n let normalizedSegmentIndex = segmentIndex\n const nextSegIndex = normalizedSegmentIndex + 1\n if (nextSegIndex < this._pts.length) {\n const nextPt = this._pts[nextSegIndex]\n if (intPt.equals2D(nextPt)) \n normalizedSegmentIndex = nextSegIndex\n \n }\n const ei = this._nodeList.add(intPt, normalizedSegmentIndex)\n return ei\n }\n addIntersections(li, segmentIndex, geomIndex) {\n for (let i = 0; i < li.getIntersectionNum(); i++) \n this.addIntersection(li, segmentIndex, geomIndex, i)\n \n }\n get interfaces_() {\n return [NodableSegmentString]\n }\n}\n","import Coordinate from './Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport Intersection from '../algorithm/Intersection.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nimport Serializable from '../../../../java/io/Serializable.js'\nimport Distance from '../algorithm/Distance.js'\nexport default class LineSegment {\n constructor() {\n LineSegment.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.p0 = null\n this.p1 = null\n if (arguments.length === 0) {\n LineSegment.constructor_.call(this, new Coordinate(), new Coordinate())\n } else if (arguments.length === 1) {\n const ls = arguments[0]\n LineSegment.constructor_.call(this, ls.p0, ls.p1)\n } else if (arguments.length === 2) {\n const p0 = arguments[0], p1 = arguments[1]\n this.p0 = p0\n this.p1 = p1\n } else if (arguments.length === 4) {\n const x0 = arguments[0], y0 = arguments[1], x1 = arguments[2], y1 = arguments[3]\n LineSegment.constructor_.call(this, new Coordinate(x0, y0), new Coordinate(x1, y1))\n }\n }\n static midPoint(p0, p1) {\n return new Coordinate((p0.x + p1.x) / 2, (p0.y + p1.y) / 2)\n }\n minX() {\n return Math.min(this.p0.x, this.p1.x)\n }\n orientationIndex() {\n if (arguments[0] instanceof LineSegment) {\n const seg = arguments[0]\n const orient0 = Orientation.index(this.p0, this.p1, seg.p0)\n const orient1 = Orientation.index(this.p0, this.p1, seg.p1)\n if (orient0 >= 0 && orient1 >= 0) return Math.max(orient0, orient1)\n if (orient0 <= 0 && orient1 <= 0) return Math.max(orient0, orient1)\n return 0\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return Orientation.index(this.p0, this.p1, p)\n }\n }\n toGeometry(geomFactory) {\n return geomFactory.createLineString([this.p0, this.p1])\n }\n isVertical() {\n return this.p0.x === this.p1.x\n }\n equals(o) {\n if (!(o instanceof LineSegment)) \n return false\n \n const other = o\n return this.p0.equals(other.p0) && this.p1.equals(other.p1)\n }\n intersection(line) {\n const li = new RobustLineIntersector()\n li.computeIntersection(this.p0, this.p1, line.p0, line.p1)\n if (li.hasIntersection()) return li.getIntersection(0)\n return null\n }\n project() {\n if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n if (p.equals(this.p0) || p.equals(this.p1)) return new Coordinate(p)\n const r = this.projectionFactor(p)\n const coord = new Coordinate()\n coord.x = this.p0.x + r * (this.p1.x - this.p0.x)\n coord.y = this.p0.y + r * (this.p1.y - this.p0.y)\n return coord\n } else if (arguments[0] instanceof LineSegment) {\n const seg = arguments[0]\n const pf0 = this.projectionFactor(seg.p0)\n const pf1 = this.projectionFactor(seg.p1)\n if (pf0 >= 1.0 && pf1 >= 1.0) return null\n if (pf0 <= 0.0 && pf1 <= 0.0) return null\n let newp0 = this.project(seg.p0)\n if (pf0 < 0.0) newp0 = this.p0\n if (pf0 > 1.0) newp0 = this.p1\n let newp1 = this.project(seg.p1)\n if (pf1 < 0.0) newp1 = this.p0\n if (pf1 > 1.0) newp1 = this.p1\n return new LineSegment(newp0, newp1)\n }\n }\n normalize() {\n if (this.p1.compareTo(this.p0) < 0) this.reverse()\n }\n angle() {\n return Math.atan2(this.p1.y - this.p0.y, this.p1.x - this.p0.x)\n }\n getCoordinate(i) {\n if (i === 0) return this.p0\n return this.p1\n }\n distancePerpendicular(p) {\n return Distance.pointToLinePerpendicular(p, this.p0, this.p1)\n }\n minY() {\n return Math.min(this.p0.y, this.p1.y)\n }\n midPoint() {\n return LineSegment.midPoint(this.p0, this.p1)\n }\n projectionFactor(p) {\n if (p.equals(this.p0)) return 0.0\n if (p.equals(this.p1)) return 1.0\n const dx = this.p1.x - this.p0.x\n const dy = this.p1.y - this.p0.y\n const len = dx * dx + dy * dy\n if (len <= 0.0) return Double.NaN\n const r = ((p.x - this.p0.x) * dx + (p.y - this.p0.y) * dy) / len\n return r\n }\n closestPoints(line) {\n const intPt = this.intersection(line)\n if (intPt !== null) \n return [intPt, intPt]\n \n const closestPt = new Array(2).fill(null)\n let minDistance = Double.MAX_VALUE\n let dist = null\n const close00 = this.closestPoint(line.p0)\n minDistance = close00.distance(line.p0)\n closestPt[0] = close00\n closestPt[1] = line.p0\n const close01 = this.closestPoint(line.p1)\n dist = close01.distance(line.p1)\n if (dist < minDistance) {\n minDistance = dist\n closestPt[0] = close01\n closestPt[1] = line.p1\n }\n const close10 = line.closestPoint(this.p0)\n dist = close10.distance(this.p0)\n if (dist < minDistance) {\n minDistance = dist\n closestPt[0] = this.p0\n closestPt[1] = close10\n }\n const close11 = line.closestPoint(this.p1)\n dist = close11.distance(this.p1)\n if (dist < minDistance) {\n minDistance = dist\n closestPt[0] = this.p1\n closestPt[1] = close11\n }\n return closestPt\n }\n closestPoint(p) {\n const factor = this.projectionFactor(p)\n if (factor > 0 && factor < 1) \n return this.project(p)\n \n const dist0 = this.p0.distance(p)\n const dist1 = this.p1.distance(p)\n if (dist0 < dist1) return this.p0\n return this.p1\n }\n maxX() {\n return Math.max(this.p0.x, this.p1.x)\n }\n getLength() {\n return this.p0.distance(this.p1)\n }\n compareTo(o) {\n const other = o\n const comp0 = this.p0.compareTo(other.p0)\n if (comp0 !== 0) return comp0\n return this.p1.compareTo(other.p1)\n }\n reverse() {\n const temp = this.p0\n this.p0 = this.p1\n this.p1 = temp\n }\n equalsTopo(other) {\n return this.p0.equals(other.p0) && this.p1.equals(other.p1) || this.p0.equals(other.p1) && this.p1.equals(other.p0)\n }\n lineIntersection(line) {\n const intPt = Intersection.intersection(this.p0, this.p1, line.p0, line.p1)\n return intPt\n }\n maxY() {\n return Math.max(this.p0.y, this.p1.y)\n }\n pointAlongOffset(segmentLengthFraction, offsetDistance) {\n const segx = this.p0.x + segmentLengthFraction * (this.p1.x - this.p0.x)\n const segy = this.p0.y + segmentLengthFraction * (this.p1.y - this.p0.y)\n const dx = this.p1.x - this.p0.x\n const dy = this.p1.y - this.p0.y\n const len = Math.sqrt(dx * dx + dy * dy)\n let ux = 0.0\n let uy = 0.0\n if (offsetDistance !== 0.0) {\n if (len <= 0.0) throw new IllegalStateException('Cannot compute offset from zero-length line segment')\n ux = offsetDistance * dx / len\n uy = offsetDistance * dy / len\n }\n const offsetx = segx - uy\n const offsety = segy + ux\n const coord = new Coordinate(offsetx, offsety)\n return coord\n }\n setCoordinates() {\n if (arguments.length === 1) {\n const ls = arguments[0]\n this.setCoordinates(ls.p0, ls.p1)\n } else if (arguments.length === 2) {\n const p0 = arguments[0], p1 = arguments[1]\n this.p0.x = p0.x\n this.p0.y = p0.y\n this.p1.x = p1.x\n this.p1.y = p1.y\n }\n }\n segmentFraction(inputPt) {\n let segFrac = this.projectionFactor(inputPt)\n if (segFrac < 0.0) segFrac = 0.0; else if (segFrac > 1.0 || Double.isNaN(segFrac)) segFrac = 1.0\n return segFrac\n }\n toString() {\n return 'LINESTRING( ' + this.p0.x + ' ' + this.p0.y + ', ' + this.p1.x + ' ' + this.p1.y + ')'\n }\n isHorizontal() {\n return this.p0.y === this.p1.y\n }\n reflect(p) {\n const A = this.p1.getY() - this.p0.getY()\n const B = this.p0.getX() - this.p1.getX()\n const C = this.p0.getY() * (this.p1.getX() - this.p0.getX()) - this.p0.getX() * (this.p1.getY() - this.p0.getY())\n const A2plusB2 = A * A + B * B\n const A2subB2 = A * A - B * B\n const x = p.getX()\n const y = p.getY()\n const rx = (-A2subB2 * x - 2 * A * B * y - 2 * A * C) / A2plusB2\n const ry = (A2subB2 * y - 2 * A * B * x - 2 * B * C) / A2plusB2\n return new Coordinate(rx, ry)\n }\n distance() {\n if (arguments[0] instanceof LineSegment) {\n const ls = arguments[0]\n return Distance.segmentToSegment(this.p0, this.p1, ls.p0, ls.p1)\n } else if (arguments[0] instanceof Coordinate) {\n const p = arguments[0]\n return Distance.pointToSegment(p, this.p0, this.p1)\n }\n }\n pointAlong(segmentLengthFraction) {\n const coord = new Coordinate()\n coord.x = this.p0.x + segmentLengthFraction * (this.p1.x - this.p0.x)\n coord.y = this.p0.y + segmentLengthFraction * (this.p1.y - this.p0.y)\n return coord\n }\n hashCode() {\n let bits0 = Double.doubleToLongBits(this.p0.x)\n bits0 ^= Double.doubleToLongBits(this.p0.y) * 31\n const hash0 = Math.trunc(bits0) ^ Math.trunc(bits0 >> 32)\n let bits1 = Double.doubleToLongBits(this.p1.x)\n bits1 ^= Double.doubleToLongBits(this.p1.y) * 31\n const hash1 = Math.trunc(bits1) ^ Math.trunc(bits1 >> 32)\n return hash0 ^ hash1\n }\n get interfaces_() {\n return [Comparable, Serializable]\n }\n}\n","import LineSegment from '../../geom/LineSegment.js'\nexport default class MonotoneChainOverlapAction {\n constructor() {\n MonotoneChainOverlapAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._overlapSeg1 = new LineSegment()\n this._overlapSeg2 = new LineSegment()\n }\n overlap() {\n if (arguments.length === 2) {\n const seg1 = arguments[0], seg2 = arguments[1]\n } else if (arguments.length === 4) {\n const mc1 = arguments[0], start1 = arguments[1], mc2 = arguments[2], start2 = arguments[3]\n mc1.getLineSegment(start1, this._overlapSeg1)\n mc2.getLineSegment(start2, this._overlapSeg2)\n this.overlap(this._overlapSeg1, this._overlapSeg2)\n }\n }\n}\n","import Envelope from '../../geom/Envelope.js'\nexport default class MonotoneChain {\n constructor() {\n MonotoneChain.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pts = null\n this._start = null\n this._end = null\n this._env = null\n this._context = null\n this._id = null\n const pts = arguments[0], start = arguments[1], end = arguments[2], context = arguments[3]\n this._pts = pts\n this._start = start\n this._end = end\n this._context = context\n }\n getLineSegment(index, ls) {\n ls.p0 = this._pts[index]\n ls.p1 = this._pts[index + 1]\n }\n computeSelect(searchEnv, start0, end0, mcs) {\n const p0 = this._pts[start0]\n const p1 = this._pts[end0]\n if (end0 - start0 === 1) {\n mcs.select(this, start0)\n return null\n }\n if (!searchEnv.intersects(p0, p1)) return null\n const mid = Math.trunc((start0 + end0) / 2)\n if (start0 < mid) \n this.computeSelect(searchEnv, start0, mid, mcs)\n \n if (mid < end0) \n this.computeSelect(searchEnv, mid, end0, mcs)\n \n }\n getCoordinates() {\n const coord = new Array(this._end - this._start + 1).fill(null)\n let index = 0\n for (let i = this._start; i <= this._end; i++) \n coord[index++] = this._pts[i]\n \n return coord\n }\n computeOverlaps() {\n if (arguments.length === 2) {\n const mc = arguments[0], mco = arguments[1]\n this.computeOverlaps(this._start, this._end, mc, mc._start, mc._end, mco)\n } else if (arguments.length === 6) {\n const start0 = arguments[0], end0 = arguments[1], mc = arguments[2], start1 = arguments[3], end1 = arguments[4], mco = arguments[5]\n if (end0 - start0 === 1 && end1 - start1 === 1) {\n mco.overlap(this, start0, mc, start1)\n return null\n }\n if (!this.overlaps(start0, end0, mc, start1, end1)) return null\n const mid0 = Math.trunc((start0 + end0) / 2)\n const mid1 = Math.trunc((start1 + end1) / 2)\n if (start0 < mid0) {\n if (start1 < mid1) this.computeOverlaps(start0, mid0, mc, start1, mid1, mco)\n if (mid1 < end1) this.computeOverlaps(start0, mid0, mc, mid1, end1, mco)\n }\n if (mid0 < end0) {\n if (start1 < mid1) this.computeOverlaps(mid0, end0, mc, start1, mid1, mco)\n if (mid1 < end1) this.computeOverlaps(mid0, end0, mc, mid1, end1, mco)\n }\n }\n }\n setId(id) {\n this._id = id\n }\n select(searchEnv, mcs) {\n this.computeSelect(searchEnv, this._start, this._end, mcs)\n }\n getEnvelope() {\n if (this._env === null) {\n const p0 = this._pts[this._start]\n const p1 = this._pts[this._end]\n this._env = new Envelope(p0, p1)\n }\n return this._env\n }\n overlaps(start0, end0, mc, start1, end1) {\n return Envelope.intersects(this._pts[start0], this._pts[end0], mc._pts[start1], mc._pts[end1])\n }\n getEndIndex() {\n return this._end\n }\n getStartIndex() {\n return this._start\n }\n getContext() {\n return this._context\n }\n getId() {\n return this._id\n }\n}\n","import MonotoneChain from './MonotoneChain.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Quadrant from '../../geomgraph/Quadrant.js'\nexport default class MonotoneChainBuilder {\n static findChainEnd(pts, start) {\n let safeStart = start\n while (safeStart < pts.length - 1 && pts[safeStart].equals2D(pts[safeStart + 1])) \n safeStart++\n \n if (safeStart >= pts.length - 1) \n return pts.length - 1\n \n const chainQuad = Quadrant.quadrant(pts[safeStart], pts[safeStart + 1])\n let last = start + 1\n while (last < pts.length) {\n if (!pts[last - 1].equals2D(pts[last])) {\n const quad = Quadrant.quadrant(pts[last - 1], pts[last])\n if (quad !== chainQuad) break\n }\n last++\n }\n return last - 1\n }\n static getChains() {\n if (arguments.length === 1) {\n const pts = arguments[0]\n return MonotoneChainBuilder.getChains(pts, null)\n } else if (arguments.length === 2) {\n const pts = arguments[0], context = arguments[1]\n const mcList = new ArrayList()\n let chainStart = 0\n do {\n const chainEnd = MonotoneChainBuilder.findChainEnd(pts, chainStart)\n const mc = new MonotoneChain(pts, chainStart, chainEnd, context)\n mcList.add(mc)\n chainStart = chainEnd\n } while (chainStart < pts.length - 1)\n return mcList\n }\n }\n}\n","export default class Noder {\n computeNodes(segStrings) {}\n getNodedSubstrings() {}\n}\n","import Noder from './Noder.js'\nexport default class SinglePassNoder {\n constructor() {\n SinglePassNoder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._segInt = null\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const segInt = arguments[0]\n this.setSegmentIntersector(segInt)\n }\n }\n setSegmentIntersector(segInt) {\n this._segInt = segInt\n }\n get interfaces_() {\n return [Noder]\n }\n}\n","import STRtree from '../index/strtree/STRtree.js'\nimport NodedSegmentString from './NodedSegmentString.js'\nimport MonotoneChainOverlapAction from '../index/chain/MonotoneChainOverlapAction.js'\nimport MonotoneChainBuilder from '../index/chain/MonotoneChainBuilder.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport SinglePassNoder from './SinglePassNoder.js'\nexport default class MCIndexNoder extends SinglePassNoder {\n constructor() {\n super()\n MCIndexNoder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._monoChains = new ArrayList()\n this._index = new STRtree()\n this._idCounter = 0\n this._nodedSegStrings = null\n this._nOverlaps = 0\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const si = arguments[0]\n SinglePassNoder.constructor_.call(this, si)\n }\n }\n getMonotoneChains() {\n return this._monoChains\n }\n getNodedSubstrings() {\n return NodedSegmentString.getNodedSubstrings(this._nodedSegStrings)\n }\n getIndex() {\n return this._index\n }\n add(segStr) {\n const segChains = MonotoneChainBuilder.getChains(segStr.getCoordinates(), segStr)\n for (let i = segChains.iterator(); i.hasNext(); ) {\n const mc = i.next()\n mc.setId(this._idCounter++)\n this._index.insert(mc.getEnvelope(), mc)\n this._monoChains.add(mc)\n }\n }\n computeNodes(inputSegStrings) {\n this._nodedSegStrings = inputSegStrings\n for (let i = inputSegStrings.iterator(); i.hasNext(); ) \n this.add(i.next())\n \n this.intersectChains()\n }\n intersectChains() {\n const overlapAction = new SegmentOverlapAction(this._segInt)\n for (let i = this._monoChains.iterator(); i.hasNext(); ) {\n const queryChain = i.next()\n const overlapChains = this._index.query(queryChain.getEnvelope())\n for (let j = overlapChains.iterator(); j.hasNext(); ) {\n const testChain = j.next()\n if (testChain.getId() > queryChain.getId()) {\n queryChain.computeOverlaps(testChain, overlapAction)\n this._nOverlaps++\n }\n if (this._segInt.isDone()) return null\n }\n }\n }\n}\nclass SegmentOverlapAction extends MonotoneChainOverlapAction {\n constructor() {\n super()\n SegmentOverlapAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._si = null\n const si = arguments[0]\n this._si = si\n }\n overlap() {\n if (arguments.length === 4) {\n const mc1 = arguments[0], start1 = arguments[1], mc2 = arguments[2], start2 = arguments[3]\n const ss1 = mc1.getContext()\n const ss2 = mc2.getContext()\n this._si.processIntersections(ss1, start1, ss2, start2)\n } else {\n return super.overlap.apply(this, arguments)\n }\n }\n}\nMCIndexNoder.SegmentOverlapAction = SegmentOverlapAction\n","import CoordinateList from '../../geom/CoordinateList.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Distance from '../../algorithm/Distance.js'\nexport default class BufferInputLineSimplifier {\n constructor() {\n BufferInputLineSimplifier.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._inputLine = null\n this._distanceTol = null\n this._isDeleted = null\n this._angleOrientation = Orientation.COUNTERCLOCKWISE\n const inputLine = arguments[0]\n this._inputLine = inputLine\n }\n static simplify(inputLine, distanceTol) {\n const simp = new BufferInputLineSimplifier(inputLine)\n return simp.simplify(distanceTol)\n }\n isDeletable(i0, i1, i2, distanceTol) {\n const p0 = this._inputLine[i0]\n const p1 = this._inputLine[i1]\n const p2 = this._inputLine[i2]\n if (!this.isConcave(p0, p1, p2)) return false\n if (!this.isShallow(p0, p1, p2, distanceTol)) return false\n return this.isShallowSampled(p0, p1, i0, i2, distanceTol)\n }\n deleteShallowConcavities() {\n let index = 1\n let midIndex = this.findNextNonDeletedIndex(index)\n let lastIndex = this.findNextNonDeletedIndex(midIndex)\n let isChanged = false\n while (lastIndex < this._inputLine.length) {\n let isMiddleVertexDeleted = false\n if (this.isDeletable(index, midIndex, lastIndex, this._distanceTol)) {\n this._isDeleted[midIndex] = BufferInputLineSimplifier.DELETE\n isMiddleVertexDeleted = true\n isChanged = true\n }\n if (isMiddleVertexDeleted) index = lastIndex; else index = midIndex\n midIndex = this.findNextNonDeletedIndex(index)\n lastIndex = this.findNextNonDeletedIndex(midIndex)\n }\n return isChanged\n }\n isShallowConcavity(p0, p1, p2, distanceTol) {\n const orientation = Orientation.index(p0, p1, p2)\n const isAngleToSimplify = orientation === this._angleOrientation\n if (!isAngleToSimplify) return false\n const dist = Distance.pointToSegment(p1, p0, p2)\n return dist < distanceTol\n }\n isShallowSampled(p0, p2, i0, i2, distanceTol) {\n let inc = Math.trunc((i2 - i0) / BufferInputLineSimplifier.NUM_PTS_TO_CHECK)\n if (inc <= 0) inc = 1\n for (let i = i0; i < i2; i += inc) \n if (!this.isShallow(p0, p2, this._inputLine[i], distanceTol)) return false\n \n return true\n }\n isConcave(p0, p1, p2) {\n const orientation = Orientation.index(p0, p1, p2)\n const isConcave = orientation === this._angleOrientation\n return isConcave\n }\n simplify(distanceTol) {\n this._distanceTol = Math.abs(distanceTol)\n if (distanceTol < 0) this._angleOrientation = Orientation.CLOCKWISE\n this._isDeleted = new Array(this._inputLine.length).fill(null)\n let isChanged = false\n do \n isChanged = this.deleteShallowConcavities()\n while (isChanged)\n return this.collapseLine()\n }\n findNextNonDeletedIndex(index) {\n let next = index + 1\n while (next < this._inputLine.length && this._isDeleted[next] === BufferInputLineSimplifier.DELETE) next++\n return next\n }\n isShallow(p0, p1, p2, distanceTol) {\n const dist = Distance.pointToSegment(p1, p0, p2)\n return dist < distanceTol\n }\n collapseLine() {\n const coordList = new CoordinateList()\n for (let i = 0; i < this._inputLine.length; i++) \n if (this._isDeleted[i] !== BufferInputLineSimplifier.DELETE) coordList.add(this._inputLine[i])\n \n return coordList.toCoordinateArray()\n }\n}\nBufferInputLineSimplifier.INIT = 0\nBufferInputLineSimplifier.DELETE = 1\nBufferInputLineSimplifier.KEEP = 1\nBufferInputLineSimplifier.NUM_PTS_TO_CHECK = 10\n","import GeometryFactory from '../../geom/GeometryFactory.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class OffsetSegmentString {\n constructor() {\n OffsetSegmentString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._ptList = null\n this._precisionModel = null\n this._minimimVertexDistance = 0.0\n this._ptList = new ArrayList()\n }\n getCoordinates() {\n const coord = this._ptList.toArray(OffsetSegmentString.COORDINATE_ARRAY_TYPE)\n return coord\n }\n setPrecisionModel(precisionModel) {\n this._precisionModel = precisionModel\n }\n addPt(pt) {\n const bufPt = new Coordinate(pt)\n this._precisionModel.makePrecise(bufPt)\n if (this.isRedundant(bufPt)) return null\n this._ptList.add(bufPt)\n }\n reverse() {}\n addPts(pt, isForward) {\n if (isForward) \n for (let i = 0; i < pt.length; i++) \n this.addPt(pt[i])\n \n else \n for (let i = pt.length - 1; i >= 0; i--) \n this.addPt(pt[i])\n \n \n }\n isRedundant(pt) {\n if (this._ptList.size() < 1) return false\n const lastPt = this._ptList.get(this._ptList.size() - 1)\n const ptDist = pt.distance(lastPt)\n if (ptDist < this._minimimVertexDistance) return true\n return false\n }\n toString() {\n const fact = new GeometryFactory()\n const line = fact.createLineString(this.getCoordinates())\n return line.toString()\n }\n closeRing() {\n if (this._ptList.size() < 1) return null\n const startPt = new Coordinate(this._ptList.get(0))\n const lastPt = this._ptList.get(this._ptList.size() - 1)\n if (startPt.equals(lastPt)) return null\n this._ptList.add(startPt)\n }\n setMinimumVertexDistance(minimimVertexDistance) {\n this._minimimVertexDistance = minimimVertexDistance\n }\n}\nOffsetSegmentString.COORDINATE_ARRAY_TYPE = new Array(0).fill(null)\n","import Orientation from './Orientation.js'\nexport default class Angle {\n static toDegrees(radians) {\n return radians * 180 / Math.PI\n }\n static normalize(angle) {\n while (angle > Math.PI) angle -= Angle.PI_TIMES_2\n while (angle <= -Math.PI) angle += Angle.PI_TIMES_2\n return angle\n }\n static angle() {\n if (arguments.length === 1) {\n const p = arguments[0]\n return Math.atan2(p.y, p.x)\n } else if (arguments.length === 2) {\n const p0 = arguments[0], p1 = arguments[1]\n const dx = p1.x - p0.x\n const dy = p1.y - p0.y\n return Math.atan2(dy, dx)\n }\n }\n static isAcute(p0, p1, p2) {\n const dx0 = p0.x - p1.x\n const dy0 = p0.y - p1.y\n const dx1 = p2.x - p1.x\n const dy1 = p2.y - p1.y\n const dotprod = dx0 * dx1 + dy0 * dy1\n return dotprod > 0\n }\n static isObtuse(p0, p1, p2) {\n const dx0 = p0.x - p1.x\n const dy0 = p0.y - p1.y\n const dx1 = p2.x - p1.x\n const dy1 = p2.y - p1.y\n const dotprod = dx0 * dx1 + dy0 * dy1\n return dotprod < 0\n }\n static interiorAngle(p0, p1, p2) {\n const anglePrev = Angle.angle(p1, p0)\n const angleNext = Angle.angle(p1, p2)\n return Math.abs(angleNext - anglePrev)\n }\n static normalizePositive(angle) {\n if (angle < 0.0) {\n while (angle < 0.0) angle += Angle.PI_TIMES_2\n if (angle >= Angle.PI_TIMES_2) angle = 0.0\n } else {\n while (angle >= Angle.PI_TIMES_2) angle -= Angle.PI_TIMES_2\n if (angle < 0.0) angle = 0.0\n }\n return angle\n }\n static angleBetween(tip1, tail, tip2) {\n const a1 = Angle.angle(tail, tip1)\n const a2 = Angle.angle(tail, tip2)\n return Angle.diff(a1, a2)\n }\n static diff(ang1, ang2) {\n let delAngle = null\n if (ang1 < ang2) \n delAngle = ang2 - ang1\n else \n delAngle = ang1 - ang2\n \n if (delAngle > Math.PI) \n delAngle = 2 * Math.PI - delAngle\n \n return delAngle\n }\n static toRadians(angleDegrees) {\n return angleDegrees * Math.PI / 180.0\n }\n static getTurn(ang1, ang2) {\n const crossproduct = Math.sin(ang2 - ang1)\n if (crossproduct > 0) \n return Angle.COUNTERCLOCKWISE\n \n if (crossproduct < 0) \n return Angle.CLOCKWISE\n \n return Angle.NONE\n }\n static angleBetweenOriented(tip1, tail, tip2) {\n const a1 = Angle.angle(tail, tip1)\n const a2 = Angle.angle(tail, tip2)\n const angDel = a2 - a1\n if (angDel <= -Math.PI) return angDel + Angle.PI_TIMES_2\n if (angDel > Math.PI) return angDel - Angle.PI_TIMES_2\n return angDel\n }\n}\nAngle.PI_TIMES_2 = 2.0 * Math.PI\nAngle.PI_OVER_2 = Math.PI / 2.0\nAngle.PI_OVER_4 = Math.PI / 4.0\nAngle.COUNTERCLOCKWISE = Orientation.COUNTERCLOCKWISE\nAngle.CLOCKWISE = Orientation.CLOCKWISE\nAngle.NONE = Orientation.COLLINEAR\n","import BufferParameters from './BufferParameters.js'\nimport Position from '../../geomgraph/Position.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Intersection from '../../algorithm/Intersection.js'\nimport OffsetSegmentString from './OffsetSegmentString.js'\nimport LineSegment from '../../geom/LineSegment.js'\nimport Angle from '../../algorithm/Angle.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nexport default class OffsetSegmentGenerator {\n constructor() {\n OffsetSegmentGenerator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._maxCurveSegmentError = 0.0\n this._filletAngleQuantum = null\n this._closingSegLengthFactor = 1\n this._segList = null\n this._distance = 0.0\n this._precisionModel = null\n this._bufParams = null\n this._li = null\n this._s0 = null\n this._s1 = null\n this._s2 = null\n this._seg0 = new LineSegment()\n this._seg1 = new LineSegment()\n this._offset0 = new LineSegment()\n this._offset1 = new LineSegment()\n this._side = 0\n this._hasNarrowConcaveAngle = false\n const precisionModel = arguments[0], bufParams = arguments[1], distance = arguments[2]\n this._precisionModel = precisionModel\n this._bufParams = bufParams\n this._li = new RobustLineIntersector()\n this._filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments()\n if (bufParams.getQuadrantSegments() >= 8 && bufParams.getJoinStyle() === BufferParameters.JOIN_ROUND) this._closingSegLengthFactor = OffsetSegmentGenerator.MAX_CLOSING_SEG_LEN_FACTOR\n this.init(distance)\n }\n addNextSegment(p, addStartPoint) {\n this._s0 = this._s1\n this._s1 = this._s2\n this._s2 = p\n this._seg0.setCoordinates(this._s0, this._s1)\n this.computeOffsetSegment(this._seg0, this._side, this._distance, this._offset0)\n this._seg1.setCoordinates(this._s1, this._s2)\n this.computeOffsetSegment(this._seg1, this._side, this._distance, this._offset1)\n if (this._s1.equals(this._s2)) return null\n const orientation = Orientation.index(this._s0, this._s1, this._s2)\n const outsideTurn = orientation === Orientation.CLOCKWISE && this._side === Position.LEFT || orientation === Orientation.COUNTERCLOCKWISE && this._side === Position.RIGHT\n if (orientation === 0) \n this.addCollinear(addStartPoint)\n else if (outsideTurn) \n this.addOutsideTurn(orientation, addStartPoint)\n else \n this.addInsideTurn(orientation, addStartPoint)\n \n }\n addLineEndCap(p0, p1) {\n const seg = new LineSegment(p0, p1)\n const offsetL = new LineSegment()\n this.computeOffsetSegment(seg, Position.LEFT, this._distance, offsetL)\n const offsetR = new LineSegment()\n this.computeOffsetSegment(seg, Position.RIGHT, this._distance, offsetR)\n const dx = p1.x - p0.x\n const dy = p1.y - p0.y\n const angle = Math.atan2(dy, dx)\n switch (this._bufParams.getEndCapStyle()) {\n case BufferParameters.CAP_ROUND:\n this._segList.addPt(offsetL.p1)\n this.addDirectedFillet(p1, angle + Math.PI / 2, angle - Math.PI / 2, Orientation.CLOCKWISE, this._distance)\n this._segList.addPt(offsetR.p1)\n break\n case BufferParameters.CAP_FLAT:\n this._segList.addPt(offsetL.p1)\n this._segList.addPt(offsetR.p1)\n break\n case BufferParameters.CAP_SQUARE:\n const squareCapSideOffset = new Coordinate()\n squareCapSideOffset.x = Math.abs(this._distance) * Math.cos(angle)\n squareCapSideOffset.y = Math.abs(this._distance) * Math.sin(angle)\n const squareCapLOffset = new Coordinate(offsetL.p1.x + squareCapSideOffset.x, offsetL.p1.y + squareCapSideOffset.y)\n const squareCapROffset = new Coordinate(offsetR.p1.x + squareCapSideOffset.x, offsetR.p1.y + squareCapSideOffset.y)\n this._segList.addPt(squareCapLOffset)\n this._segList.addPt(squareCapROffset)\n break\n }\n }\n getCoordinates() {\n const pts = this._segList.getCoordinates()\n return pts\n }\n addMitreJoin(p, offset0, offset1, distance) {\n const intPt = Intersection.intersection(offset0.p0, offset0.p1, offset1.p0, offset1.p1)\n if (intPt !== null) {\n const mitreRatio = distance <= 0.0 ? 1.0 : intPt.distance(p) / Math.abs(distance)\n if (mitreRatio <= this._bufParams.getMitreLimit()) {\n this._segList.addPt(intPt)\n return null\n }\n }\n this.addLimitedMitreJoin(offset0, offset1, distance, this._bufParams.getMitreLimit())\n }\n addOutsideTurn(orientation, addStartPoint) {\n if (this._offset0.p1.distance(this._offset1.p0) < this._distance * OffsetSegmentGenerator.OFFSET_SEGMENT_SEPARATION_FACTOR) {\n this._segList.addPt(this._offset0.p1)\n return null\n }\n if (this._bufParams.getJoinStyle() === BufferParameters.JOIN_MITRE) {\n this.addMitreJoin(this._s1, this._offset0, this._offset1, this._distance)\n } else if (this._bufParams.getJoinStyle() === BufferParameters.JOIN_BEVEL) {\n this.addBevelJoin(this._offset0, this._offset1)\n } else {\n if (addStartPoint) this._segList.addPt(this._offset0.p1)\n this.addCornerFillet(this._s1, this._offset0.p1, this._offset1.p0, orientation, this._distance)\n this._segList.addPt(this._offset1.p0)\n }\n }\n createSquare(p) {\n this._segList.addPt(new Coordinate(p.x + this._distance, p.y + this._distance))\n this._segList.addPt(new Coordinate(p.x + this._distance, p.y - this._distance))\n this._segList.addPt(new Coordinate(p.x - this._distance, p.y - this._distance))\n this._segList.addPt(new Coordinate(p.x - this._distance, p.y + this._distance))\n this._segList.closeRing()\n }\n addSegments(pt, isForward) {\n this._segList.addPts(pt, isForward)\n }\n addFirstSegment() {\n this._segList.addPt(this._offset1.p0)\n }\n addCornerFillet(p, p0, p1, direction, radius) {\n const dx0 = p0.x - p.x\n const dy0 = p0.y - p.y\n let startAngle = Math.atan2(dy0, dx0)\n const dx1 = p1.x - p.x\n const dy1 = p1.y - p.y\n const endAngle = Math.atan2(dy1, dx1)\n if (direction === Orientation.CLOCKWISE) {\n if (startAngle <= endAngle) startAngle += 2.0 * Math.PI\n } else {\n if (startAngle >= endAngle) startAngle -= 2.0 * Math.PI\n }\n this._segList.addPt(p0)\n this.addDirectedFillet(p, startAngle, endAngle, direction, radius)\n this._segList.addPt(p1)\n }\n addLastSegment() {\n this._segList.addPt(this._offset1.p1)\n }\n initSideSegments(s1, s2, side) {\n this._s1 = s1\n this._s2 = s2\n this._side = side\n this._seg1.setCoordinates(s1, s2)\n this.computeOffsetSegment(this._seg1, side, this._distance, this._offset1)\n }\n addLimitedMitreJoin(offset0, offset1, distance, mitreLimit) {\n const basePt = this._seg0.p1\n const ang0 = Angle.angle(basePt, this._seg0.p0)\n const angDiff = Angle.angleBetweenOriented(this._seg0.p0, basePt, this._seg1.p1)\n const angDiffHalf = angDiff / 2\n const midAng = Angle.normalize(ang0 + angDiffHalf)\n const mitreMidAng = Angle.normalize(midAng + Math.PI)\n const mitreDist = mitreLimit * distance\n const bevelDelta = mitreDist * Math.abs(Math.sin(angDiffHalf))\n const bevelHalfLen = distance - bevelDelta\n const bevelMidX = basePt.x + mitreDist * Math.cos(mitreMidAng)\n const bevelMidY = basePt.y + mitreDist * Math.sin(mitreMidAng)\n const bevelMidPt = new Coordinate(bevelMidX, bevelMidY)\n const mitreMidLine = new LineSegment(basePt, bevelMidPt)\n const bevelEndLeft = mitreMidLine.pointAlongOffset(1.0, bevelHalfLen)\n const bevelEndRight = mitreMidLine.pointAlongOffset(1.0, -bevelHalfLen)\n if (this._side === Position.LEFT) {\n this._segList.addPt(bevelEndLeft)\n this._segList.addPt(bevelEndRight)\n } else {\n this._segList.addPt(bevelEndRight)\n this._segList.addPt(bevelEndLeft)\n }\n }\n addDirectedFillet(p, startAngle, endAngle, direction, radius) {\n const directionFactor = direction === Orientation.CLOCKWISE ? -1 : 1\n const totalAngle = Math.abs(startAngle - endAngle)\n const nSegs = Math.trunc(totalAngle / this._filletAngleQuantum + 0.5)\n if (nSegs < 1) return null\n const angleInc = totalAngle / nSegs\n const pt = new Coordinate()\n for (let i = 0; i < nSegs; i++) {\n const angle = startAngle + directionFactor * i * angleInc\n pt.x = p.x + radius * Math.cos(angle)\n pt.y = p.y + radius * Math.sin(angle)\n this._segList.addPt(pt)\n }\n }\n computeOffsetSegment(seg, side, distance, offset) {\n const sideSign = side === Position.LEFT ? 1 : -1\n const dx = seg.p1.x - seg.p0.x\n const dy = seg.p1.y - seg.p0.y\n const len = Math.sqrt(dx * dx + dy * dy)\n const ux = sideSign * distance * dx / len\n const uy = sideSign * distance * dy / len\n offset.p0.x = seg.p0.x - uy\n offset.p0.y = seg.p0.y + ux\n offset.p1.x = seg.p1.x - uy\n offset.p1.y = seg.p1.y + ux\n }\n addInsideTurn(orientation, addStartPoint) {\n this._li.computeIntersection(this._offset0.p0, this._offset0.p1, this._offset1.p0, this._offset1.p1)\n if (this._li.hasIntersection()) {\n this._segList.addPt(this._li.getIntersection(0))\n } else {\n this._hasNarrowConcaveAngle = true\n if (this._offset0.p1.distance(this._offset1.p0) < this._distance * OffsetSegmentGenerator.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR) {\n this._segList.addPt(this._offset0.p1)\n } else {\n this._segList.addPt(this._offset0.p1)\n if (this._closingSegLengthFactor > 0) {\n const mid0 = new Coordinate((this._closingSegLengthFactor * this._offset0.p1.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset0.p1.y + this._s1.y) / (this._closingSegLengthFactor + 1))\n this._segList.addPt(mid0)\n const mid1 = new Coordinate((this._closingSegLengthFactor * this._offset1.p0.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset1.p0.y + this._s1.y) / (this._closingSegLengthFactor + 1))\n this._segList.addPt(mid1)\n } else {\n this._segList.addPt(this._s1)\n }\n this._segList.addPt(this._offset1.p0)\n }\n }\n }\n createCircle(p) {\n const pt = new Coordinate(p.x + this._distance, p.y)\n this._segList.addPt(pt)\n this.addDirectedFillet(p, 0.0, 2.0 * Math.PI, -1, this._distance)\n this._segList.closeRing()\n }\n addBevelJoin(offset0, offset1) {\n this._segList.addPt(offset0.p1)\n this._segList.addPt(offset1.p0)\n }\n init(distance) {\n this._distance = distance\n this._maxCurveSegmentError = distance * (1 - Math.cos(this._filletAngleQuantum / 2.0))\n this._segList = new OffsetSegmentString()\n this._segList.setPrecisionModel(this._precisionModel)\n this._segList.setMinimumVertexDistance(distance * OffsetSegmentGenerator.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)\n }\n addCollinear(addStartPoint) {\n this._li.computeIntersection(this._s0, this._s1, this._s1, this._s2)\n const numInt = this._li.getIntersectionNum()\n if (numInt >= 2) \n if (this._bufParams.getJoinStyle() === BufferParameters.JOIN_BEVEL || this._bufParams.getJoinStyle() === BufferParameters.JOIN_MITRE) {\n if (addStartPoint) this._segList.addPt(this._offset0.p1)\n this._segList.addPt(this._offset1.p0)\n } else {\n this.addCornerFillet(this._s1, this._offset0.p1, this._offset1.p0, Orientation.CLOCKWISE, this._distance)\n }\n \n }\n closeRing() {\n this._segList.closeRing()\n }\n hasNarrowConcaveAngle() {\n return this._hasNarrowConcaveAngle\n }\n}\nOffsetSegmentGenerator.OFFSET_SEGMENT_SEPARATION_FACTOR = 1.0E-3\nOffsetSegmentGenerator.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR = 1.0E-3\nOffsetSegmentGenerator.CURVE_VERTEX_SNAP_DISTANCE_FACTOR = 1.0E-6\nOffsetSegmentGenerator.MAX_CLOSING_SEG_LEN_FACTOR = 80\n","import BufferParameters from './BufferParameters.js'\nimport Position from '../../geomgraph/Position.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport BufferInputLineSimplifier from './BufferInputLineSimplifier.js'\nimport CoordinateArrays from '../../geom/CoordinateArrays.js'\nimport OffsetSegmentGenerator from './OffsetSegmentGenerator.js'\nexport default class OffsetCurveBuilder {\n constructor() {\n OffsetCurveBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._distance = 0.0\n this._precisionModel = null\n this._bufParams = null\n const precisionModel = arguments[0], bufParams = arguments[1]\n this._precisionModel = precisionModel\n this._bufParams = bufParams\n }\n static copyCoordinates(pts) {\n const copy = new Array(pts.length).fill(null)\n for (let i = 0; i < copy.length; i++) \n copy[i] = new Coordinate(pts[i])\n \n return copy\n }\n getOffsetCurve(inputPts, distance) {\n this._distance = distance\n if (distance === 0.0) return null\n const isRightSide = distance < 0.0\n const posDistance = Math.abs(distance)\n const segGen = this.getSegGen(posDistance)\n if (inputPts.length <= 1) \n this.computePointCurve(inputPts[0], segGen)\n else \n this.computeOffsetCurve(inputPts, isRightSide, segGen)\n \n const curvePts = segGen.getCoordinates()\n if (isRightSide) CoordinateArrays.reverse(curvePts)\n return curvePts\n }\n computeSingleSidedBufferCurve(inputPts, isRightSide, segGen) {\n const distTol = this.simplifyTolerance(this._distance)\n if (isRightSide) {\n segGen.addSegments(inputPts, true)\n const simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol)\n const n2 = simp2.length - 1\n segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = n2 - 2; i >= 0; i--) \n segGen.addNextSegment(simp2[i], true)\n \n } else {\n segGen.addSegments(inputPts, false)\n const simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n1 = simp1.length - 1\n segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = 2; i <= n1; i++) \n segGen.addNextSegment(simp1[i], true)\n \n }\n segGen.addLastSegment()\n segGen.closeRing()\n }\n computeRingBufferCurve(inputPts, side, segGen) {\n let distTol = this.simplifyTolerance(this._distance)\n if (side === Position.RIGHT) distTol = -distTol\n const simp = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n = simp.length - 1\n segGen.initSideSegments(simp[n - 1], simp[0], side)\n for (let i = 1; i <= n; i++) {\n const addStartPoint = i !== 1\n segGen.addNextSegment(simp[i], addStartPoint)\n }\n segGen.closeRing()\n }\n computeLineBufferCurve(inputPts, segGen) {\n const distTol = this.simplifyTolerance(this._distance)\n const simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n1 = simp1.length - 1\n segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT)\n for (let i = 2; i <= n1; i++) \n segGen.addNextSegment(simp1[i], true)\n \n segGen.addLastSegment()\n segGen.addLineEndCap(simp1[n1 - 1], simp1[n1])\n const simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol)\n const n2 = simp2.length - 1\n segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT)\n for (let i = n2 - 2; i >= 0; i--) \n segGen.addNextSegment(simp2[i], true)\n \n segGen.addLastSegment()\n segGen.addLineEndCap(simp2[1], simp2[0])\n segGen.closeRing()\n }\n computePointCurve(pt, segGen) {\n switch (this._bufParams.getEndCapStyle()) {\n case BufferParameters.CAP_ROUND:\n segGen.createCircle(pt)\n break\n case BufferParameters.CAP_SQUARE:\n segGen.createSquare(pt)\n break\n }\n }\n getLineCurve(inputPts, distance) {\n this._distance = distance\n if (this.isLineOffsetEmpty(distance)) return null\n const posDistance = Math.abs(distance)\n const segGen = this.getSegGen(posDistance)\n if (inputPts.length <= 1) {\n this.computePointCurve(inputPts[0], segGen)\n } else \n if (this._bufParams.isSingleSided()) {\n const isRightSide = distance < 0.0\n this.computeSingleSidedBufferCurve(inputPts, isRightSide, segGen)\n } else {\n this.computeLineBufferCurve(inputPts, segGen)\n }\n \n const lineCoord = segGen.getCoordinates()\n return lineCoord\n }\n getBufferParameters() {\n return this._bufParams\n }\n simplifyTolerance(bufDistance) {\n return bufDistance * this._bufParams.getSimplifyFactor()\n }\n getRingCurve(inputPts, side, distance) {\n this._distance = distance\n if (inputPts.length <= 2) return this.getLineCurve(inputPts, distance)\n if (distance === 0.0) \n return OffsetCurveBuilder.copyCoordinates(inputPts)\n \n const segGen = this.getSegGen(distance)\n this.computeRingBufferCurve(inputPts, side, segGen)\n return segGen.getCoordinates()\n }\n computeOffsetCurve(inputPts, isRightSide, segGen) {\n const distTol = this.simplifyTolerance(this._distance)\n if (isRightSide) {\n const simp2 = BufferInputLineSimplifier.simplify(inputPts, -distTol)\n const n2 = simp2.length - 1\n segGen.initSideSegments(simp2[n2], simp2[n2 - 1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = n2 - 2; i >= 0; i--) \n segGen.addNextSegment(simp2[i], true)\n \n } else {\n const simp1 = BufferInputLineSimplifier.simplify(inputPts, distTol)\n const n1 = simp1.length - 1\n segGen.initSideSegments(simp1[0], simp1[1], Position.LEFT)\n segGen.addFirstSegment()\n for (let i = 2; i <= n1; i++) \n segGen.addNextSegment(simp1[i], true)\n \n }\n segGen.addLastSegment()\n }\n isLineOffsetEmpty(distance) {\n if (distance === 0.0) return true\n if (distance < 0.0 && !this._bufParams.isSingleSided()) return true\n return false\n }\n getSegGen(distance) {\n return new OffsetSegmentGenerator(this._precisionModel, this._bufParams, distance)\n }\n}\n","import hasInterface from '../../../../../hasInterface.js'\nimport Position from '../../geomgraph/Position.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport DirectedEdge from '../../geomgraph/DirectedEdge.js'\nimport LineSegment from '../../geom/LineSegment.js'\nimport Comparable from '../../../../../java/lang/Comparable.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport List from '../../../../../java/util/List.js'\nexport default class SubgraphDepthLocater {\n constructor() {\n SubgraphDepthLocater.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._subgraphs = null\n this._seg = new LineSegment()\n const subgraphs = arguments[0]\n this._subgraphs = subgraphs\n }\n findStabbedSegments() {\n if (arguments.length === 1) {\n const stabbingRayLeftPt = arguments[0]\n const stabbedSegments = new ArrayList()\n for (let i = this._subgraphs.iterator(); i.hasNext(); ) {\n const bsg = i.next()\n const env = bsg.getEnvelope()\n if (stabbingRayLeftPt.y < env.getMinY() || stabbingRayLeftPt.y > env.getMaxY()) continue\n this.findStabbedSegments(stabbingRayLeftPt, bsg.getDirectedEdges(), stabbedSegments)\n }\n return stabbedSegments\n } else if (arguments.length === 3) {\n if (hasInterface(arguments[2], List) && (arguments[0] instanceof Coordinate && arguments[1] instanceof DirectedEdge)) {\n const stabbingRayLeftPt = arguments[0], dirEdge = arguments[1], stabbedSegments = arguments[2]\n const pts = dirEdge.getEdge().getCoordinates()\n for (let i = 0; i < pts.length - 1; i++) {\n this._seg.p0 = pts[i]\n this._seg.p1 = pts[i + 1]\n if (this._seg.p0.y > this._seg.p1.y) this._seg.reverse()\n const maxx = Math.max(this._seg.p0.x, this._seg.p1.x)\n if (maxx < stabbingRayLeftPt.x) continue\n if (this._seg.isHorizontal()) continue\n if (stabbingRayLeftPt.y < this._seg.p0.y || stabbingRayLeftPt.y > this._seg.p1.y) continue\n if (Orientation.index(this._seg.p0, this._seg.p1, stabbingRayLeftPt) === Orientation.RIGHT) continue\n let depth = dirEdge.getDepth(Position.LEFT)\n if (!this._seg.p0.equals(pts[i])) depth = dirEdge.getDepth(Position.RIGHT)\n const ds = new DepthSegment(this._seg, depth)\n stabbedSegments.add(ds)\n }\n } else if (hasInterface(arguments[2], List) && (arguments[0] instanceof Coordinate && hasInterface(arguments[1], List))) {\n const stabbingRayLeftPt = arguments[0], dirEdges = arguments[1], stabbedSegments = arguments[2]\n for (let i = dirEdges.iterator(); i.hasNext(); ) {\n const de = i.next()\n if (!de.isForward()) continue\n this.findStabbedSegments(stabbingRayLeftPt, de, stabbedSegments)\n }\n }\n }\n }\n getDepth(p) {\n const stabbedSegments = this.findStabbedSegments(p)\n if (stabbedSegments.size() === 0) return 0\n const ds = Collections.min(stabbedSegments)\n return ds._leftDepth\n }\n}\nclass DepthSegment {\n constructor() {\n DepthSegment.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._upwardSeg = null\n this._leftDepth = null\n const seg = arguments[0], depth = arguments[1]\n this._upwardSeg = new LineSegment(seg)\n this._leftDepth = depth\n }\n compareTo(obj) {\n const other = obj\n if (this._upwardSeg.minX() >= other._upwardSeg.maxX()) return 1\n if (this._upwardSeg.maxX() <= other._upwardSeg.minX()) return -1\n let orientIndex = this._upwardSeg.orientationIndex(other._upwardSeg)\n if (orientIndex !== 0) return orientIndex\n orientIndex = -1 * other._upwardSeg.orientationIndex(this._upwardSeg)\n if (orientIndex !== 0) return orientIndex\n return this._upwardSeg.compareTo(other._upwardSeg)\n }\n compareX(seg0, seg1) {\n const compare0 = seg0.p0.compareTo(seg1.p0)\n if (compare0 !== 0) return compare0\n return seg0.p1.compareTo(seg1.p1)\n }\n toString() {\n return this._upwardSeg.toString()\n }\n get interfaces_() {\n return [Comparable]\n }\n}\nSubgraphDepthLocater.DepthSegment = DepthSegment\n","import Exception from '../../../../java/lang/Exception.js'\nexport default class NotRepresentableException extends Exception {\n constructor() {\n super()\n NotRepresentableException.constructor_.apply(this, arguments)\n }\n static constructor_() {\n Exception.constructor_.call(this, 'Projective point not representable on the Cartesian plane.')\n }\n}\n","import NotRepresentableException from './NotRepresentableException.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Double from '../../../../java/lang/Double.js'\nexport default class HCoordinate {\n constructor() {\n HCoordinate.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.x = null\n this.y = null\n this.w = null\n if (arguments.length === 0) {\n this.x = 0.0\n this.y = 0.0\n this.w = 1.0\n } else if (arguments.length === 1) {\n const p = arguments[0]\n this.x = p.x\n this.y = p.y\n this.w = 1.0\n } else if (arguments.length === 2) {\n if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {\n const _x = arguments[0], _y = arguments[1]\n this.x = _x\n this.y = _y\n this.w = 1.0\n } else if (arguments[0] instanceof HCoordinate && arguments[1] instanceof HCoordinate) {\n const p1 = arguments[0], p2 = arguments[1]\n this.x = p1.y * p2.w - p2.y * p1.w\n this.y = p2.x * p1.w - p1.x * p2.w\n this.w = p1.x * p2.y - p2.x * p1.y\n } else if (arguments[0] instanceof Coordinate && arguments[1] instanceof Coordinate) {\n const p1 = arguments[0], p2 = arguments[1]\n this.x = p1.y - p2.y\n this.y = p2.x - p1.x\n this.w = p1.x * p2.y - p2.x * p1.y\n }\n } else if (arguments.length === 3) {\n const _x = arguments[0], _y = arguments[1], _w = arguments[2]\n this.x = _x\n this.y = _y\n this.w = _w\n } else if (arguments.length === 4) {\n const p1 = arguments[0], p2 = arguments[1], q1 = arguments[2], q2 = arguments[3]\n const px = p1.y - p2.y\n const py = p2.x - p1.x\n const pw = p1.x * p2.y - p2.x * p1.y\n const qx = q1.y - q2.y\n const qy = q2.x - q1.x\n const qw = q1.x * q2.y - q2.x * q1.y\n this.x = py * qw - qy * pw\n this.y = qx * pw - px * qw\n this.w = px * qy - qx * py\n }\n }\n getY() {\n const a = this.y / this.w\n if (Double.isNaN(a) || Double.isInfinite(a)) \n throw new NotRepresentableException()\n \n return a\n }\n getX() {\n const a = this.x / this.w\n if (Double.isNaN(a) || Double.isInfinite(a)) \n throw new NotRepresentableException()\n \n return a\n }\n getCoordinate() {\n const p = new Coordinate()\n p.x = this.getX()\n p.y = this.getY()\n return p\n }\n}\n","import Coordinate from './Coordinate.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport DD from '../math/DD.js'\nimport Angle from '../algorithm/Angle.js'\nimport HCoordinate from '../algorithm/HCoordinate.js'\nexport default class Triangle {\n constructor() {\n Triangle.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.p0 = null\n this.p1 = null\n this.p2 = null\n const p0 = arguments[0], p1 = arguments[1], p2 = arguments[2]\n this.p0 = p0\n this.p1 = p1\n this.p2 = p2\n }\n static area(a, b, c) {\n return Math.abs(((c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y)) / 2)\n }\n static signedArea(a, b, c) {\n return ((c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y)) / 2\n }\n static det(m00, m01, m10, m11) {\n return m00 * m11 - m01 * m10\n }\n static interpolateZ(p, v0, v1, v2) {\n const x0 = v0.x\n const y0 = v0.y\n const a = v1.x - x0\n const b = v2.x - x0\n const c = v1.y - y0\n const d = v2.y - y0\n const det = a * d - b * c\n const dx = p.x - x0\n const dy = p.y - y0\n const t = (d * dx - b * dy) / det\n const u = (-c * dx + a * dy) / det\n const z = v0.getZ() + t * (v1.getZ() - v0.getZ()) + u * (v2.getZ() - v0.getZ())\n return z\n }\n static longestSideLength(a, b, c) {\n const lenAB = a.distance(b)\n const lenBC = b.distance(c)\n const lenCA = c.distance(a)\n let maxLen = lenAB\n if (lenBC > maxLen) maxLen = lenBC\n if (lenCA > maxLen) maxLen = lenCA\n return maxLen\n }\n static circumcentreDD(a, b, c) {\n const ax = DD.valueOf(a.x).subtract(c.x)\n const ay = DD.valueOf(a.y).subtract(c.y)\n const bx = DD.valueOf(b.x).subtract(c.x)\n const by = DD.valueOf(b.y).subtract(c.y)\n const denom = DD.determinant(ax, ay, bx, by).multiply(2)\n const asqr = ax.sqr().add(ay.sqr())\n const bsqr = bx.sqr().add(by.sqr())\n const numx = DD.determinant(ay, asqr, by, bsqr)\n const numy = DD.determinant(ax, asqr, bx, bsqr)\n const ccx = DD.valueOf(c.x).subtract(numx.divide(denom)).doubleValue()\n const ccy = DD.valueOf(c.y).add(numy.divide(denom)).doubleValue()\n return new Coordinate(ccx, ccy)\n }\n static isAcute(a, b, c) {\n if (!Angle.isAcute(a, b, c)) return false\n if (!Angle.isAcute(b, c, a)) return false\n if (!Angle.isAcute(c, a, b)) return false\n return true\n }\n static circumcentre(a, b, c) {\n const cx = c.x\n const cy = c.y\n const ax = a.x - cx\n const ay = a.y - cy\n const bx = b.x - cx\n const by = b.y - cy\n const denom = 2 * Triangle.det(ax, ay, bx, by)\n const numx = Triangle.det(ay, ax * ax + ay * ay, by, bx * bx + by * by)\n const numy = Triangle.det(ax, ax * ax + ay * ay, bx, bx * bx + by * by)\n const ccx = cx - numx / denom\n const ccy = cy + numy / denom\n return new Coordinate(ccx, ccy)\n }\n static perpendicularBisector(a, b) {\n const dx = b.x - a.x\n const dy = b.y - a.y\n const l1 = new HCoordinate(a.x + dx / 2.0, a.y + dy / 2.0, 1.0)\n const l2 = new HCoordinate(a.x - dy + dx / 2.0, a.y + dx + dy / 2.0, 1.0)\n return new HCoordinate(l1, l2)\n }\n static angleBisector(a, b, c) {\n const len0 = b.distance(a)\n const len2 = b.distance(c)\n const frac = len0 / (len0 + len2)\n const dx = c.x - a.x\n const dy = c.y - a.y\n const splitPt = new Coordinate(a.x + frac * dx, a.y + frac * dy)\n return splitPt\n }\n static area3D(a, b, c) {\n const ux = b.x - a.x\n const uy = b.y - a.y\n const uz = b.getZ() - a.getZ()\n const vx = c.x - a.x\n const vy = c.y - a.y\n const vz = c.getZ() - a.getZ()\n const crossx = uy * vz - uz * vy\n const crossy = uz * vx - ux * vz\n const crossz = ux * vy - uy * vx\n const absSq = crossx * crossx + crossy * crossy + crossz * crossz\n const area3D = Math.sqrt(absSq) / 2\n return area3D\n }\n static centroid(a, b, c) {\n const x = (a.x + b.x + c.x) / 3\n const y = (a.y + b.y + c.y) / 3\n return new Coordinate(x, y)\n }\n static inCentre(a, b, c) {\n const len0 = b.distance(c)\n const len1 = a.distance(c)\n const len2 = a.distance(b)\n const circum = len0 + len1 + len2\n const inCentreX = (len0 * a.x + len1 * b.x + len2 * c.x) / circum\n const inCentreY = (len0 * a.y + len1 * b.y + len2 * c.y) / circum\n return new Coordinate(inCentreX, inCentreY)\n }\n area() {\n return Triangle.area(this.p0, this.p1, this.p2)\n }\n signedArea() {\n return Triangle.signedArea(this.p0, this.p1, this.p2)\n }\n interpolateZ(p) {\n if (p === null) throw new IllegalArgumentException('Supplied point is null.')\n return Triangle.interpolateZ(p, this.p0, this.p1, this.p2)\n }\n longestSideLength() {\n return Triangle.longestSideLength(this.p0, this.p1, this.p2)\n }\n isAcute() {\n return Triangle.isAcute(this.p0, this.p1, this.p2)\n }\n circumcentre() {\n return Triangle.circumcentre(this.p0, this.p1, this.p2)\n }\n area3D() {\n return Triangle.area3D(this.p0, this.p1, this.p2)\n }\n centroid() {\n return Triangle.centroid(this.p0, this.p1, this.p2)\n }\n inCentre() {\n return Triangle.inCentre(this.p0, this.p1, this.p2)\n }\n}\n","import Location from '../../geom/Location.js'\nimport LineString from '../../geom/LineString.js'\nimport Position from '../../geomgraph/Position.js'\nimport Point from '../../geom/Point.js'\nimport NodedSegmentString from '../../noding/NodedSegmentString.js'\nimport Polygon from '../../geom/Polygon.js'\nimport MultiPoint from '../../geom/MultiPoint.js'\nimport LinearRing from '../../geom/LinearRing.js'\nimport Orientation from '../../algorithm/Orientation.js'\nimport MultiPolygon from '../../geom/MultiPolygon.js'\nimport Label from '../../geomgraph/Label.js'\nimport GeometryCollection from '../../geom/GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../../java/lang/UnsupportedOperationException.js'\nimport CoordinateArrays from '../../geom/CoordinateArrays.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Distance from '../../algorithm/Distance.js'\nimport MultiLineString from '../../geom/MultiLineString.js'\nimport Triangle from '../../geom/Triangle.js'\nexport default class OffsetCurveSetBuilder {\n constructor() {\n OffsetCurveSetBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._inputGeom = null\n this._distance = null\n this._curveBuilder = null\n this._curveList = new ArrayList()\n const inputGeom = arguments[0], distance = arguments[1], curveBuilder = arguments[2]\n this._inputGeom = inputGeom\n this._distance = distance\n this._curveBuilder = curveBuilder\n }\n addRingSide(coord, offsetDistance, side, cwLeftLoc, cwRightLoc) {\n if (offsetDistance === 0.0 && coord.length < LinearRing.MINIMUM_VALID_SIZE) return null\n let leftLoc = cwLeftLoc\n let rightLoc = cwRightLoc\n if (coord.length >= LinearRing.MINIMUM_VALID_SIZE && Orientation.isCCW(coord)) {\n leftLoc = cwRightLoc\n rightLoc = cwLeftLoc\n side = Position.opposite(side)\n }\n const curve = this._curveBuilder.getRingCurve(coord, side, offsetDistance)\n this.addCurve(curve, leftLoc, rightLoc)\n }\n addRingBothSides(coord, distance) {\n this.addRingSide(coord, distance, Position.LEFT, Location.EXTERIOR, Location.INTERIOR)\n this.addRingSide(coord, distance, Position.RIGHT, Location.INTERIOR, Location.EXTERIOR)\n }\n addPoint(p) {\n if (this._distance <= 0.0) return null\n const coord = p.getCoordinates()\n const curve = this._curveBuilder.getLineCurve(coord, this._distance)\n this.addCurve(curve, Location.EXTERIOR, Location.INTERIOR)\n }\n addPolygon(p) {\n let offsetDistance = this._distance\n let offsetSide = Position.LEFT\n if (this._distance < 0.0) {\n offsetDistance = -this._distance\n offsetSide = Position.RIGHT\n }\n const shell = p.getExteriorRing()\n const shellCoord = CoordinateArrays.removeRepeatedPoints(shell.getCoordinates())\n if (this._distance < 0.0 && this.isErodedCompletely(shell, this._distance)) return null\n if (this._distance <= 0.0 && shellCoord.length < 3) return null\n this.addRingSide(shellCoord, offsetDistance, offsetSide, Location.EXTERIOR, Location.INTERIOR)\n for (let i = 0; i < p.getNumInteriorRing(); i++) {\n const hole = p.getInteriorRingN(i)\n const holeCoord = CoordinateArrays.removeRepeatedPoints(hole.getCoordinates())\n if (this._distance > 0.0 && this.isErodedCompletely(hole, -this._distance)) continue\n this.addRingSide(holeCoord, offsetDistance, Position.opposite(offsetSide), Location.INTERIOR, Location.EXTERIOR)\n }\n }\n isTriangleErodedCompletely(triangleCoord, bufferDistance) {\n const tri = new Triangle(triangleCoord[0], triangleCoord[1], triangleCoord[2])\n const inCentre = tri.inCentre()\n const distToCentre = Distance.pointToSegment(inCentre, tri.p0, tri.p1)\n return distToCentre < Math.abs(bufferDistance)\n }\n addLineString(line) {\n if (this._curveBuilder.isLineOffsetEmpty(this._distance)) return null\n const coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates())\n if (CoordinateArrays.isRing(coord) && !this._curveBuilder.getBufferParameters().isSingleSided()) {\n this.addRingBothSides(coord, this._distance)\n } else {\n const curve = this._curveBuilder.getLineCurve(coord, this._distance)\n this.addCurve(curve, Location.EXTERIOR, Location.INTERIOR)\n }\n }\n addCurve(coord, leftLoc, rightLoc) {\n if (coord === null || coord.length < 2) return null\n const e = new NodedSegmentString(coord, new Label(0, Location.BOUNDARY, leftLoc, rightLoc))\n this._curveList.add(e)\n }\n getCurves() {\n this.add(this._inputGeom)\n return this._curveList\n }\n add(g) {\n if (g.isEmpty()) return null\n if (g instanceof Polygon) this.addPolygon(g); else if (g instanceof LineString) this.addLineString(g); else if (g instanceof Point) this.addPoint(g); else if (g instanceof MultiPoint) this.addCollection(g); else if (g instanceof MultiLineString) this.addCollection(g); else if (g instanceof MultiPolygon) this.addCollection(g); else if (g instanceof GeometryCollection) this.addCollection(g); else throw new UnsupportedOperationException(g.getGeometryType())\n }\n isErodedCompletely(ring, bufferDistance) {\n const ringCoord = ring.getCoordinates()\n if (ringCoord.length < 4) return bufferDistance < 0\n if (ringCoord.length === 4) return this.isTriangleErodedCompletely(ringCoord, bufferDistance)\n const env = ring.getEnvelopeInternal()\n const envMinDimension = Math.min(env.getHeight(), env.getWidth())\n if (bufferDistance < 0.0 && 2 * Math.abs(bufferDistance) > envMinDimension) return true\n return false\n }\n addCollection(gc) {\n for (let i = 0; i < gc.getNumGeometries(); i++) {\n const g = gc.getGeometryN(i)\n this.add(g)\n }\n }\n}\n","export default class PointOnGeometryLocator {\n locate(p) {}\n}\n","import Iterator from '../../../../java/util/Iterator.js'\nimport NoSuchElementException from '../../../../java/util/NoSuchElementException.js'\nimport GeometryCollection from './GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nexport default class GeometryCollectionIterator {\n constructor() {\n GeometryCollectionIterator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._parent = null\n this._atStart = null\n this._max = null\n this._index = null\n this._subcollectionIterator = null\n const parent = arguments[0]\n this._parent = parent\n this._atStart = true\n this._index = 0\n this._max = parent.getNumGeometries()\n }\n static isAtomic(geom) {\n return !(geom instanceof GeometryCollection)\n }\n next() {\n if (this._atStart) {\n this._atStart = false\n if (GeometryCollectionIterator.isAtomic(this._parent)) this._index++\n return this._parent\n }\n if (this._subcollectionIterator !== null) \n if (this._subcollectionIterator.hasNext()) \n return this._subcollectionIterator.next()\n else \n this._subcollectionIterator = null\n \n \n if (this._index >= this._max) \n throw new NoSuchElementException()\n \n const obj = this._parent.getGeometryN(this._index++)\n if (obj instanceof GeometryCollection) {\n this._subcollectionIterator = new GeometryCollectionIterator(obj)\n return this._subcollectionIterator.next()\n }\n return obj\n }\n remove() {\n throw new UnsupportedOperationException(this.getClass().getName())\n }\n hasNext() {\n if (this._atStart) \n return true\n \n if (this._subcollectionIterator !== null) {\n if (this._subcollectionIterator.hasNext()) \n return true\n \n this._subcollectionIterator = null\n }\n if (this._index >= this._max) \n return false\n \n return true\n }\n get interfaces_() {\n return [Iterator]\n }\n}\n","import Location from '../../geom/Location.js'\nimport Polygon from '../../geom/Polygon.js'\nimport PointLocation from '../PointLocation.js'\nimport PointOnGeometryLocator from './PointOnGeometryLocator.js'\nimport GeometryCollectionIterator from '../../geom/GeometryCollectionIterator.js'\nimport GeometryCollection from '../../geom/GeometryCollection.js'\nexport default class SimplePointInAreaLocator {\n constructor() {\n SimplePointInAreaLocator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = null\n const geom = arguments[0]\n this._geom = geom\n }\n static locatePointInPolygon(p, poly) {\n if (poly.isEmpty()) return Location.EXTERIOR\n const shell = poly.getExteriorRing()\n const shellLoc = SimplePointInAreaLocator.locatePointInRing(p, shell)\n if (shellLoc !== Location.INTERIOR) return shellLoc\n for (let i = 0; i < poly.getNumInteriorRing(); i++) {\n const hole = poly.getInteriorRingN(i)\n const holeLoc = SimplePointInAreaLocator.locatePointInRing(p, hole)\n if (holeLoc === Location.BOUNDARY) return Location.BOUNDARY\n if (holeLoc === Location.INTERIOR) return Location.EXTERIOR\n }\n return Location.INTERIOR\n }\n static locatePointInRing(p, ring) {\n if (!ring.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n return PointLocation.locateInRing(p, ring.getCoordinates())\n }\n static containsPointInPolygon(p, poly) {\n return Location.EXTERIOR !== SimplePointInAreaLocator.locatePointInPolygon(p, poly)\n }\n static locateInGeometry(p, geom) {\n if (geom instanceof Polygon) \n return SimplePointInAreaLocator.locatePointInPolygon(p, geom)\n \n if (geom instanceof GeometryCollection) {\n const geomi = new GeometryCollectionIterator(geom)\n while (geomi.hasNext()) {\n const g2 = geomi.next()\n if (g2 !== geom) {\n const loc = SimplePointInAreaLocator.locateInGeometry(p, g2)\n if (loc !== Location.EXTERIOR) return loc\n }\n }\n }\n return Location.EXTERIOR\n }\n static isContained(p, geom) {\n return Location.EXTERIOR !== SimplePointInAreaLocator.locate(p, geom)\n }\n static locate(p, geom) {\n if (geom.isEmpty()) return Location.EXTERIOR\n if (!geom.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n return SimplePointInAreaLocator.locateInGeometry(p, geom)\n }\n locate(p) {\n return SimplePointInAreaLocator.locate(p, this._geom)\n }\n get interfaces_() {\n return [PointOnGeometryLocator]\n }\n}\n","import StringBuffer from '../../../../java/lang/StringBuffer.js'\nimport Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport System from '../../../../java/lang/System.js'\nimport SimplePointInAreaLocator from '../algorithm/locate/SimplePointInAreaLocator.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Assert from '../util/Assert.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class EdgeEndStar {\n constructor() {\n EdgeEndStar.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edgeMap = new TreeMap()\n this._edgeList = null\n this._ptInAreaLocation = [Location.NONE, Location.NONE]\n }\n getNextCW(ee) {\n this.getEdges()\n const i = this._edgeList.indexOf(ee)\n let iNextCW = i - 1\n if (i === 0) iNextCW = this._edgeList.size() - 1\n return this._edgeList.get(iNextCW)\n }\n propagateSideLabels(geomIndex) {\n let startLoc = Location.NONE\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n if (label.isArea(geomIndex) && label.getLocation(geomIndex, Position.LEFT) !== Location.NONE) startLoc = label.getLocation(geomIndex, Position.LEFT)\n }\n if (startLoc === Location.NONE) return null\n let currLoc = startLoc\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n if (label.getLocation(geomIndex, Position.ON) === Location.NONE) label.setLocation(geomIndex, Position.ON, currLoc)\n if (label.isArea(geomIndex)) {\n const leftLoc = label.getLocation(geomIndex, Position.LEFT)\n const rightLoc = label.getLocation(geomIndex, Position.RIGHT)\n if (rightLoc !== Location.NONE) {\n if (rightLoc !== currLoc) throw new TopologyException('side location conflict', e.getCoordinate())\n if (leftLoc === Location.NONE) \n Assert.shouldNeverReachHere('found single null side (at ' + e.getCoordinate() + ')')\n \n currLoc = leftLoc\n } else {\n Assert.isTrue(label.getLocation(geomIndex, Position.LEFT) === Location.NONE, 'found single null side')\n label.setLocation(geomIndex, Position.RIGHT, currLoc)\n label.setLocation(geomIndex, Position.LEFT, currLoc)\n }\n }\n }\n }\n getCoordinate() {\n const it = this.iterator()\n if (!it.hasNext()) return null\n const e = it.next()\n return e.getCoordinate()\n }\n print(out) {\n System.out.println('EdgeEndStar: ' + this.getCoordinate())\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n e.print(out)\n }\n }\n isAreaLabelsConsistent(geomGraph) {\n this.computeEdgeEndLabels(geomGraph.getBoundaryNodeRule())\n return this.checkAreaLabelsConsistent(0)\n }\n checkAreaLabelsConsistent(geomIndex) {\n const edges = this.getEdges()\n if (edges.size() <= 0) return true\n const lastEdgeIndex = edges.size() - 1\n const startLabel = edges.get(lastEdgeIndex).getLabel()\n const startLoc = startLabel.getLocation(geomIndex, Position.LEFT)\n Assert.isTrue(startLoc !== Location.NONE, 'Found unlabelled area edge')\n let currLoc = startLoc\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n Assert.isTrue(label.isArea(geomIndex), 'Found non-area edge')\n const leftLoc = label.getLocation(geomIndex, Position.LEFT)\n const rightLoc = label.getLocation(geomIndex, Position.RIGHT)\n if (leftLoc === rightLoc) \n return false\n \n if (rightLoc !== currLoc) \n return false\n \n currLoc = leftLoc\n }\n return true\n }\n findIndex(eSearch) {\n this.iterator()\n for (let i = 0; i < this._edgeList.size(); i++) {\n const e = this._edgeList.get(i)\n if (e === eSearch) return i\n }\n return -1\n }\n iterator() {\n return this.getEdges().iterator()\n }\n getEdges() {\n if (this._edgeList === null) \n this._edgeList = new ArrayList(this._edgeMap.values())\n \n return this._edgeList\n }\n getLocation(geomIndex, p, geom) {\n if (this._ptInAreaLocation[geomIndex] === Location.NONE) \n this._ptInAreaLocation[geomIndex] = SimplePointInAreaLocator.locate(p, geom[geomIndex].getGeometry())\n \n return this._ptInAreaLocation[geomIndex]\n }\n toString() {\n const buf = new StringBuffer()\n buf.append('EdgeEndStar: ' + this.getCoordinate())\n buf.append('\\n')\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n buf.append(e)\n buf.append('\\n')\n }\n return buf.toString()\n }\n computeEdgeEndLabels(boundaryNodeRule) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const ee = it.next()\n ee.computeLabel(boundaryNodeRule)\n }\n }\n computeLabelling(geomGraph) {\n this.computeEdgeEndLabels(geomGraph[0].getBoundaryNodeRule())\n this.propagateSideLabels(0)\n this.propagateSideLabels(1)\n const hasDimensionalCollapseEdge = [false, false]\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n for (let geomi = 0; geomi < 2; geomi++) \n if (label.isLine(geomi) && label.getLocation(geomi) === Location.BOUNDARY) hasDimensionalCollapseEdge[geomi] = true\n \n }\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n for (let geomi = 0; geomi < 2; geomi++) \n if (label.isAnyNull(geomi)) {\n let loc = Location.NONE\n if (hasDimensionalCollapseEdge[geomi]) {\n loc = Location.EXTERIOR\n } else {\n const p = e.getCoordinate()\n loc = this.getLocation(geomi, p, geomGraph)\n }\n label.setAllLocationsIfNull(geomi, loc)\n }\n \n }\n }\n getDegree() {\n return this._edgeMap.size()\n }\n insertEdgeEnd(e, obj) {\n this._edgeMap.put(e, obj)\n this._edgeList = null\n }\n}\n","import Location from '../geom/Location.js'\nimport Position from './Position.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport EdgeEndStar from './EdgeEndStar.js'\nimport System from '../../../../java/lang/System.js'\nimport Label from './Label.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport Quadrant from './Quadrant.js'\nimport Assert from '../util/Assert.js'\nexport default class DirectedEdgeStar extends EdgeEndStar {\n constructor() {\n super()\n DirectedEdgeStar.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._resultAreaEdgeList = null\n this._label = null\n this._SCANNING_FOR_INCOMING = 1\n this._LINKING_TO_OUTGOING = 2\n }\n linkResultDirectedEdges() {\n this.getResultAreaEdges()\n let firstOut = null\n let incoming = null\n let state = this._SCANNING_FOR_INCOMING\n for (let i = 0; i < this._resultAreaEdgeList.size(); i++) {\n const nextOut = this._resultAreaEdgeList.get(i)\n const nextIn = nextOut.getSym()\n if (!nextOut.getLabel().isArea()) continue\n if (firstOut === null && nextOut.isInResult()) firstOut = nextOut\n switch (state) {\n case this._SCANNING_FOR_INCOMING:\n if (!nextIn.isInResult()) continue\n incoming = nextIn\n state = this._LINKING_TO_OUTGOING\n break\n case this._LINKING_TO_OUTGOING:\n if (!nextOut.isInResult()) continue\n incoming.setNext(nextOut)\n state = this._SCANNING_FOR_INCOMING\n break\n }\n }\n if (state === this._LINKING_TO_OUTGOING) {\n if (firstOut === null) throw new TopologyException('no outgoing dirEdge found', this.getCoordinate())\n Assert.isTrue(firstOut.isInResult(), 'unable to link last incoming dirEdge')\n incoming.setNext(firstOut)\n }\n }\n insert(ee) {\n const de = ee\n this.insertEdgeEnd(de, de)\n }\n getRightmostEdge() {\n const edges = this.getEdges()\n const size = edges.size()\n if (size < 1) return null\n const de0 = edges.get(0)\n if (size === 1) return de0\n const deLast = edges.get(size - 1)\n const quad0 = de0.getQuadrant()\n const quad1 = deLast.getQuadrant()\n if (Quadrant.isNorthern(quad0) && Quadrant.isNorthern(quad1)) {\n return de0\n } else if (!Quadrant.isNorthern(quad0) && !Quadrant.isNorthern(quad1)) {\n return deLast\n } else {\n const nonHorizontalEdge = null\n if (de0.getDy() !== 0) return de0; else if (deLast.getDy() !== 0) return deLast\n }\n Assert.shouldNeverReachHere('found two horizontal edges incident on node')\n return null\n }\n print(out) {\n System.out.println('DirectedEdgeStar: ' + this.getCoordinate())\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n out.print('out ')\n de.print(out)\n out.println()\n out.print('in ')\n de.getSym().print(out)\n out.println()\n }\n }\n getResultAreaEdges() {\n if (this._resultAreaEdgeList !== null) return this._resultAreaEdgeList\n this._resultAreaEdgeList = new ArrayList()\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.isInResult() || de.getSym().isInResult()) this._resultAreaEdgeList.add(de)\n }\n return this._resultAreaEdgeList\n }\n updateLabelling(nodeLabel) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n const label = de.getLabel()\n label.setAllLocationsIfNull(0, nodeLabel.getLocation(0))\n label.setAllLocationsIfNull(1, nodeLabel.getLocation(1))\n }\n }\n linkAllDirectedEdges() {\n this.getEdges()\n let prevOut = null\n let firstIn = null\n for (let i = this._edgeList.size() - 1; i >= 0; i--) {\n const nextOut = this._edgeList.get(i)\n const nextIn = nextOut.getSym()\n if (firstIn === null) firstIn = nextIn\n if (prevOut !== null) nextIn.setNext(prevOut)\n prevOut = nextOut\n }\n firstIn.setNext(prevOut)\n }\n computeDepths() {\n if (arguments.length === 1) {\n const de = arguments[0]\n const edgeIndex = this.findIndex(de)\n const startDepth = de.getDepth(Position.LEFT)\n const targetLastDepth = de.getDepth(Position.RIGHT)\n const nextDepth = this.computeDepths(edgeIndex + 1, this._edgeList.size(), startDepth)\n const lastDepth = this.computeDepths(0, edgeIndex, nextDepth)\n if (lastDepth !== targetLastDepth) throw new TopologyException('depth mismatch at ' + de.getCoordinate())\n } else if (arguments.length === 3) {\n const startIndex = arguments[0], endIndex = arguments[1], startDepth = arguments[2]\n let currDepth = startDepth\n for (let i = startIndex; i < endIndex; i++) {\n const nextDe = this._edgeList.get(i)\n nextDe.setEdgeDepths(Position.RIGHT, currDepth)\n currDepth = nextDe.getDepth(Position.LEFT)\n }\n return currDepth\n }\n }\n mergeSymLabels() {\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n const label = de.getLabel()\n label.merge(de.getSym().getLabel())\n }\n }\n linkMinimalDirectedEdges(er) {\n let firstOut = null\n let incoming = null\n let state = this._SCANNING_FOR_INCOMING\n for (let i = this._resultAreaEdgeList.size() - 1; i >= 0; i--) {\n const nextOut = this._resultAreaEdgeList.get(i)\n const nextIn = nextOut.getSym()\n if (firstOut === null && nextOut.getEdgeRing() === er) firstOut = nextOut\n switch (state) {\n case this._SCANNING_FOR_INCOMING:\n if (nextIn.getEdgeRing() !== er) continue\n incoming = nextIn\n state = this._LINKING_TO_OUTGOING\n break\n case this._LINKING_TO_OUTGOING:\n if (nextOut.getEdgeRing() !== er) continue\n incoming.setNextMin(nextOut)\n state = this._SCANNING_FOR_INCOMING\n break\n }\n }\n if (state === this._LINKING_TO_OUTGOING) {\n Assert.isTrue(firstOut !== null, 'found null for first outgoing dirEdge')\n Assert.isTrue(firstOut.getEdgeRing() === er, 'unable to link last incoming dirEdge')\n incoming.setNextMin(firstOut)\n }\n }\n getOutgoingDegree() {\n if (arguments.length === 0) {\n let degree = 0\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.isInResult()) degree++\n }\n return degree\n } else if (arguments.length === 1) {\n const er = arguments[0]\n let degree = 0\n for (let it = this.iterator(); it.hasNext(); ) {\n const de = it.next()\n if (de.getEdgeRing() === er) degree++\n }\n return degree\n }\n }\n getLabel() {\n return this._label\n }\n findCoveredLineEdges() {\n let startLoc = Location.NONE\n for (let it = this.iterator(); it.hasNext(); ) {\n const nextOut = it.next()\n const nextIn = nextOut.getSym()\n if (!nextOut.isLineEdge()) {\n if (nextOut.isInResult()) {\n startLoc = Location.INTERIOR\n break\n }\n if (nextIn.isInResult()) {\n startLoc = Location.EXTERIOR\n break\n }\n }\n }\n if (startLoc === Location.NONE) return null\n let currLoc = startLoc\n for (let it = this.iterator(); it.hasNext(); ) {\n const nextOut = it.next()\n const nextIn = nextOut.getSym()\n if (nextOut.isLineEdge()) {\n nextOut.getEdge().setCovered(currLoc === Location.INTERIOR)\n } else {\n if (nextOut.isInResult()) currLoc = Location.EXTERIOR\n if (nextIn.isInResult()) currLoc = Location.INTERIOR\n }\n }\n }\n computeLabelling(geom) {\n super.computeLabelling.call(this, geom)\n this._label = new Label(Location.NONE)\n for (let it = this.iterator(); it.hasNext(); ) {\n const ee = it.next()\n const e = ee.getEdge()\n const eLabel = e.getLabel()\n for (let i = 0; i < 2; i++) {\n const eLoc = eLabel.getLocation(i)\n if (eLoc === Location.INTERIOR || eLoc === Location.BOUNDARY) this._label.setLocation(i, Location.INTERIOR)\n }\n }\n }\n}\n","import DirectedEdgeStar from '../../geomgraph/DirectedEdgeStar.js'\nimport Node from '../../geomgraph/Node.js'\nimport NodeFactory from '../../geomgraph/NodeFactory.js'\nexport default class OverlayNodeFactory extends NodeFactory {\n constructor() {\n super()\n }\n createNode(coord) {\n return new Node(coord, new DirectedEdgeStar())\n }\n}\n","import Comparable from '../../../../java/lang/Comparable.js'\nimport CoordinateArrays from '../geom/CoordinateArrays.js'\nexport default class OrientedCoordinateArray {\n constructor() {\n OrientedCoordinateArray.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pts = null\n this._orientation = null\n const pts = arguments[0]\n this._pts = pts\n this._orientation = OrientedCoordinateArray.orientation(pts)\n }\n static orientation(pts) {\n return CoordinateArrays.increasingDirection(pts) === 1\n }\n static compareOriented(pts1, orientation1, pts2, orientation2) {\n const dir1 = orientation1 ? 1 : -1\n const dir2 = orientation2 ? 1 : -1\n const limit1 = orientation1 ? pts1.length : -1\n const limit2 = orientation2 ? pts2.length : -1\n let i1 = orientation1 ? 0 : pts1.length - 1\n let i2 = orientation2 ? 0 : pts2.length - 1\n while (true) {\n const compPt = pts1[i1].compareTo(pts2[i2])\n if (compPt !== 0) return compPt\n i1 += dir1\n i2 += dir2\n const done1 = i1 === limit1\n const done2 = i2 === limit2\n if (done1 && !done2) return -1\n if (!done1 && done2) return 1\n if (done1 && done2) return 0\n }\n }\n compareTo(o1) {\n const oca = o1\n const comp = OrientedCoordinateArray.compareOriented(this._pts, this._orientation, oca._pts, oca._orientation)\n return comp\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import OrientedCoordinateArray from '../noding/OrientedCoordinateArray.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class EdgeList {\n constructor() {\n EdgeList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edges = new ArrayList()\n this._ocaMap = new TreeMap()\n }\n print(out) {\n out.print('MULTILINESTRING ( ')\n for (let j = 0; j < this._edges.size(); j++) {\n const e = this._edges.get(j)\n if (j > 0) out.print(',')\n out.print('(')\n const pts = e.getCoordinates()\n for (let i = 0; i < pts.length; i++) {\n if (i > 0) out.print(',')\n out.print(pts[i].x + ' ' + pts[i].y)\n }\n out.println(')')\n }\n out.print(') ')\n }\n addAll(edgeColl) {\n for (let i = edgeColl.iterator(); i.hasNext(); ) \n this.add(i.next())\n \n }\n findEdgeIndex(e) {\n for (let i = 0; i < this._edges.size(); i++) \n if (this._edges.get(i).equals(e)) return i\n \n return -1\n }\n iterator() {\n return this._edges.iterator()\n }\n getEdges() {\n return this._edges\n }\n get(i) {\n return this._edges.get(i)\n }\n findEqualEdge(e) {\n const oca = new OrientedCoordinateArray(e.getCoordinates())\n const matchEdge = this._ocaMap.get(oca)\n return matchEdge\n }\n add(e) {\n this._edges.add(e)\n const oca = new OrientedCoordinateArray(e.getCoordinates())\n this._ocaMap.put(oca, e)\n }\n}\n","export default class SegmentIntersector {\n processIntersections(e0, segIndex0, e1, segIndex1) {}\n isDone() {}\n}\n","import SegmentIntersector from './SegmentIntersector.js'\nexport default class IntersectionAdder {\n constructor() {\n IntersectionAdder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hasIntersection = false\n this._hasProper = false\n this._hasProperInterior = false\n this._hasInterior = false\n this._properIntersectionPoint = null\n this._li = null\n this._isSelfIntersection = null\n this.numIntersections = 0\n this.numInteriorIntersections = 0\n this.numProperIntersections = 0\n this.numTests = 0\n const li = arguments[0]\n this._li = li\n }\n static isAdjacentSegments(i1, i2) {\n return Math.abs(i1 - i2) === 1\n }\n isTrivialIntersection(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1) \n if (this._li.getIntersectionNum() === 1) {\n if (IntersectionAdder.isAdjacentSegments(segIndex0, segIndex1)) return true\n if (e0.isClosed()) {\n const maxSegIndex = e0.size() - 1\n if (segIndex0 === 0 && segIndex1 === maxSegIndex || segIndex1 === 0 && segIndex0 === maxSegIndex) \n return true\n \n }\n }\n \n return false\n }\n getProperIntersectionPoint() {\n return this._properIntersectionPoint\n }\n hasProperInteriorIntersection() {\n return this._hasProperInterior\n }\n getLineIntersector() {\n return this._li\n }\n hasProperIntersection() {\n return this._hasProper\n }\n processIntersections(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1 && segIndex0 === segIndex1) return null\n this.numTests++\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) {\n this.numIntersections++\n if (this._li.isInteriorIntersection()) {\n this.numInteriorIntersections++\n this._hasInterior = true\n }\n if (!this.isTrivialIntersection(e0, segIndex0, e1, segIndex1)) {\n this._hasIntersection = true\n e0.addIntersections(this._li, segIndex0, 0)\n e1.addIntersections(this._li, segIndex1, 1)\n if (this._li.isProper()) {\n this.numProperIntersections++\n this._hasProper = true\n this._hasProperInterior = true\n }\n }\n }\n }\n hasIntersection() {\n return this._hasIntersection\n }\n isDone() {\n return false\n }\n hasInteriorIntersection() {\n return this._hasInterior\n }\n get interfaces_() {\n return [SegmentIntersector]\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport Comparable from '../../../../java/lang/Comparable.js'\nexport default class EdgeIntersection {\n constructor() {\n EdgeIntersection.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.coord = null\n this.segmentIndex = null\n this.dist = null\n const coord = arguments[0], segmentIndex = arguments[1], dist = arguments[2]\n this.coord = new Coordinate(coord)\n this.segmentIndex = segmentIndex\n this.dist = dist\n }\n getSegmentIndex() {\n return this.segmentIndex\n }\n getCoordinate() {\n return this.coord\n }\n print(out) {\n out.print(this.coord)\n out.print(' seg # = ' + this.segmentIndex)\n out.println(' dist = ' + this.dist)\n }\n compareTo(obj) {\n const other = obj\n return this.compare(other.segmentIndex, other.dist)\n }\n isEndPoint(maxSegmentIndex) {\n if (this.segmentIndex === 0 && this.dist === 0.0) return true\n if (this.segmentIndex === maxSegmentIndex) return true\n return false\n }\n toString() {\n return this.coord + ' seg # = ' + this.segmentIndex + ' dist = ' + this.dist\n }\n getDistance() {\n return this.dist\n }\n compare(segmentIndex, dist) {\n if (this.segmentIndex < segmentIndex) return -1\n if (this.segmentIndex > segmentIndex) return 1\n if (this.dist < dist) return -1\n if (this.dist > dist) return 1\n return 0\n }\n get interfaces_() {\n return [Comparable]\n }\n}\n","import EdgeIntersection from './EdgeIntersection.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Label from './Label.js'\nimport Edge from './Edge.js'\nimport TreeMap from '../../../../java/util/TreeMap.js'\nexport default class EdgeIntersectionList {\n constructor() {\n EdgeIntersectionList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nodeMap = new TreeMap()\n this.edge = null\n const edge = arguments[0]\n this.edge = edge\n }\n print(out) {\n out.println('Intersections:')\n for (let it = this.iterator(); it.hasNext(); ) {\n const ei = it.next()\n ei.print(out)\n }\n }\n iterator() {\n return this._nodeMap.values().iterator()\n }\n addSplitEdges(edgeList) {\n this.addEndpoints()\n const it = this.iterator()\n let eiPrev = it.next()\n while (it.hasNext()) {\n const ei = it.next()\n const newEdge = this.createSplitEdge(eiPrev, ei)\n edgeList.add(newEdge)\n eiPrev = ei\n }\n }\n addEndpoints() {\n const maxSegIndex = this.edge.pts.length - 1\n this.add(this.edge.pts[0], 0, 0.0)\n this.add(this.edge.pts[maxSegIndex], maxSegIndex, 0.0)\n }\n createSplitEdge(ei0, ei1) {\n let npts = ei1.segmentIndex - ei0.segmentIndex + 2\n const lastSegStartPt = this.edge.pts[ei1.segmentIndex]\n const useIntPt1 = ei1.dist > 0.0 || !ei1.coord.equals2D(lastSegStartPt)\n if (!useIntPt1) \n npts--\n \n const pts = new Array(npts).fill(null)\n let ipt = 0\n pts[ipt++] = new Coordinate(ei0.coord)\n for (let i = ei0.segmentIndex + 1; i <= ei1.segmentIndex; i++) \n pts[ipt++] = this.edge.pts[i]\n \n if (useIntPt1) pts[ipt] = ei1.coord\n return new Edge(pts, new Label(this.edge._label))\n }\n add(intPt, segmentIndex, dist) {\n const eiNew = new EdgeIntersection(intPt, segmentIndex, dist)\n const ei = this._nodeMap.get(eiNew)\n if (ei !== null) \n return ei\n \n this._nodeMap.put(eiNew, eiNew)\n return eiNew\n }\n isIntersection(pt) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const ei = it.next()\n if (ei.coord.equals(pt)) return true\n }\n return false\n }\n}\n","import Location from './Location.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Dimension from './Dimension.js'\nimport Cloneable from '../../../../java/lang/Cloneable.js'\nimport StringBuilder from '../../../../java/lang/StringBuilder.js'\nexport default class IntersectionMatrix {\n constructor() {\n IntersectionMatrix.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._matrix = null\n if (arguments.length === 0) {\n this._matrix = Array(3).fill().map(() => Array(3))\n this.setAll(Dimension.FALSE)\n } else if (arguments.length === 1) {\n if (typeof arguments[0] === 'string') {\n const elements = arguments[0]\n IntersectionMatrix.constructor_.call(this)\n this.set(elements)\n } else if (arguments[0] instanceof IntersectionMatrix) {\n const other = arguments[0]\n IntersectionMatrix.constructor_.call(this)\n this._matrix[Location.INTERIOR][Location.INTERIOR] = other._matrix[Location.INTERIOR][Location.INTERIOR]\n this._matrix[Location.INTERIOR][Location.BOUNDARY] = other._matrix[Location.INTERIOR][Location.BOUNDARY]\n this._matrix[Location.INTERIOR][Location.EXTERIOR] = other._matrix[Location.INTERIOR][Location.EXTERIOR]\n this._matrix[Location.BOUNDARY][Location.INTERIOR] = other._matrix[Location.BOUNDARY][Location.INTERIOR]\n this._matrix[Location.BOUNDARY][Location.BOUNDARY] = other._matrix[Location.BOUNDARY][Location.BOUNDARY]\n this._matrix[Location.BOUNDARY][Location.EXTERIOR] = other._matrix[Location.BOUNDARY][Location.EXTERIOR]\n this._matrix[Location.EXTERIOR][Location.INTERIOR] = other._matrix[Location.EXTERIOR][Location.INTERIOR]\n this._matrix[Location.EXTERIOR][Location.BOUNDARY] = other._matrix[Location.EXTERIOR][Location.BOUNDARY]\n this._matrix[Location.EXTERIOR][Location.EXTERIOR] = other._matrix[Location.EXTERIOR][Location.EXTERIOR]\n }\n }\n }\n static matches() {\n if (Number.isInteger(arguments[0]) && typeof arguments[1] === 'string') {\n const actualDimensionValue = arguments[0], requiredDimensionSymbol = arguments[1]\n if (requiredDimensionSymbol === Dimension.SYM_DONTCARE) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_TRUE && (actualDimensionValue >= 0 || actualDimensionValue === Dimension.TRUE)) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_FALSE && actualDimensionValue === Dimension.FALSE) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_P && actualDimensionValue === Dimension.P) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_L && actualDimensionValue === Dimension.L) \n return true\n \n if (requiredDimensionSymbol === Dimension.SYM_A && actualDimensionValue === Dimension.A) \n return true\n \n return false\n } else if (typeof arguments[0] === 'string' && typeof arguments[1] === 'string') {\n const actualDimensionSymbols = arguments[0], requiredDimensionSymbols = arguments[1]\n const m = new IntersectionMatrix(actualDimensionSymbols)\n return m.matches(requiredDimensionSymbols)\n }\n }\n static isTrue(actualDimensionValue) {\n if (actualDimensionValue >= 0 || actualDimensionValue === Dimension.TRUE) \n return true\n \n return false\n }\n isIntersects() {\n return !this.isDisjoint()\n }\n isCovers() {\n const hasPointInCommon = IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.BOUNDARY]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.BOUNDARY])\n return hasPointInCommon && this._matrix[Location.EXTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.BOUNDARY] === Dimension.FALSE\n }\n isCoveredBy() {\n const hasPointInCommon = IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.BOUNDARY]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.BOUNDARY])\n return hasPointInCommon && this._matrix[Location.INTERIOR][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.EXTERIOR] === Dimension.FALSE\n }\n set() {\n if (arguments.length === 1) {\n const dimensionSymbols = arguments[0]\n for (let i = 0; i < dimensionSymbols.length; i++) {\n const row = Math.trunc(i / 3)\n const col = i % 3\n this._matrix[row][col] = Dimension.toDimensionValue(dimensionSymbols.charAt(i))\n }\n } else if (arguments.length === 3) {\n const row = arguments[0], column = arguments[1], dimensionValue = arguments[2]\n this._matrix[row][column] = dimensionValue\n }\n }\n isContains() {\n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && this._matrix[Location.EXTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.BOUNDARY] === Dimension.FALSE\n }\n setAtLeast() {\n if (arguments.length === 1) {\n const minimumDimensionSymbols = arguments[0]\n for (let i = 0; i < minimumDimensionSymbols.length; i++) {\n const row = Math.trunc(i / 3)\n const col = i % 3\n this.setAtLeast(row, col, Dimension.toDimensionValue(minimumDimensionSymbols.charAt(i)))\n }\n } else if (arguments.length === 3) {\n const row = arguments[0], column = arguments[1], minimumDimensionValue = arguments[2]\n if (this._matrix[row][column] < minimumDimensionValue) \n this._matrix[row][column] = minimumDimensionValue\n \n }\n }\n setAtLeastIfValid(row, column, minimumDimensionValue) {\n if (row >= 0 && column >= 0) \n this.setAtLeast(row, column, minimumDimensionValue)\n \n }\n isWithin() {\n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && this._matrix[Location.INTERIOR][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.EXTERIOR] === Dimension.FALSE\n }\n isTouches(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA > dimensionOfGeometryB) \n return this.isTouches(dimensionOfGeometryB, dimensionOfGeometryA)\n \n if (dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.L || dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.L) \n return this._matrix[Location.INTERIOR][Location.INTERIOR] === Dimension.FALSE && (IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.BOUNDARY]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.INTERIOR]) || IntersectionMatrix.isTrue(this._matrix[Location.BOUNDARY][Location.BOUNDARY]))\n \n return false\n }\n isOverlaps(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.P || dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.A) \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.EXTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.EXTERIOR][Location.INTERIOR])\n \n if (dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.L) \n return this._matrix[Location.INTERIOR][Location.INTERIOR] === 1 && IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.EXTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.EXTERIOR][Location.INTERIOR])\n \n return false\n }\n isEquals(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA !== dimensionOfGeometryB) \n return false\n \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && this._matrix[Location.INTERIOR][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.EXTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.EXTERIOR][Location.BOUNDARY] === Dimension.FALSE\n }\n toString() {\n const builder = new StringBuilder('123456789')\n for (let ai = 0; ai < 3; ai++) \n for (let bi = 0; bi < 3; bi++) \n builder.setCharAt(3 * ai + bi, Dimension.toDimensionSymbol(this._matrix[ai][bi]))\n \n \n return builder.toString()\n }\n setAll(dimensionValue) {\n for (let ai = 0; ai < 3; ai++) \n for (let bi = 0; bi < 3; bi++) \n this._matrix[ai][bi] = dimensionValue\n \n \n }\n get(row, column) {\n return this._matrix[row][column]\n }\n transpose() {\n let temp = this._matrix[1][0]\n this._matrix[1][0] = this._matrix[0][1]\n this._matrix[0][1] = temp\n temp = this._matrix[2][0]\n this._matrix[2][0] = this._matrix[0][2]\n this._matrix[0][2] = temp\n temp = this._matrix[2][1]\n this._matrix[2][1] = this._matrix[1][2]\n this._matrix[1][2] = temp\n return this\n }\n matches(requiredDimensionSymbols) {\n if (requiredDimensionSymbols.length !== 9) \n throw new IllegalArgumentException('Should be length 9: ' + requiredDimensionSymbols)\n \n for (let ai = 0; ai < 3; ai++) \n for (let bi = 0; bi < 3; bi++) \n if (!IntersectionMatrix.matches(this._matrix[ai][bi], requiredDimensionSymbols.charAt(3 * ai + bi))) \n return false\n \n \n \n return true\n }\n add(im) {\n for (let i = 0; i < 3; i++) \n for (let j = 0; j < 3; j++) \n this.setAtLeast(i, j, im.get(i, j))\n \n \n }\n isDisjoint() {\n return this._matrix[Location.INTERIOR][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.INTERIOR][Location.BOUNDARY] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.INTERIOR] === Dimension.FALSE && this._matrix[Location.BOUNDARY][Location.BOUNDARY] === Dimension.FALSE\n }\n isCrosses(dimensionOfGeometryA, dimensionOfGeometryB) {\n if (dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.L || dimensionOfGeometryA === Dimension.P && dimensionOfGeometryB === Dimension.A || dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.A) \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.EXTERIOR])\n \n if (dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.P || dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.P || dimensionOfGeometryA === Dimension.A && dimensionOfGeometryB === Dimension.L) \n return IntersectionMatrix.isTrue(this._matrix[Location.INTERIOR][Location.INTERIOR]) && IntersectionMatrix.isTrue(this._matrix[Location.EXTERIOR][Location.INTERIOR])\n \n if (dimensionOfGeometryA === Dimension.L && dimensionOfGeometryB === Dimension.L) \n return this._matrix[Location.INTERIOR][Location.INTERIOR] === 0\n \n return false\n }\n get interfaces_() {\n return [Cloneable]\n }\n}\n","import Arrays from '../../../../java/util/Arrays.js'\nimport System from '../../../../java/lang/System.js'\nexport default class IntArrayList {\n constructor() {\n IntArrayList.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._data = null\n this._size = 0\n if (arguments.length === 0) {\n IntArrayList.constructor_.call(this, 10)\n } else if (arguments.length === 1) {\n const initialCapacity = arguments[0]\n this._data = new Array(initialCapacity).fill(null)\n }\n }\n size() {\n return this._size\n }\n addAll(values) {\n if (values === null) return null\n if (values.length === 0) return null\n this.ensureCapacity(this._size + values.length)\n System.arraycopy(values, 0, this._data, this._size, values.length)\n this._size += values.length\n }\n ensureCapacity(capacity) {\n if (capacity <= this._data.length) return null\n const newLength = Math.max(capacity, this._data.length * 2)\n this._data = Arrays.copyOf(this._data, newLength)\n }\n toArray() {\n const array = new Array(this._size).fill(null)\n System.arraycopy(this._data, 0, array, 0, this._size)\n return array\n }\n add(value) {\n this.ensureCapacity(this._size + 1)\n this._data[this._size] = value\n ++ this._size\n }\n}\n","import IntArrayList from '../../util/IntArrayList.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Quadrant from '../Quadrant.js'\nexport default class MonotoneChainIndexer {\n static toIntArray(list) {\n const array = new Array(list.size()).fill(null)\n for (let i = 0; i < array.length; i++) \n array[i] = list.get(i).intValue()\n \n return array\n }\n getChainStartIndices(pts) {\n let start = 0\n const startIndexList = new IntArrayList(Math.trunc(pts.length / 2))\n startIndexList.add(start)\n do {\n const last = this.findChainEnd(pts, start)\n startIndexList.add(last)\n start = last\n } while (start < pts.length - 1)\n return startIndexList.toArray()\n }\n findChainEnd(pts, start) {\n const chainQuad = Quadrant.quadrant(pts[start], pts[start + 1])\n let last = start + 1\n while (last < pts.length) {\n const quad = Quadrant.quadrant(pts[last - 1], pts[last])\n if (quad !== chainQuad) break\n last++\n }\n return last - 1\n }\n OLDgetChainStartIndices(pts) {\n let start = 0\n const startIndexList = new ArrayList()\n startIndexList.add(start)\n do {\n const last = this.findChainEnd(pts, start)\n startIndexList.add(last)\n start = last\n } while (start < pts.length - 1)\n const startIndex = MonotoneChainIndexer.toIntArray(startIndexList)\n return startIndex\n }\n}\n","import MonotoneChainIndexer from './MonotoneChainIndexer.js'\nimport Envelope from '../../geom/Envelope.js'\nexport default class MonotoneChainEdge {\n constructor() {\n MonotoneChainEdge.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.e = null\n this.pts = null\n this.startIndex = null\n const e = arguments[0]\n this.e = e\n this.pts = e.getCoordinates()\n const mcb = new MonotoneChainIndexer()\n this.startIndex = mcb.getChainStartIndices(this.pts)\n }\n getCoordinates() {\n return this.pts\n }\n getMaxX(chainIndex) {\n const x1 = this.pts[this.startIndex[chainIndex]].x\n const x2 = this.pts[this.startIndex[chainIndex + 1]].x\n return x1 > x2 ? x1 : x2\n }\n getMinX(chainIndex) {\n const x1 = this.pts[this.startIndex[chainIndex]].x\n const x2 = this.pts[this.startIndex[chainIndex + 1]].x\n return x1 < x2 ? x1 : x2\n }\n computeIntersectsForChain() {\n if (arguments.length === 4) {\n const chainIndex0 = arguments[0], mce = arguments[1], chainIndex1 = arguments[2], si = arguments[3]\n this.computeIntersectsForChain(this.startIndex[chainIndex0], this.startIndex[chainIndex0 + 1], mce, mce.startIndex[chainIndex1], mce.startIndex[chainIndex1 + 1], si)\n } else if (arguments.length === 6) {\n const start0 = arguments[0], end0 = arguments[1], mce = arguments[2], start1 = arguments[3], end1 = arguments[4], ei = arguments[5]\n if (end0 - start0 === 1 && end1 - start1 === 1) {\n ei.addIntersections(this.e, start0, mce.e, start1)\n return null\n }\n if (!this.overlaps(start0, end0, mce, start1, end1)) return null\n const mid0 = Math.trunc((start0 + end0) / 2)\n const mid1 = Math.trunc((start1 + end1) / 2)\n if (start0 < mid0) {\n if (start1 < mid1) this.computeIntersectsForChain(start0, mid0, mce, start1, mid1, ei)\n if (mid1 < end1) this.computeIntersectsForChain(start0, mid0, mce, mid1, end1, ei)\n }\n if (mid0 < end0) {\n if (start1 < mid1) this.computeIntersectsForChain(mid0, end0, mce, start1, mid1, ei)\n if (mid1 < end1) this.computeIntersectsForChain(mid0, end0, mce, mid1, end1, ei)\n }\n }\n }\n overlaps(start0, end0, mce, start1, end1) {\n return Envelope.intersects(this.pts[start0], this.pts[end0], mce.pts[start1], mce.pts[end1])\n }\n getStartIndexes() {\n return this.startIndex\n }\n computeIntersects(mce, si) {\n for (let i = 0; i < this.startIndex.length - 1; i++) \n for (let j = 0; j < mce.startIndex.length - 1; j++) \n this.computeIntersectsForChain(i, mce, j, si)\n \n \n }\n}\n","import Location from '../geom/Location.js'\nimport Position from './Position.js'\nexport default class Depth {\n constructor() {\n Depth.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._depth = Array(2).fill().map(() => Array(3))\n for (let i = 0; i < 2; i++) \n for (let j = 0; j < 3; j++) \n this._depth[i][j] = Depth.NULL_VALUE\n \n \n }\n static depthAtLocation(location) {\n if (location === Location.EXTERIOR) return 0\n if (location === Location.INTERIOR) return 1\n return Depth.NULL_VALUE\n }\n getDepth(geomIndex, posIndex) {\n return this._depth[geomIndex][posIndex]\n }\n setDepth(geomIndex, posIndex, depthValue) {\n this._depth[geomIndex][posIndex] = depthValue\n }\n isNull() {\n if (arguments.length === 0) {\n for (let i = 0; i < 2; i++) \n for (let j = 0; j < 3; j++) \n if (this._depth[i][j] !== Depth.NULL_VALUE) return false\n \n \n return true\n } else if (arguments.length === 1) {\n const geomIndex = arguments[0]\n return this._depth[geomIndex][1] === Depth.NULL_VALUE\n } else if (arguments.length === 2) {\n const geomIndex = arguments[0], posIndex = arguments[1]\n return this._depth[geomIndex][posIndex] === Depth.NULL_VALUE\n }\n }\n normalize() {\n for (let i = 0; i < 2; i++) \n if (!this.isNull(i)) {\n let minDepth = this._depth[i][1]\n if (this._depth[i][2] < minDepth) minDepth = this._depth[i][2]\n if (minDepth < 0) minDepth = 0\n for (let j = 1; j < 3; j++) {\n let newValue = 0\n if (this._depth[i][j] > minDepth) newValue = 1\n this._depth[i][j] = newValue\n }\n }\n \n }\n getDelta(geomIndex) {\n return this._depth[geomIndex][Position.RIGHT] - this._depth[geomIndex][Position.LEFT]\n }\n getLocation(geomIndex, posIndex) {\n if (this._depth[geomIndex][posIndex] <= 0) return Location.EXTERIOR\n return Location.INTERIOR\n }\n toString() {\n return 'A: ' + this._depth[0][1] + ',' + this._depth[0][2] + ' B: ' + this._depth[1][1] + ',' + this._depth[1][2]\n }\n add() {\n if (arguments.length === 1) {\n const lbl = arguments[0]\n for (let i = 0; i < 2; i++) \n for (let j = 1; j < 3; j++) {\n const loc = lbl.getLocation(i, j)\n if (loc === Location.EXTERIOR || loc === Location.INTERIOR) \n if (this.isNull(i, j)) \n this._depth[i][j] = Depth.depthAtLocation(loc)\n else this._depth[i][j] += Depth.depthAtLocation(loc)\n \n }\n \n } else if (arguments.length === 3) {\n const geomIndex = arguments[0], posIndex = arguments[1], location = arguments[2]\n if (location === Location.INTERIOR) this._depth[geomIndex][posIndex]++\n }\n }\n}\nDepth.NULL_VALUE = -1\n","import EdgeIntersectionList from './EdgeIntersectionList.js'\nimport IntersectionMatrix from '../geom/IntersectionMatrix.js'\nimport MonotoneChainEdge from './index/MonotoneChainEdge.js'\nimport Position from './Position.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Label from './Label.js'\nimport Envelope from '../geom/Envelope.js'\nimport StringBuilder from '../../../../java/lang/StringBuilder.js'\nimport Depth from './Depth.js'\nimport GraphComponent from './GraphComponent.js'\nexport default class Edge extends GraphComponent {\n constructor() {\n super()\n Edge.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.pts = null\n this._env = null\n this.eiList = new EdgeIntersectionList(this)\n this._name = null\n this._mce = null\n this._isIsolated = true\n this._depth = new Depth()\n this._depthDelta = 0\n if (arguments.length === 1) {\n const pts = arguments[0]\n Edge.constructor_.call(this, pts, null)\n } else if (arguments.length === 2) {\n const pts = arguments[0], label = arguments[1]\n this.pts = pts\n this._label = label\n }\n }\n static updateIM() {\n if (arguments.length === 2 && (arguments[1] instanceof IntersectionMatrix && arguments[0] instanceof Label)) {\n const label = arguments[0], im = arguments[1]\n im.setAtLeastIfValid(label.getLocation(0, Position.ON), label.getLocation(1, Position.ON), 1)\n if (label.isArea()) {\n im.setAtLeastIfValid(label.getLocation(0, Position.LEFT), label.getLocation(1, Position.LEFT), 2)\n im.setAtLeastIfValid(label.getLocation(0, Position.RIGHT), label.getLocation(1, Position.RIGHT), 2)\n }\n } else {\n return super.updateIM.apply(this, arguments)\n }\n }\n getDepth() {\n return this._depth\n }\n getCollapsedEdge() {\n const newPts = new Array(2).fill(null)\n newPts[0] = this.pts[0]\n newPts[1] = this.pts[1]\n const newe = new Edge(newPts, Label.toLineLabel(this._label))\n return newe\n }\n isIsolated() {\n return this._isIsolated\n }\n getCoordinates() {\n return this.pts\n }\n setIsolated(isIsolated) {\n this._isIsolated = isIsolated\n }\n setName(name) {\n this._name = name\n }\n equals(o) {\n if (!(o instanceof Edge)) return false\n const e = o\n if (this.pts.length !== e.pts.length) return false\n let isEqualForward = true\n let isEqualReverse = true\n let iRev = this.pts.length\n for (let i = 0; i < this.pts.length; i++) {\n if (!this.pts[i].equals2D(e.pts[i])) \n isEqualForward = false\n \n if (!this.pts[i].equals2D(e.pts[-- iRev])) \n isEqualReverse = false\n \n if (!isEqualForward && !isEqualReverse) return false\n }\n return true\n }\n getCoordinate() {\n if (arguments.length === 0) {\n if (this.pts.length > 0) return this.pts[0]\n return null\n } else if (arguments.length === 1) {\n const i = arguments[0]\n return this.pts[i]\n }\n }\n print(out) {\n out.print('edge ' + this._name + ': ')\n out.print('LINESTRING (')\n for (let i = 0; i < this.pts.length; i++) {\n if (i > 0) out.print(',')\n out.print(this.pts[i].x + ' ' + this.pts[i].y)\n }\n out.print(') ' + this._label + ' ' + this._depthDelta)\n }\n computeIM(im) {\n Edge.updateIM(this._label, im)\n }\n isCollapsed() {\n if (!this._label.isArea()) return false\n if (this.pts.length !== 3) return false\n if (this.pts[0].equals(this.pts[2])) return true\n return false\n }\n isClosed() {\n return this.pts[0].equals(this.pts[this.pts.length - 1])\n }\n getMaximumSegmentIndex() {\n return this.pts.length - 1\n }\n getDepthDelta() {\n return this._depthDelta\n }\n getNumPoints() {\n return this.pts.length\n }\n printReverse(out) {\n out.print('edge ' + this._name + ': ')\n for (let i = this.pts.length - 1; i >= 0; i--) \n out.print(this.pts[i] + ' ')\n \n out.println('')\n }\n getMonotoneChainEdge() {\n if (this._mce === null) this._mce = new MonotoneChainEdge(this)\n return this._mce\n }\n getEnvelope() {\n if (this._env === null) {\n this._env = new Envelope()\n for (let i = 0; i < this.pts.length; i++) \n this._env.expandToInclude(this.pts[i])\n \n }\n return this._env\n }\n addIntersection(li, segmentIndex, geomIndex, intIndex) {\n const intPt = new Coordinate(li.getIntersection(intIndex))\n let normalizedSegmentIndex = segmentIndex\n let dist = li.getEdgeDistance(geomIndex, intIndex)\n const nextSegIndex = normalizedSegmentIndex + 1\n if (nextSegIndex < this.pts.length) {\n const nextPt = this.pts[nextSegIndex]\n if (intPt.equals2D(nextPt)) {\n normalizedSegmentIndex = nextSegIndex\n dist = 0.0\n }\n }\n const ei = this.eiList.add(intPt, normalizedSegmentIndex, dist)\n }\n toString() {\n const builder = new StringBuilder()\n builder.append('edge ' + this._name + ': ')\n builder.append('LINESTRING (')\n for (let i = 0; i < this.pts.length; i++) {\n if (i > 0) builder.append(',')\n builder.append(this.pts[i].x + ' ' + this.pts[i].y)\n }\n builder.append(') ' + this._label + ' ' + this._depthDelta)\n return builder.toString()\n }\n isPointwiseEqual(e) {\n if (this.pts.length !== e.pts.length) return false\n for (let i = 0; i < this.pts.length; i++) \n if (!this.pts[i].equals2D(e.pts[i])) \n return false\n \n \n return true\n }\n setDepthDelta(depthDelta) {\n this._depthDelta = depthDelta\n }\n getEdgeIntersectionList() {\n return this.eiList\n }\n addIntersections(li, segmentIndex, geomIndex) {\n for (let i = 0; i < li.getIntersectionNum(); i++) \n this.addIntersection(li, segmentIndex, geomIndex, i)\n \n }\n}\n","import Location from '../../geom/Location.js'\nimport BufferSubgraph from './BufferSubgraph.js'\nimport PolygonBuilder from '../overlay/PolygonBuilder.js'\nimport GeometryFactory from '../../geom/GeometryFactory.js'\nimport Position from '../../geomgraph/Position.js'\nimport MCIndexNoder from '../../noding/MCIndexNoder.js'\nimport OffsetCurveBuilder from './OffsetCurveBuilder.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport SubgraphDepthLocater from './SubgraphDepthLocater.js'\nimport OffsetCurveSetBuilder from './OffsetCurveSetBuilder.js'\nimport Label from '../../geomgraph/Label.js'\nimport OverlayNodeFactory from '../overlay/OverlayNodeFactory.js'\nimport EdgeList from '../../geomgraph/EdgeList.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nimport IntersectionAdder from '../../noding/IntersectionAdder.js'\nimport Edge from '../../geomgraph/Edge.js'\nimport PlanarGraph from '../../geomgraph/PlanarGraph.js'\nexport default class BufferBuilder {\n constructor() {\n BufferBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._bufParams = null\n this._workingPrecisionModel = null\n this._workingNoder = null\n this._geomFact = null\n this._graph = null\n this._edgeList = new EdgeList()\n const bufParams = arguments[0]\n this._bufParams = bufParams\n }\n static depthDelta(label) {\n const lLoc = label.getLocation(0, Position.LEFT)\n const rLoc = label.getLocation(0, Position.RIGHT)\n if (lLoc === Location.INTERIOR && rLoc === Location.EXTERIOR) return 1; else if (lLoc === Location.EXTERIOR && rLoc === Location.INTERIOR) return -1\n return 0\n }\n static convertSegStrings(it) {\n const fact = new GeometryFactory()\n const lines = new ArrayList()\n while (it.hasNext()) {\n const ss = it.next()\n const line = fact.createLineString(ss.getCoordinates())\n lines.add(line)\n }\n return fact.buildGeometry(lines)\n }\n setWorkingPrecisionModel(pm) {\n this._workingPrecisionModel = pm\n }\n insertUniqueEdge(e) {\n const existingEdge = this._edgeList.findEqualEdge(e)\n if (existingEdge !== null) {\n const existingLabel = existingEdge.getLabel()\n let labelToMerge = e.getLabel()\n if (!existingEdge.isPointwiseEqual(e)) {\n labelToMerge = new Label(e.getLabel())\n labelToMerge.flip()\n }\n existingLabel.merge(labelToMerge)\n const mergeDelta = BufferBuilder.depthDelta(labelToMerge)\n const existingDelta = existingEdge.getDepthDelta()\n const newDelta = existingDelta + mergeDelta\n existingEdge.setDepthDelta(newDelta)\n } else {\n this._edgeList.add(e)\n e.setDepthDelta(BufferBuilder.depthDelta(e.getLabel()))\n }\n }\n buildSubgraphs(subgraphList, polyBuilder) {\n const processedGraphs = new ArrayList()\n for (let i = subgraphList.iterator(); i.hasNext(); ) {\n const subgraph = i.next()\n const p = subgraph.getRightmostCoordinate()\n const locater = new SubgraphDepthLocater(processedGraphs)\n const outsideDepth = locater.getDepth(p)\n subgraph.computeDepth(outsideDepth)\n subgraph.findResultEdges()\n processedGraphs.add(subgraph)\n polyBuilder.add(subgraph.getDirectedEdges(), subgraph.getNodes())\n }\n }\n createSubgraphs(graph) {\n const subgraphList = new ArrayList()\n for (let i = graph.getNodes().iterator(); i.hasNext(); ) {\n const node = i.next()\n if (!node.isVisited()) {\n const subgraph = new BufferSubgraph()\n subgraph.create(node)\n subgraphList.add(subgraph)\n }\n }\n Collections.sort(subgraphList, Collections.reverseOrder())\n return subgraphList\n }\n createEmptyResultGeometry() {\n const emptyGeom = this._geomFact.createPolygon()\n return emptyGeom\n }\n getNoder(precisionModel) {\n if (this._workingNoder !== null) return this._workingNoder\n const noder = new MCIndexNoder()\n const li = new RobustLineIntersector()\n li.setPrecisionModel(precisionModel)\n noder.setSegmentIntersector(new IntersectionAdder(li))\n return noder\n }\n buffer(g, distance) {\n let precisionModel = this._workingPrecisionModel\n if (precisionModel === null) precisionModel = g.getPrecisionModel()\n this._geomFact = g.getFactory()\n const curveBuilder = new OffsetCurveBuilder(precisionModel, this._bufParams)\n const curveSetBuilder = new OffsetCurveSetBuilder(g, distance, curveBuilder)\n const bufferSegStrList = curveSetBuilder.getCurves()\n if (bufferSegStrList.size() <= 0) \n return this.createEmptyResultGeometry()\n \n this.computeNodedEdges(bufferSegStrList, precisionModel)\n this._graph = new PlanarGraph(new OverlayNodeFactory())\n this._graph.addEdges(this._edgeList.getEdges())\n const subgraphList = this.createSubgraphs(this._graph)\n const polyBuilder = new PolygonBuilder(this._geomFact)\n this.buildSubgraphs(subgraphList, polyBuilder)\n const resultPolyList = polyBuilder.getPolygons()\n if (resultPolyList.size() <= 0) \n return this.createEmptyResultGeometry()\n \n const resultGeom = this._geomFact.buildGeometry(resultPolyList)\n return resultGeom\n }\n computeNodedEdges(bufferSegStrList, precisionModel) {\n const noder = this.getNoder(precisionModel)\n noder.computeNodes(bufferSegStrList)\n const nodedSegStrings = noder.getNodedSubstrings()\n for (let i = nodedSegStrings.iterator(); i.hasNext(); ) {\n const segStr = i.next()\n const pts = segStr.getCoordinates()\n if (pts.length === 2 && pts[0].equals2D(pts[1])) continue\n const oldLabel = segStr.getData()\n const edge = new Edge(segStr.getCoordinates(), new Label(oldLabel))\n this.insertUniqueEdge(edge)\n }\n }\n setNoder(noder) {\n this._workingNoder = noder\n }\n}\n","import hasInterface from '../../../../hasInterface.js'\nimport Collection from '../../../../java/util/Collection.js'\nimport Noder from './Noder.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport NodedSegmentString from './NodedSegmentString.js'\nimport System from '../../../../java/lang/System.js'\nimport CoordinateArrays from '../geom/CoordinateArrays.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class ScaledNoder {\n constructor() {\n ScaledNoder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._noder = null\n this._scaleFactor = null\n this._offsetX = null\n this._offsetY = null\n this._isScaled = false\n if (arguments.length === 2) {\n const noder = arguments[0], scaleFactor = arguments[1]\n ScaledNoder.constructor_.call(this, noder, scaleFactor, 0, 0)\n } else if (arguments.length === 4) {\n const noder = arguments[0], scaleFactor = arguments[1], offsetX = arguments[2], offsetY = arguments[3]\n this._noder = noder\n this._scaleFactor = scaleFactor\n this._isScaled = !this.isIntegerPrecision()\n }\n }\n rescale() {\n if (hasInterface(arguments[0], Collection)) {\n const segStrings = arguments[0]\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n this.rescale(ss.getCoordinates())\n }\n } else if (arguments[0] instanceof Array) {\n const pts = arguments[0]\n for (let i = 0; i < pts.length; i++) {\n pts[i].x = pts[i].x / this._scaleFactor + this._offsetX\n pts[i].y = pts[i].y / this._scaleFactor + this._offsetY\n }\n if (pts.length === 2 && pts[0].equals2D(pts[1])) \n System.out.println(pts)\n \n }\n }\n scale() {\n if (hasInterface(arguments[0], Collection)) {\n const segStrings = arguments[0]\n const nodedSegmentStrings = new ArrayList(segStrings.size())\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n nodedSegmentStrings.add(new NodedSegmentString(this.scale(ss.getCoordinates()), ss.getData()))\n }\n return nodedSegmentStrings\n } else if (arguments[0] instanceof Array) {\n const pts = arguments[0]\n const roundPts = new Array(pts.length).fill(null)\n for (let i = 0; i < pts.length; i++) \n roundPts[i] = new Coordinate(Math.round((pts[i].x - this._offsetX) * this._scaleFactor), Math.round((pts[i].y - this._offsetY) * this._scaleFactor), pts[i].getZ())\n \n const roundPtsNoDup = CoordinateArrays.removeRepeatedPoints(roundPts)\n return roundPtsNoDup\n }\n }\n isIntegerPrecision() {\n return this._scaleFactor === 1.0\n }\n getNodedSubstrings() {\n const splitSS = this._noder.getNodedSubstrings()\n if (this._isScaled) this.rescale(splitSS)\n return splitSS\n }\n computeNodes(inputSegStrings) {\n let intSegStrings = inputSegStrings\n if (this._isScaled) intSegStrings = this.scale(inputSegStrings)\n this._noder.computeNodes(intSegStrings)\n }\n get interfaces_() {\n return [Noder]\n }\n}\n","import GeometryFactory from '../geom/GeometryFactory.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nimport RuntimeException from '../../../../java/lang/RuntimeException.js'\nexport default class NodingValidator {\n constructor() {\n NodingValidator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._segStrings = null\n const segStrings = arguments[0]\n this._segStrings = segStrings\n }\n checkEndPtVertexIntersections() {\n if (arguments.length === 0) {\n for (let i = this._segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n const pts = ss.getCoordinates()\n this.checkEndPtVertexIntersections(pts[0], this._segStrings)\n this.checkEndPtVertexIntersections(pts[pts.length - 1], this._segStrings)\n }\n } else if (arguments.length === 2) {\n const testPt = arguments[0], segStrings = arguments[1]\n for (let i = segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n const pts = ss.getCoordinates()\n for (let j = 1; j < pts.length - 1; j++) \n if (pts[j].equals(testPt)) throw new RuntimeException('found endpt/interior pt intersection at index ' + j + ' :pt ' + testPt)\n \n }\n }\n }\n checkInteriorIntersections() {\n if (arguments.length === 0) {\n for (let i = this._segStrings.iterator(); i.hasNext(); ) {\n const ss0 = i.next()\n for (let j = this._segStrings.iterator(); j.hasNext(); ) {\n const ss1 = j.next()\n this.checkInteriorIntersections(ss0, ss1)\n }\n }\n } else if (arguments.length === 2) {\n const ss0 = arguments[0], ss1 = arguments[1]\n const pts0 = ss0.getCoordinates()\n const pts1 = ss1.getCoordinates()\n for (let i0 = 0; i0 < pts0.length - 1; i0++) \n for (let i1 = 0; i1 < pts1.length - 1; i1++) \n this.checkInteriorIntersections(ss0, i0, ss1, i1)\n \n \n } else if (arguments.length === 4) {\n const e0 = arguments[0], segIndex0 = arguments[1], e1 = arguments[2], segIndex1 = arguments[3]\n if (e0 === e1 && segIndex0 === segIndex1) return null\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) \n if (this._li.isProper() || this.hasInteriorIntersection(this._li, p00, p01) || this.hasInteriorIntersection(this._li, p10, p11)) \n throw new RuntimeException('found non-noded intersection at ' + p00 + '-' + p01 + ' and ' + p10 + '-' + p11)\n \n \n }\n }\n checkValid() {\n this.checkEndPtVertexIntersections()\n this.checkInteriorIntersections()\n this.checkCollapses()\n }\n checkCollapses() {\n if (arguments.length === 0) {\n for (let i = this._segStrings.iterator(); i.hasNext(); ) {\n const ss = i.next()\n this.checkCollapses(ss)\n }\n } else if (arguments.length === 1) {\n const ss = arguments[0]\n const pts = ss.getCoordinates()\n for (let i = 0; i < pts.length - 2; i++) \n this.checkCollapse(pts[i], pts[i + 1], pts[i + 2])\n \n }\n }\n hasInteriorIntersection(li, p0, p1) {\n for (let i = 0; i < li.getIntersectionNum(); i++) {\n const intPt = li.getIntersection(i)\n if (!(intPt.equals(p0) || intPt.equals(p1))) return true\n }\n return false\n }\n checkCollapse(p0, p1, p2) {\n if (p0.equals(p2)) throw new RuntimeException('found non-noded collapse at ' + NodingValidator.fact.createLineString([p0, p1, p2]))\n }\n}\nNodingValidator.fact = new GeometryFactory()\n","import Coordinate from '../../geom/Coordinate.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport Envelope from '../../geom/Envelope.js'\nimport Assert from '../../util/Assert.js'\nexport default class HotPixel {\n constructor() {\n HotPixel.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = null\n this._pt = null\n this._originalPt = null\n this._ptScaled = null\n this._p0Scaled = null\n this._p1Scaled = null\n this._scaleFactor = null\n this._minx = null\n this._maxx = null\n this._miny = null\n this._maxy = null\n this._corner = new Array(4).fill(null)\n this._safeEnv = null\n const pt = arguments[0], scaleFactor = arguments[1], li = arguments[2]\n this._originalPt = pt\n this._pt = pt\n this._scaleFactor = scaleFactor\n this._li = li\n if (scaleFactor <= 0) throw new IllegalArgumentException('Scale factor must be non-zero')\n if (scaleFactor !== 1.0) {\n this._pt = new Coordinate(this.scale(pt.x), this.scale(pt.y))\n this._p0Scaled = new Coordinate()\n this._p1Scaled = new Coordinate()\n }\n this.initCorners(this._pt)\n }\n intersectsScaled(p0, p1) {\n const segMinx = Math.min(p0.x, p1.x)\n const segMaxx = Math.max(p0.x, p1.x)\n const segMiny = Math.min(p0.y, p1.y)\n const segMaxy = Math.max(p0.y, p1.y)\n const isOutsidePixelEnv = this._maxx < segMinx || this._minx > segMaxx || this._maxy < segMiny || this._miny > segMaxy\n if (isOutsidePixelEnv) return false\n const intersects = this.intersectsToleranceSquare(p0, p1)\n Assert.isTrue(!(isOutsidePixelEnv && intersects), 'Found bad envelope test')\n return intersects\n }\n initCorners(pt) {\n const tolerance = 0.5\n this._minx = pt.x - tolerance\n this._maxx = pt.x + tolerance\n this._miny = pt.y - tolerance\n this._maxy = pt.y + tolerance\n this._corner[0] = new Coordinate(this._maxx, this._maxy)\n this._corner[1] = new Coordinate(this._minx, this._maxy)\n this._corner[2] = new Coordinate(this._minx, this._miny)\n this._corner[3] = new Coordinate(this._maxx, this._miny)\n }\n intersects(p0, p1) {\n if (this._scaleFactor === 1.0) return this.intersectsScaled(p0, p1)\n this.copyScaled(p0, this._p0Scaled)\n this.copyScaled(p1, this._p1Scaled)\n return this.intersectsScaled(this._p0Scaled, this._p1Scaled)\n }\n scale(val) {\n return Math.round(val * this._scaleFactor)\n }\n getCoordinate() {\n return this._originalPt\n }\n copyScaled(p, pScaled) {\n pScaled.x = this.scale(p.x)\n pScaled.y = this.scale(p.y)\n }\n getSafeEnvelope() {\n if (this._safeEnv === null) {\n const safeTolerance = HotPixel.SAFE_ENV_EXPANSION_FACTOR / this._scaleFactor\n this._safeEnv = new Envelope(this._originalPt.x - safeTolerance, this._originalPt.x + safeTolerance, this._originalPt.y - safeTolerance, this._originalPt.y + safeTolerance)\n }\n return this._safeEnv\n }\n intersectsPixelClosure(p0, p1) {\n this._li.computeIntersection(p0, p1, this._corner[0], this._corner[1])\n if (this._li.hasIntersection()) return true\n this._li.computeIntersection(p0, p1, this._corner[1], this._corner[2])\n if (this._li.hasIntersection()) return true\n this._li.computeIntersection(p0, p1, this._corner[2], this._corner[3])\n if (this._li.hasIntersection()) return true\n this._li.computeIntersection(p0, p1, this._corner[3], this._corner[0])\n if (this._li.hasIntersection()) return true\n return false\n }\n intersectsToleranceSquare(p0, p1) {\n let intersectsLeft = false\n let intersectsBottom = false\n this._li.computeIntersection(p0, p1, this._corner[0], this._corner[1])\n if (this._li.isProper()) return true\n this._li.computeIntersection(p0, p1, this._corner[1], this._corner[2])\n if (this._li.isProper()) return true\n if (this._li.hasIntersection()) intersectsLeft = true\n this._li.computeIntersection(p0, p1, this._corner[2], this._corner[3])\n if (this._li.isProper()) return true\n if (this._li.hasIntersection()) intersectsBottom = true\n this._li.computeIntersection(p0, p1, this._corner[3], this._corner[0])\n if (this._li.isProper()) return true\n if (intersectsLeft && intersectsBottom) return true\n if (p0.equals(this._pt)) return true\n if (p1.equals(this._pt)) return true\n return false\n }\n addSnappedNode(segStr, segIndex) {\n const p0 = segStr.getCoordinate(segIndex)\n const p1 = segStr.getCoordinate(segIndex + 1)\n if (this.intersects(p0, p1)) {\n segStr.addIntersection(this.getCoordinate(), segIndex)\n return true\n }\n return false\n }\n}\nHotPixel.SAFE_ENV_EXPANSION_FACTOR = 0.75\n","import LineSegment from '../../geom/LineSegment.js'\nexport default class MonotoneChainSelectAction {\n constructor() {\n MonotoneChainSelectAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.selectedSegment = new LineSegment()\n }\n select() {\n if (arguments.length === 1) {\n const seg = arguments[0]\n } else if (arguments.length === 2) {\n const mc = arguments[0], startIndex = arguments[1]\n mc.getLineSegment(startIndex, this.selectedSegment)\n this.select(this.selectedSegment)\n }\n }\n}\n","import MonotoneChainSelectAction from '../../index/chain/MonotoneChainSelectAction.js'\nimport MonotoneChain from '../../index/chain/MonotoneChain.js'\nimport ItemVisitor from '../../index/ItemVisitor.js'\nexport default class MCIndexPointSnapper {\n constructor() {\n MCIndexPointSnapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._index = null\n const index = arguments[0]\n this._index = index\n }\n snap() {\n if (arguments.length === 1) {\n const hotPixel = arguments[0]\n return this.snap(hotPixel, null, -1)\n } else if (arguments.length === 3) {\n const hotPixel = arguments[0], parentEdge = arguments[1], hotPixelVertexIndex = arguments[2]\n const pixelEnv = hotPixel.getSafeEnvelope()\n const hotPixelSnapAction = new HotPixelSnapAction(hotPixel, parentEdge, hotPixelVertexIndex)\n this._index.query(pixelEnv, new (class {\n get interfaces_() {\n return [ItemVisitor]\n }\n visitItem(item) {\n const testChain = item\n testChain.select(pixelEnv, hotPixelSnapAction)\n }\n })())\n return hotPixelSnapAction.isNodeAdded()\n }\n }\n}\nclass HotPixelSnapAction extends MonotoneChainSelectAction {\n constructor() {\n super()\n HotPixelSnapAction.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hotPixel = null\n this._parentEdge = null\n this._hotPixelVertexIndex = null\n this._isNodeAdded = false\n const hotPixel = arguments[0], parentEdge = arguments[1], hotPixelVertexIndex = arguments[2]\n this._hotPixel = hotPixel\n this._parentEdge = parentEdge\n this._hotPixelVertexIndex = hotPixelVertexIndex\n }\n isNodeAdded() {\n return this._isNodeAdded\n }\n select() {\n if (arguments.length === 2 && (Number.isInteger(arguments[1]) && arguments[0] instanceof MonotoneChain)) {\n const mc = arguments[0], startIndex = arguments[1]\n const ss = mc.getContext()\n if (this._parentEdge === ss) \n if (startIndex === this._hotPixelVertexIndex || startIndex + 1 === this._hotPixelVertexIndex) return null\n \n this._isNodeAdded |= this._hotPixel.addSnappedNode(ss, startIndex)\n } else {\n return super.select.apply(this, arguments)\n }\n }\n}\nMCIndexPointSnapper.HotPixelSnapAction = HotPixelSnapAction\n","import SegmentIntersector from './SegmentIntersector.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class InteriorIntersectionFinderAdder {\n constructor() {\n InteriorIntersectionFinderAdder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = null\n this._interiorIntersections = null\n const li = arguments[0]\n this._li = li\n this._interiorIntersections = new ArrayList()\n }\n processIntersections(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1 && segIndex0 === segIndex1) return null\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) \n if (this._li.isInteriorIntersection()) {\n for (let intIndex = 0; intIndex < this._li.getIntersectionNum(); intIndex++) \n this._interiorIntersections.add(this._li.getIntersection(intIndex))\n \n e0.addIntersections(this._li, segIndex0, 0)\n e1.addIntersections(this._li, segIndex1, 1)\n }\n \n }\n isDone() {\n return false\n }\n getInteriorIntersections() {\n return this._interiorIntersections\n }\n get interfaces_() {\n return [SegmentIntersector]\n }\n}\n","import NodingValidator from '../NodingValidator.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport Collection from '../../../../../java/util/Collection.js'\nimport Noder from '../Noder.js'\nimport MCIndexNoder from '../MCIndexNoder.js'\nimport NodedSegmentString from '../NodedSegmentString.js'\nimport HotPixel from './HotPixel.js'\nimport Exception from '../../../../../java/lang/Exception.js'\nimport MCIndexPointSnapper from './MCIndexPointSnapper.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nimport InteriorIntersectionFinderAdder from '../InteriorIntersectionFinderAdder.js'\nexport default class MCIndexSnapRounder {\n constructor() {\n MCIndexSnapRounder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pm = null\n this._li = null\n this._scaleFactor = null\n this._noder = null\n this._pointSnapper = null\n this._nodedSegStrings = null\n const pm = arguments[0]\n this._pm = pm\n this._li = new RobustLineIntersector()\n this._li.setPrecisionModel(pm)\n this._scaleFactor = pm.getScale()\n }\n checkCorrectness(inputSegmentStrings) {\n const resultSegStrings = NodedSegmentString.getNodedSubstrings(inputSegmentStrings)\n const nv = new NodingValidator(resultSegStrings)\n try {\n nv.checkValid()\n } catch (ex) {\n if (ex instanceof Exception) \n ex.printStackTrace()\n else throw ex\n } finally {}\n }\n getNodedSubstrings() {\n return NodedSegmentString.getNodedSubstrings(this._nodedSegStrings)\n }\n snapRound(segStrings, li) {\n const intersections = this.findInteriorIntersections(segStrings, li)\n this.computeIntersectionSnaps(intersections)\n this.computeVertexSnaps(segStrings)\n }\n findInteriorIntersections(segStrings, li) {\n const intFinderAdder = new InteriorIntersectionFinderAdder(li)\n this._noder.setSegmentIntersector(intFinderAdder)\n this._noder.computeNodes(segStrings)\n return intFinderAdder.getInteriorIntersections()\n }\n computeVertexSnaps() {\n if (hasInterface(arguments[0], Collection)) {\n const edges = arguments[0]\n for (let i0 = edges.iterator(); i0.hasNext(); ) {\n const edge0 = i0.next()\n this.computeVertexSnaps(edge0)\n }\n } else if (arguments[0] instanceof NodedSegmentString) {\n const e = arguments[0]\n const pts0 = e.getCoordinates()\n for (let i = 0; i < pts0.length; i++) {\n const hotPixel = new HotPixel(pts0[i], this._scaleFactor, this._li)\n const isNodeAdded = this._pointSnapper.snap(hotPixel, e, i)\n if (isNodeAdded) \n e.addIntersection(pts0[i], i)\n \n }\n }\n }\n computeNodes(inputSegmentStrings) {\n this._nodedSegStrings = inputSegmentStrings\n this._noder = new MCIndexNoder()\n this._pointSnapper = new MCIndexPointSnapper(this._noder.getIndex())\n this.snapRound(inputSegmentStrings, this._li)\n }\n computeIntersectionSnaps(snapPts) {\n for (let it = snapPts.iterator(); it.hasNext(); ) {\n const snapPt = it.next()\n const hotPixel = new HotPixel(snapPt, this._scaleFactor, this._li)\n this._pointSnapper.snap(hotPixel)\n }\n }\n get interfaces_() {\n return [Noder]\n }\n}\n","import BufferParameters from './BufferParameters.js'\nimport Geometry from '../../geom/Geometry.js'\nimport BufferBuilder from './BufferBuilder.js'\nimport ScaledNoder from '../../noding/ScaledNoder.js'\nimport TopologyException from '../../geom/TopologyException.js'\nimport MathUtil from '../../math/MathUtil.js'\nimport PrecisionModel from '../../geom/PrecisionModel.js'\nimport RuntimeException from '../../../../../java/lang/RuntimeException.js'\nimport MCIndexSnapRounder from '../../noding/snapround/MCIndexSnapRounder.js'\nexport default class BufferOp {\n constructor() {\n BufferOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._argGeom = null\n this._distance = null\n this._bufParams = new BufferParameters()\n this._resultGeometry = null\n this._saveException = null\n if (arguments.length === 1) {\n const g = arguments[0]\n this._argGeom = g\n } else if (arguments.length === 2) {\n const g = arguments[0], bufParams = arguments[1]\n this._argGeom = g\n this._bufParams = bufParams\n }\n }\n static bufferOp() {\n if (arguments.length === 2) {\n const g = arguments[0], distance = arguments[1]\n const gBuf = new BufferOp(g)\n const geomBuf = gBuf.getResultGeometry(distance)\n return geomBuf\n } else if (arguments.length === 3) {\n if (Number.isInteger(arguments[2]) && (arguments[0] instanceof Geometry && typeof arguments[1] === 'number')) {\n const g = arguments[0], distance = arguments[1], quadrantSegments = arguments[2]\n const bufOp = new BufferOp(g)\n bufOp.setQuadrantSegments(quadrantSegments)\n const geomBuf = bufOp.getResultGeometry(distance)\n return geomBuf\n } else if (arguments[2] instanceof BufferParameters && (arguments[0] instanceof Geometry && typeof arguments[1] === 'number')) {\n const g = arguments[0], distance = arguments[1], params = arguments[2]\n const bufOp = new BufferOp(g, params)\n const geomBuf = bufOp.getResultGeometry(distance)\n return geomBuf\n }\n } else if (arguments.length === 4) {\n const g = arguments[0], distance = arguments[1], quadrantSegments = arguments[2], endCapStyle = arguments[3]\n const bufOp = new BufferOp(g)\n bufOp.setQuadrantSegments(quadrantSegments)\n bufOp.setEndCapStyle(endCapStyle)\n const geomBuf = bufOp.getResultGeometry(distance)\n return geomBuf\n }\n }\n static precisionScaleFactor(g, distance, maxPrecisionDigits) {\n const env = g.getEnvelopeInternal()\n const envMax = MathUtil.max(Math.abs(env.getMaxX()), Math.abs(env.getMaxY()), Math.abs(env.getMinX()), Math.abs(env.getMinY()))\n const expandByDistance = distance > 0.0 ? distance : 0.0\n const bufEnvMax = envMax + 2 * expandByDistance\n const bufEnvPrecisionDigits = Math.trunc(Math.log(bufEnvMax) / Math.log(10) + 1.0)\n const minUnitLog10 = maxPrecisionDigits - bufEnvPrecisionDigits\n const scaleFactor = Math.pow(10.0, minUnitLog10)\n return scaleFactor\n }\n bufferFixedPrecision(fixedPM) {\n const noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)), fixedPM.getScale())\n const bufBuilder = new BufferBuilder(this._bufParams)\n bufBuilder.setWorkingPrecisionModel(fixedPM)\n bufBuilder.setNoder(noder)\n this._resultGeometry = bufBuilder.buffer(this._argGeom, this._distance)\n }\n bufferReducedPrecision() {\n if (arguments.length === 0) {\n for (let precDigits = BufferOp.MAX_PRECISION_DIGITS; precDigits >= 0; precDigits--) {\n try {\n this.bufferReducedPrecision(precDigits)\n } catch (ex) {\n if (ex instanceof TopologyException) \n this._saveException = ex\n else throw ex\n } finally {}\n if (this._resultGeometry !== null) return null\n }\n throw this._saveException\n } else if (arguments.length === 1) {\n const precisionDigits = arguments[0]\n const sizeBasedScaleFactor = BufferOp.precisionScaleFactor(this._argGeom, this._distance, precisionDigits)\n const fixedPM = new PrecisionModel(sizeBasedScaleFactor)\n this.bufferFixedPrecision(fixedPM)\n }\n }\n computeGeometry() {\n this.bufferOriginalPrecision()\n if (this._resultGeometry !== null) return null\n const argPM = this._argGeom.getFactory().getPrecisionModel()\n if (argPM.getType() === PrecisionModel.FIXED) this.bufferFixedPrecision(argPM); else this.bufferReducedPrecision()\n }\n setQuadrantSegments(quadrantSegments) {\n this._bufParams.setQuadrantSegments(quadrantSegments)\n }\n bufferOriginalPrecision() {\n try {\n const bufBuilder = new BufferBuilder(this._bufParams)\n this._resultGeometry = bufBuilder.buffer(this._argGeom, this._distance)\n } catch (ex) {\n if (ex instanceof RuntimeException) \n this._saveException = ex\n else throw ex\n } finally {}\n }\n getResultGeometry(distance) {\n this._distance = distance\n this.computeGeometry()\n return this._resultGeometry\n }\n setEndCapStyle(endCapStyle) {\n this._bufParams.setEndCapStyle(endCapStyle)\n }\n}\nBufferOp.CAP_ROUND = BufferParameters.CAP_ROUND\nBufferOp.CAP_BUTT = BufferParameters.CAP_FLAT\nBufferOp.CAP_FLAT = BufferParameters.CAP_FLAT\nBufferOp.CAP_SQUARE = BufferParameters.CAP_SQUARE\nBufferOp.MAX_PRECISION_DIGITS = 12\n","export default class BoundaryNodeRule {\n isInBoundary(boundaryCount) {}\n}\nclass Mod2BoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount % 2 === 1\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nclass EndPointBoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount > 0\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nclass MultiValentEndPointBoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount > 1\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nclass MonoValentEndPointBoundaryNodeRule {\n isInBoundary(boundaryCount) {\n return boundaryCount === 1\n }\n get interfaces_() {\n return [BoundaryNodeRule]\n }\n}\nBoundaryNodeRule.Mod2BoundaryNodeRule = Mod2BoundaryNodeRule\nBoundaryNodeRule.EndPointBoundaryNodeRule = EndPointBoundaryNodeRule\nBoundaryNodeRule.MultiValentEndPointBoundaryNodeRule = MultiValentEndPointBoundaryNodeRule\nBoundaryNodeRule.MonoValentEndPointBoundaryNodeRule = MonoValentEndPointBoundaryNodeRule\nBoundaryNodeRule.MOD2_BOUNDARY_RULE = new Mod2BoundaryNodeRule()\nBoundaryNodeRule.ENDPOINT_BOUNDARY_RULE = new EndPointBoundaryNodeRule()\nBoundaryNodeRule.MULTIVALENT_ENDPOINT_BOUNDARY_RULE = new MultiValentEndPointBoundaryNodeRule()\nBoundaryNodeRule.MONOVALENT_ENDPOINT_BOUNDARY_RULE = new MonoValentEndPointBoundaryNodeRule()\nBoundaryNodeRule.OGC_SFS_BOUNDARY_RULE = BoundaryNodeRule.MOD2_BOUNDARY_RULE\n","import Location from '../geom/Location.js'\nimport LineString from '../geom/LineString.js'\nimport IllegalArgumentException from '../../../../java/lang/IllegalArgumentException.js'\nimport Point from '../geom/Point.js'\nimport Polygon from '../geom/Polygon.js'\nimport PointLocation from './PointLocation.js'\nimport BoundaryNodeRule from './BoundaryNodeRule.js'\nimport MultiPolygon from '../geom/MultiPolygon.js'\nimport GeometryCollectionIterator from '../geom/GeometryCollectionIterator.js'\nimport GeometryCollection from '../geom/GeometryCollection.js'\nimport MultiLineString from '../geom/MultiLineString.js'\nexport default class PointLocator {\n constructor() {\n PointLocator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._boundaryRule = BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE\n this._isIn = null\n this._numBoundaries = null\n if (arguments.length === 0) {} else if (arguments.length === 1) {\n const boundaryRule = arguments[0]\n if (boundaryRule === null) throw new IllegalArgumentException('Rule must be non-null')\n this._boundaryRule = boundaryRule\n }\n }\n locateInPolygonRing(p, ring) {\n if (!ring.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n return PointLocation.locateInRing(p, ring.getCoordinates())\n }\n intersects(p, geom) {\n return this.locate(p, geom) !== Location.EXTERIOR\n }\n updateLocationInfo(loc) {\n if (loc === Location.INTERIOR) this._isIn = true\n if (loc === Location.BOUNDARY) this._numBoundaries++\n }\n computeLocation(p, geom) {\n if (geom instanceof Point) \n this.updateLocationInfo(this.locateOnPoint(p, geom))\n \n if (geom instanceof LineString) {\n this.updateLocationInfo(this.locateOnLineString(p, geom))\n } else if (geom instanceof Polygon) {\n this.updateLocationInfo(this.locateInPolygon(p, geom))\n } else if (geom instanceof MultiLineString) {\n const ml = geom\n for (let i = 0; i < ml.getNumGeometries(); i++) {\n const l = ml.getGeometryN(i)\n this.updateLocationInfo(this.locateOnLineString(p, l))\n }\n } else if (geom instanceof MultiPolygon) {\n const mpoly = geom\n for (let i = 0; i < mpoly.getNumGeometries(); i++) {\n const poly = mpoly.getGeometryN(i)\n this.updateLocationInfo(this.locateInPolygon(p, poly))\n }\n } else if (geom instanceof GeometryCollection) {\n const geomi = new GeometryCollectionIterator(geom)\n while (geomi.hasNext()) {\n const g2 = geomi.next()\n if (g2 !== geom) this.computeLocation(p, g2)\n }\n }\n }\n locateOnPoint(p, pt) {\n const ptCoord = pt.getCoordinate()\n if (ptCoord.equals2D(p)) return Location.INTERIOR\n return Location.EXTERIOR\n }\n locateOnLineString(p, l) {\n if (!l.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR\n const seq = l.getCoordinateSequence()\n if (!l.isClosed()) \n if (p.equals(seq.getCoordinate(0)) || p.equals(seq.getCoordinate(seq.size() - 1))) \n return Location.BOUNDARY\n \n \n if (PointLocation.isOnLine(p, seq)) \n return Location.INTERIOR\n \n return Location.EXTERIOR\n }\n locateInPolygon(p, poly) {\n if (poly.isEmpty()) return Location.EXTERIOR\n const shell = poly.getExteriorRing()\n const shellLoc = this.locateInPolygonRing(p, shell)\n if (shellLoc === Location.EXTERIOR) return Location.EXTERIOR\n if (shellLoc === Location.BOUNDARY) return Location.BOUNDARY\n for (let i = 0; i < poly.getNumInteriorRing(); i++) {\n const hole = poly.getInteriorRingN(i)\n const holeLoc = this.locateInPolygonRing(p, hole)\n if (holeLoc === Location.INTERIOR) return Location.EXTERIOR\n if (holeLoc === Location.BOUNDARY) return Location.BOUNDARY\n }\n return Location.INTERIOR\n }\n locate(p, geom) {\n if (geom.isEmpty()) return Location.EXTERIOR\n if (geom instanceof LineString) \n return this.locateOnLineString(p, geom)\n else if (geom instanceof Polygon) \n return this.locateInPolygon(p, geom)\n \n this._isIn = false\n this._numBoundaries = 0\n this.computeLocation(p, geom)\n if (this._boundaryRule.isInBoundary(this._numBoundaries)) return Location.BOUNDARY\n if (this._numBoundaries > 0 || this._isIn) return Location.INTERIOR\n return Location.EXTERIOR\n }\n}\n","import WKTWriter from '../io/WKTWriter.js'\nimport CoordinateArraySequence from '../geom/impl/CoordinateArraySequence.js'\nimport Octant from './Octant.js'\nimport SegmentString from './SegmentString.js'\nexport default class BasicSegmentString {\n constructor() {\n BasicSegmentString.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._pts = null\n this._data = null\n const pts = arguments[0], data = arguments[1]\n this._pts = pts\n this._data = data\n }\n getCoordinates() {\n return this._pts\n }\n size() {\n return this._pts.length\n }\n getCoordinate(i) {\n return this._pts[i]\n }\n isClosed() {\n return this._pts[0].equals(this._pts[this._pts.length - 1])\n }\n getSegmentOctant(index) {\n if (index === this._pts.length - 1) return -1\n return Octant.octant(this.getCoordinate(index), this.getCoordinate(index + 1))\n }\n setData(data) {\n this._data = data\n }\n getData() {\n return this._data\n }\n toString() {\n return WKTWriter.toLineString(new CoordinateArraySequence(this._pts))\n }\n get interfaces_() {\n return [SegmentString]\n }\n}\n","import SegmentIntersector from './SegmentIntersector.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class NodingIntersectionFinder {\n constructor() {\n NodingIntersectionFinder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._findAllIntersections = false\n this._isCheckEndSegmentsOnly = false\n this._keepIntersections = true\n this._isInteriorIntersectionsOnly = false\n this._li = null\n this._interiorIntersection = null\n this._intSegments = null\n this._intersections = new ArrayList()\n this._intersectionCount = 0\n const li = arguments[0]\n this._li = li\n this._interiorIntersection = null\n }\n static createAllIntersectionsFinder(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setFindAllIntersections(true)\n return finder\n }\n static isInteriorVertexIntersection() {\n if (arguments.length === 4) {\n const p0 = arguments[0], p1 = arguments[1], isEnd0 = arguments[2], isEnd1 = arguments[3]\n if (isEnd0 && isEnd1) return false\n if (p0.equals2D(p1)) \n return true\n \n return false\n } else if (arguments.length === 8) {\n const p00 = arguments[0], p01 = arguments[1], p10 = arguments[2], p11 = arguments[3], isEnd00 = arguments[4], isEnd01 = arguments[5], isEnd10 = arguments[6], isEnd11 = arguments[7]\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p00, p10, isEnd00, isEnd10)) return true\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p00, p11, isEnd00, isEnd11)) return true\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p01, p10, isEnd01, isEnd10)) return true\n if (NodingIntersectionFinder.isInteriorVertexIntersection(p01, p11, isEnd01, isEnd11)) return true\n return false\n }\n }\n static createInteriorIntersectionCounter(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setInteriorIntersectionsOnly(true)\n finder.setFindAllIntersections(true)\n finder.setKeepIntersections(false)\n return finder\n }\n static createIntersectionCounter(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setFindAllIntersections(true)\n finder.setKeepIntersections(false)\n return finder\n }\n static isEndSegment(segStr, index) {\n if (index === 0) return true\n if (index >= segStr.size() - 2) return true\n return false\n }\n static createAnyIntersectionFinder(li) {\n return new NodingIntersectionFinder(li)\n }\n static createInteriorIntersectionsFinder(li) {\n const finder = new NodingIntersectionFinder(li)\n finder.setFindAllIntersections(true)\n finder.setInteriorIntersectionsOnly(true)\n return finder\n }\n setCheckEndSegmentsOnly(isCheckEndSegmentsOnly) {\n this._isCheckEndSegmentsOnly = isCheckEndSegmentsOnly\n }\n getIntersectionSegments() {\n return this._intSegments\n }\n count() {\n return this._intersectionCount\n }\n getIntersections() {\n return this._intersections\n }\n setFindAllIntersections(findAllIntersections) {\n this._findAllIntersections = findAllIntersections\n }\n setKeepIntersections(keepIntersections) {\n this._keepIntersections = keepIntersections\n }\n getIntersection() {\n return this._interiorIntersection\n }\n processIntersections(e0, segIndex0, e1, segIndex1) {\n if (!this._findAllIntersections && this.hasIntersection()) return null\n const isSameSegString = e0 === e1\n const isSameSegment = isSameSegString && segIndex0 === segIndex1\n if (isSameSegment) return null\n if (this._isCheckEndSegmentsOnly) {\n const isEndSegPresent = NodingIntersectionFinder.isEndSegment(e0, segIndex0) || NodingIntersectionFinder.isEndSegment(e1, segIndex1)\n if (!isEndSegPresent) return null\n }\n const p00 = e0.getCoordinate(segIndex0)\n const p01 = e0.getCoordinate(segIndex0 + 1)\n const p10 = e1.getCoordinate(segIndex1)\n const p11 = e1.getCoordinate(segIndex1 + 1)\n const isEnd00 = segIndex0 === 0\n const isEnd01 = segIndex0 + 2 === e0.size()\n const isEnd10 = segIndex1 === 0\n const isEnd11 = segIndex1 + 2 === e1.size()\n this._li.computeIntersection(p00, p01, p10, p11)\n const isInteriorInt = this._li.hasIntersection() && this._li.isInteriorIntersection()\n let isInteriorVertexInt = false\n if (!this._isInteriorIntersectionsOnly) {\n const isAdjacentSegment = isSameSegString && Math.abs(segIndex1 - segIndex0) <= 1\n isInteriorVertexInt = !isAdjacentSegment && NodingIntersectionFinder.isInteriorVertexIntersection(p00, p01, p10, p11, isEnd00, isEnd01, isEnd10, isEnd11)\n }\n if (isInteriorInt || isInteriorVertexInt) {\n this._intSegments = new Array(4).fill(null)\n this._intSegments[0] = p00\n this._intSegments[1] = p01\n this._intSegments[2] = p10\n this._intSegments[3] = p11\n this._interiorIntersection = this._li.getIntersection(0)\n if (this._keepIntersections) this._intersections.add(this._interiorIntersection)\n this._intersectionCount++\n }\n }\n hasIntersection() {\n return this._interiorIntersection !== null\n }\n isDone() {\n if (this._findAllIntersections) return false\n return this._interiorIntersection !== null\n }\n setInteriorIntersectionsOnly(isInteriorIntersectionsOnly) {\n this._isInteriorIntersectionsOnly = isInteriorIntersectionsOnly\n }\n get interfaces_() {\n return [SegmentIntersector]\n }\n}\n","import WKTWriter from '../io/WKTWriter.js'\nimport MCIndexNoder from './MCIndexNoder.js'\nimport TopologyException from '../geom/TopologyException.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nimport NodingIntersectionFinder from './NodingIntersectionFinder.js'\nexport default class FastNodingValidator {\n constructor() {\n FastNodingValidator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._segStrings = null\n this._findAllIntersections = false\n this._segInt = null\n this._isValid = true\n const segStrings = arguments[0]\n this._segStrings = segStrings\n }\n static computeIntersections(segStrings) {\n const nv = new FastNodingValidator(segStrings)\n nv.setFindAllIntersections(true)\n nv.isValid()\n return nv.getIntersections()\n }\n execute() {\n if (this._segInt !== null) return null\n this.checkInteriorIntersections()\n }\n getIntersections() {\n return this._segInt.getIntersections()\n }\n isValid() {\n this.execute()\n return this._isValid\n }\n setFindAllIntersections(findAllIntersections) {\n this._findAllIntersections = findAllIntersections\n }\n checkInteriorIntersections() {\n this._isValid = true\n this._segInt = new NodingIntersectionFinder(this._li)\n this._segInt.setFindAllIntersections(this._findAllIntersections)\n const noder = new MCIndexNoder()\n noder.setSegmentIntersector(this._segInt)\n noder.computeNodes(this._segStrings)\n if (this._segInt.hasIntersection()) {\n this._isValid = false\n return null\n }\n }\n checkValid() {\n this.execute()\n if (!this._isValid) throw new TopologyException(this.getErrorMessage(), this._segInt.getIntersection())\n }\n getErrorMessage() {\n if (this._isValid) return 'no intersections found'\n const intSegs = this._segInt.getIntersectionSegments()\n return 'found non-noded intersection between ' + WKTWriter.toLineString(intSegs[0], intSegs[1]) + ' and ' + WKTWriter.toLineString(intSegs[2], intSegs[3])\n }\n}\n","import BasicSegmentString from '../noding/BasicSegmentString.js'\nimport FastNodingValidator from '../noding/FastNodingValidator.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class EdgeNodingValidator {\n constructor() {\n EdgeNodingValidator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._nv = null\n const edges = arguments[0]\n this._nv = new FastNodingValidator(EdgeNodingValidator.toSegmentStrings(edges))\n }\n static toSegmentStrings(edges) {\n const segStrings = new ArrayList()\n for (let i = edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n segStrings.add(new BasicSegmentString(e.getCoordinates(), e))\n }\n return segStrings\n }\n static checkValid(edges) {\n const validator = new EdgeNodingValidator(edges)\n validator.checkValid()\n }\n checkValid() {\n this._nv.checkValid()\n }\n}\n","import GeometryFactory from '../GeometryFactory.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class GeometryCollectionMapper {\n constructor() {\n GeometryCollectionMapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._mapOp = null\n const mapOp = arguments[0]\n this._mapOp = mapOp\n }\n static map(gc, op) {\n const mapper = new GeometryCollectionMapper(op)\n return mapper.map(gc)\n }\n map(gc) {\n const mapped = new ArrayList()\n for (let i = 0; i < gc.getNumGeometries(); i++) {\n const g = this._mapOp.map(gc.getGeometryN(i))\n if (!g.isEmpty()) mapped.add(g)\n }\n return gc.getFactory().createGeometryCollection(GeometryFactory.toGeometryArray(mapped))\n }\n}\n","import ArrayList from '../../../../../java/util/ArrayList.js'\nimport Assert from '../../util/Assert.js'\nimport OverlayOp from './OverlayOp.js'\nexport default class LineBuilder {\n constructor() {\n LineBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._op = null\n this._geometryFactory = null\n this._ptLocator = null\n this._lineEdgesList = new ArrayList()\n this._resultLineList = new ArrayList()\n const op = arguments[0], geometryFactory = arguments[1], ptLocator = arguments[2]\n this._op = op\n this._geometryFactory = geometryFactory\n this._ptLocator = ptLocator\n }\n collectLines(opCode) {\n for (let it = this._op.getGraph().getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n this.collectLineEdge(de, opCode, this._lineEdgesList)\n this.collectBoundaryTouchEdge(de, opCode, this._lineEdgesList)\n }\n }\n labelIsolatedLine(e, targetIndex) {\n const loc = this._ptLocator.locate(e.getCoordinate(), this._op.getArgGeometry(targetIndex))\n e.getLabel().setLocation(targetIndex, loc)\n }\n build(opCode) {\n this.findCoveredLineEdges()\n this.collectLines(opCode)\n this.buildLines(opCode)\n return this._resultLineList\n }\n collectLineEdge(de, opCode, edges) {\n const label = de.getLabel()\n const e = de.getEdge()\n if (de.isLineEdge()) \n if (!de.isVisited() && OverlayOp.isResultOfOp(label, opCode) && !e.isCovered()) {\n edges.add(e)\n de.setVisitedEdge(true)\n }\n \n }\n findCoveredLineEdges() {\n for (let nodeit = this._op.getGraph().getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().findCoveredLineEdges()\n }\n for (let it = this._op.getGraph().getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n const e = de.getEdge()\n if (de.isLineEdge() && !e.isCoveredSet()) {\n const isCovered = this._op.isCoveredByA(de.getCoordinate())\n e.setCovered(isCovered)\n }\n }\n }\n labelIsolatedLines(edgesList) {\n for (let it = edgesList.iterator(); it.hasNext(); ) {\n const e = it.next()\n const label = e.getLabel()\n if (e.isIsolated()) \n if (label.isNull(0)) this.labelIsolatedLine(e, 0); else this.labelIsolatedLine(e, 1)\n \n }\n }\n buildLines(opCode) {\n for (let it = this._lineEdgesList.iterator(); it.hasNext(); ) {\n const e = it.next()\n const line = this._geometryFactory.createLineString(e.getCoordinates())\n this._resultLineList.add(line)\n e.setInResult(true)\n }\n }\n collectBoundaryTouchEdge(de, opCode, edges) {\n const label = de.getLabel()\n if (de.isLineEdge()) return null\n if (de.isVisited()) return null\n if (de.isInteriorAreaEdge()) return null\n if (de.getEdge().isInResult()) return null\n Assert.isTrue(!(de.isInResult() || de.getSym().isInResult()) || !de.getEdge().isInResult())\n if (OverlayOp.isResultOfOp(label, opCode) && opCode === OverlayOp.INTERSECTION) {\n edges.add(de.getEdge())\n de.setVisitedEdge(true)\n }\n }\n}\n","import ArrayList from '../../../../../java/util/ArrayList.js'\nimport OverlayOp from './OverlayOp.js'\nexport default class PointBuilder {\n constructor() {\n PointBuilder.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._op = null\n this._geometryFactory = null\n this._resultPointList = new ArrayList()\n const op = arguments[0], geometryFactory = arguments[1], ptLocator = arguments[2]\n this._op = op\n this._geometryFactory = geometryFactory\n }\n filterCoveredNodeToPoint(n) {\n const coord = n.getCoordinate()\n if (!this._op.isCoveredByLA(coord)) {\n const pt = this._geometryFactory.createPoint(coord)\n this._resultPointList.add(pt)\n }\n }\n extractNonCoveredResultNodes(opCode) {\n for (let nodeit = this._op.getGraph().getNodes().iterator(); nodeit.hasNext(); ) {\n const n = nodeit.next()\n if (n.isInResult()) continue\n if (n.isIncidentEdgeInResult()) continue\n if (n.getEdges().getDegree() === 0 || opCode === OverlayOp.INTERSECTION) {\n const label = n.getLabel()\n if (OverlayOp.isResultOfOp(label, opCode)) \n this.filterCoveredNodeToPoint(n)\n \n }\n }\n }\n build(opCode) {\n this.extractNonCoveredResultNodes(opCode)\n return this._resultPointList\n }\n}\n","import LineString from '../LineString.js'\nimport GeometryFactory from '../GeometryFactory.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport Point from '../Point.js'\nimport Polygon from '../Polygon.js'\nimport MultiPoint from '../MultiPoint.js'\nimport LinearRing from '../LinearRing.js'\nimport MultiPolygon from '../MultiPolygon.js'\nimport GeometryCollection from '../GeometryCollection.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport MultiLineString from '../MultiLineString.js'\nexport default class GeometryTransformer {\n constructor() {\n GeometryTransformer.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._inputGeom = null\n this._factory = null\n this._pruneEmptyGeometry = true\n this._preserveGeometryCollectionType = true\n this._preserveCollections = false\n this._preserveType = false\n }\n transformPoint(geom, parent) {\n return this._factory.createPoint(this.transformCoordinates(geom.getCoordinateSequence(), geom))\n }\n transformPolygon(geom, parent) {\n let isAllValidLinearRings = true\n const shell = this.transformLinearRing(geom.getExteriorRing(), geom)\n if (shell === null || !(shell instanceof LinearRing) || shell.isEmpty()) isAllValidLinearRings = false\n const holes = new ArrayList()\n for (let i = 0; i < geom.getNumInteriorRing(); i++) {\n const hole = this.transformLinearRing(geom.getInteriorRingN(i), geom)\n if (hole === null || hole.isEmpty()) \n continue\n \n if (!(hole instanceof LinearRing)) isAllValidLinearRings = false\n holes.add(hole)\n }\n if (isAllValidLinearRings) {\n return this._factory.createPolygon(shell, holes.toArray([]))\n } else {\n const components = new ArrayList()\n if (shell !== null) components.add(shell)\n components.addAll(holes)\n return this._factory.buildGeometry(components)\n }\n }\n createCoordinateSequence(coords) {\n return this._factory.getCoordinateSequenceFactory().create(coords)\n }\n getInputGeometry() {\n return this._inputGeom\n }\n transformMultiLineString(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transformLineString(geom.getGeometryN(i), geom)\n if (transformGeom === null) continue\n if (transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n return this._factory.buildGeometry(transGeomList)\n }\n transformCoordinates(coords, parent) {\n return this.copy(coords)\n }\n transformLineString(geom, parent) {\n return this._factory.createLineString(this.transformCoordinates(geom.getCoordinateSequence(), geom))\n }\n transformMultiPoint(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transformPoint(geom.getGeometryN(i), geom)\n if (transformGeom === null) continue\n if (transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n return this._factory.buildGeometry(transGeomList)\n }\n transformMultiPolygon(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transformPolygon(geom.getGeometryN(i), geom)\n if (transformGeom === null) continue\n if (transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n return this._factory.buildGeometry(transGeomList)\n }\n copy(seq) {\n return seq.copy()\n }\n transformGeometryCollection(geom, parent) {\n const transGeomList = new ArrayList()\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const transformGeom = this.transform(geom.getGeometryN(i))\n if (transformGeom === null) continue\n if (this._pruneEmptyGeometry && transformGeom.isEmpty()) continue\n transGeomList.add(transformGeom)\n }\n if (this._preserveGeometryCollectionType) return this._factory.createGeometryCollection(GeometryFactory.toGeometryArray(transGeomList))\n return this._factory.buildGeometry(transGeomList)\n }\n transform(inputGeom) {\n this._inputGeom = inputGeom\n this._factory = inputGeom.getFactory()\n if (inputGeom instanceof Point) return this.transformPoint(inputGeom, null)\n if (inputGeom instanceof MultiPoint) return this.transformMultiPoint(inputGeom, null)\n if (inputGeom instanceof LinearRing) return this.transformLinearRing(inputGeom, null)\n if (inputGeom instanceof LineString) return this.transformLineString(inputGeom, null)\n if (inputGeom instanceof MultiLineString) return this.transformMultiLineString(inputGeom, null)\n if (inputGeom instanceof Polygon) return this.transformPolygon(inputGeom, null)\n if (inputGeom instanceof MultiPolygon) return this.transformMultiPolygon(inputGeom, null)\n if (inputGeom instanceof GeometryCollection) return this.transformGeometryCollection(inputGeom, null)\n throw new IllegalArgumentException('Unknown Geometry subtype: ' + inputGeom.getGeometryType())\n }\n transformLinearRing(geom, parent) {\n const seq = this.transformCoordinates(geom.getCoordinateSequence(), geom)\n if (seq === null) return this._factory.createLinearRing(null)\n const seqSize = seq.size()\n if (seqSize > 0 && seqSize < 4 && !this._preserveType) return this._factory.createLineString(seq)\n return this._factory.createLinearRing(seq)\n }\n}\n","import LineString from '../../../geom/LineString.js'\nimport CoordinateList from '../../../geom/CoordinateList.js'\nimport Coordinate from '../../../geom/Coordinate.js'\nimport Double from '../../../../../../java/lang/Double.js'\nimport LineSegment from '../../../geom/LineSegment.js'\nexport default class LineStringSnapper {\n constructor() {\n LineStringSnapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._snapTolerance = 0.0\n this._srcPts = null\n this._seg = new LineSegment()\n this._allowSnappingToSourceVertices = false\n this._isClosed = false\n if (arguments[0] instanceof LineString && typeof arguments[1] === 'number') {\n const srcLine = arguments[0], snapTolerance = arguments[1]\n LineStringSnapper.constructor_.call(this, srcLine.getCoordinates(), snapTolerance)\n } else if (arguments[0] instanceof Array && typeof arguments[1] === 'number') {\n const srcPts = arguments[0], snapTolerance = arguments[1]\n this._srcPts = srcPts\n this._isClosed = LineStringSnapper.isClosed(srcPts)\n this._snapTolerance = snapTolerance\n }\n }\n static isClosed(pts) {\n if (pts.length <= 1) return false\n return pts[0].equals2D(pts[pts.length - 1])\n }\n snapVertices(srcCoords, snapPts) {\n const end = this._isClosed ? srcCoords.size() - 1 : srcCoords.size()\n for (let i = 0; i < end; i++) {\n const srcPt = srcCoords.get(i)\n const snapVert = this.findSnapForVertex(srcPt, snapPts)\n if (snapVert !== null) {\n srcCoords.set(i, new Coordinate(snapVert))\n if (i === 0 && this._isClosed) srcCoords.set(srcCoords.size() - 1, new Coordinate(snapVert))\n }\n }\n }\n findSnapForVertex(pt, snapPts) {\n for (let i = 0; i < snapPts.length; i++) {\n if (pt.equals2D(snapPts[i])) return null\n if (pt.distance(snapPts[i]) < this._snapTolerance) return snapPts[i]\n }\n return null\n }\n snapTo(snapPts) {\n const coordList = new CoordinateList(this._srcPts)\n this.snapVertices(coordList, snapPts)\n this.snapSegments(coordList, snapPts)\n const newPts = coordList.toCoordinateArray()\n return newPts\n }\n snapSegments(srcCoords, snapPts) {\n if (snapPts.length === 0) return null\n let distinctPtCount = snapPts.length\n if (snapPts[0].equals2D(snapPts[snapPts.length - 1])) distinctPtCount = snapPts.length - 1\n for (let i = 0; i < distinctPtCount; i++) {\n const snapPt = snapPts[i]\n const index = this.findSegmentIndexToSnap(snapPt, srcCoords)\n if (index >= 0) \n srcCoords.add(index + 1, new Coordinate(snapPt), false)\n \n }\n }\n findSegmentIndexToSnap(snapPt, srcCoords) {\n let minDist = Double.MAX_VALUE\n let snapIndex = -1\n for (let i = 0; i < srcCoords.size() - 1; i++) {\n this._seg.p0 = srcCoords.get(i)\n this._seg.p1 = srcCoords.get(i + 1)\n if (this._seg.p0.equals2D(snapPt) || this._seg.p1.equals2D(snapPt)) \n if (this._allowSnappingToSourceVertices) continue; else return -1\n \n const dist = this._seg.distance(snapPt)\n if (dist < this._snapTolerance && dist < minDist) {\n minDist = dist\n snapIndex = i\n }\n }\n return snapIndex\n }\n setAllowSnappingToSourceVertices(allowSnappingToSourceVertices) {\n this._allowSnappingToSourceVertices = allowSnappingToSourceVertices\n }\n}\n","import TreeSet from '../../../../../../java/util/TreeSet.js'\nimport GeometryTransformer from '../../../geom/util/GeometryTransformer.js'\nimport hasInterface from '../../../../../../hasInterface.js'\nimport Double from '../../../../../../java/lang/Double.js'\nimport LineStringSnapper from './LineStringSnapper.js'\nimport PrecisionModel from '../../../geom/PrecisionModel.js'\nimport Polygonal from '../../../geom/Polygonal.js'\nexport default class GeometrySnapper {\n constructor() {\n GeometrySnapper.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._srcGeom = null\n const srcGeom = arguments[0]\n this._srcGeom = srcGeom\n }\n static snap(g0, g1, snapTolerance) {\n const snapGeom = new Array(2).fill(null)\n const snapper0 = new GeometrySnapper(g0)\n snapGeom[0] = snapper0.snapTo(g1, snapTolerance)\n const snapper1 = new GeometrySnapper(g1)\n snapGeom[1] = snapper1.snapTo(snapGeom[0], snapTolerance)\n return snapGeom\n }\n static computeOverlaySnapTolerance() {\n if (arguments.length === 1) {\n const g = arguments[0]\n let snapTolerance = GeometrySnapper.computeSizeBasedSnapTolerance(g)\n const pm = g.getPrecisionModel()\n if (pm.getType() === PrecisionModel.FIXED) {\n const fixedSnapTol = 1 / pm.getScale() * 2 / 1.415\n if (fixedSnapTol > snapTolerance) snapTolerance = fixedSnapTol\n }\n return snapTolerance\n } else if (arguments.length === 2) {\n const g0 = arguments[0], g1 = arguments[1]\n return Math.min(GeometrySnapper.computeOverlaySnapTolerance(g0), GeometrySnapper.computeOverlaySnapTolerance(g1))\n }\n }\n static computeSizeBasedSnapTolerance(g) {\n const env = g.getEnvelopeInternal()\n const minDimension = Math.min(env.getHeight(), env.getWidth())\n const snapTol = minDimension * GeometrySnapper.SNAP_PRECISION_FACTOR\n return snapTol\n }\n static snapToSelf(geom, snapTolerance, cleanResult) {\n const snapper0 = new GeometrySnapper(geom)\n return snapper0.snapToSelf(snapTolerance, cleanResult)\n }\n snapTo(snapGeom, snapTolerance) {\n const snapPts = this.extractTargetCoordinates(snapGeom)\n const snapTrans = new SnapTransformer(snapTolerance, snapPts)\n return snapTrans.transform(this._srcGeom)\n }\n snapToSelf(snapTolerance, cleanResult) {\n const snapPts = this.extractTargetCoordinates(this._srcGeom)\n const snapTrans = new SnapTransformer(snapTolerance, snapPts, true)\n const snappedGeom = snapTrans.transform(this._srcGeom)\n let result = snappedGeom\n if (cleanResult && hasInterface(result, Polygonal)) \n result = snappedGeom.buffer(0)\n \n return result\n }\n computeSnapTolerance(ringPts) {\n const minSegLen = this.computeMinimumSegmentLength(ringPts)\n const snapTol = minSegLen / 10\n return snapTol\n }\n extractTargetCoordinates(g) {\n const ptSet = new TreeSet()\n const pts = g.getCoordinates()\n for (let i = 0; i < pts.length; i++) \n ptSet.add(pts[i])\n \n return ptSet.toArray(new Array(0).fill(null))\n }\n computeMinimumSegmentLength(pts) {\n let minSegLen = Double.MAX_VALUE\n for (let i = 0; i < pts.length - 1; i++) {\n const segLen = pts[i].distance(pts[i + 1])\n if (segLen < minSegLen) minSegLen = segLen\n }\n return minSegLen\n }\n}\nGeometrySnapper.SNAP_PRECISION_FACTOR = 1e-9\nclass SnapTransformer extends GeometryTransformer {\n constructor() {\n super()\n SnapTransformer.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._snapTolerance = null\n this._snapPts = null\n this._isSelfSnap = false\n if (arguments.length === 2) {\n const snapTolerance = arguments[0], snapPts = arguments[1]\n this._snapTolerance = snapTolerance\n this._snapPts = snapPts\n } else if (arguments.length === 3) {\n const snapTolerance = arguments[0], snapPts = arguments[1], isSelfSnap = arguments[2]\n this._snapTolerance = snapTolerance\n this._snapPts = snapPts\n this._isSelfSnap = isSelfSnap\n }\n }\n snapLine(srcPts, snapPts) {\n const snapper = new LineStringSnapper(srcPts, this._snapTolerance)\n snapper.setAllowSnappingToSourceVertices(this._isSelfSnap)\n return snapper.snapTo(snapPts)\n }\n transformCoordinates(coords, parent) {\n const srcPts = coords.toCoordinateArray()\n const newPts = this.snapLine(srcPts, this._snapPts)\n return this._factory.getCoordinateSequenceFactory().create(newPts)\n }\n}\n","import Double from '../../../../java/lang/Double.js'\nimport Long from '../../../../java/lang/Long.js'\nexport default class CommonBits {\n constructor() {\n this._isFirst = true\n this._commonMantissaBitsCount = 53\n this._commonBits = new Long()\n this._commonSignExp = null\n }\n\n getCommon() {\n return Double.longBitsToDouble(this._commonBits)\n }\n\n add(num) {\n const numBits = Double.doubleToLongBits(num)\n if (this._isFirst) {\n this._commonBits = numBits\n this._commonSignExp = CommonBits.signExpBits(this._commonBits)\n this._isFirst = false\n return null\n }\n const numSignExp = CommonBits.signExpBits(numBits)\n if (numSignExp !== this._commonSignExp) {\n this._commonBits.high = 0 | 0\n this._commonBits.low = 0 | 0\n return null\n }\n this._commonMantissaBitsCount = CommonBits.numCommonMostSigMantissaBits(this._commonBits, numBits)\n this._commonBits = CommonBits.zeroLowerBits(this._commonBits, 64 - (12 + this._commonMantissaBitsCount))\n }\n\n toString() {\n if (arguments.length === 1) {\n const bits = arguments[0]\n const x = Double.longBitsToDouble(bits)\n const numStr = Long.toBinaryString(bits)\n const padStr = '0000000000000000000000000000000000000000000000000000000000000000' + numStr\n const bitStr = padStr.substring(padStr.length - 64)\n const str = bitStr.substring(0, 1) + ' ' + bitStr.substring(1, 12) + '(exp) ' + bitStr.substring(12) + ' [ ' + x + ' ]'\n return str\n }\n }\n\n getClass() {\n return CommonBits\n }\n\n get interfaces_() {\n return []\n }\n\n static getBit(bits, i) {\n const mask = (1 << (i % 32))\n if (i < 32) return (bits.low & mask) !== 0 ? 1 : 0\n\n return (bits.high & mask) !== 0 ? 1 : 0\n }\n\n static signExpBits(num) {\n return num.high >>> 20\n }\n\n static zeroLowerBits(bits, nBits) {\n let prop = 'low'\n if (nBits > 32) {\n bits.low = 0 | 0\n nBits %= 32\n prop = 'high'\n }\n if (nBits > 0) {\n const mask = (nBits < 32) ? (~((1 << nBits) - 1)) : 0\n bits[prop] &= mask\n }\n return bits\n }\n\n static numCommonMostSigMantissaBits(num1, num2) {\n let count = 0\n for (let i = 52; i >= 0; i--) {\n if (CommonBits.getBit(num1, i) !== CommonBits.getBit(num2, i)) return count\n count++\n }\n return 52\n }\n}\n","import CommonBits from './CommonBits.js'\nimport CoordinateFilter from '../geom/CoordinateFilter.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport CoordinateSequenceFilter from '../geom/CoordinateSequenceFilter.js'\nexport default class CommonBitsRemover {\n constructor() {\n CommonBitsRemover.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._commonCoord = null\n this._ccFilter = new CommonCoordinateFilter()\n }\n addCommonBits(geom) {\n const trans = new Translater(this._commonCoord)\n geom.apply(trans)\n geom.geometryChanged()\n }\n removeCommonBits(geom) {\n if (this._commonCoord.x === 0.0 && this._commonCoord.y === 0.0) return geom\n const invCoord = new Coordinate(this._commonCoord)\n invCoord.x = -invCoord.x\n invCoord.y = -invCoord.y\n const trans = new Translater(invCoord)\n geom.apply(trans)\n geom.geometryChanged()\n return geom\n }\n getCommonCoordinate() {\n return this._commonCoord\n }\n add(geom) {\n geom.apply(this._ccFilter)\n this._commonCoord = this._ccFilter.getCommonCoordinate()\n }\n}\nclass CommonCoordinateFilter {\n constructor() {\n CommonCoordinateFilter.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._commonBitsX = new CommonBits()\n this._commonBitsY = new CommonBits()\n }\n filter(coord) {\n this._commonBitsX.add(coord.x)\n this._commonBitsY.add(coord.y)\n }\n getCommonCoordinate() {\n return new Coordinate(this._commonBitsX.getCommon(), this._commonBitsY.getCommon())\n }\n get interfaces_() {\n return [CoordinateFilter]\n }\n}\nclass Translater {\n constructor() {\n Translater.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.trans = null\n const trans = arguments[0]\n this.trans = trans\n }\n filter(seq, i) {\n const xp = seq.getOrdinate(i, 0) + this.trans.x\n const yp = seq.getOrdinate(i, 1) + this.trans.y\n seq.setOrdinate(i, 0, xp)\n seq.setOrdinate(i, 1, yp)\n }\n isDone() {\n return false\n }\n isGeometryChanged() {\n return true\n }\n get interfaces_() {\n return [CoordinateSequenceFilter]\n }\n}\nCommonBitsRemover.CommonCoordinateFilter = CommonCoordinateFilter\nCommonBitsRemover.Translater = Translater\n","import GeometrySnapper from './GeometrySnapper.js'\nimport System from '../../../../../../java/lang/System.js'\nimport CommonBitsRemover from '../../../precision/CommonBitsRemover.js'\nimport OverlayOp from '../OverlayOp.js'\nexport default class SnapOverlayOp {\n constructor() {\n SnapOverlayOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = new Array(2).fill(null)\n this._snapTolerance = null\n this._cbr = null\n const g1 = arguments[0], g2 = arguments[1]\n this._geom[0] = g1\n this._geom[1] = g2\n this.computeSnapTolerance()\n }\n static overlayOp(g0, g1, opCode) {\n const op = new SnapOverlayOp(g0, g1)\n return op.getResultGeometry(opCode)\n }\n static union(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.UNION)\n }\n static intersection(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.INTERSECTION)\n }\n static symDifference(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.SYMDIFFERENCE)\n }\n static difference(g0, g1) {\n return SnapOverlayOp.overlayOp(g0, g1, OverlayOp.DIFFERENCE)\n }\n selfSnap(geom) {\n const snapper0 = new GeometrySnapper(geom)\n const snapGeom = snapper0.snapTo(geom, this._snapTolerance)\n return snapGeom\n }\n removeCommonBits(geom) {\n this._cbr = new CommonBitsRemover()\n this._cbr.add(geom[0])\n this._cbr.add(geom[1])\n const remGeom = new Array(2).fill(null)\n remGeom[0] = this._cbr.removeCommonBits(geom[0].copy())\n remGeom[1] = this._cbr.removeCommonBits(geom[1].copy())\n return remGeom\n }\n prepareResult(geom) {\n this._cbr.addCommonBits(geom)\n return geom\n }\n getResultGeometry(opCode) {\n const prepGeom = this.snap(this._geom)\n const result = OverlayOp.overlayOp(prepGeom[0], prepGeom[1], opCode)\n return this.prepareResult(result)\n }\n checkValid(g) {\n if (!g.isValid()) \n System.out.println('Snapped geometry is invalid')\n \n }\n computeSnapTolerance() {\n this._snapTolerance = GeometrySnapper.computeOverlaySnapTolerance(this._geom[0], this._geom[1])\n }\n snap(geom) {\n const remGeom = this.removeCommonBits(geom)\n const snapGeom = GeometrySnapper.snap(remGeom[0], remGeom[1], this._snapTolerance)\n return snapGeom\n }\n}\n","import SnapOverlayOp from './SnapOverlayOp.js'\nimport RuntimeException from '../../../../../../java/lang/RuntimeException.js'\nimport OverlayOp from '../OverlayOp.js'\nexport default class SnapIfNeededOverlayOp {\n constructor() {\n SnapIfNeededOverlayOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = new Array(2).fill(null)\n const g1 = arguments[0], g2 = arguments[1]\n this._geom[0] = g1\n this._geom[1] = g2\n }\n static overlayOp(g0, g1, opCode) {\n const op = new SnapIfNeededOverlayOp(g0, g1)\n return op.getResultGeometry(opCode)\n }\n static union(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.UNION)\n }\n static intersection(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.INTERSECTION)\n }\n static symDifference(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.SYMDIFFERENCE)\n }\n static difference(g0, g1) {\n return SnapIfNeededOverlayOp.overlayOp(g0, g1, OverlayOp.DIFFERENCE)\n }\n getResultGeometry(opCode) {\n let result = null\n let isSuccess = false\n let savedException = null\n try {\n result = OverlayOp.overlayOp(this._geom[0], this._geom[1], opCode)\n const isValid = true\n if (isValid) isSuccess = true\n } catch (ex) {\n if (ex instanceof RuntimeException) \n savedException = ex\n else throw ex\n } finally {}\n if (!isSuccess) \n try {\n result = SnapOverlayOp.overlayOp(this._geom[0], this._geom[1], opCode)\n } catch (ex) {\n if (ex instanceof RuntimeException) \n throw savedException\n else throw ex\n } finally {}\n \n return result\n }\n}\n","export default class MonotoneChain {\n constructor() {\n MonotoneChain.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.mce = null\n this.chainIndex = null\n const mce = arguments[0], chainIndex = arguments[1]\n this.mce = mce\n this.chainIndex = chainIndex\n }\n computeIntersections(mc, si) {\n this.mce.computeIntersectsForChain(this.chainIndex, mc.mce, mc.chainIndex, si)\n }\n}\n","import Comparable from '../../../../../java/lang/Comparable.js'\nexport default class SweepLineEvent {\n constructor() {\n SweepLineEvent.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._label = null\n this._xValue = null\n this._eventType = null\n this._insertEvent = null\n this._deleteEventIndex = null\n this._obj = null\n if (arguments.length === 2) {\n const x = arguments[0], insertEvent = arguments[1]\n this._eventType = SweepLineEvent.DELETE\n this._xValue = x\n this._insertEvent = insertEvent\n } else if (arguments.length === 3) {\n const label = arguments[0], x = arguments[1], obj = arguments[2]\n this._eventType = SweepLineEvent.INSERT\n this._label = label\n this._xValue = x\n this._obj = obj\n }\n }\n isDelete() {\n return this._eventType === SweepLineEvent.DELETE\n }\n setDeleteEventIndex(deleteEventIndex) {\n this._deleteEventIndex = deleteEventIndex\n }\n getObject() {\n return this._obj\n }\n compareTo(o) {\n const pe = o\n if (this._xValue < pe._xValue) return -1\n if (this._xValue > pe._xValue) return 1\n if (this._eventType < pe._eventType) return -1\n if (this._eventType > pe._eventType) return 1\n return 0\n }\n getInsertEvent() {\n return this._insertEvent\n }\n isInsert() {\n return this._eventType === SweepLineEvent.INSERT\n }\n isSameLabel(ev) {\n if (this._label === null) return false\n return this._label === ev._label\n }\n getDeleteEventIndex() {\n return this._deleteEventIndex\n }\n get interfaces_() {\n return [Comparable]\n }\n}\nSweepLineEvent.INSERT = 1\nSweepLineEvent.DELETE = 2\n","export default class SegmentIntersector {\n constructor() {\n SegmentIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._hasIntersection = false\n this._hasProper = false\n this._hasProperInterior = false\n this._properIntersectionPoint = null\n this._li = null\n this._includeProper = null\n this._recordIsolated = null\n this._isSelfIntersection = null\n this._numIntersections = 0\n this.numTests = 0\n this._bdyNodes = null\n this._isDone = false\n this._isDoneWhenProperInt = false\n const li = arguments[0], includeProper = arguments[1], recordIsolated = arguments[2]\n this._li = li\n this._includeProper = includeProper\n this._recordIsolated = recordIsolated\n }\n static isAdjacentSegments(i1, i2) {\n return Math.abs(i1 - i2) === 1\n }\n isTrivialIntersection(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1) \n if (this._li.getIntersectionNum() === 1) {\n if (SegmentIntersector.isAdjacentSegments(segIndex0, segIndex1)) return true\n if (e0.isClosed()) {\n const maxSegIndex = e0.getNumPoints() - 1\n if (segIndex0 === 0 && segIndex1 === maxSegIndex || segIndex1 === 0 && segIndex0 === maxSegIndex) \n return true\n \n }\n }\n \n return false\n }\n getProperIntersectionPoint() {\n return this._properIntersectionPoint\n }\n setIsDoneIfProperInt(isDoneWhenProperInt) {\n this._isDoneWhenProperInt = isDoneWhenProperInt\n }\n hasProperInteriorIntersection() {\n return this._hasProperInterior\n }\n isBoundaryPointInternal(li, bdyNodes) {\n for (let i = bdyNodes.iterator(); i.hasNext(); ) {\n const node = i.next()\n const pt = node.getCoordinate()\n if (li.isIntersection(pt)) return true\n }\n return false\n }\n hasProperIntersection() {\n return this._hasProper\n }\n hasIntersection() {\n return this._hasIntersection\n }\n isDone() {\n return this._isDone\n }\n isBoundaryPoint(li, bdyNodes) {\n if (bdyNodes === null) return false\n if (this.isBoundaryPointInternal(li, bdyNodes[0])) return true\n if (this.isBoundaryPointInternal(li, bdyNodes[1])) return true\n return false\n }\n setBoundaryNodes(bdyNodes0, bdyNodes1) {\n this._bdyNodes = new Array(2).fill(null)\n this._bdyNodes[0] = bdyNodes0\n this._bdyNodes[1] = bdyNodes1\n }\n addIntersections(e0, segIndex0, e1, segIndex1) {\n if (e0 === e1 && segIndex0 === segIndex1) return null\n this.numTests++\n const p00 = e0.getCoordinates()[segIndex0]\n const p01 = e0.getCoordinates()[segIndex0 + 1]\n const p10 = e1.getCoordinates()[segIndex1]\n const p11 = e1.getCoordinates()[segIndex1 + 1]\n this._li.computeIntersection(p00, p01, p10, p11)\n if (this._li.hasIntersection()) {\n if (this._recordIsolated) {\n e0.setIsolated(false)\n e1.setIsolated(false)\n }\n this._numIntersections++\n if (!this.isTrivialIntersection(e0, segIndex0, e1, segIndex1)) {\n this._hasIntersection = true\n if (this._includeProper || !this._li.isProper()) {\n e0.addIntersections(this._li, segIndex0, 0)\n e1.addIntersections(this._li, segIndex1, 1)\n }\n if (this._li.isProper()) {\n this._properIntersectionPoint = this._li.getIntersection(0).copy()\n this._hasProper = true\n if (this._isDoneWhenProperInt) \n this._isDone = true\n \n if (!this.isBoundaryPoint(this._li, this._bdyNodes)) this._hasProperInterior = true\n }\n }\n }\n }\n}\n","import hasInterface from '../../../../../hasInterface.js'\nimport MonotoneChain from './MonotoneChain.js'\nimport SweepLineEvent from './SweepLineEvent.js'\nimport EdgeSetIntersector from './EdgeSetIntersector.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport SegmentIntersector from './SegmentIntersector.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport List from '../../../../../java/util/List.js'\nexport default class SimpleMCSweepLineIntersector extends EdgeSetIntersector {\n constructor() {\n super()\n SimpleMCSweepLineIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this.events = new ArrayList()\n this.nOverlaps = null\n }\n prepareEvents() {\n Collections.sort(this.events)\n for (let i = 0; i < this.events.size(); i++) {\n const ev = this.events.get(i)\n if (ev.isDelete()) \n ev.getInsertEvent().setDeleteEventIndex(i)\n \n }\n }\n computeIntersections() {\n if (arguments.length === 1) {\n const si = arguments[0]\n this.nOverlaps = 0\n this.prepareEvents()\n for (let i = 0; i < this.events.size(); i++) {\n const ev = this.events.get(i)\n if (ev.isInsert()) \n this.processOverlaps(i, ev.getDeleteEventIndex(), ev, si)\n \n if (si.isDone()) \n break\n \n }\n } else if (arguments.length === 3) {\n if (arguments[2] instanceof SegmentIntersector && (hasInterface(arguments[0], List) && hasInterface(arguments[1], List))) {\n const edges0 = arguments[0], edges1 = arguments[1], si = arguments[2]\n this.addEdges(edges0, edges0)\n this.addEdges(edges1, edges1)\n this.computeIntersections(si)\n } else if (typeof arguments[2] === 'boolean' && (hasInterface(arguments[0], List) && arguments[1] instanceof SegmentIntersector)) {\n const edges = arguments[0], si = arguments[1], testAllSegments = arguments[2]\n if (testAllSegments) this.addEdges(edges, null); else this.addEdges(edges)\n this.computeIntersections(si)\n }\n }\n }\n addEdge(edge, edgeSet) {\n const mce = edge.getMonotoneChainEdge()\n const startIndex = mce.getStartIndexes()\n for (let i = 0; i < startIndex.length - 1; i++) {\n const mc = new MonotoneChain(mce, i)\n const insertEvent = new SweepLineEvent(edgeSet, mce.getMinX(i), mc)\n this.events.add(insertEvent)\n this.events.add(new SweepLineEvent(mce.getMaxX(i), insertEvent))\n }\n }\n processOverlaps(start, end, ev0, si) {\n const mc0 = ev0.getObject()\n for (let i = start; i < end; i++) {\n const ev1 = this.events.get(i)\n if (ev1.isInsert()) {\n const mc1 = ev1.getObject()\n if (!ev0.isSameLabel(ev1)) {\n mc0.computeIntersections(mc1, si)\n this.nOverlaps++\n }\n }\n }\n }\n addEdges() {\n if (arguments.length === 1) {\n const edges = arguments[0]\n for (let i = edges.iterator(); i.hasNext(); ) {\n const edge = i.next()\n this.addEdge(edge, edge)\n }\n } else if (arguments.length === 2) {\n const edges = arguments[0], edgeSet = arguments[1]\n for (let i = edges.iterator(); i.hasNext(); ) {\n const edge = i.next()\n this.addEdge(edge, edgeSet)\n }\n }\n }\n}\n","export default class EdgeSetIntersector {}\n","import WKTWriter from '../../io/WKTWriter.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Double from '../../../../../java/lang/Double.js'\nimport Comparator from '../../../../../java/util/Comparator.js'\nexport default class IntervalRTreeNode {\n constructor() {\n IntervalRTreeNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._min = Double.POSITIVE_INFINITY\n this._max = Double.NEGATIVE_INFINITY\n }\n getMin() {\n return this._min\n }\n intersects(queryMin, queryMax) {\n if (this._min > queryMax || this._max < queryMin) return false\n return true\n }\n getMax() {\n return this._max\n }\n toString() {\n return WKTWriter.toLineString(new Coordinate(this._min, 0), new Coordinate(this._max, 0))\n }\n}\nclass NodeComparator {\n compare(o1, o2) {\n const n1 = o1\n const n2 = o2\n const mid1 = (n1._min + n1._max) / 2\n const mid2 = (n2._min + n2._max) / 2\n if (mid1 < mid2) return -1\n if (mid1 > mid2) return 1\n return 0\n }\n get interfaces_() {\n return [Comparator]\n }\n}\nIntervalRTreeNode.NodeComparator = NodeComparator\n","import IntervalRTreeNode from './IntervalRTreeNode.js'\nexport default class IntervalRTreeLeafNode extends IntervalRTreeNode {\n constructor() {\n super()\n IntervalRTreeLeafNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._item = null\n const min = arguments[0], max = arguments[1], item = arguments[2]\n this._min = min\n this._max = max\n this._item = item\n }\n query(queryMin, queryMax, visitor) {\n if (!this.intersects(queryMin, queryMax)) return null\n visitor.visitItem(this._item)\n }\n}\n","import IntervalRTreeNode from './IntervalRTreeNode.js'\nexport default class IntervalRTreeBranchNode extends IntervalRTreeNode {\n constructor() {\n super()\n IntervalRTreeBranchNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._node1 = null\n this._node2 = null\n const n1 = arguments[0], n2 = arguments[1]\n this._node1 = n1\n this._node2 = n2\n this.buildExtent(this._node1, this._node2)\n }\n buildExtent(n1, n2) {\n this._min = Math.min(n1._min, n2._min)\n this._max = Math.max(n1._max, n2._max)\n }\n query(queryMin, queryMax, visitor) {\n if (!this.intersects(queryMin, queryMax)) \n return null\n \n if (this._node1 !== null) this._node1.query(queryMin, queryMax, visitor)\n if (this._node2 !== null) this._node2.query(queryMin, queryMax, visitor)\n }\n}\n","import WKTWriter from '../../io/WKTWriter.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport IntervalRTreeLeafNode from './IntervalRTreeLeafNode.js'\nimport IntervalRTreeNode from './IntervalRTreeNode.js'\nimport Collections from '../../../../../java/util/Collections.js'\nimport System from '../../../../../java/lang/System.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport IntervalRTreeBranchNode from './IntervalRTreeBranchNode.js'\nexport default class SortedPackedIntervalRTree {\n constructor() {\n SortedPackedIntervalRTree.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._leaves = new ArrayList()\n this._root = null\n this._level = 0\n }\n buildTree() {\n Collections.sort(this._leaves, new IntervalRTreeNode.NodeComparator())\n let src = this._leaves\n let temp = null\n let dest = new ArrayList()\n while (true) {\n this.buildLevel(src, dest)\n if (dest.size() === 1) return dest.get(0)\n temp = src\n src = dest\n dest = temp\n }\n }\n insert(min, max, item) {\n if (this._root !== null) throw new IllegalStateException('Index cannot be added to once it has been queried')\n this._leaves.add(new IntervalRTreeLeafNode(min, max, item))\n }\n query(min, max, visitor) {\n this.init()\n if (this._root === null) return null\n this._root.query(min, max, visitor)\n }\n buildRoot() {\n if (this._root !== null) return null\n this._root = this.buildTree()\n }\n printNode(node) {\n System.out.println(WKTWriter.toLineString(new Coordinate(node._min, this._level), new Coordinate(node._max, this._level)))\n }\n init() {\n if (this._root !== null) return null\n if (this._leaves.size() === 0) return null\n this.buildRoot()\n }\n buildLevel(src, dest) {\n this._level++\n dest.clear()\n for (let i = 0; i < src.size(); i += 2) {\n const n1 = src.get(i)\n const n2 = i + 1 < src.size() ? src.get(i) : null\n if (n2 === null) {\n dest.add(n1)\n } else {\n const node = new IntervalRTreeBranchNode(src.get(i), src.get(i + 1))\n dest.add(node)\n }\n }\n }\n}\n","import LineString from '../LineString.js'\nimport Geometry from '../Geometry.js'\nimport hasInterface from '../../../../../hasInterface.js'\nimport Collection from '../../../../../java/util/Collection.js'\nimport LinearRing from '../LinearRing.js'\nimport GeometryComponentFilter from '../GeometryComponentFilter.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class LinearComponentExtracter {\n constructor() {\n LinearComponentExtracter.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._lines = null\n this._isForcedToLineString = false\n if (arguments.length === 1) {\n const lines = arguments[0]\n this._lines = lines\n } else if (arguments.length === 2) {\n const lines = arguments[0], isForcedToLineString = arguments[1]\n this._lines = lines\n this._isForcedToLineString = isForcedToLineString\n }\n }\n static getGeometry() {\n if (arguments.length === 1) {\n const geom = arguments[0]\n return geom.getFactory().buildGeometry(LinearComponentExtracter.getLines(geom))\n } else if (arguments.length === 2) {\n const geom = arguments[0], forceToLineString = arguments[1]\n return geom.getFactory().buildGeometry(LinearComponentExtracter.getLines(geom, forceToLineString))\n }\n }\n static getLines() {\n if (arguments.length === 1) {\n const geom = arguments[0]\n return LinearComponentExtracter.getLines(geom, false)\n } else if (arguments.length === 2) {\n if (hasInterface(arguments[0], Collection) && hasInterface(arguments[1], Collection)) {\n const geoms = arguments[0], lines = arguments[1]\n for (let i = geoms.iterator(); i.hasNext(); ) {\n const g = i.next()\n LinearComponentExtracter.getLines(g, lines)\n }\n return lines\n } else if (arguments[0] instanceof Geometry && typeof arguments[1] === 'boolean') {\n const geom = arguments[0], forceToLineString = arguments[1]\n const lines = new ArrayList()\n geom.apply(new LinearComponentExtracter(lines, forceToLineString))\n return lines\n } else if (arguments[0] instanceof Geometry && hasInterface(arguments[1], Collection)) {\n const geom = arguments[0], lines = arguments[1]\n if (geom instanceof LineString) \n lines.add(geom)\n else \n geom.apply(new LinearComponentExtracter(lines))\n \n return lines\n }\n } else if (arguments.length === 3) {\n if (typeof arguments[2] === 'boolean' && (hasInterface(arguments[0], Collection) && hasInterface(arguments[1], Collection))) {\n const geoms = arguments[0], lines = arguments[1], forceToLineString = arguments[2]\n for (let i = geoms.iterator(); i.hasNext(); ) {\n const g = i.next()\n LinearComponentExtracter.getLines(g, lines, forceToLineString)\n }\n return lines\n } else if (typeof arguments[2] === 'boolean' && (arguments[0] instanceof Geometry && hasInterface(arguments[1], Collection))) {\n const geom = arguments[0], lines = arguments[1], forceToLineString = arguments[2]\n geom.apply(new LinearComponentExtracter(lines, forceToLineString))\n return lines\n }\n }\n }\n filter(geom) {\n if (this._isForcedToLineString && geom instanceof LinearRing) {\n const line = geom.getFactory().createLineString(geom.getCoordinateSequence())\n this._lines.add(line)\n return null\n }\n if (geom instanceof LineString) this._lines.add(geom)\n }\n setForceToLineString(isForcedToLineString) {\n this._isForcedToLineString = isForcedToLineString\n }\n get interfaces_() {\n return [GeometryComponentFilter]\n }\n}\n","import ItemVisitor from './ItemVisitor.js'\nimport ArrayList from '../../../../java/util/ArrayList.js'\nexport default class ArrayListVisitor {\n constructor() {\n ArrayListVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._items = new ArrayList()\n }\n visitItem(item) {\n this._items.add(item)\n }\n getItems() {\n return this._items\n }\n get interfaces_() {\n return [ItemVisitor]\n }\n}\n","import hasInterface from '../../../../../hasInterface.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport ItemVisitor from '../../index/ItemVisitor.js'\nimport PointOnGeometryLocator from './PointOnGeometryLocator.js'\nimport LinearRing from '../../geom/LinearRing.js'\nimport SortedPackedIntervalRTree from '../../index/intervalrtree/SortedPackedIntervalRTree.js'\nimport LineSegment from '../../geom/LineSegment.js'\nimport Polygonal from '../../geom/Polygonal.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport LinearComponentExtracter from '../../geom/util/LinearComponentExtracter.js'\nimport ArrayListVisitor from '../../index/ArrayListVisitor.js'\nimport RayCrossingCounter from '../RayCrossingCounter.js'\nexport default class IndexedPointInAreaLocator {\n constructor() {\n IndexedPointInAreaLocator.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._geom = null\n this._index = null\n const g = arguments[0]\n if (!(hasInterface(g, Polygonal) || g instanceof LinearRing)) throw new IllegalArgumentException('Argument must be Polygonal or LinearRing')\n this._geom = g\n }\n locate(p) {\n if (this._index === null) {\n this._index = new IntervalIndexedGeometry(this._geom)\n this._geom = null\n }\n const rcc = new RayCrossingCounter(p)\n const visitor = new SegmentVisitor(rcc)\n this._index.query(p.y, p.y, visitor)\n return rcc.getLocation()\n }\n get interfaces_() {\n return [PointOnGeometryLocator]\n }\n}\nclass SegmentVisitor {\n constructor() {\n SegmentVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._counter = null\n const counter = arguments[0]\n this._counter = counter\n }\n visitItem(item) {\n const seg = item\n this._counter.countSegment(seg.getCoordinate(0), seg.getCoordinate(1))\n }\n get interfaces_() {\n return [ItemVisitor]\n }\n}\nclass IntervalIndexedGeometry {\n constructor() {\n IntervalIndexedGeometry.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._isEmpty = false\n this._index = new SortedPackedIntervalRTree()\n const geom = arguments[0]\n if (geom.isEmpty()) this._isEmpty = true; else this.init(geom)\n }\n init(geom) {\n const lines = LinearComponentExtracter.getLines(geom)\n for (let i = lines.iterator(); i.hasNext(); ) {\n const line = i.next()\n const pts = line.getCoordinates()\n this.addLine(pts)\n }\n }\n addLine(pts) {\n for (let i = 1; i < pts.length; i++) {\n const seg = new LineSegment(pts[i - 1], pts[i])\n const min = Math.min(seg.p0.y, seg.p1.y)\n const max = Math.max(seg.p0.y, seg.p1.y)\n this._index.insert(min, max, seg)\n }\n }\n query() {\n if (arguments.length === 2) {\n const min = arguments[0], max = arguments[1]\n if (this._isEmpty) return new ArrayList()\n const visitor = new ArrayListVisitor()\n this._index.query(min, max, visitor)\n return visitor.getItems()\n } else if (arguments.length === 3) {\n const min = arguments[0], max = arguments[1], visitor = arguments[2]\n if (this._isEmpty) return null\n this._index.query(min, max, visitor)\n }\n }\n}\nIndexedPointInAreaLocator.SegmentVisitor = SegmentVisitor\nIndexedPointInAreaLocator.IntervalIndexedGeometry = IntervalIndexedGeometry\n","import PointLocator from '../algorithm/PointLocator.js'\nimport Location from '../geom/Location.js'\nimport LineString from '../geom/LineString.js'\nimport HashMap from '../../../../java/util/HashMap.js'\nimport Geometry from '../geom/Geometry.js'\nimport hasInterface from '../../../../hasInterface.js'\nimport Position from './Position.js'\nimport Coordinate from '../geom/Coordinate.js'\nimport Point from '../geom/Point.js'\nimport Polygon from '../geom/Polygon.js'\nimport MultiPoint from '../geom/MultiPoint.js'\nimport SimpleMCSweepLineIntersector from './index/SimpleMCSweepLineIntersector.js'\nimport LinearRing from '../geom/LinearRing.js'\nimport BoundaryNodeRule from '../algorithm/BoundaryNodeRule.js'\nimport Orientation from '../algorithm/Orientation.js'\nimport SegmentIntersector from './index/SegmentIntersector.js'\nimport MultiPolygon from '../geom/MultiPolygon.js'\nimport Label from './Label.js'\nimport GeometryCollection from '../geom/GeometryCollection.js'\nimport UnsupportedOperationException from '../../../../java/lang/UnsupportedOperationException.js'\nimport CoordinateArrays from '../geom/CoordinateArrays.js'\nimport Polygonal from '../geom/Polygonal.js'\nimport IndexedPointInAreaLocator from '../algorithm/locate/IndexedPointInAreaLocator.js'\nimport Assert from '../util/Assert.js'\nimport Edge from './Edge.js'\nimport MultiLineString from '../geom/MultiLineString.js'\nimport PlanarGraph from './PlanarGraph.js'\nexport default class GeometryGraph extends PlanarGraph {\n constructor() {\n super()\n GeometryGraph.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._parentGeom = null\n this._lineEdgeMap = new HashMap()\n this._boundaryNodeRule = null\n this._useBoundaryDeterminationRule = true\n this._argIndex = null\n this._boundaryNodes = null\n this._hasTooFewPoints = false\n this._invalidPoint = null\n this._areaPtLocator = null\n this._ptLocator = new PointLocator()\n if (arguments.length === 2) {\n const argIndex = arguments[0], parentGeom = arguments[1]\n GeometryGraph.constructor_.call(this, argIndex, parentGeom, BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE)\n } else if (arguments.length === 3) {\n const argIndex = arguments[0], parentGeom = arguments[1], boundaryNodeRule = arguments[2]\n this._argIndex = argIndex\n this._parentGeom = parentGeom\n this._boundaryNodeRule = boundaryNodeRule\n if (parentGeom !== null) \n this.add(parentGeom)\n \n }\n }\n static determineBoundary(boundaryNodeRule, boundaryCount) {\n return boundaryNodeRule.isInBoundary(boundaryCount) ? Location.BOUNDARY : Location.INTERIOR\n }\n insertBoundaryPoint(argIndex, coord) {\n const n = this._nodes.addNode(coord)\n const lbl = n.getLabel()\n let boundaryCount = 1\n let loc = Location.NONE\n loc = lbl.getLocation(argIndex, Position.ON)\n if (loc === Location.BOUNDARY) boundaryCount++\n const newLoc = GeometryGraph.determineBoundary(this._boundaryNodeRule, boundaryCount)\n lbl.setLocation(argIndex, newLoc)\n }\n computeSelfNodes() {\n if (arguments.length === 2) {\n const li = arguments[0], computeRingSelfNodes = arguments[1]\n return this.computeSelfNodes(li, computeRingSelfNodes, false)\n } else if (arguments.length === 3) {\n const li = arguments[0], computeRingSelfNodes = arguments[1], isDoneIfProperInt = arguments[2]\n const si = new SegmentIntersector(li, true, false)\n si.setIsDoneIfProperInt(isDoneIfProperInt)\n const esi = this.createEdgeSetIntersector()\n const isRings = this._parentGeom instanceof LinearRing || this._parentGeom instanceof Polygon || this._parentGeom instanceof MultiPolygon\n const computeAllSegments = computeRingSelfNodes || !isRings\n esi.computeIntersections(this._edges, si, computeAllSegments)\n this.addSelfIntersectionNodes(this._argIndex)\n return si\n }\n }\n computeSplitEdges(edgelist) {\n for (let i = this._edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n e.eiList.addSplitEdges(edgelist)\n }\n }\n computeEdgeIntersections(g, li, includeProper) {\n const si = new SegmentIntersector(li, includeProper, true)\n si.setBoundaryNodes(this.getBoundaryNodes(), g.getBoundaryNodes())\n const esi = this.createEdgeSetIntersector()\n esi.computeIntersections(this._edges, g._edges, si)\n return si\n }\n getGeometry() {\n return this._parentGeom\n }\n getBoundaryNodeRule() {\n return this._boundaryNodeRule\n }\n hasTooFewPoints() {\n return this._hasTooFewPoints\n }\n addPoint() {\n if (arguments[0] instanceof Point) {\n const p = arguments[0]\n const coord = p.getCoordinate()\n this.insertPoint(this._argIndex, coord, Location.INTERIOR)\n } else if (arguments[0] instanceof Coordinate) {\n const pt = arguments[0]\n this.insertPoint(this._argIndex, pt, Location.INTERIOR)\n }\n }\n addPolygon(p) {\n this.addPolygonRing(p.getExteriorRing(), Location.EXTERIOR, Location.INTERIOR)\n for (let i = 0; i < p.getNumInteriorRing(); i++) {\n const hole = p.getInteriorRingN(i)\n this.addPolygonRing(hole, Location.INTERIOR, Location.EXTERIOR)\n }\n }\n addEdge(e) {\n this.insertEdge(e)\n const coord = e.getCoordinates()\n this.insertPoint(this._argIndex, coord[0], Location.BOUNDARY)\n this.insertPoint(this._argIndex, coord[coord.length - 1], Location.BOUNDARY)\n }\n addLineString(line) {\n const coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates())\n if (coord.length < 2) {\n this._hasTooFewPoints = true\n this._invalidPoint = coord[0]\n return null\n }\n const e = new Edge(coord, new Label(this._argIndex, Location.INTERIOR))\n this._lineEdgeMap.put(line, e)\n this.insertEdge(e)\n Assert.isTrue(coord.length >= 2, 'found LineString with single point')\n this.insertBoundaryPoint(this._argIndex, coord[0])\n this.insertBoundaryPoint(this._argIndex, coord[coord.length - 1])\n }\n getInvalidPoint() {\n return this._invalidPoint\n }\n getBoundaryPoints() {\n const coll = this.getBoundaryNodes()\n const pts = new Array(coll.size()).fill(null)\n let i = 0\n for (let it = coll.iterator(); it.hasNext(); ) {\n const node = it.next()\n pts[i++] = node.getCoordinate().copy()\n }\n return pts\n }\n getBoundaryNodes() {\n if (this._boundaryNodes === null) this._boundaryNodes = this._nodes.getBoundaryNodes(this._argIndex)\n return this._boundaryNodes\n }\n addSelfIntersectionNode(argIndex, coord, loc) {\n if (this.isBoundaryNode(argIndex, coord)) return null\n if (loc === Location.BOUNDARY && this._useBoundaryDeterminationRule) this.insertBoundaryPoint(argIndex, coord); else this.insertPoint(argIndex, coord, loc)\n }\n addPolygonRing(lr, cwLeft, cwRight) {\n if (lr.isEmpty()) return null\n const coord = CoordinateArrays.removeRepeatedPoints(lr.getCoordinates())\n if (coord.length < 4) {\n this._hasTooFewPoints = true\n this._invalidPoint = coord[0]\n return null\n }\n let left = cwLeft\n let right = cwRight\n if (Orientation.isCCW(coord)) {\n left = cwRight\n right = cwLeft\n }\n const e = new Edge(coord, new Label(this._argIndex, Location.BOUNDARY, left, right))\n this._lineEdgeMap.put(lr, e)\n this.insertEdge(e)\n this.insertPoint(this._argIndex, coord[0], Location.BOUNDARY)\n }\n insertPoint(argIndex, coord, onLocation) {\n const n = this._nodes.addNode(coord)\n const lbl = n.getLabel()\n if (lbl === null) \n n._label = new Label(argIndex, onLocation)\n else lbl.setLocation(argIndex, onLocation)\n }\n createEdgeSetIntersector() {\n return new SimpleMCSweepLineIntersector()\n }\n addSelfIntersectionNodes(argIndex) {\n for (let i = this._edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n const eLoc = e.getLabel().getLocation(argIndex)\n for (let eiIt = e.eiList.iterator(); eiIt.hasNext(); ) {\n const ei = eiIt.next()\n this.addSelfIntersectionNode(argIndex, ei.coord, eLoc)\n }\n }\n }\n add() {\n if (arguments.length === 1 && arguments[0] instanceof Geometry) {\n const g = arguments[0]\n if (g.isEmpty()) return null\n if (g instanceof MultiPolygon) this._useBoundaryDeterminationRule = false\n if (g instanceof Polygon) this.addPolygon(g); else if (g instanceof LineString) this.addLineString(g); else if (g instanceof Point) this.addPoint(g); else if (g instanceof MultiPoint) this.addCollection(g); else if (g instanceof MultiLineString) this.addCollection(g); else if (g instanceof MultiPolygon) this.addCollection(g); else if (g instanceof GeometryCollection) this.addCollection(g); else throw new UnsupportedOperationException(g.getGeometryType())\n } else {\n return super.add.apply(this, arguments)\n }\n }\n addCollection(gc) {\n for (let i = 0; i < gc.getNumGeometries(); i++) {\n const g = gc.getGeometryN(i)\n this.add(g)\n }\n }\n locate(pt) {\n if (hasInterface(this._parentGeom, Polygonal) && this._parentGeom.getNumGeometries() > 50) {\n if (this._areaPtLocator === null) \n this._areaPtLocator = new IndexedPointInAreaLocator(this._parentGeom)\n \n return this._areaPtLocator.locate(pt)\n }\n return this._ptLocator.locate(pt, this._parentGeom)\n }\n findEdge() {\n if (arguments.length === 1 && arguments[0] instanceof LineString) {\n const line = arguments[0]\n return this._lineEdgeMap.get(line)\n } else {\n return super.findEdge.apply(this, arguments)\n }\n }\n}\n","import BoundaryNodeRule from '../algorithm/BoundaryNodeRule.js'\nimport GeometryGraph from '../geomgraph/GeometryGraph.js'\nimport RobustLineIntersector from '../algorithm/RobustLineIntersector.js'\nexport default class GeometryGraphOperation {\n constructor() {\n GeometryGraphOperation.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._resultPrecisionModel = null\n this._arg = null\n if (arguments.length === 1) {\n const g0 = arguments[0]\n this.setComputationPrecision(g0.getPrecisionModel())\n this._arg = new Array(1).fill(null)\n this._arg[0] = new GeometryGraph(0, g0)\n \n } else if (arguments.length === 2) {\n const g0 = arguments[0], g1 = arguments[1]\n GeometryGraphOperation.constructor_.call(this, g0, g1, BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE)\n } else if (arguments.length === 3) {\n const g0 = arguments[0], g1 = arguments[1], boundaryNodeRule = arguments[2]\n if (g0.getPrecisionModel().compareTo(g1.getPrecisionModel()) >= 0) this.setComputationPrecision(g0.getPrecisionModel()); else this.setComputationPrecision(g1.getPrecisionModel())\n this._arg = new Array(2).fill(null)\n this._arg[0] = new GeometryGraph(0, g0, boundaryNodeRule)\n this._arg[1] = new GeometryGraph(1, g1, boundaryNodeRule)\n }\n }\n getArgGeometry(i) {\n return this._arg[i].getGeometry()\n }\n setComputationPrecision(pm) {\n this._resultPrecisionModel = pm\n this._li.setPrecisionModel(this._resultPrecisionModel)\n }\n}\n","import PointLocator from '../../algorithm/PointLocator.js'\nimport Location from '../../geom/Location.js'\nimport EdgeNodingValidator from '../../geomgraph/EdgeNodingValidator.js'\nimport GeometryCollectionMapper from '../../geom/util/GeometryCollectionMapper.js'\nimport PolygonBuilder from './PolygonBuilder.js'\nimport Position from '../../geomgraph/Position.js'\nimport IllegalArgumentException from '../../../../../java/lang/IllegalArgumentException.js'\nimport LineBuilder from './LineBuilder.js'\nimport PointBuilder from './PointBuilder.js'\nimport SnapIfNeededOverlayOp from './snap/SnapIfNeededOverlayOp.js'\nimport Label from '../../geomgraph/Label.js'\nimport OverlayNodeFactory from './OverlayNodeFactory.js'\nimport GeometryGraphOperation from '../GeometryGraphOperation.js'\nimport EdgeList from '../../geomgraph/EdgeList.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Assert from '../../util/Assert.js'\nimport PlanarGraph from '../../geomgraph/PlanarGraph.js'\nexport default class OverlayOp extends GeometryGraphOperation {\n constructor() {\n super()\n OverlayOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._ptLocator = new PointLocator()\n this._geomFact = null\n this._resultGeom = null\n this._graph = null\n this._edgeList = new EdgeList()\n this._resultPolyList = new ArrayList()\n this._resultLineList = new ArrayList()\n this._resultPointList = new ArrayList()\n const g0 = arguments[0], g1 = arguments[1]\n GeometryGraphOperation.constructor_.call(this, g0, g1)\n this._graph = new PlanarGraph(new OverlayNodeFactory())\n this._geomFact = g0.getFactory()\n }\n static overlayOp(geom0, geom1, opCode) {\n const gov = new OverlayOp(geom0, geom1)\n const geomOv = gov.getResultGeometry(opCode)\n return geomOv\n }\n static union(geom, other) {\n if (geom.isEmpty() || other.isEmpty()) {\n if (geom.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, geom, other, geom.getFactory())\n if (geom.isEmpty()) return other.copy()\n if (other.isEmpty()) return geom.copy()\n }\n if (geom.isGeometryCollection() || other.isGeometryCollection()) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.UNION)\n }\n static intersection(geom, other) {\n if (geom.isEmpty() || other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.INTERSECTION, geom, other, geom.getFactory())\n if (geom.isGeometryCollection()) {\n const g2 = other\n return GeometryCollectionMapper.map(geom, new (class {\n get interfaces_() {\n return [MapOp]\n }\n map(g) {\n return OverlayOp.intersection(g, g2)\n }\n })())\n }\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.INTERSECTION)\n }\n static symDifference(geom, other) {\n if (geom.isEmpty() || other.isEmpty()) {\n if (geom.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.SYMDIFFERENCE, geom, other, geom.getFactory())\n if (geom.isEmpty()) return other.copy()\n if (other.isEmpty()) return geom.copy()\n }\n if (geom.isGeometryCollection() || other.isGeometryCollection()) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.SYMDIFFERENCE)\n }\n static resultDimension(opCode, g0, g1) {\n const dim0 = g0.getDimension()\n const dim1 = g1.getDimension()\n let resultDimension = -1\n switch (opCode) {\n case OverlayOp.INTERSECTION:\n resultDimension = Math.min(dim0, dim1)\n break\n case OverlayOp.UNION:\n resultDimension = Math.max(dim0, dim1)\n break\n case OverlayOp.DIFFERENCE:\n resultDimension = dim0\n break\n case OverlayOp.SYMDIFFERENCE:\n resultDimension = Math.max(dim0, dim1)\n break\n }\n return resultDimension\n }\n static createEmptyResult(overlayOpCode, a, b, geomFact) {\n let result = null\n const resultDim = OverlayOp.resultDimension(overlayOpCode, a, b)\n return result = geomFact.createEmpty(resultDim)\n }\n static difference(geom, other) {\n if (geom.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.DIFFERENCE, geom, other, geom.getFactory())\n if (other.isEmpty()) return geom.copy()\n if (geom.isGeometryCollection() || other.isGeometryCollection()) throw new IllegalArgumentException('This method does not support GeometryCollection arguments')\n return SnapIfNeededOverlayOp.overlayOp(geom, other, OverlayOp.DIFFERENCE)\n }\n static isResultOfOp() {\n if (arguments.length === 2) {\n const label = arguments[0], opCode = arguments[1]\n const loc0 = label.getLocation(0)\n const loc1 = label.getLocation(1)\n return OverlayOp.isResultOfOp(loc0, loc1, opCode)\n } else if (arguments.length === 3) {\n let loc0 = arguments[0], loc1 = arguments[1], overlayOpCode = arguments[2]\n if (loc0 === Location.BOUNDARY) loc0 = Location.INTERIOR\n if (loc1 === Location.BOUNDARY) loc1 = Location.INTERIOR\n switch (overlayOpCode) {\n case OverlayOp.INTERSECTION:\n return loc0 === Location.INTERIOR && loc1 === Location.INTERIOR\n case OverlayOp.UNION:\n return loc0 === Location.INTERIOR || loc1 === Location.INTERIOR\n case OverlayOp.DIFFERENCE:\n return loc0 === Location.INTERIOR && loc1 !== Location.INTERIOR\n case OverlayOp.SYMDIFFERENCE:\n return loc0 === Location.INTERIOR && loc1 !== Location.INTERIOR || loc0 !== Location.INTERIOR && loc1 === Location.INTERIOR\n }\n return false\n }\n }\n insertUniqueEdge(e) {\n const existingEdge = this._edgeList.findEqualEdge(e)\n if (existingEdge !== null) {\n const existingLabel = existingEdge.getLabel()\n let labelToMerge = e.getLabel()\n if (!existingEdge.isPointwiseEqual(e)) {\n labelToMerge = new Label(e.getLabel())\n labelToMerge.flip()\n }\n const depth = existingEdge.getDepth()\n if (depth.isNull()) \n depth.add(existingLabel)\n \n depth.add(labelToMerge)\n existingLabel.merge(labelToMerge)\n } else {\n this._edgeList.add(e)\n }\n }\n getGraph() {\n return this._graph\n }\n cancelDuplicateResultEdges() {\n for (let it = this._graph.getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n const sym = de.getSym()\n if (de.isInResult() && sym.isInResult()) {\n de.setInResult(false)\n sym.setInResult(false)\n }\n }\n }\n isCoveredByLA(coord) {\n if (this.isCovered(coord, this._resultLineList)) return true\n if (this.isCovered(coord, this._resultPolyList)) return true\n return false\n }\n computeGeometry(resultPointList, resultLineList, resultPolyList, opcode) {\n const geomList = new ArrayList()\n geomList.addAll(resultPointList)\n geomList.addAll(resultLineList)\n geomList.addAll(resultPolyList)\n if (geomList.isEmpty()) return OverlayOp.createEmptyResult(opcode, this._arg[0].getGeometry(), this._arg[1].getGeometry(), this._geomFact)\n return this._geomFact.buildGeometry(geomList)\n }\n mergeSymLabels() {\n for (let nodeit = this._graph.getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().mergeSymLabels()\n }\n }\n isCovered(coord, geomList) {\n for (let it = geomList.iterator(); it.hasNext(); ) {\n const geom = it.next()\n const loc = this._ptLocator.locate(coord, geom)\n if (loc !== Location.EXTERIOR) return true\n }\n return false\n }\n replaceCollapsedEdges() {\n const newEdges = new ArrayList()\n for (let it = this._edgeList.iterator(); it.hasNext(); ) {\n const e = it.next()\n if (e.isCollapsed()) {\n it.remove()\n newEdges.add(e.getCollapsedEdge())\n }\n }\n this._edgeList.addAll(newEdges)\n }\n updateNodeLabelling() {\n for (let nodeit = this._graph.getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n const lbl = node.getEdges().getLabel()\n node.getLabel().merge(lbl)\n }\n }\n getResultGeometry(overlayOpCode) {\n this.computeOverlay(overlayOpCode)\n return this._resultGeom\n }\n insertUniqueEdges(edges) {\n for (let i = edges.iterator(); i.hasNext(); ) {\n const e = i.next()\n this.insertUniqueEdge(e)\n }\n }\n computeOverlay(opCode) {\n this.copyPoints(0)\n this.copyPoints(1)\n this._arg[0].computeSelfNodes(this._li, false)\n this._arg[1].computeSelfNodes(this._li, false)\n this._arg[0].computeEdgeIntersections(this._arg[1], this._li, true)\n const baseSplitEdges = new ArrayList()\n this._arg[0].computeSplitEdges(baseSplitEdges)\n this._arg[1].computeSplitEdges(baseSplitEdges)\n const splitEdges = baseSplitEdges\n this.insertUniqueEdges(baseSplitEdges)\n this.computeLabelsFromDepths()\n this.replaceCollapsedEdges()\n EdgeNodingValidator.checkValid(this._edgeList.getEdges())\n this._graph.addEdges(this._edgeList.getEdges())\n this.computeLabelling()\n this.labelIncompleteNodes()\n this.findResultAreaEdges(opCode)\n this.cancelDuplicateResultEdges()\n const polyBuilder = new PolygonBuilder(this._geomFact)\n polyBuilder.add(this._graph)\n this._resultPolyList = polyBuilder.getPolygons()\n const lineBuilder = new LineBuilder(this, this._geomFact, this._ptLocator)\n this._resultLineList = lineBuilder.build(opCode)\n const pointBuilder = new PointBuilder(this, this._geomFact, this._ptLocator)\n this._resultPointList = pointBuilder.build(opCode)\n this._resultGeom = this.computeGeometry(this._resultPointList, this._resultLineList, this._resultPolyList, opCode)\n }\n labelIncompleteNode(n, targetIndex) {\n const loc = this._ptLocator.locate(n.getCoordinate(), this._arg[targetIndex].getGeometry())\n n.getLabel().setLocation(targetIndex, loc)\n }\n copyPoints(argIndex) {\n for (let i = this._arg[argIndex].getNodeIterator(); i.hasNext(); ) {\n const graphNode = i.next()\n const newNode = this._graph.addNode(graphNode.getCoordinate())\n newNode.setLabel(argIndex, graphNode.getLabel().getLocation(argIndex))\n }\n }\n findResultAreaEdges(opCode) {\n for (let it = this._graph.getEdgeEnds().iterator(); it.hasNext(); ) {\n const de = it.next()\n const label = de.getLabel()\n if (label.isArea() && !de.isInteriorAreaEdge() && OverlayOp.isResultOfOp(label.getLocation(0, Position.RIGHT), label.getLocation(1, Position.RIGHT), opCode)) \n de.setInResult(true)\n \n }\n }\n computeLabelsFromDepths() {\n for (let it = this._edgeList.iterator(); it.hasNext(); ) {\n const e = it.next()\n const lbl = e.getLabel()\n const depth = e.getDepth()\n if (!depth.isNull()) {\n depth.normalize()\n for (let i = 0; i < 2; i++) \n if (!lbl.isNull(i) && lbl.isArea() && !depth.isNull(i)) \n if (depth.getDelta(i) === 0) {\n lbl.toLine(i)\n } else {\n Assert.isTrue(!depth.isNull(i, Position.LEFT), 'depth of LEFT side has not been initialized')\n lbl.setLocation(i, Position.LEFT, depth.getLocation(i, Position.LEFT))\n Assert.isTrue(!depth.isNull(i, Position.RIGHT), 'depth of RIGHT side has not been initialized')\n lbl.setLocation(i, Position.RIGHT, depth.getLocation(i, Position.RIGHT))\n }\n \n \n }\n }\n }\n computeLabelling() {\n for (let nodeit = this._graph.getNodes().iterator(); nodeit.hasNext(); ) {\n const node = nodeit.next()\n node.getEdges().computeLabelling(this._arg)\n }\n this.mergeSymLabels()\n this.updateNodeLabelling()\n }\n labelIncompleteNodes() {\n for (let ni = this._graph.getNodes().iterator(); ni.hasNext(); ) {\n const n = ni.next()\n const label = n.getLabel()\n if (n.isIsolated()) \n if (label.isNull(0)) this.labelIncompleteNode(n, 0); else this.labelIncompleteNode(n, 1)\n \n n.getEdges().updateLabelling(label)\n }\n }\n isCoveredByA(coord) {\n if (this.isCovered(coord, this._resultPolyList)) return true\n return false\n }\n}\nOverlayOp.INTERSECTION = 1\nOverlayOp.UNION = 2\nOverlayOp.DIFFERENCE = 3\nOverlayOp.SYMDIFFERENCE = 4\n","import EdgeEnd from '../../geomgraph/EdgeEnd.js'\nimport Label from '../../geomgraph/Label.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nexport default class EdgeEndBuilder {\n createEdgeEndForNext(edge, l, eiCurr, eiNext) {\n const iNext = eiCurr.segmentIndex + 1\n if (iNext >= edge.getNumPoints() && eiNext === null) return null\n let pNext = edge.getCoordinate(iNext)\n if (eiNext !== null && eiNext.segmentIndex === eiCurr.segmentIndex) pNext = eiNext.coord\n const e = new EdgeEnd(edge, eiCurr.coord, pNext, new Label(edge.getLabel()))\n l.add(e)\n }\n createEdgeEndForPrev(edge, l, eiCurr, eiPrev) {\n let iPrev = eiCurr.segmentIndex\n if (eiCurr.dist === 0.0) {\n if (iPrev === 0) return null\n iPrev--\n }\n let pPrev = edge.getCoordinate(iPrev)\n if (eiPrev !== null && eiPrev.segmentIndex >= iPrev) pPrev = eiPrev.coord\n const label = new Label(edge.getLabel())\n label.flip()\n const e = new EdgeEnd(edge, eiCurr.coord, pPrev, label)\n l.add(e)\n }\n computeEdgeEnds() {\n if (arguments.length === 1) {\n const edges = arguments[0]\n const l = new ArrayList()\n for (let i = edges; i.hasNext(); ) {\n const e = i.next()\n this.computeEdgeEnds(e, l)\n }\n return l\n } else if (arguments.length === 2) {\n const edge = arguments[0], l = arguments[1]\n const eiList = edge.getEdgeIntersectionList()\n eiList.addEndpoints()\n const it = eiList.iterator()\n let eiPrev = null\n let eiCurr = null\n if (!it.hasNext()) return null\n let eiNext = it.next()\n do {\n eiPrev = eiCurr\n eiCurr = eiNext\n eiNext = null\n if (it.hasNext()) eiNext = it.next()\n if (eiCurr !== null) {\n this.createEdgeEndForPrev(edge, l, eiCurr, eiPrev)\n this.createEdgeEndForNext(edge, l, eiCurr, eiNext)\n }\n } while (eiCurr !== null)\n }\n }\n}\n","import Location from '../../geom/Location.js'\nimport EdgeEnd from '../../geomgraph/EdgeEnd.js'\nimport Position from '../../geomgraph/Position.js'\nimport GeometryGraph from '../../geomgraph/GeometryGraph.js'\nimport Label from '../../geomgraph/Label.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport Edge from '../../geomgraph/Edge.js'\nexport default class EdgeEndBundle extends EdgeEnd {\n constructor() {\n super()\n EdgeEndBundle.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._edgeEnds = new ArrayList()\n if (arguments.length === 1) {\n const e = arguments[0]\n EdgeEndBundle.constructor_.call(this, null, e)\n } else if (arguments.length === 2) {\n const boundaryNodeRule = arguments[0], e = arguments[1]\n EdgeEnd.constructor_.call(this, e.getEdge(), e.getCoordinate(), e.getDirectedCoordinate(), new Label(e.getLabel()))\n this.insert(e)\n }\n }\n insert(e) {\n this._edgeEnds.add(e)\n }\n print(out) {\n out.println('EdgeEndBundle--> Label: ' + this._label)\n for (let it = this.iterator(); it.hasNext(); ) {\n const ee = it.next()\n ee.print(out)\n out.println()\n }\n }\n iterator() {\n return this._edgeEnds.iterator()\n }\n getEdgeEnds() {\n return this._edgeEnds\n }\n computeLabelOn(geomIndex, boundaryNodeRule) {\n let boundaryCount = 0\n let foundInterior = false\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n const loc = e.getLabel().getLocation(geomIndex)\n if (loc === Location.BOUNDARY) boundaryCount++\n if (loc === Location.INTERIOR) foundInterior = true\n }\n let loc = Location.NONE\n if (foundInterior) loc = Location.INTERIOR\n if (boundaryCount > 0) \n loc = GeometryGraph.determineBoundary(boundaryNodeRule, boundaryCount)\n \n this._label.setLocation(geomIndex, loc)\n }\n computeLabelSide(geomIndex, side) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n if (e.getLabel().isArea()) {\n const loc = e.getLabel().getLocation(geomIndex, side)\n if (loc === Location.INTERIOR) {\n this._label.setLocation(geomIndex, side, Location.INTERIOR)\n return null\n } else if (loc === Location.EXTERIOR) {\n this._label.setLocation(geomIndex, side, Location.EXTERIOR)\n }\n }\n }\n }\n getLabel() {\n return this._label\n }\n computeLabelSides(geomIndex) {\n this.computeLabelSide(geomIndex, Position.LEFT)\n this.computeLabelSide(geomIndex, Position.RIGHT)\n }\n updateIM(im) {\n Edge.updateIM(this._label, im)\n }\n computeLabel(boundaryNodeRule) {\n let isArea = false\n for (let it = this.iterator(); it.hasNext(); ) {\n const e = it.next()\n if (e.getLabel().isArea()) isArea = true\n }\n if (isArea) this._label = new Label(Location.NONE, Location.NONE, Location.NONE); else this._label = new Label(Location.NONE)\n for (let i = 0; i < 2; i++) {\n this.computeLabelOn(i, boundaryNodeRule)\n if (isArea) this.computeLabelSides(i)\n }\n }\n}\n","import EdgeEndStar from '../../geomgraph/EdgeEndStar.js'\nimport EdgeEndBundle from './EdgeEndBundle.js'\nexport default class EdgeEndBundleStar extends EdgeEndStar {\n constructor() {\n super()\n }\n updateIM(im) {\n for (let it = this.iterator(); it.hasNext(); ) {\n const esb = it.next()\n esb.updateIM(im)\n }\n }\n insert(e) {\n let eb = this._edgeMap.get(e)\n if (eb === null) {\n eb = new EdgeEndBundle(e)\n this.insertEdgeEnd(e, eb)\n } else {\n eb.insert(e)\n }\n }\n}\n","import Node from '../../geomgraph/Node.js'\nexport default class RelateNode extends Node {\n constructor() {\n super()\n RelateNode.constructor_.apply(this, arguments)\n }\n static constructor_() {\n const coord = arguments[0], edges = arguments[1]\n Node.constructor_.call(this, coord, edges)\n }\n updateIMFromEdges(im) {\n this._edges.updateIM(im)\n }\n computeIM(im) {\n im.setAtLeastIfValid(this._label.getLocation(0), this._label.getLocation(1), 0)\n }\n}\n","import EdgeEndBundleStar from './EdgeEndBundleStar.js'\nimport RelateNode from './RelateNode.js'\nimport NodeFactory from '../../geomgraph/NodeFactory.js'\nexport default class RelateNodeFactory extends NodeFactory {\n constructor() {\n super()\n }\n createNode(coord) {\n return new RelateNode(coord, new EdgeEndBundleStar())\n }\n}\n","import PointLocator from '../../algorithm/PointLocator.js'\nimport Location from '../../geom/Location.js'\nimport IntersectionMatrix from '../../geom/IntersectionMatrix.js'\nimport EdgeEndBuilder from './EdgeEndBuilder.js'\nimport NodeMap from '../../geomgraph/NodeMap.js'\nimport RelateNodeFactory from './RelateNodeFactory.js'\nimport ArrayList from '../../../../../java/util/ArrayList.js'\nimport RobustLineIntersector from '../../algorithm/RobustLineIntersector.js'\nimport Assert from '../../util/Assert.js'\nexport default class RelateComputer {\n constructor() {\n RelateComputer.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._ptLocator = new PointLocator()\n this._arg = null\n this._nodes = new NodeMap(new RelateNodeFactory())\n this._im = null\n this._isolatedEdges = new ArrayList()\n this._invalidPoint = null\n const arg = arguments[0]\n this._arg = arg\n }\n insertEdgeEnds(ee) {\n for (let i = ee.iterator(); i.hasNext(); ) {\n const e = i.next()\n this._nodes.add(e)\n }\n }\n computeProperIntersectionIM(intersector, im) {\n const dimA = this._arg[0].getGeometry().getDimension()\n const dimB = this._arg[1].getGeometry().getDimension()\n const hasProper = intersector.hasProperIntersection()\n const hasProperInterior = intersector.hasProperInteriorIntersection()\n if (dimA === 2 && dimB === 2) {\n if (hasProper) im.setAtLeast('212101212')\n } else if (dimA === 2 && dimB === 1) {\n if (hasProper) im.setAtLeast('FFF0FFFF2')\n if (hasProperInterior) im.setAtLeast('1FFFFF1FF')\n } else if (dimA === 1 && dimB === 2) {\n if (hasProper) im.setAtLeast('F0FFFFFF2')\n if (hasProperInterior) im.setAtLeast('1F1FFFFFF')\n } else if (dimA === 1 && dimB === 1) {\n if (hasProperInterior) im.setAtLeast('0FFFFFFFF')\n }\n }\n labelIsolatedEdges(thisIndex, targetIndex) {\n for (let ei = this._arg[thisIndex].getEdgeIterator(); ei.hasNext(); ) {\n const e = ei.next()\n if (e.isIsolated()) {\n this.labelIsolatedEdge(e, targetIndex, this._arg[targetIndex].getGeometry())\n this._isolatedEdges.add(e)\n }\n }\n }\n labelIsolatedEdge(e, targetIndex, target) {\n if (target.getDimension() > 0) {\n const loc = this._ptLocator.locate(e.getCoordinate(), target)\n e.getLabel().setAllLocations(targetIndex, loc)\n } else {\n e.getLabel().setAllLocations(targetIndex, Location.EXTERIOR)\n }\n }\n computeIM() {\n const im = new IntersectionMatrix()\n im.set(Location.EXTERIOR, Location.EXTERIOR, 2)\n if (!this._arg[0].getGeometry().getEnvelopeInternal().intersects(this._arg[1].getGeometry().getEnvelopeInternal())) {\n this.computeDisjointIM(im)\n return im\n }\n this._arg[0].computeSelfNodes(this._li, false)\n this._arg[1].computeSelfNodes(this._li, false)\n const intersector = this._arg[0].computeEdgeIntersections(this._arg[1], this._li, false)\n this.computeIntersectionNodes(0)\n this.computeIntersectionNodes(1)\n this.copyNodesAndLabels(0)\n this.copyNodesAndLabels(1)\n this.labelIsolatedNodes()\n this.computeProperIntersectionIM(intersector, im)\n const eeBuilder = new EdgeEndBuilder()\n const ee0 = eeBuilder.computeEdgeEnds(this._arg[0].getEdgeIterator())\n this.insertEdgeEnds(ee0)\n const ee1 = eeBuilder.computeEdgeEnds(this._arg[1].getEdgeIterator())\n this.insertEdgeEnds(ee1)\n this.labelNodeEdges()\n this.labelIsolatedEdges(0, 1)\n this.labelIsolatedEdges(1, 0)\n this.updateIM(im)\n return im\n }\n labelNodeEdges() {\n for (let ni = this._nodes.iterator(); ni.hasNext(); ) {\n const node = ni.next()\n node.getEdges().computeLabelling(this._arg)\n }\n }\n copyNodesAndLabels(argIndex) {\n for (let i = this._arg[argIndex].getNodeIterator(); i.hasNext(); ) {\n const graphNode = i.next()\n const newNode = this._nodes.addNode(graphNode.getCoordinate())\n newNode.setLabel(argIndex, graphNode.getLabel().getLocation(argIndex))\n }\n }\n labelIntersectionNodes(argIndex) {\n for (let i = this._arg[argIndex].getEdgeIterator(); i.hasNext(); ) {\n const e = i.next()\n const eLoc = e.getLabel().getLocation(argIndex)\n for (let eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {\n const ei = eiIt.next()\n const n = this._nodes.find(ei.coord)\n if (n.getLabel().isNull(argIndex)) \n if (eLoc === Location.BOUNDARY) n.setLabelBoundary(argIndex); else n.setLabel(argIndex, Location.INTERIOR)\n \n }\n }\n }\n labelIsolatedNode(n, targetIndex) {\n const loc = this._ptLocator.locate(n.getCoordinate(), this._arg[targetIndex].getGeometry())\n n.getLabel().setAllLocations(targetIndex, loc)\n }\n computeIntersectionNodes(argIndex) {\n for (let i = this._arg[argIndex].getEdgeIterator(); i.hasNext(); ) {\n const e = i.next()\n const eLoc = e.getLabel().getLocation(argIndex)\n for (let eiIt = e.getEdgeIntersectionList().iterator(); eiIt.hasNext(); ) {\n const ei = eiIt.next()\n const n = this._nodes.addNode(ei.coord)\n if (eLoc === Location.BOUNDARY) n.setLabelBoundary(argIndex); else \n if (n.getLabel().isNull(argIndex)) n.setLabel(argIndex, Location.INTERIOR)\n \n }\n }\n }\n labelIsolatedNodes() {\n for (let ni = this._nodes.iterator(); ni.hasNext(); ) {\n const n = ni.next()\n const label = n.getLabel()\n Assert.isTrue(label.getGeometryCount() > 0, 'node with empty label found')\n if (n.isIsolated()) \n if (label.isNull(0)) this.labelIsolatedNode(n, 0); else this.labelIsolatedNode(n, 1)\n \n }\n }\n updateIM(im) {\n for (let ei = this._isolatedEdges.iterator(); ei.hasNext(); ) {\n const e = ei.next()\n e.updateIM(im)\n }\n for (let ni = this._nodes.iterator(); ni.hasNext(); ) {\n const node = ni.next()\n node.updateIM(im)\n node.updateIMFromEdges(im)\n }\n }\n computeDisjointIM(im) {\n const ga = this._arg[0].getGeometry()\n if (!ga.isEmpty()) {\n im.set(Location.INTERIOR, Location.EXTERIOR, ga.getDimension())\n im.set(Location.BOUNDARY, Location.EXTERIOR, ga.getBoundaryDimension())\n }\n const gb = this._arg[1].getGeometry()\n if (!gb.isEmpty()) {\n im.set(Location.EXTERIOR, Location.INTERIOR, gb.getDimension())\n im.set(Location.EXTERIOR, Location.BOUNDARY, gb.getBoundaryDimension())\n }\n }\n}\n","import LineString from '../../geom/LineString.js'\nimport Coordinate from '../../geom/Coordinate.js'\nimport Point from '../../geom/Point.js'\nimport Polygon from '../../geom/Polygon.js'\nexport default class RectangleContains {\n constructor() {\n RectangleContains.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectEnv = null\n const rectangle = arguments[0]\n this._rectEnv = rectangle.getEnvelopeInternal()\n }\n static contains(rectangle, b) {\n const rc = new RectangleContains(rectangle)\n return rc.contains(b)\n }\n isContainedInBoundary(geom) {\n if (geom instanceof Polygon) return false\n if (geom instanceof Point) return this.isPointContainedInBoundary(geom)\n if (geom instanceof LineString) return this.isLineStringContainedInBoundary(geom)\n for (let i = 0; i < geom.getNumGeometries(); i++) {\n const comp = geom.getGeometryN(i)\n if (!this.isContainedInBoundary(comp)) return false\n }\n return true\n }\n isLineSegmentContainedInBoundary(p0, p1) {\n if (p0.equals(p1)) return this.isPointContainedInBoundary(p0)\n if (p0.x === p1.x) {\n if (p0.x === this._rectEnv.getMinX() || p0.x === this._rectEnv.getMaxX()) return true\n } else if (p0.y === p1.y) {\n if (p0.y === this._rectEnv.getMinY() || p0.y === this._rectEnv.getMaxY()) return true\n }\n return false\n }\n isLineStringContainedInBoundary(line) {\n const seq = line.getCoordinateSequence()\n const p0 = new Coordinate()\n const p1 = new Coordinate()\n for (let i = 0; i < seq.size() - 1; i++) {\n seq.getCoordinate(i, p0)\n seq.getCoordinate(i + 1, p1)\n if (!this.isLineSegmentContainedInBoundary(p0, p1)) return false\n }\n return true\n }\n isPointContainedInBoundary() {\n if (arguments[0] instanceof Point) {\n const point = arguments[0]\n return this.isPointContainedInBoundary(point.getCoordinate())\n } else if (arguments[0] instanceof Coordinate) {\n const pt = arguments[0]\n return pt.x === this._rectEnv.getMinX() || pt.x === this._rectEnv.getMaxX() || pt.y === this._rectEnv.getMinY() || pt.y === this._rectEnv.getMaxY()\n }\n }\n contains(geom) {\n if (!this._rectEnv.contains(geom.getEnvelopeInternal())) return false\n if (this.isContainedInBoundary(geom)) return false\n return true\n }\n}\n","import Coordinate from '../geom/Coordinate.js'\nimport RobustLineIntersector from './RobustLineIntersector.js'\nimport Envelope from '../geom/Envelope.js'\nexport default class RectangleLineIntersector {\n constructor() {\n RectangleLineIntersector.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._li = new RobustLineIntersector()\n this._rectEnv = null\n this._diagUp0 = null\n this._diagUp1 = null\n this._diagDown0 = null\n this._diagDown1 = null\n const rectEnv = arguments[0]\n this._rectEnv = rectEnv\n this._diagUp0 = new Coordinate(rectEnv.getMinX(), rectEnv.getMinY())\n this._diagUp1 = new Coordinate(rectEnv.getMaxX(), rectEnv.getMaxY())\n this._diagDown0 = new Coordinate(rectEnv.getMinX(), rectEnv.getMaxY())\n this._diagDown1 = new Coordinate(rectEnv.getMaxX(), rectEnv.getMinY())\n }\n intersects(p0, p1) {\n const segEnv = new Envelope(p0, p1)\n if (!this._rectEnv.intersects(segEnv)) return false\n if (this._rectEnv.intersects(p0)) return true\n if (this._rectEnv.intersects(p1)) return true\n if (p0.compareTo(p1) > 0) {\n const tmp = p0\n p0 = p1\n p1 = tmp\n }\n let isSegUpwards = false\n if (p1.y > p0.y) isSegUpwards = true\n if (isSegUpwards) \n this._li.computeIntersection(p0, p1, this._diagDown0, this._diagDown1)\n else \n this._li.computeIntersection(p0, p1, this._diagUp0, this._diagUp1)\n \n if (this._li.hasIntersection()) return true\n return false\n }\n}\n","import GeometryCollection from '../GeometryCollection.js'\nexport default class ShortCircuitedGeometryVisitor {\n constructor() {\n ShortCircuitedGeometryVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._isDone = false\n }\n applyTo(geom) {\n for (let i = 0; i < geom.getNumGeometries() && !this._isDone; i++) {\n const element = geom.getGeometryN(i)\n if (!(element instanceof GeometryCollection)) {\n this.visit(element)\n if (this.isDone()) {\n this._isDone = true\n return null\n }\n } else {\n this.applyTo(element)\n }\n }\n }\n}\n","import Coordinate from '../../geom/Coordinate.js'\nimport Polygon from '../../geom/Polygon.js'\nimport RectangleLineIntersector from '../../algorithm/RectangleLineIntersector.js'\nimport ShortCircuitedGeometryVisitor from '../../geom/util/ShortCircuitedGeometryVisitor.js'\nimport SimplePointInAreaLocator from '../../algorithm/locate/SimplePointInAreaLocator.js'\nimport LinearComponentExtracter from '../../geom/util/LinearComponentExtracter.js'\nexport default class RectangleIntersects {\n constructor() {\n RectangleIntersects.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectangle = null\n this._rectEnv = null\n const rectangle = arguments[0]\n this._rectangle = rectangle\n this._rectEnv = rectangle.getEnvelopeInternal()\n }\n static intersects(rectangle, b) {\n const rp = new RectangleIntersects(rectangle)\n return rp.intersects(b)\n }\n intersects(geom) {\n if (!this._rectEnv.intersects(geom.getEnvelopeInternal())) return false\n const visitor = new EnvelopeIntersectsVisitor(this._rectEnv)\n visitor.applyTo(geom)\n if (visitor.intersects()) return true\n const ecpVisitor = new GeometryContainsPointVisitor(this._rectangle)\n ecpVisitor.applyTo(geom)\n if (ecpVisitor.containsPoint()) return true\n const riVisitor = new RectangleIntersectsSegmentVisitor(this._rectangle)\n riVisitor.applyTo(geom)\n if (riVisitor.intersects()) return true\n return false\n }\n}\nclass EnvelopeIntersectsVisitor extends ShortCircuitedGeometryVisitor {\n constructor() {\n super()\n EnvelopeIntersectsVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectEnv = null\n this._intersects = false\n const rectEnv = arguments[0]\n this._rectEnv = rectEnv\n }\n isDone() {\n return this._intersects === true\n }\n visit(element) {\n const elementEnv = element.getEnvelopeInternal()\n if (!this._rectEnv.intersects(elementEnv)) \n return null\n \n if (this._rectEnv.contains(elementEnv)) {\n this._intersects = true\n return null\n }\n if (elementEnv.getMinX() >= this._rectEnv.getMinX() && elementEnv.getMaxX() <= this._rectEnv.getMaxX()) {\n this._intersects = true\n return null\n }\n if (elementEnv.getMinY() >= this._rectEnv.getMinY() && elementEnv.getMaxY() <= this._rectEnv.getMaxY()) {\n this._intersects = true\n return null\n }\n }\n intersects() {\n return this._intersects\n }\n}\nclass GeometryContainsPointVisitor extends ShortCircuitedGeometryVisitor {\n constructor() {\n super()\n GeometryContainsPointVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectSeq = null\n this._rectEnv = null\n this._containsPoint = false\n const rectangle = arguments[0]\n this._rectSeq = rectangle.getExteriorRing().getCoordinateSequence()\n this._rectEnv = rectangle.getEnvelopeInternal()\n }\n isDone() {\n return this._containsPoint === true\n }\n visit(geom) {\n if (!(geom instanceof Polygon)) return null\n const elementEnv = geom.getEnvelopeInternal()\n if (!this._rectEnv.intersects(elementEnv)) return null\n const rectPt = new Coordinate()\n for (let i = 0; i < 4; i++) {\n this._rectSeq.getCoordinate(i, rectPt)\n if (!elementEnv.contains(rectPt)) continue\n if (SimplePointInAreaLocator.containsPointInPolygon(rectPt, geom)) {\n this._containsPoint = true\n return null\n }\n }\n }\n containsPoint() {\n return this._containsPoint\n }\n}\nclass RectangleIntersectsSegmentVisitor extends ShortCircuitedGeometryVisitor {\n constructor() {\n super()\n RectangleIntersectsSegmentVisitor.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._rectEnv = null\n this._rectIntersector = null\n this._hasIntersection = false\n this._p0 = new Coordinate()\n this._p1 = new Coordinate()\n const rectangle = arguments[0]\n this._rectEnv = rectangle.getEnvelopeInternal()\n this._rectIntersector = new RectangleLineIntersector(this._rectEnv)\n }\n intersects() {\n return this._hasIntersection\n }\n isDone() {\n return this._hasIntersection === true\n }\n visit(geom) {\n const elementEnv = geom.getEnvelopeInternal()\n if (!this._rectEnv.intersects(elementEnv)) return null\n const lines = LinearComponentExtracter.getLines(geom)\n this.checkIntersectionWithLineStrings(lines)\n }\n checkIntersectionWithLineStrings(lines) {\n for (let i = lines.iterator(); i.hasNext(); ) {\n const testLine = i.next()\n this.checkIntersectionWithSegments(testLine)\n if (this._hasIntersection) return null\n }\n }\n checkIntersectionWithSegments(testLine) {\n const seq1 = testLine.getCoordinateSequence()\n for (let j = 1; j < seq1.size(); j++) {\n seq1.getCoordinate(j - 1, this._p0)\n seq1.getCoordinate(j, this._p1)\n if (this._rectIntersector.intersects(this._p0, this._p1)) {\n this._hasIntersection = true\n return null\n }\n }\n }\n}\n","import RelateComputer from './RelateComputer.js'\nimport GeometryGraphOperation from '../GeometryGraphOperation.js'\nimport RectangleContains from '../predicate/RectangleContains.js'\nimport RectangleIntersects from '../predicate/RectangleIntersects.js'\nexport default class RelateOp extends GeometryGraphOperation {\n constructor() {\n super()\n RelateOp.constructor_.apply(this, arguments)\n }\n static constructor_() {\n this._relate = null\n if (arguments.length === 2) {\n const g0 = arguments[0], g1 = arguments[1]\n GeometryGraphOperation.constructor_.call(this, g0, g1)\n this._relate = new RelateComputer(this._arg)\n } else if (arguments.length === 3) {\n const g0 = arguments[0], g1 = arguments[1], boundaryNodeRule = arguments[2]\n GeometryGraphOperation.constructor_.call(this, g0, g1, boundaryNodeRule)\n this._relate = new RelateComputer(this._arg)\n }\n }\n static covers(g1, g2) {\n if (g2.getDimension() === 2 && g1.getDimension() < 2) \n return false\n \n if (g2.getDimension() === 1 && g1.getDimension() < 1 && g2.getLength() > 0.0) \n return false\n \n if (!g1.getEnvelopeInternal().covers(g2.getEnvelopeInternal())) return false\n if (g1.isRectangle()) \n return true\n \n return new RelateOp(g1, g2).getIntersectionMatrix().isCovers()\n }\n static intersects(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n if (g1.isRectangle()) \n return RectangleIntersects.intersects(g1, g2)\n \n if (g2.isRectangle()) \n return RectangleIntersects.intersects(g2, g1)\n \n if (g1.isGeometryCollection() || g2.isGeometryCollection()) {\n const r = false\n for (let i = 0; i < g1.getNumGeometries(); i++) \n for (let j = 0; j < g2.getNumGeometries(); j++) \n if (g1.getGeometryN(i).intersects(g2.getGeometryN(j))) \n return true\n \n \n \n return false\n }\n return new RelateOp(g1, g2).getIntersectionMatrix().isIntersects()\n }\n static touches(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n return new RelateOp(g1, g2).getIntersectionMatrix().isTouches(g1.getDimension(), g2.getDimension())\n }\n static equalsTopo(g1, g2) {\n if (!g1.getEnvelopeInternal().equals(g2.getEnvelopeInternal())) return false\n return RelateOp.relate(g1, g2).isEquals(g1.getDimension(), g2.getDimension())\n }\n static relate() {\n if (arguments.length === 2) {\n const a = arguments[0], b = arguments[1]\n const relOp = new RelateOp(a, b)\n const im = relOp.getIntersectionMatrix()\n return im\n } else if (arguments.length === 3) {\n const a = arguments[0], b = arguments[1], boundaryNodeRule = arguments[2]\n const relOp = new RelateOp(a, b, boundaryNodeRule)\n const im = relOp.getIntersectionMatrix()\n return im\n }\n }\n static overlaps(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n return new RelateOp(g1, g2).getIntersectionMatrix().isOverlaps(g1.getDimension(), g2.getDimension())\n }\n static crosses(g1, g2) {\n if (!g1.getEnvelopeInternal().intersects(g2.getEnvelopeInternal())) return false\n return new RelateOp(g1, g2).getIntersectionMatrix().isCrosses(g1.getDimension(), g2.getDimension())\n }\n static contains(g1, g2) {\n if (g2.getDimension() === 2 && g1.getDimension() < 2) \n return false\n \n if (g2.getDimension() === 1 && g1.getDimension() < 1 && g2.getLength() > 0.0) \n return false\n \n if (!g1.getEnvelopeInternal().contains(g2.getEnvelopeInternal())) return false\n if (g1.isRectangle()) \n return RectangleContains.contains(g1, g2)\n \n return new RelateOp(g1, g2).getIntersectionMatrix().isContains()\n }\n getIntersectionMatrix() {\n return this._relate.computeIM()\n }\n}\n","import SnapIfNeededOverlayOp from '../overlay/snap/SnapIfNeededOverlayOp.js'\nimport OverlayOp from '../overlay/OverlayOp.js'\nexport default class UnionOp {\n get interfaces_() {\n return []\n }\n\n getClass() {\n return UnionOp\n }\n\n static union(g, other) {\n if (g.isEmpty() || other.isEmpty()) {\n if (g.isEmpty() && other.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.UNION, g, other, g.getFactory())\n if (g.isEmpty()) return other.copy()\n if (other.isEmpty()) return g.copy()\n }\n g.checkNotGeometryCollection(g)\n g.checkNotGeometryCollection(other)\n return SnapIfNeededOverlayOp.overlayOp(g, other, OverlayOp.UNION)\n }\n}\n","import Coordinate from \"jsts/org/locationtech/jts/geom/Coordinate.js\";\nimport GeometryFactory from \"jsts/org/locationtech/jts/geom/GeometryFactory.js\";\nimport PrecisionModel from \"jsts/org/locationtech/jts/geom/PrecisionModel.js\";\nimport WKTReader from \"jsts/org/locationtech/jts/io/WKTReader.js\";\nimport WKTWriter from \"jsts/org/locationtech/jts/io/WKTWriter.js\";\nimport { BufferOp } from \"jsts/org/locationtech/jts/operation/buffer\";\nimport OverlayOp from \"jsts/org/locationtech/jts/operation/overlay/OverlayOp.js\";\nimport RelateOp from \"jsts/org/locationtech/jts/operation/relate/RelateOp.js\";\nimport UnionOp from \"jsts/org/locationtech/jts/operation/union/UnionOp.js\";\n\n// TODO: various geometry patched functions don't show up in node module\n// see jsts monkey.js for patching\n\nexport const difference = (g1, g2) => {\n return OverlayOp.difference(g1, g2);\n};\n\nexport const intersects = (g1, g2) => {\n return RelateOp.intersects(g1, g2);\n};\n\nexport const touches = (g1, g2) => {\n return RelateOp.touches(g1, g2);\n};\n\nexport const union = (g1, g2) => {\n return UnionOp.union(g1, g2);\n};\n\nexport const intersection = (g1, g2) => {\n return OverlayOp.intersection(g1, g2);\n};\n\nexport const contains = (g1, g2) => {\n return RelateOp.contains(g1, g2);\n};\n\nexport const expandGeometry = (geometry, distance) => {\n return BufferOp.bufferOp(geometry, distance).norm();\n};\n\nexport const geometryToWkt = (geometry) => {\n if (!geometry) {\n return null;\n }\n const precisionModel = new PrecisionModel();\n const factory = new GeometryFactory(precisionModel);\n const wktWriter = new WKTWriter(factory);\n return wktWriter.write(geometry);\n};\n\nexport const wktToGeometry = (wkt) => {\n if (!wkt) {\n return null;\n }\n const wktReader = new WKTReader();\n return wktReader.read(wkt);\n};\n\n// {x, y, height, width}\nexport const rectToPolygon = (rect) => {\n const reader = new WKTReader();\n const polyString = rectToWKTPolygonString(rect);\n return reader.read(polyString);\n};\n\n// {x, y, height, width}\nexport const rectToWKTPolygonString = (rect) => {\n const p = [\n rect.x,\n rect.y,\n rect.x + rect.width,\n rect.y,\n rect.x + rect.width,\n rect.y + rect.height,\n rect.x,\n rect.y + rect.height,\n // close off poly\n rect.x,\n rect.y,\n ];\n return `POLYGON((${p[0]} ${p[1]}, ${p[2]} ${p[3]}, ${p[4]} ${p[5]}, ${p[6]} ${p[7]}, ${p[8]} ${p[9]}))`;\n};\n\nexport const twoPointsToLineString = (x1, y1, x2, y2) => {\n return new GeometryFactory().createLineString([\n new Coordinate(x1, y1),\n new Coordinate(x2, y2),\n ]);\n};\n\n// [[x,y]...]\nexport const pointsToPolygon = (points) => {\n const coords = points.map((p) => new Coordinate(p[0], p[1]));\n return new GeometryFactory().createPolygon(coords);\n};\n\nexport const slope = (x1, y1, x2, y2) => {\n if (x1 === x2) {\n // vertical line has undefined slope\n return Infinity;\n }\n return (y2 - y1) / (x2 - x1);\n};\n\nexport const inverseSlope = (slope) => {\n if (slope === Infinity) {\n // vertical line; inverse/perpendicular is horizontal\n return 0.0;\n }\n if (slope === 0) {\n // horizontal line; inverse/pendendicular is vertical\n return Infinity;\n }\n return -1.0 / slope;\n};\n\nexport const distanceBetweenPoints = (x1, y1, x2, y2) => {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n};\n\nexport const comparePoints = (x1, y1, x2, y2) => {\n if (x1 < x2 || (x1 === x2 && y1 < y2)) {\n // less than\n return -1;\n } else if (x1 === x2 && y1 === y2) {\n // equal\n return 0;\n } else {\n // greater than\n return 1;\n }\n};\n\nexport const lesserPoint = (x1, y1, x2, y2) => {\n if (comparePoints(x1, y1, x2, y2) === -1) {\n return [x1, y1];\n }\n return [x2, y2];\n};\n\nexport const greaterPoint = (x1, y1, x2, y2) => {\n if (comparePoints(x1, y1, x2, y2) !== -1) {\n return [x1, y1];\n }\n return [x2, y2];\n};\n\nexport const rectangleForSegment = (thickness, x1, y1, x2, y2) => {\n const m = slope(x1, y1, x2, y2);\n const rectDelta = thickness / 2.0;\n\n // slope is delta y / delta x\n if (m === 0) {\n // door is horizontal\n return [\n x1,\n y1 + rectDelta,\n x2,\n y1 + rectDelta,\n x2,\n y1 - rectDelta,\n x1,\n y1 - rectDelta,\n ];\n }\n if (m === Infinity) {\n // door is vertical\n return [\n x1 - rectDelta,\n y1,\n x1 - rectDelta,\n y2,\n x2 + rectDelta,\n y2,\n x2 + rectDelta,\n y1,\n ];\n }\n\n // https://math.stackexchange.com/questions/656500/given-a-point-slope-and-a-distance-along-that-slope-easily-find-a-second-p/656512\n const theta = Math.atan(m);\n // flipped dx/dy and +/- to make things work\n const dy = rectDelta * Math.cos(theta);\n const dx = rectDelta * Math.sin(theta);\n return [\n // lower right - more x, more y\n x1 - dx,\n y1 + dy,\n // upper right - more x, less y\n x2 - dx,\n y2 + dy,\n // upper left - less x, less y\n x2 + dx,\n y2 - dy,\n // lower left - less x, more y\n x1 + dx,\n y1 - dy,\n // close the polygon\n x1 + dy,\n y1 - dx,\n ];\n};\n","import { makeWalls } from \"./wallmaker.js\";\nimport * as geo from \"./geo-utils.js\";\nimport { defaultConfig } from \"./themes.js\";\n\nexport class DungeonState {\n static FLAG_KEY = \"dungeonState\";\n\n constructor(geometry, themeAreas, doors, secretDoors, interiorWalls, config) {\n this.geometry = geometry;\n this.themeAreas = themeAreas;\n this.doors = doors;\n this.secretDoors = secretDoors;\n this.interiorWalls = interiorWalls;\n this.config = config;\n }\n\n static startState() {\n return new DungeonState(null, [], [], [], [], defaultConfig());\n }\n\n clone() {\n return new DungeonState(\n this.geometry ? this.geometry.copy() : null,\n JSON.parse(JSON.stringify(this.themeAreas)),\n JSON.parse(JSON.stringify(this.doors)),\n this.secretDoors ? [...this.secretDoors] : [],\n this.interiorWalls ? [...this.interiorWalls] : [],\n JSON.parse(JSON.stringify(this.config))\n );\n }\n\n /* -------------------------------------------- */\n\n toString() {\n return JSON.stringify({\n // serialize the geometry object as a WKT string\n wkt: geo.geometryToWkt(this.geometry),\n themeAreas: this.themeAreas,\n doors: this.doors,\n secretDoors: this.secretDoors,\n interiorWalls: this.interiorWalls,\n config: this.config,\n });\n }\n\n // TODO: implement as fromJSON?\n static fromString(s) {\n if (!s) {\n return DungeonState.startState();\n }\n const obj = JSON.parse(s);\n const geometry = geo.wktToGeometry(obj.wkt);\n const themeAreas = obj.themeAreas ? obj.themeAreas : [];\n const doors = obj.doors ? obj.doors : [];\n const secretDoors = obj.secretDoors ? obj.secretDoors : [];\n const interiorWalls = obj.interiorWalls ? obj.interiorWalls : [];\n // fill in any new defaults\n const config = foundry.utils.mergeObject(defaultConfig(), obj.config);\n return new DungeonState(\n geometry,\n themeAreas,\n doors,\n secretDoors,\n interiorWalls,\n config\n );\n }\n\n /* -------------------------------------------- */\n\n async saveToJournalEntry(journalEntry) {\n const serialized = this.toString();\n // update walls before we update the journal\n await makeWalls(this);\n await journalEntry.update({\n content: serialized,\n });\n }\n\n static async loadFromJournalEntry(journalEntry) {\n if (journalEntry.data.content) {\n console.log(`Loading dungeon from JournalEntry ${journalEntry.name}`);\n return DungeonState.fromString(journalEntry.data.content);\n } else {\n console.log(\"Loading dungeon from start state\");\n return DungeonState.startState();\n }\n }\n}\n","/*!\n * pixi-filters - v4.1.5\n * Compiled Wed, 29 Sep 2021 14:05:57 UTC\n *\n * pixi-filters is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nvar __filters=function(e,n,t,r,o,i,l,a){\"use strict\";var s=function(e,n){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})(e,n)};function u(e,n){function t(){this.constructor=e}s(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var f=function(){return(f=Object.assign||function(e){for(var n,t=arguments,r=1,o=arguments.length;r 0.0) {\\n c.rgb /= c.a;\\n\\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\\n rgb.r *= red;\\n rgb.g *= green;\\n rgb.b *= blue;\\n c.rgb = rgb * brightness;\\n\\n c.rgb *= c.a;\\n }\\n\\n gl_FragColor = c * alpha;\\n}\\n\")||this;return t.gamma=1,t.saturation=1,t.contrast=1,t.brightness=1,t.red=1,t.green=1,t.blue=1,t.alpha=1,Object.assign(t,n),t}return u(n,e),n.prototype.apply=function(e,n,t,r){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,n,t,r)},n}(n.Filter),p=function(e){function n(n){void 0===n&&(n=.5);var t=e.call(this,c,\"\\nuniform sampler2D uSampler;\\nvarying vec2 vTextureCoord;\\n\\nuniform float threshold;\\n\\nvoid main() {\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n\\n // A simple & fast algorithm for getting brightness.\\n // It's inaccuracy , but good enought for this feature.\\n float _max = max(max(color.r, color.g), color.b);\\n float _min = min(min(color.r, color.g), color.b);\\n float brightness = (_max + _min) * 0.5;\\n\\n if(brightness > threshold) {\\n gl_FragColor = color;\\n } else {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\\n }\\n}\\n\")||this;return t.threshold=n,t}return u(n,e),Object.defineProperty(n.prototype,\"threshold\",{get:function(){return this.uniforms.threshold},set:function(e){this.uniforms.threshold=e},enumerable:!1,configurable:!0}),n}(n.Filter),d=function(e){function n(n,r,o){void 0===n&&(n=4),void 0===r&&(r=3),void 0===o&&(o=!1);var i=e.call(this,c,o?\"\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec2 uOffset;\\nuniform vec4 filterClamp;\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n\\n // Sample top left pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Sample top right pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Sample bottom right pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Sample bottom left pixel\\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\\n\\n // Average\\n color *= 0.25;\\n\\n gl_FragColor = color;\\n}\\n\":\"\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec2 uOffset;\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n\\n // Sample top left pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\\n\\n // Sample top right pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\\n\\n // Sample bottom right pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\\n\\n // Sample bottom left pixel\\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\\n\\n // Average\\n color *= 0.25;\\n\\n gl_FragColor = color;\\n}\")||this;return i._kernels=[],i._blur=4,i._quality=3,i.uniforms.uOffset=new Float32Array(2),i._pixelSize=new t.Point,i.pixelSize=1,i._clamp=o,Array.isArray(n)?i.kernels=n:(i._blur=n,i.quality=r),i}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i=this._pixelSize.x/n._frame.width,l=this._pixelSize.y/n._frame.height;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*i,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,n,t,r);else{for(var a=e.getFilterTexture(),s=n,u=a,f=void 0,c=this._quality-1,m=0;m0)for(var r=e,o=e/n,i=1;i0?(this._kernels=e,this._quality=e.length,this._blur=Math.max.apply(Math,e)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"clamp\",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"pixelSize\",{get:function(){return this._pixelSize},set:function(e){\"number\"==typeof e?(this._pixelSize.x=e,this._pixelSize.y=e):Array.isArray(e)?(this._pixelSize.x=e[0],this._pixelSize.y=e[1]):e instanceof t.Point?(this._pixelSize.x=e.x,this._pixelSize.y=e.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"quality\",{get:function(){return this._quality},set:function(e){this._quality=Math.max(1,Math.round(e)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blur\",{get:function(){return this._blur},set:function(e){this._blur=e,this._generateKernels()},enumerable:!1,configurable:!0}),n}(n.Filter),h=function(e){function n(t){var o=e.call(this,c,\"uniform sampler2D uSampler;\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D bloomTexture;\\nuniform float bloomScale;\\nuniform float brightness;\\n\\nvoid main() {\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n color.rgb *= brightness;\\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\\n bloomColor.rgb *= bloomScale;\\n gl_FragColor = color + bloomColor;\\n}\\n\")||this;o.bloomScale=1,o.brightness=1,o._resolution=r.settings.FILTER_RESOLUTION,\"number\"==typeof t&&(t={threshold:t});var i=Object.assign(n.defaults,t);o.bloomScale=i.bloomScale,o.brightness=i.brightness;var l=i.kernels,a=i.blur,s=i.quality,u=i.pixelSize,f=i.resolution;return o._extractFilter=new p(i.threshold),o._extractFilter.resolution=f,o._blurFilter=l?new d(l):new d(a,s),o.pixelSize=u,o.resolution=f,o}return u(n,e),n.prototype.apply=function(e,n,t,r,o){var i=e.getFilterTexture();this._extractFilter.apply(e,n,i,1,o);var l=e.getFilterTexture();this._blurFilter.apply(e,i,l,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,e.applyFilter(this,n,t,r),e.returnFilterTexture(l),e.returnFilterTexture(i)},Object.defineProperty(n.prototype,\"resolution\",{get:function(){return this._resolution},set:function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"threshold\",{get:function(){return this._extractFilter.threshold},set:function(e){this._extractFilter.threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"kernels\",{get:function(){return this._blurFilter.kernels},set:function(e){this._blurFilter.kernels=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blur\",{get:function(){return this._blurFilter.blur},set:function(e){this._blurFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"quality\",{get:function(){return this._blurFilter.quality},set:function(e){this._blurFilter.quality=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"pixelSize\",{get:function(){return this._blurFilter.pixelSize},set:function(e){this._blurFilter.pixelSize=e},enumerable:!1,configurable:!0}),n.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:r.settings.FILTER_RESOLUTION},n}(n.Filter),g=function(e){function n(n){void 0===n&&(n=8);var t=e.call(this,c,\"varying vec2 vTextureCoord;\\n\\nuniform vec4 filterArea;\\nuniform float pixelSize;\\nuniform sampler2D uSampler;\\n\\nvec2 mapCoord( vec2 coord )\\n{\\n coord *= filterArea.xy;\\n coord += filterArea.zw;\\n\\n return coord;\\n}\\n\\nvec2 unmapCoord( vec2 coord )\\n{\\n coord -= filterArea.zw;\\n coord /= filterArea.xy;\\n\\n return coord;\\n}\\n\\nvec2 pixelate(vec2 coord, vec2 size)\\n{\\n return floor( coord / size ) * size;\\n}\\n\\nvec2 getMod(vec2 coord, vec2 size)\\n{\\n return mod( coord , size) / size;\\n}\\n\\nfloat character(float n, vec2 p)\\n{\\n p = floor(p*vec2(4.0, -4.0) + 2.5);\\n\\n if (clamp(p.x, 0.0, 4.0) == p.x)\\n {\\n if (clamp(p.y, 0.0, 4.0) == p.y)\\n {\\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\\n }\\n }\\n return 0.0;\\n}\\n\\nvoid main()\\n{\\n vec2 coord = mapCoord(vTextureCoord);\\n\\n // get the rounded color..\\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\\n pixCoord = unmapCoord(pixCoord);\\n\\n vec4 color = texture2D(uSampler, pixCoord);\\n\\n // determine the character to use\\n float gray = (color.r + color.g + color.b) / 3.0;\\n\\n float n = 65536.0; // .\\n if (gray > 0.2) n = 65600.0; // :\\n if (gray > 0.3) n = 332772.0; // *\\n if (gray > 0.4) n = 15255086.0; // o\\n if (gray > 0.5) n = 23385164.0; // &\\n if (gray > 0.6) n = 15252014.0; // 8\\n if (gray > 0.7) n = 13199452.0; // @\\n if (gray > 0.8) n = 11512810.0; // #\\n\\n // get the mod..\\n vec2 modd = getMod(coord, vec2(pixelSize));\\n\\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\\n\\n}\\n\")||this;return t.size=n,t}return u(n,e),Object.defineProperty(n.prototype,\"size\",{get:function(){return this.uniforms.pixelSize},set:function(e){this.uniforms.pixelSize=e},enumerable:!1,configurable:!0}),n}(n.Filter),v=function(e){function n(n){var t=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\n\\nuniform float transformX;\\nuniform float transformY;\\nuniform vec3 lightColor;\\nuniform float lightAlpha;\\nuniform vec3 shadowColor;\\nuniform float shadowAlpha;\\n\\nvoid main(void) {\\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n float light = texture2D(uSampler, vTextureCoord - transform).a;\\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\\n\\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\\n gl_FragColor = vec4(color.rgb * color.a, color.a);\\n}\\n\")||this;return t._thickness=2,t._angle=0,t.uniforms.lightColor=new Float32Array(3),t.uniforms.shadowColor=new Float32Array(3),Object.assign(t,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},n),t.padding=1,t}return u(n,e),n.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(n.prototype,\"rotation\",{get:function(){return this._angle/t.DEG_TO_RAD},set:function(e){this._angle=e*t.DEG_TO_RAD,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"thickness\",{get:function(){return this._thickness},set:function(e){this._thickness=e,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lightColor\",{get:function(){return o.rgb2hex(this.uniforms.lightColor)},set:function(e){o.hex2rgb(e,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lightAlpha\",{get:function(){return this.uniforms.lightAlpha},set:function(e){this.uniforms.lightAlpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"shadowColor\",{get:function(){return o.rgb2hex(this.uniforms.shadowColor)},set:function(e){o.hex2rgb(e,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"shadowAlpha\",{get:function(){return this.uniforms.shadowAlpha},set:function(e){this.uniforms.shadowAlpha=e},enumerable:!1,configurable:!0}),n}(n.Filter),y=function(e){function n(n,o,s,u){void 0===n&&(n=2),void 0===o&&(o=4),void 0===s&&(s=r.settings.FILTER_RESOLUTION),void 0===u&&(u=5);var f,c,m=e.call(this)||this;return\"number\"==typeof n?(f=n,c=n):n instanceof t.Point?(f=n.x,c=n.y):Array.isArray(n)&&(f=n[0],c=n[1]),m.blurXFilter=new a.BlurFilterPass(!0,f,o,s,u),m.blurYFilter=new a.BlurFilterPass(!1,c,o,s,u),m.blurYFilter.blendMode=i.BLEND_MODES.SCREEN,m.defaultFilter=new l.AlphaFilter,m}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=e.getFilterTexture();this.defaultFilter.apply(e,n,t,r),this.blurXFilter.apply(e,n,o,1),this.blurYFilter.apply(e,o,t,0),e.returnFilterTexture(o)},Object.defineProperty(n.prototype,\"blur\",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blurX\",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blurY\",{get:function(){return this.blurYFilter.blur},set:function(e){this.blurYFilter.blur=e},enumerable:!1,configurable:!0}),n}(n.Filter),b=function(e){function n(t){var r=e.call(this,c,\"uniform float radius;\\nuniform float strength;\\nuniform vec2 center;\\nuniform sampler2D uSampler;\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\nuniform vec2 dimensions;\\n\\nvoid main()\\n{\\n vec2 coord = vTextureCoord * filterArea.xy;\\n coord -= center * dimensions.xy;\\n float distance = length(coord);\\n if (distance < radius) {\\n float percent = distance / radius;\\n if (strength > 0.0) {\\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\\n } else {\\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\\n }\\n }\\n coord += center * dimensions.xy;\\n coord /= filterArea.xy;\\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\\n vec4 color = texture2D(uSampler, clampedCoord);\\n if (coord != clampedCoord) {\\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\\n }\\n\\n gl_FragColor = color;\\n}\\n\")||this;return r.uniforms.dimensions=new Float32Array(2),Object.assign(r,n.defaults,t),r}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=n.filterFrame,i=o.width,l=o.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.radius},set:function(e){this.uniforms.radius=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"strength\",{get:function(){return this.uniforms.strength},set:function(e){this.uniforms.strength=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.center},set:function(e){this.uniforms.center=e},enumerable:!1,configurable:!0}),n.defaults={center:[.5,.5],radius:100,strength:1},n}(n.Filter),x=function(e){function t(n,t,r){void 0===t&&(t=!1),void 0===r&&(r=1);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform sampler2D colorMap;\\nuniform float _mix;\\nuniform float _size;\\nuniform float _sliceSize;\\nuniform float _slicePixelSize;\\nuniform float _sliceInnerSize;\\nvoid main() {\\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\\n\\n vec4 adjusted;\\n if (color.a > 0.0) {\\n color.rgb /= color.a;\\n float innerWidth = _size - 1.0;\\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\\n float s0 = xOffset + (zSlice0 * _sliceSize);\\n float s1 = xOffset + (zSlice1 * _sliceSize);\\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\\n float zOffset = fract(color.b * innerWidth);\\n adjusted = mix(slice0Color, slice1Color, zOffset);\\n\\n color.rgb *= color.a;\\n }\\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\\n\\n}\")||this;return o.mix=1,o._size=0,o._sliceSize=0,o._slicePixelSize=0,o._sliceInnerSize=0,o._nearest=!1,o._scaleMode=null,o._colorMap=null,o._scaleMode=null,o.nearest=t,o.mix=r,o.colorMap=n,o}return u(t,e),t.prototype.apply=function(e,n,t,r){this.uniforms._mix=this.mix,e.applyFilter(this,n,t,r)},Object.defineProperty(t.prototype,\"colorSize\",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"colorMap\",{get:function(){return this._colorMap},set:function(e){var t;e&&(e instanceof n.Texture||(e=n.Texture.from(e)),(null===(t=e)||void 0===t?void 0:t.baseTexture)&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=i.MIPMAP_MODES.OFF,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"nearest\",{get:function(){return this._nearest},set:function(e){this._nearest=e,this._scaleMode=e?i.SCALE_MODES.NEAREST:i.SCALE_MODES.LINEAR;var n=this._colorMap;n&&n.baseTexture&&(n.baseTexture._glTextures={},n.baseTexture.scaleMode=this._scaleMode,n.baseTexture.mipmap=i.MIPMAP_MODES.OFF,n._updateID++,n.baseTexture.emit(\"update\",n.baseTexture))},enumerable:!1,configurable:!0}),t.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit(\"update\",e.baseTexture),this.colorMap=e)},t.prototype.destroy=function(n){void 0===n&&(n=!1),this._colorMap&&this._colorMap.destroy(n),e.prototype.destroy.call(this)},t}(n.Filter),_=function(e){function n(n,t){void 0===n&&(n=0),void 0===t&&(t=1);var r=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec3 color;\\nuniform float alpha;\\n\\nvoid main(void) {\\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\\n gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a);\\n}\\n\")||this;return r._color=0,r._alpha=1,r.uniforms.color=new Float32Array(3),r.color=n,r.alpha=t,r}return u(n,e),Object.defineProperty(n.prototype,\"color\",{get:function(){return this._color},set:function(e){var n=this.uniforms.color;\"number\"==typeof e?(o.hex2rgb(e,n),this._color=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],this._color=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"alpha\",{get:function(){return this._alpha},set:function(e){this.uniforms.alpha=e,this._alpha=e},enumerable:!1,configurable:!0}),n}(n.Filter),C=function(e){function n(n,t,r){void 0===n&&(n=16711680),void 0===t&&(t=0),void 0===r&&(r=.4);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec3 originalColor;\\nuniform vec3 newColor;\\nuniform float epsilon;\\nvoid main(void) {\\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\\n float colorDistance = length(colorDiff);\\n float doReplace = step(colorDistance, epsilon);\\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\\n}\\n\")||this;return o._originalColor=16711680,o._newColor=0,o.uniforms.originalColor=new Float32Array(3),o.uniforms.newColor=new Float32Array(3),o.originalColor=n,o.newColor=t,o.epsilon=r,o}return u(n,e),Object.defineProperty(n.prototype,\"originalColor\",{get:function(){return this._originalColor},set:function(e){var n=this.uniforms.originalColor;\"number\"==typeof e?(o.hex2rgb(e,n),this._originalColor=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],this._originalColor=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"newColor\",{get:function(){return this._newColor},set:function(e){var n=this.uniforms.newColor;\"number\"==typeof e?(o.hex2rgb(e,n),this._newColor=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],this._newColor=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"epsilon\",{get:function(){return this.uniforms.epsilon},set:function(e){this.uniforms.epsilon=e},enumerable:!1,configurable:!0}),n}(n.Filter),S=function(e){function n(n,t,r){void 0===t&&(t=200),void 0===r&&(r=200);var o=e.call(this,c,\"precision mediump float;\\n\\nvarying mediump vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec2 texelSize;\\nuniform float matrix[9];\\n\\nvoid main(void)\\n{\\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\\n\\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\\n\\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\\n\\n gl_FragColor =\\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\\n\\n gl_FragColor.a = c22.a;\\n}\\n\")||this;return o.uniforms.texelSize=new Float32Array(2),o.uniforms.matrix=new Float32Array(9),void 0!==n&&(o.matrix=n),o.width=t,o.height=r,o}return u(n,e),Object.defineProperty(n.prototype,\"matrix\",{get:function(){return this.uniforms.matrix},set:function(e){var n=this;e.forEach((function(e,t){n.uniforms.matrix[t]=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"width\",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(e){this.uniforms.texelSize[0]=1/e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"height\",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(e){this.uniforms.texelSize[1]=1/e},enumerable:!1,configurable:!0}),n}(n.Filter),F=function(e){function n(){return e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void)\\n{\\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\\n\\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\\n\\n if (lum < 1.00)\\n {\\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.75)\\n {\\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.50)\\n {\\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n\\n if (lum < 0.3)\\n {\\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\\n {\\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\\n }\\n }\\n}\\n\")||this}return u(n,e),n}(n.Filter),z=function(e){function n(t){var r=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\nuniform vec2 dimensions;\\n\\nconst float SQRT_2 = 1.414213;\\n\\nconst float light = 1.0;\\n\\nuniform float curvature;\\nuniform float lineWidth;\\nuniform float lineContrast;\\nuniform bool verticalLine;\\nuniform float noise;\\nuniform float noiseSize;\\n\\nuniform float vignetting;\\nuniform float vignettingAlpha;\\nuniform float vignettingBlur;\\n\\nuniform float seed;\\nuniform float time;\\n\\nfloat rand(vec2 co) {\\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\\n}\\n\\nvoid main(void)\\n{\\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\\n vec2 dir = vec2(vTextureCoord.xy - vec2(0.5, 0.5)) * filterArea.xy / dimensions;\\n\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n vec3 rgb = gl_FragColor.rgb;\\n\\n if (noise > 0.0 && noiseSize > 0.0)\\n {\\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\\n rgb += _noise * noise;\\n }\\n\\n if (lineWidth > 0.0)\\n {\\n float _c = curvature > 0. ? curvature : 1.;\\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\\n vec2 uv = dir * k;\\n\\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\\n rgb *= j;\\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\\n rgb *= 0.99 + ceil(segment) * 0.015;\\n }\\n\\n if (vignetting > 0.0)\\n {\\n float outter = SQRT_2 - vignetting * SQRT_2;\\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\\n }\\n\\n gl_FragColor.rgb = rgb;\\n}\\n\")||this;return r.time=0,r.seed=0,r.uniforms.dimensions=new Float32Array(2),Object.assign(r,n.defaults,t),r}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=n.filterFrame,i=o.width,l=o.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"curvature\",{get:function(){return this.uniforms.curvature},set:function(e){this.uniforms.curvature=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lineWidth\",{get:function(){return this.uniforms.lineWidth},set:function(e){this.uniforms.lineWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"lineContrast\",{get:function(){return this.uniforms.lineContrast},set:function(e){this.uniforms.lineContrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"verticalLine\",{get:function(){return this.uniforms.verticalLine},set:function(e){this.uniforms.verticalLine=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noise\",{get:function(){return this.uniforms.noise},set:function(e){this.uniforms.noise=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noiseSize\",{get:function(){return this.uniforms.noiseSize},set:function(e){this.uniforms.noiseSize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignetting\",{get:function(){return this.uniforms.vignetting},set:function(e){this.uniforms.vignetting=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingAlpha\",{get:function(){return this.uniforms.vignettingAlpha},set:function(e){this.uniforms.vignettingAlpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingBlur\",{get:function(){return this.uniforms.vignettingBlur},set:function(e){this.uniforms.vignettingBlur=e},enumerable:!1,configurable:!0}),n.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},n}(n.Filter),O=function(e){function n(n,t){void 0===n&&(n=1),void 0===t&&(t=5);var r=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\n\\nuniform vec4 filterArea;\\nuniform sampler2D uSampler;\\n\\nuniform float angle;\\nuniform float scale;\\n\\nfloat pattern()\\n{\\n float s = sin(angle), c = cos(angle);\\n vec2 tex = vTextureCoord * filterArea.xy;\\n vec2 point = vec2(\\n c * tex.x - s * tex.y,\\n s * tex.x + c * tex.y\\n ) * scale;\\n return (sin(point.x) * sin(point.y)) * 4.0;\\n}\\n\\nvoid main()\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n float average = (color.r + color.g + color.b) / 3.0;\\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\\n}\\n\")||this;return r.scale=n,r.angle=t,r}return u(n,e),Object.defineProperty(n.prototype,\"scale\",{get:function(){return this.uniforms.scale},set:function(e){this.uniforms.scale=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"angle\",{get:function(){return this.uniforms.angle},set:function(e){this.uniforms.angle=e},enumerable:!1,configurable:!0}),n}(n.Filter),P=function(e){function i(o){var l=e.call(this)||this;l.angle=45,l._distance=5,l._resolution=r.settings.FILTER_RESOLUTION;var a=o?f(f({},i.defaults),o):i.defaults,s=a.kernels,u=a.blur,m=a.quality,p=a.pixelSize,h=a.resolution;l._tintFilter=new n.Filter(c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform float alpha;\\nuniform vec3 color;\\n\\nuniform vec2 shift;\\nuniform vec4 inputSize;\\n\\nvoid main(void){\\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\\n\\n // Premultiply alpha\\n sample.rgb = color.rgb * sample.a;\\n\\n // alpha user alpha\\n sample *= alpha;\\n\\n gl_FragColor = sample;\\n}\"),l._tintFilter.uniforms.color=new Float32Array(4),l._tintFilter.uniforms.shift=new t.Point,l._tintFilter.resolution=h,l._blurFilter=s?new d(s):new d(u,m),l.pixelSize=p,l.resolution=h;var g=a.shadowOnly,v=a.rotation,y=a.distance,b=a.alpha,x=a.color;return l.shadowOnly=g,l.rotation=v,l.distance=y,l.alpha=b,l.color=x,l._updatePadding(),l}return u(i,e),i.prototype.apply=function(e,n,t,r){var o=e.getFilterTexture();this._tintFilter.apply(e,n,o,1),this._blurFilter.apply(e,o,t,r),!0!==this.shadowOnly&&e.applyFilter(this,n,t,0),e.returnFilterTexture(o)},i.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},i.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},Object.defineProperty(i.prototype,\"resolution\",{get:function(){return this._resolution},set:function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"distance\",{get:function(){return this._distance},set:function(e){this._distance=e,this._updatePadding(),this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"rotation\",{get:function(){return this.angle/t.DEG_TO_RAD},set:function(e){this.angle=e*t.DEG_TO_RAD,this._updateShift()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"alpha\",{get:function(){return this._tintFilter.uniforms.alpha},set:function(e){this._tintFilter.uniforms.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"color\",{get:function(){return o.rgb2hex(this._tintFilter.uniforms.color)},set:function(e){o.hex2rgb(e,this._tintFilter.uniforms.color)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"kernels\",{get:function(){return this._blurFilter.kernels},set:function(e){this._blurFilter.kernels=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"blur\",{get:function(){return this._blurFilter.blur},set:function(e){this._blurFilter.blur=e,this._updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"quality\",{get:function(){return this._blurFilter.quality},set:function(e){this._blurFilter.quality=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,\"pixelSize\",{get:function(){return this._blurFilter.pixelSize},set:function(e){this._blurFilter.pixelSize=e},enumerable:!1,configurable:!0}),i.defaults={rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:r.settings.FILTER_RESOLUTION},i}(n.Filter),A=function(e){function n(n){void 0===n&&(n=5);var t=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float strength;\\nuniform vec4 filterArea;\\n\\n\\nvoid main(void)\\n{\\n\\tvec2 onePixel = vec2(1.0 / filterArea);\\n\\n\\tvec4 color;\\n\\n\\tcolor.rgb = vec3(0.5);\\n\\n\\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\\n\\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\\n\\n\\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\\n\\n\\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\\n\\n\\tgl_FragColor = vec4(color.rgb * alpha, alpha);\\n}\\n\")||this;return t.strength=n,t}return u(n,e),Object.defineProperty(n.prototype,\"strength\",{get:function(){return this.uniforms.strength},set:function(e){this.uniforms.strength=e},enumerable:!1,configurable:!0}),n}(n.Filter),T=function(e){function r(t){var o=e.call(this,c,\"// precision highp float;\\n\\nvarying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\nuniform vec2 dimensions;\\nuniform float aspect;\\n\\nuniform sampler2D displacementMap;\\nuniform float offset;\\nuniform float sinDir;\\nuniform float cosDir;\\nuniform int fillMode;\\n\\nuniform float seed;\\nuniform vec2 red;\\nuniform vec2 green;\\nuniform vec2 blue;\\n\\nconst int TRANSPARENT = 0;\\nconst int ORIGINAL = 1;\\nconst int LOOP = 2;\\nconst int CLAMP = 3;\\nconst int MIRROR = 4;\\n\\nvoid main(void)\\n{\\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\\n\\n if (coord.x > 1.0 || coord.y > 1.0) {\\n return;\\n }\\n\\n float cx = coord.x - 0.5;\\n float cy = (coord.y - 0.5) * aspect;\\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\\n\\n // displacementMap: repeat\\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\\n\\n // displacementMap: mirror\\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\\n\\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\\n\\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\\n\\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\\n\\n if (fillMode == CLAMP) {\\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\\n } else {\\n if( coord.x > filterClamp.z ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.x -= filterClamp.z;\\n } else if (fillMode == MIRROR) {\\n coord.x = filterClamp.z * 2.0 - coord.x;\\n }\\n } else if( coord.x < filterClamp.x ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.x += filterClamp.z;\\n } else if (fillMode == MIRROR) {\\n coord.x *= -filterClamp.z;\\n }\\n }\\n\\n if( coord.y > filterClamp.w ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.y -= filterClamp.w;\\n } else if (fillMode == MIRROR) {\\n coord.y = filterClamp.w * 2.0 - coord.y;\\n }\\n } else if( coord.y < filterClamp.y ) {\\n if (fillMode == TRANSPARENT) {\\n discard;\\n } else if (fillMode == LOOP) {\\n coord.y += filterClamp.w;\\n } else if (fillMode == MIRROR) {\\n coord.y *= -filterClamp.w;\\n }\\n }\\n }\\n\\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\\n gl_FragColor.a = texture2D(uSampler, coord).a;\\n}\\n\")||this;return o.offset=100,o.fillMode=r.TRANSPARENT,o.average=!1,o.seed=0,o.minSize=8,o.sampleSize=512,o._slices=0,o._offsets=new Float32Array(1),o._sizes=new Float32Array(1),o._direction=-1,o.uniforms.dimensions=new Float32Array(2),o._canvas=document.createElement(\"canvas\"),o._canvas.width=4,o._canvas.height=o.sampleSize,o.texture=n.Texture.from(o._canvas,{scaleMode:i.SCALE_MODES.NEAREST}),Object.assign(o,r.defaults,t),o}return u(r,e),r.prototype.apply=function(e,n,t,r){var o=n.filterFrame,i=o.width,l=o.height;this.uniforms.dimensions[0]=i,this.uniforms.dimensions[1]=l,this.uniforms.aspect=l/i,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,n,t,r)},r.prototype._randomizeSizes=function(){var e=this._sizes,n=this._slices-1,t=this.sampleSize,r=Math.min(this.minSize/t,.9/this._slices);if(this.average){for(var o=this._slices,i=1,l=0;l0;n--){var t=Math.random()*n>>0,r=e[n];e[n]=e[t],e[t]=r}},r.prototype._randomizeOffsets=function(){for(var e=0;e0?e:0,s=e<0?-e:0;r.fillStyle=\"rgba(\"+a+\", \"+s+\", 0, 1)\",r.fillRect(0,o>>0,n,l+1>>0),o+=l}t.baseTexture.update(),this.uniforms.displacementMap=t},Object.defineProperty(r.prototype,\"sizes\",{get:function(){return this._sizes},set:function(e){for(var n=Math.min(this._slices,e.length),t=0;t>0)},Object.defineProperty(n.prototype,\"offset\",{get:function(){return this.uniforms.uOffset},set:function(e){this.uniforms.uOffset=e},enumerable:!1,configurable:!0}),n}(n.Filter),M=function(e){function n(n,t,r){void 0===t&&(t=.05),void 0===r&&(r=n.length);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform float epsilon;\\n\\nconst int MAX_COLORS = %maxColors%;\\n\\nuniform vec3 originalColors[MAX_COLORS];\\nuniform vec3 targetColors[MAX_COLORS];\\n\\nvoid main(void)\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n\\n float alpha = gl_FragColor.a;\\n if (alpha < 0.0001)\\n {\\n return;\\n }\\n\\n vec3 color = gl_FragColor.rgb / alpha;\\n\\n for(int i = 0; i < MAX_COLORS; i++)\\n {\\n vec3 origColor = originalColors[i];\\n if (origColor.r < 0.0)\\n {\\n break;\\n }\\n vec3 colorDiff = origColor - color;\\n if (length(colorDiff) < epsilon)\\n {\\n vec3 targetColor = targetColors[i];\\n gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);\\n return;\\n }\\n }\\n}\\n\".replace(/%maxColors%/g,r.toFixed(0)))||this;return o._replacements=[],o._maxColors=0,o.epsilon=t,o._maxColors=r,o.uniforms.originalColors=new Float32Array(3*r),o.uniforms.targetColors=new Float32Array(3*r),o.replacements=n,o}return u(n,e),Object.defineProperty(n.prototype,\"replacements\",{get:function(){return this._replacements},set:function(e){var n=this.uniforms.originalColors,t=this.uniforms.targetColors,r=e.length;if(r>this._maxColors)throw new Error(\"Length of replacements (\"+r+\") exceeds the maximum colors length (\"+this._maxColors+\")\");n[3*r]=-1;for(var i=0;i 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\\n}\\n\\n\\nvoid main()\\n{\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n vec3 color = gl_FragColor.rgb;\\n\\n if (sepia > 0.0)\\n {\\n float gray = (color.x + color.y + color.z) / 3.0;\\n vec3 grayscale = vec3(gray);\\n\\n color = Overlay(SEPIA_RGB, grayscale);\\n\\n color = grayscale + sepia * (color - grayscale);\\n }\\n\\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\\n\\n if (vignetting > 0.0)\\n {\\n float outter = SQRT_2 - vignetting * SQRT_2;\\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\\n dir.y *= dimensions.y / dimensions.x;\\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\\n }\\n\\n if (scratchDensity > seed && scratch != 0.0)\\n {\\n float phase = seed * 256.0;\\n float s = mod(floor(phase), 2.0);\\n float dist = 1.0 / scratchDensity;\\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\\n if (d < seed * 0.6 + 0.4)\\n {\\n highp float period = scratchDensity * 10.0;\\n\\n float xx = coord.x * period + phase;\\n float aa = abs(mod(xx, 0.5) * 4.0);\\n float bb = mod(floor(xx / 0.5), 2.0);\\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\\n\\n float kk = 2.0 * period;\\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\\n float dh = dw * kk;\\n\\n float tine = (yy - (2.0 - dh));\\n\\n if (tine > 0.0) {\\n float _sign = sign(scratch);\\n\\n tine = s * tine / period + scratch + 0.1;\\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\\n\\n color.rgb *= tine;\\n }\\n }\\n }\\n\\n if (noise > 0.0 && noiseSize > 0.0)\\n {\\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\\n // float _noise = snoise(d) * 0.5;\\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\\n color += _noise * noise;\\n }\\n\\n gl_FragColor.rgb = color;\\n}\\n\")||this;return o.seed=0,o.uniforms.dimensions=new Float32Array(2),\"number\"==typeof t?(o.seed=t,t=void 0):o.seed=r,Object.assign(o,n.defaults,t),o}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i;this.uniforms.dimensions[0]=null===(o=n.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=n.filterFrame)||void 0===i?void 0:i.height,this.uniforms.seed=this.seed,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"sepia\",{get:function(){return this.uniforms.sepia},set:function(e){this.uniforms.sepia=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noise\",{get:function(){return this.uniforms.noise},set:function(e){this.uniforms.noise=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"noiseSize\",{get:function(){return this.uniforms.noiseSize},set:function(e){this.uniforms.noiseSize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"scratch\",{get:function(){return this.uniforms.scratch},set:function(e){this.uniforms.scratch=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"scratchDensity\",{get:function(){return this.uniforms.scratchDensity},set:function(e){this.uniforms.scratchDensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"scratchWidth\",{get:function(){return this.uniforms.scratchWidth},set:function(e){this.uniforms.scratchWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignetting\",{get:function(){return this.uniforms.vignetting},set:function(e){this.uniforms.vignetting=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingAlpha\",{get:function(){return this.uniforms.vignettingAlpha},set:function(e){this.uniforms.vignettingAlpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"vignettingBlur\",{get:function(){return this.uniforms.vignettingBlur},set:function(e){this.uniforms.vignettingBlur=e},enumerable:!1,configurable:!0}),n.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},n}(n.Filter),E=function(e){function n(t,r,o){void 0===t&&(t=1),void 0===r&&(r=0),void 0===o&&(o=.1);var i=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec2 thickness;\\nuniform vec4 outlineColor;\\nuniform vec4 filterClamp;\\n\\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\\n\\nvoid main(void) {\\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\\n vec4 curColor;\\n float maxAlpha = 0.;\\n vec2 displaced;\\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\\n maxAlpha = max(maxAlpha, curColor.a);\\n }\\n float resultAlpha = max(maxAlpha, ownColor.a);\\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\\n}\\n\".replace(/\\$\\{angleStep\\}/,n.getAngleStep(o)))||this;return i._thickness=1,i.uniforms.thickness=new Float32Array([0,0]),i.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(i,{thickness:t,color:r,quality:o}),i}return u(n,e),n.getAngleStep=function(e){var t=Math.max(e*n.MAX_SAMPLES,n.MIN_SAMPLES);return(2*Math.PI/t).toFixed(7)},n.prototype.apply=function(e,n,t,r){this.uniforms.thickness[0]=this._thickness/n._frame.width,this.uniforms.thickness[1]=this._thickness/n._frame.height,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"color\",{get:function(){return o.rgb2hex(this.uniforms.outlineColor)},set:function(e){o.hex2rgb(e,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"thickness\",{get:function(){return this._thickness},set:function(e){this._thickness=e,this.padding=e},enumerable:!1,configurable:!0}),n.MIN_SAMPLES=1,n.MAX_SAMPLES=100,n}(n.Filter),I=function(e){function n(n){void 0===n&&(n=10);var t=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec2 size;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\n\\nvec2 mapCoord( vec2 coord )\\n{\\n coord *= filterArea.xy;\\n coord += filterArea.zw;\\n\\n return coord;\\n}\\n\\nvec2 unmapCoord( vec2 coord )\\n{\\n coord -= filterArea.zw;\\n coord /= filterArea.xy;\\n\\n return coord;\\n}\\n\\nvec2 pixelate(vec2 coord, vec2 size)\\n{\\n\\treturn floor( coord / size ) * size;\\n}\\n\\nvoid main(void)\\n{\\n vec2 coord = mapCoord(vTextureCoord);\\n\\n coord = pixelate(coord, size);\\n\\n coord = unmapCoord(coord);\\n\\n gl_FragColor = texture2D(uSampler, coord);\\n}\\n\")||this;return t.size=n,t}return u(n,e),Object.defineProperty(n.prototype,\"size\",{get:function(){return this.uniforms.size},set:function(e){\"number\"==typeof e&&(e=[e,e]),this.uniforms.size=e},enumerable:!1,configurable:!0}),n}(n.Filter),k=function(e){function n(n,t,r,o){void 0===n&&(n=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===o&&(o=-1);var i=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\n\\nuniform float uRadian;\\nuniform vec2 uCenter;\\nuniform float uRadius;\\nuniform int uKernelSize;\\n\\nconst int MAX_KERNEL_SIZE = 2048;\\n\\nvoid main(void)\\n{\\n vec4 color = texture2D(uSampler, vTextureCoord);\\n\\n if (uKernelSize == 0)\\n {\\n gl_FragColor = color;\\n return;\\n }\\n\\n float aspect = filterArea.y / filterArea.x;\\n vec2 center = uCenter.xy / filterArea.xy;\\n float gradient = uRadius / filterArea.x * 0.3;\\n float radius = uRadius / filterArea.x - gradient * 0.5;\\n int k = uKernelSize - 1;\\n\\n vec2 coord = vTextureCoord;\\n vec2 dir = vec2(center - coord);\\n float dist = length(vec2(dir.x, dir.y * aspect));\\n\\n float radianStep = uRadian;\\n if (radius >= 0.0 && dist > radius) {\\n float delta = dist - radius;\\n float gap = gradient;\\n float scale = 1.0 - abs(delta / gap);\\n if (scale <= 0.0) {\\n gl_FragColor = color;\\n return;\\n }\\n radianStep *= scale;\\n }\\n radianStep /= float(k);\\n\\n float s = sin(radianStep);\\n float c = cos(radianStep);\\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\\n\\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\\n if (i == k) {\\n break;\\n }\\n\\n coord -= center;\\n coord.y *= aspect;\\n coord = rotationMatrix * coord;\\n coord.y /= aspect;\\n coord += center;\\n\\n vec4 sample = texture2D(uSampler, coord);\\n\\n // switch to pre-multiplied alpha to correctly blur transparent images\\n // sample.rgb *= sample.a;\\n\\n color += sample;\\n }\\n\\n gl_FragColor = color / float(uKernelSize);\\n}\\n\")||this;return i._angle=0,i.angle=n,i.center=t,i.kernelSize=r,i.radius=o,i}return u(n,e),n.prototype.apply=function(e,n,t,r){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"angle\",{get:function(){return this._angle},set:function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.uCenter},set:function(e){this.uniforms.uCenter=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.uRadius},set:function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},enumerable:!1,configurable:!0}),n}(n.Filter),L=function(e){function n(t){var r=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\n\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\nuniform vec2 dimensions;\\n\\nuniform bool mirror;\\nuniform float boundary;\\nuniform vec2 amplitude;\\nuniform vec2 waveLength;\\nuniform vec2 alpha;\\nuniform float time;\\n\\nfloat rand(vec2 co) {\\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\\n}\\n\\nvoid main(void)\\n{\\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\\n vec2 coord = pixelCoord / dimensions;\\n\\n if (coord.y < boundary) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n\\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\\n float areaY = boundary * dimensions.y / filterArea.y;\\n float v = areaY + areaY - vTextureCoord.y;\\n float y = mirror ? v : vTextureCoord.y;\\n\\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\\n\\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\\n x = clamp(x, filterClamp.x, filterClamp.z);\\n\\n vec4 color = texture2D(uSampler, vec2(x, y));\\n\\n gl_FragColor = color * _alpha;\\n}\\n\")||this;return r.time=0,r.uniforms.amplitude=new Float32Array(2),r.uniforms.waveLength=new Float32Array(2),r.uniforms.alpha=new Float32Array(2),r.uniforms.dimensions=new Float32Array(2),Object.assign(r,n.defaults,t),r}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i;this.uniforms.dimensions[0]=null===(o=n.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=n.filterFrame)||void 0===i?void 0:i.height,this.uniforms.time=this.time,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"mirror\",{get:function(){return this.uniforms.mirror},set:function(e){this.uniforms.mirror=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"boundary\",{get:function(){return this.uniforms.boundary},set:function(e){this.uniforms.boundary=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"amplitude\",{get:function(){return this.uniforms.amplitude},set:function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"waveLength\",{get:function(){return this.uniforms.waveLength},set:function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"alpha\",{get:function(){return this.uniforms.alpha},set:function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},enumerable:!1,configurable:!0}),n.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},n}(n.Filter),N=function(e){function n(n,t,r){void 0===n&&(n=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]);var o=e.call(this,c,\"precision mediump float;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\nuniform vec2 red;\\nuniform vec2 green;\\nuniform vec2 blue;\\n\\nvoid main(void)\\n{\\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\\n}\\n\")||this;return o.red=n,o.green=t,o.blue=r,o}return u(n,e),Object.defineProperty(n.prototype,\"red\",{get:function(){return this.uniforms.red},set:function(e){this.uniforms.red=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"green\",{get:function(){return this.uniforms.green},set:function(e){this.uniforms.green=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"blue\",{get:function(){return this.uniforms.blue},set:function(e){this.uniforms.blue=e},enumerable:!1,configurable:!0}),n}(n.Filter),X=function(e){function n(t,r,o){void 0===t&&(t=[0,0]),void 0===o&&(o=0);var i=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform vec4 filterArea;\\nuniform vec4 filterClamp;\\n\\nuniform vec2 center;\\n\\nuniform float amplitude;\\nuniform float wavelength;\\n// uniform float power;\\nuniform float brightness;\\nuniform float speed;\\nuniform float radius;\\n\\nuniform float time;\\n\\nconst float PI = 3.14159;\\n\\nvoid main()\\n{\\n float halfWavelength = wavelength * 0.5 / filterArea.x;\\n float maxRadius = radius / filterArea.x;\\n float currentRadius = time * speed / filterArea.x;\\n\\n float fade = 1.0;\\n\\n if (maxRadius > 0.0) {\\n if (currentRadius > maxRadius) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\\n }\\n\\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\\n dir.y *= filterArea.y / filterArea.x;\\n float dist = length(dir);\\n\\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n\\n vec2 diffUV = normalize(dir);\\n\\n float diff = (dist - currentRadius) / halfWavelength;\\n\\n float p = 1.0 - pow(abs(diff), 2.0);\\n\\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\\n\\n vec2 offset = diffUV * powDiff / filterArea.xy;\\n\\n // Do clamp :\\n vec2 coord = vTextureCoord + offset;\\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\\n vec4 color = texture2D(uSampler, clampedCoord);\\n if (coord != clampedCoord) {\\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\\n }\\n\\n // No clamp :\\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\\n\\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\\n\\n gl_FragColor = color;\\n}\\n\")||this;return i.center=t,Object.assign(i,n.defaults,r),i.time=o,i}return u(n,e),n.prototype.apply=function(e,n,t,r){this.uniforms.time=this.time,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.center},set:function(e){this.uniforms.center=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"amplitude\",{get:function(){return this.uniforms.amplitude},set:function(e){this.uniforms.amplitude=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"wavelength\",{get:function(){return this.uniforms.wavelength},set:function(e){this.uniforms.wavelength=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"brightness\",{get:function(){return this.uniforms.brightness},set:function(e){this.uniforms.brightness=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"speed\",{get:function(){return this.uniforms.speed},set:function(e){this.uniforms.speed=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.radius},set:function(e){this.uniforms.radius=e},enumerable:!1,configurable:!0}),n.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},n}(n.Filter),B=function(e){function n(n,t,r){void 0===t&&(t=0),void 0===r&&(r=1);var o=e.call(this,c,\"varying vec2 vTextureCoord;\\nuniform sampler2D uSampler;\\nuniform sampler2D uLightmap;\\nuniform vec4 filterArea;\\nuniform vec2 dimensions;\\nuniform vec4 ambientColor;\\nvoid main() {\\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\\n vec4 light = texture2D(uLightmap, lightCoord);\\n vec3 ambient = ambientColor.rgb * ambientColor.a;\\n vec3 intensity = ambient + light.rgb;\\n vec3 finalColor = diffuseColor.rgb * intensity;\\n gl_FragColor = vec4(finalColor, diffuseColor.a);\\n}\\n\")||this;return o._color=0,o.uniforms.dimensions=new Float32Array(2),o.uniforms.ambientColor=new Float32Array([0,0,0,r]),o.texture=n,o.color=t,o}return u(n,e),n.prototype.apply=function(e,n,t,r){var o,i;this.uniforms.dimensions[0]=null===(o=n.filterFrame)||void 0===o?void 0:o.width,this.uniforms.dimensions[1]=null===(i=n.filterFrame)||void 0===i?void 0:i.height,e.applyFilter(this,n,t,r)},Object.defineProperty(n.prototype,\"texture\",{get:function(){return this.uniforms.uLightmap},set:function(e){this.uniforms.uLightmap=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"color\",{get:function(){return this._color},set:function(e){var n=this.uniforms.ambientColor;\"number\"==typeof e?(o.hex2rgb(e,n),this._color=e):(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],this._color=o.rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"alpha\",{get:function(){return this.uniforms.ambientColor[3]},set:function(e){this.uniforms.ambientColor[3]=e},enumerable:!1,configurable:!0}),n}(n.Filter),G=function(e){function n(n,r,o,i){void 0===n&&(n=100),void 0===r&&(r=600);var l=e.call(this,c,\"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float blur;\\nuniform float gradientBlur;\\nuniform vec2 start;\\nuniform vec2 end;\\nuniform vec2 delta;\\nuniform vec2 texSize;\\n\\nfloat random(vec3 scale, float seed)\\n{\\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\\n}\\n\\nvoid main(void)\\n{\\n vec4 color = vec4(0.0);\\n float total = 0.0;\\n\\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\\n\\n for (float t = -30.0; t <= 30.0; t++)\\n {\\n float percent = (t + offset - 0.5) / 30.0;\\n float weight = 1.0 - abs(percent);\\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\\n sample.rgb *= sample.a;\\n color += sample * weight;\\n total += weight;\\n }\\n\\n color /= total;\\n color.rgb /= color.a + 0.00001;\\n\\n gl_FragColor = color;\\n}\\n\")||this;return l.uniforms.blur=n,l.uniforms.gradientBlur=r,l.uniforms.start=o||new t.Point(0,window.innerHeight/2),l.uniforms.end=i||new t.Point(600,window.innerHeight/2),l.uniforms.delta=new t.Point(30,30),l.uniforms.texSize=new t.Point(window.innerWidth,window.innerHeight),l.updateDelta(),l}return u(n,e),n.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(n.prototype,\"blur\",{get:function(){return this.uniforms.blur},set:function(e){this.uniforms.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"gradientBlur\",{get:function(){return this.uniforms.gradientBlur},set:function(e){this.uniforms.gradientBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"start\",{get:function(){return this.uniforms.start},set:function(e){this.uniforms.start=e,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"end\",{get:function(){return this.uniforms.end},set:function(e){this.uniforms.end=e,this.updateDelta()},enumerable:!1,configurable:!0}),n}(n.Filter),K=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(n,e),n.prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,t=Math.sqrt(e*e+n*n);this.uniforms.delta.x=e/t,this.uniforms.delta.y=n/t},n}(G),q=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(n,e),n.prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,t=Math.sqrt(e*e+n*n);this.uniforms.delta.x=-n/t,this.uniforms.delta.y=e/t},n}(G),W=function(e){function n(n,t,r,o){void 0===n&&(n=100),void 0===t&&(t=600);var i=e.call(this)||this;return i.tiltShiftXFilter=new K(n,t,r,o),i.tiltShiftYFilter=new q(n,t,r,o),i}return u(n,e),n.prototype.apply=function(e,n,t,r){var o=e.getFilterTexture();this.tiltShiftXFilter.apply(e,n,o,1),this.tiltShiftYFilter.apply(e,o,t,r),e.returnFilterTexture(o)},Object.defineProperty(n.prototype,\"blur\",{get:function(){return this.tiltShiftXFilter.blur},set:function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"gradientBlur\",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"start\",{get:function(){return this.tiltShiftXFilter.start},set:function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"end\",{get:function(){return this.tiltShiftXFilter.end},set:function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},enumerable:!1,configurable:!0}),n}(n.Filter),Y=function(e){function n(t){var r=e.call(this,c,\"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform float radius;\\nuniform float angle;\\nuniform vec2 offset;\\nuniform vec4 filterArea;\\n\\nvec2 mapCoord( vec2 coord )\\n{\\n coord *= filterArea.xy;\\n coord += filterArea.zw;\\n\\n return coord;\\n}\\n\\nvec2 unmapCoord( vec2 coord )\\n{\\n coord -= filterArea.zw;\\n coord /= filterArea.xy;\\n\\n return coord;\\n}\\n\\nvec2 twist(vec2 coord)\\n{\\n coord -= offset;\\n\\n float dist = length(coord);\\n\\n if (dist < radius)\\n {\\n float ratioDist = (radius - dist) / radius;\\n float angleMod = ratioDist * ratioDist * angle;\\n float s = sin(angleMod);\\n float c = cos(angleMod);\\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\\n }\\n\\n coord += offset;\\n\\n return coord;\\n}\\n\\nvoid main(void)\\n{\\n\\n vec2 coord = mapCoord(vTextureCoord);\\n\\n coord = twist(coord);\\n\\n coord = unmapCoord(coord);\\n\\n gl_FragColor = texture2D(uSampler, coord );\\n\\n}\\n\")||this;return Object.assign(r,n.defaults,t),r}return u(n,e),Object.defineProperty(n.prototype,\"offset\",{get:function(){return this.uniforms.offset},set:function(e){this.uniforms.offset=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.radius},set:function(e){this.uniforms.radius=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"angle\",{get:function(){return this.uniforms.angle},set:function(e){this.uniforms.angle=e},enumerable:!1,configurable:!0}),n.defaults={radius:200,angle:4,padding:20,offset:new t.Point},n}(n.Filter),Z=function(e){function n(t){var r,o=Object.assign(n.defaults,t),i=o.maxKernelSize,l=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o= 0.0 && dist > radius) { // radius < 0 means it's infinity\\n delta = dist - radius;\\n gap = gradient;\\n }\\n\\n if (delta > 0.0) {\\n float normalCount = gap / filterArea.x;\\n delta = (normalCount - delta) / normalCount;\\n countLimit *= delta;\\n strength *= delta;\\n if (countLimit < 1.0)\\n {\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n return;\\n }\\n }\\n\\n // randomize the lookup values to hide the fixed number of samples\\n float offset = rand(vTextureCoord, 0.0);\\n\\n float total = 0.0;\\n vec4 color = vec4(0.0);\\n\\n dir *= strength;\\n\\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\\n float percent = (t + offset) / MAX_KERNEL_SIZE;\\n float weight = 4.0 * (percent - percent * percent);\\n vec2 p = vTextureCoord + dir * percent;\\n vec4 sample = texture2D(uSampler, p);\\n\\n // switch to pre-multiplied alpha to correctly blur transparent images\\n // sample.rgb *= sample.a;\\n\\n color += sample * weight;\\n total += weight;\\n\\n if (t > countLimit){\\n break;\\n }\\n }\\n\\n color /= total;\\n // switch back from pre-multiplied alpha\\n // color.rgb /= color.a + 0.00001;\\n\\n gl_FragColor = color;\\n}\\n\".replace(\"${maxKernelSize}\",i.toFixed(1)))||this,Object.assign(r,l),r}return u(n,e),Object.defineProperty(n.prototype,\"center\",{get:function(){return this.uniforms.uCenter},set:function(e){this.uniforms.uCenter=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"strength\",{get:function(){return this.uniforms.uStrength},set:function(e){this.uniforms.uStrength=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"innerRadius\",{get:function(){return this.uniforms.uInnerRadius},set:function(e){this.uniforms.uInnerRadius=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,\"radius\",{get:function(){return this.uniforms.uRadius},set:function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},enumerable:!1,configurable:!0}),n.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},n}(n.Filter);return e.AdjustmentFilter=m,e.AdvancedBloomFilter=h,e.AsciiFilter=g,e.BevelFilter=v,e.BloomFilter=y,e.BulgePinchFilter=b,e.CRTFilter=z,e.ColorMapFilter=x,e.ColorOverlayFilter=_,e.ColorReplaceFilter=C,e.ConvolutionFilter=S,e.CrossHatchFilter=F,e.DotFilter=O,e.DropShadowFilter=P,e.EmbossFilter=A,e.GlitchFilter=T,e.GlowFilter=w,e.GodrayFilter=D,e.KawaseBlurFilter=d,e.MotionBlurFilter=j,e.MultiColorReplaceFilter=M,e.OldFilmFilter=R,e.OutlineFilter=E,e.PixelateFilter=I,e.RGBSplitFilter=N,e.RadialBlurFilter=k,e.ReflectionFilter=L,e.ShockwaveFilter=X,e.SimpleLightmapFilter=B,e.TiltShiftAxisFilter=G,e.TiltShiftFilter=W,e.TiltShiftXFilter=K,e.TiltShiftYFilter=q,e.TwistFilter=Y,e.ZoomBlurFilter=Z,Object.defineProperty(e,\"__esModule\",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters);Object.assign(PIXI.filters,__filters);\n//# sourceMappingURL=pixi-filters.js.map\n","import * as geo from \"./geo-utils.js\";\nimport { getTheme } from \"./themes.js\";\n// importing a local copy of PIXI filters, to avoid a long chain of npm pixi dependencies\nimport \"./lib/pixi-filters.min.js\";\n\nexport const render = async (container, state) => {\n container.clear();\n await addBackgroundImage(container, state.config);\n // floor render pass, no additional clipping\n await renderPass(container, state);\n // draw theme-painted areas as additional render passes\n await drawThemeAreas(container, state);\n};\n\nconst drawThemeAreas = async (container, state) => {\n for (let area of state.themeAreas) {\n const theme = getTheme(area.themeKey);\n if (!theme) {\n console.log(`No such ${area.themeType} theme: ${area.themeKey}`);\n continue;\n }\n // TODO: hacky way to pass down the actual theme to paint\n const areaState = state.clone();\n // TODO: how should we deal with different wall thicknesses, door colors, etc\n // which look jarring/off when two different themes meet up\n areaState.config = theme.config;\n // TODO: for now, just keep certain values from the main state config,\n // so the dungeon walls etc look consistent at meet up areas\n areaState.config.doorColor = state.config.doorColor;\n areaState.config.doorFillColor = state.config.doorFillColor;\n areaState.config.doorFillOpacity = state.config.doorFillOpacity;\n areaState.config.doorThickness = state.config.doorThickness;\n areaState.config.wallColor = state.config.wallColor;\n areaState.config.wallThickness = state.config.wallThickness;\n areaState.config.exteriorShadowOpacity = 0.0; // don't draw additional exterior shadows\n\n // mask for our area shape\n const areaContainer = new PIXI.Container();\n const areaMask = new PIXI.Graphics();\n areaMask.beginFill(0xffffff, 1.0);\n areaMask.drawPolygon(area.points.flat());\n areaMask.endFill();\n areaContainer.mask = areaMask;\n\n // render the theme, clipping to our rectangle\n const clipPoly = geo.pointsToPolygon(area.points);\n await renderPass(areaContainer, areaState, { clipPoly });\n\n container.addChild(areaMask);\n container.addChild(areaContainer);\n }\n};\n\nconst renderPass = async (container, state, options = {}) => {\n if (!state.geometry) {\n return;\n }\n\n const floorGfx = new PIXI.Graphics();\n const interiorShadowGfx = new PIXI.Graphics();\n const wallGfx = new PIXI.Graphics();\n\n // maybe draw an outer surrounding blurred shadow\n addExteriorShadow(container, state.config, state.geometry);\n\n // use a mask to clip the tiled background and interior shadows\n const clipMask = new PIXI.Graphics();\n drawMultiPolygonMask(clipMask, state.geometry);\n container.addChild(clipMask);\n\n interiorShadowGfx.mask = clipMask;\n // apply alpha filter once for entire shadow graphics, so overlaps aren't additive\n const alphaFilter = new PIXI.filters.AlphaFilter(\n state.config.interiorShadowOpacity\n );\n const blurFilter = new PIXI.filters.BlurFilter();\n interiorShadowGfx.filters = [alphaFilter, blurFilter];\n\n // maybe add a tiled background\n if (state.config.floorTexture) {\n // TODO: having both clipMask / clipPoly parameters is confusing.\n await addTiledBackground(\n container,\n clipMask,\n state.config.floorTexture,\n state.config.floorTextureTint,\n state.geometry,\n options.clipPoly\n );\n }\n\n // draw the dungeon geometry room(s)\n drawMultiPolygonRoom(\n floorGfx,\n interiorShadowGfx,\n wallGfx,\n state.config,\n state.geometry\n );\n\n // TODO: need to apply texture to interior walls, too\n\n const wallMask = new PIXI.Graphics();\n const maskConfig = JSON.parse(JSON.stringify(state.config));\n maskConfig.wallColor = \"#000000\";\n\n // draw interior walls\n for (let wall of state.interiorWalls) {\n drawInteriorWallShadow(interiorShadowGfx, state.config, wall);\n if (state.config.wallTexture) {\n drawInteriorWall(wallMask, maskConfig, wall);\n } else {\n drawInteriorWall(wallGfx, state.config, wall);\n }\n }\n\n // draw doors\n for (let door of state.doors) {\n drawDoorShadow(interiorShadowGfx, state.config, door);\n drawDoor(wallGfx, wallMask, state.config, door);\n }\n for (let secretDoor of state.secretDoors) {\n drawInteriorWallShadow(interiorShadowGfx, state.config, secretDoor);\n drawSecretDoor(wallGfx, wallMask, state.config, secretDoor);\n }\n\n // layer everything properly\n container.addChild(floorGfx);\n container.addChild(interiorShadowGfx);\n if (state.config.wallTexture) {\n drawMultiPolygonWallMask(\n wallMask,\n state.geometry,\n state.config.wallThickness\n );\n container.addChild(wallMask);\n // expand our geometry, so we add sprites\n // under the half of the wall thickness that expands past the geometry\n const expandedGeometry = geo.expandGeometry(\n state.geometry,\n state.config.wallThickness / 2.0\n );\n await addTiledBackground(\n container,\n wallMask,\n state.config.wallTexture,\n state.config.wallTextureTint,\n expandedGeometry,\n options.clipPoly\n );\n }\n container.addChild(wallGfx);\n};\n\n/** Try-catch wrapper around loadTexture. */\nconst getTexture = async (path) => {\n try {\n const texture = await loadTexture(path);\n return texture;\n } catch (error) {\n console.log(error);\n }\n};\n\n/** Possibly add a background image. */\nconst addBackgroundImage = async (container, config) => {\n if (config.backgroundImage) {\n // mimicking MapLayer._drawBackground() behavior\n const texture = await getTexture(config.backgroundImage);\n if (texture?.valid) {\n const d = canvas.dimensions;\n const bg = new PIXI.Sprite(texture);\n bg.position.set(d.paddingX - d.shiftX, d.paddingY - d.shiftY);\n // resize the background image to match the scene dimensions\n bg.width = d.sceneWidth;\n bg.height = d.sceneHeight;\n maybeStartSpriteVideo(bg);\n container.addChild(bg);\n }\n }\n};\n\nconst maybeStartSpriteVideo = (sprite) => {\n // if video, start playing it\n const source = sprite.texture.baseTexture.resource.source;\n const isVideo = source && source.tagName === \"VIDEO\";\n if (isVideo) {\n source.loop = true;\n source.volume = game.settings.get(\"core\", \"globalAmbientVolume\");\n game.video.play(source);\n }\n};\n\n/** Add an exterior blurred shadow. */\nconst addExteriorShadow = (container, config, geometry) => {\n if (\n !config.exteriorShadowThickness ||\n !config.exteriorShadowOpacity ||\n !geometry\n ) {\n return;\n }\n for (let i = 0; i < geometry.getNumGeometries(); i++) {\n const poly = geometry.getGeometryN(i);\n addExteriorShadowForPoly(container, config, poly);\n }\n};\n\n/** Add an exterior blurred shadow for the given polygon. */\nconst addExteriorShadowForPoly = (container, config, poly) => {\n const outerShadow = new PIXI.Graphics();\n // normalize the expanded buffer to remove any oddities\n //const expanded = poly.buffer(config.exteriorShadowThickness).norm();\n const expanded = geo.expandGeometry(poly, config.exteriorShadowThickness);\n outerShadow.beginFill(\n PIXI.utils.string2hex(config.exteriorShadowColor),\n config.exteriorShadowOpacity\n );\n outerShadow.drawPolygon(\n expanded\n .getCoordinates()\n .map((c) => [c.x, c.y])\n .flat()\n );\n outerShadow.endFill();\n const blurFilter = new PIXI.filters.BlurFilter();\n outerShadow.filters = [blurFilter];\n container.addChild(outerShadow);\n};\n\n/** Add TilingSprites for floor or wall texture. */\nconst addTiledBackground = async (\n container,\n mask,\n texturePath,\n textureTint,\n geometry,\n clipPoly\n) => {\n const texture = await getTexture(texturePath);\n if (!texture?.valid) {\n return;\n }\n\n // assume square textures\n const textureSize = texture.width;\n // allow for scene padding in our total height/width\n const height = canvas.scene.data.height * (1 + 2 * canvas.scene.data.padding);\n const width = canvas.scene.data.width * (1 + 2 * canvas.scene.data.padding);\n const rows = Math.ceil(height / textureSize);\n const cols = Math.ceil(width / textureSize);\n\n const bg = new PIXI.Container();\n for (let row = 0; row < rows; row++) {\n for (let col = 0; col < cols; col++) {\n // only create a sprite if this row/col rectangle intersects with our map geometry\n const rect = geo.pointsToPolygon([\n [col * textureSize, row * textureSize],\n [(col + 1) * textureSize, row * textureSize],\n [(col + 1) * textureSize, (row + 1) * textureSize],\n [col * textureSize, (row + 1) * textureSize],\n [col * textureSize, row * textureSize],\n ]);\n if (\n (!clipPoly || geo.intersects(clipPoly, rect)) &&\n geo.intersects(geometry, rect) &&\n !geo.touches(geometry, rect)\n ) {\n const sprite = new PIXI.TilingSprite(texture, textureSize, textureSize);\n sprite.x = col * textureSize;\n sprite.y = row * textureSize;\n if (textureTint) {\n sprite.tint = foundry.utils.colorStringToHex(textureTint);\n }\n maybeStartSpriteVideo(sprite);\n bg.addChild(sprite);\n }\n }\n }\n bg.mask = mask;\n container.addChild(bg);\n};\n\nconst drawPolygonMask = (gfx, poly) => {\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n gfx.beginFill(0xffffff, 1.0);\n gfx.drawPolygon(flatCoords);\n gfx.endFill();\n\n const numHoles = poly.getNumInteriorRing();\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n gfx.lineStyle(0, 0x000000, 1.0, 1, 0.5);\n gfx.beginHole();\n gfx.drawPolygon(flatCoords);\n gfx.endHole();\n }\n};\n\nconst drawMultiPolygonMask = (gfx, multi) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n drawPolygonMask(gfx, poly);\n }\n};\n\nconst drawPolygonWallMask = (gfx, poly, wallThickness) => {\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n gfx.lineStyle(wallThickness, PIXI.utils.string2hex(\"#000000\"), 1.0, 0.5);\n gfx.drawPolygon(flatCoords);\n\n const numHoles = poly.getNumInteriorRing();\n // for (let i = 0; i < numHoles; i++) {\n // const hole = poly.getInteriorRingN(i);\n // const coords = hole.getCoordinates();\n // const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n // gfx.beginHole();\n // gfx.drawPolygon(flatCoords);\n // gfx.endHole();\n // }\n\n // draw interior hole walls/shadows\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n\n // draw hole wall poly\n gfx.lineStyle(wallThickness, PIXI.utils.string2hex(\"#000000\"), 1.0);\n gfx.drawPolygon(flatCoords);\n }\n};\n\nconst drawMultiPolygonWallMask = (gfx, multi, wallThickness) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n drawPolygonWallMask(gfx, poly, wallThickness);\n }\n};\n\nconst drawMultiPolygonRoom = (\n floorGfx,\n interiorShadowGfx,\n wallGfx,\n config,\n multi\n) => {\n for (let i = 0; i < multi.getNumGeometries(); i++) {\n const poly = multi.getGeometryN(i);\n drawPolygonRoom(floorGfx, interiorShadowGfx, wallGfx, config, poly);\n }\n};\n\nconst drawPolygonRoom = (\n floorGfx,\n interiorShadowGfx,\n wallGfx,\n config,\n poly\n) => {\n const exterior = poly.getExteriorRing();\n const coords = exterior.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n\n // if no floor texture is specified, draw a solid-color floor\n if (!config.floorTexture) {\n floorGfx.beginFill(PIXI.utils.string2hex(config.floorColor), 1.0);\n floorGfx.drawPolygon(flatCoords);\n floorGfx.endFill();\n }\n\n // cut out holes\n const numHoles = poly.getNumInteriorRing();\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n floorGfx.lineStyle(0, 0x000000, 1.0, 1, 0.5);\n floorGfx.beginHole();\n floorGfx.drawPolygon(flatCoords);\n floorGfx.endHole();\n }\n\n // draw inner wall drop shadows\n if (config.interiorShadowOpacity) {\n // TODO: don't need to set this multiple times... bubble up?\n // TODO: there's a weird lag or visual artifact happening between the inner blur shadow and the solid line wall,\n // that sometimes leaves an unshadowed or lighter pixel line/area next to the wall.\n // To (partially) work around that, draw a wider shadow from the middle of the wall, rather than inside.\n interiorShadowGfx.lineStyle({\n width: config.wallThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n });\n interiorShadowGfx.drawPolygon(flatCoords);\n }\n\n // draw outer wall poly\n if (!config.wallTexture) {\n wallGfx.lineStyle(\n config.wallThickness,\n PIXI.utils.string2hex(config.wallColor),\n 1.0,\n 0.5\n );\n wallGfx.drawPolygon(flatCoords);\n }\n\n // draw interior hole walls/shadows\n for (let i = 0; i < numHoles; i++) {\n const hole = poly.getInteriorRingN(i);\n const coords = hole.getCoordinates();\n const flatCoords = coords.map((c) => [c.x, c.y]).flat();\n\n // draw hole wall outer drop shadows\n interiorShadowGfx.drawPolygon(flatCoords);\n\n // draw hole wall poly\n if (!config.wallTexture) {\n wallGfx.lineStyle(\n config.wallThickness,\n PIXI.utils.string2hex(config.wallColor),\n 1.0\n );\n wallGfx.drawPolygon(flatCoords);\n }\n }\n};\n\n// [x1, y1, x2, y2]\nconst drawInteriorWall = (wallGfx, config, wall) => {\n wallGfx.lineStyle({\n width: config.wallThickness,\n color: PIXI.utils.string2hex(config.wallColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n wallGfx.moveTo(wall[0], wall[1]);\n wallGfx.lineTo(wall[2], wall[3]);\n};\n\nconst drawInteriorWallShadow = (gfx, config, wall) => {\n gfx.lineStyle({\n // wide enough to be exposed on either side\n width: config.wallThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n cap: \"round\",\n });\n gfx.moveTo(wall[2], wall[3]);\n gfx.lineTo(wall[0], wall[1]);\n};\n\n// [x1, y1, x2, y2]\nconst drawDoor = (wallGfx, wallMask, config, door) => {\n // calculate some door dimensions\n const totalLength = geo.distanceBetweenPoints(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const jambLength = 20;\n const rectLength = totalLength - 2 * jambLength;\n const jambFraction = jambLength / totalLength;\n const rectFraction = rectLength / totalLength;\n const rectEndFraction = jambFraction + rectFraction;\n const deltaX = door[2] - door[0];\n const deltaY = door[3] - door[1];\n const jamb1End = [\n door[0] + deltaX * jambFraction,\n door[1] + deltaY * jambFraction,\n ];\n const rectEnd = [\n door[0] + deltaX * rectEndFraction,\n door[1] + deltaY * rectEndFraction,\n ];\n const doorRect = geo.rectangleForSegment(\n config.doorThickness,\n jamb1End[0],\n jamb1End[1],\n rectEnd[0],\n rectEnd[1]\n );\n\n // draw the door jamb at wall thickness, either into the texture mask or onto the wall graphics\n const wallColor = config.wallTexture ? \"#000000\" : config.wallColor;\n wallGfx.lineStyle({\n width: config.wallThickness,\n color: PIXI.utils.string2hex(wallColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n if (config.wallTexture) {\n wallMask.moveTo(door[0], door[1]);\n // left jamb\n wallMask.lineTo(jamb1End[0], jamb1End[1]);\n // right jamb\n wallMask.moveTo(rectEnd[0], rectEnd[1]);\n wallMask.lineTo(door[2], door[3]);\n } else {\n wallGfx.moveTo(door[0], door[1]);\n // left jamb\n wallGfx.lineTo(jamb1End[0], jamb1End[1]);\n // right jamb\n wallGfx.moveTo(rectEnd[0], rectEnd[1]);\n wallGfx.lineTo(door[2], door[3]);\n }\n // door rectangle\n if (config.doorFillOpacity) {\n wallGfx.beginFill(\n PIXI.utils.string2hex(config.doorFillColor),\n config.doorFillOpacity\n );\n }\n // door rectangle is drawn at a different line thickness\n wallGfx.lineStyle(\n config.doorLineThickness,\n PIXI.utils.string2hex(config.doorColor),\n 1.0,\n 0.5\n );\n wallGfx.drawPolygon(\n doorRect[0],\n doorRect[1],\n doorRect[2],\n doorRect[3],\n doorRect[4],\n doorRect[5],\n doorRect[6],\n doorRect[7],\n doorRect[0],\n doorRect[1]\n );\n if (config.doorFillColor) {\n wallGfx.endFill();\n }\n};\n\nconst drawSecretDoor = (wallGfx, wallMask, config, door) => {\n const isGM = game.user.isGM;\n if (\n (isGM && config.secretDoorStyleGM === \"door\") ||\n (!isGM && config.secretDoorStylePlayer === \"door\")\n ) {\n // TODO: need to draw door shadow. where?\n drawDoor(wallGfx, wallMask, config, door);\n return;\n }\n\n const totalLength = geo.distanceBetweenPoints(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const rectLength = 40.0;\n const jambLength = (totalLength - rectLength) / 2.0;\n const jambFraction = jambLength / totalLength;\n const rectFraction = rectLength / totalLength;\n const rectEndFraction = jambFraction + rectFraction;\n const deltaX = door[2] - door[0];\n const deltaY = door[3] - door[1];\n const jamb1End = [\n door[0] + deltaX * jambFraction,\n door[1] + deltaY * jambFraction,\n ];\n const middle = [door[0] + deltaX * 0.5, door[1] + deltaY * 0.5];\n const rectEnd = [\n door[0] + deltaX * rectEndFraction,\n door[1] + deltaY * rectEndFraction,\n ];\n const doorRect = geo.rectangleForSegment(\n 30.0,\n jamb1End[0],\n jamb1End[1],\n rectEnd[0],\n rectEnd[1]\n );\n\n // draw a wall across the door opening\n const wallColor = config.wallTexture ? \"#000000\" : config.wallColor;\n wallGfx.lineStyle({\n width: config.wallThickness,\n color: PIXI.utils.string2hex(wallColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n if (config.wallTexture) {\n wallMask.moveTo(door[0], door[1]);\n wallMask.lineTo(door[2], door[3]);\n } else {\n wallGfx.moveTo(door[0], door[1]);\n wallGfx.lineTo(door[2], door[3]);\n }\n\n // possibly draw an additional S-shape through the wall\n if (\n (isGM && config.secretDoorStyleGM === \"secret\") ||\n (!isGM && config.secretDoorStylePlayer === \"secret\")\n ) {\n const midRect = geo.rectangleForSegment(\n 50.0,\n jamb1End[0],\n jamb1End[1],\n middle[0],\n middle[1]\n );\n const midRect2 = geo.rectangleForSegment(\n 50.0,\n middle[0],\n middle[1],\n rectEnd[0],\n rectEnd[1]\n );\n wallGfx.lineStyle({\n width: 5.0,\n color: PIXI.utils.string2hex(config.secretDoorSColor),\n alpha: 1.0,\n alignment: 0.5, // middle\n cap: \"round\",\n });\n wallGfx.moveTo(doorRect[6], doorRect[7]);\n wallGfx.bezierCurveTo(\n midRect[0],\n midRect[1],\n midRect[2],\n midRect[3],\n middle[0],\n middle[1]\n );\n wallGfx.bezierCurveTo(\n midRect2[6],\n midRect2[7],\n midRect2[4],\n midRect2[5],\n doorRect[2],\n doorRect[3]\n );\n }\n};\n\nconst drawDoorShadow = (gfx, config, door) => {\n // TODO: DRY up these repeated dimension calculations\n const totalLength = geo.distanceBetweenPoints(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const jambLength = 20;\n const rectLength = totalLength - 2 * jambLength;\n const jambFraction = jambLength / totalLength;\n const rectFraction = rectLength / totalLength;\n const rectEndFraction = jambFraction + rectFraction;\n const deltaX = door[2] - door[0];\n const deltaY = door[3] - door[1];\n const jamb1End = [\n door[0] + deltaX * jambFraction,\n door[1] + deltaY * jambFraction,\n ];\n const rectEnd = [\n door[0] + deltaX * rectEndFraction,\n door[1] + deltaY * rectEndFraction,\n ];\n const doorRect = geo.rectangleForSegment(\n config.doorThickness,\n jamb1End[0],\n jamb1End[1],\n rectEnd[0],\n rectEnd[1]\n );\n\n gfx.lineStyle({\n // wide enough to be exposed on either side\n width: config.wallThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n });\n\n // left jamb\n gfx.moveTo(door[2], door[3]);\n gfx.lineTo(rectEnd[0], rectEnd[1]);\n\n // right jamb\n gfx.moveTo(jamb1End[0], jamb1End[1]);\n gfx.lineTo(door[0], door[1]);\n\n gfx.lineStyle({\n // wide enough to be exposed on either side\n width: config.doorLineThickness + config.interiorShadowThickness,\n color: PIXI.utils.string2hex(config.interiorShadowColor),\n alignment: 0.5, // middle\n join: \"round\",\n });\n\n // door rectangle\n gfx.drawPolygon(\n doorRect[0],\n doorRect[1],\n doorRect[2],\n doorRect[3],\n doorRect[4],\n doorRect[5],\n doorRect[6],\n doorRect[7],\n doorRect[0],\n doorRect[1]\n );\n};\n","import { DungeonState } from \"./dungeonstate.js\";\nimport { render } from \"./renderer.js\";\nimport * as geo from \"./geo-utils.js\";\nimport { getThemePainterThemeKey } from \"./themes.js\";\n\n/**\n * @extends {PlaceableObject}\n */\n// TODO: does Dungeon even need to be a PlaceableObject? Or could it just extend PIXI.Container?\nexport class Dungeon extends PlaceableObject {\n // expects JournalEntry for constructor\n constructor(journalEntry, note) {\n // note will be saved as this.document\n super(note);\n this.journalEntry = journalEntry;\n // time-ordered array of DungeonStates\n this.history = [DungeonState.startState()];\n this.historyIndex = 0;\n }\n\n /* -------------------------------------------- */\n\n // TODO: figure out what documentName / embeddedName / type we should be using\n /** @inheritdoc */\n static embeddedName = \"Drawing\";\n\n /* -------------------------------------------- */\n\n deleteAll() {\n // keep our most recent config around\n const lastState = this.state();\n const resetState = DungeonState.startState();\n resetState.config = lastState.config;\n this.history = [resetState];\n this.historyIndex = 0;\n this.history[this.historyIndex].saveToJournalEntry(this.journalEntry);\n this.refresh();\n }\n\n state() {\n return this.history[this.historyIndex];\n }\n\n /* -------------------------------------------- */\n /* Rendering */\n /* -------------------------------------------- */\n\n /** @override */\n draw() {\n this.refresh();\n return this;\n }\n\n /** @override */\n refresh() {\n render(this, this.state());\n }\n\n async maybeRefresh(journalEntry) {\n if (journalEntry.id === this.journalEntry.id) {\n const savedState = await DungeonState.loadFromJournalEntry(\n this.journalEntry\n );\n // update state, but don't save to journal\n await this.pushState(savedState, false);\n }\n }\n\n /* -------------------------------------------- */\n\n async loadFromJournalEntry() {\n const savedState = await DungeonState.loadFromJournalEntry(\n this.journalEntry\n );\n this.history = [savedState];\n this.historyIndex = 0;\n await this.refresh();\n }\n\n /* -------------------------------------------- */\n\n async undo() {\n this.historyIndex = Math.max(0, this.historyIndex - 1);\n await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry);\n await this.refresh();\n }\n\n async redo() {\n this.historyIndex = Math.min(\n this.history.length - 1,\n this.historyIndex + 1\n );\n await this.history[this.historyIndex].saveToJournalEntry(this.journalEntry);\n await this.refresh();\n }\n\n /* -------------------------------------------- */\n\n async pushState(newState, saveToJournalEntry = true) {\n // throw away any history states after current\n for (let i = this.history.length - 1; i > this.historyIndex; i--) {\n this.history.pop();\n }\n // and add our new state\n this.history.push(newState);\n this.historyIndex++;\n\n if (saveToJournalEntry) {\n await newState.saveToJournalEntry(this.journalEntry);\n }\n await this.refresh();\n }\n\n async setConfig(config) {\n const newState = this.state().clone();\n newState.config = config;\n await this.pushState(newState);\n }\n\n async addDoor(x1, y1, x2, y2) {\n await this._addDoor(x1, y1, x2, y2, \"doors\");\n }\n\n async addSecretDoor(x1, y1, x2, y2) {\n await this._addDoor(x1, y1, x2, y2, \"secretDoors\");\n }\n\n async _addDoor(x1, y1, x2, y2, doorProperty) {\n const newState = this.history[this.historyIndex].clone();\n const doorPoly = geo.twoPointsToLineString(x1, y1, x2, y2);\n\n // possibly split interior walls\n const wallsToDelete = [];\n const wallsToAdd = [];\n for (let wall of newState.interiorWalls) {\n const wallPoly = geo.twoPointsToLineString(\n wall[0],\n wall[1],\n wall[2],\n wall[3]\n );\n const contains = geo.contains(wallPoly, doorPoly);\n if (contains) {\n wallsToDelete.push(wall);\n // make sure points are consistently ordered\n const w1 = geo.lesserPoint(wall[0], wall[1], wall[2], wall[3]);\n const w2 = geo.greaterPoint(wall[0], wall[1], wall[2], wall[3]);\n const d1 = geo.lesserPoint(x1, y1, x2, y2);\n const d2 = geo.greaterPoint(x1, y1, x2, y2);\n wallsToAdd.push([w1[0], w1[1], d1[0], d1[1]]);\n wallsToAdd.push([d2[0], d2[1], w2[0], w2[1]]);\n }\n }\n newState.interiorWalls = newState.interiorWalls.filter(\n (w) => wallsToDelete.indexOf(w) === -1\n );\n newState.interiorWalls = newState.interiorWalls.concat(wallsToAdd);\n newState[doorProperty].push([x1, y1, x2, y2]);\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async subtractDoors(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const doorsToKeep = this.history[this.historyIndex].doors.filter((d) => {\n const doorPoly = geo.twoPointsToLineString(d[0], d[1], d[2], d[3]);\n return !geo.intersects(rectPoly, doorPoly);\n });\n if (doorsToKeep.length != this.history[this.historyIndex].doors.length) {\n const newState = this.history[this.historyIndex].clone();\n newState.doors = doorsToKeep;\n await this.pushState(newState);\n }\n }\n\n /**\n * Split the wall if it's drawn over an existing door.\n *\n * @returns [[x1, y1, x2, y2], ...]\n */\n _maybeSplitWall(x1, y1, x2, y2, doors) {\n // TODO: this logic doesn't handle two doors side by side\n const wallPoly = geo.twoPointsToLineString(x1, y1, x2, y2);\n for (let door of doors) {\n const doorPoly = geo.twoPointsToLineString(\n door[0],\n door[1],\n door[2],\n door[3]\n );\n const contains = geo.contains(wallPoly, doorPoly);\n if (contains) {\n // make sure points are consistently ordered\n const w1 = geo.lesserPoint(x1, y1, x2, y2);\n const w2 = geo.greaterPoint(x1, y1, x2, y2);\n const d1 = geo.lesserPoint(door[0], door[1], door[2], door[3]);\n const d2 = geo.greaterPoint(door[0], door[1], door[2], door[3]);\n return [\n [w1[0], w1[1], d1[0], d1[1]],\n [d2[0], d2[1], w2[0], w2[1]],\n ];\n }\n }\n // wall didn't contain any door, so return as-is\n return [[x1, y1, x2, y2]];\n }\n\n async addInteriorWall(x1, y1, x2, y2) {\n const newState = this.history[this.historyIndex].clone();\n const wallsToAdd = this._maybeSplitWall(x1, y1, x2, y2, newState.doors);\n newState.interiorWalls = newState.interiorWalls.concat(wallsToAdd);\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async subtractInteriorWalls(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const wallsToKeep = this.history[this.historyIndex].interiorWalls.filter(\n (w) => {\n const wallPoly = geo.twoPointsToLineString(w[0], w[1], w[2], w[3]);\n return !geo.intersects(rectPoly, wallPoly);\n }\n );\n if (\n wallsToKeep.length != this.history[this.historyIndex].interiorWalls.length\n ) {\n const newState = this.history[this.historyIndex].clone();\n newState.interiorWalls = wallsToKeep;\n await this.pushState(newState);\n }\n }\n\n // {x:, y:, height:, width:}\n async subtractDoorsAndInteriorWalls(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const oldState = this.history[this.historyIndex];\n const doorsToKeep = oldState.doors.filter((d) => {\n const doorPoly = geo.twoPointsToLineString(d[0], d[1], d[2], d[3]);\n return !geo.intersects(rectPoly, doorPoly);\n });\n const secretDoorsToKeep = oldState.secretDoors.filter((d) => {\n const doorPoly = geo.twoPointsToLineString(d[0], d[1], d[2], d[3]);\n return !geo.intersects(rectPoly, doorPoly);\n });\n const wallsToKeep = oldState.interiorWalls.filter((w) => {\n const wallPoly = geo.twoPointsToLineString(w[0], w[1], w[2], w[3]);\n return !geo.intersects(rectPoly, wallPoly);\n });\n if (\n doorsToKeep.length != oldState.doors.length ||\n secretDoorsToKeep.length != oldState.secretDoors.length ||\n wallsToKeep.length != oldState.interiorWalls.length\n ) {\n const newState = oldState.clone();\n newState.doors = doorsToKeep;\n newState.secretDoors = secretDoorsToKeep;\n newState.interiorWalls = wallsToKeep;\n await this.pushState(newState);\n }\n }\n\n async _addPoly(poly) {\n const oldState = this.history[this.historyIndex];\n const newState = oldState.clone();\n if (newState.geometry) {\n newState.geometry = geo.union(newState.geometry, poly);\n const touches = geo.touches(oldState.geometry, poly);\n if (touches) {\n const intersection = geo.intersection(oldState.geometry, poly);\n const coordinates = intersection.getCoordinates();\n // TODO: do we need to handle more complicated overlaps, GeometryCollection etc?\n // this coordinate 2-step is flimsy\n if (coordinates.length > 1 && coordinates.length % 2 === 0) {\n for (let i = 0; i < coordinates.length; i += 2) {\n const wallsToAdd = this._maybeSplitWall(\n coordinates[i].x,\n coordinates[i].y,\n coordinates[i + 1].x,\n coordinates[i + 1].y,\n newState.doors\n );\n newState.interiorWalls = newState.interiorWalls.concat(wallsToAdd);\n }\n }\n } else {\n // also nuke any interior walls in this new poly\n const wallsToKeep = newState.interiorWalls.filter((w) => {\n const wallPoly = geo.twoPointsToLineString(w[0], w[1], w[2], w[3]);\n return !geo.intersects(poly, wallPoly);\n });\n if (wallsToKeep.length != newState.interiorWalls.length) {\n newState.interiorWalls = wallsToKeep;\n }\n }\n } else {\n newState.geometry = poly;\n }\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async addRectangle(rect) {\n const poly = geo.rectToPolygon(rect);\n this._addPoly(poly);\n }\n\n // {x:, y:, height:, width:}\n async subtractRectangle(rect) {\n // only makes sense to subtract if we have geometry\n if (!this.history[this.historyIndex].geometry) {\n return;\n }\n const poly = geo.rectToPolygon(rect);\n // and if the poly intersects existing geometry\n if (!geo.intersects(this.history[this.historyIndex].geometry, poly)) {\n return;\n }\n const newState = this.history[this.historyIndex].clone();\n newState.geometry = geo.difference(newState.geometry, poly);\n await this.pushState(newState);\n }\n\n // [[x,y]...]\n async addPolygon(points) {\n try {\n const poly = geo.pointsToPolygon(points);\n await this._addPoly(poly);\n } catch (error) {\n console.log(error);\n }\n }\n\n /**\n * @param {Object} rect\n * @param {Number} rect.x\n * @param {Number} rect.y\n * @param {Number} rect.height\n * @param {Number} rect.width\n */\n async addThemeArea(points) {\n try {\n // make sure we can create a polygon from the points\n geo.pointsToPolygon(points);\n } catch (error) {\n console.log(error);\n return;\n }\n\n const themeKey = getThemePainterThemeKey();\n const newArea = {\n points,\n themeKey,\n };\n const newState = this.history[this.historyIndex].clone();\n newState.themeAreas.push(newArea);\n await this.pushState(newState);\n }\n\n // {x:, y:, height:, width:}\n async removeThemeAreas(rect) {\n const rectPoly = geo.rectToPolygon(rect);\n const areasToKeep = this.history[this.historyIndex].themeAreas.filter(\n (a) => {\n try {\n const areaPoly = geo.pointsToPolygon(a.points);\n return !geo.intersects(rectPoly, areaPoly);\n } catch (error) {\n console.log(error);\n return false;\n }\n }\n );\n if (\n areasToKeep.length != this.history[this.historyIndex].themeAreas.length\n ) {\n const newState = this.history[this.historyIndex].clone();\n newState.themeAreas = areasToKeep;\n await this.pushState(newState);\n }\n }\n}\n","import * as constants from \"./constants.js\";\nimport { Dungeon } from \"./dungeon.js\";\n\nconst FOLDER_NAME = \"Dungeon Draw\";\n\nconst findDungeonEntryAndNote = () => {\n for (const note of canvas.scene.notes) {\n const journalEntry = game.journal.get(note.data.entryId);\n if (journalEntry) {\n const flag = journalEntry.getFlag(\n constants.MODULE_NAME,\n \"dungeonVersion\"\n );\n if (flag) {\n return { journalEntry, note };\n }\n }\n }\n return { journalEntry: null, note: null };\n};\n\nconst createDungeonEntryAndNote = async () => {\n const journalEntry = await createDungeonEntry();\n const note = await createDungeonNote(journalEntry);\n return { journalEntry, note };\n};\n\nconst createDungeonEntry = async () => {\n let folder = game.folders\n .filter((f) => f.data.type === \"JournalEntry\" && f.name === FOLDER_NAME)\n .pop();\n if (!folder) {\n folder = await Folder.create({\n name: FOLDER_NAME,\n type: \"JournalEntry\",\n });\n }\n\n const journalEntry = await JournalEntry.create({\n name: canvas.scene.name,\n folder: folder.id,\n flags: {\n \"dungeon-draw\": {\n // extract string constant somewhere\n dungeonVersion: \"1.0\",\n },\n },\n });\n return journalEntry;\n};\n\nconst createDungeonNote = async (journalEntry) => {\n await canvas.scene.createEmbeddedDocuments(\"Note\", [\n {\n entryId: journalEntry.id,\n fontSize: 20,\n icon: \"icons/svg/cave.svg\",\n iconSize: 32,\n textAnchor: 1,\n textColor: \"#FFFFFF\",\n x: 50,\n y: 50,\n iconTint: \"\",\n text: \"Dungeon Draw\",\n flags: {},\n },\n ]);\n};\n\n/**\n *\n * @extends {PlaceablesLayer}\n */\nexport class DungeonLayer extends PlaceablesLayer {\n static LAYER_NAME = \"dungeon\";\n\n constructor() {\n super();\n this.dungeonContainer = null;\n this.dungeon = null;\n }\n\n /** @inheritdoc */\n static get layerOptions() {\n return foundry.utils.mergeObject(super.layerOptions, {\n name: DungeonLayer.LAYER_NAME,\n // canDragCreate: game.user.isGM,\n canDragCreate: true,\n zIndex: -1, // under tiles and background image\n });\n }\n\n // TODO: figure out what documentName / embeddedName / type we should be using\n /** @inheritdoc */\n static documentName = \"Drawing\";\n\n /**\n * Get initial data for a new drawing.\n * Start with some global defaults, apply user default config, then apply mandatory overrides per tool.\n * @param {Object} origin The initial coordinate\n * @return {Object} The new drawing data\n */\n _getNewDrawingData(origin) {\n const tool = game.activeTool;\n const data = {\n fillColor: game.user.color,\n strokeColor: game.user.color,\n strokeWidth: 8,\n };\n // Mandatory additions\n data.x = origin.x;\n data.y = origin.y;\n data.author = game.user.id;\n // Tool-based settings\n switch (tool) {\n case \"addrect\":\n case \"subtractdoor\":\n case \"subtractrect\":\n case \"themeeraser\":\n data.type = CONST.DRAWING_TYPES.RECTANGLE;\n data.points = [];\n break;\n case \"adddoor\":\n case \"addpoly\":\n case \"addsecretdoor\":\n case \"addwall\":\n case \"themepainter\":\n data.type = CONST.DRAWING_TYPES.POLYGON;\n data.points = [[0, 0]];\n break;\n case \"ellipse\":\n data.type = CONST.DRAWING_TYPES.ELLIPSE;\n data.points = [];\n break;\n }\n return data;\n }\n\n /** @override */\n async deleteAll() {\n const type = this.constructor.documentName;\n if (!game.user.isGM) {\n throw new Error(\n `You do not have permission to delete ${type} objects from the Scene.`\n );\n }\n return Dialog.confirm({\n title: game.i18n.localize(\"CONTROLS.ClearAll\"),\n content: `

${game.i18n.format(\"CONTROLS.ClearAllHint\", { type })}

`,\n yes: () => this._deleteAll(),\n });\n }\n\n // actually delete everything\n async _deleteAll() {\n this.dungeon?.deleteAll();\n }\n\n /* -------------------------------------------- */\n\n async loadDungeon() {\n const { journalEntry, note } = await findDungeonEntryAndNote();\n if (journalEntry) {\n this.dungeon = new Dungeon(journalEntry, note);\n await this.dungeon.loadFromJournalEntry();\n // add dungeon underneath any placeables or drawing preview\n this.addChildAt(this.dungeon, 0);\n } else {\n // no journal entry and note found, so make sure dungeon is nulled on this layer\n this.dungeon = null;\n }\n }\n\n async createNewDungeon() {\n await createDungeonEntryAndNote();\n await this.loadDungeon();\n }\n\n /* -------------------------------------------- */\n /* Rendering */\n /* -------------------------------------------- */\n\n /** @inheritdoc */\n async draw() {\n await super.draw();\n return this;\n }\n\n /* -------------------------------------------- */\n /* Event Listeners and Handlers */\n /* -------------------------------------------- */\n\n /** @override */\n async _onClickLeft(event) {\n const { preview, createState, originalEvent } = event.data;\n\n // Continue polygon point placement\n if (createState >= 1 && preview.isPolygon) {\n let point = event.data.destination;\n if (!originalEvent.shiftKey)\n point = canvas.grid.getSnappedPosition(\n point.x,\n point.y,\n this.gridPrecision\n );\n preview._addPoint(point, false);\n preview._chain = true; // Note that we are now in chain mode\n return preview.refresh();\n }\n\n await super._onClickLeft(event);\n }\n\n /** @override */\n _onClickLeft2(event) {\n const { createState, preview } = event.data;\n\n // Conclude polygon placement with double-click\n if (createState >= 1 && preview.isPolygon) {\n event.data.createState = 2;\n return this._onDragLeftDrop(event);\n }\n\n super._onClickLeft2(event);\n }\n\n /** @override */\n async _onDragLeftStart(event) {\n await super._onDragLeftStart(event);\n\n // we use a Drawing as our preview, but then on end-drag/completion,\n // update our single Dungeon instance.\n const data = this._getNewDrawingData(event.data.origin);\n const document = new DrawingDocument(data, { parent: canvas.scene });\n const drawing = new Drawing(document);\n event.data.preview = this.preview.addChild(drawing);\n return drawing.draw();\n }\n\n /** @override */\n _onDragLeftMove(event) {\n const { preview, createState } = event.data;\n if (!preview) {\n return;\n }\n if (preview.parent === null) {\n // In theory this should never happen, but rarely does\n this.preview.addChild(preview);\n }\n if (createState >= 1) {\n preview._onMouseDraw(event);\n if (\n preview.data.type !== CONST.DRAWING_TYPES.POLYGON ||\n game.activeTool === \"adddoor\" ||\n game.activeTool === \"addsecretdoor\" ||\n game.activeTool === \"addwall\"\n ) {\n event.data.createState = 2;\n }\n }\n }\n\n /** @override */\n async _onDragLeftDrop(event) {\n const { createState, destination, origin, preview } = event.data;\n\n // Successful drawing completion\n if (createState === 2) {\n // create a new dungeon if we don't already have one\n if (!this.dungeon) {\n await this.createNewDungeon();\n }\n\n const distance = Math.hypot(\n destination.x - origin.x,\n destination.y - origin.y\n );\n const minDistance = distance >= canvas.dimensions.size / 8;\n const completePolygon =\n preview.isPolygon && preview.data.points.length > 2;\n\n if (game.activeTool === \"adddoor\") {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n await this.dungeon.addDoor(\n data.x,\n data.y,\n data.x + data.points[1][0],\n data.y + data.points[1][1]\n );\n }\n if (game.activeTool === \"addsecretdoor\") {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n await this.dungeon.addSecretDoor(\n data.x,\n data.y,\n data.x + data.points[1][0],\n data.y + data.points[1][1]\n );\n } else if (game.activeTool === \"addwall\") {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n await this.dungeon.addInteriorWall(\n data.x,\n data.y,\n data.x + data.points[1][0],\n data.y + data.points[1][1]\n );\n } else if (minDistance || completePolygon) {\n event.data.createState = 0;\n const data = preview.data.toObject(false);\n preview._chain = false;\n const createData = this.constructor.placeableClass.normalizeShape(data);\n\n if (game.activeTool === \"addpoly\") {\n const length = createData.points.length;\n if (\n length > 2 &&\n (createData.points[0][0] !== createData.points[length - 1][0] ||\n createData.points[0][1] !== createData.points[length - 1][1])\n ) {\n // auto-close the polygon\n createData.points.push(createData.points[0]);\n }\n const offsetPoints = createData.points.map((p) => [\n p[0] + createData.x,\n p[1] + createData.y,\n ]);\n await this.dungeon.addPolygon(offsetPoints);\n } else if (game.activeTool === \"addrect\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.addRectangle(rect);\n } else if (game.activeTool === \"subtractdoor\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.subtractDoorsAndInteriorWalls(rect);\n } else if (game.activeTool === \"themeeraser\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.removeThemeAreas(rect);\n } else if (game.activeTool === \"themepainter\") {\n const length = createData.points.length;\n if (\n length > 2 &&\n (createData.points[0][0] !== createData.points[length - 1][0] ||\n createData.points[0][1] !== createData.points[length - 1][1])\n ) {\n // auto-close the polygon\n createData.points.push(createData.points[0]);\n }\n const offsetPoints = createData.points.map((p) => [\n p[0] + createData.x,\n p[1] + createData.y,\n ]);\n await this.dungeon.addThemeArea(offsetPoints);\n } else if (game.activeTool === \"subtractrect\") {\n const rect = {\n x: createData.x,\n y: createData.y,\n height: createData.height,\n width: createData.width,\n };\n await this.dungeon.subtractRectangle(rect);\n }\n }\n\n // Cancel the preview\n return this._onDragLeftCancel(event);\n }\n\n // In-progress polygon\n if (createState === 1 && preview.isPolygon) {\n event.data.originalEvent.preventDefault();\n if (preview._chain) {\n return;\n }\n return this._onClickLeft(event);\n }\n\n // Incomplete drawing\n return this._onDragLeftCancel(event);\n }\n}\n","import { ConfigSheet } from \"./configsheet.js\";\nimport { DungeonLayer } from \"./dungeonlayer.js\";\nimport * as constants from \"./constants.js\";\n\nexport class DungeonDraw {\n static init() {\n console.log(\"***** DUNGEON DRAW *****\");\n game.settings.register(constants.MODULE_NAME, \"releaseNotesVersion\", {\n name: \"Last version we showed release notes.\",\n scope: \"client\",\n default: \"\",\n type: String,\n config: false,\n });\n game.settings.register(constants.MODULE_NAME, \"customThemes\", {\n name: \"Custom themes.\",\n scope: \"client\",\n default: \"{}\",\n type: String,\n config: false,\n });\n game.settings.register(\n constants.MODULE_NAME,\n constants.SETTING_THEME_PAINTER_THEME,\n {\n name: \"Theme painter theme key.\",\n scope: \"client\",\n default: \"module.cavern\",\n type: String,\n config: false,\n }\n );\n }\n\n static ready() {\n DungeonDraw.maybeShowReleaseNotes();\n }\n\n static async maybeShowReleaseNotes() {\n if (!game.user.isGM) {\n // GMs only\n return;\n }\n const moduleVersion = game.modules.get(constants.MODULE_NAME).data.version;\n const settingsVersion = game.settings.get(\n constants.MODULE_NAME,\n \"releaseNotesVersion\"\n );\n if (moduleVersion === settingsVersion) {\n // they've already seen it\n return;\n }\n const resp = await fetch(\"modules/dungeon-draw/CHANGELOG.md\");\n const changelog = await resp.text();\n // keep only the most recent changelog section\n const firstChangelog = \"#\" + changelog.split(\"#\")[1];\n // show it in a Dialog\n const html = await renderTemplate(\n \"modules/dungeon-draw/templates/release-notes.html\",\n {\n data: {\n version: moduleVersion,\n changelog: firstChangelog,\n },\n }\n );\n const dialog = new Dialog(\n {\n title: game.i18n.localize(\"DD.ReleaseNotes\"),\n content: html,\n buttons: {\n roll: {\n icon: '',\n label: \"OK\",\n },\n },\n },\n {\n width: 600,\n }\n );\n dialog.render(true);\n // mark this version as shown\n await game.settings.set(\n constants.MODULE_NAME,\n \"releaseNotesVersion\",\n moduleVersion\n );\n }\n\n static getSceneControlButtons(controls) {\n if (CONFIG.Canvas.layers.background?.group) {\n // v9+ layer setup\n CONFIG.Canvas.layers.dungeon = {\n layerClass: DungeonLayer,\n group: \"primary\",\n };\n } else {\n // v8 layer setup\n // TODO: remove this if/else once v8 is gone from existence\n CONFIG.Canvas.layers.dungeon = DungeonLayer;\n }\n\n CONFIG.Dungeon = {\n //documentClass: DungeonDocument,\n layerClass: DungeonLayer,\n //sheetClass: DungeonConfig\n };\n\n controls.push({\n name: \"dungeondraw\",\n title: \"DD.SceneControlTitle\",\n layer: DungeonLayer.LAYER_NAME,\n icon: \"fas fa-dungeon\",\n visible: game.user.isTrusted,\n tools: [\n {\n name: \"addrect\",\n title: \"DD.ButtonTitleAddRect\",\n icon: \"fas fa-plus-square\",\n },\n {\n name: \"subtractrect\",\n title: \"DD.ButtonTitleSubtractRect\",\n icon: \"fas fa-minus-square\",\n },\n {\n name: \"addpoly\",\n title: \"DD.ButtonTitleAddPoly\",\n icon: \"fas fa-draw-polygon\",\n },\n {\n name: \"addwall\",\n title: \"DD.ButtonTitleAddWall\",\n icon: \"fas fa-bars\",\n },\n {\n name: \"adddoor\",\n title: \"DD.ButtonTitleAddDoor\",\n icon: \"fas fa-door-open\",\n },\n {\n name: \"addsecretdoor\",\n title: \"DD.ButtonTitleAddSecretDoor\",\n icon: \"fas fa-mask\",\n },\n {\n name: \"subtractdoor\",\n title: \"DD.ButtonTitleSubtractDoorsAndWalls\",\n icon: \"fas fa-window-close\",\n },\n {\n name: \"themepainter\",\n title: \"DD.ButtonTitleThemePainter\",\n icon: \"fas fa-brush\",\n },\n {\n name: \"themeeraser\",\n title: \"DD.ButtonTitleThemeEraser\",\n icon: \"fas fa-eraser\",\n },\n {\n name: \"undo\",\n title: \"DD.ButtonTitleUndo\",\n icon: \"fas fa-undo\",\n onClick: async () => {\n await canvas.dungeon.dungeon.undo();\n },\n button: true,\n },\n {\n name: \"redo\",\n title: \"DD.ButtonTitleRedo\",\n icon: \"fas fa-redo\",\n onClick: async () => {\n await canvas.dungeon.dungeon.redo();\n },\n button: true,\n },\n {\n name: \"config\",\n title: \"DD.ButtonTitleConfig\",\n icon: \"fas fa-cog\",\n onClick: () => new ConfigSheet().render(true),\n button: true,\n },\n {\n name: \"clear\",\n title: \"DD.ButtonTitleClear\",\n icon: \"fas fa-trash\",\n // visible: isGM,\n visible: true,\n onClick: () => canvas.dungeon.deleteAll(),\n button: true,\n },\n ],\n activeTool: \"addrect\",\n });\n }\n\n static async canvasReady(canvas) {\n await canvas.dungeon.loadDungeon();\n }\n\n static async updateJournalEntry(document, change, options, userId) {\n if (game.user.id !== userId) {\n // if somebody else changed the backing JournalEntry, we need to refresh\n await canvas.dungeon.dungeon?.maybeRefresh(document);\n }\n }\n}\n\nHooks.on(\"init\", DungeonDraw.init);\nHooks.on(\"ready\", DungeonDraw.ready);\nHooks.on(\"getSceneControlButtons\", DungeonDraw.getSceneControlButtons);\nHooks.on(\"canvasReady\", DungeonDraw.canvasReady);\nHooks.on(\"updateJournalEntry\", DungeonDraw.updateJournalEntry);\n"],"names":["MODULE_NAME","getTheme","themeKey","splits","split","type","key","getCustomThemes","themes","customThemesString","game","settings","get","constants.MODULE_NAME","JSON","parse","e","console","log","setCustomThemes","customThemes","themesString","stringify","set","getThemePainterThemeKey","default","name","config","backgroundImage","doorColor","doorFillColor","doorFillOpacity","doorLineThickness","doorThickness","exteriorShadowColor","exteriorShadowThickness","exteriorShadowOpacity","floorColor","floorTexture","floorTextureTint","interiorShadowColor","interiorShadowThickness","interiorShadowOpacity","sceneBackgroundColor","sceneGridColor","sceneGridOpacity","secretDoorSColor","secretDoorStyleGM","secretDoorStylePlayer","wallColor","wallTexture","wallTextureTint","wallThickness","arcPavement","foundry","utils","mergeObject","basicBlack","cavern","checkerboard","cobblestone","dirt","dungeonSquares","grass","groovyCarpet","hexagon","marble","metalGrid","metalSquares","moldvayBlue","neonBlueprint","ruddyPaper","water","woodPlanks","ThemeSheet","FormApplication","constructor","super","this","defaultOptions","id","classes","template","width","height","tabs","navSelector","contentSelector","initial","title","i18n","localize","getData","theme","themeName","async","event","formData","ConfigSheet","activeTab","_tabs","active","canvas","dungeon","state","customThemeKeys","Object","keys","sort","themeKeys","themePainterThemeKey","customThemeName","themePainterTheme","setConfig","user","isGM","scene","update","backgroundColor","gridAlpha","sceneGridAlpha","gridColor","options","close","preview","removeChildren","activateListeners","html","find","click","_onResetDefaults","bind","_onThemeNameClick","_onSaveAsThemeClick","_onEditThemeClick","_onCopyThemeClick","_onDeleteThemeClick","change","_onThemePainterThemeSelect","preventDefault","refresh","render","themeRow","$","currentTarget","parent","data","newConfig","saveAsThemeName","closest","children","val","_getSubmitData","oldTheme","newTheme","newName","num","done","setThemePainterThemeKey","deleteAllWalls","walls","getEmbeddedCollection","ids","wall","getFlag","push","deleteEmbeddedDocuments","error","makeWallsFromMulti","multi","i","getNumGeometries","poly","getGeometryN","makeWallsFromPoly","wallData","x1","y1","x2","y2","c","flags","dungeonVersion","doorData","door","secretDoorData","allWalls","coords","getExteriorRing","getCoordinates","length","x","y","numHoles","getNumInteriorRing","getInteriorRingN","createEmbeddedDocuments","makeInteriorWalls","makeDoors","doors","allDoors","makeSecretDoors","NumberUtil","static","tolerance","Math","abs","Exception","Error","message","toString","IllegalArgumentException","Long","high","low","mask","result","Double","Comparable","Clonable","Comparator","Serializable","NaN","isNaN","n","Number","isInfinite","isFinite","MAX_VALUE","POSITIVE_INFINITY","NEGATIVE_INFINITY","Float64Array","Int32Array","EXP_BIT_MASK","f64buf","i32buf","buffer","doubleToLongBits","value","longBitsToDouble","bits","BIAS","log2","floor","pow","MAX_REL_BITS_INTEGER","f","skip","sign","exp","Infinity","fract","RuntimeException","AssertionFailedException","constructor_","apply","arguments","call","Assert","shouldNeverReachHere","assertion","isTrue","expectedValue","actualValue","equals","kBuf","ArrayBuffer","kBufAsF64","kBufAsI32","Coordinate","z","getZ","NULL_ORDINATE","getM","setOrdinate","ordinateIndex","X","Y","Z","setZ","equals2D","other","equalsWithTolerance","setM","m","M","getOrdinate","equals3D","equalInZ","setX","compareTo","o","getX","clone","CloneNotSupportedException","copy","distance3D","dx","dy","dz","sqrt","getY","setY","distance","hashCode","setCoordinate","interfaces_","Cloneable","DimensionalComparator","_dimensionsToTest","dimensionsToTest","a","b","compare","c1","c2","compX","compY","indexOf","CoordinateSequence","index","hasM","mIndex","getDimension","getMeasures","hasZ","size","getCoordinate","getCoordinateCopy","createCoordinate","expandEnvelope","env","toCoordinateArray","CoordinateSequenceFactory","create","Array","hasInterface","dimension","GeometryComponentFilter","filter","geom","Envelope","_minx","_maxx","_miny","_maxy","init","p","p1","p2","q","q1","q2","minq","min","maxq","max","minp","maxp","getArea","getWidth","getHeight","otherEnvelope","isNull","getMaxX","getMaxY","getMinX","getMinY","intersection","intersects","intMinX","intMinY","intMaxX","intMaxY","covers","getDiameter","w","h","expandToInclude","minExtent","translate","transX","transY","setToNull","disjoint","maxExtent","expandBy","deltaX","deltaY","contains","centre","Geometry","isGeometryCollection","getTypeCode","TYPECODE_GEOMETRYCOLLECTION","getFactory","_factory","isRectangle","equalsExact","geometryChanged","geometryChangedFilter","geometryChangedAction","_envelope","equalsNorm","g","norm","getLength","isEmpty","compareToSameClass","comp","getUserData","_userData","getSRID","_SRID","getEnvelope","toGeometry","getEnvelopeInternal","checkNotGeometryCollection","equal","normalize","reverse","res","reverseInternal","envelope","setSRID","copyInternal","getPrecisionModel","computeEnvelopeInternal","SRID","setUserData","userData","iterator","j","hasNext","aElement","next","bElement","comparison","isEquivalentClass","getClass","isGeometryCollectionOrDerived","TYPECODE_MULTIPOINT","TYPECODE_MULTILINESTRING","TYPECODE_MULTIPOLYGON","geometries","array","factory","TYPECODE_POINT","TYPECODE_LINESTRING","TYPECODE_LINEARRING","TYPECODE_POLYGON","TYPENAME_POINT","TYPENAME_MULTIPOINT","TYPENAME_LINESTRING","TYPENAME_LINEARRING","TYPENAME_MULTILINESTRING","TYPENAME_POLYGON","TYPENAME_MULTIPOLYGON","TYPENAME_GEOMETRYCOLLECTION","CoordinateFilter","coord","Lineal","CoordinateSequences","src","srcPos","dest","destPos","minDim","dim","seq","isInteger","indexOfFirstCoordinate","scroll","isRing","firstCoordinate","ensureRing","last","k","cs1","cs2","cs1Size","d","v1","v2","minCoordinateIndex","to","minCoordIndex","minCoord","testCoord","fact","newseq","mid","trunc","swap","tmp","copyCoord","createClosedRing","coordinate","UnsupportedOperationException","Character","toUpperCase","Dimension","dimensionValue","FALSE","SYM_FALSE","TRUE","SYM_TRUE","DONTCARE","SYM_DONTCARE","P","SYM_P","L","SYM_L","A","SYM_A","dimensionSymbol","GeometryFilter","CoordinateSequenceFilter","isDone","isGeometryChanged","LineString","_points","points","isClosed","isSimple","otherLineString","getBoundaryDimension","getCoordinateN","getNumPoints","createLineString","getEndPoint","getPointN","pts","len","x0","y0","ofLine","line","getBoundary","getGeometryType","getCoordinateSequence","getCoordinateSequenceFactory","isCoordinate","pt","getStartPoint","createPoint","Puntal","Point","_coordinates","coordinates","IllegalStateException","point","createGeometryCollection","Area","ring","ofRingSigned","sum","p0","Collection","add","addAll","toArray","remove","IndexOutOfBoundsException","List","NoSuchElementException","ArrayList","ensureCapacity","splice","clear","element","oldElement","Iterator","comparator","slice","Symbol","values","arrayList","position","Arrays","t","r","concat","original","newLength","StringBuffer","str","append","setCharAt","substr","Integer","intValue","DD","_hi","_lo","dd","hi","lo","determinant","valueOf","multiply","selfSubtract","selfMultiply","strlen","isWhitespace","charAt","isNegative","signCh","numDigits","numBeforeDec","hasDecimalChar","ch","isDigit","TEN","selfAdd","expStr","substring","parseInt","ex","NumberFormatException","val2","numDecPlaces","scale","divide","negate","xAbs","xLog10","xMag","buf","le","extractSignificantDigits","insertDecimalPoint","magnitude","mag","gt","lt","ONE","decimalPointPos","MAX_PRINT_DIGITS","digit","rebiasBy10","digitChar","subtract","continueExtractingDigits","remMag","sqr","doubleValue","isZero","getSpecialNumberString","selfDivide","yhi","ylo","hc","tc","hy","ty","C","U","u","SPLIT","dump","createNaN","ge","s","reciprocal","ceil","fhi","flo","rint","setValue","ax","axdd","d2","H","S","T","zhi","zlo","hx","tx","selfSqr","toStandardNotation","toSciNotation","specialStr","fill","sigDigits","stringOfChar","numZeroes","SCI_NOT_ZERO","digits","SCI_NOT_EXPONENT_CHAR","trailingDigits","digitsWithDecimal","isPositive","signum","PI","TWO_PI","PI_2","E","EPS","CGAlgorithmsDD","orientationIndexFilter","dx1","dy1","dx2","dy2","px","py","pw","qx","qy","qw","xInt","yInt","pa","pb","pc","detsum","detleft","detright","det","errbound","DP_SAFE_EPSILON","Orientation","orientationIndex","nPts","hiPt","hiIndex","iPrev","iNext","prev","disc","isCCW","CLOCKWISE","RIGHT","COUNTERCLOCKWISE","LEFT","COLLINEAR","STRAIGHT","Polygonal","Polygon","_shell","_holes","shell","holes","createLinearRing","hasNullElements","hasNonEmptyElements","shellCoordinates","childCoordinates","area","ofRing","shellCopy","holeCopies","prevX","prevY","otherPolygon","thisShell","otherPolygonShell","normalized","clockwise","createPolygon","numPoints","convexHull","otherShell","shellComp","nHole1","nHole2","thisHole","otherHole","holeComp","createMultiLineString","rings","Set","SortedSet","TreeSet","GeometryCollection","_geometries","otherCollection","numGeometries","reversed","buildGeometry","theseElements","asList","otherElements","gc","n1","n2","thisGeom","otherGeom","MultiPoint","isValid","LinearRing","validateConstruction","MINIMUM_VALID_SIZE","CoordinateXY","CoordinateXYM","_m","CoordinateXYZM","Coordinates","measures","CoordinateList","allowRepeated","isChanged","coordArrayType","obj","start","end","inc","closeRing","duplicate","MathUtil","ln","LOG_10","v3","v4","System","CoordinateArrays","testPts","testPt","newCoordinates","arraycopy","coord1","coord2","coordinateComparator","coordList","hasRepeatedPoints","nonNull","newCoord","srcStart","destStart","pts1","pts2","clamp","npts","extractPts","iPts","ForwardComparator","o1","o2","BidirectionalComparator","forwardComp","isEqualReversed","OLDcompare","dir1","increasingDirection","dir2","i1","i2","comparePt","StringBuilder","CoordinateArraySequence","_dimension","_measures","coordSeq","cloneCoordinates","strBuilder","CoordinateArraySequenceFactory","instanceObject","readResolve","instance","spatial","MultiPolygon","polygons","allRings","allRingsArray","Map","put","entrySet","HashSet","map","has","from","current","HashMap","MapInterface","it","hashSet","entries","forEach","entry","PrecisionModel","_modelType","_scale","FLOATING","Type","modelType","FIXED","setScale","pm","pm1","pm2","otherPrecisionModel","getMaximumSignificantDigits","otherSigDigits","getScale","isFloating","FLOATING_SINGLE","getType","description","makePrecise","round","maxSigDigits","_name","nameToTypeMap","maximumPreciseValue","MultiLineString","lineStrings","GeometryFactory","_precisionModel","_coordinateSequenceFactory","coordinateSequenceFactory","precisionModel","getDefaultCoordinateSequenceFactory","multiPolygons","multiPolygonArray","geometryArray","multiLineStrings","multiLineStringArray","lineStringArray","multiPoints","multiPointArray","linearRings","linearRingArray","pointArray","polygonArray","exemplar","createEmpty","geomList","geomType","isHeterogeneous","hasGeometryCollection","partType","toGeometryArray","geom0","createMultiPolygon","toPolygonArray","toLineStringArray","createMultiPoint","toPointArray","createMultiPointFromCoords","ptSeq","GeometryLayout","GeometryType","POINT","LINE_STRING","LINEAR_RING","POLYGON","MULTI_POINT","MULTI_LINE_STRING","MULTI_POLYGON","GEOMETRY_COLLECTION","CIRCLE","TokenType","WKTGeometryType","Lexer","wkt","index_","isAlpha_","isNumeric_","opt_decimal","undefined","isWhiteSpace_","nextChar_","nextToken","readNumber_","readText_","decimal","scientificNotation","parseFloat","Parser","lexer","lexer_","token_","layout_","consume_","isTokenType","match","isMatch","parseGeometry_","parseGeometryLayout_","layout","dimToken","dimInfo","parseGeometryCollectionText_","isEmptyGeometry_","formatErrorMessage_","parsePointText_","parsePoint_","parseLineStringText_","parsePointList_","parsePolygonText_","parseLineStringTextList_","parseMultiPointText_","parsePointTextList_","parseMultiLineStringText_","parseMultiPolygonText_","parsePolygonTextList_","dimensions","token","o2c","ordinates","ca2p","components","encodePointGeometry","cs","join","encodeLineStringGeometry","ii","encodePolygonGeometry","GeometryEncoder","encode","geometryEncoder","encodeGeometryLayout","WKTParser","geometryFactory","read","write","geometry","WKTReader","parser","WKTWriter","BufferParameters","_quadrantSegments","DEFAULT_QUADRANT_SEGMENTS","_endCapStyle","CAP_ROUND","_joinStyle","JOIN_ROUND","_mitreLimit","DEFAULT_MITRE_LIMIT","_isSingleSided","_simplifyFactor","DEFAULT_SIMPLIFY_FACTOR","quadrantSegments","setQuadrantSegments","endCapStyle","setEndCapStyle","joinStyle","mitreLimit","setJoinStyle","setMitreLimit","quadSegs","alpha","cos","getEndCapStyle","isSingleSided","JOIN_BEVEL","JOIN_MITRE","getJoinStyle","setSimplifyFactor","simplifyFactor","getSimplifyFactor","getQuadrantSegments","getMitreLimit","setSingleSided","CAP_FLAT","CAP_SQUARE","Location","locationValue","EXTERIOR","BOUNDARY","INTERIOR","NONE","Position","ON","EmptyStackException","Stack","pop","peek","empty","search","RightmostEdgeFinder","_minIndex","_minCoord","_minDe","_orientedDe","getRightmostSide","de","side","getRightmostSideOfSegment","checkForRightmostCoordinate","findRightmostEdgeAtVertex","getEdge","pPrev","pNext","orientation","usePrev","pos","findRightmostEdgeAtNode","star","getNode","getEdges","getRightmostEdge","isForward","getSym","findEdge","dirEdgeList","TopologyException","msg","LinkedList","addLast","removeFirst","shift","BufferSubgraph","_finder","_dirEdgeList","_nodes","_rightMostCoord","_env","clearVisitedEdges","setVisited","getRightmostCoordinate","computeNodeDepth","startEdge","isVisited","computeDepths","copySymDepths","computeDepth","outsideDepth","getLabel","setEdgeDepths","node","addReachable","findResultEdges","getDepth","isInteriorAreaEdge","setInResult","nodesVisited","nodeQueue","startNode","sym","adjNode","graph","edgeEnv","nodeStack","setDepth","symNode","getNodes","getDirectedEdges","Intersection","minX0","minY0","maxX0","maxY0","minX1","minY1","maxX1","maxY1","midx","midy","p1x","p1y","p2x","p2y","q1x","q1y","q2x","q2y","Distance","B","D","pointToSegment","noIntersection","denom","r_num","len2","minDistance","dist","LineIntersector","_result","_inputLines","_intPt","_intLineIndex","_isProper","_pa","_pb","pdx","pdy","getIndexAlongSegment","segmentIndex","intIndex","computeIntLineIndex","getTopologySummary","catBuilder","isEndPoint","isCollinear","computeIntersection","p3","p4","computeIntersect","getIntersectionNum","getEdgeDistance","isProper","hasIntersection","setPrecisionModel","isInteriorIntersection","inputLineIndex","getIntersection","NO_INTERSECTION","computeEdgeDistance","COLLINEAR_INTERSECTION","toLineString","getEndpoint","ptIndex","isIntersection","getIntersectionAlongSegment","DONT_INTERSECT","DO_INTERSECT","POINT_INTERSECTION","RobustLineIntersector","nearestPt","minDist","isInSegmentEnvelopes","intPt","env0","env1","intersectionSafe","nearestEndpoint","checkDD","intPtDD","isIn","out","println","computeCollinearIntersection","p1q1p2","p1q2p2","q1p1q2","q1p2q2","Pq1","Pq2","Qp1","Qp2","RayCrossingCounter","_p","_crossingCount","_isPointOnSegment","counter","countSegment","isOnSegment","getLocation","minx","maxx","orient","isPointInPolygon","PointLocation","lineIntersector","locatePointInRing","locateInRing","TopologyLocation","location","on","gl","left","right","setAllLocations","locValue","setAllLocationsIfNull","isLine","merge","newLoc","getLocations","flip","temp","toLocationSymbol","setLocations","posIndex","isArea","isAnyNull","setLocation","locIndex","isEqualOnSide","allPositionsEqual","loc","Label","elt","onLoc","lbl","geomIndex","leftLoc","rightLoc","label","lineLabel","getGeometryCount","count","toLine","EdgeRing","_startDe","_maxNodeDegree","_edges","_pts","_label","_ring","_isHole","_geometryFactory","computePoints","computeRing","isIsolated","isFirstEdge","getEdgeRing","mergeLabel","addPoints","setEdgeRing","getNext","getLinearRing","computeMaxNodeDegree","degree","getOutgoingDegree","edge","edgePts","startIndex","isHole","containsPoint","isInRing","addHole","isShell","getMaxNodeDegree","getShell","deLabel","setShell","toPolygon","holeLR","MinimalEdgeRing","er","setMinEdgeRing","getNextMin","MaximalEdgeRing","buildMinimalRings","minEdgeRings","getMinEdgeRing","minEr","linkDirectedEdgesForMinimalEdgeRings","linkMinimalDirectedEdges","GraphComponent","_isInResult","_isCovered","_isCoveredSet","_isVisited","isInResult","isCovered","isCoveredSet","setLabel","setCovered","updateIM","im","computeIM","Node","_coord","edges","isIncidentEdgeInResult","print","computeMergedLocation","label2","eltIndex","nLoc","argIndex","onLocation","insert","setNode","setLabelBoundary","SortedMap","colorOf","color","parentOf","setColor","leftOf","rightOf","TreeMap","root_","size_","cmp","getValue","getKey","oldValue","fixAfterInsertion","rotateLeft","rotateRight","getFirstEntry","successor","l","containsKey","NodeMap","nodeMap","nodeFact","addNode","createNode","getBoundaryNodes","bdyNodes","Quadrant","quad","NE","NW","quad1","quad2","halfPlane","SE","SW","EdgeEnd","_edge","_node","_p0","_p1","_dx","_dy","_quadrant","compareDirection","getDy","angle","atan2","className","getName","lastDotPos","lastIndexOf","getDirectedCoordinate","getDx","getQuadrant","computeLabel","boundaryNodeRule","quadrant","DirectedEdge","_isForward","_sym","_next","_nextMin","_edgeRing","_minEdgeRing","_depth","computeDirectedLabel","currLocation","nextLocation","depthVal","setNextMin","nextMin","getDepthDelta","minEdgeRing","isLineEdge","isExteriorIfArea0","isExteriorIfArea1","edgeRing","depthDelta","printEdge","printReverse","setSym","setVisitedEdge","depth","directionFactor","oppositePos","opposite","oppositeDepth","setNext","NodeFactory","PlanarGraph","_edgeEndList","nodes","nodeit","linkResultDirectedEdges","printEdges","eiList","getNodeIterator","debugPrintln","isBoundaryNode","linkAllDirectedEdges","matchInSameDirection","ep0","ep1","getEdgeEnds","debugPrint","getEdgeIterator","findEdgeInSameDirection","eCoord","insertEdge","findEdgeEnd","ee","addEdges","edgesToAdd","de1","de2","PolygonBuilder","_shellList","testEr","shellList","testRing","testEnv","minShell","minShellEnv","tryShell","tryShellRing","tryShellEnv","ptNotInList","isContained","sortShellsAndHoles","edgeRings","freeHoleList","computePolygons","resultPolyList","placeFreeHoles","hole","findEdgeRingContaining","buildMinimalEdgeRings","maxEdgeRings","findShell","placePolygonHoles","buildMaximalEdgeRings","dirEdges","getPolygons","shellCount","Boundable","getBounds","ItemBoundable","_bounds","_item","bounds","item","getItem","PriorityQueue","_size","_items","poll","minItem","reorder","child","SpatialIndex","itemEnv","query","AbstractNode","_childBoundables","_level","level","getLevel","getChildBoundables","addChildBoundable","childBoundable","computeBounds","Collections","reverseOrder","alen","singletonList","EnvelopeDistance","ax1","ay1","ax2","ay2","bx1","by1","bx2","by2","env2","miny","maxy","aminx","aminy","amaxx","amaxy","bminx","bminy","bmaxx","bmaxy","maxDistance","BoundablePair","_boundable1","_boundable2","_distance","_itemDistance","boundable1","boundable2","itemDistance","maximumDistance","expandToQueue","priQ","isComp1","isComposite","isComp2","expand","isLeaves","nd","bndComposite","bndOther","isFlipped","bp","getDistance","getBoundable","ItemVisitor","visitItem","AbstractSTRtree","_root","_built","_itemBoundables","_nodeCapacity","DEFAULT_NODE_CAPACITY","nodeCapacity","queryInternal","searchBounds","visitor","childBoundables","getIntersectsOp","matches","getNodeCapacity","lastNode","build","removeItem","childToRemove","itemsTree","valuesTree","valuesTreeForNode","valuesTreeForChild","boundablesAtLevel","boundables","top","boundable","createHigherLevels","getRoot","found","childToPrune","boundablesOfALevel","parentBoundables","createParentBoundables","maxChildDepth","childDepth","newLevel","sortedChildBoundables","getComparator","IntersectsOp","ItemDistance","item1","item2","STRtree","avg","kNearestNeighbors","items","createParentBoundablesFromVerticalSlices","verticalSlices","createParentBoundablesFromVerticalSlice","nearestNeighbourK","initBndPair","distanceLowerBound","bndPair","pairDistance","getItems","STRtreeNode","intersectsOp","sliceCount","sliceCapacity","slices","boundablesAddedToSlice","searchEnv","yComparator","minLeafCount","xComparator","nearestNeighbour","itemDist","minPair","tree","bnd","isWithinDistance","distanceUpperBound","compareDoubles","centreX","centreY","aBounds","bBounds","SegmentPointComparator","octant","xSign","relativeSign","ySign","compareValue","compareSign0","compareSign1","SegmentNode","_segString","_segmentOctant","_isInterior","segString","segmentOctant","maxSegmentIndex","isInterior","SegmentNodeList","_nodeMap","getSplitCoordinates","addEndpoints","eiPrev","ei","addEdgeCoordinates","addCollapsedNodes","collapsedVertexIndexes","findCollapsesFromInsertedNodes","findCollapsesFromExistingVertices","vertexIndex","createSplitEdgePts","ei0","ei1","lastSegStartPt","useIntPt1","ipt","addSplitEdges","edgeList","newEdge","createSplitEdge","findCollapseIndex","collapsedVertexIndex","numVerticesBetween","maxSegIndex","NodedSegmentString","eiNew","getSegmentOctant","checkSplitEdgesCorrectness","splitEdges","pt0","splitnPts","ptn","Octant","adx","ady","SegmentString","setData","NodableSegmentString","addIntersection","_nodeList","_data","segStrings","resultEdgelist","getNodedSubstrings","getNodeList","safeOctant","addIntersectionNode","normalizedSegmentIndex","nextSegIndex","nextPt","addIntersections","li","LineSegment","ls","minX","seg","orient0","orient1","geomFactory","isVertical","project","projectionFactor","pf0","pf1","newp0","newp1","distancePerpendicular","pointToLinePerpendicular","minY","midPoint","closestPoints","closestPt","close00","closestPoint","close01","close10","close11","factor","maxX","comp0","equalsTopo","lineIntersection","maxY","pointAlongOffset","segmentLengthFraction","offsetDistance","segx","segy","ux","uy","setCoordinates","segmentFraction","inputPt","segFrac","isHorizontal","reflect","A2plusB2","A2subB2","segmentToSegment","pointAlong","bits0","hash0","bits1","MonotoneChainOverlapAction","_overlapSeg1","_overlapSeg2","overlap","start1","mc2","start2","getLineSegment","MonotoneChain","_start","_end","_context","_id","context","computeSelect","start0","end0","mcs","select","computeOverlaps","mc","mco","end1","overlaps","mid0","mid1","setId","getEndIndex","getStartIndex","getContext","getId","MonotoneChainBuilder","safeStart","chainQuad","getChains","mcList","chainStart","chainEnd","findChainEnd","Noder","computeNodes","SinglePassNoder","_segInt","segInt","setSegmentIntersector","MCIndexNoder","_monoChains","_index","_idCounter","_nodedSegStrings","_nOverlaps","si","getMonotoneChains","getIndex","segStr","inputSegStrings","intersectChains","overlapAction","SegmentOverlapAction","queryChain","testChain","_si","ss1","ss2","processIntersections","BufferInputLineSimplifier","_inputLine","_distanceTol","_isDeleted","_angleOrientation","inputLine","distanceTol","simplify","isDeletable","i0","isConcave","isShallow","isShallowSampled","deleteShallowConcavities","midIndex","findNextNonDeletedIndex","lastIndex","isMiddleVertexDeleted","DELETE","isShallowConcavity","NUM_PTS_TO_CHECK","collapseLine","INIT","KEEP","OffsetSegmentString","_ptList","_minimimVertexDistance","COORDINATE_ARRAY_TYPE","addPt","bufPt","isRedundant","addPts","lastPt","startPt","setMinimumVertexDistance","minimimVertexDistance","Angle","radians","PI_TIMES_2","dx0","dy0","anglePrev","angleNext","tip1","tail","tip2","a1","a2","diff","ang1","ang2","delAngle","angleDegrees","crossproduct","sin","angDel","PI_OVER_2","PI_OVER_4","OffsetSegmentGenerator","_maxCurveSegmentError","_filletAngleQuantum","_closingSegLengthFactor","_segList","_bufParams","_li","_s0","_s1","_s2","_seg0","_seg1","_offset0","_offset1","_side","_hasNarrowConcaveAngle","bufParams","MAX_CLOSING_SEG_LEN_FACTOR","addNextSegment","addStartPoint","computeOffsetSegment","outsideTurn","addCollinear","addOutsideTurn","addInsideTurn","addLineEndCap","offsetL","offsetR","addDirectedFillet","squareCapSideOffset","squareCapLOffset","squareCapROffset","addMitreJoin","offset0","offset1","addLimitedMitreJoin","OFFSET_SEGMENT_SEPARATION_FACTOR","addBevelJoin","addCornerFillet","createSquare","addSegments","addFirstSegment","direction","radius","startAngle","endAngle","addLastSegment","initSideSegments","s1","s2","basePt","ang0","angDiffHalf","angleBetweenOriented","midAng","mitreMidAng","mitreDist","bevelHalfLen","bevelMidX","bevelMidY","bevelMidPt","mitreMidLine","bevelEndLeft","bevelEndRight","totalAngle","nSegs","angleInc","offset","sideSign","INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR","createCircle","CURVE_VERTEX_SNAP_DISTANCE_FACTOR","hasNarrowConcaveAngle","OffsetCurveBuilder","getOffsetCurve","inputPts","isRightSide","posDistance","segGen","getSegGen","computePointCurve","computeOffsetCurve","curvePts","computeSingleSidedBufferCurve","distTol","simplifyTolerance","simp2","simp1","computeRingBufferCurve","simp","computeLineBufferCurve","getLineCurve","isLineOffsetEmpty","getBufferParameters","bufDistance","getRingCurve","copyCoordinates","SubgraphDepthLocater","_subgraphs","_seg","subgraphs","findStabbedSegments","stabbingRayLeftPt","stabbedSegments","bsg","dirEdge","ds","DepthSegment","_leftDepth","_upwardSeg","orientIndex","compareX","seg0","seg1","compare0","NotRepresentableException","HCoordinate","_x","_y","_w","Triangle","m00","m01","m10","m11","v0","lenAB","lenBC","lenCA","maxLen","ay","bx","by","asqr","bsqr","numx","numy","ccx","ccy","isAcute","cx","cy","l1","l2","len0","frac","uz","vx","vy","vz","crossx","crossy","crossz","absSq","len1","circum","inCentreX","inCentreY","signedArea","interpolateZ","longestSideLength","circumcentre","area3D","centroid","inCentre","OffsetCurveSetBuilder","_inputGeom","_curveBuilder","_curveList","inputGeom","curveBuilder","addRingSide","cwLeftLoc","cwRightLoc","curve","addCurve","addRingBothSides","addPoint","addPolygon","offsetSide","shellCoord","removeRepeatedPoints","isErodedCompletely","holeCoord","isTriangleErodedCompletely","triangleCoord","bufferDistance","tri","addLineString","getCurves","addCollection","ringCoord","envMinDimension","PointOnGeometryLocator","locate","GeometryCollectionIterator","_parent","_atStart","_max","_subcollectionIterator","isAtomic","SimplePointInAreaLocator","_geom","shellLoc","holeLoc","locatePointInPolygon","geomi","g2","locateInGeometry","EdgeEndStar","_edgeMap","_edgeList","_ptInAreaLocation","getNextCW","iNextCW","propagateSideLabels","startLoc","currLoc","isAreaLabelsConsistent","geomGraph","computeEdgeEndLabels","getBoundaryNodeRule","checkAreaLabelsConsistent","lastEdgeIndex","findIndex","eSearch","getGeometry","computeLabelling","hasDimensionalCollapseEdge","getDegree","insertEdgeEnd","DirectedEdgeStar","_resultAreaEdgeList","_SCANNING_FOR_INCOMING","_LINKING_TO_OUTGOING","getResultAreaEdges","firstOut","incoming","nextOut","nextIn","de0","deLast","quad0","isNorthern","updateLabelling","nodeLabel","prevOut","firstIn","edgeIndex","startDepth","targetLastDepth","nextDepth","endIndex","currDepth","nextDe","mergeSymLabels","findCoveredLineEdges","eLabel","eLoc","OverlayNodeFactory","OrientedCoordinateArray","_orientation","orientation1","orientation2","limit1","limit2","compPt","done1","done2","oca","compareOriented","EdgeList","_ocaMap","edgeColl","findEdgeIndex","findEqualEdge","SegmentIntersector","e0","segIndex0","e1","segIndex1","IntersectionAdder","_hasIntersection","_hasProper","_hasProperInterior","_hasInterior","_properIntersectionPoint","_isSelfIntersection","numIntersections","numInteriorIntersections","numProperIntersections","numTests","isTrivialIntersection","isAdjacentSegments","getProperIntersectionPoint","hasProperInteriorIntersection","getLineIntersector","hasProperIntersection","p00","p01","p10","p11","hasInteriorIntersection","EdgeIntersection","getSegmentIndex","EdgeIntersectionList","Edge","IntersectionMatrix","_matrix","setAll","elements","actualDimensionValue","requiredDimensionSymbol","requiredDimensionSymbols","isIntersects","isDisjoint","isCovers","isCoveredBy","dimensionSymbols","row","col","toDimensionValue","column","isContains","setAtLeast","minimumDimensionSymbols","minimumDimensionValue","setAtLeastIfValid","isWithin","isTouches","dimensionOfGeometryA","dimensionOfGeometryB","isOverlaps","isEquals","builder","ai","bi","toDimensionSymbol","transpose","isCrosses","IntArrayList","initialCapacity","capacity","copyOf","MonotoneChainIndexer","list","getChainStartIndices","startIndexList","OLDgetChainStartIndices","toIntArray","MonotoneChainEdge","mcb","chainIndex","computeIntersectsForChain","chainIndex0","mce","chainIndex1","getStartIndexes","computeIntersects","Depth","NULL_VALUE","depthValue","minDepth","newValue","getDelta","depthAtLocation","_mce","_isIsolated","_depthDelta","getCollapsedEdge","newPts","toLineLabel","setIsolated","setName","isEqualForward","isEqualReverse","iRev","isCollapsed","getMaximumSegmentIndex","getMonotoneChainEdge","isPointwiseEqual","setDepthDelta","getEdgeIntersectionList","BufferBuilder","_workingPrecisionModel","_workingNoder","_geomFact","_graph","lLoc","rLoc","lines","ss","setWorkingPrecisionModel","insertUniqueEdge","existingEdge","existingLabel","labelToMerge","mergeDelta","newDelta","buildSubgraphs","subgraphList","polyBuilder","processedGraphs","subgraph","createSubgraphs","createEmptyResultGeometry","getNoder","noder","bufferSegStrList","computeNodedEdges","oldLabel","setNoder","ScaledNoder","_noder","_scaleFactor","_offsetX","_offsetY","_isScaled","scaleFactor","isIntegerPrecision","rescale","nodedSegmentStrings","roundPts","splitSS","intSegStrings","NodingValidator","_segStrings","checkEndPtVertexIntersections","checkInteriorIntersections","ss0","pts0","checkValid","checkCollapses","checkCollapse","HotPixel","_pt","_originalPt","_ptScaled","_p0Scaled","_p1Scaled","_corner","_safeEnv","initCorners","intersectsScaled","segMinx","segMaxx","segMiny","segMaxy","isOutsidePixelEnv","intersectsToleranceSquare","copyScaled","pScaled","getSafeEnvelope","safeTolerance","SAFE_ENV_EXPANSION_FACTOR","intersectsPixelClosure","intersectsLeft","intersectsBottom","addSnappedNode","segIndex","MonotoneChainSelectAction","selectedSegment","MCIndexPointSnapper","snap","hotPixel","parentEdge","hotPixelVertexIndex","pixelEnv","hotPixelSnapAction","HotPixelSnapAction","isNodeAdded","_hotPixel","_parentEdge","_hotPixelVertexIndex","_isNodeAdded","InteriorIntersectionFinderAdder","_interiorIntersections","getInteriorIntersections","MCIndexSnapRounder","_pm","_pointSnapper","checkCorrectness","inputSegmentStrings","resultSegStrings","nv","printStackTrace","snapRound","intersections","findInteriorIntersections","computeIntersectionSnaps","computeVertexSnaps","intFinderAdder","edge0","snapPts","snapPt","BufferOp","_argGeom","_resultGeometry","_saveException","getResultGeometry","bufOp","maxPrecisionDigits","bufEnvMax","minUnitLog10","bufferFixedPrecision","fixedPM","bufBuilder","bufferReducedPrecision","precDigits","MAX_PRECISION_DIGITS","precisionDigits","sizeBasedScaleFactor","precisionScaleFactor","computeGeometry","bufferOriginalPrecision","argPM","CAP_BUTT","BoundaryNodeRule","isInBoundary","boundaryCount","Mod2BoundaryNodeRule","EndPointBoundaryNodeRule","MultiValentEndPointBoundaryNodeRule","MonoValentEndPointBoundaryNodeRule","MOD2_BOUNDARY_RULE","ENDPOINT_BOUNDARY_RULE","MULTIVALENT_ENDPOINT_BOUNDARY_RULE","MONOVALENT_ENDPOINT_BOUNDARY_RULE","OGC_SFS_BOUNDARY_RULE","PointLocator","_boundaryRule","_isIn","_numBoundaries","boundaryRule","locateInPolygonRing","updateLocationInfo","computeLocation","locateOnPoint","locateOnLineString","locateInPolygon","ml","mpoly","isOnLine","BasicSegmentString","NodingIntersectionFinder","_findAllIntersections","_isCheckEndSegmentsOnly","_keepIntersections","_isInteriorIntersectionsOnly","_interiorIntersection","_intSegments","_intersections","_intersectionCount","finder","setFindAllIntersections","isEnd1","isEnd00","isEnd01","isEnd10","isEnd11","isInteriorVertexIntersection","setInteriorIntersectionsOnly","setKeepIntersections","setCheckEndSegmentsOnly","isCheckEndSegmentsOnly","getIntersectionSegments","getIntersections","findAllIntersections","keepIntersections","isSameSegString","isEndSegment","isInteriorInt","isInteriorVertexInt","isInteriorIntersectionsOnly","FastNodingValidator","_isValid","execute","getErrorMessage","intSegs","EdgeNodingValidator","_nv","toSegmentStrings","GeometryCollectionMapper","_mapOp","mapOp","op","mapped","LineBuilder","_op","_ptLocator","_lineEdgesList","_resultLineList","ptLocator","collectLines","opCode","getGraph","collectLineEdge","collectBoundaryTouchEdge","labelIsolatedLine","targetIndex","getArgGeometry","buildLines","OverlayOp","isResultOfOp","isCoveredByA","labelIsolatedLines","edgesList","INTERSECTION","PointBuilder","_resultPointList","filterCoveredNodeToPoint","isCoveredByLA","extractNonCoveredResultNodes","GeometryTransformer","_pruneEmptyGeometry","_preserveGeometryCollectionType","_preserveCollections","_preserveType","transformPoint","transformCoordinates","transformPolygon","isAllValidLinearRings","transformLinearRing","createCoordinateSequence","getInputGeometry","transformMultiLineString","transGeomList","transformGeom","transformLineString","transformMultiPoint","transformMultiPolygon","transformGeometryCollection","transform","seqSize","LineStringSnapper","_snapTolerance","_srcPts","_allowSnappingToSourceVertices","_isClosed","srcLine","snapTolerance","srcPts","snapVertices","srcCoords","srcPt","snapVert","findSnapForVertex","snapTo","snapSegments","distinctPtCount","findSegmentIndexToSnap","snapIndex","setAllowSnappingToSourceVertices","allowSnappingToSourceVertices","GeometrySnapper","_srcGeom","srcGeom","g0","g1","snapGeom","snapper0","snapper1","computeSizeBasedSnapTolerance","fixedSnapTol","computeOverlaySnapTolerance","SNAP_PRECISION_FACTOR","cleanResult","snapToSelf","extractTargetCoordinates","SnapTransformer","snappedGeom","computeSnapTolerance","ringPts","computeMinimumSegmentLength","ptSet","minSegLen","segLen","_snapPts","_isSelfSnap","isSelfSnap","snapLine","snapper","CommonBits","_isFirst","_commonMantissaBitsCount","_commonBits","_commonSignExp","getCommon","numBits","signExpBits","numCommonMostSigMantissaBits","zeroLowerBits","padStr","toBinaryString","bitStr","nBits","prop","num1","num2","getBit","CommonBitsRemover","_commonCoord","_ccFilter","CommonCoordinateFilter","addCommonBits","trans","Translater","removeCommonBits","invCoord","getCommonCoordinate","_commonBitsX","_commonBitsY","xp","yp","SnapOverlayOp","_cbr","overlayOp","UNION","SYMDIFFERENCE","DIFFERENCE","selfSnap","remGeom","prepareResult","prepGeom","SnapIfNeededOverlayOp","isSuccess","savedException","computeIntersections","SweepLineEvent","_xValue","_eventType","_insertEvent","_deleteEventIndex","_obj","insertEvent","INSERT","isDelete","setDeleteEventIndex","deleteEventIndex","getObject","pe","getInsertEvent","isInsert","isSameLabel","ev","getDeleteEventIndex","_includeProper","_recordIsolated","_numIntersections","_bdyNodes","_isDone","_isDoneWhenProperInt","includeProper","recordIsolated","setIsDoneIfProperInt","isDoneWhenProperInt","isBoundaryPointInternal","isBoundaryPoint","setBoundaryNodes","bdyNodes0","bdyNodes1","SimpleMCSweepLineIntersector","events","nOverlaps","prepareEvents","processOverlaps","edges0","edges1","addEdge","edgeSet","ev0","mc0","ev1","mc1","IntervalRTreeNode","_min","getMin","queryMin","queryMax","getMax","NodeComparator","mid2","IntervalRTreeLeafNode","IntervalRTreeBranchNode","_node1","_node2","buildExtent","SortedPackedIntervalRTree","_leaves","buildTree","buildLevel","buildRoot","printNode","LinearComponentExtracter","_lines","_isForcedToLineString","isForcedToLineString","getLines","forceToLineString","setForceToLineString","ArrayListVisitor","IndexedPointInAreaLocator","IntervalIndexedGeometry","rcc","SegmentVisitor","_counter","_isEmpty","addLine","GeometryGraph","_parentGeom","_lineEdgeMap","_boundaryNodeRule","_useBoundaryDeterminationRule","_argIndex","_boundaryNodes","_hasTooFewPoints","_invalidPoint","_areaPtLocator","parentGeom","insertBoundaryPoint","determineBoundary","computeSelfNodes","computeRingSelfNodes","isDoneIfProperInt","esi","createEdgeSetIntersector","isRings","computeAllSegments","addSelfIntersectionNodes","computeSplitEdges","edgelist","computeEdgeIntersections","hasTooFewPoints","insertPoint","addPolygonRing","getInvalidPoint","getBoundaryPoints","coll","addSelfIntersectionNode","lr","cwLeft","cwRight","eiIt","GeometryGraphOperation","_resultPrecisionModel","_arg","setComputationPrecision","_resultGeom","_resultPolyList","geom1","createEmptyResult","MapOp","dim0","dim1","resultDimension","overlayOpCode","geomFact","resultDim","loc0","loc1","cancelDuplicateResultEdges","resultPointList","resultLineList","opcode","replaceCollapsedEdges","newEdges","updateNodeLabelling","computeOverlay","insertUniqueEdges","copyPoints","baseSplitEdges","computeLabelsFromDepths","labelIncompleteNodes","findResultAreaEdges","lineBuilder","pointBuilder","labelIncompleteNode","graphNode","ni","EdgeEndBuilder","createEdgeEndForNext","eiCurr","eiNext","createEdgeEndForPrev","computeEdgeEnds","EdgeEndBundle","_edgeEnds","computeLabelOn","foundInterior","computeLabelSide","computeLabelSides","EdgeEndBundleStar","eb","RelateNode","updateIMFromEdges","RelateNodeFactory","RelateComputer","_im","_isolatedEdges","arg","insertEdgeEnds","computeProperIntersectionIM","intersector","dimA","dimB","hasProper","hasProperInterior","labelIsolatedEdges","thisIndex","labelIsolatedEdge","target","computeDisjointIM","computeIntersectionNodes","copyNodesAndLabels","labelIsolatedNodes","eeBuilder","ee0","ee1","labelNodeEdges","labelIntersectionNodes","labelIsolatedNode","ga","gb","RectangleContains","_rectEnv","rectangle","isContainedInBoundary","isPointContainedInBoundary","isLineStringContainedInBoundary","isLineSegmentContainedInBoundary","RectangleLineIntersector","_diagUp0","_diagUp1","_diagDown0","_diagDown1","rectEnv","segEnv","isSegUpwards","ShortCircuitedGeometryVisitor","applyTo","visit","RectangleIntersects","_rectangle","EnvelopeIntersectsVisitor","ecpVisitor","GeometryContainsPointVisitor","riVisitor","RectangleIntersectsSegmentVisitor","_intersects","elementEnv","_rectSeq","_containsPoint","rectPt","containsPointInPolygon","_rectIntersector","checkIntersectionWithLineStrings","testLine","checkIntersectionWithSegments","seq1","RelateOp","_relate","getIntersectionMatrix","relate","UnionOp","touches","expandGeometry","bufferOp","geometryToWkt","rectToPolygon","rect","reader","polyString","rectToWKTPolygonString","twoPointsToLineString","pointsToPolygon","distanceBetweenPoints","comparePoints","lesserPoint","greaterPoint","rectangleForSegment","thickness","slope","rectDelta","theta","atan","DungeonState","themeAreas","secretDoors","interiorWalls","geo.geometryToWkt","startState","journalEntry","serialized","makeWalls","content","fromString","__filters","setPrototypeOf","__proto__","prototype","hasOwnProperty","assign","gamma","saturation","contrast","brightness","red","green","blue","uniforms","applyFilter","Filter","threshold","defineProperty","enumerable","configurable","_kernels","_blur","_quality","uOffset","Float32Array","_pixelSize","pixelSize","_clamp","isArray","kernels","quality","_frame","getFilterTexture","returnFilterTexture","_updatePadding","padding","reduce","_generateKernels","bloomScale","_resolution","FILTER_RESOLUTION","defaults","blur","resolution","_extractFilter","_blurFilter","bloomTexture","v","_thickness","_angle","lightColor","shadowColor","rotation","lightAlpha","shadowAlpha","_updateTransform","transformX","transformY","DEG_TO_RAD","rgb2hex","hex2rgb","blurXFilter","BlurFilterPass","blurYFilter","blendMode","BLEND_MODES","SCREEN","defaultFilter","AlphaFilter","filterFrame","strength","center","mix","_sliceSize","_slicePixelSize","_sliceInnerSize","_nearest","_scaleMode","_colorMap","nearest","colorMap","_mix","Texture","baseTexture","scaleMode","mipmap","MIPMAP_MODES","OFF","SCALE_MODES","NEAREST","LINEAR","_glTextures","_updateID","emit","updateColorMap","destroy","_","_color","_alpha","_originalColor","_newColor","originalColor","newColor","epsilon","texelSize","matrix","F","time","seed","curvature","lineWidth","lineContrast","verticalLine","noise","noiseSize","vignetting","vignettingAlpha","vignettingBlur","O","_tintFilter","shadowOnly","_updateShift","fillMode","TRANSPARENT","average","minSize","sampleSize","_slices","_offsets","_sizes","_direction","_canvas","document","createElement","texture","aspect","_randomizeSizes","random","shuffle","_randomizeOffsets","redraw","clearRect","fillStyle","fillRect","displacementMap","slicesWidth","slicesOffset","sinDir","cosDir","ORIGINAL","LOOP","CLAMP","MIRROR","outerStrength","innerStrength","knockout","replace","toFixed","glowColor","parallel","_angleLight","gain","lacunarity","light","kernelSize","uVelocity","_velocity","ObservablePoint","velocityChanged","setVelocity","velocity","uKernelSize","copyFrom","_replacements","_maxColors","originalColors","targetColors","replacements","R","sepia","scratch","scratchDensity","scratchWidth","getAngleStep","outlineColor","MAX_SAMPLES","MIN_SAMPLES","I","uRadian","uCenter","uRadius","amplitude","waveLength","mirror","boundary","N","wavelength","speed","ambientColor","uLightmap","G","gradientBlur","window","innerHeight","delta","texSize","innerWidth","updateDelta","K","W","tiltShiftXFilter","tiltShiftYFilter","maxKernelSize","getOwnPropertySymbols","propertyIsEnumerable","uStrength","uInnerRadius","innerRadius","AdjustmentFilter","AdvancedBloomFilter","AsciiFilter","BevelFilter","BloomFilter","BulgePinchFilter","CRTFilter","ColorMapFilter","ColorOverlayFilter","ColorReplaceFilter","ConvolutionFilter","CrossHatchFilter","DotFilter","DropShadowFilter","EmbossFilter","GlitchFilter","GlowFilter","GodrayFilter","KawaseBlurFilter","MotionBlurFilter","MultiColorReplaceFilter","OldFilmFilter","OutlineFilter","PixelateFilter","RGBSplitFilter","RadialBlurFilter","ReflectionFilter","ShockwaveFilter","SimpleLightmapFilter","TiltShiftAxisFilter","TiltShiftFilter","TiltShiftXFilter","TiltShiftYFilter","TwistFilter","ZoomBlurFilter","PIXI","filters","drawThemeAreas","container","themeType","areaState","areaContainer","Container","areaMask","Graphics","beginFill","drawPolygon","flat","endFill","clipPoly","geo.pointsToPolygon","renderPass","addChild","floorGfx","interiorShadowGfx","wallGfx","addExteriorShadow","clipMask","drawMultiPolygonMask","alphaFilter","blurFilter","BlurFilter","addTiledBackground","drawMultiPolygonRoom","wallMask","maskConfig","drawInteriorWallShadow","drawInteriorWall","drawDoorShadow","drawDoor","secretDoor","drawSecretDoor","drawMultiPolygonWallMask","expandedGeometry","geo.expandGeometry","getTexture","path","loadTexture","addBackgroundImage","valid","bg","Sprite","paddingX","shiftX","paddingY","shiftY","sceneWidth","sceneHeight","maybeStartSpriteVideo","sprite","source","resource","tagName","loop","volume","video","play","addExteriorShadowForPoly","outerShadow","expanded","string2hex","texturePath","textureTint","textureSize","rows","cols","geo.intersects","geo.touches","TilingSprite","tint","colorStringToHex","drawPolygonMask","gfx","flatCoords","lineStyle","beginHole","endHole","drawPolygonWallMask","drawPolygonRoom","alignment","cap","moveTo","lineTo","totalLength","geo.distanceBetweenPoints","jambFraction","rectEndFraction","jamb1End","rectEnd","doorRect","geo.rectangleForSegment","middle","midRect","midRect2","bezierCurveTo","Dungeon","PlaceableObject","note","history","historyIndex","deleteAll","lastState","resetState","saveToJournalEntry","draw","savedState","loadFromJournalEntry","pushState","newState","_addDoor","doorProperty","doorPoly","geo.twoPointsToLineString","wallsToDelete","wallsToAdd","wallPoly","geo.contains","w1","geo.lesserPoint","w2","geo.greaterPoint","d1","rectPoly","geo.rectToPolygon","doorsToKeep","_maybeSplitWall","wallsToKeep","oldState","secretDoorsToKeep","union","geo.intersection","_addPoly","difference","newArea","areasToKeep","areaPoly","createDungeonEntry","folder","folders","Folder","JournalEntry","createDungeonNote","entryId","fontSize","icon","iconSize","textAnchor","textColor","iconTint","text","DungeonLayer","PlaceablesLayer","dungeonContainer","layerOptions","LAYER_NAME","canDragCreate","zIndex","_getNewDrawingData","origin","tool","activeTool","fillColor","strokeColor","strokeWidth","author","CONST","DRAWING_TYPES","RECTANGLE","ELLIPSE","documentName","Dialog","confirm","format","yes","_deleteAll","notes","journal","findDungeonEntryAndNote","addChildAt","createDungeonEntryAndNote","loadDungeon","createState","originalEvent","isPolygon","destination","shiftKey","grid","getSnappedPosition","gridPrecision","_addPoint","_chain","_onClickLeft","_onClickLeft2","_onDragLeftDrop","_onDragLeftStart","DrawingDocument","drawing","Drawing","_onDragLeftMove","_onMouseDraw","createNewDungeon","hypot","completePolygon","toObject","addDoor","addSecretDoor","addInteriorWall","createData","placeableClass","normalizeShape","offsetPoints","addRectangle","subtractDoorsAndInteriorWalls","removeThemeAreas","addThemeArea","subtractRectangle","_onDragLeftCancel","DungeonDraw","register","scope","String","maybeShowReleaseNotes","moduleVersion","modules","version","resp","fetch","firstChangelog","renderTemplate","changelog","buttons","roll","controls","CONFIG","Canvas","layers","background","group","layerClass","layer","visible","isTrusted","tools","onClick","undo","button","redo","userId","maybeRefresh","Hooks","ready","getSceneControlButtons","canvasReady","updateJournalEntry"],"mappings":"AACO,MAAMA,EAAc,eC+BdC,EAAYC,IACvB,MAAMC,EAASD,EAASE,MAAM,KACxBC,EAAOF,EAAO,GACdG,EAAMH,EAAO,GACnB,GAAa,WAATE,EAAmB,CAErB,OADqBE,IACDD,GAEtB,OAAOE,EAAOF,IAGHC,EAAkB,KAC7B,IACE,MAAME,EAAqBC,KAAKC,SAASC,IACvCC,EACA,gBAEF,OAAOC,KAAKC,MAAMN,GAClB,MAAOO,GAEP,OADAC,QAAQC,IAAIF,GACL,KAIEG,EAAmBC,IAC9B,MAAMC,EAAeP,KAAKQ,UAAUF,GACpCV,KAAKC,SAASY,IAAIV,EAAuB,eAAgBQ,IAG9CG,EAA0B,IAC9Bd,KAAKC,SAASC,IACnBC,ED7DuC,qBC0E9BL,EAAS,CACpBiB,QAAS,CACPC,KAAM,UACNC,OA5EK,CACLC,gBAAiB,GACjBC,UAAW,UACXC,cAAe,UACfC,gBAAiB,EACjBC,kBAAmB,EACnBC,cAAe,GACfC,oBAAqB,UACrBC,wBAAyB,GACzBC,sBAAuB,GACvBC,WAAY,UACZC,aAAc,GACdC,iBAAkB,GAClBC,oBAAqB,UACrBC,wBAAyB,EACzBC,sBAAuB,GACvBC,qBAAsB,UACtBC,eAAgB,UAChBC,iBAAkB,GAClBC,iBAAkB,UAClBC,kBAAmB,SACnBC,sBAAuB,OACvBC,UAAW,UACXC,YAAa,GACbC,gBAAiB,GACjBC,cAAe,IAqDj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,QAAQA,QAAQquG,QAE/BD,QAAQ,GAEV,CACEjzG,KAAM,SACN+D,MAAO,uBACP6oG,KAAM,aACNmG,QAAS,KAAM,IAAIvuG,GAAc2C,QAAO,GACxC8rG,QAAQ,GAEV,CACEjzG,KAAM,QACN+D,MAAO,sBACP6oG,KAAM,eAENgG,SAAS,EACTG,QAAS,IAAMnuG,OAAOC,QAAQmlG,YAC9BiJ,QAAQ,IAGZrF,WAAY,YAIhB3iG,yBAAyBrG,SACjBA,EAAOC,QAAQmqG,cAGvB/jG,gCAAgC6wF,EAAU/0F,EAAQf,EAASmtG,GACrDn0G,KAAKwG,KAAKlC,KAAO6vG,SAEbvuG,OAAOC,QAAQA,SAASuuG,aAAatX,KAKjDuX,MAAM5mE,GAAG,OAAQ4kE,GAAYr9F,MAC7Bq/F,MAAM5mE,GAAG,QAAS4kE,GAAYiC,OAC9BD,MAAM5mE,GAAG,yBAA0B4kE,GAAYkC,wBAC/CF,MAAM5mE,GAAG,cAAe4kE,GAAYmC,aACpCH,MAAM5mE,GAAG,qBAAsB4kE,GAAYoC"} \ No newline at end of file diff --git a/src/dungeondraw.js b/src/dungeondraw.js index 2ce3da4..e3a8327 100644 --- a/src/dungeondraw.js +++ b/src/dungeondraw.js @@ -89,7 +89,18 @@ export class DungeonDraw { } static getSceneControlButtons(controls) { - CONFIG.Canvas.layers.dungeon = DungeonLayer; + if (CONFIG.Canvas.layers.background?.group) { + // v9+ layer setup + CONFIG.Canvas.layers.dungeon = { + layerClass: DungeonLayer, + group: "primary", + }; + } else { + // v8 layer setup + // TODO: remove this if/else once v8 is gone from existence + CONFIG.Canvas.layers.dungeon = DungeonLayer; + } + CONFIG.Dungeon = { //documentClass: DungeonDocument, layerClass: DungeonLayer,