From 0c2bbc482ffa6312e5cecdb4dd49f8884378e004 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Fri, 22 Jan 2016 14:01:02 +0100 Subject: [PATCH] Add security to make not to longer cadastre request --- .gitignore | 1 - app/assets/javascripts/application.js | 3 +- app/assets/javascripts/carte/cadastre.js | 11 ++++---- app/assets/javascripts/carte/carte.js | 35 ++++++++++++++++++++---- vendor/assets/javascripts/turf.js | 18 ++++++++++++ 5 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 vendor/assets/javascripts/turf.js diff --git a/.gitignore b/.gitignore index b72d999d0..255ab6ef0 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,5 @@ config/initializers/token.rb doc/*.svg rubocop.html config/france_connect.yml -vendor/**/* uploads/* diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 2e085c684..bc36d7d72 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -24,4 +24,5 @@ //= require concavehull.min //= require graham_scan.min //= require leaflet.freedraw -//= require smart_listing \ No newline at end of file +//= require smart_listing +//= require turf diff --git a/app/assets/javascripts/carte/cadastre.js b/app/assets/javascripts/carte/cadastre.js index db3912df5..9ee82261d 100644 --- a/app/assets/javascripts/carte/cadastre.js +++ b/app/assets/javascripts/carte/cadastre.js @@ -21,17 +21,17 @@ function get_cadastre(coordinates) { return cadastre['cadastres']; } -function display_cadastre(cadastre_list) { +function display_cadastre(cadastre_array) { if (!cadastre_active()) return; - cadastre_array = cadastre_list; - $("#cadastre.list ul").html(''); - new_cadastreLayer(); - if (cadastre_array.length > 0) { + if (cadastre_array.length == 1 && cadastre_array[0]['zoom_error']) + $("#cadastre.list ul").html('
  • Merci de dessiner une surface plus petite afin de récupérer les parcelles cadastrales.
  • '); + + else if (cadastre_array.length > 0) { cadastre_array.forEach(function (cadastre) { $("#cadastre.list ul").append('
  • Parcelle n°' + cadastre.numero + ' - Feuille ' + cadastre.code_arr + ' ' + cadastre.section + ' ' + cadastre.feuille+ '
  • '); @@ -56,6 +56,5 @@ function new_cadastreLayer() { map.removeLayer(cadastreItems); cadastreItems = new L.GeoJSON(); - cadastreItems.addTo(map); } \ No newline at end of file diff --git a/app/assets/javascripts/carte/carte.js b/app/assets/javascripts/carte/carte.js index 239a6aef0..41cd316c9 100644 --- a/app/assets/javascripts/carte/carte.js +++ b/app/assets/javascripts/carte/carte.js @@ -41,17 +41,42 @@ function initCarto() { add_event_freeDraw(); } -function default_position (){ +function default_position() { return {lon: LON, lat: LAT, zoom: 13} } -function get_external_data (latLngs){ - +function get_external_data(latLngs) { if (qp_active()) display_qp(get_qp(latLngs)); - if (cadastre_active()) - display_cadastre(get_cadastre(latLngs)); + if (cadastre_active()) { + cadastre_list = []; + + polygons = {"type": "FeatureCollection", "features": []}; + + for (i = 0; i < latLngs.length; i++) + polygons.features.push(feature_polygon_latLngs(latLngs[i])) + + if (turf.area(polygons) < 300000) + cadastre_list = get_cadastre(latLngs); + else + cadastre_list = [{zoom_error: true}]; + + display_cadastre(cadastre_list); + } +} + +function feature_polygon_latLngs(coordinates) { + return ({ + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + JSON.parse(L.FreeDraw.Utilities.getJsonPolygons([coordinates]))['latLngs'] + ] + } + }) } function add_event_freeDraw() { diff --git a/vendor/assets/javascripts/turf.js b/vendor/assets/javascripts/turf.js new file mode 100644 index 000000000..2b8892ab0 --- /dev/null +++ b/vendor/assets/javascripts/turf.js @@ -0,0 +1,18 @@ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.turf=t()}}(function(){var t;return function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var g=n[s]={exports:{}};t[s][0].call(g.exports,function(e){var n=t[s][1][e];return r(n?n:e)},g,g.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;sF)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+F.toString(16)+" bytes");0>r?r=0:r>>>=0;var s=this;o.TYPED_ARRAY_SUPPORT?s=o._augment(new Uint8Array(r)):(s.length=r,s._isBuffer=!0);var a;if(o.TYPED_ARRAY_SUPPORT&&"number"==typeof t.byteLength)s._set(t);else if(N(t))if(o.isBuffer(t))for(a=0;r>a;a++)s[a]=t.readUInt8(a);else for(a=0;r>a;a++)s[a]=(t[a]%256+256)%256;else if("string"===i)s.write(t,0,e);else if("number"===i&&!o.TYPED_ARRAY_SUPPORT&&!n)for(a=0;r>a;a++)s[a]=0;return r>0&&r<=o.poolSize&&(s.parent=B),s}function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);var i=new o(t,e,n);return delete i.parent,i}function i(t,e,n,o){n=Number(n)||0;var r=t.length-n;o?(o=Number(o),o>r&&(o=r)):o=r;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");o>i/2&&(o=i/2);for(var s=0;o>s;s++){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))throw new Error("Invalid hex string");t[n+s]=a}return s}function s(t,e,n,o){var r=M(P(e,t.length-n),t,n,o);return r}function a(t,e,n,o){var r=M(R(e),t,n,o);return r}function u(t,e,n,o){return a(t,e,n,o)}function p(t,e,n,o){var r=M(O(e),t,n,o);return r}function g(t,e,n,o){var r=M(w(e,t.length-n),t,n,o);return r}function l(t,e,n){return T.fromByteArray(0===e&&n===t.length?t:t.slice(e,n))}function h(t,e,n){var o="",r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)t[i]<=127?(o+=A(r)+String.fromCharCode(t[i]),r=""):r+="%"+t[i].toString(16);return o+A(r)}function d(t,e,n){var o="";n=Math.min(t.length,n);for(var r=e;n>r;r++)o+=String.fromCharCode(127&t[r]);return o}function c(t,e,n){var o="";n=Math.min(t.length,n);for(var r=e;n>r;r++)o+=String.fromCharCode(t[r]);return o}function f(t,e,n){var o=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>o)&&(n=o);for(var r="",i=e;n>i;i++)r+=b(t[i]);return r}function m(t,e,n){for(var o=t.slice(e,n),r="",i=0;it)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||s>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range")}function v(t,e,n,o){0>e&&(e=65535+e+1);for(var r=0,i=Math.min(t.length-n,2);i>r;r++)t[n+r]=(e&255<<8*(o?r:1-r))>>>8*(o?r:1-r)}function E(t,e,n,o){0>e&&(e=4294967295+e+1);for(var r=0,i=Math.min(t.length-n,4);i>r;r++)t[n+r]=e>>>8*(o?r:3-r)&255}function x(t,e,n,o,r,i){if(e>r||i>e)throw new RangeError("value is out of bounds");if(n+o>t.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function I(t,e,n,o,r){return r||x(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),D.write(t,e,n,o,23,4),n+4}function S(t,e,n,o,r){return r||x(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),D.write(t,e,n,o,52,8),n+8}function L(t){if(t=C(t).replace(_,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function C(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function N(t){return G(t)||o.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function b(t){return 16>t?"0"+t.toString(16):t.toString(16)}function P(t,e){e=e||1/0;for(var n,o=t.length,r=null,i=[],s=0;o>s;s++){if(n=t.charCodeAt(s),n>55295&&57344>n){if(!r){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===o){(e-=3)>-1&&i.push(239,191,189);continue}r=n;continue}if(56320>n){(e-=3)>-1&&i.push(239,191,189),r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&((e-=3)>-1&&i.push(239,191,189),r=null);if(128>n){if((e-=1)<0)break;i.push(n)}else if(2048>n){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(65536>n){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(2097152>n))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function R(t){for(var e=[],n=0;n>8,r=n%256,i.push(r),i.push(o);return i}function O(t){return T.toByteArray(L(t))}function M(t,e,n,o){for(var r=0;o>r&&!(r+n>=e.length||r>=t.length);r++)e[r+n]=t[r];return r}function A(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}var T=t("base64-js"),D=t("ieee754"),G=t("is-array");n.Buffer=o,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,o.poolSize=8192;var F=1073741823,B={};o.TYPED_ARRAY_SUPPORT=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(n){return!1}}(),o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);s>i&&t[i]===e[i];i++);return i!==s&&(n=t[i],r=e[i]),r>n?-1:n>r?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!G(t))throw new TypeError("Usage: Buffer.concat(list[, length])");if(0===t.length)return new o(0);if(1===t.length)return t[0];var n;if(void 0===e)for(e=0,n=0;n>>1;break;case"utf8":case"utf-8":n=P(t).length;break;case"base64":n=O(t).length;break;default:n=t.length}return n},o.prototype.length=void 0,o.prototype.parent=void 0,o.prototype.toString=function(t,e,n){var o=!1;if(e>>>=0,n=void 0===n||1/0===n?this.length:n>>>0,t||(t="utf8"),0>e&&(e=0),n>this.length&&(n=this.length),e>=n)return"";for(;;)switch(t){case"hex":return f(this,e,n);case"utf8":case"utf-8":return h(this,e,n);case"ascii":return d(this,e,n);case"binary":return c(this,e,n);case"base64":return l(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,e,n);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===o.compare(this,t)},o.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},o.prototype.compare=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:o.compare(this,t)},o.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},o.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},o.prototype.write=function(t,e,n,o){if(isFinite(e))isFinite(n)||(o=n,n=void 0);else{var r=o;o=e,e=n,n=r}if(e=Number(e)||0,0>n||0>e||e>this.length)throw new RangeError("attempt to write outside buffer bounds");var l=this.length-e;n?(n=Number(n),n>l&&(n=l)):n=l,o=String(o||"utf8").toLowerCase();var h;switch(o){case"hex":h=i(this,t,e,n);break;case"utf8":case"utf-8":h=s(this,t,e,n);break;case"ascii":h=a(this,t,e,n);break;case"binary":h=u(this,t,e,n);break;case"base64":h=p(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":h=g(this,t,e,n);break;default:throw new TypeError("Unknown encoding: "+o)}return h},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),t>e&&(e=t);var r;if(o.TYPED_ARRAY_SUPPORT)r=o._augment(this.subarray(t,e));else{var i=e-t;r=new o(i,void 0,!0);for(var s=0;i>s;s++)r[s]=this[s+t]}return r.length&&(r.parent=this.parent||this),r},o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||y(t,e,this.length);for(var o=this[t],r=1,i=0;++i>>=0,e>>>=0,n||y(t,e,this.length);for(var o=this[t+--e],r=1;e>0&&(r*=256);)o+=this[t+--e]*r;return o},o.prototype.readUInt8=function(t,e){return e||y(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||y(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||y(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||y(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||y(t,e,this.length);for(var o=this[t],r=1,i=0;++i=r&&(o-=Math.pow(2,8*e)),o},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||y(t,e,this.length);for(var o=e,r=1,i=this[t+--o];o>0&&(r*=256);)i+=this[t+--o]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*e)),i},o.prototype.readInt8=function(t,e){return e||y(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||y(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){e||y(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return e||y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||y(t,4,this.length),D.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||y(t,4,this.length),D.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||y(t,8,this.length),D.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||y(t,8,this.length),D.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,n,o){t=+t,e>>>=0,n>>>=0,o||j(this,t,e,n,Math.pow(2,8*n),0);var r=1,i=0;for(this[e]=255&t;++i>>0&255;return e+n},o.prototype.writeUIntBE=function(t,e,n,o){t=+t,e>>>=0,n>>>=0,o||j(this,t,e,n,Math.pow(2,8*n),0);var r=n-1,i=1;for(this[e+r]=255&t;--r>=0&&(i*=256);)this[e+r]=t/i>>>0&255;return e+n},o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t,e+1},o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t,this[e+1]=t>>>8):v(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t):v(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t):E(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t):E(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,n,o){t=+t,e>>>=0,o||j(this,t,e,n,Math.pow(2,8*n-1)-1,-Math.pow(2,8*n-1));var r=0,i=1,s=0>t?1:0;for(this[e]=255&t;++r>0)-s&255;return e+n},o.prototype.writeIntBE=function(t,e,n,o){t=+t,e>>>=0,o||j(this,t,e,n,Math.pow(2,8*n-1)-1,-Math.pow(2,8*n-1));var r=n-1,i=1,s=0>t?1:0;for(this[e+r]=255&t;--r>=0&&(i*=256);)this[e+r]=(t/i>>0)-s&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t,this[e+1]=t>>>8):v(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t):v(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):E(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||j(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t):E(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,n){return I(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return I(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return S(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return S(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){var i=this;if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&n>r&&(r=n),r===n)return 0;if(0===t.length||0===i.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>n||n>=i.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-es||!o.TYPED_ARRAY_SUPPORT)for(var a=0;s>a;a++)t[a+e]=this[a+n];else t._set(this.subarray(n,n+s),e);return s},o.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),e>n)throw new RangeError("end < start");if(n!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var o;if("number"==typeof t)for(o=e;n>o;o++)this[o]=t;else{var r=P(t.toString()),i=r.length;for(o=e;n>o;o++)this[o]=r[o%i]}return this}},o.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(o.TYPED_ARRAY_SUPPORT)return new o(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;n>e;e+=1)t[e]=this[e];return t.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var q=o.prototype;o._augment=function(t){return t.constructor=o,t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=q.get,t.set=q.set,t.write=q.write,t.toString=q.toString,t.toLocaleString=q.toString,t.toJSON=q.toJSON,t.equals=q.equals,t.compare=q.compare,t.copy=q.copy,t.slice=q.slice,t.readUIntLE=q.readUIntLE,t.readUIntBE=q.readUIntBE,t.readUInt8=q.readUInt8,t.readUInt16LE=q.readUInt16LE,t.readUInt16BE=q.readUInt16BE,t.readUInt32LE=q.readUInt32LE,t.readUInt32BE=q.readUInt32BE,t.readIntLE=q.readIntLE,t.readIntBE=q.readIntBE,t.readInt8=q.readInt8,t.readInt16LE=q.readInt16LE,t.readInt16BE=q.readInt16BE,t.readInt32LE=q.readInt32LE,t.readInt32BE=q.readInt32BE,t.readFloatLE=q.readFloatLE,t.readFloatBE=q.readFloatBE,t.readDoubleLE=q.readDoubleLE,t.readDoubleBE=q.readDoubleBE,t.writeUInt8=q.writeUInt8,t.writeUIntLE=q.writeUIntLE,t.writeUIntBE=q.writeUIntBE,t.writeUInt16LE=q.writeUInt16LE,t.writeUInt16BE=q.writeUInt16BE,t.writeUInt32LE=q.writeUInt32LE,t.writeUInt32BE=q.writeUInt32BE,t.writeIntLE=q.writeIntLE,t.writeIntBE=q.writeIntBE,t.writeInt8=q.writeInt8,t.writeInt16LE=q.writeInt16LE,t.writeInt16BE=q.writeInt16BE,t.writeInt32LE=q.writeInt32LE,t.writeInt32BE=q.writeInt32BE,t.writeFloatLE=q.writeFloatLE,t.writeFloatBE=q.writeFloatBE,t.writeDoubleLE=q.writeDoubleLE,t.writeDoubleBE=q.writeDoubleBE,t.fill=q.fill,t.inspect=q.inspect,t.toArrayBuffer=q.toArrayBuffer,t};var _=/[^+\/0-9A-z\-]/g},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(t,e,n){var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===s||e===l?62:e===a||e===h?63:u>e?-1:u+10>e?e-u+26+26:g+26>e?e-g:p+26>e?e-p+26:void 0}function n(t){function n(t){p[l++]=t}var o,r,s,a,u,p;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var g=t.length;u="="===t.charAt(g-2)?2:"="===t.charAt(g-1)?1:0,p=new i(3*t.length/4-u),s=u>0?t.length-4:t.length;var l=0;for(o=0,r=0;s>o;o+=4,r+=3)a=e(t.charAt(o))<<18|e(t.charAt(o+1))<<12|e(t.charAt(o+2))<<6|e(t.charAt(o+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===u?(a=e(t.charAt(o))<<2|e(t.charAt(o+1))>>4,n(255&a)):1===u&&(a=e(t.charAt(o))<<10|e(t.charAt(o+1))<<4|e(t.charAt(o+2))>>2,n(a>>8&255),n(255&a)),p}function r(t){function e(t){return o.charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var r,i,s,a=t.length%3,u="";for(r=0,s=t.length-a;s>r;r+=3)i=(t[r]<<16)+(t[r+1]<<8)+t[r+2],u+=n(i);switch(a){case 1:i=t[t.length-1],u+=e(i>>2),u+=e(i<<4&63),u+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],u+=e(i>>10),u+=e(i>>4&63),u+=e(i<<2&63),u+="="}return u}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),p="a".charCodeAt(0),g="A".charCodeAt(0),l="-".charCodeAt(0),h="_".charCodeAt(0);t.toByteArray=n,t.fromByteArray=r}("undefined"==typeof n?this.base64js={}:n)},{}],4:[function(t,e,n){n.read=function(t,e,n,o,r){var i,s,a=8*r-o-1,u=(1<>1,g=-7,l=n?r-1:0,h=n?-1:1,d=t[e+l];for(l+=h,i=d&(1<<-g)-1,d>>=-g,g+=a;g>0;i=256*i+t[e+l],l+=h,g-=8);for(s=i&(1<<-g)-1,i>>=-g,g+=o;g>0;s=256*s+t[e+l],l+=h,g-=8);if(0===i)i=1-p;else{if(i===u)return s?0/0:1/0*(d?-1:1);s+=Math.pow(2,o),i-=p}return(d?-1:1)*s*Math.pow(2,i-o)},n.write=function(t,e,n,o,r,i){var s,a,u,p=8*i-r-1,g=(1<>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=o?0:i-1,c=o?1:-1,f=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(a=isNaN(e)?1:0,s=g):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),e+=s+l>=1?h/u:h*Math.pow(2,1-l),e*u>=2&&(s++,u/=2),s+l>=g?(a=0,s=g):s+l>=1?(a=(e*u-1)*Math.pow(2,r),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;t[n+d]=255&a,d+=c,a/=256,r-=8);for(s=s<0;t[n+d]=255&s,d+=c,s/=256,p-=8);t[n+d-c]|=128*f}},{}],5:[function(t,e){var n=Array.isArray,o=Object.prototype.toString;e.exports=n||function(t){return!!t&&"[object Array]"==o.call(t)}},{}],6:[function(t,e){function n(t){return"average"===t||"sum"===t||"median"===t||"min"===t||"max"===t||"deviation"===t||"variance"===t||"count"===t}var o=t("turf-average"),r=t("turf-sum"),i=t("turf-median"),s=t("turf-min"),a=t("turf-max"),u=t("turf-deviation"),p=t("turf-variance"),g=t("turf-count"),l={};l.average=o,l.sum=r,l.median=i,l.min=s,l.max=a,l.deviation=u,l.variance=p,l.count=g,e.exports=function(t,e,o){for(var r=0,i=o.length;i>r;r++){var s=o[r],a=s.aggregation;if(!n(a))throw new Error('"'+a+'" is not a recognized aggregation operation.');t="count"===a?l[a](t,e,s.outField):l[a](t,e,s.inField,s.outField)}return t}},{"turf-average":11,"turf-count":56,"turf-deviation":58,"turf-max":91,"turf-median":92,"turf-min":96,"turf-sum":116,"turf-variance":125}],7:[function(t,e){var n=t("turf-distance"),o=t("turf-point"),r=t("turf-bearing"),i=t("turf-destination");e.exports=function(t,e,s){var a;if("Feature"===t.type)a=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");a=t.geometry.coordinates}for(var u=0,p=0;p=u&&p===a.length-1);p++){if(u>=e){var g=e-u;if(g){var l=r(o(a[p]),o(a[p-1]))-180,h=i(o(a[p]),g,l,s);return h}return o(a[p])}u+=n(o(a[p]),o(a[p+1]),s)}return o(a[a.length-1])}},{"turf-bearing":13,"turf-destination":57,"turf-distance":60,"turf-point":102}],8:[function(t,e){var n=t("geojson-area").geometry;e.exports=function(t){if("FeatureCollection"===t.type){for(var e=0,o=0;e0){e+=Math.abs(r(t[0]));for(var n=1;n2){for(var n,o,r=0;rt&&(e.push(o),n=r)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}},n.prototype.pos=function(t){function e(t,e,n,o,r){var i=function(t){var e=t*t,n=e*t;return[n,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]},s=i(t),a={x:r.x*s[0]+o.x*s[1]+n.x*s[2]+e.x*s[3],y:r.y*s[0]+o.y*s[1]+n.y*s[2]+e.y*s[3],z:r.z*s[0]+o.z*s[1]+n.z*s[2]+e.z*s[3]};return a}var n=t-this.delay;0>n&&(n=0),n>this.duration&&(n=this.duration-1);var o=n/this.duration;if(o>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*o),i=(this.length-1)*o-r;return e(i,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])},e.exports=n},{}],16:[function(t,e){var n=t("turf-featurecollection"),o=t("turf-polygon"),r=t("turf-combine"),i=t("jsts");e.exports=function(t,e,n){var o;switch(n){case"miles":e/=69.047;break;case"feet":e/=364568;break;case"kilometers":e/=111.12;break;case"meters":e/=111120;break;case"degrees":}if("FeatureCollection"===t.type){var i=r(t);return i.properties={},o=s(i,e)}return o=s(t,e)};var s=function(t,e){var r=new i.io.GeoJSONReader,s=r.read(JSON.stringify(t.geometry)),a=s.buffer(e),u=new i.io.GeoJSONParser;return a=u.write(a),"MultiPolygon"===a.type?(a={type:"Feature",geometry:a,properties:{}},a=n([a])):a=n([o(a.coordinates)]),a}},{jsts:17,"turf-combine":24,"turf-featurecollection":72,"turf-polygon":103}],17:[function(t,e){t("javascript.util");var n=t("./lib/jsts");e.exports=n},{"./lib/jsts":18,"javascript.util":20}],18:[function(t,e){jsts={version:"0.15.0",algorithm:{distance:{},locate:{}},error:{},geom:{util:{}},geomgraph:{index:{}},index:{bintree:{},chain:{},kdtree:{},quadtree:{},strtree:{}},io:{},noding:{snapround:{}},operation:{buffer:{},distance:{},overlay:{snap:{}},polygonize:{},predicate:{},relate:{},union:{},valid:{}},planargraph:{},simplify:{},triangulate:{quadedge:{}},util:{}},"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),jsts.abstractFunc=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.error={},jsts.error.IllegalArgumentError=function(t){this.name="IllegalArgumentError",this.message=t},jsts.error.IllegalArgumentError.prototype=new Error,jsts.error.TopologyError=function(t,e){this.name="TopologyError",this.message=e?t+" [ "+e+" ]":t},jsts.error.TopologyError.prototype=new Error,jsts.error.AbstractMethodInvocationError=function(){this.name="AbstractMethodInvocationError",this.message="Abstract method called, should be implemented in subclass."},jsts.error.AbstractMethodInvocationError.prototype=new Error,jsts.error.NotImplementedError=function(){this.name="NotImplementedError",this.message="This method has not yet been implemented."},jsts.error.NotImplementedError.prototype=new Error,jsts.error.NotRepresentableError=function(t){this.name="NotRepresentableError",this.message=t},jsts.error.NotRepresentableError.prototype=new Error,jsts.error.LocateFailureError=function(t){this.name="LocateFailureError",this.message=t},jsts.error.LocateFailureError.prototype=new Error,"undefined"!=typeof e&&(e.exports=jsts),jsts.geom.GeometryFilter=function(){},jsts.geom.GeometryFilter.prototype.filter=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.util.PolygonExtracter=function(t){this.comps=t},jsts.geom.util.PolygonExtracter.prototype=new jsts.geom.GeometryFilter,jsts.geom.util.PolygonExtracter.prototype.comps=null,jsts.geom.util.PolygonExtracter.getPolygons=function(t,e){return void 0===e&&(e=[]),t instanceof jsts.geom.Polygon?e.push(t):t instanceof jsts.geom.GeometryCollection&&t.apply(new jsts.geom.util.PolygonExtracter(e)),e},jsts.geom.util.PolygonExtracter.prototype.filter=function(t){t instanceof jsts.geom.Polygon&&this.comps.push(t)},jsts.io.WKTParser=function(t){this.geometryFactory=t||new jsts.geom.GeometryFactory,this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/}},jsts.io.WKTParser.prototype.read=function(t){var e,n,o;t=t.replace(/[\n\r]/g," ");var r=this.regExes.typeStr.exec(t);if(-1!==t.search("EMPTY")&&(r=this.regExes.emptyTypeStr.exec(t),r[2]=void 0),r&&(n=r[1].toLowerCase(),o=r[2],this.parse[n]&&(e=this.parse[n].apply(this,[o]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},jsts.io.WKTParser.prototype.write=function(t){return this.extractGeometry(t)},jsts.io.WKTParser.prototype.extractGeometry=function(t){var e=t.CLASS_NAME.split(".")[2].toLowerCase(); +if(!this.extract[e])return null;var n,o=e.toUpperCase();return n=t.isEmpty()?o+" EMPTY":o+"("+this.extract[e].apply(this,[t])+")"},jsts.io.WKTParser.prototype.extract={coordinate:function(t){return t.x+" "+t.y},point:function(t){return t.coordinate.x+" "+t.coordinate.y},multipoint:function(t){for(var e=[],n=0,o=t.geometries.length;o>n;++n)e.push("("+this.extract.point.apply(this,[t.geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,o=t.points.length;o>n;++n)e.push(this.extract.coordinate.apply(this,[t.points[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,o=t.geometries.length;o>n;++n)e.push("("+this.extract.linestring.apply(this,[t.geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+this.extract.linestring.apply(this,[t.shell])+")");for(var n=0,o=t.holes.length;o>n;++n)e.push("("+this.extract.linestring.apply(this,[t.holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,o=t.geometries.length;o>n;++n)e.push("("+this.extract.polygon.apply(this,[t.geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,o=t.geometries.length;o>n;++n)e.push(this.extractGeometry.apply(this,[t.geometries[n]]));return e.join(",")}},jsts.io.WKTParser.prototype.parse={point:function(t){if(void 0===t)return this.geometryFactory.createPoint(null);var e=t.trim().split(this.regExes.spaces);return this.geometryFactory.createPoint(new jsts.geom.Coordinate(e[0],e[1]))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint(null);for(var e,n=t.trim().split(","),o=[],r=0,i=n.length;i>r;++r)e=n[r].replace(this.regExes.trimParens,"$1"),o.push(this.parse.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(o)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString(null);for(var e,n=t.trim().split(","),o=[],r=0,i=n.length;i>r;++r)e=n[r].trim().split(this.regExes.spaces),o.push(new jsts.geom.Coordinate(e[0],e[1]));return this.geometryFactory.createLineString(o)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing(null);for(var e,n=t.trim().split(","),o=[],r=0,i=n.length;i>r;++r)e=n[r].trim().split(this.regExes.spaces),o.push(new jsts.geom.Coordinate(e[0],e[1]));return this.geometryFactory.createLinearRing(o)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString(null);for(var e,n=t.trim().split(this.regExes.parenComma),o=[],r=0,i=n.length;i>r;++r)e=n[r].replace(this.regExes.trimParens,"$1"),o.push(this.parse.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(o)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon(null);for(var e,n,o,r,i=t.trim().split(this.regExes.parenComma),s=[],a=0,u=i.length;u>a;++a)e=i[a].replace(this.regExes.trimParens,"$1"),n=this.parse.linestring.apply(this,[e]),o=this.geometryFactory.createLinearRing(n.points),0===a?r=o:s.push(o);return this.geometryFactory.createPolygon(r,s)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon(null);for(var e,n=t.trim().split(this.regExes.doubleParenComma),o=[],r=0,i=n.length;i>r;++r)e=n[r].replace(this.regExes.trimParens,"$1"),o.push(this.parse.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(o)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection(null);t=t.replace(/,\s*([A-Za-z])/g,"|$1");for(var e=t.trim().split("|"),n=[],o=0,r=e.length;r>o;++o)n.push(jsts.io.WKTParser.prototype.read.apply(this,[e[o]]));return this.geometryFactory.createGeometryCollection(n)}},jsts.index.ItemVisitor=function(){},jsts.index.ItemVisitor.prototype.visitItem=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.algorithm.CGAlgorithms=function(){},jsts.algorithm.CGAlgorithms.CLOCKWISE=-1,jsts.algorithm.CGAlgorithms.RIGHT=jsts.algorithm.CGAlgorithms.CLOCKWISE,jsts.algorithm.CGAlgorithms.COUNTERCLOCKWISE=1,jsts.algorithm.CGAlgorithms.LEFT=jsts.algorithm.CGAlgorithms.COUNTERCLOCKWISE,jsts.algorithm.CGAlgorithms.COLLINEAR=0,jsts.algorithm.CGAlgorithms.STRAIGHT=jsts.algorithm.CGAlgorithms.COLLINEAR,jsts.algorithm.CGAlgorithms.orientationIndex=function(t,e,n){var o,r,i,s;return o=e.x-t.x,r=e.y-t.y,i=n.x-e.x,s=n.y-e.y,jsts.algorithm.RobustDeterminant.signOfDet2x2(o,r,i,s)},jsts.algorithm.CGAlgorithms.isPointInRing=function(t,e){return jsts.algorithm.CGAlgorithms.locatePointInRing(t,e)!==jsts.geom.Location.EXTERIOR},jsts.algorithm.CGAlgorithms.locatePointInRing=function(t,e){return jsts.algorithm.RayCrossingCounter.locatePointInRing(t,e)},jsts.algorithm.CGAlgorithms.isOnLine=function(t,e){var n,o,r,i,s;for(n=new jsts.algorithm.RobustLineIntersector,o=1,r=e.length;r>o;o++)if(i=e[o-1],s=e[o],n.computeIntersection(t,i,s),n.hasIntersection())return!0;return!1},jsts.algorithm.CGAlgorithms.isCCW=function(t){var e,n,o,r,i,s,a,u,p,g,l;if(e=t.length-1,3>e)throw new jsts.IllegalArgumentError("Ring has fewer than 3 points, so orientation cannot be determined");for(n=t[0],o=0,p=1;e>=p;p++)r=t[p],r.y>n.y&&(n=r,o=p);i=o;do i-=1,0>i&&(i=e);while(t[i].equals2D(n)&&i!==o);s=o;do s=(s+1)%e;while(t[s].equals2D(n)&&s!==o);return a=t[i],u=t[s],a.equals2D(n)||u.equals2D(n)||a.equals2D(u)?!1:(g=jsts.algorithm.CGAlgorithms.computeOrientation(a,n,u),l=!1,l=0===g?a.x>u.x:g>0)},jsts.algorithm.CGAlgorithms.computeOrientation=function(t,e,n){return jsts.algorithm.CGAlgorithms.orientationIndex(t,e,n)},jsts.algorithm.CGAlgorithms.distancePointLine=function(t,e,n){if(e instanceof jsts.geom.Coordinate||jsts.algorithm.CGAlgorithms.distancePointLine2.apply(this,arguments),e.x===n.x&&e.y===n.y)return t.distance(e);var o,r;return o=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)),0>=o?t.distance(e):o>=1?t.distance(n):(r=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)),Math.abs(r)*Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)))},jsts.algorithm.CGAlgorithms.distancePointLinePerpendicular=function(t,e,n){var o=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y));return Math.abs(o)*Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y))},jsts.algorithm.CGAlgorithms.distancePointLine2=function(t,e){var n,o,r,i;if(0===e.length)throw new jsts.error.IllegalArgumentError("Line array must contain at least one vertex");for(n=t.distance(e[0]),o=0,r=e.length-1;r>o;o++)i=jsts.algorithm.CGAlgorithms.distancePointLine(t,e[o],e[o+1]),n>i&&(n=i);return n},jsts.algorithm.CGAlgorithms.distanceLineLine=function(t,e,n,o){if(t.equals(e))return jsts.algorithm.CGAlgorithms.distancePointLine(t,n,o);if(n.equals(o))return jsts.algorithm.CGAlgorithms.distancePointLine(o,t,e);var r,i,s,a,u,p;return r=(t.y-n.y)*(o.x-n.x)-(t.x-n.x)*(o.y-n.y),i=(e.x-t.x)*(o.y-n.y)-(e.y-t.y)*(o.x-n.x),s=(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y),a=(e.x-t.x)*(o.y-n.y)-(e.y-t.y)*(o.x-n.x),0===i||0===a?Math.min(jsts.algorithm.CGAlgorithms.distancePointLine(t,n,o),Math.min(jsts.algorithm.CGAlgorithms.distancePointLine(e,n,o),Math.min(jsts.algorithm.CGAlgorithms.distancePointLine(n,t,e),jsts.algorithm.CGAlgorithms.distancePointLine(o,t,e)))):(u=s/a,p=r/i,0>p||p>1||0>u||u>1?Math.min(jsts.algorithm.CGAlgorithms.distancePointLine(t,n,o),Math.min(jsts.algorithm.CGAlgorithms.distancePointLine(e,n,o),Math.min(jsts.algorithm.CGAlgorithms.distancePointLine(n,t,e),jsts.algorithm.CGAlgorithms.distancePointLine(o,t,e)))):0)},jsts.algorithm.CGAlgorithms.signedArea=function(t){if(t.length<3)return 0;var e,n,o,r,i,s,a;for(e=0,n=0,o=t.length-1;o>n;n++)r=t[n].x,i=t[n].y,s=t[n+1].x,a=t[n+1].y,e+=(r+s)*(a-i);return-e/2},jsts.algorithm.CGAlgorithms.signedArea=function(t){var e,n,o,r,i,s,a,u;if(e=t.length,3>e)return 0;for(n=0,o=t[0],r=o.x,i=o.y,s=1;e>s;s++)o=t[s],a=o.x,u=o.y,n+=(r+a)*(u-i),r=a,i=u;return-n/2},jsts.algorithm.CGAlgorithms.computeLength=function(t){var e,n,o,r,i,s,a,u,p,g,l=t.length;if(1>=l)return 0;for(e=0,u=t[0],n=u.x,o=u.y,p=1,g=l,p;l>p;p++)u=t[p],r=u.x,i=u.y,s=r-n,a=i-o,e+=Math.sqrt(s*s+a*a),n=r,o=i;return e},jsts.algorithm.CGAlgorithms.length=function(){},jsts.algorithm.Angle=function(){},jsts.algorithm.Angle.PI_TIMES_2=2*Math.PI,jsts.algorithm.Angle.PI_OVER_2=Math.PI/2,jsts.algorithm.Angle.PI_OVER_4=Math.PI/4,jsts.algorithm.Angle.COUNTERCLOCKWISE=jsts.algorithm.CGAlgorithms.COUNTERCLOCKWISE,jsts.algorithm.Angle.CLOCKWISE=jsts.algorithm.CGAlgorithms.CLOCKWISE,jsts.algorithm.Angle.NONE=jsts.algorithm.CGAlgorithms.COLLINEAR,jsts.algorithm.Angle.toDegrees=function(t){return 180*t/Math.PI},jsts.algorithm.Angle.toRadians=function(t){return t*Math.PI/180},jsts.algorithm.Angle.angle=function(){return 1===arguments.length?jsts.algorithm.Angle.angleFromOrigo(arguments[0]):jsts.algorithm.Angle.angleBetweenCoords(arguments[0],arguments[1])},jsts.algorithm.Angle.angleBetweenCoords=function(t,e){var n,o;return n=e.x-t.x,o=e.y-t.y,Math.atan2(o,n)},jsts.algorithm.Angle.angleFromOrigo=function(t){return Math.atan2(t.y,t.x)},jsts.algorithm.Angle.isAcute=function(t,e,n){var o,r,i,s,a;return o=t.x-e.x,r=t.y-e.y,i=n.x-e.x,s=n.y-e.y,a=o*i+r*s,a>0},jsts.algorithm.Angle.isObtuse=function(t,e,n){var o,r,i,s,a;return o=t.x-e.x,r=t.y-e.y,i=n.x-e.x,s=n.y-e.y,a=o*i+r*s,0>a},jsts.algorithm.Angle.angleBetween=function(t,e,n){var o,r;return o=jsts.algorithm.Angle.angle(e,t),r=jsts.algorithm.Angle.angle(e,n),jsts.algorithm.Angle.diff(o,r)},jsts.algorithm.Angle.angleBetweenOriented=function(t,e,n){var o,r,i;return o=jsts.algorithm.Angle.angle(e,t),r=jsts.algorithm.Angle.angle(e,n),i=r-o,i<=-Math.PI?i+jsts.algorithm.Angle.PI_TIMES_2:i>Math.PI?i-jsts.algorithm.Angle.PI_TIMES_2:i},jsts.algorithm.Angle.interiorAngle=function(t,e,n){var o,r;return o=jsts.algorithm.Angle.angle(e,t),r=jsts.algorithm.Angle.angle(e,n),Math.abs(r-o)},jsts.algorithm.Angle.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?jsts.algorithm.Angle.COUNTERCLOCKWISE:0>n?jsts.algorithm.Angle.CLOCKWISE:jsts.algorithm.Angle.NONE},jsts.algorithm.Angle.normalize=function(t){for(;t>Math.PI;)t-=jsts.algorithm.Angle.PI_TIMES_2;for(;t<=-Math.PI;)t+=jsts.algorithm.Angle.PI_TIMES_2;return t},jsts.algorithm.Angle.normalizePositive=function(t){if(0>t){for(;0>t;)t+=jsts.algorithm.Angle.PI_TIMES_2;t>=jsts.algorithm.Angle.PI_TIMES_2&&(t=0)}else{for(;t>=jsts.algorithm.Angle.PI_TIMES_2;)t-=jsts.algorithm.Angle.PI_TIMES_2;0>t&&(t=0)}return t},jsts.algorithm.Angle.diff=function(t,e){var n;return n=e>t?e-t:t-e,n>Math.PI&&(n=2*Math.PI-n),n},jsts.geom.GeometryComponentFilter=function(){},jsts.geom.GeometryComponentFilter.prototype.filter=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.util.LinearComponentExtracter=function(t,e){this.lines=t,this.isForcedToLineString=e},jsts.geom.util.LinearComponentExtracter.prototype=new jsts.geom.GeometryComponentFilter,jsts.geom.util.LinearComponentExtracter.prototype.lines=null,jsts.geom.util.LinearComponentExtracter.prototype.isForcedToLineString=!1,jsts.geom.util.LinearComponentExtracter.getLines=function(t,e){if(1==arguments.length)return jsts.geom.util.LinearComponentExtracter.getLines5.apply(this,arguments);if(2==arguments.length&&"boolean"==typeof e)return jsts.geom.util.LinearComponentExtracter.getLines6.apply(this,arguments);if(2==arguments.length&&t instanceof jsts.geom.Geometry)return jsts.geom.util.LinearComponentExtracter.getLines3.apply(this,arguments);if(3==arguments.length&&t instanceof jsts.geom.Geometry)return jsts.geom.util.LinearComponentExtracter.getLines4.apply(this,arguments);if(3==arguments.length)return jsts.geom.util.LinearComponentExtracter.getLines2.apply(this,arguments);for(var n=0;ne;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;n>e;e++)this.reducePrecision(t.geometries[e])}}(),jsts.geom.Geometry=function(t){this.factory=t},jsts.geom.Geometry.prototype.envelope=null,jsts.geom.Geometry.prototype.factory=null,jsts.geom.Geometry.prototype.getGeometryType=function(){return"Geometry"},jsts.geom.Geometry.hasNonEmptyElements=function(t){var e;for(e=0;ee?!1:DistanceOp.isWithinDistance(this,t,e)},jsts.geom.Geometry.prototype.isRectangle=function(){return!1},jsts.geom.Geometry.prototype.getArea=function(){return 0},jsts.geom.Geometry.prototype.getLength=function(){return 0},jsts.geom.Geometry.prototype.getCentroid=function(){if(this.isEmpty())return null;var t,e=null,n=this.getDimension();return 0===n?(t=new jsts.algorithm.CentroidPoint,t.add(this),e=t.getCentroid()):1===n?(t=new jsts.algorithm.CentroidLine,t.add(this),e=t.getCentroid()):(t=new jsts.algorithm.CentroidArea,t.add(this),e=t.getCentroid()),this.createPointFromInternalCoord(e,this)},jsts.geom.Geometry.prototype.getInteriorPoint=function(){var t,e=null,n=this.getDimension();return 0===n?(t=new jsts.algorithm.InteriorPointPoint(this),e=t.getInteriorPoint()):1===n?(t=new jsts.algorithm.InteriorPointLine(this),e=t.getInteriorPoint()):(t=new jsts.algorithm.InteriorPointArea(this),e=t.getInteriorPoint()),this.createPointFromInternalCoord(e,this)},jsts.geom.Geometry.prototype.getDimension=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.getBoundary=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.getBoundaryDimension=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},jsts.geom.Geometry.prototype.getEnvelopeInternal=function(){return null===this.envelope&&(this.envelope=this.computeEnvelopeInternal()),this.envelope},jsts.geom.Geometry.prototype.disjoint=function(t){return!this.intersects(t)},jsts.geom.Geometry.prototype.touches=function(t){return this.getEnvelopeInternal().intersects(t.getEnvelopeInternal())?this.relate(t).isTouches(this.getDimension(),t.getDimension()):!1},jsts.geom.Geometry.prototype.intersects=function(t){return this.getEnvelopeInternal().intersects(t.getEnvelopeInternal())?this.isRectangle()?jsts.operation.predicate.RectangleIntersects.intersects(this,t):t.isRectangle()?jsts.operation.predicate.RectangleIntersects.intersects(t,this):this.relate(t).isIntersects():!1},jsts.geom.Geometry.prototype.crosses=function(t){return this.getEnvelopeInternal().intersects(t.getEnvelopeInternal())?this.relate(t).isCrosses(this.getDimension(),t.getDimension()):!1},jsts.geom.Geometry.prototype.within=function(t){return t.contains(this)},jsts.geom.Geometry.prototype.contains=function(t){return this.getEnvelopeInternal().contains(t.getEnvelopeInternal())?this.isRectangle()?jsts.operation.predicate.RectangleContains.contains(this,t):this.relate(t).isContains():!1},jsts.geom.Geometry.prototype.overlaps=function(t){return this.getEnvelopeInternal().intersects(t.getEnvelopeInternal())?this.relate(t).isOverlaps(this.getDimension(),t.getDimension()):!1},jsts.geom.Geometry.prototype.covers=function(t){return this.getEnvelopeInternal().covers(t.getEnvelopeInternal())?this.isRectangle()?!0:this.relate(t).isCovers():!1},jsts.geom.Geometry.prototype.coveredBy=function(t){return t.covers(this)},jsts.geom.Geometry.prototype.relate=function(t,e){return 1===arguments.length?this.relate2.apply(this,arguments):this.relate2(t).matches(e)},jsts.geom.Geometry.prototype.relate2=function(t){return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),jsts.operation.relate.RelateOp.relate(this,t)},jsts.geom.Geometry.prototype.equalsTopo=function(t){return this.getEnvelopeInternal().equals(t.getEnvelopeInternal())?this.relate(t).isEquals(this.getDimension(),t.getDimension()):!1},jsts.geom.Geometry.prototype.equals=function(t){return t instanceof jsts.geom.Geometry||t instanceof jsts.geom.LinearRing||t instanceof jsts.geom.Polygon||t instanceof jsts.geom.GeometryCollection||t instanceof jsts.geom.MultiPoint||t instanceof jsts.geom.MultiLineString||t instanceof jsts.geom.MultiPolygon?this.equalsExact(t):!1},jsts.geom.Geometry.prototype.buffer=function(t,e,n){var o=new jsts.operation.buffer.BufferParameters(e,n);return jsts.operation.buffer.BufferOp.bufferOp2(this,t,o)},jsts.geom.Geometry.prototype.convexHull=function(){return new jsts.algorithm.ConvexHull(this).getConvexHull()},jsts.geom.Geometry.prototype.intersection=function(t){if(this.isEmpty())return this.getFactory().createGeometryCollection(null);if(t.isEmpty())return this.getFactory().createGeometryCollection(null);if(this.isGeometryCollection(this));return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),jsts.operation.overlay.snap.SnapIfNeededOverlayOp.overlayOp(this,t,jsts.operation.overlay.OverlayOp.INTERSECTION)},jsts.geom.Geometry.prototype.union=function(t){return 0===arguments.length?jsts.operation.union.UnaryUnionOp.union(this):this.isEmpty()?t.clone():t.isEmpty()?this.clone():(this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),jsts.operation.overlay.snap.SnapIfNeededOverlayOp.overlayOp(this,t,jsts.operation.overlay.OverlayOp.UNION))},jsts.geom.Geometry.prototype.difference=function(t){return this.isEmpty()?this.getFactory().createGeometryCollection(null):t.isEmpty()?this.clone():(this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),jsts.operation.overlay.snap.SnapIfNeededOverlayOp.overlayOp(this,t,jsts.operation.overlay.OverlayOp.DIFFERENCE))},jsts.geom.Geometry.prototype.symDifference=function(t){return this.isEmpty()?t.clone():t.isEmpty()?this.clone():(this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),jsts.operation.overlay.snap.SnapIfNeededOverlayOp.overlayOp(this,t,jsts.operation.overlay.OverlayOp.SYMDIFFERENCE))},jsts.geom.Geometry.prototype.equalsExact=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.equalsNorm=function(t){return null===t||void 0===t?!1:this.norm().equalsExact(t.norm())},jsts.geom.Geometry.prototype.apply=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.clone=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.normalize=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.norm=function(){var t=this.clone();return t.normalize(),t},jsts.geom.Geometry.prototype.compareTo=function(t){var e=t;return this.getClassSortIndex()!==e.getClassSortIndex()?this.getClassSortIndex()-e.getClassSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)},jsts.geom.Geometry.prototype.isEquivalentClass=function(t){return this instanceof jsts.geom.Point&&t instanceof jsts.geom.Point?!0:this instanceof jsts.geom.LineString&&t instanceof jsts.geom.LineString|t instanceof jsts.geom.LinearRing?!0:this instanceof jsts.geom.LinearRing&&t instanceof jsts.geom.LineString|t instanceof jsts.geom.LinearRing?!0:this instanceof jsts.geom.Polygon&&t instanceof jsts.geom.Polygon?!0:this instanceof jsts.geom.MultiPoint&&t instanceof jsts.geom.MultiPoint?!0:this instanceof jsts.geom.MultiLineString&&t instanceof jsts.geom.MultiLineString?!0:this instanceof jsts.geom.MultiPolygon&&t instanceof jsts.geom.MultiPolygon?!0:this instanceof jsts.geom.GeometryCollection&&t instanceof jsts.geom.GeometryCollection?!0:!1},jsts.geom.Geometry.prototype.checkNotGeometryCollection=function(t){if(t.isGeometryCollectionBase())throw new jsts.error.IllegalArgumentError("This method does not support GeometryCollection")},jsts.geom.Geometry.prototype.isGeometryCollection=function(){return this instanceof jsts.geom.GeometryCollection},jsts.geom.Geometry.prototype.isGeometryCollectionBase=function(){return"jsts.geom.GeometryCollection"===this.CLASS_NAME},jsts.geom.Geometry.prototype.computeEnvelopeInternal=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.compareToSameClass=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.Geometry.prototype.compare=function(t,e){for(var n=t.iterator(),o=e.iterator();n.hasNext()&&o.hasNext();){var r=n.next(),i=o.next(),s=r.compareTo(i);if(0!==s)return s}return n.hasNext()?1:o.hasNext()?-1:0},jsts.geom.Geometry.prototype.equal=function(t,e,n){return void 0===n||null===n||0===n?t.equals(e):t.distance(e)<=n},jsts.geom.Geometry.prototype.getClassSortIndex=function(){for(var t=[jsts.geom.Point,jsts.geom.MultiPoint,jsts.geom.LineString,jsts.geom.LinearRing,jsts.geom.MultiLineString,jsts.geom.Polygon,jsts.geom.MultiPolygon,jsts.geom.GeometryCollection],e=0;et.x?1:this.yt.y?1:0},jsts.geom.Coordinate.prototype.toString=function(){return"("+this.x+", "+this.y+")"}}(),jsts.geom.Envelope=function(){jsts.geom.Envelope.prototype.init.apply(this,arguments)},jsts.geom.Envelope.prototype.minx=null,jsts.geom.Envelope.prototype.maxx=null,jsts.geom.Envelope.prototype.miny=null,jsts.geom.Envelope.prototype.maxy=null,jsts.geom.Envelope.prototype.init=function(){"number"==typeof arguments[0]&&4===arguments.length?this.initFromValues(arguments[0],arguments[1],arguments[2],arguments[3]):arguments[0]instanceof jsts.geom.Coordinate&&1===arguments.length?this.initFromCoordinate(arguments[0]):arguments[0]instanceof jsts.geom.Coordinate&&2===arguments.length?this.initFromCoordinates(arguments[0],arguments[1]):arguments[0]instanceof jsts.geom.Envelope&&1===arguments.length?this.initFromEnvelope(arguments[0]):this.setToNull()},jsts.geom.Envelope.prototype.initFromValues=function(t,e,n,o){e>t?(this.minx=t,this.maxx=e):(this.minx=e,this.maxx=t),o>n?(this.miny=n,this.maxy=o):(this.miny=o,this.maxy=n)},jsts.geom.Envelope.prototype.initFromCoordinates=function(t,e){this.initFromValues(t.x,e.x,t.y,e.y)},jsts.geom.Envelope.prototype.initFromCoordinate=function(t){this.initFromValues(t.x,t.x,t.y,t.y)},jsts.geom.Envelope.prototype.initFromEnvelope=function(t){this.minx=t.minx,this.maxx=t.maxx,this.miny=t.miny,this.maxy=t.maxy},jsts.geom.Envelope.prototype.setToNull=function(){this.minx=0,this.maxx=-1,this.miny=0,this.maxy=-1},jsts.geom.Envelope.prototype.isNull=function(){return this.maxxthis.maxx&&(this.maxx=t),ethis.maxy&&(this.maxy=e))},jsts.geom.Envelope.prototype.expandToIncludeEnvelope=function(t){t.isNull()||(this.isNull()?(this.minx=t.getMinX(),this.maxx=t.getMaxX(),this.miny=t.getMinY(),this.maxy=t.getMaxY()):(t.minxthis.maxx&&(this.maxx=t.maxx),t.minythis.maxy&&(this.maxy=t.maxy)))},jsts.geom.Envelope.prototype.expandBy=function(){1===arguments.length?this.expandByDistance(arguments[0]):this.expandByDistances(arguments[0],arguments[1])},jsts.geom.Envelope.prototype.expandByDistance=function(t){this.expandByDistances(t,t)},jsts.geom.Envelope.prototype.expandByDistances=function(t,e){this.isNull()||(this.minx-=t,this.maxx+=t,this.miny-=e,this.maxy+=e,(this.minx>this.maxx||this.miny>this.maxy)&&this.setToNull())},jsts.geom.Envelope.prototype.translate=function(t,e){this.isNull()||this.init(this.minx+t,this.maxx+t,this.miny+e,this.maxy+e)},jsts.geom.Envelope.prototype.centre=function(){return this.isNull()?null:new jsts.geom.Coordinate((this.minx+this.maxx)/2,(this.miny+this.maxy)/2)},jsts.geom.Envelope.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new jsts.geom.Envelope;var e=this.minx>t.minx?this.minx:t.minx,n=this.miny>t.miny?this.miny:t.miny,o=this.maxxthis.maxx||t.maxxthis.maxy||t.maxythis.maxx||tthis.maxy||e=this.minx&&t<=this.maxx&&e>=this.miny&&e<=this.maxy},jsts.geom.Envelope.prototype.coversCoordinate=function(t){return this.coversValues(t.x,t.y)},jsts.geom.Envelope.prototype.coversEnvelope=function(t){return this.isNull()||t.isNull()?!1:t.minx>=this.minx&&t.maxx<=this.maxx&&t.miny>=this.miny&&t.maxy<=this.maxy},jsts.geom.Envelope.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this.maxxt.maxx&&(e=this.minx-t.maxx);var n=0;return this.maxyt.maxy&&(n=this.miny-t.maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},jsts.geom.Envelope.prototype.equals=function(t){return this.isNull()?t.isNull():this.maxx===t.maxx&&this.maxy===t.maxy&&this.minx===t.minx&&this.miny===t.miny},jsts.geom.Envelope.prototype.toString=function(){return"Env["+this.minx+" : "+this.maxx+", "+this.miny+" : "+this.maxy+"]" +},jsts.geom.Envelope.intersects=function(t,e,n){if(4===arguments.length)return jsts.geom.Envelope.intersectsEnvelope(arguments[0],arguments[1],arguments[2],arguments[3]);var o=t.xe.x?t.x:e.x,i=t.ye.y?t.y:e.y;return n.x>=o&&n.x<=r&&n.y>=i&&n.y<=s?!0:!1},jsts.geom.Envelope.intersectsEnvelope=function(t,e,n,o){var r=Math.min(n.x,o.x),i=Math.max(n.x,o.x),s=Math.min(t.x,e.x),a=Math.max(t.x,e.x);return s>i?!1:r>a?!1:(r=Math.min(n.y,o.y),i=Math.max(n.y,o.y),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s>i?!1:r>a?!1:!0)},jsts.geom.Envelope.prototype.clone=function(){return new jsts.geom.Envelope(this.minx,this.maxx,this.miny,this.maxy)},jsts.geom.util.GeometryCombiner=function(t){this.geomFactory=jsts.geom.util.GeometryCombiner.extractFactory(t),this.inputGeoms=t},jsts.geom.util.GeometryCombiner.combine=function(t){if(arguments.length>1)return this.combine2.apply(this,arguments);var e=new jsts.geom.util.GeometryCombiner(t);return e.combine()},jsts.geom.util.GeometryCombiner.combine2=function(){var t=new javascript.util.ArrayList;Array.prototype.slice.call(arguments).forEach(function(e){t.add(e)});var e=new jsts.geom.util.GeometryCombiner(t);return e.combine()},jsts.geom.util.GeometryCombiner.prototype.geomFactory=null,jsts.geom.util.GeometryCombiner.prototype.skipEmpty=!1,jsts.geom.util.GeometryCombiner.prototype.inputGeoms,jsts.geom.util.GeometryCombiner.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},jsts.geom.util.GeometryCombiner.prototype.combine=function(){var t,e=new javascript.util.ArrayList;for(t=this.inputGeoms.iterator();t.hasNext();){var n=t.next();this.extractElements(n,e)}return 0===e.size()?null!==this.geomFactory?this.geomFactory.createGeometryCollection(null):null:this.geomFactory.buildGeometry(e)},jsts.geom.util.GeometryCombiner.prototype.extractElements=function(t,e){if(null!==t)for(var n=0;nr;r++){var i=this.seg.distance(this.pts[r]);i>n&&(n=i,o=r)}if(n<=this.distanceTolerance)for(var s=t+1;e>s;s++)this.usePt[s]=!1;else this.simplifySection(t,o),this.simplifySection(o,e)}},jsts.geomgraph.EdgeIntersection=function(t,e,n){this.coord=new jsts.geom.Coordinate(t),this.segmentIndex=e,this.dist=n},jsts.geomgraph.EdgeIntersection.prototype.coord=null,jsts.geomgraph.EdgeIntersection.prototype.segmentIndex=null,jsts.geomgraph.EdgeIntersection.prototype.dist=null,jsts.geomgraph.EdgeIntersection.prototype.getCoordinate=function(){return this.coord},jsts.geomgraph.EdgeIntersection.prototype.getSegmentIndex=function(){return this.segmentIndex},jsts.geomgraph.EdgeIntersection.prototype.getDistance=function(){return this.dist},jsts.geomgraph.EdgeIntersection.prototype.compareTo=function(t){return this.compare(t.segmentIndex,t.dist)},jsts.geomgraph.EdgeIntersection.prototype.compare=function(t,e){return this.segmentIndext?1:this.diste?1:0},jsts.geomgraph.EdgeIntersection.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist?!0:this.segmentIndex===t?!0:!1},jsts.geomgraph.EdgeIntersection.prototype.toString=function(){return""+this.segmentIndex+this.dist},function(){var t=jsts.geomgraph.EdgeIntersection,e=javascript.util.TreeMap;jsts.geomgraph.EdgeIntersectionList=function(t){this.nodeMap=new e,this.edge=t},jsts.geomgraph.EdgeIntersectionList.prototype.nodeMap=null,jsts.geomgraph.EdgeIntersectionList.prototype.edge=null,jsts.geomgraph.EdgeIntersectionList.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1},jsts.geomgraph.EdgeIntersectionList.prototype.add=function(e,n,o){var r=new t(e,n,o),i=this.nodeMap.get(r);return null!==i?i:(this.nodeMap.put(r,r),r)},jsts.geomgraph.EdgeIntersectionList.prototype.iterator=function(){return this.nodeMap.values().iterator()},jsts.geomgraph.EdgeIntersectionList.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},jsts.geomgraph.EdgeIntersectionList.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var o=e.next(),r=this.createSplitEdge(n,o);t.add(r),n=o}},jsts.geomgraph.EdgeIntersectionList.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,o=this.edge.pts[e.segmentIndex],r=e.dist>0||!e.coord.equals2D(o);r||n--;var i=[],s=0;i[s++]=new jsts.geom.Coordinate(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)i[s++]=this.edge.pts[a];return r&&(i[s]=e.coord),new jsts.geomgraph.Edge(i,new jsts.geomgraph.Label(this.edge.label))}}(),function(){var t=function(t){this.message=t};t.prototype=new Error,t.prototype.name="AssertionFailedException",jsts.util.AssertionFailedException=t}(),function(){var t=jsts.util.AssertionFailedException;jsts.util.Assert=function(){},jsts.util.Assert.isTrue=function(e,n){if(!e)throw null===n?new t:new t(n)},jsts.util.Assert.equals=function(e,n,o){if(!n.equals(e))throw new t("Expected "+e+" but encountered "+n+(null!=o?": "+o:""))},jsts.util.Assert.shouldNeverReachHere=function(e){throw new t("Should never reach here"+(null!=e?": "+e:""))}}(),function(){var t=jsts.geom.Location,e=jsts.util.Assert,n=javascript.util.ArrayList;jsts.operation.relate.RelateComputer=function(t){this.li=new jsts.algorithm.RobustLineIntersector,this.ptLocator=new jsts.algorithm.PointLocator,this.nodes=new jsts.geomgraph.NodeMap(new jsts.operation.relate.RelateNodeFactory),this.isolatedEdges=new n,this.arg=t},jsts.operation.relate.RelateComputer.prototype.li=null,jsts.operation.relate.RelateComputer.prototype.ptLocator=null,jsts.operation.relate.RelateComputer.prototype.arg=null,jsts.operation.relate.RelateComputer.prototype.nodes=null,jsts.operation.relate.RelateComputer.prototype.im=null,jsts.operation.relate.RelateComputer.prototype.isolatedEdges=null,jsts.operation.relate.RelateComputer.prototype.invalidPoint=null,jsts.operation.relate.RelateComputer.prototype.computeIM=function(){var e=new jsts.geom.IntersectionMatrix;if(e.set(t.EXTERIOR,t.EXTERIOR,2),!this.arg[0].getGeometry().getEnvelopeInternal().intersects(this.arg[1].getGeometry().getEnvelopeInternal()))return this.computeDisjointIM(e),e;this.arg[0].computeSelfNodes(this.li,!1),this.arg[1].computeSelfNodes(this.li,!1);var n=this.arg[0].computeEdgeIntersections(this.arg[1],this.li,!1);this.computeIntersectionNodes(0),this.computeIntersectionNodes(1),this.copyNodesAndLabels(0),this.copyNodesAndLabels(1),this.labelIsolatedNodes(),this.computeProperIntersectionIM(n,e);var o=new jsts.operation.relate.EdgeEndBuilder,r=o.computeEdgeEnds(this.arg[0].getEdgeIterator());this.insertEdgeEnds(r);var i=o.computeEdgeEnds(this.arg[1].getEdgeIterator());return this.insertEdgeEnds(i),this.labelNodeEdges(),this.labelIsolatedEdges(0,1),this.labelIsolatedEdges(1,0),this.updateIM(e),e},jsts.operation.relate.RelateComputer.prototype.insertEdgeEnds=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.nodes.add(n)}},jsts.operation.relate.RelateComputer.prototype.computeProperIntersectionIM=function(t,e){var n=this.arg[0].getGeometry().getDimension(),o=this.arg[1].getGeometry().getDimension(),r=t.hasProperIntersection(),i=t.hasProperInteriorIntersection();2===n&&2===o?r&&e.setAtLeast("212101212"):2===n&&1===o?(r&&e.setAtLeast("FFF0FFFF2"),i&&e.setAtLeast("1FFFFF1FF")):1===n&&2===o?(r&&e.setAtLeast("F0FFFFFF2"),i&&e.setAtLeast("1F1FFFFFF")):1===n&&1===o&&i&&e.setAtLeast("0FFFFFFFF")},jsts.operation.relate.RelateComputer.prototype.copyNodesAndLabels=function(t){for(var e=this.arg[t].getNodeIterator();e.hasNext();){var n=e.next(),o=this.nodes.addNode(n.getCoordinate());o.setLabel(t,n.getLabel().getLocation(t))}},jsts.operation.relate.RelateComputer.prototype.computeIntersectionNodes=function(e){for(var n=this.arg[e].getEdgeIterator();n.hasNext();)for(var o=n.next(),r=o.getLabel().getLocation(e),i=o.getEdgeIntersectionList().iterator();i.hasNext();){var s=i.next(),a=this.nodes.addNode(s.coord);r===t.BOUNDARY?a.setLabelBoundary(e):a.getLabel().isNull(e)&&a.setLabel(e,t.INTERIOR)}},jsts.operation.relate.RelateComputer.prototype.labelIntersectionNodes=function(e){for(var n=this.arg[e].getEdgeIterator();n.hasNext();)for(var o=n.next(),r=o.getLabel().getLocation(e),i=o.getEdgeIntersectionList().iterator();i.hasNext();){var s=i.next(),a=this.nodes.find(s.coord);a.getLabel().isNull(e)&&(r===t.BOUNDARY?a.setLabelBoundary(e):a.setLabel(e,t.INTERIOR))}},jsts.operation.relate.RelateComputer.prototype.computeDisjointIM=function(e){var n=this.arg[0].getGeometry();n.isEmpty()||(e.set(t.INTERIOR,t.EXTERIOR,n.getDimension()),e.set(t.BOUNDARY,t.EXTERIOR,n.getBoundaryDimension()));var o=this.arg[1].getGeometry();o.isEmpty()||(e.set(t.EXTERIOR,t.INTERIOR,o.getDimension()),e.set(t.EXTERIOR,t.BOUNDARY,o.getBoundaryDimension()))},jsts.operation.relate.RelateComputer.prototype.labelNodeEdges=function(){for(var t=this.nodes.iterator();t.hasNext();){var e=t.next();e.getEdges().computeLabelling(this.arg)}},jsts.operation.relate.RelateComputer.prototype.updateIM=function(t){for(var e=this.isolatedEdges.iterator();e.hasNext();){var n=e.next();n.updateIM(t)}for(var o=this.nodes.iterator();o.hasNext();){var r=o.next();r.updateIM(t),r.updateIMFromEdges(t)}},jsts.operation.relate.RelateComputer.prototype.labelIsolatedEdges=function(t,e){for(var n=this.arg[t].getEdgeIterator();n.hasNext();){var o=n.next();o.isIsolated()&&(this.labelIsolatedEdge(o,e,this.arg[e].getGeometry()),this.isolatedEdges.add(o))}},jsts.operation.relate.RelateComputer.prototype.labelIsolatedEdge=function(e,n,o){if(o.getDimension()>0){var r=this.ptLocator.locate(e.getCoordinate(),o);e.getLabel().setAllLocations(n,r)}else e.getLabel().setAllLocations(n,t.EXTERIOR)},jsts.operation.relate.RelateComputer.prototype.labelIsolatedNodes=function(){for(var t=this.nodes.iterator();t.hasNext();){var n=t.next(),o=n.getLabel();e.isTrue(o.getGeometryCount()>0,"node with empty label found"),n.isIsolated()&&(o.isNull(0)?this.labelIsolatedNode(n,0):this.labelIsolatedNode(n,1))}},jsts.operation.relate.RelateComputer.prototype.labelIsolatedNode=function(t,e){var n=this.ptLocator.locate(t.getCoordinate(),this.arg[e].getGeometry());t.getLabel().setAllLocations(e,n)}}(),function(){var t=jsts.util.Assert;jsts.geomgraph.GraphComponent=function(t){this.label=t},jsts.geomgraph.GraphComponent.prototype.label=null,jsts.geomgraph.GraphComponent.prototype._isInResult=!1,jsts.geomgraph.GraphComponent.prototype._isCovered=!1,jsts.geomgraph.GraphComponent.prototype._isCoveredSet=!1,jsts.geomgraph.GraphComponent.prototype._isVisited=!1,jsts.geomgraph.GraphComponent.prototype.getLabel=function(){return this.label},jsts.geomgraph.GraphComponent.prototype.setLabel=function(t){return 2===arguments.length?void this.setLabel2.apply(this,arguments):void(this.label=t)},jsts.geomgraph.GraphComponent.prototype.setInResult=function(t){this._isInResult=t},jsts.geomgraph.GraphComponent.prototype.isInResult=function(){return this._isInResult},jsts.geomgraph.GraphComponent.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},jsts.geomgraph.GraphComponent.prototype.isCovered=function(){return this._isCovered},jsts.geomgraph.GraphComponent.prototype.isCoveredSet=function(){return this._isCoveredSet},jsts.geomgraph.GraphComponent.prototype.isVisited=function(){return this._isVisited},jsts.geomgraph.GraphComponent.prototype.setVisited=function(t){this._isVisited=t},jsts.geomgraph.GraphComponent.prototype.getCoordinate=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geomgraph.GraphComponent.prototype.computeIM=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geomgraph.GraphComponent.prototype.isIsolated=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geomgraph.GraphComponent.prototype.updateIM=function(e){t.isTrue(this.label.getGeometryCount()>=2,"found partial label"),this.computeIM(e)}}(),jsts.geomgraph.Node=function(t,e){this.coord=t,this.edges=e,this.label=new jsts.geomgraph.Label(0,jsts.geom.Location.NONE)},jsts.geomgraph.Node.prototype=new jsts.geomgraph.GraphComponent,jsts.geomgraph.Node.prototype.coord=null,jsts.geomgraph.Node.prototype.edges=null,jsts.geomgraph.Node.prototype.isIsolated=function(){return 1==this.label.getGeometryCount()},jsts.geomgraph.Node.prototype.setLabel2=function(t,e){null===this.label?this.label=new jsts.geomgraph.Label(t,e):this.label.setLocation(t,e)},jsts.geomgraph.Node.prototype.setLabelBoundary=function(t){var e=jsts.geom.Location.NONE;null!==this.label&&(e=this.label.getLocation(t));var n;switch(e){case jsts.geom.Location.BOUNDARY:n=jsts.geom.Location.INTERIOR;break;case jsts.geom.Location.INTERIOR:n=jsts.geom.Location.BOUNDARY;break;default:n=jsts.geom.Location.BOUNDARY}this.label.setLocation(t,n)},jsts.geomgraph.Node.prototype.add=function(t){this.edges.insert(t),t.setNode(this)},jsts.geomgraph.Node.prototype.getCoordinate=function(){return this.coord},jsts.geomgraph.Node.prototype.getEdges=function(){return this.edges},jsts.geomgraph.Node.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){var e=t.next();if(e.getEdge().isInResult())return!0}return!1},jsts.geom.Point=function(t,e){this.factory=e,void 0!==t&&(this.coordinate=t)},jsts.geom.Point.prototype=new jsts.geom.Geometry,jsts.geom.Point.constructor=jsts.geom.Point,jsts.geom.Point.CLASS_NAME="jsts.geom.Point",jsts.geom.Point.prototype.coordinate=null,jsts.geom.Point.prototype.getX=function(){return this.coordinate.x},jsts.geom.Point.prototype.getY=function(){return this.coordinate.y},jsts.geom.Point.prototype.getCoordinate=function(){return this.coordinate},jsts.geom.Point.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.coordinate]},jsts.geom.Point.prototype.getCoordinateSequence=function(){return this.isEmpty()?[]:[this.coordinate]},jsts.geom.Point.prototype.isEmpty=function(){return null===this.coordinate},jsts.geom.Point.prototype.equalsExact=function(t,e){return this.isEquivalentClass(t)?this.isEmpty()&&t.isEmpty()?!0:this.equal(t.getCoordinate(),this.getCoordinate(),e):!1},jsts.geom.Point.prototype.getNumPoints=function(){return this.isEmpty()?0:1},jsts.geom.Point.prototype.isSimple=function(){return!0},jsts.geom.Point.prototype.getBoundary=function(){return new jsts.geom.GeometryCollection(null)},jsts.geom.Point.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new jsts.geom.Envelope:new jsts.geom.Envelope(this.coordinate)},jsts.geom.Point.prototype.apply=function(t){if(t instanceof jsts.geom.GeometryFilter||t instanceof jsts.geom.GeometryComponentFilter)t.filter(this);else if(t instanceof jsts.geom.CoordinateFilter){if(this.isEmpty())return;t.filter(this.getCoordinate())}},jsts.geom.Point.prototype.clone=function(){return new jsts.geom.Point(this.coordinate.clone(),this.factory)},jsts.geom.Point.prototype.getDimension=function(){return 0},jsts.geom.Point.prototype.getBoundaryDimension=function(){return jsts.geom.Dimension.FALSE},jsts.geom.Point.prototype.reverse=function(){return this.clone()},jsts.geom.Point.prototype.isValid=function(){return jsts.operation.valid.IsValidOp.isValid(this.getCoordinate())?!0:!1},jsts.geom.Point.prototype.normalize=function(){},jsts.geom.Point.prototype.compareToSameClass=function(t){var e=t;return this.getCoordinate().compareTo(e.getCoordinate())},jsts.geom.Point.prototype.getGeometryType=function(){return"Point"},jsts.geom.Point.prototype.hashCode=function(){return"Point_"+this.coordinate.hashCode()},jsts.geom.Point.prototype.CLASS_NAME="jsts.geom.Point",jsts.geom.Dimension=function(){},jsts.geom.Dimension.P=0,jsts.geom.Dimension.L=1,jsts.geom.Dimension.A=2,jsts.geom.Dimension.FALSE=-1,jsts.geom.Dimension.TRUE=-2,jsts.geom.Dimension.DONTCARE=-3,jsts.geom.Dimension.toDimensionSymbol=function(t){switch(t){case jsts.geom.Dimension.FALSE:return"F";case jsts.geom.Dimension.TRUE:return"T";case jsts.geom.Dimension.DONTCARE:return"*";case jsts.geom.Dimension.P:return"0";case jsts.geom.Dimension.L:return"1";case jsts.geom.Dimension.A:return"2"}throw new jsts.IllegalArgumentError("Unknown dimension value: "+t)},jsts.geom.Dimension.toDimensionValue=function(t){switch(t.toUpperCase()){case"F":return jsts.geom.Dimension.FALSE;case"T":return jsts.geom.Dimension.TRUE;case"*":return jsts.geom.Dimension.DONTCARE;case"0":return jsts.geom.Dimension.P;case"1":return jsts.geom.Dimension.L;case"2":return jsts.geom.Dimension.A}throw new jsts.error.IllegalArgumentError("Unknown dimension symbol: "+t)},function(){var t=jsts.geom.Dimension;jsts.geom.LineString=function(t,e){this.factory=e,this.points=t||[]},jsts.geom.LineString.prototype=new jsts.geom.Geometry,jsts.geom.LineString.constructor=jsts.geom.LineString,jsts.geom.LineString.prototype.points=null,jsts.geom.LineString.prototype.getCoordinates=function(){return this.points},jsts.geom.LineString.prototype.getCoordinateSequence=function(){return this.points},jsts.geom.LineString.prototype.getCoordinateN=function(t){return this.points[t]},jsts.geom.LineString.prototype.getCoordinate=function(){return this.isEmpty()?null:this.getCoordinateN(0)},jsts.geom.LineString.prototype.getDimension=function(){return 1},jsts.geom.LineString.prototype.getBoundaryDimension=function(){return this.isClosed()?t.FALSE:0},jsts.geom.LineString.prototype.isEmpty=function(){return 0===this.points.length},jsts.geom.LineString.prototype.getNumPoints=function(){return this.points.length},jsts.geom.LineString.prototype.getPointN=function(t){return this.getFactory().createPoint(this.points[t])},jsts.geom.LineString.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},jsts.geom.LineString.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},jsts.geom.LineString.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.points.length-1))},jsts.geom.LineString.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},jsts.geom.LineString.prototype.getGeometryType=function(){return"LineString"},jsts.geom.LineString.prototype.getLength=function(){return jsts.algorithm.CGAlgorithms.computeLength(this.points)},jsts.geom.LineString.prototype.getBoundary=function(){return new jsts.operation.BoundaryOp(this).getBoundary()},jsts.geom.LineString.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new jsts.geom.Envelope;var t=new jsts.geom.Envelope;return this.points.forEach(function(e){t.expandToInclude(e)}),t},jsts.geom.LineString.prototype.equalsExact=function(t,e){return this.isEquivalentClass(t)?this.points.length!==t.points.length?!1:this.isEmpty()&&t.isEmpty()?!0:this.points.reduce(function(n,o,r){return n&&jsts.geom.Geometry.prototype.equal(o,t.points[r],e)}):!1},jsts.geom.LineString.prototype.isEquivalentClass=function(t){return t instanceof jsts.geom.LineString},jsts.geom.LineString.prototype.compareToSameClass=function(t){for(var e=t,n=0,o=this.points.length,r=0,i=e.points.length;o>n&&i>r;){var s=this.points[n].compareTo(e.points[r]);if(0!==s)return s;n++,r++}return o>n?1:i>r?-1:0},jsts.geom.LineString.prototype.apply=function(t){if(t instanceof jsts.geom.GeometryFilter||t instanceof jsts.geom.GeometryComponentFilter)t.filter(this);else if(t instanceof jsts.geom.CoordinateFilter)for(var e=0,n=this.points.length;n>e;e++)t.filter(this.points[e]);else t instanceof jsts.geom.CoordinateSequenceFilter&&this.apply2.apply(this,arguments)},jsts.geom.LineString.prototype.apply2=function(t){if(0!==this.points.length){for(var e=0;ee;e++)t.push(this.points[e].clone());return this.factory.createLineString(t)},jsts.geom.LineString.prototype.normalize=function(){var t,e,n,o,r,i;for(i=this.points.length,e=parseInt(i/2),t=0;e>t;t++)if(n=i-1-t,o=this.points[t],r=this.points[n],!o.equals(r))return void(o.compareTo(r)>0&&this.points.reverse())},jsts.geom.LineString.prototype.CLASS_NAME="jsts.geom.LineString"}(),function(){jsts.geom.Polygon=function(t,e,n){this.shell=t||n.createLinearRing(null),this.holes=e||[],this.factory=n},jsts.geom.Polygon.prototype=new jsts.geom.Geometry,jsts.geom.Polygon.constructor=jsts.geom.Polygon,jsts.geom.Polygon.prototype.getCoordinate=function(){return this.shell.getCoordinate()},jsts.geom.Polygon.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=[],e=-1,n=this.shell.getCoordinates(),o=0;on;n++){var o=t[n].x;if(o!=e.getMinX()&&o!=e.getMaxX())return!1;var r=t[n].y;if(r!=e.getMinY()&&r!=e.getMaxY())return!1}for(var i=t[0].x,s=t[0].y,n=1;4>=n;n++){var o=t[n].x,r=t[n].y,a=o!=i,u=r!=s;if(a==u)return!1;i=o,s=r}return!0},jsts.geom.Polygon.prototype.getExteriorRing=function(){return this.shell},jsts.geom.Polygon.prototype.getInteriorRingN=function(t){return this.holes[t]},jsts.geom.Polygon.prototype.getNumInteriorRing=function(){return this.holes.length},jsts.geom.Polygon.prototype.getArea=function(){var t=0;t+=Math.abs(jsts.algorithm.CGAlgorithms.signedArea(this.shell.getCoordinateSequence()));for(var e=0;ee;e++)t[e+1]=this.holes[e].clone();return t.length<=1?t[0]:this.getFactory().createMultiLineString(t)},jsts.geom.Polygon.prototype.computeEnvelopeInternal=function(){return this.shell.getEnvelopeInternal()},jsts.geom.Polygon.prototype.getDimension=function(){return 2},jsts.geom.Polygon.prototype.getBoundaryDimension=function(){return 1},jsts.geom.Polygon.prototype.equalsExact=function(t,e){if(!this.isEquivalentClass(t))return!1;if(this.isEmpty()&&t.isEmpty())return!0;if(this.isEmpty()!==t.isEmpty())return!1;if(!this.shell.equalsExact(t.shell,e))return!1;if(this.holes.length!==t.holes.length)return!1;if(this.holes.length!==t.holes.length)return!1;for(var n=0;ne;e++)this.holes[e].apply(t)}else if(t instanceof jsts.geom.GeometryFilter)t.filter(this);else if(t instanceof jsts.geom.CoordinateFilter){this.shell.apply(t);for(var e=0,n=this.holes.length;n>e;e++)this.holes[e].apply(t)}else t instanceof jsts.geom.CoordinateSequenceFilter&&this.apply2.apply(this,arguments)},jsts.geom.Polygon.prototype.apply2=function(t){if(this.shell.apply(t),!t.isDone())for(var e=0;ee;e++)t.push(this.holes[e].clone());return this.factory.createPolygon(this.shell.clone(),t)},jsts.geom.Polygon.prototype.normalize=function(){this.normalize2(this.shell,!0);for(var t=0,e=this.holes.length;e>t;t++)this.normalize2(this.holes[t],!1);this.holes.sort()},jsts.geom.Polygon.prototype.normalize2=function(t,e){if(!t.isEmpty()){var n=t.points.slice(0,t.points.length-1),o=jsts.geom.CoordinateArrays.minCoordinate(t.points);jsts.geom.CoordinateArrays.scroll(n,o),t.points=n.concat(),t.points[n.length]=n[0],jsts.algorithm.CGAlgorithms.isCCW(t.points)===e&&t.points.reverse()}},jsts.geom.Polygon.prototype.getGeometryType=function(){return"Polygon"},jsts.geom.Polygon.prototype.CLASS_NAME="jsts.geom.Polygon"}(),function(){var t=jsts.geom.Geometry,e=javascript.util.TreeSet,n=javascript.util.Arrays;jsts.geom.GeometryCollection=function(t,e){this.geometries=t||[],this.factory=e},jsts.geom.GeometryCollection.prototype=new t,jsts.geom.GeometryCollection.constructor=jsts.geom.GeometryCollection,jsts.geom.GeometryCollection.prototype.isEmpty=function(){for(var t=0,e=this.geometries.length;e>t;t++){var n=this.getGeometryN(t);if(!n.isEmpty())return!1}return!0},jsts.geom.GeometryCollection.prototype.getArea=function(){for(var t=0,e=0,n=this.geometries.length;n>e;e++)t+=this.getGeometryN(e).getArea();return t},jsts.geom.GeometryCollection.prototype.getLength=function(){for(var t=0,e=0,n=this.geometries.length;n>e;e++)t+=this.getGeometryN(e).getLength();return t},jsts.geom.GeometryCollection.prototype.getCoordinate=function(){return this.isEmpty()?null:this.getGeometryN(0).getCoordinate()},jsts.geom.GeometryCollection.prototype.getCoordinates=function(){for(var t=[],e=-1,n=0,o=this.geometries.length;o>n;n++)for(var r=this.getGeometryN(n),i=r.getCoordinates(),s=0;sn;n++){var r=this.getGeometryN(n);if(!r.equalsExact(t.getGeometryN(n),e))return!1}return!0},jsts.geom.GeometryCollection.prototype.clone=function(){for(var t=[],e=0,n=this.geometries.length;n>e;e++)t.push(this.geometries[e].clone());return this.factory.createGeometryCollection(t)},jsts.geom.GeometryCollection.prototype.normalize=function(){for(var t=0,e=this.geometries.length;e>t;t++)this.getGeometryN(t).normalize();this.geometries.sort()},jsts.geom.GeometryCollection.prototype.compareToSameClass=function(t){var o=new e(n.asList(this.geometries)),r=new e(n.asList(t.geometries));return this.compare(o,r)},jsts.geom.GeometryCollection.prototype.apply=function(t){if(t instanceof jsts.geom.GeometryFilter||t instanceof jsts.geom.GeometryComponentFilter){t.filter(this);for(var e=0,n=this.geometries.length;n>e;e++)this.getGeometryN(e).apply(t)}else if(t instanceof jsts.geom.CoordinateFilter)for(var e=0,n=this.geometries.length;n>e;e++)this.getGeometryN(e).apply(t);else t instanceof jsts.geom.CoordinateSequenceFilter&&this.apply2.apply(this,arguments)},jsts.geom.GeometryCollection.prototype.apply2=function(t){if(0!=this.geometries.length){for(var e=0;ee;e++){var o=this.getGeometryN(e);t=Math.max(t,o.getDimension())}return t},jsts.geom.GeometryCollection.prototype.computeEnvelopeInternal=function(){for(var t=new jsts.geom.Envelope,e=0,n=this.geometries.length;n>e;e++){var o=this.getGeometryN(e);t.expandToInclude(o.getEnvelopeInternal())}return t},jsts.geom.GeometryCollection.prototype.CLASS_NAME="jsts.geom.GeometryCollection"}(),jsts.algorithm.Centroid=function(t){this.areaBasePt=null,this.triangleCent3=new jsts.geom.Coordinate,this.areasum2=0,this.cg3=new jsts.geom.Coordinate,this.lineCentSum=new jsts.geom.Coordinate,this.totalLength=0,this.ptCount=0,this.ptCentSum=new jsts.geom.Coordinate,this.add(t)},jsts.algorithm.Centroid.getCentroid=function(t){var e=new jsts.algorithm.Centroid(t);return e.getCentroid()},jsts.algorithm.Centroid.centroid3=function(t,e,n,o){o.x=t.x+e.x+n.x,o.y=t.y+e.y+n.y},jsts.algorithm.Centroid.area2=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)},jsts.algorithm.Centroid.prototype.add=function(t){if(!t.isEmpty())if(t instanceof jsts.geom.Point)this.addPoint(t.getCoordinate());else if(t instanceof jsts.geom.LineString)this.addLineSegments(t.getCoordinates());else if(t instanceof jsts.geom.Polygon)this.addPolygon(t);else if(t instanceof jsts.geom.GeometryCollection)for(var e=0;e0)t.x=this.cg3.x/3/this.areasum2,t.y=this.cg3.y/3/this.areasum2;else if(this.totalLength>0)t.x=this.lineCentSum.x/this.totalLength,t.y=this.lineCentSum.y/this.totalLength; +else{if(!(this.ptCount>0))return null;t.x=this.ptCentSum.x/this.ptCount,t.y=this.ptCentSum.y/this.ptCount}return t},jsts.algorithm.Centroid.prototype.setBasePoint=function(t){null===this.areaBasePt&&(this.areaBasePt=t)},jsts.algorithm.Centroid.prototype.addPolygon=function(t){this.addShell(t.getExteriorRing().getCoordinates());for(var e=0;e0&&this.setBasePoint(t[0]);for(var e=!jsts.algorithm.CGAlgorithms.isCCW(t),n=0;n0&&this.addPoint(t[0])},jsts.algorithm.Centroid.prototype.addPoint=function(t){this.ptCount+=1,this.ptCentSum.x+=t.x,this.ptCentSum.y+=t.y},function(){var t=function(t){this.deList=new javascript.util.ArrayList,this.factory=t};t.findEdgeRingContaining=function(t,e){for(var n=t.getRing(),o=n.getEnvelopeInternal(),r=n.getCoordinateN(0),i=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),p=u.getRing(),g=p.getEnvelopeInternal();null!=i&&(s=i.getRing().getEnvelopeInternal());var l=!1;g.equals(o)||(r=jsts.geom.CoordinateArrays.ptNotInList(n.getCoordinates(),p.getCoordinates()),g.contains(o)&&jsts.algorithm.CGAlgorithms.isPointInRing(r,p.getCoordinates())&&(l=!0),l&&(null==i||s.contains(g))&&(i=u))}return i},t.ptNotInList=function(t,e){for(var n=0;n=0;o--)n.add(t[o],!1)},jsts.operation.polygonize.EdgeRing=t}(),function(){var t=function(){};t.setVisited=function(t,e){for(;t.hasNext();){var n=t.next();n.setVisited(e)}},t.setMarked=function(t,e){for(;t.hasNext();){var n=t.next();n.setMarked(e)}},t.getComponentWithVisitedState=function(t,e){for(;t.hasNext();){var n=t.next();if(n.isVisited()==e)return n}return null},t.prototype._isMarked=!1,t.prototype._isVisited=!1,t.prototype.data,t.prototype.isVisited=function(){return this._isVisited},t.prototype.setVisited=function(t){this._isVisited=t},t.prototype.isMarked=function(){return this._isMarked},t.prototype.setMarked=function(t){this._isMarked=t},t.prototype.setContext=function(t){this.data=t},t.prototype.getContext=function(){return data},t.prototype.setData=function(t){this.data=t},t.prototype.getData=function(){return data},t.prototype.isRemoved=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.planargraph.GraphComponent=t}(),function(){var t=jsts.planargraph.GraphComponent,e=function(t,e){void 0!==t&&this.setDirectedEdges(t,e)};e.prototype=new t,e.prototype.dirEdge=null,e.prototype.setDirectedEdges=function(t,e){this.dirEdge=[t,e],t.setEdge(this),e.setEdge(this),t.setSym(e),e.setSym(t),t.getFromNode().addOutEdge(t),e.getFromNode().addOutEdge(e)},e.prototype.getDirEdge=function(t){return t instanceof jsts.planargraph.Node&&this.getDirEdge2(t),this.dirEdge[t]},e.prototype.getDirEdge2=function(t){return this.dirEdge[0].getFromNode()==t?this.dirEdge[0]:this.dirEdge[1].getFromNode()==t?this.dirEdge[1]:null},e.prototype.getOppositeNode=function(t){return this.dirEdge[0].getFromNode()==t?this.dirEdge[0].getToNode():this.dirEdge[1].getFromNode()==t?this.dirEdge[1].getToNode():null},e.prototype.remove=function(){this.dirEdge=null},e.prototype.isRemoved=function(){return null==dirEdge},jsts.planargraph.Edge=e}(),jsts.operation.polygonize.PolygonizeEdge=function(t){this.line=t},jsts.operation.polygonize.PolygonizeEdge.prototype=new jsts.planargraph.Edge,jsts.operation.polygonize.PolygonizeEdge.prototype.line=null,jsts.operation.polygonize.PolygonizeEdge.prototype.getLine=function(){return this.line},function(){var t=javascript.util.ArrayList,e=jsts.planargraph.GraphComponent,n=function(t,e,n,o){if(void 0!==t){this.from=t,this.to=e,this.edgeDirection=o,this.p0=t.getCoordinate(),this.p1=n;var r=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y;this.quadrant=jsts.geomgraph.Quadrant.quadrant(r,i),this.angle=Math.atan2(i,r)}};n.prototype=new e,n.toEdges=function(e){for(var n=new t,o=e.iterator();o.hasNext();)n.add(o.next().parentEdge);return n},n.prototype.parentEdge=null,n.prototype.from=null,n.prototype.to=null,n.prototype.p0=null,n.prototype.p1=null,n.prototype.sym=null,n.prototype.edgeDirection=null,n.prototype.quadrant=null,n.prototype.angle=null,n.prototype.getEdge=function(){return this.parentEdge},n.prototype.setEdge=function(t){this.parentEdge=t},n.prototype.getQuadrant=function(){return this.quadrant},n.prototype.getDirectionPt=function(){return this.p1},n.prototype.getEdgeDirection=function(){return this.edgeDirection},n.prototype.getFromNode=function(){return this.from},n.prototype.getToNode=function(){return this.to},n.prototype.getCoordinate=function(){return this.from.getCoordinate()},n.prototype.getAngle=function(){return this.angle},n.prototype.getSym=function(){return this.sym},n.prototype.setSym=function(t){this.sym=t},n.prototype.remove=function(){this.sym=null,this.parentEdge=null},n.prototype.isRemoved=function(){return null==this.parentEdge},n.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},n.prototype.compareDirection=function(t){return this.quadrant>t.quadrant?1:this.quadrante&&(e+=this.outEdges.size()),e},e.prototype.getNextEdge=function(t){var e=this.getIndex(t);return this.outEdges.get(getIndex(e+1))},e.prototype.getNextCWEdge=function(t){var e=this.getIndex(t);return this.outEdges.get(getIndex(e-1))},jsts.planargraph.DirectedEdgeStar=e}(),function(){var t=jsts.planargraph.GraphComponent,e=jsts.planargraph.DirectedEdgeStar,n=function(t,n){this.pt=t,this.deStar=n||new e};n.prototype=new t,n.getEdgesBetween=function(t,e){var n=DirectedEdge.toEdges(t.getOutEdges().getEdges()),o=new javascript.util.HashSet(n),r=DirectedEdge.toEdges(e.getOutEdges().getEdges());return o.retainAll(r),o},n.prototype.pt=null,n.prototype.deStar=null,n.prototype.getCoordinate=function(){return this.pt},n.prototype.addOutEdge=function(t){this.deStar.add(t)},n.prototype.getOutEdges=function(){return this.deStar},n.prototype.getDegree=function(){return this.deStar.getDegree()},n.prototype.getIndex=function(t){return this.deStar.getIndex(t)},n.prototype.remove=function(t){return void 0===t?this.remove2():void this.deStar.remove(t)},n.prototype.remove2=function(){this.pt=null},n.prototype.isRemoved=function(){return null==this.pt},jsts.planargraph.Node=n}(),function(){var t=function(){this.nodeMap=new javascript.util.TreeMap};t.prototype.nodeMap=null,t.prototype.add=function(t){return this.nodeMap.put(t.getCoordinate(),t),t},t.prototype.remove=function(t){return this.nodeMap.remove(t)},t.prototype.find=function(t){return this.nodeMap.get(t)},t.prototype.iterator=function(){return this.nodeMap.values().iterator()},t.prototype.values=function(){return this.nodeMap.values()},jsts.planargraph.NodeMap=t}(),function(){var t=javascript.util.ArrayList,e=function(){this.edges=new javascript.util.HashSet,this.dirEdges=new javascript.util.HashSet,this.nodeMap=new jsts.planargraph.NodeMap};e.prototype.edges=null,e.prototype.dirEdges=null,e.prototype.nodeMap=null,e.prototype.findNode=function(t){return this.nodeMap.find(t)},e.prototype.add=function(t){return t instanceof jsts.planargraph.Edge?this.add2(t):t instanceof jsts.planargraph.DirectedEdge?this.add3(t):void this.nodeMap.add(t)},e.prototype.add2=function(t){this.edges.add(t),this.add(t.getDirEdge(0)),this.add(t.getDirEdge(1))},e.prototype.add3=function(t){this.dirEdges.add(t)},e.prototype.nodeIterator=function(){return this.nodeMap.iterator()},e.prototype.contains=function(t){return t instanceof jsts.planargraph.DirectedEdge?this.contains2(t):this.edges.contains(t)},e.prototype.contains2=function(t){return this.dirEdges.contains(t)},e.prototype.getNodes=function(){return this.nodeMap.values()},e.prototype.dirEdgeIterator=function(){return this.dirEdges.iterator()},e.prototype.edgeIterator=function(){return this.edges.iterator()},e.prototype.getEdges=function(){return this.edges},e.prototype.remove=function(t){return t instanceof jsts.planargraph.DirectedEdge?this.remove2(t):(this.remove(t.getDirEdge(0)),this.remove(t.getDirEdge(1)),this.edges.remove(t),void this.edge.remove())},e.prototype.remove2=function(t){if(t instanceof jsts.planargraph.Node)return this.remove3(t);var e=t.getSym();null!=e&&e.setSym(null),t.getFromNode().remove(t),t.remove(),this.dirEdges.remove(t)},e.prototype.remove3=function(t){for(var e=t.getOutEdges().getEdges(),n=e.iterator();n.hasNext();){var o=n.next(),r=o.getSym();null!=r&&this.remove(r),this.dirEdges.remove(o);var i=o.getEdge();null!=i&&this.edges.remove(i)}this.nodeMap.remove(t.getCoordinate()),t.remove()},e.prototype.findNodesOfDegree=function(e){for(var n=new t,o=this.nodeIterator();o.hasNext();){var r=o.next();r.getDegree()==e&&n.add(r)}return n},jsts.planargraph.PlanarGraph=e}(),function(){var t=javascript.util.ArrayList,e=javascript.util.Stack,n=javascript.util.HashSet,o=jsts.util.Assert,r=jsts.operation.polygonize.EdgeRing,i=jsts.operation.polygonize.PolygonizeEdge,s=jsts.operation.polygonize.PolygonizeDirectedEdge,a=jsts.planargraph.PlanarGraph,u=jsts.planargraph.Node,p=function(t){a.apply(this),this.factory=t};p.prototype=new a,p.getDegreeNonDeleted=function(t){for(var e=t.getOutEdges().getEdges(),n=0,o=e.iterator();o.hasNext();){var r=o.next();r.isMarked()||n++}return n},p.getDegree=function(t,e){for(var n=t.getOutEdges().getEdges(),o=0,r=n.iterator();r.hasNext();){var i=r.next();i.getLabel()==e&&o++}return o},p.deleteAllEdges=function(t){for(var e=t.getOutEdges().getEdges(),n=e.iterator();n.hasNext();){var o=n.next();o.setMarked(!0);var r=o.getSym();null!=r&&r.setMarked(!0)}},p.prototype.factory=null,p.prototype.addEdge=function(t){if(!t.isEmpty()){var e=jsts.geom.CoordinateArrays.removeRepeatedPoints(t.getCoordinates());if(!(e.length<2)){var n=e[0],o=e[e.length-1],r=this.getNode(n),a=this.getNode(o),u=new s(r,a,e[1],!0),p=new s(a,r,e[e.length-2],!1),g=new i(t);g.setDirectedEdges(u,p),this.add(g)}}},p.prototype.getNode=function(t){var e=this.findNode(t);return null==e&&(e=new u(t),this.add(e)),e},p.prototype.computeNextCWEdges=function(){for(var t=this.nodeIterator();t.hasNext();){var e=t.next();p.computeNextCWEdges(e)}},p.prototype.convertMaximalToMinimalEdgeRings=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),o=n.getLabel(),r=p.findIntersectionNodes(n,o);if(null!=r)for(var i=r.iterator();i.hasNext();){var s=i.next();p.computeNextCCWEdges(s,o)}}},p.findIntersectionNodes=function(e,n){var r=e,i=null;do{var s=r.getFromNode();p.getDegree(s,n)>1&&(null==i&&(i=new t),i.add(s)),r=r.getNext(),o.isTrue(null!=r,"found null DE in ring"),o.isTrue(r==e||!r.isInRing(),"found DE already in ring")}while(r!=e);return i},p.prototype.getEdgeRings=function(){this.computeNextCWEdges(),p.label(this.dirEdges,-1);var e=p.findLabeledEdgeRings(this.dirEdges);this.convertMaximalToMinimalEdgeRings(e);for(var n=new t,o=this.dirEdges.iterator();o.hasNext();){var r=o.next();if(!r.isMarked()&&!r.isInRing()){var i=this.findEdgeRing(r);n.add(i)}}return n},p.findLabeledEdgeRings=function(e){for(var n=new t,o=1,r=e.iterator();r.hasNext();){var i=r.next();if(!(i.isMarked()||i.getLabel()>=0)){n.add(i);var s=p.findDirEdgesInRing(i);p.label(s,o),o++}}return n},p.prototype.deleteCutEdges=function(){this.computeNextCWEdges(),p.findLabeledEdgeRings(this.dirEdges);for(var e=new t,n=this.dirEdges.iterator();n.hasNext();){var o=n.next();if(!o.isMarked()){var r=o.getSym();if(o.getLabel()==r.getLabel()){o.setMarked(!0),r.setMarked(!0);var i=o.getEdge();e.add(i.getLine())}}}return e},p.label=function(t,e){for(var n=t.iterator();n.hasNext();){var o=n.next();o.setLabel(e)}},p.computeNextCWEdges=function(t){for(var e=t.getOutEdges(),n=null,o=null,r=e.getEdges().iterator();r.hasNext();){var i=r.next();if(!i.isMarked()){if(null==n&&(n=i),null!=o){var s=o.getSym();s.setNext(i)}o=i}}if(null!=o){var s=o.getSym();s.setNext(n)}},p.computeNextCCWEdges=function(t,e){for(var n=t.getOutEdges(),r=null,i=null,s=n.getEdges(),a=s.size()-1;a>=0;a--){var u=s.get(a),p=u.getSym(),g=null;u.getLabel()==e&&(g=u);var l=null;p.getLabel()==e&&(l=p),(null!=g||null!=l)&&(null!=l&&(i=l),null!=g&&(null!=i&&(i.setNext(g),i=null),null==r&&(r=g)))}null!=i&&(o.isTrue(null!=r),i.setNext(r))},p.findDirEdgesInRing=function(e){var n=e,r=new t;do r.add(n),n=n.getNext(),o.isTrue(null!=n,"found null DE in ring"),o.isTrue(n==e||!n.isInRing(),"found DE already in ring");while(n!=e);return r},p.prototype.findEdgeRing=function(t){var e=t,n=new r(this.factory);do n.add(e),e.setRing(n),e=e.getNext(),o.isTrue(null!=e,"found null DE in ring"),o.isTrue(e==t||!e.isInRing(),"found DE already in ring");while(e!=t);return n},p.prototype.deleteDangles=function(){for(var t=this.findNodesOfDegree(1),o=new n,r=new e,i=t.iterator();i.hasNext();)r.push(i.next());for(;!r.isEmpty();){var s=r.pop();p.deleteAllEdges(s);for(var a=s.getOutEdges().getEdges(),i=a.iterator();i.hasNext();){var u=i.next();u.setMarked(!0);var g=u.getSym();null!=g&&g.setMarked(!0);var l=u.getEdge();o.add(l.getLine());var h=u.getToNode();1==p.getDegreeNonDeleted(h)&&r.push(h)}}return o},p.prototype.computeDepthParity=function(){for(;;){var t=null;if(null==t)return;this.computeDepthParity(t)}},p.prototype.computeDepthParity=function(){},jsts.operation.polygonize.PolygonizeGraph=p}(),jsts.index.strtree.Interval=function(){var t;return 1===arguments.length?(t=arguments[0],jsts.index.strtree.Interval(t.min,t.max)):void(2===arguments.length&&(jsts.util.Assert.isTrue(this.min<=this.max),this.min=arguments[0],this.max=arguments[1]))},jsts.index.strtree.Interval.prototype.min=null,jsts.index.strtree.Interval.prototype.max=null,jsts.index.strtree.Interval.prototype.getCentre=function(){return(this.min+this.max)/2},jsts.index.strtree.Interval.prototype.expandToInclude=function(t){return this.max=Math.max(this.max,t.max),this.min=Math.min(this.min,t.min),this},jsts.index.strtree.Interval.prototype.intersects=function(t){return!(t.min>this.max||t.max1;if(u){if(a instanceof jsts.geom.Polygon)return this.createMultiPolygon(t.toArray());if(a instanceof jsts.geom.LineString)return this.createMultiLineString(t.toArray());if(a instanceof jsts.geom.Point)return this.createMultiPoint(t.toArray());jsts.util.Assert.shouldNeverReachHere("Unhandled class: "+a)}return a},jsts.geom.GeometryFactory.prototype.createGeometryCollection=function(t){return new jsts.geom.GeometryCollection(t,this)},jsts.geom.GeometryFactory.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new jsts.geom.Coordinate(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new jsts.geom.Coordinate(t.getMinX(),t.getMinY()),new jsts.geom.Coordinate(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new jsts.geom.Coordinate(t.getMinX(),t.getMinY()),new jsts.geom.Coordinate(t.getMinX(),t.getMaxY()),new jsts.geom.Coordinate(t.getMaxX(),t.getMaxY()),new jsts.geom.Coordinate(t.getMaxX(),t.getMinY()),new jsts.geom.Coordinate(t.getMinX(),t.getMinY())]),null)},jsts.geomgraph.NodeFactory=function(){},jsts.geomgraph.NodeFactory.prototype.createNode=function(t){return new jsts.geomgraph.Node(t,null)},function(){jsts.geomgraph.Position=function(){},jsts.geomgraph.Position.ON=0,jsts.geomgraph.Position.LEFT=1,jsts.geomgraph.Position.RIGHT=2,jsts.geomgraph.Position.opposite=function(t){return t===jsts.geomgraph.Position.LEFT?jsts.geomgraph.Position.RIGHT:t===jsts.geomgraph.Position.RIGHT?jsts.geomgraph.Position.LEFT:t}}(),jsts.geomgraph.TopologyLocation=function(){if(this.location=[],3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];this.init(3),this.location[jsts.geomgraph.Position.ON]=t,this.location[jsts.geomgraph.Position.LEFT]=e,this.location[jsts.geomgraph.Position.RIGHT]=n}else if(arguments[0]instanceof jsts.geomgraph.TopologyLocation){var o=arguments[0];if(this.init(o.location.length),null!=o)for(var r=0;r1},jsts.geomgraph.TopologyLocation.prototype.isLine=function(){return 1===this.location.length},jsts.geomgraph.TopologyLocation.prototype.flip=function(){if(!(this.location.length<=1)){var t=this.location[jsts.geomgraph.Position.LEFT];this.location[jsts.geomgraph.Position.LEFT]=this.location[jsts.geomgraph.Position.RIGHT],this.location[jsts.geomgraph.Position.RIGHT]=t}},jsts.geomgraph.TopologyLocation.prototype.setAllLocations=function(t){for(var e=0;ethis.location.length){var e=[];e[jsts.geomgraph.Position.ON]=this.location[jsts.geomgraph.Position.ON],e[jsts.geomgraph.Position.LEFT]=jsts.geom.Location.NONE,e[jsts.geomgraph.Position.RIGHT]=jsts.geom.Location.NONE,this.location=e}for(var n=0;ne;e++)n.setLocation(e,t.getLocation(e));return n},jsts.geomgraph.Label.prototype.elt=null,jsts.geomgraph.Label.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},jsts.geomgraph.Label.prototype.getLocation=function(t,e){return 1==arguments.length?this.getLocation2.apply(this,arguments):this.elt[t].get(e)},jsts.geomgraph.Label.prototype.getLocation2=function(t){return this.elt[t].get(jsts.geomgraph.Position.ON)},jsts.geomgraph.Label.prototype.setLocation=function(t,e,n){return 2==arguments.length?void this.setLocation2.apply(this,arguments):void this.elt[t].setLocation(e,n)},jsts.geomgraph.Label.prototype.setLocation2=function(t,e){this.elt[t].setLocation(jsts.geomgraph.Position.ON,e)},jsts.geomgraph.Label.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},jsts.geomgraph.Label.prototype.setAllLocationsIfNull=function(t,e){return 1==arguments.length?void this.setAllLocationsIfNull2.apply(this,arguments):void this.elt[t].setAllLocationsIfNull(e)},jsts.geomgraph.Label.prototype.setAllLocationsIfNull2=function(t){this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)},jsts.geomgraph.Label.prototype.merge=function(t){var e;for(e=0;2>e;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new jsts.geomgraph.TopologyLocation(t.elt[e]):this.elt[e].merge(t.elt[e])},jsts.geomgraph.Label.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},jsts.geomgraph.Label.prototype.isNull=function(t){return this.elt[t].isNull()},jsts.geomgraph.Label.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},jsts.geomgraph.Label.prototype.isArea=function(){return 1==arguments.length?this.isArea2(arguments[0]):this.elt[0].isArea()||this.elt[1].isArea()},jsts.geomgraph.Label.prototype.isArea2=function(t){return this.elt[t].isArea()},jsts.geomgraph.Label.prototype.isLine=function(t){return this.elt[t].isLine()},jsts.geomgraph.Label.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},jsts.geomgraph.Label.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},jsts.geomgraph.Label.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new jsts.geomgraph.TopologyLocation(this.elt[t].location[0]))},jsts.geomgraph.EdgeRing=function(t,e){this.edges=[],this.pts=[],this.holes=[],this.label=new jsts.geomgraph.Label(jsts.geom.Location.NONE),this.geometryFactory=e,t&&(this.computePoints(t),this.computeRing())},jsts.geomgraph.EdgeRing.prototype.startDe=null,jsts.geomgraph.EdgeRing.prototype.maxNodeDegree=-1,jsts.geomgraph.EdgeRing.prototype.edges=null,jsts.geomgraph.EdgeRing.prototype.pts=null,jsts.geomgraph.EdgeRing.prototype.label=null,jsts.geomgraph.EdgeRing.prototype.ring=null,jsts.geomgraph.EdgeRing.prototype._isHole=null,jsts.geomgraph.EdgeRing.prototype.shell=null,jsts.geomgraph.EdgeRing.prototype.holes=null,jsts.geomgraph.EdgeRing.prototype.geometryFactory=null,jsts.geomgraph.EdgeRing.prototype.isIsolated=function(){return 1==this.label.getGeometryCount()},jsts.geomgraph.EdgeRing.prototype.isHole=function(){return this._isHole},jsts.geomgraph.EdgeRing.prototype.getCoordinate=function(t){return this.pts[t]},jsts.geomgraph.EdgeRing.prototype.getLinearRing=function(){return this.ring},jsts.geomgraph.EdgeRing.prototype.getLabel=function(){return this.label},jsts.geomgraph.EdgeRing.prototype.isShell=function(){return null===this.shell},jsts.geomgraph.EdgeRing.prototype.getShell=function(){return this.shell},jsts.geomgraph.EdgeRing.prototype.setShell=function(t){this.shell=t,null!==t&&t.addHole(this)},jsts.geomgraph.EdgeRing.prototype.addHole=function(t){this.holes.push(t)},jsts.geomgraph.EdgeRing.prototype.toPolygon=function(){for(var t=[],e=0;ethis.maxNodeDegree&&(this.maxNodeDegree=n),t=this.getNext(t)}while(t!==this.startDe);this.maxNodeDegree*=2},jsts.geomgraph.EdgeRing.prototype.setInResult=function(){var t=this.startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!=this.startDe)},jsts.geomgraph.EdgeRing.prototype.mergeLabel=function(t){this.mergeLabel2(t,0),this.mergeLabel2(t,1)},jsts.geomgraph.EdgeRing.prototype.mergeLabel2=function(t,e){var n=t.getLocation(e,jsts.geomgraph.Position.RIGHT);if(n!=jsts.geom.Location.NONE)return this.label.getLocation(e)===jsts.geom.Location.NONE?void this.label.setLocation(e,n):void 0},jsts.geomgraph.EdgeRing.prototype.addPoints=function(t,e,n){var o=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var i=r;i=0;i--)this.pts.push(o[i])}},jsts.geomgraph.EdgeRing.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal(); +if(!n.contains(t))return!1;if(!jsts.algorithm.CGAlgorithms.isPointInRing(t,e.getCoordinates()))return!1;for(var o=0;o1,"Node capacity must be greater than 1"),this.nodeCapacity=t)},jsts.index.strtree.AbstractSTRtree.IntersectsOp=function(){},jsts.index.strtree.AbstractSTRtree.IntersectsOp.prototype.intersects=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.index.strtree.AbstractSTRtree.prototype.root=null,jsts.index.strtree.AbstractSTRtree.prototype.built=!1,jsts.index.strtree.AbstractSTRtree.prototype.itemBoundables=null,jsts.index.strtree.AbstractSTRtree.prototype.nodeCapacity=null,jsts.index.strtree.AbstractSTRtree.prototype.build=function(){jsts.util.Assert.isTrue(!this.built),this.root=0===this.itemBoundables.length?this.createNode(0):this.createHigherLevels(this.itemBoundables,-1),this.built=!0},jsts.index.strtree.AbstractSTRtree.prototype.createNode=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.index.strtree.AbstractSTRtree.prototype.createParentBoundables=function(t,e){jsts.util.Assert.isTrue(!(0===t.length));var n=[];n.push(this.createNode(e));for(var o=[],r=0;re?1:e>t?-1:0},jsts.index.strtree.AbstractSTRtree.prototype.createHigherLevels=function(t,e){jsts.util.Assert.isTrue(!(0===t.length));var n=this.createParentBoundables(t,e+1);return 1===n.length?n[0]:this.createHigherLevels(n,e+1)},jsts.index.strtree.AbstractSTRtree.prototype.getRoot=function(){return this.built||this.build(),this.root},jsts.index.strtree.AbstractSTRtree.prototype.getNodeCapacity=function(){return this.nodeCapacity},jsts.index.strtree.AbstractSTRtree.prototype.size=function(){return 1===arguments.length?this.size2(arguments[0]):(this.built||this.build(),0===this.itemBoundables.length?0:this.size2(root))},jsts.index.strtree.AbstractSTRtree.prototype.size2=function(t){for(var e=0,n=t.getChildBoundables(),o=0;ot&&(t=r)}}return t+1},jsts.index.strtree.AbstractSTRtree.prototype.insert=function(t,e){jsts.util.Assert.isTrue(!this.built,"Cannot insert items into an STR packed R-tree after it has been built."),this.itemBoundables.push(new jsts.index.strtree.ItemBoundable(t,e))},jsts.index.strtree.AbstractSTRtree.prototype.query=function(t){arguments.length>1&&this.query2.apply(this,arguments),this.built||this.build();var e=[];return 0===this.itemBoundables.length?(jsts.util.Assert.isTrue(null===this.root.getBounds()),e):(this.getIntersectsOp().intersects(this.root.getBounds(),t)&&this.query3(t,this.root,e),e)},jsts.index.strtree.AbstractSTRtree.prototype.query2=function(t,e){arguments.length>2&&this.query3.apply(this,arguments),this.built||this.build(),0===this.itemBoundables.length&&jsts.util.Assert.isTrue(null===this.root.getBounds()),this.getIntersectsOp().intersects(this.root.getBounds(),t)&&this.query4(t,this.root,e)},jsts.index.strtree.AbstractSTRtree.prototype.query3=function(t,e,n){arguments[2]instanceof Array||this.query4.apply(this,arguments);for(var o=e.getChildBoundables(),r=0;r1)return void this.boundablesAtLevel2.apply(this,arguments);var e=[];return this.boundablesAtLevel2(t,this.root,e),e},jsts.index.strtree.AbstractSTRtree.prototype.boundablesAtLevel2=function(t,e,n){if(jsts.util.Assert.isTrue(t>-2),e.getLevel()===t)return void n.add(e);for(var o=node.getChildBoundables(),r=0;r0);for(var n=[],o=0;oa;a++)for(i[a]=[],n=0;sn;)o=t[s++],i[a].push(o),n++;return i},jsts.index.strtree.STRtree.DEFAULT_NODE_CAPACITY=10,jsts.index.strtree.STRtree.prototype.createNode=function(t){var e=new jsts.index.strtree.AbstractNode(t);return e.computeBounds=function(){for(var t=null,e=this.getChildBoundables(),n=0;n0;){var i=r.pop(),s=i.getDistance();if(s>=n)break;i.isLeaves()?(n=s,o=i):i.expandToQueue(r,n)}return[o.getBoundable(0).getItem(),o.getBoundable(1).getItem()]},jsts.noding.SegmentString=function(){},jsts.noding.SegmentString.prototype.getData=jsts.abstractFunc,jsts.noding.SegmentString.prototype.setData=jsts.abstractFunc,jsts.noding.SegmentString.prototype.size=jsts.abstractFunc,jsts.noding.SegmentString.prototype.getCoordinate=jsts.abstractFunc,jsts.noding.SegmentString.prototype.getCoordinates=jsts.abstractFunc,jsts.noding.SegmentString.prototype.isClosed=jsts.abstractFunc,jsts.noding.NodableSegmentString=function(){},jsts.noding.NodableSegmentString.prototype=new jsts.noding.SegmentString,jsts.noding.NodableSegmentString.prototype.addIntersection=jsts.abstractFunc,jsts.noding.NodedSegmentString=function(t,e){this.nodeList=new jsts.noding.SegmentNodeList(this),this.pts=t,this.data=e},jsts.noding.NodedSegmentString.prototype=new jsts.noding.NodableSegmentString,jsts.noding.NodedSegmentString.constructor=jsts.noding.NodedSegmentString,jsts.noding.NodedSegmentString.getNodedSubstrings=function(t){if(2===arguments.length)return void jsts.noding.NodedSegmentString.getNodedSubstrings2.apply(this,arguments);var e=new javascript.util.ArrayList;return jsts.noding.NodedSegmentString.getNodedSubstrings2(t,e),e},jsts.noding.NodedSegmentString.getNodedSubstrings2=function(t,e){for(var n=t.iterator();n.hasNext();){var o=n.next();o.getNodeList().addSplitEdges(e)}},jsts.noding.NodedSegmentString.prototype.nodeList=null,jsts.noding.NodedSegmentString.prototype.pts=null,jsts.noding.NodedSegmentString.prototype.data=null,jsts.noding.NodedSegmentString.prototype.getData=function(){return this.data},jsts.noding.NodedSegmentString.prototype.setData=function(t){this.data=t},jsts.noding.NodedSegmentString.prototype.getNodeList=function(){return this.nodeList},jsts.noding.NodedSegmentString.prototype.size=function(){return this.pts.length},jsts.noding.NodedSegmentString.prototype.getCoordinate=function(t){return this.pts[t]},jsts.noding.NodedSegmentString.prototype.getCoordinates=function(){return this.pts},jsts.noding.NodedSegmentString.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},jsts.noding.NodedSegmentString.prototype.getSegmentOctant=function(t){return t===this.pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},jsts.noding.NodedSegmentString.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:jsts.noding.Octant.octant(t,e)},jsts.noding.NodedSegmentString.prototype.addIntersections=function(t,e,n){for(var o=0;o=t.length-1)return t.length-1;for(var o=jsts.geomgraph.Quadrant.quadrant(t[n],t[n+1]),r=e+1;rr?o:r;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);i=o>r?s:a,0!==i||t.equals(e)||(i=Math.max(s,a))}if(0===i&&!t.equals(e))throw new jsts.error.IllegalArgumentError("Bad distance calculation");return i},jsts.algorithm.LineIntersector.nonRobustComputeEdgeDistance=function(t,e){var n=t.x-e.x,o=t.y-e.y,r=Math.sqrt(n*n+o*o);if(0!==r||t.equals(e))throw new jsts.error.IllegalArgumentError("Invalid distance calculation");return r},jsts.algorithm.LineIntersector.prototype.result=null,jsts.algorithm.LineIntersector.prototype.inputLines=null,jsts.algorithm.LineIntersector.prototype.intPt=null,jsts.algorithm.LineIntersector.prototype.intLineIndex=null,jsts.algorithm.LineIntersector.prototype._isProper=null,jsts.algorithm.LineIntersector.prototype.pa=null,jsts.algorithm.LineIntersector.prototype.pb=null,jsts.algorithm.LineIntersector.prototype.precisionModel=null,jsts.algorithm.LineIntersector.prototype.computeIntersection=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.algorithm.LineIntersector.prototype.isCollinear=function(){return this.result===jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION},jsts.algorithm.LineIntersector.prototype.computeIntersection=function(t,e,n,o){this.inputLines[0][0]=t,this.inputLines[0][1]=e,this.inputLines[1][0]=n,this.inputLines[1][1]=o,this.result=this.computeIntersect(t,e,n,o)},jsts.algorithm.LineIntersector.prototype.computeIntersect=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.algorithm.LineIntersector.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},jsts.algorithm.LineIntersector.prototype.hasIntersection=function(){return this.result!==jsts.algorithm.LineIntersector.NO_INTERSECTION},jsts.algorithm.LineIntersector.prototype.getIntersectionNum=function(){return this.result},jsts.algorithm.LineIntersector.prototype.getIntersection=function(t){return this.intPt[t]},jsts.algorithm.LineIntersector.prototype.computeIntLineIndex=function(){null===this.intLineIndex&&(this.intLineIndex=[[],[]],this.computeIntLineIndex(0),this.computeIntLineIndex(1))},jsts.algorithm.LineIntersector.prototype.isIntersection=function(t){var e;for(e=0;en?(this.intLineIndex[t][0]=0,this.intLineIndex[t][1]=1):(this.intLineIndex[t][0]=1,this.intLineIndex[t][1]=0)},jsts.algorithm.LineIntersector.prototype.getEdgeDistance=function(t,e){var n=jsts.algorithm.LineIntersector.computeEdgeDistance(this.intPt[e],this.inputLines[t][0],this.inputLines[t][1]);return n},jsts.algorithm.RobustLineIntersector=function(){jsts.algorithm.RobustLineIntersector.prototype.constructor.call(this)},jsts.algorithm.RobustLineIntersector.prototype=new jsts.algorithm.LineIntersector,jsts.algorithm.RobustLineIntersector.prototype.computeIntersection=function(t,e,n){return 4===arguments.length?void jsts.algorithm.LineIntersector.prototype.computeIntersection.apply(this,arguments):(this._isProper=!1,jsts.geom.Envelope.intersects(e,n,t)&&0===jsts.algorithm.CGAlgorithms.orientationIndex(e,n,t)&&0===jsts.algorithm.CGAlgorithms.orientationIndex(n,e,t)?(this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),void(this.result=jsts.algorithm.LineIntersector.POINT_INTERSECTION)):void(this.result=jsts.algorithm.LineIntersector.NO_INTERSECTION))},jsts.algorithm.RobustLineIntersector.prototype.computeIntersect=function(t,e,n,o){if(this._isProper=!1,!jsts.geom.Envelope.intersects(t,e,n,o))return jsts.algorithm.LineIntersector.NO_INTERSECTION;var r=jsts.algorithm.CGAlgorithms.orientationIndex(t,e,n),i=jsts.algorithm.CGAlgorithms.orientationIndex(t,e,o);if(r>0&&i>0||0>r&&0>i)return jsts.algorithm.LineIntersector.NO_INTERSECTION;var s=jsts.algorithm.CGAlgorithms.orientationIndex(n,o,t),a=jsts.algorithm.CGAlgorithms.orientationIndex(n,o,e);if(s>0&&a>0||0>s&&0>a)return jsts.algorithm.LineIntersector.NO_INTERSECTION;var u=0===r&&0===i&&0===s&&0===a;return u?this.computeCollinearIntersection(t,e,n,o):(0===r||0===i||0===s||0===a?(this._isProper=!1,t.equals2D(n)||t.equals2D(o)?this.intPt[0]=t:e.equals2D(n)||e.equals2D(o)?this.intPt[0]=e:0===r?this.intPt[0]=new jsts.geom.Coordinate(n):0===i?this.intPt[0]=new jsts.geom.Coordinate(o):0===s?this.intPt[0]=new jsts.geom.Coordinate(t):0===a&&(this.intPt[0]=new jsts.geom.Coordinate(e))):(this._isProper=!0,this.intPt[0]=this.intersection(t,e,n,o)),jsts.algorithm.LineIntersector.POINT_INTERSECTION)},jsts.algorithm.RobustLineIntersector.prototype.computeCollinearIntersection=function(t,e,n,o){var r=jsts.geom.Envelope.intersects(t,e,n),i=jsts.geom.Envelope.intersects(t,e,o),s=jsts.geom.Envelope.intersects(n,o,t),a=jsts.geom.Envelope.intersects(n,o,e);return r&&i?(this.intPt[0]=n,this.intPt[1]=o,jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION):s&&a?(this.intPt[0]=t,this.intPt[1]=e,jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION):r&&s?(this.intPt[0]=n,this.intPt[1]=t,!n.equals(t)||i||a?jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION:jsts.algorithm.LineIntersector.POINT_INTERSECTION):r&&a?(this.intPt[0]=n,this.intPt[1]=e,!n.equals(e)||i||s?jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION:jsts.algorithm.LineIntersector.POINT_INTERSECTION):i&&s?(this.intPt[0]=o,this.intPt[1]=t,!o.equals(t)||r||a?jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION:jsts.algorithm.LineIntersector.POINT_INTERSECTION):i&&a?(this.intPt[0]=o,this.intPt[1]=e,!o.equals(e)||r||s?jsts.algorithm.LineIntersector.COLLINEAR_INTERSECTION:jsts.algorithm.LineIntersector.POINT_INTERSECTION):jsts.algorithm.LineIntersector.NO_INTERSECTION},jsts.algorithm.RobustLineIntersector.prototype.intersection=function(t,e,n,o){var r=this.intersectionWithNormalization(t,e,n,o);return this.isInSegmentEnvelopes(r)||(r=jsts.algorithm.CentralEndpointIntersector.getIntersection(t,e,n,o)),null!==this.precisionModel&&this.precisionModel.makePrecise(r),r},jsts.algorithm.RobustLineIntersector.prototype.intersectionWithNormalization=function(t,e,n,o){var r=new jsts.geom.Coordinate(t),i=new jsts.geom.Coordinate(e),s=new jsts.geom.Coordinate(n),a=new jsts.geom.Coordinate(o),u=new jsts.geom.Coordinate;this.normalizeToEnvCentre(r,i,s,a,u);var p=this.safeHCoordinateIntersection(r,i,s,a);return p.x+=u.x,p.y+=u.y,p},jsts.algorithm.RobustLineIntersector.prototype.safeHCoordinateIntersection=function(t,e,n,o){var r=null;try{r=jsts.algorithm.HCoordinate.intersection(t,e,n,o)}catch(i){if(!(i instanceof jsts.error.NotRepresentableError))throw i;r=jsts.algorithm.CentralEndpointIntersector.getIntersection(t,e,n,o)}return r},jsts.algorithm.RobustLineIntersector.prototype.normalizeToMinimum=function(t,e,n,o,r){r.x=this.smallestInAbsValue(t.x,e.x,n.x,o.x),r.y=this.smallestInAbsValue(t.y,e.y,n.y,o.y),t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,o.x-=r.x,o.y-=r.y},jsts.algorithm.RobustLineIntersector.prototype.normalizeToEnvCentre=function(t,e,n,o,r){var i=t.xe.x?t.x:e.x,u=t.y>e.y?t.y:e.y,p=n.xo.x?n.x:o.x,h=n.y>o.y?n.y:o.y,d=i>p?i:p,c=l>a?a:l,f=s>g?s:g,m=h>u?u:h,y=(d+c)/2,j=(f+m)/2;r.x=y,r.y=j,t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,o.x-=r.x,o.y-=r.y},jsts.algorithm.RobustLineIntersector.prototype.smallestInAbsValue=function(t,e,n,o){var r=t,i=Math.abs(r);return Math.abs(e)=0&&n>=0?Math.max(e,n):0>=e&&0>=n?Math.max(e,n):0},jsts.geom.LineSegment.prototype.orientationIndex2=function(t){return jsts.algorithm.CGAlgorithms.orientationIndex(this.p0,this.p1,t)},jsts.geom.LineSegment.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},jsts.geom.LineSegment.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},jsts.geom.LineSegment.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},jsts.geom.LineSegment.prototype.midPoint=function(){return jsts.geom.LineSegment.midPoint(this.p0,this.p1)},jsts.geom.LineSegment.prototype.distance=function(t){return t instanceof jsts.geom.LineSegment?this.distance1(t):t instanceof jsts.geom.Coordinate?this.distance2(t):void 0},jsts.geom.LineSegment.prototype.distance1=function(t){return jsts.algorithm.CGAlgorithms.distanceLineLine(this.p0,this.p1,t.p0,t.p1)},jsts.geom.LineSegment.prototype.distance2=function(t){return jsts.algorithm.CGAlgorithms.distancePointLine(t,this.p0,this.p1) +},jsts.geom.LineSegment.prototype.pointAlong=function(t){var e=new jsts.geom.Coordinate;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},jsts.geom.LineSegment.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),o=this.p0.y+t*(this.p1.y-this.p0.y),r=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,s=Math.sqrt(r*r+i*i),a=0,u=0;if(0!==e){if(0>=s)throw"Cannot compute offset from zero-length line segment";a=e*r/s,u=e*i/s}var p=n-u,g=o+a,l=new jsts.geom.Coordinate(p,g);return l},jsts.geom.LineSegment.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,o=e*e+n*n,r=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/o;return r},jsts.geom.LineSegment.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return 0>e?e=0:(e>1||isNaN(e))&&(e=1),e},jsts.geom.LineSegment.prototype.project=function(t){return t instanceof jsts.geom.Coordinate?this.project1(t):t instanceof jsts.geom.LineSegment?this.project2(t):void 0},jsts.geom.LineSegment.prototype.project1=function(t){if(t.equals(this.p0)||t.equals(this.p1))return new jsts.geom.Coordinate(t);var e=this.projectionFactor(t),n=new jsts.geom.Coordinate;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n},jsts.geom.LineSegment.prototype.project2=function(t){var e=this.projectionFactor(t.p0),n=this.projectionFactor(t.p1);if(e>=1&&n>=1)return null;if(0>=e&&0>=n)return null;var o=this.project(t.p0);0>e&&(o=p0),e>1&&(o=p1);var r=this.project(t.p1);return 0>n&&(r=p0),n>1&&(r=p1),new jsts.geom.LineSegment(o,r)},jsts.geom.LineSegment.prototype.closestPoint=function(t){var e=this.projectionFactor(t);if(e>0&&1>e)return this.project(t);var n=this.p0.distance(t),o=this.p1.distance(t);return o>n?this.p0:this.p1},jsts.geom.LineSegment.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n,o=[],r=Number.MAX_VALUE,i=this.closestPoint(t.p0);r=i.distance(t.p0),o[0]=i,o[1]=t.p0;var s=this.closestPoint(t.p1);n=s.distance(t.p1),r>n&&(r=n,o[0]=s,o[1]=t.p1);var a=t.closestPoint(this.p0);n=a.distance(this.p0),r>n&&(r=n,o[0]=this.p0,o[1]=a);var u=t.closestPoint(this.p1);return n=u.distance(this.p1),r>n&&(r=n,o[0]=this.p1,o[1]=u),o},jsts.geom.LineSegment.prototype.intersection=function(t){var e=new jsts.algorithm.RobustLineIntersector;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},jsts.geom.LineSegment.prototype.setCoordinates=function(t){return t instanceof jsts.geom.Coordinate?void this.setCoordinates2.apply(this,arguments):void this.setCoordinates2(t.p0,t.p1)},jsts.geom.LineSegment.prototype.setCoordinates2=function(t,e){this.p0.x=t.x,this.p0.y=t.y,this.p1.x=e.x,this.p1.y=e.y},jsts.geom.LineSegment.prototype.distancePerpendicular=function(t){return jsts.algorithm.CGAlgorithms.distancePointLinePerpendicular(t,this.p0,this.p1)},jsts.geom.LineSegment.prototype.lineIntersection=function(t){try{var e=jsts.algorithm.HCoordinate.intersection(this.p0,this.p1,t.p0,t.p1);return e}catch(n){}return null},jsts.geom.LineSegment.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},jsts.geom.LineSegment.prototype.equals=function(t){return t instanceof jsts.geom.LineSegment?this.p0.equals(t.p0)&&this.p1.equals(t.p1):!1},jsts.geom.LineSegment.prototype.compareTo=function(t){var e=this.p0.compareTo(t.p0);return 0!==e?e:this.p1.compareTo(t.p1)},jsts.geom.LineSegment.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)},jsts.geom.LineSegment.prototype.toString=function(){return"LINESTRING("+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},jsts.index.chain.MonotoneChainOverlapAction=function(){this.tempEnv1=new jsts.geom.Envelope,this.tempEnv2=new jsts.geom.Envelope,this.overlapSeg1=new jsts.geom.LineSegment,this.overlapSeg2=new jsts.geom.LineSegment},jsts.index.chain.MonotoneChainOverlapAction.prototype.tempEnv1=null,jsts.index.chain.MonotoneChainOverlapAction.prototype.tempEnv2=null,jsts.index.chain.MonotoneChainOverlapAction.prototype.overlapSeg1=null,jsts.index.chain.MonotoneChainOverlapAction.prototype.overlapSeg2=null,jsts.index.chain.MonotoneChainOverlapAction.prototype.overlap=function(t,e,n,o){this.mc1.getLineSegment(e,this.overlapSeg1),this.mc2.getLineSegment(o,this.overlapSeg2),this.overlap2(this.overlapSeg1,this.overlapSeg2)},jsts.index.chain.MonotoneChainOverlapAction.prototype.overlap2=function(){},function(){var t=jsts.index.chain.MonotoneChainOverlapAction,e=jsts.noding.SinglePassNoder,n=jsts.index.strtree.STRtree,o=jsts.noding.NodedSegmentString,r=jsts.index.chain.MonotoneChainBuilder,i=function(t){this.si=t};i.prototype=new t,i.constructor=i,i.prototype.si=null,i.prototype.overlap=function(t,e,n,o){var r=t.getContext(),i=n.getContext();this.si.processIntersections(r,e,i,o)},jsts.noding.MCIndexNoder=function(){this.monoChains=[],this.index=new n},jsts.noding.MCIndexNoder.prototype=new e,jsts.noding.MCIndexNoder.constructor=jsts.noding.MCIndexNoder,jsts.noding.MCIndexNoder.prototype.monoChains=null,jsts.noding.MCIndexNoder.prototype.index=null,jsts.noding.MCIndexNoder.prototype.idCounter=0,jsts.noding.MCIndexNoder.prototype.nodedSegStrings=null,jsts.noding.MCIndexNoder.prototype.nOverlaps=0,jsts.noding.MCIndexNoder.prototype.getMonotoneChains=function(){return this.monoChains},jsts.noding.MCIndexNoder.prototype.getIndex=function(){return this.index},jsts.noding.MCIndexNoder.prototype.getNodedSubstrings=function(){return o.getNodedSubstrings(this.nodedSegStrings)},jsts.noding.MCIndexNoder.prototype.computeNodes=function(t){this.nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},jsts.noding.MCIndexNoder.prototype.intersectChains=function(){for(var t=new i(this.segInt),e=0;en.getId()&&(n.computeOverlaps(s,t),this.nOverlaps++),this.segInt.isDone())return}},jsts.noding.MCIndexNoder.prototype.add=function(t){for(var e=r.getChains(t.getCoordinates(),t),n=0;ni;i++)r.isLine(i)&&r.getLocation(i)===jsts.geom.Location.BOUNDARY&&(e[i]=!0);for(var n=this.iterator();n.hasNext();)for(var o=n.next(),r=o.getLabel(),i=0;2>i;i++)if(r.isAnyNull(i)){var s=jsts.geom.Location.NONE;if(e[i])s=jsts.geom.Location.EXTERIOR;else{var a=o.getCoordinate();s=this.getLocation(i,a,t)}r.setAllLocationsIfNull(i,s)}},jsts.geomgraph.EdgeEndStar.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.computeLabel(t)}},jsts.geomgraph.EdgeEndStar.prototype.getLocation=function(t,e,n){return this.ptInAreaLocation[t]===jsts.geom.Location.NONE&&(this.ptInAreaLocation[t]=jsts.algorithm.locate.SimplePointInAreaLocator.locate(e,n[t].getGeometry())),this.ptInAreaLocation[t]},jsts.geomgraph.EdgeEndStar.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jsts.geomgraph.EdgeEndStar.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,o=e.get(n).getLabel(),r=o.getLocation(t,jsts.geomgraph.Position.LEFT);jsts.util.Assert.isTrue(r!=jsts.geom.Location.NONE,"Found unlabelled area edge");for(var i=r,s=this.iterator();s.hasNext();){var a=s.next(),u=a.getLabel();jsts.util.Assert.isTrue(u.isArea(t),"Found non-area edge");var p=u.getLocation(t,jsts.geomgraph.Position.LEFT),g=u.getLocation(t,jsts.geomgraph.Position.RIGHT);if(p===g)return!1;if(g!==i)return!1;i=p}return!0},jsts.geomgraph.EdgeEndStar.prototype.propagateSideLabels=function(t){for(var e=jsts.geom.Location.NONE,n=this.iterator();n.hasNext();){var o=n.next(),r=o.getLabel();r.isArea(t)&&r.getLocation(t,jsts.geomgraph.Position.LEFT)!==jsts.geom.Location.NONE&&(e=r.getLocation(t,jsts.geomgraph.Position.LEFT))}if(e!==jsts.geom.Location.NONE)for(var i=e,n=this.iterator();n.hasNext();){var o=n.next(),r=o.getLabel();if(r.getLocation(t,jsts.geomgraph.Position.ON)===jsts.geom.Location.NONE&&r.setLocation(t,jsts.geomgraph.Position.ON,i),r.isArea(t)){var s=r.getLocation(t,jsts.geomgraph.Position.LEFT),a=r.getLocation(t,jsts.geomgraph.Position.RIGHT);if(a!==jsts.geom.Location.NONE){if(a!==i)throw new jsts.error.TopologyError("side location conflict",o.getCoordinate());s===jsts.geom.Location.NONE&&jsts.util.Assert.shouldNeverReachHere("found single null side (at "+o.getCoordinate()+")"),i=s}else jsts.util.Assert.isTrue(r.getLocation(t,jsts.geomgraph.Position.LEFT)===jsts.geom.Location.NONE,"found single null side"),r.setLocation(t,jsts.geomgraph.Position.RIGHT,i),r.setLocation(t,jsts.geomgraph.Position.LEFT,i)}}},jsts.geomgraph.EdgeEndStar.prototype.findIndex=function(t){this.iterator();for(var e=0;ei;i++)n=t.get(i),o=this.findSnapForVertex(n,e),null!==o&&(t.set(i,new jsts.geom.Coordinate(o)),0===i&&this.isClosed&&t.set(t.size()-1,new jsts.geom.Coordinate(o)))},t.prototype.findSnapForVertex=function(t,e){var n=0,o=e.length;for(n=0;o>n;n++){if(t.equals(e[n]))return null;if(t.distance(e[n])1&&e[0].equals2D(e[e.length-1])&&(i=e.length-1),n=0;i>n;n++)o=e[n],r=this.findSegmentIndexToSnap(o,t),r>=0&&t.add(r+1,new jsts.geom.Coordinate(o),!1)}},t.prototype.findSegmentIndexToSnap=function(t,e){var n,o=Number.MAX_VALUE,r=-1,i=0;for(i;in&&(o=n,r=i)}return r},jsts.operation.overlay.snap.LineStringSnapper=t}(),function(){var t=javascript.util.ArrayList,e=jsts.geom.GeometryComponentFilter,n=jsts.geom.LineString,o=jsts.operation.polygonize.EdgeRing,r=jsts.operation.polygonize.PolygonizeGraph,i=function(){var o=this,r=function(){};r.prototype=new e,r.prototype.filter=function(t){t instanceof n&&o.add(t)},this.lineStringAdder=new r,this.dangles=new t,this.cutEdges=new t,this.invalidRingLines=new t};i.prototype.lineStringAdder=null,i.prototype.graph=null,i.prototype.dangles=null,i.prototype.cutEdges=null,i.prototype.invalidRingLines=null,i.prototype.holeList=null,i.prototype.shellList=null,i.prototype.polyList=null,i.prototype.add=function(t){if(t instanceof jsts.geom.LineString)return this.add3(t);if(t instanceof jsts.geom.Geometry)return this.add2(t);for(var e=t.iterator();e.hasNext();){var n=e.next();this.add2(n)}},i.prototype.add2=function(t){t.apply(this.lineStringAdder)},i.prototype.add3=function(t){null==this.graph&&(this.graph=new r(t.getFactory())),this.graph.addEdge(t)},i.prototype.getPolygons=function(){return this.polygonize(),this.polyList},i.prototype.getDangles=function(){return this.polygonize(),this.dangles},i.prototype.getCutEdges=function(){return this.polygonize(),this.cutEdges},i.prototype.getInvalidRingLines=function(){return this.polygonize(),this.invalidRingLines},i.prototype.polygonize=function(){if(null==this.polyList&&(this.polyList=new t,null!=this.graph)){this.dangles=this.graph.deleteDangles(),this.cutEdges=this.graph.deleteCutEdges();var e=this.graph.getEdgeRings(),n=new t;this.invalidRingLines=new t,this.findValidRings(e,n,this.invalidRingLines),this.findShellsAndHoles(n),i.assignHolesToShells(this.holeList,this.shellList),this.polyList=new t;for(var o=this.shellList.iterator();o.hasNext();){var r=o.next();this.polyList.add(r.getPolygon())}}},i.prototype.findValidRings=function(t,e,n){for(var o=t.iterator();o.hasNext();){var r=o.next();r.isValid()?e.add(r):n.add(r.getLineString())}},i.prototype.findShellsAndHoles=function(e){this.holeList=new t,this.shellList=new t;for(var n=e.iterator();n.hasNext();){var o=n.next();o.isHole()?this.holeList.add(o):this.shellList.add(o)}},i.assignHolesToShells=function(t,e){for(var n=t.iterator();n.hasNext();){var o=n.next();i.assignHoleToShell(o,e)}},i.assignHoleToShell=function(t,e){var n=o.findEdgeRingContaining(t,e);null!=n&&n.addHole(t.getRing())},jsts.operation.polygonize.Polygonizer=i}(),function(){var t=javascript.util.ArrayList,e=function(){};e.prototype.inputGeom=null,e.prototype.factory=null,e.prototype.pruneEmptyGeometry=!0,e.prototype.preserveGeometryCollectionType=!0,e.prototype.preserveCollections=!1,e.prototype.reserveType=!1,e.prototype.getInputGeometry=function(){return this.inputGeom},e.prototype.transform=function(t){if(this.inputGeom=t,this.factory=t.getFactory(),t instanceof jsts.geom.Point)return this.transformPoint(t,null);if(t instanceof jsts.geom.MultiPoint)return this.transformMultiPoint(t,null);if(t instanceof jsts.geom.LinearRing)return this.transformLinearRing(t,null);if(t instanceof jsts.geom.LineString)return this.transformLineString(t,null);if(t instanceof jsts.geom.MultiLineString)return this.transformMultiLineString(t,null);if(t instanceof jsts.geom.Polygon)return this.transformPolygon(t,null);if(t instanceof jsts.geom.MultiPolygon)return this.transformMultiPolygon(t,null);if(t instanceof jsts.geom.GeometryCollection)return this.transformGeometryCollection(t,null);throw new jsts.error.IllegalArgumentException("Unknown Geometry subtype: "+t.getClass().getName())},e.prototype.createCoordinateSequence=function(t){return this.factory.getCoordinateSequenceFactory().create(t)},e.prototype.copy=function(t){return t.clone()},e.prototype.transformCoordinates=function(t){return this.copy(t)},e.prototype.transformPoint=function(t){return this.factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},e.prototype.transformMultiPoint=function(e){for(var n=new t,o=0;o0&&4>n&&!this.preserveType?this.factory.createLineString(e):this.factory.createLinearRing(e)},e.prototype.transformLineString=function(t){return this.factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},e.prototype.transformMultiLineString=function(e){for(var n=new t,o=0;on&&(n=i)}return n},r.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),o=n*r.SNAP_PRECISION_FACTOR;return o},r.computeOverlaySnapTolerance2=function(t,e){return Math.min(this.computeOverlaySnapTolerance(t),this.computeOverlaySnapTolerance(e))},r.snap=function(t,e,n){var o=[],i=new r(t);o[0]=i.snapTo(e,n);var s=new r(e);return o[1]=s.snapTo(o[0],n),o},r.snapToSelf=function(t,e,n){var o=new r(t);return o.snapToSelf(e,n)},r.prototype.srcGeom=null,r.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t),r=new o(e,n);return r.transform(this.srcGeom)},r.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(srcGeom),r=new o(t,n,!0),i=r.transform(srcGeom),s=i;return e&&s instanceof Polygonal&&(s=i.buffer(0)),s},r.prototype.extractTargetCoordinates=function(t){for(var e=new n,o=t.getCoordinates(),r=0;ro&&(e=o)}return e},jsts.operation.overlay.snap.GeometrySnapper=r}(),jsts.algorithm.PointLocator=function(t){this.boundaryRule=t?t:jsts.algorithm.BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE},jsts.algorithm.PointLocator.prototype.boundaryRule=null,jsts.algorithm.PointLocator.prototype.isIn=null,jsts.algorithm.PointLocator.prototype.numBoundaries=null,jsts.algorithm.PointLocator.prototype.intersects=function(t,e){return this.locate(t,e)!==jsts.geom.Location.EXTERIOR},jsts.algorithm.PointLocator.prototype.locate=function(t,e){return e.isEmpty()?jsts.geom.Location.EXTERIOR:e instanceof jsts.geom.Point?this.locate2(t,e):e instanceof jsts.geom.LineString?this.locate3(t,e):e instanceof jsts.geom.Polygon?this.locate4(t,e):(this.isIn=!1,this.numBoundaries=0,this.computeLocation(t,e),this.boundaryRule.isInBoundary(this.numBoundaries)?jsts.geom.Location.BOUNDARY:this.numBoundaries>0||this.isIn?jsts.geom.Location.INTERIOR:jsts.geom.Location.EXTERIOR)},jsts.algorithm.PointLocator.prototype.computeLocation=function(t,e){if(e instanceof jsts.geom.Point||e instanceof jsts.geom.LineString||e instanceof jsts.geom.Polygon)this.updateLocationInfo(this.locate(t,e));else if(e instanceof jsts.geom.MultiLineString)for(var n=e,o=0;or;r++){if(n=this.edges.get(r),o=n.getCoordinates(),this.matchInSameDirection(t,e,o[0],o[1]))return n;if(this.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return n}return null},jsts.geomgraph.PlanarGraph.prototype.matchInSameDirection=function(t,e,n,o){return t.equals(n)&&jsts.algorithm.CGAlgorithms.computeOrientation(t,e,o)===jsts.algorithm.CGAlgorithms.COLLINEAR&&jsts.geomgraph.Quadrant.quadrant(t,e)===jsts.geomgraph.Quadrant.quadrant(n,o)?!0:!1},jsts.geomgraph.PlanarGraph.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null}}(),jsts.noding.SegmentIntersector=function(){},jsts.noding.SegmentIntersector.prototype.processIntersections=jsts.abstractFunc,jsts.noding.SegmentIntersector.prototype.isDone=jsts.abstractFunc,function(){var t=jsts.noding.SegmentIntersector,e=javascript.util.ArrayList;jsts.noding.InteriorIntersectionFinder=function(t){this.li=t,this.intersections=new e,this.interiorIntersection=null},jsts.noding.InteriorIntersectionFinder.prototype=new t,jsts.noding.InteriorIntersectionFinder.constructor=jsts.noding.InteriorIntersectionFinder,jsts.noding.InteriorIntersectionFinder.prototype.findAllIntersections=!1,jsts.noding.InteriorIntersectionFinder.prototype.isCheckEndSegmentsOnly=!1,jsts.noding.InteriorIntersectionFinder.prototype.li=null,jsts.noding.InteriorIntersectionFinder.prototype.interiorIntersection=null,jsts.noding.InteriorIntersectionFinder.prototype.intSegments=null,jsts.noding.InteriorIntersectionFinder.prototype.intersections=null,jsts.noding.InteriorIntersectionFinder.prototype.setFindAllIntersections=function(t){this.findAllIntersections=t},jsts.noding.InteriorIntersectionFinder.prototype.getIntersections=function(){return intersections},jsts.noding.InteriorIntersectionFinder.prototype.setCheckEndSegmentsOnly=function(t){this.isCheckEndSegmentsOnly=t},jsts.noding.InteriorIntersectionFinder.prototype.hasIntersection=function(){return null!=this.interiorIntersection},jsts.noding.InteriorIntersectionFinder.prototype.getInteriorIntersection=function(){return this.interiorIntersection},jsts.noding.InteriorIntersectionFinder.prototype.getIntersectionSegments=function(){return this.intSegments},jsts.noding.InteriorIntersectionFinder.prototype.processIntersections=function(t,e,n,o){if(!this.hasIntersection()&&(t!=n||e!=o)){if(this.isCheckEndSegmentsOnly){var r=this.isEndSegment(t,e)||isEndSegment(n,o);if(!r)return}var i=t.getCoordinates()[e],s=t.getCoordinates()[e+1],a=n.getCoordinates()[o],u=n.getCoordinates()[o+1];this.li.computeIntersection(i,s,a,u),this.li.hasIntersection()&&this.li.isInteriorIntersection()&&(this.intSegments=[],this.intSegments[0]=i,this.intSegments[1]=s,this.intSegments[2]=a,this.intSegments[3]=u,this.interiorIntersection=this.li.getIntersection(0),this.intersections.add(this.interiorIntersection))}},jsts.noding.InteriorIntersectionFinder.prototype.isEndSegment=function(t,e){return 0==e?!0:e>=t.size()-2?!0:!1},jsts.noding.InteriorIntersectionFinder.prototype.isDone=function(){return this.findAllIntersections?!1:null!=this.interiorIntersection}}(),function(){var t=jsts.algorithm.RobustLineIntersector,e=jsts.noding.InteriorIntersectionFinder,n=jsts.noding.MCIndexNoder;jsts.noding.FastNodingValidator=function(e){this.li=new t,this.segStrings=e},jsts.noding.FastNodingValidator.prototype.li=null,jsts.noding.FastNodingValidator.prototype.segStrings=null,jsts.noding.FastNodingValidator.prototype.findAllIntersections=!1,jsts.noding.FastNodingValidator.prototype.segInt=null,jsts.noding.FastNodingValidator.prototype._isValid=!0,jsts.noding.FastNodingValidator.prototype.setFindAllIntersections=function(t){this.findAllIntersections=t},jsts.noding.FastNodingValidator.prototype.getIntersections=function(){return segInt.getIntersections()},jsts.noding.FastNodingValidator.prototype.isValid=function(){return this.execute(),this._isValid},jsts.noding.FastNodingValidator.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this.segInt.getIntersectionSegments();return"found non-noded intersection between "+jsts.io.WKTWriter.toLineString(t[0],t[1])+" and "+jsts.io.WKTWriter.toLineString(t[2],t[3])},jsts.noding.FastNodingValidator.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new jsts.error.TopologyError(this.getErrorMessage(),this.segInt.getInteriorIntersection())},jsts.noding.FastNodingValidator.prototype.execute=function(){null==this.segInt&&this.checkInteriorIntersections()},jsts.noding.FastNodingValidator.prototype.checkInteriorIntersections=function(){this._isValid=!0,this.segInt=new e(this.li),this.segInt.setFindAllIntersections(this.findAllIntersections);var t=new n;return t.setSegmentIntersector(this.segInt),t.computeNodes(this.segStrings),this.segInt.hasIntersection()?void(this._isValid=!1):void 0}}(),function(){jsts.noding.BasicSegmentString=function(t,e){this.pts=t,this.data=e},jsts.noding.BasicSegmentString.prototype=new jsts.noding.SegmentString,jsts.noding.BasicSegmentString.prototype.pts=null,jsts.noding.BasicSegmentString.prototype.data=null,jsts.noding.BasicSegmentString.prototype.getData=function(){return this.data},jsts.noding.BasicSegmentString.prototype.setData=function(t){this.data=t},jsts.noding.BasicSegmentString.prototype.size=function(){return this.pts.length},jsts.noding.BasicSegmentString.prototype.getCoordinate=function(t){return this.pts[t]},jsts.noding.BasicSegmentString.prototype.getCoordinates=function(){return this.pts},jsts.noding.BasicSegmentString.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},jsts.noding.BasicSegmentString.prototype.getSegmentOctant=function(t){return t==this.pts.length-1?-1:jsts.noding.Octant.octant(this.getCoordinate(t),this.getCoordinate(t+1))}}(),function(){var t=jsts.noding.FastNodingValidator,e=jsts.noding.BasicSegmentString,n=javascript.util.ArrayList;jsts.geomgraph.EdgeNodingValidator=function(e){this.nv=new t(jsts.geomgraph.EdgeNodingValidator.toSegmentStrings(e))},jsts.geomgraph.EdgeNodingValidator.checkValid=function(t){var e=new jsts.geomgraph.EdgeNodingValidator(t);e.checkValid()},jsts.geomgraph.EdgeNodingValidator.toSegmentStrings=function(t){for(var o=new n,r=t.iterator();r.hasNext();){var i=r.next();o.add(new e(i.getCoordinates(),i))}return o},jsts.geomgraph.EdgeNodingValidator.prototype.nv=null,jsts.geomgraph.EdgeNodingValidator.prototype.checkValid=function(){this.nv.checkValid()}}(),jsts.operation.GeometryGraphOperation=function(t,e,n){if(this.li=new jsts.algorithm.RobustLineIntersector,this.arg=[],void 0!==t){if(void 0===e)return this.setComputationPrecision(t.getPrecisionModel()),void(this.arg[0]=new jsts.geomgraph.GeometryGraph(0,t));n=n||jsts.algorithm.BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE,this.setComputationPrecision(t.getPrecisionModel().compareTo(e.getPrecisionModel())>=0?t.getPrecisionModel():e.getPrecisionModel()),this.arg[0]=new jsts.geomgraph.GeometryGraph(0,t,n),this.arg[1]=new jsts.geomgraph.GeometryGraph(1,e,n)}},jsts.operation.GeometryGraphOperation.prototype.li=null,jsts.operation.GeometryGraphOperation.prototype.resultPrecisionModel=null,jsts.operation.GeometryGraphOperation.prototype.arg=null,jsts.operation.GeometryGraphOperation.prototype.getArgGeometry=function(t){return arg[t].getGeometry()},jsts.operation.GeometryGraphOperation.prototype.setComputationPrecision=function(t){this.resultPrecisionModel=t,this.li.setPrecisionModel(this.resultPrecisionModel)},jsts.operation.overlay.OverlayNodeFactory=function(){},jsts.operation.overlay.OverlayNodeFactory.prototype=new jsts.geomgraph.NodeFactory,jsts.operation.overlay.OverlayNodeFactory.constructor=jsts.operation.overlay.OverlayNodeFactory,jsts.operation.overlay.OverlayNodeFactory.prototype.createNode=function(t){return new jsts.geomgraph.Node(t,new jsts.geomgraph.DirectedEdgeStar)},jsts.operation.overlay.PolygonBuilder=function(t){this.shellList=[],this.geometryFactory=t},jsts.operation.overlay.PolygonBuilder.prototype.geometryFactory=null,jsts.operation.overlay.PolygonBuilder.prototype.shellList=null,jsts.operation.overlay.PolygonBuilder.prototype.add=function(t){return 2===arguments.length?void this.add2.apply(this,arguments):void this.add2(t.getEdgeEnds(),t.getNodes())},jsts.operation.overlay.PolygonBuilder.prototype.add2=function(t,e){jsts.geomgraph.PlanarGraph.linkResultDirectedEdges(e);var n=this.buildMaximalEdgeRings(t),o=[],r=this.buildMinimalEdgeRings(n,this.shellList,o);this.sortShellsAndHoles(r,this.shellList,o),this.placeFreeHoles(this.shellList,o)},jsts.operation.overlay.PolygonBuilder.prototype.getPolygons=function(){var t=this.computePolygons(this.shellList);return t},jsts.operation.overlay.PolygonBuilder.prototype.buildMaximalEdgeRings=function(t){for(var e=[],n=t.iterator();n.hasNext();){var o=n.next();if(o.isInResult()&&o.getLabel().isArea()&&null==o.getEdgeRing()){var r=new jsts.operation.overlay.MaximalEdgeRing(o,this.geometryFactory);e.push(r),r.setInResult()}}return e},jsts.operation.overlay.PolygonBuilder.prototype.buildMinimalEdgeRings=function(t,e,n){for(var o=[],r=0;r2){i.linkDirectedEdgesForMinimalEdgeRings();var s=i.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.push(a)):n=n.concat(s)}else o.push(i)}return o},jsts.operation.overlay.PolygonBuilder.prototype.findShell=function(t){for(var e=0,n=null,o=0;o=e,"found two shells in MinimalEdgeRing list"),n},jsts.operation.overlay.PolygonBuilder.prototype.placePolygonHoles=function(t,e){for(var n=0;nr;r++)n.isNull(r)||!n.isArea()||o.isNull(r)||(0==o.getDelta(r)?n.toLine(r):(h.isTrue(!o.isNull(r,i.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(r,i.LEFT,o.getLocation(r,i.LEFT)),h.isTrue(!o.isNull(r,i.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(r,i.RIGHT,o.getLocation(r,i.RIGHT))))}}},jsts.operation.overlay.OverlayOp.prototype.replaceCollapsedEdges=function(){for(var t=new d,e=this.edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this.edgeList.addAll(t)},jsts.operation.overlay.OverlayOp.prototype.copyPoints=function(t){for(var e=this.arg[t].getNodeIterator();e.hasNext();){var n=e.next(),o=this.graph.addNode(n.getCoordinate());o.setLabel(t,n.getLabel().getLocation(t))}},jsts.operation.overlay.OverlayOp.prototype.computeLabelling=function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){var e=t.next();e.getEdges().computeLabelling(this.arg)}this.mergeSymLabels(),this.updateNodeLabelling()},jsts.operation.overlay.OverlayOp.prototype.mergeSymLabels=function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){var e=t.next();e.getEdges().mergeSymLabels()}},jsts.operation.overlay.OverlayOp.prototype.updateNodeLabelling=function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},jsts.operation.overlay.OverlayOp.prototype.labelIncompleteNodes=function(){for(var t=0,e=this.graph.getNodes().iterator();e.hasNext();){var n=e.next(),o=n.getLabel();n.isIsolated()&&(t++,o.isNull(0)?this.labelIncompleteNode(n,0):this.labelIncompleteNode(n,1)),n.getEdges().updateLabelling(o)}},jsts.operation.overlay.OverlayOp.prototype.labelIncompleteNode=function(t,e){var n=this.ptLocator.locate(t.getCoordinate(),this.arg[e].getGeometry());t.getLabel().setLocation(e,n)},jsts.operation.overlay.OverlayOp.prototype.findResultAreaEdges=function(t){for(var e=this.graph.getEdgeEnds().iterator();e.hasNext();){var n=e.next(),o=n.getLabel();o.isArea()&&!n.isInteriorAreaEdge()&&jsts.operation.overlay.OverlayOp.isResultOfOp(o.getLocation(0,i.RIGHT),o.getLocation(1,i.RIGHT),t)&&n.setInResult(!0)}},jsts.operation.overlay.OverlayOp.prototype.cancelDuplicateResultEdges=function(){for(var t=this.graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},jsts.operation.overlay.OverlayOp.prototype.isCoveredByLA=function(t){return this.isCovered(t,this.resultLineList)?!0:this.isCovered(t,this.resultPolyList)?!0:!1},jsts.operation.overlay.OverlayOp.prototype.isCoveredByA=function(t){return this.isCovered(t,this.resultPolyList)?!0:!1},jsts.operation.overlay.OverlayOp.prototype.isCovered=function(t,n){for(var o=n.iterator();o.hasNext();){var r=o.next(),i=this.ptLocator.locate(t,r);if(i!=e.EXTERIOR)return!0}return!1},jsts.operation.overlay.OverlayOp.prototype.computeGeometry=function(t,e,n){var o=new d;return o.addAll(t),o.addAll(e),o.addAll(n),this.geomFact.buildGeometry(o)},jsts.operation.overlay.OverlayOp.prototype.createEmptyResult=function(t){var e=null;switch(resultDimension(t,this.arg[0].getGeometry(),this.arg[1].getGeometry())){case-1:e=geomFact.createGeometryCollection();break;case 0:e=geomFact.createPoint(null);break;case 1:e=geomFact.createLineString(null);break;case 2:e=geomFact.createPolygon(null,null)}return e},jsts.operation.overlay.OverlayOp.prototype.resultDimension=function(t,e,n){var o=e.getDimension(),r=n.getDimension(),i=-1;switch(t){case jsts.operation.overlay.OverlayOp.INTERSECTION:i=Math.min(o,r);break;case jsts.operation.overlay.OverlayOp.UNION:i=Math.max(o,r);break;case jsts.operation.overlay.OverlayOp.DIFFERENCE:i=o;break;case jsts.operation.overlay.OverlayOp.SYMDIFFERENCE:i=Math.max(o,r)}return i}}(),function(){var t=jsts.operation.overlay.OverlayOp,e=jsts.operation.overlay.snap.GeometrySnapper,n=function(t,e){this.geom=[],this.geom[0]=t,this.geom[1]=e,this.computeSnapTolerance()};n.overlayOp=function(t,e,o){var r=new n(t,e);return r.getResultGeometry(o)},n.intersection=function(e,n){return this.overlayOp(e,n,t.INTERSECTION)},n.union=function(e,n){return this.overlayOp(e,n,t.UNION)},n.difference=function(e,n){return overlayOp(e,n,t.DIFFERENCE)},n.symDifference=function(e,n){return overlayOp(e,n,t.SYMDIFFERENCE)},n.prototype.geom=null,n.prototype.snapTolerance=null,n.prototype.computeSnapTolerance=function(){this.snapTolerance=e.computeOverlaySnapTolerance(this.geom[0],this.geom[1])},n.prototype.getResultGeometry=function(e){var n=this.snap(this.geom),o=t.overlayOp(n[0],n[1],e);return this.prepareResult(o)},n.prototype.selfSnap=function(t){var n=new e(t),o=n.snapTo(t,this.snapTolerance);return o},n.prototype.snap=function(t){var n=t,o=e.snap(n[0],n[1],this.snapTolerance);return o},n.prototype.prepareResult=function(t){return t},n.prototype.cbr=null,n.prototype.removeCommonBits=function(){this.cbr=new jsts.precision.CommonBitsRemover,this.cbr.add(this.geom[0]),this.cbr.add(this.geom[1]);var t=[];return t[0]=cbr.removeCommonBits(this.geom[0].clone()),t[1]=cbr.removeCommonBits(this.geom[1].clone()),t},jsts.operation.overlay.snap.SnapOverlayOp=n}(),jsts.geomgraph.index.EdgeSetIntersector=function(){},jsts.geomgraph.index.EdgeSetIntersector.prototype.computeIntersections=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geomgraph.index.EdgeSetIntersector.prototype.computeIntersections2=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geomgraph.index.SimpleMCSweepLineIntersector=function(){this.events=[]},jsts.geomgraph.index.SimpleMCSweepLineIntersector.prototype=new jsts.geomgraph.index.EdgeSetIntersector,jsts.geomgraph.index.SimpleMCSweepLineIntersector.prototype.events=null,jsts.geomgraph.index.SimpleMCSweepLineIntersector.prototype.nOverlaps=0,jsts.geomgraph.index.SimpleMCSweepLineIntersector.prototype.computeIntersections=function(t,e,n){return e instanceof javascript.util.List?void this.computeIntersections2.apply(this,arguments):(n?this.addList2(t,null):this.addList(t),void this.computeIntersections3(e))},jsts.geomgraph.index.SimpleMCSweepLineIntersector.prototype.computeIntersections2=function(t,e,n){this.addList2(t,t),this.addList2(e,e),this.computeIntersections3(n)},jsts.geomgraph.index.SimpleMCSweepLineIntersector.prototype.add=function(t,e){if(t instanceof javascript.util.List)return void this.addList.apply(this,arguments);for(var n=t.getMonotoneChainEdge(),o=n.getStartIndexes(),r=0;ri;i++){var s=this.events[i];if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(r.computeIntersections(a,o),this.nOverlaps++)}}},jsts.algorithm.locate.SimplePointInAreaLocator=function(t){this.geom=t},jsts.algorithm.locate.SimplePointInAreaLocator.locate=function(t,e){return e.isEmpty()?jsts.geom.Location.EXTERIOR:jsts.algorithm.locate.SimplePointInAreaLocator.containsPoint(t,e)?jsts.geom.Location.INTERIOR:jsts.geom.Location.EXTERIOR},jsts.algorithm.locate.SimplePointInAreaLocator.containsPoint=function(t,e){if(e instanceof jsts.geom.Polygon)return jsts.algorithm.locate.SimplePointInAreaLocator.containsPointInPolygon(t,e);if(e instanceof jsts.geom.GeometryCollection||e instanceof jsts.geom.MultiPoint||e instanceof jsts.geom.MultiLineString||e instanceof jsts.geom.MultiPolygon)for(var n=0;ne)return null;var n=t.get(0);if(1==e)return n;var r=t.get(e-1),i=n.getQuadrant(),s=r.getQuadrant();if(jsts.geomgraph.Quadrant.isNorthern(i)&&jsts.geomgraph.Quadrant.isNorthern(s))return n;if(!jsts.geomgraph.Quadrant.isNorthern(i)&&!jsts.geomgraph.Quadrant.isNorthern(s))return r;return 0!=n.getDy()?n:0!=r.getDy()?r:(o.shouldNeverReachHere("found two horizontal edges incident on node"),null)},jsts.geomgraph.DirectedEdgeStar.prototype.computeLabelling=function(e){n.prototype.computeLabelling.call(this,e),this.label=new jsts.geomgraph.Label(t.NONE);for(var o=this.iterator();o.hasNext();)for(var r=o.next(),i=r.getEdge(),s=i.getLabel(),a=0;2>a;a++){var u=s.getLocation(a);(u===t.INTERIOR||u===t.BOUNDARY)&&this.label.setLocation(a,t.INTERIOR)}},jsts.geomgraph.DirectedEdgeStar.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next(),n=e.getLabel();n.merge(e.getSym().getLabel())}},jsts.geomgraph.DirectedEdgeStar.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next(),o=n.getLabel();o.setAllLocationsIfNull(0,t.getLocation(0)),o.setAllLocationsIfNull(1,t.getLocation(1))}},jsts.geomgraph.DirectedEdgeStar.prototype.getResultAreaEdges=function(){if(null!==this.resultAreaEdgeList)return this.resultAreaEdgeList; +this.resultAreaEdgeList=new javascript.util.ArrayList;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this.resultAreaEdgeList.add(e)}return this.resultAreaEdgeList},jsts.geomgraph.DirectedEdgeStar.prototype.SCANNING_FOR_INCOMING=1,jsts.geomgraph.DirectedEdgeStar.prototype.LINKING_TO_OUTGOING=2,jsts.geomgraph.DirectedEdgeStar.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this.SCANNING_FOR_INCOMING,r=0;r=0;i--){var s=this.resultAreaEdgeList.get(i),a=s.getSym();switch(null===e&&s.getEdgeRing()===t&&(e=s),r){case this.SCANNING_FOR_INCOMING:if(a.getEdgeRing()!=t)continue;n=a,r=this.LINKING_TO_OUTGOING;break;case this.LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),r=this.SCANNING_FOR_INCOMING}}r===this.LINKING_TO_OUTGOING&&(o.isTrue(null!==e,"found null for first outgoing dirEdge"),o.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},jsts.geomgraph.DirectedEdgeStar.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this.edgeList.size()-1;n>=0;n--){var o=this.edgeList.get(n),r=o.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=o}e.setNext(t)},jsts.geomgraph.DirectedEdgeStar.prototype.findCoveredLineEdges=function(){for(var e=t.NONE,n=this.iterator();n.hasNext();){var o=n.next(),r=o.getSym();if(!o.isLineEdge()){if(o.isInResult()){e=t.INTERIOR;break}if(r.isInResult()){e=t.EXTERIOR;break}}}if(e!==t.NONE)for(var i=e,n=this.iterator();n.hasNext();){var o=n.next(),r=o.getSym();o.isLineEdge()?o.getEdge().setCovered(i===t.INTERIOR):(o.isInResult()&&(i=t.EXTERIOR),r.isInResult()&&(i=t.INTERIOR))}},jsts.geomgraph.DirectedEdgeStar.prototype.computeDepths=function(t){if(2===arguments.length)return void this.computeDepths2.apply(this,arguments);var n=this.findIndex(t),o=(t.getLabel(),t.getDepth(e.LEFT)),r=t.getDepth(e.RIGHT),i=this.computeDepths2(n+1,this.edgeList.size(),o),s=this.computeDepths2(0,n,i);if(s!=r)throw new jsts.error.TopologyError("depth mismatch at "+t.getCoordinate())},jsts.geomgraph.DirectedEdgeStar.prototype.computeDepths2=function(t,n,o){for(var r=o,i=t;n>i;i++){{var s=this.edgeList.get(i);s.getLabel()}s.setEdgeDepths(e.RIGHT,r),r=s.getDepth(e.LEFT)}return r}}(),jsts.algorithm.CentroidLine=function(){this.centSum=new jsts.geom.Coordinate},jsts.algorithm.CentroidLine.prototype.centSum=null,jsts.algorithm.CentroidLine.prototype.totalLength=0,jsts.algorithm.CentroidLine.prototype.add=function(t){if(t instanceof Array)return void this.add2.apply(this,arguments);if(t instanceof jsts.geom.LineString)this.add(t.getCoordinates());else if(t instanceof jsts.geom.Polygon){var e=t;this.add(e.getExteriorRing().getCoordinates());for(var n=0;n0?this.pts[0]:null:this.pts[t]},jsts.geomgraph.Edge.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},jsts.geomgraph.Edge.prototype.setIsolated=function(t){this._isIsolated=t},jsts.geomgraph.Edge.prototype.isIsolated=function(){return this._isIsolated},jsts.geomgraph.Edge.prototype.addIntersections=function(t,e,n){for(var o=0;o=0?e>=0?n>=o?0:1:n>=o?7:6:e>=0?n>=o?3:2:n>=o?4:5},jsts.noding.Octant.octant2=function(t,e){var n=e.x-t.x,o=e.y-t.y;if(0===n&&0===o)throw new jsts.error.IllegalArgumentError("Cannot compute the octant for two identical points "+t);return jsts.noding.Octant.octant(n,o)},jsts.operation.union.UnionInteracting=function(t,e){this.g0=t,this.g1=e,this.geomFactory=t.getFactory(),this.interacts0=[],this.interacts1=[]},jsts.operation.union.UnionInteracting.union=function(t,e){var n=new jsts.operation.union.UnionInteracting(t,e);return n.union()},jsts.operation.union.UnionInteracting.prototype.geomFactory=null,jsts.operation.union.UnionInteracting.prototype.g0=null,jsts.operation.union.UnionInteracting.prototype.g1=null,jsts.operation.union.UnionInteracting.prototype.interacts0=null,jsts.operation.union.UnionInteracting.prototype.interacts1=null,jsts.operation.union.UnionInteracting.prototype.union=function(){this.computeInteracting();var t=this.extractElements(this.g0,this.interacts0,!0),e=this.extractElements(this.g1,this.interacts1,!0);t.isEmpty()||e.isEmpty();var n=in0.union(e),o=this.extractElements(this.g0,this.interacts0,!1),r=this.extractElements(this.g1,this.interacts1,!1),i=jsts.geom.util.GeometryCombiner.combine(n,o,r);return i},jsts.operation.union.UnionInteracting.prototype.bufferUnion=function(t,e){var n=t.getFactory(),o=n.createGeometryCollection([t,e]),r=o.buffer(0);return r},jsts.operation.union.UnionInteracting.prototype.computeInteracting=function(t){if(t){for(var e=!1,n=0,o=g1.getNumGeometries();o>n;n++){var r=this.g1.getGeometryN(n),i=r.getEnvelopeInternal().intersects(t.getEnvelopeInternal());i&&(this.interacts1[n]=!0,e=!0)}return e}for(var n=0,o=this.g0.getNumGeometries();o>n;n++){var s=this.g0.getGeometryN(n);this.interacts0[n]=this.computeInteracting(s)}},jsts.operation.union.UnionInteracting.prototype.extractElements=function(t,e,n){for(var o=[],r=0,i=t.getNumGeometries();i>r;r++){var s=t.getGeometryN(r);e[r]===n&&o.push(s)}return this.geomFactory.buildGeometry(o)},jsts.triangulate.quadedge.TrianglePredicate=function(){},jsts.triangulate.quadedge.TrianglePredicate.isInCircleNonRobust=function(t,e,n,o){var r=(t.x*t.x+t.y*t.y)*jsts.triangulate.quadedge.TrianglePredicate.triArea(e,n,o)-(e.x*e.x+e.y*e.y)*jsts.triangulate.quadedge.TrianglePredicate.triArea(t,n,o)+(n.x*n.x+n.y*n.y)*jsts.triangulate.quadedge.TrianglePredicate.triArea(t,e,o)-(o.x*o.x+o.y*o.y)*jsts.triangulate.quadedge.TrianglePredicate.triArea(t,e,n)>0;return r},jsts.triangulate.quadedge.TrianglePredicate.isInCircleNormalized=function(t,e,n,o){var r,i,s,a,u,p,g,l,h,d,c,f,m;return r=t.x-o.x,i=t.y-o.y,s=e.x-o.x,a=e.y-o.y,u=n.x-o.x,p=n.y-o.y,g=r*a-s*i,l=s*p-u*a,h=u*i-r*p,d=r*r+i*i,c=s*s+a*a,f=u*u+p*p,m=d*l+c*h+f*g,m>0},jsts.triangulate.quadedge.TrianglePredicate.triArea=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(e.y-t.y)*(n.x-t.x)},jsts.triangulate.quadedge.TrianglePredicate.isInCircleRobust=function(t,e,n,o){return jsts.triangulate.quadedge.TrianglePredicate.isInCircleNormalized(t,e,n,o)},jsts.triangulate.quadedge.TrianglePredicate.isInCircleDDSlow=function(t,e,n,o){var r,i,s,a,u,p,g,l,h,d,c,f,m,y;return r=jsts.math.DD.valueOf(o.x),i=jsts.math.DD.valueOf(o.y),s=jsts.math.DD.valueOf(t.x),a=jsts.math.DD.valueOf(t.y),u=jsts.math.DD.valueOf(e.x),p=jsts.math.DD.valueOf(e.y),g=jsts.math.DD.valueOf(n.x),l=jsts.math.DD.valueOf(n.y),h=s.multiply(s).add(a.multiply(a)).multiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDSlow(u,p,g,l,r,i)),d=u.multiply(u).add(p.multiply(p)).multiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDSlow(s,a,g,l,r,i)),c=g.multiply(g).add(l.multiply(l)).multiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDSlow(s,a,u,p,r,i)),f=r.multiply(r).add(i.multiply(i)).multiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDSlow(s,a,u,p,g,l)),m=h.subtract(d).add(c).subtract(f),y=m.doubleValue()>0},jsts.triangulate.quadedge.TrianglePredicate.triAreaDDSlow=function(t,e,n,o,r,i){return n.subtract(t).multiply(i.subtract(e)).subtract(o.subtract(e).multiply(r.subtract(t)))},jsts.triangulate.quadedge.TrianglePredicate.isInCircleDDFast=function(t,e,n,o){var r,i,s,a,u,p;return r=jsts.math.DD.sqr(t.x).selfAdd(jsts.math.DD.sqr(t.y)).selfMultiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDFast(e,n,o)),i=jsts.math.DD.sqr(e.x).selfAdd(jsts.math.DD.sqr(e.y)).selfMultiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDFast(t,n,o)),s=jsts.math.DD.sqr(n.x).selfAdd(jsts.math.DD.sqr(n.y)).selfMultiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDFast(t,e,o)),a=jsts.math.DD.sqr(o.x).selfAdd(jsts.math.DD.sqr(o.y)).selfMultiply(jsts.triangulate.quadedge.TrianglePredicate.triAreaDDFast(t,e,n)),u=r.selfSubtract(i).selfAdd(s).selfSubtract(a),p=u.doubleValue()>0},jsts.triangulate.quadedge.TrianglePredicate.triAreaDDFast=function(t,e,n){var o,r;return o=jsts.math.DD.valueOf(e.x).selfSubtract(t.x).selfMultiply(jsts.math.DD.valueOf(n.y).selfSubtract(t.y)),r=jsts.math.DD.valueOf(e.y).selSubtract(t.y).selfMultiply(jsts.math.DD.valueOf(n.x).selfSubtract(t.x)),o.selfSubtract(r)},jsts.triangulate.quadedge.TrianglePredicate.isInCircleDDNormalized=function(t,e,n,o){var r,i,s,a,u,p,g,l,h,d,c,f,m,y;return r=jsts.math.DD.valueOf(t.x).selfSubtract(o.x),i=jsts.math.DD.valueOf(t.y).selfSubtract(o.y),s=jsts.math.DD.valueOf(e.x).selfSubtract(o.x),s=jsts.math.DD.valueOf(e.y).selfSubtract(o.y),u=jsts.math.DD.valueOf(n.x).selfSubtract(o.x),u=jsts.math.DD.valueOf(n.y).selfSubtract(o.y),g=r.multiply(a).selfSubtract(s.multiply(i)),l=s.multiply(p).selfSubtract(u.multiply(a)),h=u.multiply(i).selfSubtract(r.multiply(p)),d=r.multiply(r).selfAdd(i.multiply(i)),c=s.multiply(s).selfAdd(a.multiply(a)),f=u.multiply(u).selfAdd(p.multiply(p)),m=d.selfMultiply(l).selfAdd(c.selfMultiply(h)).selfAdd(f.selfMultiply(g)),y=m.doubleValue()>0},jsts.triangulate.quadedge.TrianglePredicate.isInCircleCC=function(t,e,n,o){var r,i,s;return r=jsts.geom.Triangle.circumcentre(t,e,n),i=t.distance(r),s=o.distance(r)-i,0>=s},jsts.operation.union.PointGeometryUnion=function(t,e){this.pointGeom=t,this.otherGeom=e,this.geomFact=e.getFactory()},jsts.operation.union.PointGeometryUnion.union=function(t,e){var n=new jsts.operation.union.PointGeometryUnion(t,e);return n.union()},jsts.operation.union.PointGeometryUnion.prototype.pointGeom=null,jsts.operation.union.PointGeometryUnion.prototype.otherGeom=null,jsts.operation.union.PointGeometryUnion.prototype.geomFact=null,jsts.operation.union.PointGeometryUnion.prototype.union=function(){for(var t=new jsts.algorithm.PointLocator,e=[],n=0,o=this.pointGeom.getNumGeometries();o>n;n++){var r=this.pointGeom.getGeometryN(n),i=r.getCoordinate(),s=t.locate(i,this.otherGeom);if(s===jsts.geom.Location.EXTERIOR){for(var a=!0,u=e.length;n--;)if(e[u].equals(i)){a=!1;break}a&&e.push(i)}}if(e.sort(function(t,e){return t.compareTo(e)}),0===e.length)return this.otherGeom;var p=null,g=jsts.geom.CoordinateArrays.toCoordinateArray(e);return p=1===g.length?this.geomFact.createPoint(g[0]):this.geomFact.createMultiPoint(g),jsts.geom.util.GeometryCombiner.combine(p,this.otherGeom)},jsts.noding.IntersectionFinderAdder=function(t){this.li=t,this.interiorIntersections=new javascript.util.ArrayList},jsts.noding.IntersectionFinderAdder.prototype=new jsts.noding.SegmentIntersector,jsts.noding.IntersectionFinderAdder.constructor=jsts.noding.IntersectionFinderAdder,jsts.noding.IntersectionFinderAdder.prototype.li=null,jsts.noding.IntersectionFinderAdder.prototype.interiorIntersections=null,jsts.noding.IntersectionFinderAdder.prototype.getInteriorIntersections=function(){return this.interiorIntersections},jsts.noding.IntersectionFinderAdder.prototype.processIntersections=function(t,e,n,o){if(t!==n||e!==o){var r=t.getCoordinates()[e],i=t.getCoordinates()[e+1],s=n.getCoordinates()[o],a=n.getCoordinates()[o+1];if(this.li.computeIntersection(r,i,s,a),this.li.hasIntersection()&&this.li.isInteriorIntersection()){for(var u=0;un;n++)if(!t[n].equals(e))return t[n];return null},jsts.operation.valid.ConnectedInteriorTester.prototype.getCoordinate=function(){return this.disconnectedRingcoord},jsts.operation.valid.ConnectedInteriorTester.prototype.isInteriorsConnected=function(){var t=new javascript.util.ArrayList;this.geomGraph.computeSplitEdges(t);var e=new jsts.geomgraph.PlanarGraph(new jsts.operation.overlay.OverlayNodeFactory);e.addEdges(t),this.setInteriorEdgesInResult(e),e.linkResultDirectedEdges();var n=this.buildEdgeRings(e.getEdgeEnds());return this.visitShellInteriors(this.geomGraph.getGeometry(),e),!this.hasUnvisitedShellEdge(n)},jsts.operation.valid.ConnectedInteriorTester.prototype.setInteriorEdgesInResult=function(t){for(var e,n=t.getEdgeEnds().iterator();n.hasNext();)e=n.next(),e.getLabel().getLocation(0,jsts.geomgraph.Position.RIGHT)==jsts.geom.Location.INTERIOR&&e.setInResult(!0)},jsts.operation.valid.ConnectedInteriorTester.prototype.buildEdgeRings=function(t){for(var e=new javascript.util.ArrayList,n=t.iterator();n.hasNext();){var o=n.next();if(o.isInResult()&&null==o.getEdgeRing()){var r=new jsts.operation.overlay.MaximalEdgeRing(o,this.geometryFactory);r.linkDirectedEdgesForMinimalEdgeRings();var i=r.buildMinimalRings(),s=0,a=i.length;for(s;a>s;s++)e.add(i[s])}}return e},jsts.operation.valid.ConnectedInteriorTester.prototype.visitShellInteriors=function(t,e){if(t instanceof jsts.geom.Polygon){var n=t;this.visitInteriorRing(n.getExteriorRing(),e)}if(t instanceof jsts.geom.MultiPolygon)for(var o=t,r=0;r0&&0>=s||s>0&&0>=r)&&(n=jsts.algorithm.RobustDeterminant.signOfDet2x2(o,r,i,s)/(s-r),n>0&&this.crossings++)},jsts.operation.valid.TopologyValidationError=function(t,e){this.errorType=t,this.pt=null,null!=e&&(this.pt=e.clone())},jsts.operation.valid.TopologyValidationError.HOLE_OUTSIDE_SHELL=2,jsts.operation.valid.TopologyValidationError.NESTED_HOLES=3,jsts.operation.valid.TopologyValidationError.DISCONNECTED_INTERIOR=4,jsts.operation.valid.TopologyValidationError.SELF_INTERSECTION=5,jsts.operation.valid.TopologyValidationError.RING_SELF_INTERSECTION=6,jsts.operation.valid.TopologyValidationError.NESTED_SHELLS=7,jsts.operation.valid.TopologyValidationError.DUPLICATE_RINGS=8,jsts.operation.valid.TopologyValidationError.TOO_FEW_POINTS=9,jsts.operation.valid.TopologyValidationError.INVALID_COORDINATE=10,jsts.operation.valid.TopologyValidationError.RING_NOT_CLOSED=11,jsts.operation.valid.TopologyValidationError.prototype.errMsg=["Topology Validation Error","Repeated Point","Hole lies outside shell","Holes are nested","Interior is disconnected","Self-intersection","Ring Self-intersection","Nested shells","Duplicate Rings","Too few distinct points in geometry component","Invalid Coordinate","Ring is not closed"],jsts.operation.valid.TopologyValidationError.prototype.getCoordinate=function(){return this.pt},jsts.operation.valid.TopologyValidationError.prototype.getErrorType=function(){return this.errorType},jsts.operation.valid.TopologyValidationError.prototype.getMessage=function(){return this.errMsg[this.errorType]},jsts.operation.valid.TopologyValidationError.prototype.toString=function(){var t="";return null!=this.pt?(t=" at or near point "+this.pt,this.getMessage()+t):t},function(){jsts.geom.MultiPolygon=function(t,e){this.geometries=t||[],this.factory=e},jsts.geom.MultiPolygon.prototype=new jsts.geom.GeometryCollection,jsts.geom.MultiPolygon.constructor=jsts.geom.MultiPolygon,jsts.geom.MultiPolygon.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString(null);for(var t=[],e=0;ee&&(this.min=e,this.max=t)},t.prototype.getMin=function(){return this.min},t.prototype.getMax=function(){return this.max},t.prototype.getWidth=function(){return this.max-this.min},t.prototype.expandToInclude=function(t){t.max>this.max&&(this.max=t.max),t.mine||this.max=this.min&&e<=this.max},t.prototype.containsPoint=function(t){return t>=this.min&&t<=this.max},jsts.index.bintree.Interval=t}(),jsts.index.DoubleBits=function(){},jsts.index.DoubleBits.powerOf2=function(t){return Math.pow(2,t)},jsts.index.DoubleBits.exponent=function(t){return jsts.index.DoubleBits.CVTFWD(64,t)-1023},jsts.index.DoubleBits.CVTFWD=function(t,e){var n,o,r,i,s="",a={32:{d:127,c:128,b:0,a:0},64:{d:32752,c:0,b:0,a:0}},u={32:8,64:11}[t];if(i||(n=0>e||0>1/e,isFinite(e)||(i=a[t],n&&(i.d+=1<=2;)o++,r/=2;for(;1>r&&o>0;)o--,r*=2;0>=o&&(r/=2,s="Zero or Denormal"),32===t&&o>254&&(s="Too big for Single",i={d:n?255:127,c:128,b:0,a:0},o=Math.pow(2,u)-1,r=0)}return o},function(){var t=jsts.index.DoubleBits,e=jsts.index.bintree.Interval,n=function(t){this.pt=0,this.level=0,this.computeKey(t)};n.computeLevel=function(e){var n,o=e.getWidth();return n=t.exponent(o)+1},n.prototype.getPoint=function(){return this.pt},n.prototype.getLevel=function(){return this.level},n.prototype.getInterval=function(){return this.interval},n.prototype.computeKey=function(t){for(this.level=n.computeLevel(t),this.interval=new e,this.computeInterval(this.level,t);!this.interval.contains(t);)this.level+=1,this.computeInterval(this.level,t)},n.prototype.computeInterval=function(e,n){var o=t.powerOf2(e);this.pt=Math.floor(n.getMin()/o)*o,this.interval.init(this.pt,this.pt+o)},jsts.index.bintree.Key=n}(),jsts.operation.buffer.SubgraphDepthLocater=function(t){this.subgraphs=[],this.seg=new jsts.geom.LineSegment,this.subgraphs=t},jsts.operation.buffer.SubgraphDepthLocater.prototype.subgraphs=null,jsts.operation.buffer.SubgraphDepthLocater.prototype.seg=null,jsts.operation.buffer.SubgraphDepthLocater.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(0===e.length)return 0;e.sort();var n=e[0];return n.leftDepth},jsts.operation.buffer.SubgraphDepthLocater.prototype.findStabbedSegments=function(t){if(3===arguments.length)return void this.findStabbedSegments2.apply(this,arguments);for(var e=[],n=0;nr.getMaxY()||this.findStabbedSegments2(t,o.getDirectedEdges(),e)}return e},jsts.operation.buffer.SubgraphDepthLocater.prototype.findStabbedSegments2=function(t,e,n){if(arguments[1]instanceof jsts.geomgraph.DirectedEdge)return void this.findStabbedSegments3(t,e,n);for(var o=e.iterator();o.hasNext();){var r=o.next();r.isForward()&&this.findStabbedSegments3(t,r,n)}},jsts.operation.buffer.SubgraphDepthLocater.prototype.findStabbedSegments3=function(t,e,n){for(var o=e.getEdge().getCoordinates(),r=0;rthis.seg.p1.y&&this.seg.reverse();var i=Math.max(this.seg.p0.x,this.seg.p1.x);if(!(ithis.seg.p1.y||jsts.algorithm.CGAlgorithms.computeOrientation(this.seg.p0,this.seg.p1,t)===jsts.algorithm.CGAlgorithms.RIGHT)){var s=e.getDepth(jsts.geomgraph.Position.LEFT);this.seg.p0.equals(o[r])||(s=e.getDepth(jsts.geomgraph.Position.RIGHT));var a=new jsts.operation.buffer.SubgraphDepthLocater.DepthSegment(this.seg,s);n.push(a)}}},jsts.operation.buffer.SubgraphDepthLocater.DepthSegment=function(t,e){this.upwardSeg=new jsts.geom.LineSegment(t),this.leftDepth=e},jsts.operation.buffer.SubgraphDepthLocater.DepthSegment.prototype.upwardSeg=null,jsts.operation.buffer.SubgraphDepthLocater.DepthSegment.prototype.leftDepth=null,jsts.operation.buffer.SubgraphDepthLocater.DepthSegment.prototype.compareTo=function(t){var e=t,n=this.upwardSeg.orientationIndex(e.upwardSeg);return 0===n&&(n=-1*e.upwardSeg.orientationIndex(upwardSeg)),0!==n?n:this.compareX(this.upwardSeg,e.upwardSeg)},jsts.operation.buffer.SubgraphDepthLocater.DepthSegment.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},jsts.noding.snapround.HotPixel=function(t,e,n){this.corner=[],this.originalPt=t,this.pt=t,this.scaleFactor=e,this.li=n,1!==this.scaleFactor&&(this.pt=new jsts.geom.Coordinate(this.scale(t.x),this.scale(t.y)),this.p0Scaled=new jsts.geom.Coordinate,this.p1Scaled=new jsts.geom.Coordinate),this.initCorners(this.pt)},jsts.noding.snapround.HotPixel.prototype.li=null,jsts.noding.snapround.HotPixel.prototype.pt=null,jsts.noding.snapround.HotPixel.prototype.originalPt=null,jsts.noding.snapround.HotPixel.prototype.ptScaled=null,jsts.noding.snapround.HotPixel.prototype.p0Scaled=null,jsts.noding.snapround.HotPixel.prototype.p1Scaled=null,jsts.noding.snapround.HotPixel.prototype.scaleFactor=void 0,jsts.noding.snapround.HotPixel.prototype.minx=void 0,jsts.noding.snapround.HotPixel.prototype.maxx=void 0,jsts.noding.snapround.HotPixel.prototype.miny=void 0,jsts.noding.snapround.HotPixel.prototype.maxy=void 0,jsts.noding.snapround.HotPixel.prototype.corner=null,jsts.noding.snapround.HotPixel.prototype.safeEnv=null,jsts.noding.snapround.HotPixel.prototype.getCoordinate=function(){return this.originalPt},jsts.noding.snapround.HotPixel.SAFE_ENV_EXPANSION_FACTOR=.75,jsts.noding.snapround.HotPixel.prototype.getSafeEnvelope=function(){if(null===this.safeEnv){var t=jsts.noding.snapround.HotPixel.SAFE_ENV_EXPANSION_FACTOR/this.scaleFactor;this.safeEnv=new jsts.geom.Envelope(this.originalPt.x-t,this.originalPt.x+t,this.originalPt.y-t,this.originalPt.y+t)}return this.safeEnv},jsts.noding.snapround.HotPixel.prototype.initCorners=function(t){var e=.5;this.minx=t.x-e,this.maxx=t.x+e,this.miny=t.y-e,this.maxy=t.y+e,this.corner[0]=new jsts.geom.Coordinate(this.maxx,this.maxy),this.corner[1]=new jsts.geom.Coordinate(this.minx,this.maxy),this.corner[2]=new jsts.geom.Coordinate(this.minx,this.miny),this.corner[3]=new jsts.geom.Coordinate(this.maxx,this.miny)},jsts.noding.snapround.HotPixel.prototype.scale=function(t){return Math.round(t*this.scaleFactor)},jsts.noding.snapround.HotPixel.prototype.intersects=function(t,e){return 1===this.scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this.p0Scaled),this.copyScaled(e,this.p1Scaled),this.intersectsScaled(this.p0Scaled,this.p1Scaled))},jsts.noding.snapround.HotPixel.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},jsts.noding.snapround.HotPixel.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.y,e.y),i=Math.max(t.y,e.y),s=this.maxxo||this.maxyi;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return jsts.util.Assert.isTrue(!(s&&a),"Found bad envelope test"),a},jsts.noding.snapround.HotPixel.prototype.intersectsToleranceSquare=function(t,e){var n=!1,o=!1;return this.li.computeIntersection(t,e,this.corner[0],this.corner[1]),this.li.isProper()?!0:(this.li.computeIntersection(t,e,this.corner[1],this.corner[2]),this.li.isProper()?!0:(this.li.hasIntersection()&&(n=!0),this.li.computeIntersection(t,e,this.corner[2],this.corner[3]),this.li.isProper()?!0:(this.li.hasIntersection()&&(o=!0),this.li.computeIntersection(t,e,this.corner[3],this.corner[0]),this.li.isProper()?!0:n&&o?!0:t.equals(this.pt)?!0:e.equals(this.pt)?!0:!1)))},jsts.noding.snapround.HotPixel.prototype.intersectsPixelClosure=function(t,e){return this.li.computeIntersection(t,e,this.corner[0],this.corner[1]),this.li.hasIntersection()?!0:(this.li.computeIntersection(t,e,this.corner[1],this.corner[2]),this.li.hasIntersection()?!0:(this.li.computeIntersection(t,e,this.corner[2],this.corner[3]),this.li.hasIntersection()?!0:(this.li.computeIntersection(t,e,this.corner[3],this.corner[0]),this.li.hasIntersection()?!0:!1)))},jsts.noding.snapround.HotPixel.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),o=t.getCoordinate(e+1);return this.intersects(n,o)?(t.addIntersection(this.getCoordinate(),e),!0):!1},jsts.operation.buffer.BufferInputLineSimplifier=function(t){this.inputLine=t},jsts.operation.buffer.BufferInputLineSimplifier.simplify=function(t,e){var n=new jsts.operation.buffer.BufferInputLineSimplifier(t);return n.simplify(e)},jsts.operation.buffer.BufferInputLineSimplifier.INIT=0,jsts.operation.buffer.BufferInputLineSimplifier.DELETE=1,jsts.operation.buffer.BufferInputLineSimplifier.KEEP=1,jsts.operation.buffer.BufferInputLineSimplifier.prototype.inputLine=null,jsts.operation.buffer.BufferInputLineSimplifier.prototype.distanceTol=null,jsts.operation.buffer.BufferInputLineSimplifier.prototype.isDeleted=null,jsts.operation.buffer.BufferInputLineSimplifier.prototype.angleOrientation=jsts.algorithm.CGAlgorithms.COUNTERCLOCKWISE,jsts.operation.buffer.BufferInputLineSimplifier.prototype.simplify=function(t){this.distanceTol=Math.abs(t),0>t&&(this.angleOrientation=jsts.algorithm.CGAlgorithms.CLOCKWISE),this.isDeleted=[],this.isDeleted.length=this.inputLine.length;var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()},jsts.operation.buffer.BufferInputLineSimplifier.prototype.deleteShallowConcavities=function(){for(var t=1,e=(this.inputLine.length-1,this.findNextNonDeletedIndex(t)),n=this.findNextNonDeletedIndex(e),o=!1;ns},jsts.operation.buffer.BufferInputLineSimplifier.NUM_PTS_TO_CHECK=10,jsts.operation.buffer.BufferInputLineSimplifier.prototype.isShallowSampled=function(t,e,n,o,r){var i=parseInt((o-n)/jsts.operation.buffer.BufferInputLineSimplifier.NUM_PTS_TO_CHECK);0>=i&&(i=1);for(var s=n;o>s;s+=i)if(!this.isShallow(t,e,this.inputLine[s],r))return!1;return!0},jsts.operation.buffer.BufferInputLineSimplifier.prototype.isShallow=function(t,e,n,o){var r=jsts.algorithm.CGAlgorithms.distancePointLine(e,t,n);return o>r},jsts.operation.buffer.BufferInputLineSimplifier.prototype.isConcave=function(t,e,n){var o=jsts.algorithm.CGAlgorithms.computeOrientation(t,e,n),r=o===this.angleOrientation;return r},jsts.geomgraph.index.SweepLineEvent=function(t,e,n){return e instanceof jsts.geomgraph.index.SweepLineEvent?(this.eventType=jsts.geomgraph.index.SweepLineEvent.DELETE,this.xValue=t,void(this.insertEvent=e)):(this.eventType=jsts.geomgraph.index.SweepLineEvent.INSERT,this.label=n,this.xValue=t,void(this.obj=e))},jsts.geomgraph.index.SweepLineEvent.INSERT=1,jsts.geomgraph.index.SweepLineEvent.DELETE=2,jsts.geomgraph.index.SweepLineEvent.prototype.label=null,jsts.geomgraph.index.SweepLineEvent.prototype.xValue=null,jsts.geomgraph.index.SweepLineEvent.prototype.eventType=null,jsts.geomgraph.index.SweepLineEvent.prototype.insertEvent=null,jsts.geomgraph.index.SweepLineEvent.prototype.deleteEventIndex=null,jsts.geomgraph.index.SweepLineEvent.prototype.obj=null,jsts.geomgraph.index.SweepLineEvent.prototype.isInsert=function(){return this.eventType==jsts.geomgraph.index.SweepLineEvent.INSERT},jsts.geomgraph.index.SweepLineEvent.prototype.isDelete=function(){return this.eventType==jsts.geomgraph.index.SweepLineEvent.DELETE},jsts.geomgraph.index.SweepLineEvent.prototype.getInsertEvent=function(){return this.insertEvent},jsts.geomgraph.index.SweepLineEvent.prototype.getDeleteEventIndex=function(){return this.deleteEventIndex},jsts.geomgraph.index.SweepLineEvent.prototype.setDeleteEventIndex=function(t){this.deleteEventIndex=t},jsts.geomgraph.index.SweepLineEvent.prototype.getObject=function(){return this.obj},jsts.geomgraph.index.SweepLineEvent.prototype.isSameLabel=function(t){return null==this.label?!1:this.label==t.label},jsts.geomgraph.index.SweepLineEvent.prototype.compareTo=function(t){return this.xValuet.xValue?1:this.eventTypet.eventType?1:0},jsts.geom.CoordinateList=function(t,e){this.array=[],e=void 0===e?!0:e,void 0!==t&&this.add(t,e)},jsts.geom.CoordinateList.prototype=new javascript.util.ArrayList,jsts.geom.CoordinateList.prototype.iterator=null,jsts.geom.CoordinateList.prototype.remove=null,jsts.geom.CoordinateList.prototype.get=function(t){return this.array[t]},jsts.geom.CoordinateList.prototype.set=function(t,e){var n=this.array[t];return this.array[t]=e,n},jsts.geom.CoordinateList.prototype.size=function(){return this.array.length},jsts.geom.CoordinateList.prototype.add=function(){return arguments.length>1?this.addCoordinates.apply(this,arguments):this.array.push(arguments[0])},jsts.geom.CoordinateList.prototype.addCoordinates=function(t,e,n){if(t instanceof jsts.geom.Coordinate)return this.addCoordinate.apply(this,arguments);if("number"==typeof t)return this.insertCoordinate.apply(this,arguments);if(n=n||!0)for(var o=0;o=0;o--)this.addCoordinate(t[o],e);return!0},jsts.geom.CoordinateList.prototype.addCoordinate=function(t,e){if(!e&&this.size()>=1){var n=this.get(this.size()-1);if(n.equals2D(t))return}this.add(t)},jsts.geom.CoordinateList.prototype.insertCoordinate=function(t,e,n){if(!n){var o=t>0?t-1:-1;if(-1!==o&&this.get(o).equals2D(e))return;var r=t0&&this.addCoordinate(new jsts.geom.Coordinate(this.get(0)),!1)},jsts.geom.CoordinateList.prototype.toArray=function(){return this.array},jsts.geom.CoordinateList.prototype.toCoordinateArray=function(){return this.array},jsts.operation.buffer.OffsetSegmentGenerator=function(t,e,n){this.seg0=new jsts.geom.LineSegment,this.seg1=new jsts.geom.LineSegment,this.offset0=new jsts.geom.LineSegment,this.offset1=new jsts.geom.LineSegment,this.precisionModel=t,this.bufParams=e,this.li=new jsts.algorithm.RobustLineIntersector,this.filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),this.bufParams.getQuadrantSegments()>=8&&this.bufParams.getJoinStyle()===jsts.operation.buffer.BufferParameters.JOIN_ROUND&&(this.closingSegLengthFactor=jsts.operation.buffer.OffsetSegmentGenerator.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},jsts.operation.buffer.OffsetSegmentGenerator.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,jsts.operation.buffer.OffsetSegmentGenerator.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,jsts.operation.buffer.OffsetSegmentGenerator.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,jsts.operation.buffer.OffsetSegmentGenerator.MAX_CLOSING_SEG_LEN_FACTOR=80,jsts.operation.buffer.OffsetSegmentGenerator.prototype.maxCurveSegmentError=0,jsts.operation.buffer.OffsetSegmentGenerator.prototype.filletAngleQuantum=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.closingSegLengthFactor=1,jsts.operation.buffer.OffsetSegmentGenerator.prototype.segList=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.distance=0,jsts.operation.buffer.OffsetSegmentGenerator.prototype.precisionModel=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.bufParams=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.li=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.s0=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.s1=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.s2=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.seg0=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.seg1=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.offset0=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.offset1=null,jsts.operation.buffer.OffsetSegmentGenerator.prototype.side=0,jsts.operation.buffer.OffsetSegmentGenerator.prototype.hasNarrowConcaveAngle=!1,jsts.operation.buffer.OffsetSegmentGenerator.prototype.hasNarrowConcaveAngle=function(){return this.hasNarrowConcaveAngle},jsts.operation.buffer.OffsetSegmentGenerator.prototype.init=function(t){this.distance=t,this.maxCurveSegmentError=this.distance*(1-Math.cos(this.filletAngleQuantum/2)),this.segList=new jsts.operation.buffer.OffsetSegmentString,this.segList.setPrecisionModel(this.precisionModel),this.segList.setMinimumVertexDistance(this.distance*jsts.operation.buffer.OffsetSegmentGenerator.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.initSideSegments=function(t,e,n){this.s1=t,this.s2=e,this.side=n,this.seg1.setCoordinates(this.s1,this.s2),this.computeOffsetSegment(this.seg1,this.side,this.distance,this.offset1)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.getCoordinates=function(){return this.segList.getCoordinates()},jsts.operation.buffer.OffsetSegmentGenerator.prototype.closeRing=function(){this.segList.closeRing()},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addSegments=function(t,e){this.segList.addPts(t,e)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addFirstSegment=function(){this.segList.addPt(this.offset1.p0)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addLastSegment=function(){this.segList.addPt(this.offset1.p1)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addNextSegment=function(t,e){if(this.s0=this.s1,this.s1=this.s2,this.s2=t,this.seg0.setCoordinates(this.s0,this.s1),this.computeOffsetSegment(this.seg0,this.side,this.distance,this.offset0),this.seg1.setCoordinates(this.s1,this.s2),this.computeOffsetSegment(this.seg1,this.side,this.distance,this.offset1),!this.s1.equals(this.s2)){var n=jsts.algorithm.CGAlgorithms.computeOrientation(this.s0,this.s1,this.s2),o=n===jsts.algorithm.CGAlgorithms.CLOCKWISE&&this.side===jsts.geomgraph.Position.LEFT||n===jsts.algorithm.CGAlgorithms.COUNTERCLOCKWISE&&this.side===jsts.geomgraph.Position.RIGHT;0==n?this.addCollinear(e):o?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)}},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addCollinear=function(t){this.li.computeIntersection(this.s0,this.s1,this.s1,this.s2);var e=this.li.getIntersectionNum();e>=2&&(this.bufParams.getJoinStyle()===jsts.operation.buffer.BufferParameters.JOIN_BEVEL||this.bufParams.getJoinStyle()===jsts.operation.buffer.BufferParameters.JOIN_MITRE?(t&&this.segList.addPt(this.offset0.p1),this.segList.addPt(this.offset1.p0)):this.addFillet(this.s1,this.offset0.p1,this.offset1.p0,jsts.algorithm.CGAlgorithms.CLOCKWISE,this.distance))},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addOutsideTurn=function(t,e){return this.offset0.p1.distance(this.offset1.p0)0){var t=new jsts.geom.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));this.segList.addPt(t);var e=new jsts.geom.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));this.segList.addPt(e)}else this.segList.addPt(this.s1);this.segList.addPt(this.offset1.p0)}},jsts.operation.buffer.OffsetSegmentGenerator.prototype.computeOffsetSegment=function(t,e,n,o){var r=e===jsts.geomgraph.Position.LEFT?1:-1,i=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(i*i+s*s),u=r*n*i/a,p=r*n*s/a;o.p0.x=t.p0.x-p,o.p0.y=t.p0.y+u,o.p1.x=t.p1.x-p,o.p1.y=t.p1.y+u},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addLineEndCap=function(t,e){var n=new jsts.geom.LineSegment(t,e),o=new jsts.geom.LineSegment;this.computeOffsetSegment(n,jsts.geomgraph.Position.LEFT,this.distance,o);var r=new jsts.geom.LineSegment;this.computeOffsetSegment(n,jsts.geomgraph.Position.RIGHT,this.distance,r);var i=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,i);switch(this.bufParams.getEndCapStyle()){case jsts.operation.buffer.BufferParameters.CAP_ROUND:this.segList.addPt(o.p1),this.addFillet(e,a+Math.PI/2,a-Math.PI/2,jsts.algorithm.CGAlgorithms.CLOCKWISE,this.distance),this.segList.addPt(r.p1);break;case jsts.operation.buffer.BufferParameters.CAP_FLAT:this.segList.addPt(o.p1),this.segList.addPt(r.p1);break;case jsts.operation.buffer.BufferParameters.CAP_SQUARE:var u=new jsts.geom.Coordinate;u.x=Math.abs(this.distance)*Math.cos(a),u.y=Math.abs(this.distance)*Math.sin(a);var p=new jsts.geom.Coordinate(o.p1.x+u.x,o.p1.y+u.y),g=new jsts.geom.Coordinate(r.p1.x+u.x,r.p1.y+u.y);this.segList.addPt(p),this.segList.addPt(g)}},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addMitreJoin=function(t,e,n,o){var r=!0,i=null;try{i=jsts.algorithm.HCoordinate.intersection(e.p0,e.p1,n.p0,n.p1);var s=0>=o?1:i.distance(t)/Math.abs(o);s>this.bufParams.getMitreLimit()&&(this.isMitreWithinLimit=!1)}catch(a){a instanceof jsts.error.NotRepresentableError&&(i=new jsts.geom.Coordinate(0,0),this.isMitreWithinLimit=!1)}r?this.segList.addPt(i):this.addLimitedMitreJoin(e,n,o,bufParams.getMitreLimit())},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addLimitedMitreJoin=function(t,e,n,o){var r=this.seg0.p1,i=jsts.algorithm.Angle.angle(r,this.seg0.p0),s=(jsts.algorithm.Angle.angle(r,this.seg1.p1),jsts.algorithm.Angle.angleBetweenOriented(this.seg0.p0,r,this.seg1.p1)),a=s/2,u=jsts.algorithm.Angle.normalize(i+a),p=jsts.algorithm.Angle.normalize(u+Math.PI),g=o*n,l=g*Math.abs(Math.sin(a)),h=n-l,d=r.x+g*Math.cos(p),c=r.y+g*Math.sin(p),f=new jsts.geom.Coordinate(d,c),m=new jsts.geom.LineSegment(r,f),y=m.pointAlongOffset(1,h),j=m.pointAlongOffset(1,-h);this.side==jsts.geomgraph.Position.LEFT?(this.segList.addPt(y),this.segList.addPt(j)):(this.segList.addPt(j),this.segList.addPt(y))},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addBevelJoin=function(t,e){this.segList.addPt(t.p1),this.segList.addPt(e.p0)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addFillet=function(t,e,n,o,r){if(!(n instanceof jsts.geom.Coordinate))return void this.addFillet2.apply(this,arguments);var i=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,i),u=n.x-t.x,p=n.y-t.y,g=Math.atan2(p,u);o===jsts.algorithm.CGAlgorithms.CLOCKWISE?g>=a&&(a+=2*Math.PI):a>=g&&(a-=2*Math.PI),this.segList.addPt(e),this.addFillet(t,a,g,o,r),this.segList.addPt(n)},jsts.operation.buffer.OffsetSegmentGenerator.prototype.addFillet2=function(t,e,n,o,r){var i=o===jsts.algorithm.CGAlgorithms.CLOCKWISE?-1:1,s=Math.abs(e-n),a=parseInt(s/this.filletAngleQuantum+.5);if(!(1>a)){var u,p;u=0,p=s/a;for(var g=u,l=new jsts.geom.Coordinate;s>g;){var h=e+i*g;l.x=t.x+r*Math.cos(h),l.y=t.y+r*Math.sin(h),this.segList.addPt(l),g+=p}}},jsts.operation.buffer.OffsetSegmentGenerator.prototype.createCircle=function(t){var e=new jsts.geom.Coordinate(t.x+this.distance,t.y);this.segList.addPt(e),this.addFillet(t,0,2*Math.PI,-1,this.distance),this.segList.closeRing()},jsts.operation.buffer.OffsetSegmentGenerator.prototype.createSquare=function(t){this.segList.addPt(new jsts.geom.Coordinate(t.x+distance,t.y+distance)),this.segList.addPt(new jsts.geom.Coordinate(t.x+distance,t.y-distance)),this.segList.addPt(new jsts.geom.Coordinate(t.x-distance,t.y-distance)),this.segList.addPt(new jsts.geom.Coordinate(t.x-distance,t.y+distance)),this.segList.closeRing()},jsts.operation.overlay.MaximalEdgeRing=function(t,e){jsts.geomgraph.EdgeRing.call(this,t,e)},jsts.operation.overlay.MaximalEdgeRing.prototype=new jsts.geomgraph.EdgeRing,jsts.operation.overlay.MaximalEdgeRing.constructor=jsts.operation.overlay.MaximalEdgeRing,jsts.operation.overlay.MaximalEdgeRing.prototype.getNext=function(t){return t.getNext()},jsts.operation.overlay.MaximalEdgeRing.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},jsts.operation.overlay.MaximalEdgeRing.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this.startDe;do{var e=t.getNode();e.getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!=this.startDe)},jsts.operation.overlay.MaximalEdgeRing.prototype.buildMinimalRings=function(){var t=[],e=this.startDe;do{if(null===e.getMinEdgeRing()){var n=new jsts.operation.overlay.MinimalEdgeRing(e,this.geometryFactory);t.push(n)}e=e.getNext()}while(e!=this.startDe);return t},jsts.algorithm.CentroidPoint=function(){this.centSum=new jsts.geom.Coordinate},jsts.algorithm.CentroidPoint.prototype.ptCount=0,jsts.algorithm.CentroidPoint.prototype.centSum=null,jsts.algorithm.CentroidPoint.prototype.add=function(t){if(t instanceof jsts.geom.Point)this.add2(t.getCoordinate());else if(t instanceof jsts.geom.GeometryCollection||t instanceof jsts.geom.MultiPoint||t instanceof jsts.geom.MultiLineString||t instanceof jsts.geom.MultiPolygon)for(var e=t,n=0;ne?e:n},jsts.geomgraph.index.MonotoneChainEdge.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},jsts.geomgraph.index.MonotoneChainEdge.prototype.computeIntersects=function(t,e){for(var n=0;nt&&(l>o&&this.computeIntersectsForChain2(t,g,n,o,l,i),r>l&&this.computeIntersectsForChain2(t,g,n,l,r,i)),e>g&&(l>o&&this.computeIntersectsForChain2(g,e,n,o,l,i),r>l&&this.computeIntersectsForChain2(g,e,n,l,r,i))}},function(){var t=javascript.util.ArrayList;jsts.operation.relate.EdgeEndBuilder=function(){},jsts.operation.relate.EdgeEndBuilder.prototype.computeEdgeEnds=function(e){if(2==arguments.length)return void this.computeEdgeEnds2.apply(this,arguments);for(var n=new t,o=e;o.hasNext();){var r=o.next();this.computeEdgeEnds2(r,n)}return n},jsts.operation.relate.EdgeEndBuilder.prototype.computeEdgeEnds2=function(t,e){var n=t.getEdgeIntersectionList();n.addEndpoints();var o=n.iterator(),r=null,i=null;if(o.hasNext()){var s=o.next();do r=i,i=s,s=null,o.hasNext()&&(s=o.next()),null!==i&&(this.createEdgeEndForPrev(t,e,i,r),this.createEdgeEndForNext(t,e,i,s));while(null!==i)}},jsts.operation.relate.EdgeEndBuilder.prototype.createEdgeEndForPrev=function(t,e,n,o){var r=n.segmentIndex;if(0===n.dist){if(0===r)return;r--}var i=t.getCoordinate(r);null!==o&&o.segmentIndex>=r&&(i=o.coord);var s=new jsts.geomgraph.Label(t.getLabel());s.flip();var a=new jsts.geomgraph.EdgeEnd(t,n.coord,i,s);e.add(a)},jsts.operation.relate.EdgeEndBuilder.prototype.createEdgeEndForNext=function(t,e,n,o){var r=n.segmentIndex+1;if(!(r>=t.getNumPoints()&&null===o)){var i=t.getCoordinate(r);null!==o&&o.segmentIndex===n.segmentIndex&&(i=o.coord);var s=new jsts.geomgraph.EdgeEnd(t,n.coord,i,new jsts.geomgraph.Label(t.getLabel()));e.add(s)}}}(),function(){var t=javascript.util.ArrayList,e=javascript.util.TreeSet,n=jsts.geom.CoordinateFilter;jsts.util.UniqueCoordinateArrayFilter=function(){this.treeSet=new e,this.list=new t},jsts.util.UniqueCoordinateArrayFilter.prototype=new n,jsts.util.UniqueCoordinateArrayFilter.prototype.treeSet=null,jsts.util.UniqueCoordinateArrayFilter.prototype.list=null,jsts.util.UniqueCoordinateArrayFilter.prototype.getCoordinates=function(){return this.list.toArray()},jsts.util.UniqueCoordinateArrayFilter.prototype.filter=function(t){this.treeSet.contains(t)||(this.list.add(t),this.treeSet.add(t))}}(),function(){var t=jsts.algorithm.CGAlgorithms,e=jsts.util.UniqueCoordinateArrayFilter,n=jsts.util.Assert,o=javascript.util.Stack,r=javascript.util.ArrayList,i=javascript.util.Arrays,s=function(t){this.origin=t};s.prototype.origin=null,s.prototype.compare=function(t,e){var n=t,o=e;return s.polarCompare(this.origin,n,o)},s.polarCompare=function(e,n,o){var r=n.x-e.x,i=n.y-e.y,s=o.x-e.x,a=o.y-e.y,u=t.computeOrientation(e,n,o);if(u==t.COUNTERCLOCKWISE)return 1;if(u==t.CLOCKWISE)return-1;var p=r*r+i*i,g=s*s+a*a;return g>p?-1:p>g?1:0},jsts.algorithm.ConvexHull=function(){if(1===arguments.length){var t=arguments[0];this.inputPts=jsts.algorithm.ConvexHull.extractCoordinates(t),this.geomFactory=t.getFactory()}else this.pts=arguments[0],this.geomFactory=arguments[1]},jsts.algorithm.ConvexHull.prototype.geomFactory=null,jsts.algorithm.ConvexHull.prototype.inputPts=null,jsts.algorithm.ConvexHull.extractCoordinates=function(t){var n=new e;return t.apply(n),n.getCoordinates()},jsts.algorithm.ConvexHull.prototype.getConvexHull=function(){if(0==this.inputPts.length)return this.geomFactory.createGeometryCollection(null);if(1==this.inputPts.length)return this.geomFactory.createPoint(this.inputPts[0]);if(2==this.inputPts.length)return this.geomFactory.createLineString(this.inputPts);var t=this.inputPts;this.inputPts.length>50&&(t=this.reduce(this.inputPts));var e=this.preSort(t),n=this.grahamScan(e),o=n.toArray();return this.lineOrPolygon(o)},jsts.algorithm.ConvexHull.prototype.reduce=function(e){var n=this.computeOctRing(e);if(null==n)return this.inputPts;for(var o=new javascript.util.TreeSet,r=0;r0;)n=r.pop();n=r.push(n),n=r.push(e[i])}return n=r.push(e[0]),r},jsts.algorithm.ConvexHull.prototype.isBetween=function(e,n,o){if(0!==t.computeOrientation(e,n,o))return!1;if(e.x!=o.x){if(e.x<=n.x&&n.x<=o.x)return!0;if(o.x<=n.x&&n.x<=e.x)return!0}if(e.y!=o.y){if(e.y<=n.y&&n.y<=o.y)return!0;if(o.y<=n.y&&n.y<=e.y)return!0}return!1},jsts.algorithm.ConvexHull.prototype.computeOctRing=function(t){var e=this.computeOctPts(t),n=new jsts.geom.CoordinateList;return n.add(e,!1),n.size()<3?null:(n.closeRing(),n.toCoordinateArray())},jsts.algorithm.ConvexHull.prototype.computeOctPts=function(t){for(var e=[],n=0;8>n;n++)e[n]=t[0];for(var o=1;oe[2].y&&(e[2]=t[o]),t[o].x+t[o].y>e[3].x+e[3].y&&(e[3]=t[o]),t[o].x>e[4].x&&(e[4]=t[o]),t[o].x-t[o].y>e[5].x-e[5].y&&(e[5]=t[o]),t[o].y=t.length&&(e=0),e},jsts.algorithm.MinimumDiameter.computeC=function(t,e,n){return t*n.y-e*n.x},jsts.algorithm.MinimumDiameter.computeSegmentForLine=function(t,e,n){var o,r;return Math.abs(e)>Math.abs(t)?(o=new jsts.geom.Coordinate(0,n/e),r=new jsts.geom.Coordinate(1,n/e-t/e)):(o=new jsts.geom.Coordinate(n/t,0),r=new jsts.geom.Coordinate(n/t-e/t,1)),new jsts.geom.LineSegment(o,r)},jsts.algorithm.MinimumDiameter.prototype.getLength=function(){return this.computeMinimumDiameter(),this.minWidth},jsts.algorithm.MinimumDiameter.prototype.getWidthCoordinate=function(){return this.computeMinimumDiameter(),this.minWidthPt},jsts.algorithm.MinimumDiameter.prototype.getSupportingSegment=function(){this.computeMinimumDiameter();var t=[this.minBaseSeg.p0,this.minBaseSeg.p1];return jsts.algorithm.MinimumDiameter.inputGeom.getFactory().createLineString(t)},jsts.algorithm.MinimumDiameter.prototype.getDiameter=function(){if(this.computeMinimumDiameter(),null===this.minWidthPt)return jsts.algorithm.MinimumDiameter.inputGeom.getFactory().createLineString(null);var t=this.minBaseSeg.project(this.minWidthPt);return jsts.algorithm.MinimumDiameter.inputGeom.getFactory().createLineString([t,this.minWidthPt])},jsts.algorithm.MinimumDiameter.prototype.computeMinimumDiameter=function(){if(null===this.minWidthPt)if(jsts.algorithm.MinimumDiameter.isConvex)this.computeWidthConvex(jsts.algorithm.MinimumDiameter.inputGeom);else{var t=new jsts.algorithm.ConvexHull(jsts.algorithm.MinimumDiameter.inputGeom).getConvexHull();this.computeWidthConvex(t)}},jsts.algorithm.MinimumDiameter.prototype.computeWidthConvex=function(t){this.convexHullPts=t instanceof jsts.geom.Polygon?t.getExteriorRing().getCoordinates():t.getCoordinates(),0===this.convexHullPts.length?(this.minWidth=0,this.minWidthPt=null,this.minBaseSeg=null):1===this.convexHullPts.length?(this.minWidth=0,this.minWidthPt=this.convexHullPts[0],this.minBaseSeg.p0=this.convexHullPts[0],this.minBaseSeg.p1=this.convexHullPts[0]):2===this.convexHullPts.length||3===this.convexHullPts.length?(this.minWidth=0,this.minWidthPt=this.convexHullPts[0],this.minBaseSeg.p0=this.convexHullPts[0],this.minBaseSeg.p1=this.convexHullPts[1]):this.computeConvexRingMinDiameter(this.convexHullPts)},jsts.algorithm.MinimumDiameter.prototype.computeConvexRingMinDiameter=function(t){this.minWidth=Number.MAX_VALUE;for(var e=1,n=new jsts.geom.LineSegment,o=0;o=o;)o=r,i=s,s=jsts.algorithm.MinimumDiameter.nextIndex(t,i),r=e.distancePerpendicular(t[s]);return oo&&(o=a),n>a&&(n=a);var u=jsts.algorithm.MinimumDiameter.computeC(-e,t,this.convexHullPts[s]);u>i&&(i=u),r>u&&(r=u)}var p=jsts.algorithm.MinimumDiameter.computeSegmentForLine(-t,-e,i),g=jsts.algorithm.MinimumDiameter.computeSegmentForLine(-t,-e,r),l=jsts.algorithm.MinimumDiameter.computeSegmentForLine(-e,t,o),h=jsts.algorithm.MinimumDiameter.computeSegmentForLine(-e,t,n),d=l.lineIntersection(p),c=h.lineIntersection(p),f=h.lineIntersection(g),m=l.lineIntersection(g),y=jsts.algorithm.MinimumDiameter.inputGeom.getFactory().createLinearRing([d,c,f,m,d]);return jsts.algorithm.MinimumDiameter.inputGeom.getFactory().createPolygon(y,null)},function(){jsts.io.GeoJSONParser=function(t){this.geometryFactory=t||new jsts.geom.GeometryFactory,this.geometryTypes=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"]},jsts.io.GeoJSONParser.prototype.read=function(t){var e;e="string"==typeof t?JSON.parse(t):t;var n=e.type;if(!this.parse[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!=this.geometryTypes.indexOf(n)?this.parse[n].apply(this,[e.coordinates]):"GeometryCollection"===n?this.parse[n].apply(this,[e.geometries]):this.parse[n].apply(this,[e])},jsts.io.GeoJSONParser.prototype.parse={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var o=t.geometry.type;if(!this.parse[o])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n0?jsts.triangulate.quadedge.Vertex.LEFT:0>i?jsts.triangulate.quadedge.Vertex.RIGHT:o.getX()*r.getX()<0||o.getY()*r.getY()<0?jsts.triangulate.quadedge.Vertex.BEHIND:o.magn()0},jsts.triangulate.quadedge.Vertex.prototype.rightOf=function(t){return this.isCCW(t.dest(),t.orig())},jsts.triangulate.quadedge.Vertex.prototype.leftOf=function(t){return this.isCCW(t.orig(),t.dest())},jsts.triangulate.quadedge.Vertex.prototype.bisector=function(t,e){var n,o,r,i;return n=e.getX()-t.getX(),o=e.getY()-t.getY(),r=new jsts.algorithm.HCoordinate(t.getX()+n/2,t.getY()+o/2,1),i=new jsts.algorithm.HCoordinate(t.getX()-o+n/2,t.getY()+n+o/2,1),new jsts.algorithm.HCoordinate(r,i)},jsts.triangulate.quadedge.Vertex.prototype.distance=function(t,e){return t.p.distance(e.p)},jsts.triangulate.quadedge.Vertex.prototype.circumRadiusRatio=function(t,e){var n,o,r,i;return n=this.circleCenter(t,e),o=this.distance(n,t),r=this.distance(this,t),i=this.distance(t,e),r>i&&(r=i),i=this.distance(e,this),r>i&&(r=i),o/r},jsts.triangulate.quadedge.Vertex.prototype.midPoint=function(t){var e,n;return e=(this.p.x+t.getX())/2,n=(this.p.y+t.getY())/2,new jsts.triangulate.quadedge.Vertex(e,n)},jsts.triangulate.quadedge.Vertex.prototype.circleCenter=function(t,e){var n,o,r,i,s;n=new jsts.triangulate.quadedge.Vertex(this.getX(),this.getY()),o=this.bisector(n,t),r=this.bisector(t,e),i=new jsts.algorithm.HCoordinate(o,r),s=null;try{s=new jsts.triangulate.quadedge.Vertex(i.getX(),i.getY())}catch(a){}return s},jsts.operation.valid.IsValidOp=function(t){this.parentGeometry=t,this.isSelfTouchingRingFormingHoleValid=!1,this.validErr=null},jsts.operation.valid.IsValidOp.isValid=function(t){if(arguments[0]instanceof jsts.geom.Coordinate)return isNaN(t.x)?!1:isFinite(t.x)||isNaN(t.x)?isNaN(t.y)?!1:isFinite(t.y)||isNaN(t.y)?!0:!1:!1;var e=new jsts.operation.valid.IsValidOp(t);return e.isValid()},jsts.operation.valid.IsValidOp.findPtNotNode=function(t,e,n){for(var o=n.findEdge(e),r=o.getEdgeIntersectionList(),i=0;in;n++){var o=t.getGeometryN(n);if(this.checkInvalidCoordinates(o),null!=this.validErr)return;if(this.checkClosedRings(o),null!=this.validErr)return}var r=new jsts.geomgraph.GeometryGraph(0,t);if(this.checkTooFewPoints(r),null==this.validErr&&(this.checkConsistentArea(r),null==this.validErr&&(this.isSelfTouchingRingFormingHoleValid||(this.checkNoSelfIntersectingRings(r),null==this.validErr)))){for(var n=0;n=1&&(e=t.getCoordinateN(0)),this.validErr=new jsts.operation.valid.TopologyValidationError(jsts.operation.valid.TopologyValidationError.RING_NOT_CLOSED,e)}},jsts.operation.valid.IsValidOp.prototype.checkTooFewPoints=function(t){return t.hasTooFewPoints?void(this.validErr=new jsts.operation.valid.TopologyValidationError(jsts.operation.valid.TopologyValidationError.TOO_FEW_POINTS,t.getInvalidPoint())):void 0},jsts.operation.valid.IsValidOp.prototype.checkConsistentArea=function(t){var e=new jsts.operation.valid.ConsistentAreaTester(t),n=e.isNodeConsistentArea();return n?void(e.hasDuplicateRings()&&(this.validErr=new jsts.operation.valid.TopologyValidationError(jsts.operation.valid.TopologyValidationError.DUPLICATE_RINGS,e.getInvalidPoint()))):void(this.validErr=new jsts.operation.valid.TopologyValidationError(jsts.operation.valid.TopologyValidationError.SELF_INTERSECTION,e.getInvalidPoint()))},jsts.operation.valid.IsValidOp.prototype.checkNoSelfIntersectingRings=function(t){for(var e=t.getEdgeIterator();e.hasNext();){var n=e.next();if(this.checkNoSelfIntersectingRing(n.getEdgeIntersectionList()),null!=this.validErr)return}},jsts.operation.valid.IsValidOp.prototype.checkNoSelfIntersectingRing=function(t){for(var e=[],n=!0,o=t.iterator();o.hasNext();){var r=o.next();if(n)n=!1;else{if(e.indexOf(r.coord)>=0)return void(this.validErr=new jsts.operation.valid.TopologyValidationError(jsts.operation.valid.TopologyValidationError.RING_SELF_INTERSECTION,r.coord));e.push(r.coord)}}},jsts.operation.valid.IsValidOp.prototype.checkHolesInShell=function(t,e){for(var n=t.getExteriorRing(),o=new jsts.algorithm.MCPointInRing(n),r=0;r0?n>0?-r:r:n>0?r:-r;if(0===e||0===n)return o>0?t>0?r:-r:t>0?-r:r;if(e>0?o>0?e>o&&(r=-r,i=t,t=n,n=i,i=e,e=o,o=i):-o>=e?(r=-r,n=-n,o=-o):(i=t,t=-n,n=i,i=e,e=-o,o=i):o>0?o>=-e?(r=-r,t=-t,e=-e):(i=-t,t=n,n=i,i=-e,e=o,o=i):e>=o?(t=-t,e=-e,n=-n,o=-o):(r=-r,i=-t,t=-n,n=i,i=-e,e=-o,o=i),t>0){if(!(n>0))return r;if(t>n)return r}else{if(n>0)return-r;if(!(t>=n))return-r;r=-r,t=-t,n=-n}for(;;){if(a+=1,s=Math.floor(n/t),n-=s*t,o-=s*e,0>o)return-r;if(o>e)return r;if(t>n+n){if(o+o>e)return r}else{if(e>o+o)return-r;n=t-n,o=e-o,r=-r}if(0===o)return 0===n?0:-r;if(0===n)return r;if(s=Math.floor(t/n),t-=s*n,e-=s*o,0>e)return r;if(e>o)return-r;if(n>t+t){if(e+e>o)return-r}else{if(o>e+e)return r;t=n-t,e=o-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}},jsts.algorithm.RobustDeterminant.orientationIndex=function(t,e,n){var o=e.x-t.x,r=e.y-t.y,i=n.x-e.x,s=n.y-e.y;return jsts.algorithm.RobustDeterminant.signOfDet2x2(o,r,i,s)},jsts.index.quadtree.NodeBase=function(){this.subnode=new Array(4),this.subnode[0]=null,this.subnode[1]=null,this.subnode[2]=null,this.subnode[3]=null,this.items=[]},jsts.index.quadtree.NodeBase.prototype.getSubnodeIndex=function(t,e){var n=-1;return t.getMinX()>=e.x&&(t.getMinY()>=e.y&&(n=3),t.getMaxY()<=e.y&&(n=1)),t.getMaxX()<=e.x&&(t.getMinY()>=e.y&&(n=2),t.getMaxY()<=e.y&&(n=0)),n},jsts.index.quadtree.NodeBase.prototype.getItems=function(){return this.items},jsts.index.quadtree.NodeBase.prototype.hasItems=function(){return this.items.length>0},jsts.index.quadtree.NodeBase.prototype.add=function(t){this.items.push(t)},jsts.index.quadtree.NodeBase.prototype.remove=function(t,e){if(!this.isSearchMatch(t))return!1;var n=!1,o=0;for(o;4>o;o++)if(null!==this.subnode[o]&&(n=this.subnode[o].remove(t,e))){this.subnode[o].isPrunable()&&(this.subnode[o]=null);break}if(n)return n;if(-1!==this.items.indexOf(e)){for(var o=this.items.length-1;o>=0;o--)this.items[o]===e&&this.items.splice(o,1);n=!0}return n},jsts.index.quadtree.NodeBase.prototype.isPrunable=function(){return!(this.hasChildren()||this.hasItems())},jsts.index.quadtree.NodeBase.prototype.hasChildren=function(){var t=0;for(t;4>t;t++)if(null!==this.subnode[t])return!0;return!1},jsts.index.quadtree.NodeBase.prototype.isEmpty=function(){var t=!0;this.items.length>0&&(t=!1);var e=0;for(e;4>e;e++)null!==this.subnode[e]&&(this.subnode[e].isEmpty()||(t=!1));return t},jsts.index.quadtree.NodeBase.prototype.addAllItems=function(t){t=t.concat(this.items);var e=0;for(e;4>e;e++)null!==this.subnode[e]&&(t=this.subnode[e].addAllItems(t));return t},jsts.index.quadtree.NodeBase.prototype.addAllItemsFromOverlapping=function(t,e){if(this.isSearchMatch(t)){e=e.concat(this.items);var n=0;for(n;4>n;n++)null!==this.subnode[n]&&(e=this.subnode[n].addAllItemsFromOverlapping(t,e))}},jsts.index.quadtree.NodeBase.prototype.visit=function(t,e){if(this.isSearchMatch(t)){this.visitItems(t,e);var n=0;for(n;4>n;n++)null!==this.subnode[n]&&this.subnode[n].visit(t,e)}},jsts.index.quadtree.NodeBase.prototype.visitItems=function(t,e){var n=0,o=this.items.length;for(n;o>n;n++)e.visitItem(this.items[n])},jsts.index.quadtree.NodeBase.prototype.depth=function(){var t,e=0,n=0;for(n;4>n;n++)null!==this.subnode[n]&&(t=this.subnode[n].depth(),t>e&&(e=t));return e+1},jsts.index.quadtree.NodeBase.prototype.size=function(){var t=0,e=0;for(e;4>e;e++)null!==this.subnode[e]&&(t+=this.subnode[e].size());return t+this.items.length},jsts.index.quadtree.NodeBase.prototype.getNodeCount=function(){var t=0,e=0;for(e;4>e;e++)null!==this.subnode[e]&&(t+=this.subnode[e].size());return t+1},jsts.index.quadtree.Node=function(t,e){jsts.index.quadtree.NodeBase.prototype.constructor.apply(this,arguments),this.env=t,this.level=e,this.centre=new jsts.geom.Coordinate,this.centre.x=(t.getMinX()+t.getMaxX())/2,this.centre.y=(t.getMinY()+t.getMaxY())/2},jsts.index.quadtree.Node.prototype=new jsts.index.quadtree.NodeBase,jsts.index.quadtree.Node.createNode=function(t){var e,n;return e=new jsts.index.quadtree.Key(t),n=new jsts.index.quadtree.Node(e.getEnvelope(),e.getLevel())},jsts.index.quadtree.Node.createExpanded=function(t,e){var n,o=new jsts.geom.Envelope(e);return null!==t&&o.expandToInclude(t.env),n=jsts.index.quadtree.Node.createNode(o),null!==t&&n.insertNode(t),n},jsts.index.quadtree.Node.prototype.getEnvelope=function(){return this.env},jsts.index.quadtree.Node.prototype.isSearchMatch=function(t){return this.env.intersects(t)},jsts.index.quadtree.Node.prototype.getNode=function(t){var e,n=this.getSubnodeIndex(t,this.centre);return-1!==n?(e=this.getSubnode(n),e.getNode(t)):this},jsts.index.quadtree.Node.prototype.find=function(t){var e,n=this.getSubnodeIndex(t,this.centre);return-1===n?this:null!==this.subnode[n]?(e=this.subnode[n],e.find(t)):this},jsts.index.quadtree.Node.prototype.insertNode=function(t){var e,n=this.getSubnodeIndex(t.env,this.centre);t.level===this.level-1?this.subnode[n]=t:(e=this.createSubnode(n),e.insertNode(t),this.subnode[n]=e)},jsts.index.quadtree.Node.prototype.getSubnode=function(t){return null===this.subnode[t]&&(this.subnode[t]=this.createSubnode(t)),this.subnode[t]},jsts.index.quadtree.Node.prototype.createSubnode=function(t){var e,n,o=0,r=0,i=0,s=0;switch(t){case 0:o=this.env.getMinX(),r=this.centre.x,i=this.env.getMinY(),s=this.centre.y;break;case 1:o=this.centre.x,r=this.env.getMaxX(),i=this.env.getMinY(),s=this.centre.y;break;case 2:o=this.env.getMinX(),r=this.centre.x,i=this.centre.y,s=this.env.getMaxY();break;case 3:o=this.centre.x,r=this.env.getMaxX(),i=this.centre.y,s=this.env.getMaxY()}return e=new jsts.geom.Envelope(o,r,i,s),n=new jsts.index.quadtree.Node(e,this.level-1)},function(){jsts.triangulate.quadedge.QuadEdge=function(){this.rot=null,this.vertex=null,this.next=null,this.data=null};var t=jsts.triangulate.quadedge.QuadEdge;jsts.triangulate.quadedge.QuadEdge.makeEdge=function(e,n){var o,r,i,s,a;return o=new t,r=new t,i=new t,s=new t,o.rot=r,r.rot=i,i.rot=s,s.rot=o,o.setNext(o),r.setNext(s),i.setNext(i),s.setNext(r),a=o,a.setOrig(e),a.setDest(n),a},jsts.triangulate.quadedge.QuadEdge.connect=function(e,n){var o=t.makeEdge(e.dest(),n.orig());return t.splice(o,e.lNext()),t.splice(o.sym(),n),o},jsts.triangulate.quadedge.QuadEdge.splice=function(t,e){var n,o,r,i,s,a;n=t.oNext().rot,o=e.oNext().rot,r=e.oNext(),i=t.oNext(),s=o.oNext(),a=n.oNext(),t.setNext(r),e.setNext(i),n.setNext(s),o.setNext(a)},jsts.triangulate.quadedge.QuadEdge.swap=function(e){var n,o;n=e.oPrev(),o=e.sym().oPrev(),t.splice(e,n),t.splice(e.sym(),o),t.splice(e,n.lNext()),t.splice(e.sym(),o.lNext()),e.setOrig(n.dest()),e.setDest(o.dest())},jsts.triangulate.quadedge.QuadEdge.prototype.getPrimary=function(){return this.orig().getCoordinate().compareTo(this.dest().getCoordinate())<=0?this:this.sym()},jsts.triangulate.quadedge.QuadEdge.prototype.setData=function(t){this.data=t},jsts.triangulate.quadedge.QuadEdge.prototype.getData=function(){return this.data},jsts.triangulate.quadedge.QuadEdge.prototype.delete_jsts=function(){this.rot=null},jsts.triangulate.quadedge.QuadEdge.prototype.isLive=function(){return null!==this.rot},jsts.triangulate.quadedge.QuadEdge.prototype.setNext=function(t){this.next=t},jsts.triangulate.quadedge.QuadEdge.prototype.invRot=function(){return this.rot.sym()},jsts.triangulate.quadedge.QuadEdge.prototype.sym=function(){return this.rot.rot},jsts.triangulate.quadedge.QuadEdge.prototype.oNext=function(){return this.next},jsts.triangulate.quadedge.QuadEdge.prototype.oPrev=function(){return this.rot.next.rot},jsts.triangulate.quadedge.QuadEdge.prototype.dNext=function(){return this.sym().oNext().sym()},jsts.triangulate.quadedge.QuadEdge.prototype.dPrev=function(){return this.invRot().oNext().invRot()},jsts.triangulate.quadedge.QuadEdge.prototype.lNext=function(){return this.invRot().oNext().rot},jsts.triangulate.quadedge.QuadEdge.prototype.lPrev=function(){return this.next.sym()},jsts.triangulate.quadedge.QuadEdge.prototype.rNext=function(){return this.rot.next.invRot()},jsts.triangulate.quadedge.QuadEdge.prototype.rPrev=function(){return this.sym().oNext()},jsts.triangulate.quadedge.QuadEdge.prototype.setOrig=function(t){this.vertex=t},jsts.triangulate.quadedge.QuadEdge.prototype.setDest=function(t){this.sym().setOrig(t)},jsts.triangulate.quadedge.QuadEdge.prototype.orig=function(){return this.vertex},jsts.triangulate.quadedge.QuadEdge.prototype.dest=function(){return this.sym().orig()},jsts.triangulate.quadedge.QuadEdge.prototype.getLength=function(){return this.orig().getCoordinate().distance(dest().getCoordinate())},jsts.triangulate.quadedge.QuadEdge.prototype.equalsNonOriented=function(t){return this.equalsOriented(t)?!0:this.equalsOriented(t.sym())?!0:!1},jsts.triangulate.quadedge.QuadEdge.prototype.equalsOriented=function(t){return this.orig().getCoordinate().equals2D(t.orig().getCoordinate())&&this.dest().getCoordinate().equals2D(t.dest().getCoordinate())?!0:!1},jsts.triangulate.quadedge.QuadEdge.prototype.toLineSegment=function(){return new jsts.geom.LineSegment(this.vertex.getCoordinate(),this.dest().getCoordinate()) +},jsts.triangulate.quadedge.QuadEdge.prototype.toString=function(){var t,e;return t=this.vertex.getCoordinate(),e=this.dest().getCoordinate(),jsts.io.WKTWriter.toLineString(t,e)}}(),function(){var t=jsts.util.Assert;jsts.geomgraph.EdgeEnd=function(t,e,n,o){this.edge=t,e&&n&&this.init(e,n),o&&(this.label=o||null)},jsts.geomgraph.EdgeEnd.prototype.edge=null,jsts.geomgraph.EdgeEnd.prototype.label=null,jsts.geomgraph.EdgeEnd.prototype.node=null,jsts.geomgraph.EdgeEnd.prototype.p0=null,jsts.geomgraph.EdgeEnd.prototype.p1=null,jsts.geomgraph.EdgeEnd.prototype.dx=null,jsts.geomgraph.EdgeEnd.prototype.dy=null,jsts.geomgraph.EdgeEnd.prototype.quadrant=null,jsts.geomgraph.EdgeEnd.prototype.init=function(e,n){this.p0=e,this.p1=n,this.dx=n.x-e.x,this.dy=n.y-e.y,this.quadrant=jsts.geomgraph.Quadrant.quadrant(this.dx,this.dy),t.isTrue(!(0===this.dx&&0===this.dy),"EdgeEnd with identical endpoints found")},jsts.geomgraph.EdgeEnd.prototype.getEdge=function(){return this.edge},jsts.geomgraph.EdgeEnd.prototype.getLabel=function(){return this.label},jsts.geomgraph.EdgeEnd.prototype.getCoordinate=function(){return this.p0},jsts.geomgraph.EdgeEnd.prototype.getDirectedCoordinate=function(){return this.p1},jsts.geomgraph.EdgeEnd.prototype.getQuadrant=function(){return this.quadrant},jsts.geomgraph.EdgeEnd.prototype.getDx=function(){return this.dx},jsts.geomgraph.EdgeEnd.prototype.getDy=function(){return this.dy},jsts.geomgraph.EdgeEnd.prototype.setNode=function(t){this.node=t},jsts.geomgraph.EdgeEnd.prototype.getNode=function(){return this.node},jsts.geomgraph.EdgeEnd.prototype.compareTo=function(t){return this.compareDirection(t)},jsts.geomgraph.EdgeEnd.prototype.compareDirection=function(t){return this.dx===t.dx&&this.dy===t.dy?0:this.quadrant>t.quadrant?1:this.quadrant0&&this.minIndexthis.minCoord.y&&n.y>this.minCoord.y&&o===jsts.algorithm.CGAlgorithms.CLOCKWISE&&(r=!0),r&&(this.minIndex=this.minIndex-1)},jsts.operation.buffer.RightmostEdgeFinder.prototype.checkForRightmostCoordinate=function(t){for(var e=t.getEdge().getCoordinates(),n=0;nthis.minCoord.x)&&(this.minDe=t,this.minIndex=n,this.minCoord=e[n])},jsts.operation.buffer.RightmostEdgeFinder.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return 0>n&&(n=this.getRightmostSideOfSegment(t,e-1)),0>n&&(this.minCoord=null,this.checkForRightmostCoordinate(t)),n},jsts.operation.buffer.RightmostEdgeFinder.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),o=n.getCoordinates();if(0>e||e+1>=o.length)return-1;if(o[e].y==o[e+1].y)return-1;var r=jsts.geomgraph.Position.LEFT;return o[e].y0},jsts.triangulate.IncrementalDelaunayTriangulator.prototype.insertSites=function(t){var e,n=0,o=t.length;for(n;o>n;n++)e=t[n],this.insertSite(e)},jsts.triangulate.IncrementalDelaunayTriangulator.prototype.insertSite=function(t){var e,n,o,r;if(e=this.subdiv.locate(t),this.subdiv.isVertexOfEdge(e,t))return e;this.subdiv.isOnEdge(e,t.getCoordinate())&&(e=e.oPrev(),this.subdiv.delete_jsts(e.oNext())),n=this.subdiv.makeEdge(e.orig(),t),jsts.triangulate.quadedge.QuadEdge.splice(n,e),o=n;do n=this.subdiv.connect(e,n.sym()),e=n.oPrev();while(e.lNext()!=o);for(;;)if(r=e.oPrev(),r.dest().rightOf(e)&&t.isInCircle(e.orig(),r.dest(),e.dest()))jsts.triangulate.quadedge.QuadEdge.swap(e),e=e.oPrev();else{if(e.oNext()==o)return n;e=e.oNext().lPrev()}}}(),jsts.algorithm.CentroidArea=function(){this.basePt=null,this.triangleCent3=new jsts.geom.Coordinate,this.centSum=new jsts.geom.Coordinate,this.cg3=new jsts.geom.Coordinate},jsts.algorithm.CentroidArea.prototype.basePt=null,jsts.algorithm.CentroidArea.prototype.triangleCent3=null,jsts.algorithm.CentroidArea.prototype.areasum2=0,jsts.algorithm.CentroidArea.prototype.cg3=null,jsts.algorithm.CentroidArea.prototype.centSum=null,jsts.algorithm.CentroidArea.prototype.totalLength=0,jsts.algorithm.CentroidArea.prototype.add=function(t){if(t instanceof jsts.geom.Polygon){var e=t;this.setBasePoint(e.getExteriorRing().getCoordinateN(0)),this.add3(e)}else if(t instanceof jsts.geom.GeometryCollection||t instanceof jsts.geom.MultiPolygon)for(var n=t,o=0;o0?(t.x=this.cg3.x/3/this.areasum2,t.y=this.cg3.y/3/this.areasum2):(t.x=this.centSum.x/this.totalLength,t.y=this.centSum.y/this.totalLength),t},jsts.algorithm.CentroidArea.prototype.setBasePoint=function(t){null==this.basePt&&(this.basePt=t)},jsts.algorithm.CentroidArea.prototype.add3=function(t){this.addShell(t.getExteriorRing().getCoordinates());for(var e=0;et?t:e},jsts.geomgraph.index.SweepLineSegment.prototype.getMaxX=function(){var t=this.pts[this.ptIndex].x,e=this.pts[this.ptIndex+1].x;return t>e?t:e},jsts.geomgraph.index.SweepLineSegment.prototype.computeIntersections=function(t,e){e.addIntersections(this.edge,this.ptIndex,t.edge,t.ptIndex)},jsts.index.quadtree.Root=function(){jsts.index.quadtree.NodeBase.prototype.constructor.apply(this,arguments),this.origin=new jsts.geom.Coordinate(0,0)},jsts.index.quadtree.Root.prototype=new jsts.index.quadtree.NodeBase,jsts.index.quadtree.Root.prototype.insert=function(t,e){var n=this.getSubnodeIndex(t,this.origin);if(-1===n)return void this.add(e);var o=this.subnode[n];if(null===o||!o.getEnvelope().contains(t)){var r=jsts.index.quadtree.Node.createExpanded(o,t);this.subnode[n]=r}this.insertContained(this.subnode[n],t,e)},jsts.index.quadtree.Root.prototype.insertContained=function(t,e,n){var o,r,i;o=jsts.index.IntervalSize.isZeroWidth(e.getMinX(),e.getMaxX()),r=jsts.index.IntervalSize.isZeroWidth(e.getMinY(),e.getMaxY()),i=o||r?t.find(e):t.getNode(e),i.add(n)},jsts.index.quadtree.Root.prototype.isSearchMatch=function(){return!0},jsts.geomgraph.index.MonotoneChainIndexer=function(){},jsts.geomgraph.index.MonotoneChainIndexer.toIntArray=function(t){for(var e=[],n=t.iterator();n.hasNext();){var o=n.next();e.push(o)}return e},jsts.geomgraph.index.MonotoneChainIndexer.prototype.getChainStartIndices=function(t){var e=0,n=new javascript.util.ArrayList;n.add(e);do{var o=this.findChainEnd(t,e);n.add(o),e=o}while(ee;e++){var o=this.inputPolys[e];t.insert(o.getEnvelopeInternal(),o)}var r=t.itemsTree(),i=this.unionTree(r);return i},jsts.operation.union.CascadedPolygonUnion.prototype.unionTree=function(t){var e=this.reduceToGeometries(t),n=this.binaryUnion(e);return n},jsts.operation.union.CascadedPolygonUnion.prototype.binaryUnion=function(t,e,n){if(e=e||0,n=n||t.length,1>=n-e){var o=this.getGeometry(t,e);return this.unionSafe(o,null)}if(n-e===2)return this.unionSafe(this.getGeometry(t,e),this.getGeometry(t,e+1));var r=parseInt((n+e)/2),o=this.binaryUnion(t,e,r),i=this.binaryUnion(t,r,n);return this.unionSafe(o,i)},jsts.operation.union.CascadedPolygonUnion.prototype.getGeometry=function(t,e){return e>=t.length?null:t[e]},jsts.operation.union.CascadedPolygonUnion.prototype.reduceToGeometries=function(t){for(var e=[],n=0,o=t.length;o>n;n++){var r=t[n],i=null;r instanceof Array?i=this.unionTree(r):r instanceof jsts.geom.Geometry&&(i=r),e.push(i)}return e},jsts.operation.union.CascadedPolygonUnion.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.clone():null===e?t.clone():this.unionOptimized(t,e)},jsts.operation.union.CascadedPolygonUnion.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),o=e.getEnvelopeInternal();if(!n.intersects(o)){var r=jsts.geom.util.GeometryCombiner.combine(t,e);return r}if(t.getNumGeometries<=1&&e.getNumGeometries<=1)return this.unionActual(t,e);var i=n.intersection(o);return this.unionUsingEnvelopeIntersection(t,e,i)},jsts.operation.union.CascadedPolygonUnion.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var o=new javascript.util.ArrayList,r=this.extractByEnvelope(n,t,o),i=this.extractByEnvelope(n,e,o),s=this.unionActual(r,i);o.add(s);var a=jsts.geom.util.GeometryCombiner.combine(o);return a},jsts.operation.union.CascadedPolygonUnion.prototype.extractByEnvelope=function(t,e,n){for(var o=new javascript.util.ArrayList,r=0;re;this.computeSingleSidedBufferCurve(t,r,o)}else this.computeLineBufferCurve(t,o);var i=o.getCoordinates();return i},jsts.operation.buffer.OffsetCurveBuilder.prototype.getRingCurve=function(t,e,n){if(this.distance=n,t.length<=2)return this.getLineCurve(t,n);if(0==this.distance)return jsts.operation.buffer.OffsetCurveBuilder.copyCoordinates(t);var o=this.getSegGen(this.distance);return this.computeRingBufferCurve(t,e,o),o.getCoordinates()},jsts.operation.buffer.OffsetCurveBuilder.prototype.getOffsetCurve=function(t,e){if(this.distance=e,0===this.distance)return null;var n=this.distance<0,o=Math.abs(this.distance),r=this.getSegGen(o);t.length<=1?this.computePointCurve(t[0],r):this.computeOffsetCurve(t,n,r);var i=r.getCoordinates();return n&&i.reverse(),i},jsts.operation.buffer.OffsetCurveBuilder.copyCoordinates=function(t){for(var e=[],n=0;n=i;i++)e.addNextSegment(o[i],!0);e.addLastSegment(),e.addLineEndCap(o[r-1],o[r]);var s=jsts.operation.buffer.BufferInputLineSimplifier.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],jsts.geomgraph.Position.LEFT);for(var i=a-2;i>=0;i--)e.addNextSegment(s[i],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},jsts.operation.buffer.OffsetCurveBuilder.prototype.computeSingleSidedBufferCurve=function(t,e,n){var o=jsts.operation.buffer.OffsetCurveBuilder.simplifyTolerance(this.distance);if(e){n.addSegments(t,!0);var r=jsts.operation.buffer.BufferInputLineSimplifier.simplify(t,-o),i=r.length-1;n.initSideSegments(r[i],r[i-1],jsts.geomgraph.Position.LEFT),n.addFirstSegment();for(var s=i-2;s>=0;s--)n.addNextSegment(r[s],!0)}else{n.addSegments(t,!1);var a=jsts.operation.buffer.BufferInputLineSimplifier.simplify(t,o),u=a.length-1;n.initSideSegments(a[0],a[1],jsts.geomgraph.Position.LEFT),n.addFirstSegment();for(var s=2;u>=s;s++)n.addNextSegment(a[s],!0)}n.addLastSegment(),n.closeRing()},jsts.operation.buffer.OffsetCurveBuilder.prototype.computeOffsetCurve=function(t,e,n){var o=jsts.operation.buffer.OffsetCurveBuilder.simplifyTolerance(this.distance);if(e){var r=jsts.operation.buffer.BufferInputLineSimplifier.simplify(t,-o),i=r.length-1;n.initSideSegments(r[i],r[i-1],jsts.geomgraph.Position.LEFT),n.addFirstSegment();for(var s=i-2;s>=0;s--)n.addNextSegment(r[s],!0)}else{var a=jsts.operation.buffer.BufferInputLineSimplifier.simplify(t,o),u=a.length-1;n.initSideSegments(a[0],a[1],jsts.geomgraph.Position.LEFT),n.addFirstSegment();for(var s=2;u>=s;s++)n.addNextSegment(a[s],!0)}n.addLastSegment()},jsts.operation.buffer.OffsetCurveBuilder.prototype.computeRingBufferCurve=function(t,e,n){var o=jsts.operation.buffer.OffsetCurveBuilder.simplifyTolerance(this.distance);e===jsts.geomgraph.Position.RIGHT&&(o=-o);var r=jsts.operation.buffer.BufferInputLineSimplifier.simplify(t,o),i=r.length-1;n.initSideSegments(r[i-1],r[0],e);for(var s=1;i>=s;s++){var a=1!==s;n.addNextSegment(r[s],a)}n.closeRing()},function(){var t=function(t,e,n){this.hotPixel=t,this.parentEdge=e,this.vertexIndex=n};t.prototype=new jsts.index.chain.MonotoneChainSelectAction,t.constructor=t,t.prototype.hotPixel=null,t.prototype.parentEdge=null,t.prototype.vertexIndex=null,t.prototype._isNodeAdded=!1,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(t,e){var n=t.getContext();(null===this.parentEdge||n!==this.parentEdge||e!==this.vertexIndex)&&(this._isNodeAdded=this.hotPixel.addSnappedNode(n,e))},jsts.noding.snapround.MCIndexPointSnapper=function(t){this.index=t},jsts.noding.snapround.MCIndexPointSnapper.prototype.index=null,jsts.noding.snapround.MCIndexPointSnapper.prototype.snap=function(e,n,o){if(1===arguments.length)return void this.snap2.apply(this,arguments);var r=e.getSafeEnvelope(),i=new t(e,n,o);return this.index.query(r,{visitItem:function(t){t.select(r,i)}}),i.isNodeAdded()},jsts.noding.snapround.MCIndexPointSnapper.prototype.snap2=function(t){return this.snap(t,null,-1)}}(),function(){var t=function(){this.items=new javascript.util.ArrayList,this.subnode=[null,null]};t.getSubnodeIndex=function(t,e){var n=-1;return t.min>=e&&(n=1),t.max<=e&&(n=0),n},t.prototype.getItems=function(){return this.items},t.prototype.add=function(t){this.items.add(t)},t.prototype.addAllItems=function(t){t.addAll(this.items);var e=0,n=2;for(e;n>e;e++)null!==this.subnode[e]&&this.subnode[e].addAllItems(t);return t},t.prototype.addAllItemsFromOverlapping=function(t,e){(null===t||this.isSearchMatch(t))&&(e.addAll(this.items),null!==this.subnode[0]&&this.subnode[0].addAllItemsFromOverlapping(t,e),null!==this.subnode[1]&&this.subnode[1].addAllItemsFromOverlapping(t,e))},t.prototype.remove=function(t,e){if(!this.isSearchMatch(t))return!1;var n=!1,o=0,r=2;for(o;r>o;o++)if(null!==this.subnode[o]&&(n=this.subnode[o].remove(t,e))){this.subnode[o].isPrunable()&&(this.subnode[o]=null);break}return n?n:n=this.items.remove(e)},t.prototype.isPrunable=function(){return!(this.hasChildren()||this.hasItems())},t.prototype.hasChildren=function(){var t=0,e=2;for(t;e>t;t++)if(null!==this.subnode[t])return!0;return!1},t.prototype.hasItems=function(){return!this.items.isEmpty()},t.prototype.depth=function(){var t,e=0,n=0,o=2;for(n;o>n;n++)null!==this.subnode[n]&&(t=this.subnode[n].depth(),t>e&&(e=t));return e+1},t.prototype.size=function(){var t=0,e=0,n=2;for(e;n>e;e++)null!==this.subnode[e]&&(t+=this.subnode[e].size());return t+this.items.size()},t.prototype.nodeSize=function(){var t=0,e=0,n=2;for(e;n>e;e++)null!==this.subnode[e]&&(t+=this.subnode[e].nodeSize());return t+1},jsts.index.bintree.NodeBase=t}(),function(){var t=jsts.index.bintree.NodeBase,e=jsts.index.bintree.Key,n=jsts.index.bintree.Interval,o=function(t,e){this.items=new javascript.util.ArrayList,this.subnode=[null,null],this.interval=t,this.level=e,this.centre=(t.getMin()+t.getMax())/2};o.prototype=new t,o.constructor=o,o.createNode=function(t){var n,r;return n=new e(t),r=new o(n.getInterval(),n.getLevel())},o.createExpanded=function(t,e){var r,i;return r=new n(e),null!==t&&r.expandToInclude(t.interval),i=o.createNode(r),null!==t&&i.insert(t),i},o.prototype.getInterval=function(){return this.interval},o.prototype.isSearchMatch=function(t){return t.overlaps(this.interval)},o.prototype.getNode=function(e){var n,o=t.getSubnodeIndex(e,this.centre);return-1!=o?(n=this.getSubnode(o),n.getNode(e)):this},o.prototype.find=function(e){var n,o=t.getSubnodeIndex(e,this.centre);return-1===o?this:null!==this.subnode[o]?(n=this.subnode[o],n.find(e)):this},o.prototype.insert=function(e){var n,o=t.getSubnodeIndex(e.interval,this.centre);e.level===this.level-1?this.subnode[o]=e:(n=this.createSubnode(o),n.insert(e),this.subnode[o]=n)},o.prototype.getSubnode=function(t){return null===this.subnode[t]&&(this.subnode[t]=this.createSubnode(t)),this.subnode[t]},o.prototype.createSubnode=function(t){var e,r,i,s;switch(e=0,r=0,t){case 0:e=this.interval.getMin(),r=this.centre;break;case 1:e=this.centre,r=this.interval.getMax()}return i=new n(e,r),s=new o(i,this.level-1)},jsts.index.bintree.Node=o}(),function(){var t=jsts.index.bintree.Node,e=jsts.index.bintree.NodeBase,n=function(){this.subnode=[null,null],this.items=new javascript.util.ArrayList};n.prototype=new jsts.index.bintree.NodeBase,n.constructor=n,n.origin=0,n.prototype.insert=function(o,r){var i,s,a=e.getSubnodeIndex(o,n.origin);return-1===a?void this.add(r):(i=this.subnode[a],null!==i&&i.getInterval().contains(o)||(s=t.createExpanded(i,o),this.subnode[a]=s),void this.insertContained(this.subnode[a],o,r))},n.prototype.insertContained=function(t,e,n){var o,r;o=jsts.index.IntervalSize.isZeroWidth(e.getMin(),e.getMax()),r=o?t.find(e):t.getNode(e),r.add(n)},n.prototype.isSearchMatch=function(){return!0},jsts.index.bintree.Root=n}(),jsts.geomgraph.Quadrant=function(){},jsts.geomgraph.Quadrant.NE=0,jsts.geomgraph.Quadrant.NW=1,jsts.geomgraph.Quadrant.SW=2,jsts.geomgraph.Quadrant.SE=3,jsts.geomgraph.Quadrant.quadrant=function(t,e){if(t instanceof jsts.geom.Coordinate)return jsts.geomgraph.Quadrant.quadrant2.apply(this,arguments);if(0===t&&0===e)throw new jsts.error.IllegalArgumentError("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?jsts.geomgraph.Quadrant.NE:jsts.geomgraph.Quadrant.SE:e>=0?jsts.geomgraph.Quadrant.NW:jsts.geomgraph.Quadrant.SW},jsts.geomgraph.Quadrant.quadrant2=function(t,e){if(e.x===t.x&&e.y===t.y)throw new jsts.error.IllegalArgumentError("Cannot compute the quadrant for two identical points "+t);return e.x>=t.x?e.y>=t.y?jsts.geomgraph.Quadrant.NE:jsts.geomgraph.Quadrant.SE:e.y>=t.y?jsts.geomgraph.Quadrant.NW:jsts.geomgraph.Quadrant.SW},jsts.geomgraph.Quadrant.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return 2===n?!0:!1},jsts.geomgraph.Quadrant.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(2===n)return-1;var o=e>t?t:e,r=t>e?t:e;return 0===o&&3===r?3:o},jsts.geomgraph.Quadrant.isInHalfPlane=function(t,e){return e===jsts.geomgraph.Quadrant.SE?t===jsts.geomgraph.Quadrant.SE||t===jsts.geomgraph.Quadrant.SW:t===e||t===e+1},jsts.geomgraph.Quadrant.isNorthern=function(t){return t===jsts.geomgraph.Quadrant.NE||t===jsts.geomgraph.Quadrant.NW},jsts.operation.valid.ConsistentAreaTester=function(t){this.geomGraph=t,this.li=new jsts.algorithm.RobustLineIntersector,this.nodeGraph=new jsts.operation.relate.RelateNodeGraph,this.invalidPoint=null},jsts.operation.valid.ConsistentAreaTester.prototype.getInvalidPoint=function(){return this.invalidPoint},jsts.operation.valid.ConsistentAreaTester.prototype.isNodeConsistentArea=function(){var t=this.geomGraph.computeSelfNodes(this.li,!0);return t.hasProperIntersection()?(this.invalidPoint=t.getProperIntersectionPoint(),!1):(this.nodeGraph.build(this.geomGraph),this.isNodeEdgeAreaLabelsConsistent())},jsts.operation.valid.ConsistentAreaTester.prototype.isNodeEdgeAreaLabelsConsistent=function(){for(var t=this.nodeGraph.getNodeIterator();t.hasNext();){var e=t.next();if(!e.getEdges().isAreaLabelsConsistent(this.geomGraph))return this.invalidPoint=e.getCoordinate().clone(),!1}return!0},jsts.operation.valid.ConsistentAreaTester.prototype.hasDuplicateRings=function(){for(var t=this.nodeGraph.getNodeIterator();t.hasNext();)for(var e=t.next(),n=e.getEdges().iterator();n.hasNext();){var o=n.next();if(o.getEdgeEnds().length>1)return invalidPoint=o.getEdge().getCoordinate(0),!0}return!1},jsts.operation.relate.RelateNode=function(){jsts.geomgraph.Node.apply(this,arguments)},jsts.operation.relate.RelateNode.prototype=new jsts.geomgraph.Node,jsts.operation.relate.RelateNode.prototype.computeIM=function(t){t.setAtLeastIfValid(this.label.getLocation(0),this.label.getLocation(1),0)},jsts.operation.relate.RelateNode.prototype.updateIMFromEdges=function(t){this.edges.updateIM(t)},function(){var t=jsts.geom.Location,e=jsts.geomgraph.Position,n=jsts.geomgraph.EdgeEnd;jsts.geomgraph.DirectedEdge=function(t,e){if(n.call(this,t),this.depth=[0,-999,-999],this._isForward=e,e)this.init(t.getCoordinate(0),t.getCoordinate(1));else{var o=t.getNumPoints()-1;this.init(t.getCoordinate(o),t.getCoordinate(o-1))}this.computeDirectedLabel()},jsts.geomgraph.DirectedEdge.prototype=new n,jsts.geomgraph.DirectedEdge.constructor=jsts.geomgraph.DirectedEdge,jsts.geomgraph.DirectedEdge.depthFactor=function(e,n){return e===t.EXTERIOR&&n===t.INTERIOR?1:e===t.INTERIOR&&n===t.EXTERIOR?-1:0},jsts.geomgraph.DirectedEdge.prototype._isForward=null,jsts.geomgraph.DirectedEdge.prototype._isInResult=!1,jsts.geomgraph.DirectedEdge.prototype._isVisited=!1,jsts.geomgraph.DirectedEdge.prototype.sym=null,jsts.geomgraph.DirectedEdge.prototype.next=null,jsts.geomgraph.DirectedEdge.prototype.nextMin=null,jsts.geomgraph.DirectedEdge.prototype.edgeRing=null,jsts.geomgraph.DirectedEdge.prototype.minEdgeRing=null,jsts.geomgraph.DirectedEdge.prototype.depth=null,jsts.geomgraph.DirectedEdge.prototype.getEdge=function(){return this.edge},jsts.geomgraph.DirectedEdge.prototype.setInResult=function(t){this._isInResult=t},jsts.geomgraph.DirectedEdge.prototype.isInResult=function(){return this._isInResult},jsts.geomgraph.DirectedEdge.prototype.isVisited=function(){return this._isVisited},jsts.geomgraph.DirectedEdge.prototype.setVisited=function(t){this._isVisited=t},jsts.geomgraph.DirectedEdge.prototype.setEdgeRing=function(t){this.edgeRing=t},jsts.geomgraph.DirectedEdge.prototype.getEdgeRing=function(){return this.edgeRing},jsts.geomgraph.DirectedEdge.prototype.setMinEdgeRing=function(t){this.minEdgeRing=t},jsts.geomgraph.DirectedEdge.prototype.getMinEdgeRing=function(){return this.minEdgeRing},jsts.geomgraph.DirectedEdge.prototype.getDepth=function(t){return this.depth[t]},jsts.geomgraph.DirectedEdge.prototype.setDepth=function(t,e){if(-999!==this.depth[t]&&this.depth[t]!==e)throw new jsts.error.TopologyError("assigned depths do not match",this.getCoordinate());this.depth[t]=e},jsts.geomgraph.DirectedEdge.prototype.getDepthDelta=function(){var t=this.edge.getDepthDelta();return this._isForward||(t=-t),t},jsts.geomgraph.DirectedEdge.prototype.setVisitedEdge=function(t){this.setVisited(t),this.sym.setVisited(t)},jsts.geomgraph.DirectedEdge.prototype.getSym=function(){return this.sym},jsts.geomgraph.DirectedEdge.prototype.isForward=function(){return this._isForward},jsts.geomgraph.DirectedEdge.prototype.setSym=function(t){this.sym=t},jsts.geomgraph.DirectedEdge.prototype.getNext=function(){return this.next},jsts.geomgraph.DirectedEdge.prototype.setNext=function(t){this.next=t},jsts.geomgraph.DirectedEdge.prototype.getNextMin=function(){return this.nextMin},jsts.geomgraph.DirectedEdge.prototype.setNextMin=function(t){this.nextMin=t},jsts.geomgraph.DirectedEdge.prototype.isLineEdge=function(){var e=this.label.isLine(0)||this.label.isLine(1),n=!this.label.isArea(0)||this.label.allPositionsEqual(0,t.EXTERIOR),o=!this.label.isArea(1)||this.label.allPositionsEqual(1,t.EXTERIOR);return e&&n&&o},jsts.geomgraph.DirectedEdge.prototype.isInteriorAreaEdge=function(){for(var n=!0,o=0;2>o;o++)this.label.isArea(o)&&this.label.getLocation(o,e.LEFT)===t.INTERIOR&&this.label.getLocation(o,e.RIGHT)===t.INTERIOR||(n=!1); +return n},jsts.geomgraph.DirectedEdge.prototype.computeDirectedLabel=function(){this.label=new jsts.geomgraph.Label(this.edge.getLabel()),this._isForward||this.label.flip()},jsts.geomgraph.DirectedEdge.prototype.setEdgeDepths=function(t,n){var o=this.getEdge().getDepthDelta();this._isForward||(o=-o);var r=1;t===e.LEFT&&(r=-1);var i=e.opposite(t),s=o*r,a=n+s;this.setDepth(t,n),this.setDepth(i,a)}}(),jsts.operation.distance.DistanceOp=function(t,e,n){this.ptLocator=new jsts.algorithm.PointLocator,this.geom=[],this.geom[0]=t,this.geom[1]=e,this.terminateDistance=n},jsts.operation.distance.DistanceOp.prototype.geom=null,jsts.operation.distance.DistanceOp.prototype.terminateDistance=0,jsts.operation.distance.DistanceOp.prototype.ptLocator=null,jsts.operation.distance.DistanceOp.prototype.minDistanceLocation=null,jsts.operation.distance.DistanceOp.prototype.minDistance=Number.MAX_VALUE,jsts.operation.distance.DistanceOp.distance=function(t,e){var n=new jsts.operation.distance.DistanceOp(t,e,0);return n.distance()},jsts.operation.distance.DistanceOp.isWithinDistance=function(t,e,n){var o=new jsts.operation.distance.DistanceOp(t,e,n);return o.distance()<=n},jsts.operation.distance.DistanceOp.nearestPoints=function(t,e){var n=new jsts.operation.distance.DistanceOp(t,e,0);return n.nearestPoints()},jsts.operation.distance.DistanceOp.prototype.distance=function(){if(null===this.geom[0]||null===this.geom[1])throw new jsts.error.IllegalArgumentError("null geometries are not supported");return this.geom[0].isEmpty()||this.geom[1].isEmpty()?0:(this.computeMinDistance(),this.minDistance)},jsts.operation.distance.DistanceOp.prototype.nearestPoints=function(){this.computeMinDistance();var t=[this.minDistanceLocation[0].getCoordinate(),this.minDistanceLocation[1].getCoordinate()];return t},jsts.operation.distance.DistanceOp.prototype.nearestLocations=function(){return this.computeMinDistance(),this.minDistanceLocation},jsts.operation.distance.DistanceOp.prototype.updateMinDistance=function(t,e){null!==t[0]&&(e?(this.minDistanceLocation[0]=t[1],this.minDistanceLocation[1]=t[0]):(this.minDistanceLocation[0]=t[0],this.minDistanceLocation[1]=t[1]))},jsts.operation.distance.DistanceOp.prototype.computeMinDistance=function(){return arguments.length>0?void this.computeMinDistance2.apply(this,arguments):void(null===this.minDistanceLocation&&(this.minDistanceLocation=[],this.computeContainmentDistance(),this.minDistance<=this.terminateDistance||this.computeFacetDistance()))},jsts.operation.distance.DistanceOp.prototype.computeContainmentDistance=function(){if(2===arguments.length)return void this.computeContainmentDistance2.apply(this,arguments);if(3===arguments.length&&!arguments[0]instanceof jsts.operation.distance.GeometryLocation)return void this.computeContainmentDistance3.apply(this,arguments);if(3===arguments.length)return void this.computeContainmentDistance4.apply(this,arguments);var t=[];this.computeContainmentDistance2(0,t),this.minDistance<=this.terminateDistance||this.computeContainmentDistance2(1,t)},jsts.operation.distance.DistanceOp.prototype.computeContainmentDistance2=function(t,e){var n=1-t,o=jsts.geom.util.PolygonExtracter.getPolygons(this.geom[t]);if(o.length>0){var r=jsts.operation.distance.ConnectedElementLocationFilter.getLocations(this.geom[n]);if(this.computeContainmentDistance3(r,o,e),this.minDistance<=this.terminateDistance)return this.minDistanceLocation[n]=e[0],void(this.minDistanceLocation[t]=e[1])}},jsts.operation.distance.DistanceOp.prototype.computeContainmentDistance3=function(t,e,n){for(var o=0;othis.minDistance))for(var o=t.getCoordinates(),r=e.getCoordinates(),i=0;ithis.minDistance))for(var o=t.getCoordinates(),r=e.getCoordinate(),i=0;io;o++)t=n[o],null===e?e=new jsts.index.strtree.Interval(t.getBounds()):e.expandToInclude(t.getBounds());return e},t},jsts.index.strtree.SIRtree.prototype.insert=function(t,e,n){jsts.index.strtree.AbstractSTRtree.prototype.insert(new jsts.index.strtree.Interval(Math.min(t,e),Math.max(t,e)),n)},jsts.index.strtree.SIRtree.prototype.query=function(t,e){e=e||t,jsts.index.strtree.AbstractSTRtree.prototype.query(new jsts.index.strtree.Interval(Math.min(t,e),Math.max(t,e)))},jsts.index.strtree.SIRtree.prototype.getIntersectsOp=function(){return this.intersectionOp},jsts.index.strtree.SIRtree.prototype.getComparator=function(){return this.comperator},jsts.simplify.DouglasPeuckerSimplifier=function(t){this.inputGeom=t,this.isEnsureValidTopology=!0},jsts.simplify.DouglasPeuckerSimplifier.prototype.inputGeom=null,jsts.simplify.DouglasPeuckerSimplifier.prototype.distanceTolerance=null,jsts.simplify.DouglasPeuckerSimplifier.prototype.isEnsureValidTopology=null,jsts.simplify.DouglasPeuckerSimplifier.simplify=function(t,e){var n=new jsts.simplify.DouglasPeuckerSimplifier(t);return n.setDistanceTolerance(e),n.getResultGeometry()},jsts.simplify.DouglasPeuckerSimplifier.prototype.setDistanceTolerance=function(t){if(0>t)throw"Tolerance must be non-negative";this.distanceTolerance=t},jsts.simplify.DouglasPeuckerSimplifier.prototype.setEnsureValid=function(t){this.isEnsureValidTopology=t},jsts.simplify.DouglasPeuckerSimplifier.prototype.getResultGeometry=function(){return this.inputGeom.isEmpty()?this.inputGeom.clone():new jsts.simplify.DPTransformer(this.distanceTolerance,this.isEnsureValidTopology).transform(this.inputGeom)},function(){jsts.operation.predicate.RectangleContains=function(t){this.rectEnv=t.getEnvelopeInternal()},jsts.operation.predicate.RectangleContains.contains=function(t,e){var n=new jsts.operation.predicate.RectangleContains(t);return n.contains(e)},jsts.operation.predicate.RectangleContains.prototype.rectEnv=null,jsts.operation.predicate.RectangleContains.prototype.contains=function(t){return this.rectEnv.contains(t.getEnvelopeInternal())?this.isContainedInBoundary(t)?!1:!0:!1},jsts.operation.predicate.RectangleContains.prototype.isContainedInBoundary=function(t){if(t instanceof jsts.geom.Polygon)return!1;if(t instanceof jsts.geom.Point)return this.isPointContainedInBoundary(t.getCoordinate());if(t instanceof jsts.geom.LineString)return this.isLineStringContainedInBoundary(t);for(var e=0;et;t++)for(var e=0;3>e;e++)this.depth[t][e]=jsts.geomgraph.Depth.NULL_VALUE},jsts.geomgraph.Depth.NULL_VALUE=-1,jsts.geomgraph.Depth.depthAtLocation=function(e){return e===t.EXTERIOR?0:e===t.INTERIOR?1:jsts.geomgraph.Depth.NULL_VALUE},jsts.geomgraph.Depth.prototype.depth=null,jsts.geomgraph.Depth.prototype.getDepth=function(t,e){return this.depth[t][e]},jsts.geomgraph.Depth.prototype.setDepth=function(t,e,n){this.depth[t][e]=n},jsts.geomgraph.Depth.prototype.getLocation=function(e,n){return this.depth[e][n]<=0?t.EXTERIOR:t.INTERIOR},jsts.geomgraph.Depth.prototype.add=function(e,n,o){o===t.INTERIOR&&this.depth[e][n]++},jsts.geomgraph.Depth.prototype.isNull=function(){if(arguments.length>0)return this.isNull2.apply(this,arguments);for(var t=0;2>t;t++)for(var e=0;3>e;e++)if(this.depth[t][e]!==jsts.geomgraph.Depth.NULL_VALUE)return!1;return!0},jsts.geomgraph.Depth.prototype.isNull2=function(t){return arguments.length>1?this.isNull3.apply(this,arguments):this.depth[t][1]==jsts.geomgraph.Depth.NULL_VALUE},jsts.geomgraph.Depth.prototype.isNull3=function(t,e){return this.depth[t][e]==jsts.geomgraph.Depth.NULL_VALUE},jsts.geomgraph.Depth.prototype.add=function(e){for(var n=0;2>n;n++)for(var o=1;3>o;o++){var r=e.getLocation(n,o);(r===t.EXTERIOR||r===t.INTERIOR)&&(this.isNull(n,o)?this.depth[n][o]=jsts.geomgraph.Depth.depthAtLocation(r):this.depth[n][o]+=jsts.geomgraph.Depth.depthAtLocation(r))}},jsts.geomgraph.Depth.prototype.getDelta=function(t){return this.depth[t][e.RIGHT]-this.depth[t][e.LEFT]},jsts.geomgraph.Depth.prototype.normalize=function(){for(var t=0;2>t;t++)if(!this.isNull(t)){var e=this.depth[t][1];this.depth[t][2]e&&(e=0);for(var n=1;3>n;n++){var o=0;this.depth[t][n]>e&&(o=1),this.depth[t][n]=o}}},jsts.geomgraph.Depth.prototype.toString=function(){return"A: "+this.depth[0][1]+","+this.depth[0][2]+" B: "+this.depth[1][1]+","+this.depth[1][2]}}(),jsts.algorithm.BoundaryNodeRule=function(){},jsts.algorithm.BoundaryNodeRule.prototype.isInBoundary=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.algorithm.Mod2BoundaryNodeRule=function(){},jsts.algorithm.Mod2BoundaryNodeRule.prototype=new jsts.algorithm.BoundaryNodeRule,jsts.algorithm.Mod2BoundaryNodeRule.prototype.isInBoundary=function(t){return t%2===1},jsts.algorithm.BoundaryNodeRule.MOD2_BOUNDARY_RULE=new jsts.algorithm.Mod2BoundaryNodeRule,jsts.algorithm.BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE=jsts.algorithm.BoundaryNodeRule.MOD2_BOUNDARY_RULE,jsts.operation.distance.GeometryLocation=function(t,e,n){this.component=t,this.segIndex=e,this.pt=n},jsts.operation.distance.GeometryLocation.INSIDE_AREA=-1,jsts.operation.distance.GeometryLocation.prototype.component=null,jsts.operation.distance.GeometryLocation.prototype.segIndex=null,jsts.operation.distance.GeometryLocation.prototype.pt=null,jsts.operation.distance.GeometryLocation.prototype.getGeometryComponent=function(){return this.component},jsts.operation.distance.GeometryLocation.prototype.getSegmentIndex=function(){return this.segIndex},jsts.operation.distance.GeometryLocation.prototype.getCoordinate=function(){return this.pt},jsts.operation.distance.GeometryLocation.prototype.isInsideArea=function(){return this.segIndex===jsts.operation.distance.GeometryLocation.INSIDE_AREA},jsts.geom.util.PointExtracter=function(t){this.pts=t},jsts.geom.util.PointExtracter.prototype=new jsts.geom.GeometryFilter,jsts.geom.util.PointExtracter.prototype.pts=null,jsts.geom.util.PointExtracter.getPoints=function(t,e){return void 0===e&&(e=[]),t instanceof jsts.geom.Point?e.push(t):(t instanceof jsts.geom.GeometryCollection||t instanceof jsts.geom.MultiPoint||t instanceof jsts.geom.MultiLineString||t instanceof jsts.geom.MultiPolygon)&&t.apply(new jsts.geom.util.PointExtracter(e)),e},jsts.geom.util.PointExtracter.prototype.filter=function(t){t instanceof jsts.geom.Point&&this.pts.push(t)},function(){var t=jsts.geom.Location;jsts.operation.relate.RelateNodeGraph=function(){this.nodes=new jsts.geomgraph.NodeMap(new jsts.operation.relate.RelateNodeFactory)},jsts.operation.relate.RelateNodeGraph.prototype.nodes=null,jsts.operation.relate.RelateNodeGraph.prototype.build=function(t){this.computeIntersectionNodes(t,0),this.copyNodesAndLabels(t,0);var e=new jsts.operation.relate.EdgeEndBuilder,n=e.computeEdgeEnds(t.getEdgeIterator());this.insertEdgeEnds(n)},jsts.operation.relate.RelateNodeGraph.prototype.computeIntersectionNodes=function(e,n){for(var o=e.getEdgeIterator();o.hasNext();)for(var r=o.next(),i=r.getLabel().getLocation(n),s=r.getEdgeIntersectionList().iterator();s.hasNext();){var a=s.next(),u=this.nodes.addNode(a.coord);i===t.BOUNDARY?u.setLabelBoundary(n):u.getLabel().isNull(n)&&u.setLabel(n,t.INTERIOR)}},jsts.operation.relate.RelateNodeGraph.prototype.copyNodesAndLabels=function(t,e){for(var n=t.getNodeIterator();n.hasNext();){var o=n.next(),r=this.nodes.addNode(o.getCoordinate());r.setLabel(e,o.getLabel().getLocation(e))}},jsts.operation.relate.RelateNodeGraph.prototype.insertEdgeEnds=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.nodes.add(n)}},jsts.operation.relate.RelateNodeGraph.prototype.getNodeIterator=function(){return this.nodes.iterator()}}(),jsts.geomgraph.index.SimpleSweepLineIntersector=function(){},jsts.geomgraph.index.SimpleSweepLineIntersector.prototype=new jsts.geomgraph.index.EdgeSetIntersector,jsts.geomgraph.index.SimpleSweepLineIntersector.prototype.events=[],jsts.geomgraph.index.SimpleSweepLineIntersector.prototype.nOverlaps=null,jsts.geomgraph.index.SimpleSweepLineIntersector.prototype.computeIntersections=function(t,e,n){return e instanceof javascript.util.List?void this.computeIntersections2.apply(this,arguments):(n?this.add(t,null):this.add(t),void this.computeIntersections3(e))},jsts.geomgraph.index.SimpleSweepLineIntersector.prototype.computeIntersections2=function(t,e,n){this.add(t,t),this.add(e,e),this.computeIntersections3(n)},jsts.geomgraph.index.SimpleSweepLineIntersector.prototype.add=function(t,e){if(t instanceof javascript.util.List)return void this.add2.apply(this,arguments);for(var n=t.getCoordinates(),o=0;oi;i++){var s=this.events[i];if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(r.computeIntersections(a,o),this.nOverlaps++)}}},jsts.triangulate.VoronoiDiagramBuilder=function(){this.siteCoords=null,this.tolerance=0,this.subdiv=null,this.clipEnv=null,this.diagramEnv=null},jsts.triangulate.VoronoiDiagramBuilder.prototype.setSites=function(){var t=arguments[0];t instanceof jsts.geom.Geometry||t instanceof jsts.geom.Coordinate||t instanceof jsts.geom.Point||t instanceof jsts.geom.MultiPoint||t instanceof jsts.geom.LineString||t instanceof jsts.geom.MultiLineString||t instanceof jsts.geom.LinearRing||t instanceof jsts.geom.Polygon||t instanceof jsts.geom.MultiPolygon?this.setSitesByGeometry(t):this.setSitesByArray(t)},jsts.triangulate.VoronoiDiagramBuilder.prototype.setSitesByGeometry=function(t){this.siteCoords=jsts.triangulate.DelaunayTriangulationBuilder.extractUniqueCoordinates(t)},jsts.triangulate.VoronoiDiagramBuilder.prototype.setSitesByArray=function(t){this.siteCoords=jsts.triangulate.DelaunayTriangulationBuilder.unique(t)},jsts.triangulate.VoronoiDiagramBuilder.prototype.setClipEnvelope=function(t){this.clipEnv=t},jsts.triangulate.VoronoiDiagramBuilder.prototype.setTolerance=function(t){this.tolerance=t},jsts.triangulate.VoronoiDiagramBuilder.prototype.create=function(){if(null===this.subdiv){var t,e,n,o;t=jsts.triangulate.DelaunayTriangulationBuilder.envelope(this.siteCoords),this.diagramEnv=t,e=Math.max(this.diagramEnv.getWidth(),this.diagramEnv.getHeight()),this.diagramEnv.expandBy(e),null!==this.clipEnv&&this.diagramEnv.expandToInclude(this.clipEnv),n=jsts.triangulate.DelaunayTriangulationBuilder.toVertices(this.siteCoords),this.subdiv=new jsts.triangulate.quadedge.QuadEdgeSubdivision(t,this.tolerance),o=new jsts.triangulate.IncrementalDelaunayTriangulator(this.subdiv),o.insertSites(n)}},jsts.triangulate.VoronoiDiagramBuilder.prototype.getSubdivision=function(){return this.create(),this.subdiv},jsts.triangulate.VoronoiDiagramBuilder.prototype.getDiagram=function(t){this.create();var e=this.subdiv.getVoronoiDiagram(t);return this.clipGeometryCollection(e,this.diagramEnv)},jsts.triangulate.VoronoiDiagramBuilder.prototype.clipGeometryCollection=function(t,e){var n,o,r,i,s,a;for(n=t.getFactory().toGeometry(e),o=[],r=0,i=t.getNumGeometries(),r;i>r;r++)s=t.getGeometryN(r),a=null,e.contains(s.getEnvelopeInternal())?a=s:e.intersects(s.getEnvelopeInternal())&&(a=n.intersection(s)),null===a||a.isEmpty()||o.push(a);return t.getFactory().createGeometryCollection(o)},jsts.operation.valid.IndexedNestedRingTester=function(t){this.graph=t,this.rings=new javascript.util.ArrayList,this.totalEnv=new jsts.geom.Envelope,this.index=null,this.nestedPt=null},jsts.operation.valid.IndexedNestedRingTester.prototype.getNestedPoint=function(){return this.nestedPt},jsts.operation.valid.IndexedNestedRingTester.prototype.add=function(t){this.rings.add(t),this.totalEnv.expandToInclude(t.getEnvelopeInternal())},jsts.operation.valid.IndexedNestedRingTester.prototype.isNonNested=function(){this.buildIndex();for(var t=0;te.segmentIndex?1:this.coord.equals2D(e.coord)?0:jsts.noding.SegmentPointComparator.compare(this.segmentOctant,this.coord,e.coord)},function(){jsts.io.GeoJSONWriter=function(){this.parser=new jsts.io.GeoJSONParser(this.geometryFactory)},jsts.io.GeoJSONWriter.prototype.write=function(t){var e=this.parser.write(t);return e}}(),jsts.io.OpenLayersParser=function(t){this.geometryFactory=t||new jsts.geom.GeometryFactory},jsts.io.OpenLayersParser.prototype.read=function(t){return"OpenLayers.Geometry.Point"===t.CLASS_NAME?this.convertFromPoint(t):"OpenLayers.Geometry.LineString"===t.CLASS_NAME?this.convertFromLineString(t):"OpenLayers.Geometry.LinearRing"===t.CLASS_NAME?this.convertFromLinearRing(t):"OpenLayers.Geometry.Polygon"===t.CLASS_NAME?this.convertFromPolygon(t):"OpenLayers.Geometry.MultiPoint"===t.CLASS_NAME?this.convertFromMultiPoint(t):"OpenLayers.Geometry.MultiLineString"===t.CLASS_NAME?this.convertFromMultiLineString(t):"OpenLayers.Geometry.MultiPolygon"===t.CLASS_NAME?this.convertFromMultiPolygon(t):"OpenLayers.Geometry.Collection"===t.CLASS_NAME?this.convertFromCollection(t):void 0},jsts.io.OpenLayersParser.prototype.convertFromPoint=function(t){return this.geometryFactory.createPoint(new jsts.geom.Coordinate(t.x,t.y))},jsts.io.OpenLayersParser.prototype.convertFromLineString=function(t){var e,n=[];for(e=0;e0&&(this.minExtent=e);var n=t.getHeight();n0&&(this.minExtent=n)},jsts.operation.relate.RelateNodeFactory=function(){},jsts.operation.relate.RelateNodeFactory.prototype=new jsts.geomgraph.NodeFactory,jsts.operation.relate.RelateNodeFactory.prototype.createNode=function(t){return new jsts.operation.relate.RelateNode(t,new jsts.operation.relate.EdgeEndBundleStar)},jsts.index.quadtree.Key=function(t){this.pt=new jsts.geom.Coordinate,this.level=0,this.env=null,this.computeKey(t)},jsts.index.quadtree.Key.computeQuadLevel=function(t){var e,n,o,r;return e=t.getWidth(),n=t.getHeight(),o=e>n?e:n,r=jsts.index.DoubleBits.exponent(o)+1},jsts.index.quadtree.Key.prototype.getPoint=function(){return this.pt},jsts.index.quadtree.Key.prototype.getLevel=function(){return this.level},jsts.index.quadtree.Key.prototype.getEnvelope=function(){return this.env},jsts.index.quadtree.Key.prototype.getCentre=function(){var t,e;return t=(this.env.getMinX()+this.env.getMaxX())/2,e=(this.env.getMinY()+this.env.getMaxY())/2,new jsts.geom.Coordinate(t,e)},jsts.index.quadtree.Key.prototype.computeKey=function(){arguments[0]instanceof jsts.geom.Envelope?this.computeKeyFromEnvelope(arguments[0]):this.computeKeyFromLevel(arguments[0],arguments[1])},jsts.index.quadtree.Key.prototype.computeKeyFromEnvelope=function(t){for(this.level=jsts.index.quadtree.Key.computeQuadLevel(t),this.env=new jsts.geom.Envelope,this.computeKey(this.level,t);!this.env.contains(t);)this.level+=1,this.computeKey(this.level,t)},jsts.index.quadtree.Key.prototype.computeKeyFromLevel=function(t,e){var n=jsts.index.DoubleBits.powerOf2(t);this.pt.x=Math.floor(e.getMinX()/n)*n,this.pt.y=Math.floor(e.getMinY()/n)*n,this.env.init(this.pt.x,this.pt.x+n,this.pt.y,this.pt.y+n)},jsts.geom.CoordinateArrays=function(){throw new jsts.error.AbstractMethodInvocationError},jsts.geom.CoordinateArrays.copyDeep=function(){return 1===arguments.length?jsts.geom.CoordinateArrays.copyDeep1(arguments[0]):void(5===arguments.length&&jsts.geom.CoordinateArrays.copyDeep2(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]))},jsts.geom.CoordinateArrays.copyDeep1=function(t){for(var e=[],n=0;ni;i++)n[o+i]=new jsts.geom.Coordinate(t[e+i])},jsts.geom.CoordinateArrays.removeRepeatedPoints=function(t){var e;return this.hasRepeatedPoints(t)?(e=new jsts.geom.CoordinateList(t,!1),e.toCoordinateArray()):t},jsts.geom.CoordinateArrays.hasRepeatedPoints=function(t){var e;for(e=1;e0)&&(e=t[n]);return e},jsts.geom.CoordinateArrays.scroll=function(t,e){var n=jsts.geom.CoordinateArrays.indexOf(e,t);if(!(0>n)){var o=t.slice(n).concat(t.slice(0,n));for(n=0;no;o++)e=t[o],n[o]=new jsts.triangulate.quadedge.Vertex(e);return n},jsts.triangulate.DelaunayTriangulationBuilder.envelope=function(t){var e=new jsts.geom.Envelope,n=0,o=t.length;for(n;o>n;n++)e.expandToInclude(t[n]);return e},jsts.triangulate.DelaunayTriangulationBuilder.prototype.setSites=function(){var t=arguments[0];t instanceof jsts.geom.Geometry||t instanceof jsts.geom.Coordinate||t instanceof jsts.geom.Point||t instanceof jsts.geom.MultiPoint||t instanceof jsts.geom.LineString||t instanceof jsts.geom.MultiLineString||t instanceof jsts.geom.LinearRing||t instanceof jsts.geom.Polygon||t instanceof jsts.geom.MultiPolygon?this.setSitesFromGeometry(t):this.setSitesFromCollection(t)},jsts.triangulate.DelaunayTriangulationBuilder.prototype.setSitesFromGeometry=function(t){this.siteCoords=jsts.triangulate.DelaunayTriangulationBuilder.extractUniqueCoordinates(t)},jsts.triangulate.DelaunayTriangulationBuilder.prototype.setSitesFromCollection=function(t){this.siteCoords=jsts.triangulate.DelaunayTriangulationBuilder.unique(t)},jsts.triangulate.DelaunayTriangulationBuilder.prototype.setTolerance=function(t){this.tolerance=t},jsts.triangulate.DelaunayTriangulationBuilder.prototype.create=function(){if(null===this.subdiv){var t,e,n;t=jsts.triangulate.DelaunayTriangulationBuilder.envelope(this.siteCoords),e=jsts.triangulate.DelaunayTriangulationBuilder.toVertices(this.siteCoords),this.subdiv=new jsts.triangulate.quadedge.QuadEdgeSubdivision(t,this.tolerance),n=new jsts.triangulate.IncrementalDelaunayTriangulator(this.subdiv),n.insertSites(e)}},jsts.triangulate.DelaunayTriangulationBuilder.prototype.getSubdivision=function(){return this.create(),this.subdiv},jsts.triangulate.DelaunayTriangulationBuilder.prototype.getEdges=function(t){return this.create(),this.subdiv.getEdges(t)},jsts.triangulate.DelaunayTriangulationBuilder.prototype.getTriangles=function(t){return this.create(),this.subdiv.getTriangles(t)},jsts.algorithm.RayCrossingCounter=function(t){this.p=t},jsts.algorithm.RayCrossingCounter.locatePointInRing=function(t,e){for(var n=new jsts.algorithm.RayCrossingCounter(t),o=1;oo&&(n=e.x,o=t.x),void(this.p.x>=n&&this.p.x<=o&&(this.isPointOnSegment=!0))}if(t.y>this.p.y&&e.y<=this.p.y||e.y>this.p.y&&t.y<=this.p.y){var r=t.x-this.p.x,i=t.y-this.p.y,s=e.x-this.p.x,a=e.y-this.p.y,u=jsts.algorithm.RobustDeterminant.signOfDet2x2(r,i,s,a);if(0===u)return void(this.isPointOnSegment=!0);i>a&&(u=-u),u>0&&this.crossingCount++}}},jsts.algorithm.RayCrossingCounter.prototype.isOnSegment=function(){return jsts.geom.isPointOnSegment},jsts.algorithm.RayCrossingCounter.prototype.getLocation=function(){return this.isPointOnSegment?jsts.geom.Location.BOUNDARY:this.crossingCount%2===1?jsts.geom.Location.INTERIOR:jsts.geom.Location.EXTERIOR},jsts.algorithm.RayCrossingCounter.prototype.isPointInPolygon=function(){return this.getLocation()!==jsts.geom.Location.EXTERIOR},jsts.operation.BoundaryOp=function(t,e){this.geom=t,this.geomFact=t.getFactory(),this.bnRule=e||jsts.algorithm.BoundaryNodeRule.MOD2_BOUNDARY_RULE},jsts.operation.BoundaryOp.prototype.geom=null,jsts.operation.BoundaryOp.prototype.geomFact=null,jsts.operation.BoundaryOp.prototype.bnRule=null,jsts.operation.BoundaryOp.prototype.getBoundary=function(){return this.geom instanceof jsts.geom.LineString?this.boundaryLineString(this.geom):this.geom instanceof jsts.geom.MultiLineString?this.boundaryMultiLineString(this.geom):this.geom.getBoundary()},jsts.operation.BoundaryOp.prototype.getEmptyMultiPoint=function(){return this.geomFact.createMultiPoint(null)},jsts.operation.BoundaryOp.prototype.boundaryMultiLineString=function(t){if(this.geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1==e.length?this.geomFact.createPoint(e[0]):this.geomFact.createMultiPoint(e)},jsts.operation.BoundaryOp.prototype.endpoints=null,jsts.operation.BoundaryOp.prototype.computeBoundaryCoordinates=function(t){var e,n,o,r=[];for(this.endpoints=[],e=0;e0&&this.isErodedCompletely(s,-this.distance)||this.addPolygonRing(a,e,jsts.geomgraph.Position.opposite(n),jsts.geom.Location.INTERIOR,jsts.geom.Location.EXTERIOR)}}},jsts.operation.buffer.OffsetCurveSetBuilder.prototype.addPolygonRing=function(t,e,n,o,r){if(!(0==e&&t.length=jsts.geom.LinearRing.MINIMUM_VALID_SIZE&&jsts.algorithm.CGAlgorithms.isCCW(t)&&(i=r,s=o,n=jsts.geomgraph.Position.opposite(n));var a=this.curveBuilder.getRingCurve(t,n,e);this.addCurve(a,i,s)}},jsts.operation.buffer.OffsetCurveSetBuilder.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return 0>e;if(4==n.length)return this.isTriangleErodedCompletely(n,e);var o=t.getEnvelopeInternal(),r=Math.min(o.getHeight(),o.getWidth());return 0>e&&2*Math.abs(e)>r?!0:!1},jsts.operation.buffer.OffsetCurveSetBuilder.prototype.isTriangleErodedCompletely=function(t,e){var n=new jsts.geom.Triangle(t[0],t[1],t[2]),o=n.inCentre(),r=jsts.algorithm.CGAlgorithms.distancePointLine(o,n.p0,n.p1);return r=1&&e.getDepth(jsts.geomgraph.Position.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},jsts.operation.buffer.BufferSubgraph.prototype.compareTo=function(t){var e=t;return this.rightMostCoord.xe.rightMostCoord.x?1:0},jsts.simplify.DPTransformer=function(t,e){this.distanceTolerance=t,this.isEnsureValidTopology=e},jsts.simplify.DPTransformer.prototype=new jsts.geom.util.GeometryTransformer,jsts.simplify.DPTransformer.prototype.distanceTolerance=null,jsts.simplify.DPTransformer.prototype.isEnsureValidTopology=null,jsts.simplify.DPTransformer.prototype.transformCoordinates=function(t){var e=t,n=null;return n=0==e.length?[]:jsts.simplify.DouglasPeuckerLineSimplifier.simplify(e,this.distanceTolerance)},jsts.simplify.DPTransformer.prototype.transformPolygon=function(t,e){if(t.isEmpty())return null;var n=jsts.geom.util.GeometryTransformer.prototype.transformPolygon.apply(this,arguments);return e instanceof jsts.geom.MultiPolygon?n:this.createValidArea(n)},jsts.simplify.DPTransformer.prototype.transformLinearRing=function(t,e){var n=e instanceof jsts.geom.Polygon,o=jsts.geom.util.GeometryTransformer.prototype.transformLinearRing.apply(this,arguments);return!n||o instanceof jsts.geom.LinearRing?o:null},jsts.simplify.DPTransformer.prototype.transformMultiPolygon=function(){var t=jsts.geom.util.GeometryTransformer.prototype.transformMultiPolygon.apply(this,arguments);return this.createValidArea(t)},jsts.simplify.DPTransformer.prototype.createValidArea=function(t){return this.isEnsureValidTopology?t.buffer(0):t},jsts.geom.util.GeometryExtracter=function(t,e){this.clz=t,this.comps=e},jsts.geom.util.GeometryExtracter.prototype=new jsts.geom.GeometryFilter,jsts.geom.util.GeometryExtracter.prototype.clz=null,jsts.geom.util.GeometryExtracter.prototype.comps=null,jsts.geom.util.GeometryExtracter.extract=function(t,e,n){return n=n||new javascript.util.ArrayList,t instanceof e?n.add(t):(t instanceof jsts.geom.GeometryCollection||t instanceof jsts.geom.MultiPoint||t instanceof jsts.geom.MultiLineString||t instanceof jsts.geom.MultiPolygon)&&t.apply(new jsts.geom.util.GeometryExtracter(e,n)),n},jsts.geom.util.GeometryExtracter.prototype.filter=function(t){(null===this.clz||t instanceof this.clz)&&this.comps.add(t)},function(){var t=jsts.operation.overlay.OverlayOp,e=jsts.operation.overlay.snap.SnapOverlayOp,n=function(t,e){this.geom=[],this.geom[0]=t,this.geom[1]=e};n.overlayOp=function(t,e,o){var r=new n(t,e);return r.getResultGeometry(o)},n.intersection=function(e,n){return overlayOp(e,n,t.INTERSECTION)},n.union=function(e,n){return overlayOp(e,n,t.UNION)},n.difference=function(e,n){return overlayOp(e,n,t.DIFFERENCE)},n.symDifference=function(e,n){return overlayOp(e,n,t.SYMDIFFERENCE)},n.prototype.geom=null,n.prototype.getResultGeometry=function(n){var o=null,r=!1,i=null;try{o=t.overlayOp(this.geom[0],this.geom[1],n);var s=!0;s&&(r=!0)}catch(a){i=a}if(!r)try{o=e.overlayOp(this.geom[0],this.geom[1],n)}catch(a){throw i}return o},jsts.operation.overlay.snap.SnapIfNeededOverlayOp=n}(),function(){var t=jsts.geom.util.GeometryExtracter,e=jsts.operation.union.CascadedPolygonUnion,n=jsts.operation.union.PointGeometryUnion,o=jsts.operation.overlay.OverlayOp,r=jsts.operation.overlay.snap.SnapIfNeededOverlayOp,i=javascript.util.ArrayList;jsts.operation.union.UnaryUnionOp=function(t,e){this.polygons=new i,this.lines=new i,this.points=new i,e&&(this.geomFact=e),this.extract(t)},jsts.operation.union.UnaryUnionOp.union=function(t,e){var n=new jsts.operation.union.UnaryUnionOp(t,e);return n.union()},jsts.operation.union.UnaryUnionOp.prototype.polygons=null,jsts.operation.union.UnaryUnionOp.prototype.lines=null,jsts.operation.union.UnaryUnionOp.prototype.points=null,jsts.operation.union.UnaryUnionOp.prototype.geomFact=null,jsts.operation.union.UnaryUnionOp.prototype.extract=function(e){if(e instanceof i)for(var n=e.iterator();n.hasNext();){var o=n.next();this.extract(o)}else null===this.geomFact&&(this.geomFact=e.getFactory()),t.extract(e,jsts.geom.Polygon,this.polygons),t.extract(e,jsts.geom.LineString,this.lines),t.extract(e,jsts.geom.Point,this.points)},jsts.operation.union.UnaryUnionOp.prototype.union=function(){if(null===this.geomFact)return null;var t=null;if(this.points.size()>0){var o=this.geomFact.buildGeometry(this.points);t=this.unionNoOpt(o)}var r=null;if(this.lines.size()>0){var i=this.geomFact.buildGeometry(this.lines);r=this.unionNoOpt(i)}var s=null;this.polygons.size()>0&&(s=e.union(this.polygons));var a=this.unionWithNull(r,s),u=null;return u=null===t?a:null===a?t:n(t,a),null===u?this.geomFact.createGeometryCollection(null):u},jsts.operation.union.UnaryUnionOp.prototype.unionWithNull=function(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)},jsts.operation.union.UnaryUnionOp.prototype.unionNoOpt=function(t){var e=this.geomFact.createPoint(null);return r.overlayOp(t,e,o.UNION)}}(),jsts.index.kdtree.KdNode=function(){this.left=null,this.right=null,this.count=1,2===arguments.length?this.initializeFromCoordinate.apply(this,arguments[0],arguments[1]):3===arguments.length&&this.initializeFromXY.apply(this,arguments[0],arguments[1],arguments[2])},jsts.index.kdtree.KdNode.prototype.initializeFromXY=function(t,e,n){this.p=new jsts.geom.Coordinate(t,e),this.data=n},jsts.index.kdtree.KdNode.prototype.initializeFromCoordinate=function(t,e){this.p=t,this.data=e},jsts.index.kdtree.KdNode.prototype.getX=function(){return this.p.x},jsts.index.kdtree.KdNode.prototype.getY=function(){return this.p.y},jsts.index.kdtree.KdNode.prototype.getCoordinate=function(){return this.p},jsts.index.kdtree.KdNode.prototype.getData=function(){return this.data},jsts.index.kdtree.KdNode.prototype.getLeft=function(){return this.left},jsts.index.kdtree.KdNode.prototype.getRight=function(){return this.right},jsts.index.kdtree.KdNode.prototype.increment=function(){this.count+=1},jsts.index.kdtree.KdNode.prototype.getCount=function(){return this.count},jsts.index.kdtree.KdNode.prototype.isRepeated=function(){return count>1},jsts.index.kdtree.KdNode.prototype.setLeft=function(t){this.left=t},jsts.index.kdtree.KdNode.prototype.setRight=function(t){this.right=t},jsts.algorithm.InteriorPointPoint=function(t){this.minDistance=Number.MAX_VALUE,this.interiorPoint=null,this.centroid=t.getCentroid().getCoordinate(),this.add(t)},jsts.algorithm.InteriorPointPoint.prototype.add=function(t){if(t instanceof jsts.geom.Point)this.addPoint(t.getCoordinate());else if(t instanceof jsts.geom.GeometryCollection)for(var e=0;e0&&(this.minExtent=e)},jsts.index.bintree.Bintree=n}(),jsts.algorithm.InteriorPointArea=function(t){this.factory,this.interiorPoint=null,this.maxWidth=0,this.factory=t.getFactory(),this.add(t)},jsts.algorithm.InteriorPointArea.avg=function(t,e){return(t+e)/2},jsts.algorithm.InteriorPointArea.prototype.getInteriorPoint=function(){return this.interiorPoint},jsts.algorithm.InteriorPointArea.prototype.add=function(t){if(t instanceof jsts.geom.Polygon)this.addPolygon(t);else if(t instanceof jsts.geom.GeometryCollection)for(var e=0;ethis.maxWidth)&&(this.interiorPoint=e,this.maxWidth=n)}},jsts.algorithm.InteriorPointArea.prototype.widestGeometry=function(t){if(t instanceof jsts.geom.GeometryCollection){var e=t;if(e.isEmpty())return e;for(var n=e.getGeometryN(0),o=1;on.getEnvelopeInternal().getWidth()&&(n=e.getGeometryN(o));return n}return t instanceof jsts.geom.Geometry?t:void 0},jsts.algorithm.InteriorPointArea.prototype.horizontalBisector=function(t){var e=t.getEnvelopeInternal(),n=jsts.algorithm.SafeBisectorFinder.getBisectorY(t);return this.factory.createLineString([new jsts.geom.Coordinate(e.getMinX(),n),new jsts.geom.Coordinate(e.getMaxX(),n)])},jsts.algorithm.InteriorPointArea.prototype.centre=function(t){return new jsts.geom.Coordinate(jsts.algorithm.InteriorPointArea.avg(t.getMinX(),t.getMaxX()),jsts.algorithm.InteriorPointArea.avg(t.getMinY(),t.getMaxY()))},jsts.algorithm.SafeBisectorFinder=function(t){this.poly,this.centreY,this.hiY=Number.MAX_VALUE,this.loY=-Number.MAX_VALUE,this.poly=t,this.hiY=t.getEnvelopeInternal().getMaxY(),this.loY=t.getEnvelopeInternal().getMinY(),this.centreY=jsts.algorithm.InteriorPointArea.avg(this.loY,this.hiY)},jsts.algorithm.SafeBisectorFinder.getBisectorY=function(t){var e=new jsts.algorithm.SafeBisectorFinder(t);return e.getBisectorY()},jsts.algorithm.SafeBisectorFinder.prototype.getBisectorY=function(){this.process(this.poly.getExteriorRing());for(var t=0;tthis.loY&&(this.loY=t):t>this.centreY&&t=t&&(this.quadrantSegments=1),this.joinStyle!==jsts.operation.buffer.BufferParameters.JOIN_ROUND&&(this.quadrantSegments=jsts.operation.buffer.BufferParameters.DEFAULT_QUADRANT_SEGMENTS)},jsts.operation.buffer.BufferParameters.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},jsts.operation.buffer.BufferParameters.prototype.getEndCapStyle=function(){return this.endCapStyle},jsts.operation.buffer.BufferParameters.prototype.setEndCapStyle=function(t){this.endCapStyle=t},jsts.operation.buffer.BufferParameters.prototype.getJoinStyle=function(){return this.joinStyle},jsts.operation.buffer.BufferParameters.prototype.setJoinStyle=function(t){this.joinStyle=t},jsts.operation.buffer.BufferParameters.prototype.getMitreLimit=function(){return this.mitreLimit},jsts.operation.buffer.BufferParameters.prototype.setMitreLimit=function(t){this.mitreLimit=t},jsts.operation.buffer.BufferParameters.prototype.setSingleSided=function(t){this._isSingleSided=t},jsts.operation.buffer.BufferParameters.prototype.isSingleSided=function(){return this._isSingleSided},function(){jsts.geom.util.ShortCircuitedGeometryVisitor=function(){},jsts.geom.util.ShortCircuitedGeometryVisitor.prototype.isDone=!1,jsts.geom.util.ShortCircuitedGeometryVisitor.prototype.applyTo=function(t){for(var e=0;e=rectEnv.getMinX()&&e.getMaxX()<=rectEnv.getMaxX()?void(this.intersects=!0):e.getMinY()>=rectEnv.getMinY()&&e.getMaxY()<=rectEnv.getMaxY()?void(this.intersects=!0):void 0},t.prototype.isDone=function(){return 1==this.intersects};var e=function(t){this.rectSeq=t.getExteriorRing().getCoordinateSequence(),this.rectEnv=t.getEnvelopeInternal()};e.prototype=new jsts.geom.util.ShortCircuitedGeometryVisitor,e.constructor=e,e.prototype.rectSeq=null,e.prototype.rectEnv=null,e.prototype.containsPoint=!1,e.prototype.containsPoint=function(){return this.containsPoint},e.prototype.visit=function(t){if(t instanceof jsts.geom.Polygon){var e=t.getEnvelopeInternal();if(this.rectEnv.intersects(e))for(var n=new jsts.geom.Coordinate,o=0;4>o;o++)if(this.rectSeq.getCoordinate(o,n),e.contains(n)&&SimplePointInAreaLocator.containsPointInPolygon(n,t))return void(this.containsPoint=!0)}},e.prototype.isDone=function(){return 1==this.containsPoint};var n=function(t){this.rectEnv=t.getEnvelopeInternal(),this.rectIntersector=new RectangleLineIntersector(rectEnv)};n.prototype=new jsts.geom.util.ShortCircuitedGeometryVisitor,n.constructor=n,n.prototype.rectEnv=null,n.prototype.rectIntersector=null,n.prototype.hasIntersection=!1,n.prototype.p0=null,n.prototype.p1=null,n.prototype.intersects=function(){return this.hasIntersection},n.prototype.visit=function(t){var e=t.getEnvelopeInternal();if(this.rectEnv.intersects(e)){var n=LinearComponentExtracter.getLines(t);this.checkIntersectionWithLineStrings(n)}},n.prototype.checkIntersectionWithLineStrings=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();if(this.checkIntersectionWithSegments(n),this.hasIntersection)return}},n.prototype.checkIntersectionWithSegments=function(t){for(var e=t.getCoordinateSequence(),n=1;nt?-1:t>e?1:0},jsts.noding.SegmentPointComparator.compareValue=function(t,e){return 0>t?-1:t>0?1:0>e?-1:e>0?1:0},jsts.operation.relate.RelateOp=function(){jsts.operation.GeometryGraphOperation.apply(this,arguments),this._relate=new jsts.operation.relate.RelateComputer(this.arg)},jsts.operation.relate.RelateOp.prototype=new jsts.operation.GeometryGraphOperation,jsts.operation.relate.RelateOp.relate=function(t,e,n){var o=new jsts.operation.relate.RelateOp(t,e,n),r=o.getIntersectionMatrix();return r},jsts.operation.relate.RelateOp.prototype._relate=null,jsts.operation.relate.RelateOp.prototype.getIntersectionMatrix=function(){return this._relate.computeIM()},jsts.index.chain.MonotoneChain=function(t,e,n,o){this.pts=t,this.start=e,this.end=n,this.context=o},jsts.index.chain.MonotoneChain.prototype.pts=null,jsts.index.chain.MonotoneChain.prototype.start=null,jsts.index.chain.MonotoneChain.prototype.end=null,jsts.index.chain.MonotoneChain.prototype.env=null,jsts.index.chain.MonotoneChain.prototype.context=null,jsts.index.chain.MonotoneChain.prototype.id=null,jsts.index.chain.MonotoneChain.prototype.setId=function(t){this.id=t},jsts.index.chain.MonotoneChain.prototype.getId=function(){return this.id},jsts.index.chain.MonotoneChain.prototype.getContext=function(){return this.context},jsts.index.chain.MonotoneChain.prototype.getEnvelope=function(){if(null==this.env){var t=this.pts[this.start],e=this.pts[this.end];this.env=new jsts.geom.Envelope(t,e)}return this.env},jsts.index.chain.MonotoneChain.prototype.getStartIndex=function(){return this.start},jsts.index.chain.MonotoneChain.prototype.getEndIndex=function(){return this.end},jsts.index.chain.MonotoneChain.prototype.getLineSegment=function(t,e){e.p0=this.pts[t],e.p1=this.pts[t+1]},jsts.index.chain.MonotoneChain.prototype.getCoordinates=function(){for(var t=[],e=0,n=this.start;n<=this.end;n++)t[e++]=this.pts[n];return t},jsts.index.chain.MonotoneChain.prototype.select=function(t,e){this.computeSelect2(t,this.start,this.end,e)},jsts.index.chain.MonotoneChain.prototype.computeSelect2=function(t,e,n,o){var r=this.pts[e],i=this.pts[n];if(o.tempEnv1.init(r,i),n-e===1)return void o.select(this,e);if(t.intersects(o.tempEnv1)){var s=parseInt((e+n)/2);s>e&&this.computeSelect2(t,e,s,o),n>s&&this.computeSelect2(t,s,n,o)}},jsts.index.chain.MonotoneChain.prototype.computeOverlaps=function(t,e){return 6===arguments.length?this.computeOverlaps2.apply(this,arguments):void this.computeOverlaps2(this.start,this.end,t,t.start,t.end,e)},jsts.index.chain.MonotoneChain.prototype.computeOverlaps2=function(t,e,n,o,r,i){var s=this.pts[t],a=this.pts[e],u=n.pts[o],p=n.pts[r];if(e-t===1&&r-o===1)return void i.overlap(this,t,n,o);if(i.tempEnv1.init(s,a),i.tempEnv2.init(u,p),i.tempEnv1.intersects(i.tempEnv2)){var g=parseInt((t+e)/2),l=parseInt((o+r)/2);g>t&&(l>o&&this.computeOverlaps2(t,g,n,o,l,i),r>l&&this.computeOverlaps2(t,g,n,l,r,i)),e>g&&(l>o&&this.computeOverlaps2(g,e,n,o,l,i),r>l&&this.computeOverlaps2(g,e,n,l,r,i))}},function(){var t=jsts.geom.Location,e=jsts.geom.Dimension;jsts.geom.IntersectionMatrix=function(n){var o=n;void 0===n||null===n?(this.matrix=[[],[],[]],this.setAll(e.FALSE)):"string"==typeof n?this.set(n):o instanceof jsts.geom.IntersectionMatrix&&(this.matrix[t.INTERIOR][t.INTERIOR]=o.matrix[t.INTERIOR][t.INTERIOR],this.matrix[t.INTERIOR][t.BOUNDARY]=o.matrix[t.INTERIOR][t.BOUNDARY],this.matrix[t.INTERIOR][t.EXTERIOR]=o.matrix[t.INTERIOR][t.EXTERIOR],this.matrix[t.BOUNDARY][t.INTERIOR]=o.matrix[t.BOUNDARY][t.INTERIOR],this.matrix[t.BOUNDARY][t.BOUNDARY]=o.matrix[t.BOUNDARY][t.BOUNDARY],this.matrix[t.BOUNDARY][t.EXTERIOR]=o.matrix[t.BOUNDARY][t.EXTERIOR],this.matrix[t.EXTERIOR][t.INTERIOR]=o.matrix[t.EXTERIOR][t.INTERIOR],this.matrix[t.EXTERIOR][t.BOUNDARY]=o.matrix[t.EXTERIOR][t.BOUNDARY],this.matrix[t.EXTERIOR][t.EXTERIOR]=o.matrix[t.EXTERIOR][t.EXTERIOR])},jsts.geom.IntersectionMatrix.prototype.matrix=null,jsts.geom.IntersectionMatrix.prototype.add=function(t){var e,n;for(e=0;3>e;e++)for(n=0;3>n;n++)this.setAtLeast(e,n,t.get(e,n))},jsts.geom.IntersectionMatrix.matches=function(t,n){return"string"==typeof t?jsts.geom.IntersectionMatrix.matches2.call(this,arguments):"*"===n?!0:"T"===n&&(t>=0||t===e.TRUE)?!0:"F"===n&&t===e.FALSE?!0:"0"===n&&t===e.P?!0:"1"===n&&t===e.L?!0:"2"===n&&t===e.A?!0:!1},jsts.geom.IntersectionMatrix.matches2=function(t,e){var n=new jsts.geom.IntersectionMatrix(t);return n.matches(e)},jsts.geom.IntersectionMatrix.prototype.set=function(t,e,n){return"string"==typeof t?void this.set2(t):void(this.matrix[t][e]=n)},jsts.geom.IntersectionMatrix.prototype.set2=function(t){for(var n=0;n=0&&e>=0&&this.setAtLeast(t,e,n)},jsts.geom.IntersectionMatrix.prototype.setAtLeast2=function(t){var e;for(e=0;ee;e++)for(n=0;3>n;n++)this.matrix[e][n]=t},jsts.geom.IntersectionMatrix.prototype.get=function(t,e){return this.matrix[t][e]},jsts.geom.IntersectionMatrix.prototype.isDisjoint=function(){return this.matrix[t.INTERIOR][t.INTERIOR]===e.FALSE&&this.matrix[t.INTERIOR][t.BOUNDARY]===e.FALSE&&this.matrix[t.BOUNDARY][t.INTERIOR]===e.FALSE&&this.matrix[t.BOUNDARY][t.BOUNDARY]===e.FALSE},jsts.geom.IntersectionMatrix.prototype.isIntersects=function(){return!this.isDisjoint()},jsts.geom.IntersectionMatrix.prototype.isTouches=function(n,o){return n>o?this.isTouches(o,n):n==e.A&&o==e.A||n==e.L&&o==e.L||n==e.L&&o==e.A||n==e.P&&o==e.A||n==e.P&&o==e.L?this.matrix[t.INTERIOR][t.INTERIOR]===e.FALSE&&(jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.BOUNDARY],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.BOUNDARY][t.INTERIOR],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.BOUNDARY][t.BOUNDARY],"T")):!1},jsts.geom.IntersectionMatrix.prototype.isCrosses=function(n,o){return n==e.P&&o==e.L||n==e.P&&o==e.A||n==e.L&&o==e.A?jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")&&jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.EXTERIOR],"T"):n==e.L&&o==e.P||n==e.A&&o==e.P||n==e.A&&o==e.L?jsts.geom.IntersectionMatrix.matches(matrix[t.INTERIOR][t.INTERIOR],"T")&&jsts.geom.IntersectionMatrix.matches(this.matrix[t.EXTERIOR][t.INTERIOR],"T"):n===e.L&&o===e.L?0===this.matrix[t.INTERIOR][t.INTERIOR]:!1},jsts.geom.IntersectionMatrix.prototype.isWithin=function(){return jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")&&this.matrix[t.INTERIOR][t.EXTERIOR]==e.FALSE&&this.matrix[t.BOUNDARY][t.EXTERIOR]==e.FALSE},jsts.geom.IntersectionMatrix.prototype.isContains=function(){return jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")&&this.matrix[t.EXTERIOR][t.INTERIOR]==e.FALSE&&this.matrix[t.EXTERIOR][t.BOUNDARY]==e.FALSE},jsts.geom.IntersectionMatrix.prototype.isCovers=function(){var n=jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.BOUNDARY],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.BOUNDARY][t.INTERIOR],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.BOUNDARY][t.BOUNDARY],"T");return n&&this.matrix[t.EXTERIOR][t.INTERIOR]==e.FALSE&&this.matrix[t.EXTERIOR][t.BOUNDARY]==e.FALSE},jsts.geom.IntersectionMatrix.prototype.isCoveredBy=function(){var n=jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.BOUNDARY],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.BOUNDARY][t.INTERIOR],"T")||jsts.geom.IntersectionMatrix.matches(this.matrix[t.BOUNDARY][t.BOUNDARY],"T");return n&&this.matrix[t.INTERIOR][t.EXTERIOR]===e.FALSE&&this.matrix[t.BOUNDARY][t.EXTERIOR]===e.FALSE},jsts.geom.IntersectionMatrix.prototype.isEquals=function(n,o){return n!==o?!1:jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")&&this.matrix[t.EXTERIOR][t.INTERIOR]===e.FALSE&&this.matrix[t.INTERIOR][t.EXTERIOR]===e.FALSE&&this.matrix[t.EXTERIOR][t.BOUNDARY]===e.FALSE&&this.matrix[t.BOUNDARY][t.EXTERIOR]===e.FALSE},jsts.geom.IntersectionMatrix.prototype.isOverlaps=function(n,o){return n==e.P&&o===e.P||n==e.A&&o===e.A?jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.INTERIOR],"T")&&jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.EXTERIOR],"T")&&jsts.geom.IntersectionMatrix.matches(this.matrix[t.EXTERIOR][t.INTERIOR],"T"):n===e.L&&o===e.L?1==this.matrix[t.INTERIOR][t.INTERIOR]&&jsts.geom.IntersectionMatrix.matches(this.matrix[t.INTERIOR][t.EXTERIOR],"T")&&jsts.geom.IntersectionMatrix.matches(this.matrix[t.EXTERIOR][t.INTERIOR],"T"):!1},jsts.geom.IntersectionMatrix.prototype.matches=function(t){if(9!=t.length)throw new jsts.error.IllegalArgumentException("Should be length 9: "+t);for(var e=0;3>e;e++)for(var n=0;3>n;n++)if(!jsts.geom.IntersectionMatrix.matches(this.matrix[e][n],t.charAt(3*e+n)))return!1;return!0},jsts.geom.IntersectionMatrix.prototype.transpose=function(){var t=matrix[1][0];return this.matrix[1][0]=this.matrix[0][1],this.matrix[0][1]=t,t=this.matrix[2][0],this.matrix[2][0]=this.matrix[0][2],this.matrix[0][2]=t,t=this.matrix[2][1],this.matrix[2][1]=this.matrix[1][2],this.matrix[1][2]=t,this},jsts.geom.IntersectionMatrix.prototype.toString=function(){var t,n,o="";for(t=0;3>t;t++)for(n=0;3>n;n++)o+=e.toDimensionSymbol(this.matrix[t][n]);return o}}(),jsts.triangulate.quadedge.LastFoundQuadEdgeLocator=function(t){this.subdiv=t,this.lastEdge=null,this.init()},jsts.triangulate.quadedge.LastFoundQuadEdgeLocator.prototype.init=function(){this.lastEdge=this.findEdge()},jsts.triangulate.quadedge.LastFoundQuadEdgeLocator.prototype.findEdge=function(){var t=this.subdiv.getEdges();return t[0]},jsts.triangulate.quadedge.LastFoundQuadEdgeLocator.prototype.locate=function(t){this.lastEdge.isLive()||this.init();var e=this.subdiv.locateFromEdge(t,this.lastEdge);return this.lastEdge=e,e},jsts.noding.SegmentNodeList=function(t){this.nodeMap=new javascript.util.TreeMap,this.edge=t},jsts.noding.SegmentNodeList.prototype.nodeMap=null,jsts.noding.SegmentNodeList.prototype.iterator=function(){return this.nodeMap.values().iterator()},jsts.noding.SegmentNodeList.prototype.edge=null,jsts.noding.SegmentNodeList.prototype.getEdge=function(){return this.edge},jsts.noding.SegmentNodeList.prototype.add=function(t,e){var n=new jsts.noding.SegmentNode(this.edge,t,e,this.edge.getSegmentOctant(e)),o=this.nodeMap.get(n);return null!==o?(jsts.util.Assert.isTrue(o.coord.equals2D(t),"Found equal nodes with different coordinates"),o):(this.nodeMap.put(n,n),n)},jsts.noding.SegmentNodeList.prototype.addEndpoints=function(){var t=this.edge.size()-1;this.add(this.edge.getCoordinate(0),0),this.add(this.edge.getCoordinate(t),t)},jsts.noding.SegmentNodeList.prototype.addCollapsedNodes=function(){var t=[];this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=0;ee;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;n>e;e++)this.reducePrecision(t.geometries[e])},jsts.triangulate.quadedge.QuadEdgeSubdivision=function(t,e){this.tolerance=e,this.edgeCoincidenceTolerance=e/jsts.triangulate.quadedge.QuadEdgeSubdivision.EDGE_COINCIDENCE_TOL_FACTOR,this.visitedKey=0,this.quadEdges=[],this.startingEdge,this.tolerance,this.edgeCoincidenceTolerance,this.frameEnv,this.locator=null,this.seg=new jsts.geom.LineSegment,this.triEdges=new Array(3),this.frameVertex=new Array(3),this.createFrame(t),this.startingEdge=this.initSubdiv(),this.locator=new jsts.triangulate.quadedge.LastFoundQuadEdgeLocator(this)},jsts.triangulate.quadedge.QuadEdgeSubdivision.EDGE_COINCIDENCE_TOL_FACTOR=1e3,jsts.triangulate.quadedge.QuadEdgeSubdivision.getTriangleEdges=function(t,e){if(e[0]=t,e[1]=e[0].lNext(),e[2]=e[1].lNext(),e[2].lNext()!=e[0])throw new jsts.IllegalArgumentError("Edges do not form a triangle")},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.createFrame=function(t){var e,n,o;e=t.getWidth(),n=t.getHeight(),o=0,o=e>n?10*e:10*n,this.frameVertex[0]=new jsts.triangulate.quadedge.Vertex((t.getMaxX()+t.getMinX())/2,t.getMaxY()+o),this.frameVertex[1]=new jsts.triangulate.quadedge.Vertex(t.getMinX()-o,t.getMinY()-o),this.frameVertex[2]=new jsts.triangulate.quadedge.Vertex(t.getMaxX()+o,t.getMinY()-o),this.frameEnv=new jsts.geom.Envelope(this.frameVertex[0].getCoordinate(),this.frameVertex[1].getCoordinate()),this.frameEnv.expandToInclude(this.frameVertex[2].getCoordinate())},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.initSubdiv=function(){var t,e,n;return t=this.makeEdge(this.frameVertex[0],this.frameVertex[1]),e=this.makeEdge(this.frameVertex[1],this.frameVertex[2]),jsts.triangulate.quadedge.QuadEdge.splice(t.sym(),e),n=this.makeEdge(this.frameVertex[2],this.frameVertex[0]),jsts.triangulate.quadedge.QuadEdge.splice(e.sym(),n),jsts.triangulate.quadedge.QuadEdge.splice(n.sym(),t),t},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getTolerance=function(){return this.tolerance},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getEnvelope=function(){return new jsts.geom.Envelope(this.frameEnv)},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getEdges=function(){return arguments.length>0?this.getEdgesByFactory(arguments[0]):this.quadEdges},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.setLocator=function(t){this.locator=t},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.makeEdge=function(t,e){var n=jsts.triangulate.quadedge.QuadEdge.makeEdge(t,e);return this.quadEdges.push(n),n},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.connect=function(t,e){var n=jsts.triangulate.quadedge.QuadEdge.connect(t,e);return this.quadEdges.push(n),n},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.delete_jsts=function(t){jsts.triangulate.quadedge.QuadEdge.splice(t,t.oPrev()),jsts.triangulate.quadedge.QuadEdge.splice(t.sym(),t.sym().oPrev());var e,n,o;t.eSym=t.sym(),n=t.rot,o=t.rot.sym();var r=this.quadEdges.indexOf(t);-1!==r&&this.quadEdges.splice(r,1),r=this.quadEdges.indexOf(e),-1!==r&&this.quadEdges.splice(r,1),r=this.quadEdges.indexOf(n),-1!==r&&this.quadEdges.splice(r,1),r=this.quadEdges.indexOf(o),-1!==r&&this.quadEdges.splice(r,1),t.delete_jsts(),e.delete_jsts(),n.delete_jsts(),o.delete_jsts()},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.locateFromEdge=function(t,e){var n,o=0,r=this.quadEdges.length;for(n=e;;){if(o++,o>r)throw new jsts.error.LocateFailureError(n.toLineSegment());if(t.equals(n.orig())||t.equals(n.dest()))break;if(t.rightOf(n))n=n.sym();else if(t.rightOf(n.oNext())){if(t.rightOf(n.dPrev()))break;n=n.dPrev()}else n=n.oNext()}return n},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.locate=function(){return 1===arguments.length?arguments[0]instanceof jsts.triangulate.quadedge.Vertex?this.locateByVertex(arguments[0]):this.locateByCoordinate(arguments[0]):this.locateByCoordinates(arguments[0],arguments[1])},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.locateByVertex=function(t){return this.locator.locate(t)},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.locateByCoordinate=function(t){return this.locator.locate(new jsts.triangulate.quadedge.Vertex(t))},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.locateByCoordinates=function(t,e){var n,o,r,n=this.locator.locate(new jsts.triangulate.quadedge.Vertex(t));if(null===n)return null;o=n,n.dest().getCoordinate().equals2D(t)&&(o=n.sym()),r=o;do{if(r.dest().getCoordinate().equals2D(e))return r;r=r.oNext()}while(r!=o);return null},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.insertSite=function(t){var e,n,o;if(e=this.locate(t),t.equals(e.orig(),this.tolerance)||t.equals(e.dest(),this.tolerance))return e;n=this.makeEdge(e.orig(),t),jsts.triangulate.quadedge.QuadEdge.splice(n,e),o=n;do n=this.connect(e,n.sym()),e=n.oPrev();while(e.lNext()!=o);return o},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.isFrameEdge=function(t){return this.isFrameVertex(t.orig())||this.isFrameVertex(t.dest())?!0:!1},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.isFrameBorderEdge=function(t){var e,n,o,r;return e=new Array(3),this.getTriangleEdges(t,e),n=new Array(3),this.getTriangleEdges(t.sym(),n),o=t.lNext().dest(),this.isFrameVertex(o)?!0:(r=t.sym().lNext().dest(),this.isFrameVertex(r)?!0:!1)},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.isFrameVertex=function(t){return t.equals(this.frameVertex[0])?!0:t.equals(this.frameVertex[1])?!0:t.equals(this.frameVertex[2])?!0:!1},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.isOnEdge=function(t,e){this.seg.setCoordinates(t.orig().getCoordinate(),t.dest().getCoordinate());var n=this.seg.distance(e);return ne;e++)o=this.quadEdges[e],r=o.orig(),(t||!this.isFrameVertex(r))&&s.push(r),i=o.dest(),(t||!this.isFrameVertex(i))&&s.push(i);return s},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getVertexUniqueEdges=function(t){var e,n,o,r,i,s,a,u;for(e=[],n=[],o=0,r=this.quadEdges.length,o;r>o;o++)i=this.quadEdges[o],s=i.orig(),-1===n.indexOf(s)&&(n.push(s),(t||!this.isFrameVertex(s))&&e.push(i)),a=i.sym(),u=a.orig(),-1===n.indexOf(u)&&(n.push(u),(t||!this.isFrameVertex(u))&&e.push(a));return e},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getPrimaryEdges=function(t){this.visitedKey++;var e,n,o,r,i;for(e=[],n=[],n.push(this.startingEdge),o=[];n.length>0;)r=n.pop(),-1===o.indexOf(r)&&(i=r.getPrimary(),(t||!this.isFrameEdge(i))&&e.push(i),n.push(r.oNext()),n.push(r.sym().oNext()),o.push(r),o.push(r.sym()));return e},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.visitTriangles=function(t,e){this.visitedKey++;var n,o,r,i;for(n=[],n.push(this.startingEdge),o=[];n.length>0;)r=n.pop(),-1===o.indexOf(r)&&(i=this.fetchTriangleToVisit(r,n,e,o),null!==i&&t.visit(i))},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.fetchTriangleToVisit=function(t,e,n,o){var r,i,s,a;r=t,i=0,s=!1;do this.triEdges[i]=r,this.isFrameEdge(r)&&(s=!0),a=r.sym(),-1===o.indexOf(a)&&e.push(a),o.push(r),i++,r=r.lNext();while(r!==t);return s&&!n?null:this.triEdges},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getTriangleEdges=function(t){var e=new jsts.triangulate.quadedge.TriangleEdgesListVisitor;return this.visitTriangles(e,t),e.getTriangleEdges()},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getTriangleVertices=function(t){var e=new TriangleVertexListVisitor;return this.visitTriangles(e,t),e.getTriangleVertices()},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getTriangleCoordinates=function(t){var e=new jsts.triangulate.quadedge.TriangleCoordinatesVisitor;return this.visitTriangles(e,t),e.getTriangles()},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getEdgesByFactory=function(t){var e,n,o,r,i,s;for(e=this.getPrimaryEdges(!1),n=[],o=0,r=e.length,o;r>o;o++)i=e[o],s=[],s[0]=i.orig().getCoordinate(),s[1]=i.dest().getCoordinate(),n[o]=t.createLineString(s);return t.createMultiLineString(n)},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getTriangles=function(t){var e,n,o,r,i;for(e=this.getTriangleCoordinates(!1),n=new Array(e.length),r=0,i=e.length,r;i>r;r++)o=e[r],n[r]=t.createPolygon(t.createLinearRing(o,null));return t.createGeometryCollection(n)},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getVoronoiDiagram=function(t){var e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection(e)},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getVoronoiCellPolygons=function(t){this.visitTriangles(new jsts.triangulate.quadedge.TriangleCircumcentreVisitor,!0);var e,n,o,r,i;for(e=[],n=this.getVertexUniqueEdges(!1),o=0,r=n.length,o;r>o;o++)i=n[o],e.push(this.getVoronoiCellPolygon(i,t));return e},jsts.triangulate.quadedge.QuadEdgeSubdivision.prototype.getVoronoiCellPolygon=function(t,e){var n,o,r,i,s;n=[],startQE=t;do o=t.rot.orig().getCoordinate(),n.push(o),t=t.oPrev();while(t!==startQE);return r=new jsts.geom.CoordinateList([],!1),r.add(n,!1),r.closeRing(),r.size()<4&&r.add(r.get(r.size()-1),!0),i=e.createPolygon(e.createLinearRing(r.toArray()),null),s=startQE.orig(),i},jsts.triangulate.quadedge.TriangleCircumcentreVisitor=function(){},jsts.triangulate.quadedge.TriangleCircumcentreVisitor.prototype.visit=function(t){var e,n,o,r,i,s;for(e=t[0].orig().getCoordinate(),n=t[1].orig().getCoordinate(),o=t[2].orig().getCoordinate(),r=jsts.geom.Triangle.circumcentre(e,n,o),i=new jsts.triangulate.quadedge.Vertex(r),s=0;3>s;s++)t[s].rot.setOrig(i)},jsts.triangulate.quadedge.TriangleEdgesListVisitor=function(){this.triList=[]},jsts.triangulate.quadedge.TriangleEdgesListVisitor.prototype.visit=function(t){var e=t.concat();this.triList.push(e)},jsts.triangulate.quadedge.TriangleEdgesListVisitor.prototype.getTriangleEdges=function(){return this.triList},jsts.triangulate.quadedge.TriangleVertexListVisitor=function(){this.triList=[]},jsts.triangulate.quadedge.TriangleVertexListVisitor.prototype.visit=function(){var t=[];t.push(trieEdges[0].orig()),t.push(trieEdges[1].orig()),t.push(trieEdges[2].orig()),this.triList.push(t)},jsts.triangulate.quadedge.TriangleVertexListVisitor.prototype.getTriangleVertices=function(){return this.triList},jsts.triangulate.quadedge.TriangleCoordinatesVisitor=function(){this.coordList=new jsts.geom.CoordinateList([],!1),this.triCoords=[]},jsts.triangulate.quadedge.TriangleCoordinatesVisitor.prototype.visit=function(t){this.coordList=new jsts.geom.CoordinateList([],!1);var e,n,o=0;for(o;3>o;o++)e=t[o].orig(),this.coordList.add(e.getCoordinate());if(this.coordList.size()>0){if(this.coordList.closeRing(),n=this.coordList.toArray(),4!==n.length)return;this.triCoords.push(n)}},jsts.triangulate.quadedge.TriangleCoordinatesVisitor.prototype.getTriangles=function(){return this.triCoords},jsts.operation.relate.EdgeEndBundle=function(){this.edgeEnds=[];var t=arguments[0]instanceof jsts.geomgraph.EdgeEnd?arguments[0]:arguments[1],e=t.getEdge(),n=t.getCoordinate(),o=t.getDirectedCoordinate(),r=new jsts.geomgraph.Label(t.getLabel());jsts.geomgraph.EdgeEnd.call(this,e,n,o,r),this.insert(t)},jsts.operation.relate.EdgeEndBundle.prototype=new jsts.geomgraph.EdgeEnd,jsts.operation.relate.EdgeEndBundle.prototype.edgeEnds=null,jsts.operation.relate.EdgeEndBundle.prototype.getLabel=function(){return this.label},jsts.operation.relate.EdgeEndBundle.prototype.getEdgeEnds=function(){return this.edgeEnds},jsts.operation.relate.EdgeEndBundle.prototype.insert=function(t){this.edgeEnds.push(t)},jsts.operation.relate.EdgeEndBundle.prototype.computeLabel=function(t){for(var e=!1,n=0;nn;n++)this.computeLabelOn(n,t),e&&this.computeLabelSides(n)},jsts.operation.relate.EdgeEndBundle.prototype.computeLabelOn=function(t,e){for(var n=0,o=!1,r=0;r0&&(s=jsts.geomgraph.GeometryGraph.determineBoundary(e,n)),this.label.setLocation(t,s)},jsts.operation.relate.EdgeEndBundle.prototype.computeLabelSides=function(t){this.computeLabelSide(t,jsts.geomgraph.Position.LEFT),this.computeLabelSide(t,jsts.geomgraph.Position.RIGHT) +},jsts.operation.relate.EdgeEndBundle.prototype.computeLabelSide=function(t,e){for(var n=0;ni,p=s>=a;u&&this.queryNode(t.getLeft(),e,n,!o,r),n.contains(t.getCoordinate())&&r.add(t),p&&this.queryNode(t.getRight(),e,n,!o,r)}},jsts.index.kdtree.KdTree.prototype.query=function(){return 1===arguments.length?this.queryByEnvelope.apply(this,arguments[0]):this.queryWithArray.apply(this,arguments[0],arguments[1])},jsts.index.kdtree.KdTree.prototype.queryByEnvelope=function(t){var e=[];return this.queryNode(this.root,this.last,t,!0,e),e},jsts.index.kdtree.KdTree.prototype.queryWithArray=function(t,e){this.queryNode(this.root,this.last,t,!0,e)},jsts.geom.Triangle=function(t,e,n){this.p0=t,this.p1=e,this.p2=n},jsts.geom.Triangle.isAcute=function(t,e,n){return jsts.algorithm.Angle.isAcute(t,e,n)&&jsts.algorithm.Angle.isAcute(e,n,t)&&jsts.algorithm.Angle.isAcute(n,t,e)?!0:!1},jsts.geom.Triangle.perpendicularBisector=function(t,e){var n,o,r,i;return n=e.x-t.x,o=e.y-t.y,r=new jsts.algorithm.HCoordinate(t.x+n/2,t.y+o/2,1),i=new jsts.algorithm.HCoordinate(t.x-o+n/2,t.y+n+o/2,1),new jsts.algorithm.HCoordinate(r,i)},jsts.geom.Triangle.circumcentre=function(t,e,n){var o,r,i,s,a,u,p,g,l,h,d;return o=n.x,r=n.y,i=t.x-o,s=t.y-r,a=e.x-o,u=e.y-r,p=2*jsts.geom.Triangle.det(i,s,a,u),g=jsts.geom.Triangle.det(s,i*i+s*s,u,a*a+u*u),l=jsts.geom.Triangle.det(i,i*i+s*s,a,a*a+u*u),h=o-g/p,d=r+l/p,new jsts.geom.Coordinate(h,d)},jsts.geom.Triangle.det=function(t,e,n,o){return t*o-e*n},jsts.geom.Triangle.inCentre=function(t,e,n){var o,r,i,s,a,u;return o=e.distance(n),r=t.distance(n),i=t.distance(e),s=o+r+i,a=(o*t.x+r*e.x+i*n.x)/s,u=(o*t.y+r*e.y+i*n.y)/s,new jsts.geom.Coordinate(a,u)},jsts.geom.Triangle.centroid=function(t,e,n){var o,r;return o=(t.x+e.x+n.x)/3,r=(t.y+e.y+n.y)/3,new jsts.geom.Coordinate(o,r)},jsts.geom.Triangle.longestSideLength=function(t,e,n){var o,r,i,s;return o=t.distance(e),r=e.distance(n),i=n.distance(t),s=o,r>s&&(s=r),i>s&&(s=i),s},jsts.geom.Triangle.angleBisector=function(t,e,n){var o,r,i,s,a,u;return o=e.distance(t),r=e.distance(n),i=o/(o+r),s=n.x-t.x,a=n.y-t.y,u=new jsts.geom.Coordinate(t.x+i*s,t.y+i*a)},jsts.geom.Triangle.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},jsts.geom.Triangle.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},jsts.geom.Triangle.prototype.inCentre=function(){return jsts.geom.Triangle.inCentre(this.p0,this.p1,this.p2)},jsts.noding.OrientedCoordinateArray=function(t){this.pts=t,this._orientation=jsts.noding.OrientedCoordinateArray.orientation(t)},jsts.noding.OrientedCoordinateArray.prototype.pts=null,jsts.noding.OrientedCoordinateArray.prototype._orientation=void 0,jsts.noding.OrientedCoordinateArray.orientation=function(t){return 1===jsts.geom.CoordinateArrays.increasingDirection(t)},jsts.noding.OrientedCoordinateArray.prototype.compareTo=function(t){var e=t,n=jsts.noding.OrientedCoordinateArray.compareOriented(this.pts,this._orientation,e.pts,e._orientation);return n},jsts.noding.OrientedCoordinateArray.compareOriented=function(t,e,n,o){for(var r=e?1:-1,i=o?1:-1,s=e?t.length:-1,a=o?n.length:-1,u=e?0:t.length-1,p=o?0:n.length-1;;){var g=t[u].compareTo(n[p]);if(0!==g)return g;u+=r,p+=i;var l=u===s,h=p===a;if(l&&!h)return-1;if(!l&&h)return 1;if(l&&h)return 0}},jsts.algorithm.CentralEndpointIntersector=function(t,e,n,o){this.pts=[t,e,n,o],this.compute()},jsts.algorithm.CentralEndpointIntersector.getIntersection=function(t,e,n,o){var r=new jsts.algorithm.CentralEndpointIntersector(t,e,n,o);return r.getIntersection()},jsts.algorithm.CentralEndpointIntersector.prototype.pts=null,jsts.algorithm.CentralEndpointIntersector.prototype.intPt=null,jsts.algorithm.CentralEndpointIntersector.prototype.compute=function(){var t=jsts.algorithm.CentralEndpointIntersector.average(this.pts);this.intPt=this.findNearestPoint(t,this.pts)},jsts.algorithm.CentralEndpointIntersector.prototype.getIntersection=function(){return this.intPt},jsts.algorithm.CentralEndpointIntersector.average=function(t){var e,n=new jsts.geom.Coordinate,o=t.length;for(e=0;o>e;e++)n.x+=t[e].x,n.y+=t[e].y;return o>0&&(n.x/=o,n.y/=o),n},jsts.algorithm.CentralEndpointIntersector.prototype.findNearestPoint=function(t,e){var n,o,r=Number.MAX_VALUE,i=null;for(n=0;no&&(r=o,i=e[n]);return i},jsts.operation.buffer.BufferOp=function(t,e){this.argGeom=t,this.bufParams=e?e:new jsts.operation.buffer.BufferParameters},jsts.operation.buffer.BufferOp.MAX_PRECISION_DIGITS=12,jsts.operation.buffer.BufferOp.precisionScaleFactor=function(t,e,n){var o=t.getEnvelopeInternal(),r=Math.max(o.getHeight(),o.getWidth()),i=e>0?e:0,s=r+2*i,a=Math.log(s)/Math.log(10)+1,u=a-n,p=Math.pow(10,-u);return p},jsts.operation.buffer.BufferOp.bufferOp=function(t,e){if(arguments.length>2)return jsts.operation.buffer.BufferOp.bufferOp2.apply(this,arguments);var n=new jsts.operation.buffer.BufferOp(t),o=n.getResultGeometry(e);return o},jsts.operation.buffer.BufferOp.bufferOp2=function(t,e,n){if(arguments.length>3)return jsts.operation.buffer.BufferOp.bufferOp3.apply(this,arguments);var o=new jsts.operation.buffer.BufferOp(t,n),r=o.getResultGeometry(e);return r},jsts.operation.buffer.BufferOp.bufferOp3=function(t,e,n){if(arguments.length>4)return jsts.operation.buffer.BufferOp.bufferOp4.apply(this,arguments);var o=new jsts.operation.buffer.BufferOp(t);o.setQuadrantSegments(n);var r=o.getResultGeometry(e);return r},jsts.operation.buffer.BufferOp.bufferOp4=function(t,e,n,o){var r=new jsts.operation.buffer.BufferOp(t);r.setQuadrantSegments(n),r.setEndCapStyle(o);var i=r.getResultGeometry(e);return i},jsts.operation.buffer.BufferOp.prototype.argGeom=null,jsts.operation.buffer.BufferOp.prototype.distance=null,jsts.operation.buffer.BufferOp.prototype.bufParams=null,jsts.operation.buffer.BufferOp.prototype.resultGeometry=null,jsts.operation.buffer.BufferOp.prototype.setEndCapStyle=function(t){this.bufParams.setEndCapStyle(t)},jsts.operation.buffer.BufferOp.prototype.setQuadrantSegments=function(t){this.bufParams.setQuadrantSegments(t)},jsts.operation.buffer.BufferOp.prototype.getResultGeometry=function(t){return this.distance=t,this.computeGeometry(),this.resultGeometry},jsts.operation.buffer.BufferOp.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null===this.resultGeometry){var t=this.argGeom.getPrecisionModel();t.getType()===jsts.geom.PrecisionModel.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},jsts.operation.buffer.BufferOp.prototype.bufferReducedPrecision=function(){var t,e=null;for(t=jsts.operation.buffer.BufferOp.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision2(t)}catch(n){e=n}if(null!==this.resultGeometry)return}throw e},jsts.operation.buffer.BufferOp.prototype.bufferOriginalPrecision=function(){try{var t=new jsts.operation.buffer.BufferBuilder(this.bufParams);this.resultGeometry=t.buffer(this.argGeom,this.distance)}catch(e){}},jsts.operation.buffer.BufferOp.prototype.bufferReducedPrecision2=function(t){var e=jsts.operation.buffer.BufferOp.precisionScaleFactor(this.argGeom,this.distance,t),n=new jsts.geom.PrecisionModel(e);this.bufferFixedPrecision(n)},jsts.operation.buffer.BufferOp.prototype.bufferFixedPrecision=function(t){var e=new jsts.noding.ScaledNoder(new jsts.noding.snapround.MCIndexSnapRounder(new jsts.geom.PrecisionModel(1)),t.getScale()),n=new jsts.operation.buffer.BufferBuilder(this.bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this.resultGeometry=n.buffer(this.argGeom,this.distance)},function(){var t=jsts.geom.Location,e=jsts.geomgraph.Position,n=jsts.util.Assert;jsts.geomgraph.GeometryGraph=function(t,e,n){jsts.geomgraph.PlanarGraph.call(this),this.lineEdgeMap=new javascript.util.HashMap,this.ptLocator=new jsts.algorithm.PointLocator,this.argIndex=t,this.parentGeom=e,this.boundaryNodeRule=n||jsts.algorithm.BoundaryNodeRule.OGC_SFS_BOUNDARY_RULE,null!==e&&this.add(e)},jsts.geomgraph.GeometryGraph.prototype=new jsts.geomgraph.PlanarGraph,jsts.geomgraph.GeometryGraph.constructor=jsts.geomgraph.GeometryGraph,jsts.geomgraph.GeometryGraph.prototype.createEdgeSetIntersector=function(){return new jsts.geomgraph.index.SimpleMCSweepLineIntersector},jsts.geomgraph.GeometryGraph.determineBoundary=function(e,n){return e.isInBoundary(n)?t.BOUNDARY:t.INTERIOR},jsts.geomgraph.GeometryGraph.prototype.parentGeom=null,jsts.geomgraph.GeometryGraph.prototype.lineEdgeMap=null,jsts.geomgraph.GeometryGraph.prototype.boundaryNodeRule=null,jsts.geomgraph.GeometryGraph.prototype.useBoundaryDeterminationRule=!0,jsts.geomgraph.GeometryGraph.prototype.argIndex=null,jsts.geomgraph.GeometryGraph.prototype.boundaryNodes=null,jsts.geomgraph.GeometryGraph.prototype.hasTooFewPoints=!1,jsts.geomgraph.GeometryGraph.prototype.invalidPoint=null,jsts.geomgraph.GeometryGraph.prototype.areaPtLocator=null,jsts.geomgraph.GeometryGraph.prototype.ptLocator=null,jsts.geomgraph.GeometryGraph.prototype.getGeometry=function(){return this.parentGeom},jsts.geomgraph.GeometryGraph.prototype.getBoundaryNodes=function(){return null===this.boundaryNodes&&(this.boundaryNodes=this.nodes.getBoundaryNodes(this.argIndex)),this.boundaryNodes},jsts.geomgraph.GeometryGraph.prototype.getBoundaryNodeRule=function(){return this.boundaryNodeRule},jsts.geomgraph.GeometryGraph.prototype.findEdge=function(t){return this.lineEdgeMap.get(t)},jsts.geomgraph.GeometryGraph.prototype.computeSplitEdges=function(t){for(var e=this.edges.iterator();e.hasNext();){var n=e.next();n.eiList.addSplitEdges(t)}},jsts.geomgraph.GeometryGraph.prototype.add=function(t){if(!t.isEmpty())if(t instanceof jsts.geom.MultiPolygon&&(this.useBoundaryDeterminationRule=!1),t instanceof jsts.geom.Polygon)this.addPolygon(t);else if(t instanceof jsts.geom.LineString)this.addLineString(t);else if(t instanceof jsts.geom.Point)this.addPoint(t);else if(t instanceof jsts.geom.MultiPoint)this.addCollection(t);else if(t instanceof jsts.geom.MultiLineString)this.addCollection(t);else if(t instanceof jsts.geom.MultiPolygon)this.addCollection(t);else{if(!(t instanceof jsts.geom.GeometryCollection))throw new jsts.error.IllegalArgumentError("Geometry type not supported.");this.addCollection(t)}},jsts.geomgraph.GeometryGraph.prototype.addCollection=function(t){for(var e=0;e=2,"found LineString with single point"),this.insertBoundaryPoint(this.argIndex,o[0]),this.insertBoundaryPoint(this.argIndex,o[o.length-1])},jsts.geomgraph.GeometryGraph.prototype.addPolygonRing=function(e,n,o){if(!e.isEmpty()){var r=jsts.geom.CoordinateArrays.removeRepeatedPoints(e.getCoordinates());if(r.length<4)return this.hasTooFewPoints=!0,void(this.invalidPoint=r[0]);var i=n,s=o;jsts.algorithm.CGAlgorithms.isCCW(r)&&(i=o,s=n);var a=new jsts.geomgraph.Edge(r,new jsts.geomgraph.Label(this.argIndex,t.BOUNDARY,i,s));this.lineEdgeMap.put(e,a),this.insertEdge(a),this.insertPoint(this.argIndex,r[0],t.BOUNDARY)}},jsts.geomgraph.GeometryGraph.prototype.addPolygon=function(e){this.addPolygonRing(e.getExteriorRing(),t.EXTERIOR,t.INTERIOR);for(var n=0;n=0;n--)this.addPt(t[n])},jsts.operation.buffer.OffsetSegmentString.prototype.isRedundant=function(t){if(this.ptList.length<1)return!1;var e=this.ptList[this.ptList.length-1],n=t.distance(e);return n=2&&(n=this.ptList[this.ptList.length-2]),t.equals(e)||this.ptList.push(t)}},jsts.operation.buffer.OffsetSegmentString.prototype.reverse=function(){},jsts.operation.buffer.OffsetSegmentString.prototype.getCoordinates=function(){return this.ptList},jsts.algorithm.distance.PointPairDistance=function(){this.pt=[new jsts.geom.Coordinate,new jsts.geom.Coordinate]},jsts.algorithm.distance.PointPairDistance.prototype.pt=null,jsts.algorithm.distance.PointPairDistance.prototype.distance=0/0,jsts.algorithm.distance.PointPairDistance.prototype.isNull=!0,jsts.algorithm.distance.PointPairDistance.prototype.initialize=function(t,e,n){return void 0===t?void(this.isNull=!0):(this.pt[0].setCoordinate(t),this.pt[1].setCoordinate(e),this.distance=void 0!==n?n:t.distance(e),void(this.isNull=!1))},jsts.algorithm.distance.PointPairDistance.prototype.getDistance=function(){return this.distance},jsts.algorithm.distance.PointPairDistance.prototype.getCoordinates=function(){return this.pt},jsts.algorithm.distance.PointPairDistance.prototype.getCoordinate=function(t){return this.pt[t]},jsts.algorithm.distance.PointPairDistance.prototype.setMaximum=function(t){return 2===arguments.length?void this.setMaximum2.apply(this,arguments):void this.setMaximum(t.pt[0],t.pt[1])},jsts.algorithm.distance.PointPairDistance.prototype.setMaximum2=function(t,e){if(this.isNull)return void this.initialize(t,e);var n=t.distance(e);n>this.distance&&this.initialize(t,e,n)},jsts.algorithm.distance.PointPairDistance.prototype.setMinimum=function(t){return 2===arguments.length?void this.setMinimum2.apply(this,arguments):void this.setMinimum(t.pt[0],t.pt[1])},jsts.algorithm.distance.PointPairDistance.prototype.setMinimum2=function(t,e){if(this.isNull)return void this.initialize(t,e);var n=t.distance(e);n1||0>=t)throw new jsts.error.IllegalArgumentError("Fraction is not in range (0.0 - 1.0]");this.densifyFrac=t},jsts.algorithm.distance.DiscreteHausdorffDistance.prototype.distance=function(){return this.compute(this.g0,this.g1),ptDist.getDistance()},jsts.algorithm.distance.DiscreteHausdorffDistance.prototype.orientedDistance=function(){return this.computeOrientedDistance(this.g0,this.g1,this.ptDist),this.ptDist.getDistance()},jsts.algorithm.distance.DiscreteHausdorffDistance.prototype.getCoordinates=function(){return ptDist.getCoordinates()},jsts.algorithm.distance.DiscreteHausdorffDistance.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this.ptDist),this.computeOrientedDistance(e,t,this.ptDist)},jsts.algorithm.distance.DiscreteHausdorffDistance.prototype.computeOrientedDistance=function(t,e,r){var i=new n(e);if(t.apply(i),r.setMaximum(i.getMaxPointDistance()),this.densifyFrac>0){var s=new o(e,this.densifyFrac);t.apply(s),r.setMaximum(s.getMaxPointDistance())}}}(),jsts.algorithm.MinimumBoundingCircle=function(t){this.input=null,this.extremalPts=null,this.centre=null,this.radius=0,this.input=t},jsts.algorithm.MinimumBoundingCircle.prototype.getCircle=function(){if(this.compute(),null===this.centre)return this.input.getFactory().createPolygon(null,null);var t=this.input.getFactory().createPoint(this.centre);return 0===this.radius?t:t.buffer(this.radius)},jsts.algorithm.MinimumBoundingCircle.prototype.getExtremalPoints=function(){return this.compute(),this.extremalPts},jsts.algorithm.MinimumBoundingCircle.prototype.getCentre=function(){return this.compute(),this.centre},jsts.algorithm.MinimumBoundingCircle.prototype.getRadius=function(){return this.compute(),this.radius},jsts.algorithm.MinimumBoundingCircle.prototype.computeCentre=function(){switch(this.extremalPts.length){case 0:this.centre=null;break;case 1:this.centre=this.extremalPts[0];break;case 2:this.centre=new jsts.geom.Coordinate((this.extremalPts[0].x+this.extremalPts[1].x)/2,(this.extremalPts[0].y+this.extremalPts[1].y)/2);break;case 3:this.centre=jsts.geom.Triangle.circumcentre(this.extremalPts[0],this.extremalPts[1],this.extremalPts[2])}},jsts.algorithm.MinimumBoundingCircle.prototype.compute=function(){null===this.extremalPts&&(this.computeCirclePoints(),this.computeCentre(),null!==this.centre&&(this.radius=this.centre.distance(this.extremalPts[0])))},jsts.algorithm.MinimumBoundingCircle.prototype.computeCirclePoints=function(){if(this.input.isEmpty())return void(this.extremalPts=[]);var t;if(1===this.input.getNumPoints())return t=this.input.getCoordinates(),void(this.extremalPts=[new jsts.geom.Coordinate(t[0])]);var e=this.input.convexHull(),n=e.getCoordinates();if(t=n,n[0].equals2D(n[n.length-1])&&(t=[],jsts.geom.CoordinateArrays.copyDeep(n,0,t,0,n.length-1)),t.length<=2)return void(this.extremalPts=jsts.geom.CoordinateArrays.copyDeep(t));for(var o=jsts.algorithm.MinimumBoundingCircle.lowestPoint(t),r=jsts.algorithm.MinimumBoundingCircle.pointWitMinAngleWithX(t,o),i=0;ia&&(a=-a);var u=Math.sqrt(s*s+a*a),p=a/u;n>p&&(n=p,o=i)}}return o},jsts.algorithm.MinimumBoundingCircle.pointWithMinAngleWithSegment=function(t,e,n){for(var o=Number.MAX_VALUE,r=null,i=0;ia&&(o=a,r=s)}}return r},jsts.noding.ScaledNoder=function(t,e,n,o){this.offsetX=n?n:0,this.offsetY=o?o:0,this.noder=t,this.scaleFactor=e,this.isScaled=!this.isIntegerPrecision()},jsts.noding.ScaledNoder.prototype=new jsts.noding.Noder,jsts.noding.ScaledNoder.constructor=jsts.noding.ScaledNoder,jsts.noding.ScaledNoder.prototype.noder=null,jsts.noding.ScaledNoder.prototype.scaleFactor=void 0,jsts.noding.ScaledNoder.prototype.offsetX=void 0,jsts.noding.ScaledNoder.prototype.offsetY=void 0,jsts.noding.ScaledNoder.prototype.isScaled=!1,jsts.noding.ScaledNoder.prototype.isIntegerPrecision=function(){return 1===this.scaleFactor},jsts.noding.ScaledNoder.prototype.getNodedSubstrings=function(){var t=this.noder.getNodedSubstrings();return this.isScaled&&this.rescale(t),t},jsts.noding.ScaledNoder.prototype.computeNodes=function(t){var e=t;this.isScaled&&(e=this.scale(t)),this.noder.computeNodes(e)},jsts.noding.ScaledNoder.prototype.scale=function(t){if(t instanceof Array)return this.scale2(t);for(var e=new javascript.util.ArrayList,n=t.iterator();n.hasNext();){var o=n.next();e.add(new jsts.noding.NodedSegmentString(this.scale(o.getCoordinates()),o.getData()))}return e},jsts.noding.ScaledNoder.prototype.scale2=function(t){for(var e=[],n=0;nt||t>=this.size())throw new r;return this.a[t]},l.prototype.get=l.prototype.get,l.prototype.g=function(){return 0===this.a.length +},l.prototype.isEmpty=l.prototype.g,l.prototype.size=function(){return this.a.length},l.prototype.size=l.prototype.size,l.prototype.h=function(){for(var t=[],e=0,n=this.a.length;n>e;e++)t.push(this.a[e]);return t},l.prototype.toArray=l.prototype.h,l.prototype.remove=function(t){for(var e=!1,n=0,o=this.a.length;o>n;n++)if(this.a[n]===t){this.a.splice(n,1),e=!0;break}return e},l.prototype.remove=l.prototype.remove,e("$jscomp.scope.Iterator_",h),h.prototype.j=null,h.prototype.b=0,h.prototype.next=function(){if(this.b===this.j.size())throw new p;return this.j.get(this.b++)},h.prototype.next=h.prototype.next,h.prototype.c=function(){return this.bn;n++)e.add(t[n]);return e},n(c,u),e("javascript.util.HashMap",c),c.prototype.i=null,c.prototype.get=function(t){return this.i[t]||null},c.prototype.get=c.prototype.get,c.prototype.put=function(t,e){return this.i[t]=e},c.prototype.put=c.prototype.put,c.prototype.m=function(){var t,e=new l;for(t in this.i)this.i.hasOwnProperty(t)&&e.add(this.i[t]);return e},c.prototype.values=c.prototype.m,c.prototype.size=function(){return this.m().size()},c.prototype.size=c.prototype.size,n(f,s),e("javascript.util.Set",f),n(m,f),e("javascript.util.HashSet",m),m.prototype.a=null,m.prototype.contains=function(t){for(var e=0,n=this.a.length;n>e;e++)if(this.a[e]===t)return!0;return!1},m.prototype.contains=m.prototype.contains,m.prototype.add=function(t){return this.contains(t)?!1:(this.a.push(t),!0)},m.prototype.add=m.prototype.add,m.prototype.e=function(t){for(t=t.f();t.c();)this.add(t.next());return!0},m.prototype.addAll=m.prototype.e,m.prototype.remove=function(){throw new g},m.prototype.remove=m.prototype.remove,m.prototype.size=function(){return this.a.length},m.prototype.g=function(){return 0===this.a.length},m.prototype.isEmpty=m.prototype.g,m.prototype.h=function(){for(var t=[],e=0,n=this.a.length;n>e;e++)t.push(this.a[e]);return t},m.prototype.toArray=m.prototype.h,m.prototype.f=function(){return new y(this)},m.prototype.iterator=m.prototype.f,e("$jscomp.scope.Iterator_$1",y),y.prototype.k=null,y.prototype.b=0,y.prototype.next=function(){if(this.b===this.k.size())throw new p;return this.k.a[this.b++]},y.prototype.next=y.prototype.next,y.prototype.c=function(){return this.be;e++)t.push(this.a[e]);return t},E.prototype.toArray=E.prototype.h,n(C,j),e("javascript.util.TreeMap",C),C.prototype.get=function(t){for(var e=this.d;null!==e;){var n=t.compareTo(e.key);if(0>n)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},C.prototype.get=C.prototype.get,C.prototype.put=function(t,e){if(null===this.d)return this.d={key:t,value:e,left:null,right:null,parent:null,color:0},this.n=1,null;var n,o,r=this.d;do if(n=r,o=t.compareTo(r.key),0>o)r=r.left;else{if(!(o>0))return n=r.value,r.value=e,n;r=r.right}while(null!==r);for(r={key:t,left:null,right:null,value:e,parent:n,color:0},0>o?n.left=r:n.right=r,r.color=1;null!=r&&r!=this.d&&1==r.parent.color;)x(r)==S(x(x(r)))?(n=L(x(x(r))),1==(null==n?0:n.color)?(I(x(r),0),I(n,0),I(x(x(r)),1),r=x(x(r))):(r==L(x(r))&&(r=x(r),N(this,r)),I(x(r),0),I(x(x(r)),1),b(this,x(x(r))))):(n=S(x(x(r))),1==(null==n?0:n.color)?(I(x(r),0),I(n,0),I(x(x(r)),1),r=x(x(r))):(r==S(x(r))&&(r=x(r),b(this,r)),I(x(r),0),I(x(x(r)),1),N(this,x(x(r)))));return this.d.color=0,this.n++,null},C.prototype.put=C.prototype.put,C.prototype.m=function(){var t,e=new l;if(t=this.d,null!=t)for(;null!=t.left;)t=t.left;if(null!==t)for(e.add(t.value);null!==(t=P(t));)e.add(t.value);return e},C.prototype.values=C.prototype.m,C.prototype.size=function(){return this.n},C.prototype.size=C.prototype.size,n(R,v),e("javascript.util.TreeSet",R),R.prototype.a=null,R.prototype.contains=function(t){for(var e=0,n=this.a.length;n>e;e++)if(0===this.a[e].compareTo(t))return!0;return!1},R.prototype.contains=R.prototype.contains,R.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.a.length;n>e;e++)if(1===this.a[e].compareTo(t))return this.a.splice(e,0,t),!0;return this.a.push(t),!0},R.prototype.add=R.prototype.add,R.prototype.e=function(t){for(t=t.f();t.c();)this.add(t.next());return!0},R.prototype.addAll=R.prototype.e,R.prototype.remove=function(){throw new g},R.prototype.remove=R.prototype.remove,R.prototype.size=function(){return this.a.length},R.prototype.size=R.prototype.size,R.prototype.g=function(){return 0===this.a.length},R.prototype.isEmpty=R.prototype.g,R.prototype.h=function(){for(var t=[],e=0,n=this.a.length;n>e;e++)t.push(this.a[e]);return t},R.prototype.toArray=R.prototype.h,R.prototype.f=function(){return new w(this)},R.prototype.iterator=R.prototype.f,e("$jscomp.scope.Iterator_$2",w),w.prototype.l=null,w.prototype.b=0,w.prototype.next=function(){if(this.b===this.l.size())throw new p;return this.l.a[this.b++]},w.prototype.next=w.prototype.next,w.prototype.c=function(){return this.bo;o++)for(g=c?t.features[o].geometry:f?t.geometry:t,h="GeometryCollection"===g.type,u=h?g.geometries.length:1,s=0;u>s;s++)if(a=h?g.geometries[s]:g,p=a.coordinates,d=!n||"Polygon"!==a.type&&"MultiPolygon"!==a.type?0:1,"Point"===a.type)e(p);else if("LineString"===a.type||"MultiPoint"===a.type)for(r=0;r=a&&e>=u&&e>=p}if("number"!=typeof e)throw new Error("maxEdge parameter is required");if("string"!=typeof o)throw new Error("units parameter is required");var i=n.tin(t),s=i.features.filter(r);return i.features=s,n.merge(i)}},{"turf-distance":60,"turf-merge":93,"turf-point":102,"turf-tin":118}],26:[function(t,e){var n=t("turf-meta").coordEach,o=t("convex-hull"),r=t("turf-polygon");e.exports=function(t){var e=[];n(t,function(t){e.push(t)});for(var i=o(e),s=[],a=0;at[n][0]&&(n=o);return n>e?[[e],[n]]:e>n?[[n],[e]]:[[e]]}e.exports=n},{}],29:[function(t,e){"use strict";function n(t){var e=o(t),n=e.length;if(2>=n)return[];for(var r=new Array(n),i=e[n-1],s=0;n>s;++s){var a=e[s];r[s]=[i,a],i=a}return r}e.exports=n;var o=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":48}],30:[function(t,e){"use strict";function n(t,e){for(var n=t.length,o=new Array(n),r=0;rr;++r)e.indexOf(r)<0&&(o[i++]=t[r]);return o}function o(t,e){for(var n=t.length,o=e.length,r=0;n>r;++r)for(var i=t[r],s=0;sa)i[s]=e[a];else{a-=o;for(var u=0;o>u;++u)a>=e[u]&&(a+=1);i[s]=a}}return t}function r(t,e){try{return i(t,!0)}catch(r){var a=s(t);if(a.length<=e)return[];var u=n(t,a),p=i(u,!0);return o(p,a)}}e.exports=r;var i=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":31,"incremental-convex-hull":38}],31:[function(t,e){"use strict";function n(t,e){for(var n=new Array(e+1),o=0;o=i;++i){for(var s=new Array(e),a=0;e>a;++a)s[a]=Math.pow(i+1-o,a);n[i]=s}var u=r.apply(void 0,n);if(u)return!0}return!1}function o(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var o=t[0].length,r=[t[0]],i=[0],s=1;e>s;++s)if(r.push(t[s]),n(r,o)){if(i.push(s),i.length===o+1)return i}else r.pop();return i}e.exports=o;var r=t("robust-orientation")},{"robust-orientation":37}],32:[function(t,e){"use strict";function n(t,e,n){var o=t+e,r=o-t,i=o-r,s=e-r,a=t-i;return n?(n[0]=a+s,n[1]=o,n):[a+s,o]}e.exports=n},{}],33:[function(t,e){"use strict";function n(t,e){var n=t.length;if(1===n){var i=o(t[0],e);return i[0]?i:[i[1]]}var s=new Array(2*n),a=[.1,.1],u=[.1,.1],p=0;o(t[0],e,a),a[0]&&(s[p++]=a[0]);for(var g=1;n>g;++g){o(t[g],e,u);var l=a[1];r(l,u[0],a),a[0]&&(s[p++]=a[0]);var h=u[1],d=a[1],c=h+d,f=c-h,m=d-f;a[1]=c,m&&(s[p++]=m)}return a[1]&&(s[p++]=a[1]),0===p&&(s[p++]=0),s.length=p,s}var o=t("two-product"),r=t("two-sum");e.exports=n},{"two-product":36,"two-sum":32}],34:[function(t,e){"use strict";function n(t,e){var n=t+e,o=n-t,r=n-o,i=e-o,s=t-r,a=s+i;return a?[a,n]:[n]}function o(t,e){var o=0|t.length,r=0|e.length;if(1===o&&1===r)return n(t[0],-e[0]);var i,s,a=o+r,u=new Array(a),p=0,g=0,l=0,h=Math.abs,d=t[g],c=h(d),f=-e[l],m=h(f);m>c?(s=d,g+=1,o>g&&(d=t[g],c=h(d))):(s=f,l+=1,r>l&&(f=-e[l],m=h(f))),o>g&&m>c||l>=r?(i=d,g+=1,o>g&&(d=t[g],c=h(d))):(i=f,l+=1,r>l&&(f=-e[l],m=h(f)));for(var y,j,v,E,x,I=i+s,S=I-i,L=s-S,C=L,N=I;o>g&&r>l;)m>c?(i=d,g+=1,o>g&&(d=t[g],c=h(d))):(i=f,l+=1,r>l&&(f=-e[l],m=h(f))),s=C,I=i+s,S=I-i,L=s-S,L&&(u[p++]=L),y=N+I,j=y-N,v=y-j,E=I-j,x=N-v,C=x+E,N=y;for(;o>g;)i=d,s=C,I=i+s,S=I-i,L=s-S,L&&(u[p++]=L),y=N+I,j=y-N,v=y-j,E=I-j,x=N-v,C=x+E,N=y,g+=1,o>g&&(d=t[g]);for(;r>l;)i=f,s=C,I=i+s,S=I-i,L=s-S,L&&(u[p++]=L),y=N+I,j=y-N,v=y-j,E=I-j,x=N-v,C=x+E,N=y,l+=1,r>l&&(f=-e[l]);return C&&(u[p++]=C),N&&(u[p++]=N),p||(u[p++]=0),u.length=p,u}e.exports=o},{}],35:[function(t,e){"use strict";function n(t,e){var n=t+e,o=n-t,r=n-o,i=e-o,s=t-r,a=s+i;return a?[a,n]:[n]}function o(t,e){var o=0|t.length,r=0|e.length;if(1===o&&1===r)return n(t[0],e[0]);var i,s,a=o+r,u=new Array(a),p=0,g=0,l=0,h=Math.abs,d=t[g],c=h(d),f=e[l],m=h(f);m>c?(s=d,g+=1,o>g&&(d=t[g],c=h(d))):(s=f,l+=1,r>l&&(f=e[l],m=h(f))),o>g&&m>c||l>=r?(i=d,g+=1,o>g&&(d=t[g],c=h(d))):(i=f,l+=1,r>l&&(f=e[l],m=h(f)));for(var y,j,v,E,x,I=i+s,S=I-i,L=s-S,C=L,N=I;o>g&&r>l;)m>c?(i=d,g+=1,o>g&&(d=t[g],c=h(d))):(i=f,l+=1,r>l&&(f=e[l],m=h(f))),s=C,I=i+s,S=I-i,L=s-S,L&&(u[p++]=L),y=N+I,j=y-N,v=y-j,E=I-j,x=N-v,C=x+E,N=y;for(;o>g;)i=d,s=C,I=i+s,S=I-i,L=s-S,L&&(u[p++]=L),y=N+I,j=y-N,v=y-j,E=I-j,x=N-v,C=x+E,N=y,g+=1,o>g&&(d=t[g]);for(;r>l;)i=f,s=C,I=i+s,S=I-i,L=s-S,L&&(u[p++]=L),y=N+I,j=y-N,v=y-j,E=I-j,x=N-v,C=x+E,N=y,l+=1,r>l&&(f=e[l]);return C&&(u[p++]=C),N&&(u[p++]=N),p||(u[p++]=0),u.length=p,u}e.exports=o},{}],36:[function(t,e){"use strict";function n(t,e,n){var r=t*e,i=o*t,s=i-t,a=i-s,u=t-a,p=o*e,g=p-e,l=p-g,h=e-l,d=r-a*l,c=d-u*l,f=c-a*h,m=u*h-f;return n?(n[0]=m,n[1]=r,n):[m,r]}e.exports=n;var o=+(Math.pow(2,27)+1)},{}],37:[function(t,e){"use strict";function n(t,e){for(var n=new Array(t.length-1),o=1;on;++n){e[n]=new Array(t);for(var o=0;t>o;++o)e[n][o]=["m",o,"[",t-n-1,"]"].join("")}return e}function r(t){return 1&t?"-":""}function i(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",i(t.slice(0,e)),",",i(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],o=0;op;++p)0===(1&p)?e.push.apply(e,s(n(a,p))):r.push.apply(r,s(n(a,p))),u.push("m"+p);var c=i(e),f=i(r),m="orientation"+t+"Exact",y=["function ",m,"(",u.join(),"){var p=",c,",n=",f,",d=sub(p,n);return d[d.length-1];};return ",m].join(""),j=new Function("sum","prod","scale","sub",y);return j(l,g,h,d)}function u(t){var e=E[t.length];return e||(e=E[t.length]=a(t.length)),e.apply(void 0,t)}function p(){for(;E.length<=c;)E.push(a(E.length));for(var t=[],n=["slow"],o=0;c>=o;++o)t.push("a"+o),n.push("o"+o);for(var r=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],o=2;c>=o;++o)r.push("case ",o,":return o",o,"(",t.slice(0,o).join(),");");r.push("}var s=new Array(arguments.length);for(var i=0;i=o;++o)e.exports[o]=E[o]}var g=t("two-product"),l=t("robust-sum"),h=t("robust-scale"),d=t("robust-subtract"),c=5,f=1.1102230246251565e-16,m=(3+16*f)*f,y=(7+56*f)*f,j=a(3),v=a(4),E=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){var o,r=(t[1]-n[1])*(e[0]-n[0]),i=(t[0]-n[0])*(e[1]-n[1]),s=r-i;if(r>0){if(0>=i)return s;o=r+i}else{if(!(0>r))return s;if(i>=0)return s;o=-(r+i)}var a=m*o;return s>=a||-a>=s?s:j(t,e,n)},function(t,e,n,o){var r=t[0]-o[0],i=e[0]-o[0],s=n[0]-o[0],a=t[1]-o[1],u=e[1]-o[1],p=n[1]-o[1],g=t[2]-o[2],l=e[2]-o[2],h=n[2]-o[2],d=i*p,c=s*u,f=s*a,m=r*p,j=r*u,E=i*a,x=g*(d-c)+l*(f-m)+h*(j-E),I=(Math.abs(d)+Math.abs(c))*Math.abs(g)+(Math.abs(f)+Math.abs(m))*Math.abs(l)+(Math.abs(j)+Math.abs(E))*Math.abs(h),S=y*I;return x>S||-x>S?x:v(t,e,n,o)}];p()},{"robust-scale":33,"robust-subtract":34,"robust-sum":35,"two-product":36}],38:[function(t,e){"use strict";function n(t,e,n){this.vertices=t,this.adjacent=e,this.boundary=n,this.lastVisited=-1}function o(t,e,n){this.vertices=t,this.cell=e,this.index=n}function r(t,e){return p(t.vertices,e.vertices)}function i(t){for(var e=["function orient(){var tuple=this.tuple;return test("],n=0;t>=n;++n)n>0&&e.push(","),e.push("tuple[",n,"]");e.push(")}return orient");var o=new Function("test",e.join("")),r=u[t+1];return r||(r=u),o(r)}function s(t,e,n){this.dimension=t,this.vertices=e,this.simplices=n,this.interior=n.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var o=0;t>=o;++o)this.tuple[o]=this.vertices[o];var r=g[t];r||(r=g[t]=i(t)),this.orient=r}function a(t,e){var o=t.length;if(0===o)throw new Error("Must have at least d+1 points");var r=t[0].length;if(r>=o)throw new Error("Must input at least d+1 points");var i=t.slice(0,r+1),a=u.apply(void 0,i);if(0===a)throw new Error("Input not in general position");for(var p=new Array(r+1),g=0;r>=g;++g)p[g]=g;0>a&&(p[0]=1,p[1]=0);for(var l=new n(p,new Array(r+1),!1),h=l.adjacent,d=new Array(r+2),g=0;r>=g;++g){for(var c=p.slice(),f=0;r>=f;++f)f===g&&(c[f]=-1);var m=c[0];c[0]=c[1],c[1]=m;var y=new n(c,new Array(r+1),!0);h[g]=y,d[g]=y}d[r+1]=l;for(var g=0;r>=g;++g)for(var c=h[g].vertices,j=h[g].adjacent,f=0;r>=f;++f){var v=c[f];if(0>v)j[f]=l;else for(var E=0;r>=E;++E)h[E].vertices.indexOf(v)<0&&(j[f]=h[E])}for(var x=new s(r,i,d),I=!!e,g=r+1;o>g;++g)x.insert(t[g],I);return x.boundary()}e.exports=a;var u=t("robust-orientation"),p=t("simplicial-complex").compareCells;n.prototype.flip=function(){var t=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=t;var e=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=e};var g=[],l=s.prototype;l.handleBoundaryDegeneracy=function(t,e){var n=this.dimension,o=this.vertices.length-1,r=this.tuple,i=this.vertices,s=[t];for(t.lastVisited=-o;s.length>0;){t=s.pop();for(var a=(t.vertices,t.adjacent),u=0;n>=u;++u){var p=a[u];if(p.boundary&&!(p.lastVisited<=-o)){for(var g=p.vertices,l=0;n>=l;++l){var h=g[l];r[l]=0>h?e:i[h]}var d=this.orient();if(d>0)return p;p.lastVisited=-o,0===d&&s.push(p)}}}return null},l.walk=function(t,e){var n=this.vertices.length-1,o=this.dimension,r=this.vertices,i=this.tuple,s=e?this.interior.length*Math.random()|0:this.interior.length-1,a=this.interior[s];t:for(;!a.boundary;){for(var u=a.vertices,p=a.adjacent,g=0;o>=g;++g)i[g]=r[u[g]];a.lastVisited=n;for(var g=0;o>=g;++g){var l=p[g];if(!(l.lastVisited>=n)){var h=i[g];i[g]=t;var d=this.orient();if(i[g]=h,0>d){a=l;continue t}l.lastVisited=l.boundary?-n:n}}return}return a},l.addPeaks=function(t,e){var i=this.vertices.length-1,s=this.dimension,a=this.vertices,u=this.tuple,p=this.interior,g=this.simplices,l=[e];e.lastVisited=i,e.vertices[e.vertices.indexOf(-1)]=i,e.boundary=!1,p.push(e);for(var h=[];l.length>0;){var e=l.pop(),d=e.vertices,c=e.adjacent,f=d.indexOf(i);if(!(0>f))for(var m=0;s>=m;++m)if(m!==f){var y=c[m];if(y.boundary&&!(y.lastVisited>=i)){var j=y.vertices;if(y.lastVisited!==-i){for(var v=0,E=0;s>=E;++E)j[E]<0?(v=E,u[E]=t):u[E]=a[j[E]];var x=this.orient();if(x>0){j[v]=i,y.boundary=!1,p.push(y),l.push(y),y.lastVisited=i;continue}y.lastVisited=-i}var I=y.adjacent,S=d.slice(),L=c.slice(),C=new n(S,L,!0);g.push(C);var N=I.indexOf(e);if(!(0>N)){I[N]=C,L[f]=y,S[m]=-1,L[m]=e,c[m]=C,C.flip();for(var E=0;s>=E;++E){var b=S[E];if(!(0>b||b===i)){for(var P=new Array(s-1),R=0,w=0;s>=w;++w){var O=S[w];0>O||w===E||(P[R++]=O)}h.push(new o(P,C,E))}}}}}}h.sort(r);for(var m=0;m+1T||0>D||(M.cell.adjacent[M.index]=A.cell,A.cell.adjacent[A.index]=M.cell)}},l.insert=function(t,e){var n=this.vertices;n.push(t);var o=this.walk(t,e);if(o){for(var r=this.dimension,i=this.tuple,s=0;r>=s;++s){var a=o.vertices[s];i[s]=0>a?t:n[a]}var u=this.orient(i);0>u||(0!==u||(o=this.handleBoundaryDegeneracy(o,t)))&&this.addPeaks(t,o)}},l.boundary=function(){for(var t=this.dimension,e=[],n=this.simplices,o=n.length,r=0;o>r;++r){var i=n[r];if(i.boundary){for(var s=new Array(t),a=i.vertices,u=0,p=0,g=0;t>=g;++g)a[g]>=0?s[u++]=a[g]:p=1&g;if(p===(1&t)){var l=s[0];s[0]=s[1],s[1]=l}e.push(s)}}return e}},{"robust-orientation":44,"simplicial-complex":47}],39:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],40:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33,"two-product":43,"two-sum":39}],41:[function(t,e,n){arguments[4][34][0].apply(n,arguments)},{dup:34}],42:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],43:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],44:[function(t,e,n){arguments[4][37][0].apply(n,arguments)},{dup:37,"robust-scale":40,"robust-subtract":41,"robust-sum":42,"two-product":43}],45:[function(t,e,n){"use strict";"use restrict";function o(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var r=32;n.INT_BITS=r,n.INT_MAX=2147483647,n.INT_MIN=-1<0)-(0>t)},n.abs=function(t){var e=t>>r-1;return(t^e)-e},n.min=function(t,e){return e^(t^e)&-(e>t)},n.max=function(t,e){return t^(t^e)&-(e>t)},n.isPow2=function(t){return!(t&t-1||!t)},n.log2=function(t){var e,n;return e=(t>65535)<<4,t>>>=e,n=(t>255)<<3,t>>>=n,e|=n,n=(t>15)<<2,t>>>=n,e|=n,n=(t>3)<<1,t>>>=n,e|=n,e|t>>1},n.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},n.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},n.countTrailingZeros=o,n.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},n.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},n.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var i=new Array(256);!function(t){for(var e=0;256>e;++e){var n=e,o=e,r=7;for(n>>>=1;n;n>>>=1)o<<=1,o|=1&n,--r;t[e]=o<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},n.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},n.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},n.interleave3=function(t,e,n){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,n&=1023,n=4278190335&(n|n<<16),n=251719695&(n|n<<8),n=3272356035&(n|n<<4),n=1227133513&(n|n<<2),t|n<<2},n.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},n.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>o(t)+1}},{}],46:[function(t,e){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var o=n.prototype;Object.defineProperty(o,"length",{get:function(){return this.roots.length}}),o.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},o.find=function(t){for(var e=this.roots;e[t]!==t;){var n=e[t];e[t]=e[n],t=n}return t},o.link=function(t,e){var n=this.find(t),o=this.find(e);if(n!==o){var r=this.ranks,i=this.roots,s=r[n],a=r[o];a>s?i[n]=o:s>a?i[o]=n:(i[o]=n,++r[n])}}},{}],47:[function(t,e,n){"use strict";"use restrict";function o(t){for(var e=0,n=Math.max,o=0,r=t.length;r>o;++o)e=n(e,t[o].length);return e-1}function r(t){for(var e=-1,n=Math.max,o=0,r=t.length;r>o;++o)for(var i=t[o],s=0,a=i.length;a>s;++s)e=n(e,i[s]);return e+1}function i(t){for(var e=new Array(t.length),n=0,o=t.length;o>n;++n)e[n]=t[n].slice(0);return e}function s(t,e){var n=t.length,o=t.length-e.length,r=Math.min;if(o)return o;switch(n){case 0:return 0;case 1:return t[0]-e[0];case 2:var i=t[0]+t[1]-e[0]-e[1];return i?i:r(t[0],t[1])-r(e[0],e[1]);case 3:var s=t[0]+t[1],a=e[0]+e[1];if(i=s+t[2]-(a+e[2]))return i;var u=r(t[0],t[1]),p=r(e[0],e[1]),i=r(u,t[2])-r(p,e[2]);return i?i:r(u+t[2],s)-r(p+e[2],a);default:var g=t.slice(0);g.sort();var l=e.slice(0);l.sort();for(var h=0;n>h;++h)if(o=g[h]-l[h])return o;return 0}}function a(t,e){return s(t[0],e[0])}function u(t,e){if(e){for(var n=t.length,o=new Array(n),r=0;n>r;++r)o[r]=[t[r],e[r]];o.sort(a);for(var r=0;n>r;++r)t[r]=o[r][0],e[r]=o[r][1];return t}return t.sort(s),t}function p(t){if(0===t.length)return[];for(var e=1,n=t.length,o=1;n>o;++o){var r=t[o];if(s(r,t[o-1])){if(o===e){e++;continue}t[e++]=r}}return t.length=e,t}function g(t,e){for(var n=0,o=t.length-1,r=-1;o>=n;){var i=n+o>>1,a=s(t[i],e);0>=a?(0===a&&(r=i),n=i+1):a>0&&(o=i-1)}return r}function l(t,e){for(var n=new Array(t.length),o=0,r=n.length;r>o;++o)n[o]=[];for(var i=[],o=0,a=e.length;a>o;++o)for(var u=e[o],p=u.length,l=1,h=1<l;++l){i.length=v.popCount(l);for(var d=0,c=0;p>c;++c)l&1<f))for(;;)if(n[f++].push(o),f>=t.length||0!==s(t[f],i))break}return n}function h(t,e){if(!e)return l(p(c(t,0)),t,0);for(var n=new Array(e),o=0;e>o;++o)n[o]=[];for(var o=0,r=t.length;r>o;++o)for(var i=t[o],s=0,a=i.length;a>s;++s)n[i[s]].push(o);return n}function d(t){for(var e=[],n=0,o=t.length;o>n;++n)for(var r=t[n],i=0|r.length,s=1,a=1<s;++s){for(var p=[],g=0;i>g;++g)s>>>g&1&&p.push(r[g]);e.push(p)}return u(e)}function c(t,e){if(0>e)return[];for(var n=[],o=(1<n;++n)for(var r=t[n],i=0,s=r.length;s>i;++i){for(var a=new Array(r.length-1),p=0,g=0;s>p;++p)p!==i&&(a[g++]=r[p]);e.push(a)}return u(e)}function m(t,e){for(var n=new E(e),o=0;oe){for(var n=new Array(e),r=0;e>r;++r)n[r]=r;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:n}for(var i=new Array(e),r=0;e>r;++r)i[r]=r;i.sort(function(e,n){var o=t[e][0]-t[n][0];return o?o:t[e][1]-t[n][1]});for(var s=[i[0],i[1]],a=[i[0],i[1]],r=2;e>r;++r){for(var u=i[r],p=t[u],g=s.length;g>1&&o(t[s[g-2]],t[s[g-1]],p)<=0;)g-=1,s.pop();for(s.push(u),g=a.length;g>1&&o(t[a[g-2]],t[a[g-1]],p)>=0;)g-=1,a.pop();a.push(u)}for(var n=new Array(a.length+s.length-2),l=0,r=0,h=s.length;h>r;++r)n[l++]=s[r];for(var d=a.length-2;d>0;--d)n[l++]=a[d];return n}e.exports=n;var o=t("robust-orientation")[3]},{"robust-orientation":54}],49:[function(t,e,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],50:[function(t,e,n){arguments[4][33][0].apply(n,arguments)},{dup:33,"two-product":53,"two-sum":49}],51:[function(t,e,n){arguments[4][34][0].apply(n,arguments)},{dup:34}],52:[function(t,e,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],53:[function(t,e,n){arguments[4][36][0].apply(n,arguments)},{dup:36}],54:[function(t,e,n){arguments[4][37][0].apply(n,arguments)},{dup:37,"robust-scale":50,"robust-subtract":51,"robust-sum":52,"two-product":53}],55:[function(t,e,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],56:[function(t,e){var n=t("turf-inside");e.exports=function(t,e,o){for(var r=0;rl;l++)r=e[l],i=r[0],s=r[1],a+=i,u+=s,p+=i*i,g+=i*s;t=(o*g-a*u)/(o*p-a*a),n=u/o-t*a/o}return{m:t,b:n}},t.m=function(){return t.mb().m},t.b=function(){return t.mb().b},t.line=function(){var e=t.mb(),n=e.m,o=e.b;return function(t){return o+n*t}},t}function n(t,e){if(t.length<2)return 1;for(var n,o=0,r=0;re||void 0===e)&&(e=t[n]);return e}function g(t){if(0===t.length)return null;for(var e=i(t),n=[],o=0;or&&(r=i,e=o),i=1,o=n[s]):i++;return e}function v(t,e){var n=i(t),o=l(t),r=Math.sqrt(t.length);return(n-e)/(o/r)}function E(t,e,n){var o=t.length,r=e.length;if(!o||!r)return null;n||(n=0);var s=i(t),a=i(e),u=((o-1)*d(t)+(r-1)*d(e))/(o+r-2);return(s-a-n)/Math.sqrt(u*(1/o+1/r))}function x(t,e){var n=[];if(0>=e)return null;for(var o=0;o0;)o=Math.floor(e()*r--),n=t[r],t[r]=t[o],t[o]=n;return t}function S(t,e){return t=t.slice(),I(t.slice(),e)}function L(t,e,n){var o=S(t,n);return o.slice(0,e)}function C(t,e){if(0===t.length)return null;var n=t.slice().sort(function(t,e){return t-e});if(e.length){for(var o=[],r=0;re||e>1?null:1===e?t[t.length-1]:0===e?t[0]:n%1!==0?t[Math.ceil(n)-1]:t.length%2===0?(t[n-1]+t[n])/2:t[n]}function b(t){return 0===t.length?null:C(t,.75)-C(t,.25)}function P(t){if(!t||0===t.length)return null;for(var e=y(t),n=[],o=0;oo;o++)a.push(0),u.push(0);r.push(a),i.push(u)}for(n=1;e+1>n;n++)for(r[1][n]=1,i[1][n]=0,o=2;oc;c++){var f=p-c+1,m=t[f-1];if(h++,g+=m,l+=m*m,s=l-g*g/h,d=f-1,0!==d)for(o=2;e+1>o;o++)i[p][o]>=s+i[d][o-1]&&(r[p][o]=f,i[p][o]=s+i[d][o-1])}r[p][1]=1,i[p][1]=s}return{lower_class_limits:r,variance_combinations:i}}function w(t,e,n){var o=t.length-1,r=[],i=n;for(r[n]=t[t.length-1],r[0]=t[0];i>1;)r[i-1]=t[e[o][i]-2],o=e[o][i]-1,i--;return r}function O(t,e){if(e>t.length)return null;t=t.slice().sort(function(t,e){return t-e});var n=R(t,e),o=n.lower_class_limits;return w(t,o,e)}function M(t){if(t.length<3)return null;var e=t.length,n=Math.pow(c(t),3),o=h(t,3);return e*o/((e-1)*(e-2)*n)}function A(t){var e=Math.abs(t),n=Math.floor(10*e),o=10*(Math.floor(100*e)/10-Math.floor(100*e/10)),r=Math.min(10*n+o,k.length-1);return t>=0?k[r]:+(1-k[r]).toFixed(4)}function T(t,e,n){return(t-e)/n}function D(t){if(0>t)return null;for(var e=1,n=2;t>=n;n++)e*=n;return e}function G(t){return 0>t||t>1?null:F(1,t)}function F(t,e){function n(t,e,n){return D(e)/(D(t)*D(e-t))*Math.pow(n,t)*Math.pow(1-n,e-t)}if(0>e||e>1||0>=t||t%1!==0)return null;var o=0,r=0,i={};do i[o]=n(o,t,e),r+=i[o],o++;while(1-U>r);return i}function B(t){function e(t,e){return Math.pow(Math.E,-e)*Math.pow(e,t)/D(t)}if(0>=t)return null;var n=0,o=0,r={};do r[n]=e(n,t),o+=r[n],n++;while(1-U>o);return r}function q(t,e,n){for(var o,r,s=i(t),a=0,u=1,p=e(s),g=[],l=[],h=0;h=0;r--)l[r]<3&&(l[r-1]+=l[r],l.pop(),g[r-1]+=g[r],g.pop());for(r=0;rt[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]o;o++){var i=t[0]+e*a[o],s=t[1]+e*u[o];n.push([i,s])}return n.push(n[0]),r([n])}for(var o=t("turf-point"),r=t("turf-polygon"),i=t("turf-distance"),s=t("turf-featurecollection"),a=[],u=[],p=0;6>p;p++){var g=2*Math.PI/6*p;a.push(Math.cos(g)),u.push(Math.sin(g))}e.exports=function(t,e,r){var a=e/i(o([t[0],t[1]]),o([t[2],t[1]]),r),u=a*(t[2]-t[0]),p=e/i(o([t[0],t[1]]),o([t[0],t[3]]),r),g=(p*(t[3]-t[1]),u/2),l=2*g,h=Math.sqrt(3)/2*l,d=t[2]-t[0],c=t[3]-t[1],f=.75*l,m=h,y=d/(l-g/2),j=Math.ceil(y);Math.round(y)===j&&j++;var v=(j*f-g/2-d)/2-g/2,E=Math.ceil(c/h),x=(c-E*h)/2,I=E*h-c>h/2;I&&(x-=h/4);for(var S=s([]),L=0;j>L;L++)for(var C=0;E>=C;C++){var N=L%2===1;if(!(0===C&&N||0===C&&I)){var b=L*f+t[0]-v,P=C*m+t[1]+x;N&&(P-=h/2),S.features.push(n([b,P],g))}}return S}},{"turf-distance":60,"turf-featurecollection":72,"turf-point":102,"turf-polygon":103}],76:[function(t,e){function n(t,e){for(var n=!1,o=0,r=e.length-1;ot[1]!=u>t[1]&&t[0]<(a-i)*(t[1]-s)/(u-s)+i;p&&(n=!n)}return n}e.exports=function(t,e){var o=e.geometry.coordinates,r=[t.geometry.coordinates[0],t.geometry.coordinates[1]];"Polygon"===e.geometry.type&&(o=[o]);for(var i=!1,s=0;sn*n+o*o}function o(t){for(var e=t.head;e;){var n=e.next;e.next=e.prev,e.prev=n,e=n}var n=t.head;t.head=t.tail,t.tail=n}function r(t){this.level=t,this.s=null,this.count=0}function i(t){if(t)this.drawContour=t;else{var e=this;e.contours={},this.drawContour=function(t,n,o,i,s,a){var u=e.contours[a];u||(u=e.contours[a]=new r(s)),u.addSegment({x:t,y:n},{x:o,y:i})},this.contourList=function(){var t=[],n=e.contours;for(var o in n)for(var r=n[o].s,i=n[o].level;r;){var s=r.head,a=[];for(a.level=i,a.k=o;s&&s.p;)a.push(s.p),s=s.next;t.push(a),r=r.next}return t.sort(function(t,e){return t.k-e.k}),t}}this.h=new Array(5),this.sh=new Array(5),this.xh=new Array(5),this.yh=new Array(5)}e.exports=i;var s=1e-10;r.prototype.remove_seq=function(t){t.prev?t.prev.next=t.next:this.s=t.next,t.next&&(t.next.prev=t.prev),--this.count},r.prototype.addSegment=function(t,e){for(var r=this.s,i=null,s=null,a=!1,u=!1;r&&(null==i&&(n(t,r.head.p)?(i=r,a=!0):n(t,r.tail.p)&&(i=r)),null==s&&(n(e,r.head.p)?(s=r,u=!0):n(e,r.tail.p)&&(s=r)),null==s||null==i);)r=r.next;var p=(null!=i?1:0)|(null!=s?2:0);switch(p){case 0:var g={p:t,prev:null},l={p:e,next:null};g.next=l,l.prev=g,i={head:g,tail:l,next:this.s,prev:null,closed:!1},this.s&&(this.s.prev=i),this.s=i,++this.count;break;case 1:var h={p:e};a?(h.next=i.head,h.prev=null,i.head.prev=h,i.head=h):(h.next=null,h.prev=i.tail,i.tail.next=h,i.tail=h);break;case 2:var h={p:t};u?(h.next=s.head,h.prev=null,s.head.prev=h,s.head=h):(h.next=null,h.prev=s.tail,s.tail.next=h,s.tail=h);break;case 3:if(i===s){var h={p:i.tail.p,next:i.head,prev:null};i.head.prev=h,i.head=h,i.closed=!0;break}switch((a?1:0)|(u?2:0)){case 0:o(i);case 1:s.tail.next=i.head,i.head.prev=s.tail,s.tail=i.tail,this.remove_seq(i);break;case 3:o(i);case 2:i.tail.next=s.head,s.head.prev=i.tail,i.tail=s.tail,this.remove_seq(s)}}},i.prototype.contour=function(t,e,n,o,r,i,a,u,p){var g=this.h,l=this.sh,h=this.xh,d=this.yh,c=this.drawContour;this.contours={};for(var f,m,y,j,v,E,x=function(t,e){return(g[e]*h[t]-g[t]*h[e])/(g[e]-g[t])},I=function(t,e){return(g[e]*d[t]-g[t]*d[e])/(g[e]-g[t])},S=0,L=0,C=0,N=0,b=[0,1,1,0],P=[0,0,1,1],R=[[[0,0,8],[0,2,5],[7,6,9]],[[0,3,4],[1,3,1],[4,3,0]],[[9,6,7],[5,2,0],[8,0,0]]],w=r-1;w>=o;w--)for(var O=e;n-1>=O;O++){var M,A;if(M=Math.min(t[O][w],t[O][w+1]),A=Math.min(t[O+1][w],t[O+1][w+1]),v=Math.min(M,A),M=Math.max(t[O][w],t[O][w+1]),A=Math.max(t[O+1][w],t[O+1][w+1]),E=Math.max(M,A),E>=p[0]&&v<=p[u-1])for(var T=0;u>T;T++)if(p[T]>=v&&p[T]<=E){for(var D=4;D>=0;D--)D>0?(g[D]=t[O+b[D-1]][w+P[D-1]]-p[T],h[D]=i[O+b[D-1]],d[D]=a[w+P[D-1]]):(g[0]=.25*(g[1]+g[2]+g[3]+g[4]),h[0]=.5*(i[O]+i[O+1]),d[0]=.5*(a[w]+a[w+1])),l[D]=g[D]>s?1:g[D]<-s?-1:0;for(D=1;4>=D;D++)if(f=D,m=0,y=4!=D?D+1:1,j=R[l[f]+1][l[m]+1][l[y]+1],0!=j){switch(j){case 1:S=h[f],C=d[f],L=h[m],N=d[m];break;case 2:S=h[m],C=d[m],L=h[y],N=d[y];break;case 3:S=h[y],C=d[y],L=h[f],N=d[f];break;case 4:S=h[f],C=d[f],L=x(m,y),N=I(m,y);break;case 5:S=h[m],C=d[m],L=x(y,f),N=I(y,f);break;case 6:S=h[y],C=d[y],L=x(f,m),N=I(f,m);break;case 7:S=x(f,m),C=I(f,m),L=x(m,y),N=I(m,y);break;case 8:S=x(m,y),C=I(m,y),L=x(y,f),N=I(y,f);break;case 9:S=x(y,f),C=I(y,f),L=x(f,m),N=I(f,m)}c(S,C,L,N,p[T],T)}}}}},{}],83:[function(t,e){var n=t("turf-tin"),o=t("turf-inside"),r=t("turf-grid"),i=t("turf-extent"),s=t("turf-planepoint"),a=t("turf-featurecollection"),u=t("turf-linestring"),p=t("turf-square"),g=t("./conrec");e.exports=function(t,e,l,h){for(var d=n(t,e),c=i(t),f=p(c),m=r(f,l),y=[],j=0;jS;S++){var L=m.features.slice(S*I,(S+1)*I),C=[];L.forEach(function(t){C.push(t.properties?t.properties[e]:0)}),y.push(C)}for(var N=(f[2]-f[0])/I,b=[],P=[],S=0;I>S;S++)b.push(S*N+f[0]),P.push(S*N+f[1]);var R=new g;R.contour(y,0,l,0,l,b,P,h.length,h);var w=R.contourList(),O=a([]);return w.forEach(function(t){if(t.length>2){var n=[];t.forEach(function(t){n.push([t.x,t.y])});var o=u(n);o.properties={},o.properties[e]=t.level,O.features.push(o)}}),O}},{"./conrec":82,"turf-extent":70,"turf-featurecollection":72,"turf-grid":84,"turf-inside":76,"turf-linestring":90,"turf-planepoint":98,"turf-square":115,"turf-tin":118}],84:[function(t,e){var n=t("turf-point");e.exports=function(t,e){for(var o=t[0],r=t[1],i=t[2],s=(t[3],(i-o)/e),a={type:"FeatureCollection",features:[]},u=0;e>=u;u++)for(var p=0;e>=p;p++)a.features.push(n([u*s+o,p*s+r]));return a}},{"turf-point":102}],85:[function(t,e){var n=t("simple-statistics");e.exports=function(t,e,o){var r=[],i=[];return t.features.forEach(function(t){void 0!==t.properties[e]&&r.push(t.properties[e])}),i=n.jenks(r,o)}},{"simple-statistics":86}],86:[function(t,e,n){arguments[4][59][0].apply(n,arguments)},{dup:59}],87:[function(t,e){function n(t,e,n,o,r,i,s,a){var u,p,g,l,h,d={x:null,y:null,onLine1:!1,onLine2:!1};return u=(a-i)*(n-t)-(s-r)*(o-e),0==u?null!=d.x&&null!=d.y?d:!1:(p=e-i,g=t-r,l=(s-r)*p-(a-i)*g,h=(n-t)*p-(o-e)*g,p=l/u,g=h/u,d.x=t+p*(n-t),d.y=e+p*(o-e),p>0&&1>p&&(d.onLine1=!0),g>0&&1>g&&(d.onLine2=!0),d.onLine1&&d.onLine2?[d.x,d.y]:!1)}var o=(t("turf-polygon"),t("turf-point")),r=t("turf-featurecollection");e.exports=function(t){var e,i={intersections:r([]),fixed:null};e="Feature"===t.type?t.geometry:t;return e.coordinates.forEach(function(t){e.coordinates.forEach(function(e){for(var r=0;r0&&1>p&&(d.onLine1=!0),g>0&&1>g&&(d.onLine2=!0),d.onLine1&&d.onLine2?[d.x,d.y]:!1)}var r=t("turf-distance"),i=t("turf-point"),s=t("turf-linestring"),a=t("turf-bearing"),u=t("turf-destination");e.exports=function(t,e,o){var r;if("Feature"===o.type)r=o.geometry.coordinates;else{if("LineString"!==o.type)throw new Error("input must be a LineString Feature or Geometry");r=o.geometry.coordinates}var i,a=n(t,r),u=n(e,r);i=a.properties.index<=u.properties.index?[a,u]:[u,a];for(var p=s([i[0].geometry.coordinates],{}),g=i[0].properties.index+1;ge||void 0===e)&&(e=t[n]);return e}var o=t("turf-inside");e.exports=function(t,e,r,i){return t.features.forEach(function(t){t.properties||(t.properties={});var s=[];e.features.forEach(function(e){o(e,t)&&s.push(e.properties[r])}),t.properties[i]=n(s)}),t}},{"turf-inside":76}],92:[function(t,e){function n(t){if(0===t.length)return null;var e=t.slice().sort(function(t,e){return t-e});if(e.length%2===1)return e[(e.length-1)/2];var n=e[e.length/2-1],o=e[e.length/2];return(n+o)/2}var o=t("turf-inside");e.exports=function(t,e,r,i){return t.features.forEach(function(t){t.properties||(t.properties={});var s=[];e.features.forEach(function(e){o(e,t)&&s.push(e.properties[r])}),t.properties[i]=n(s)}),t}},{"turf-inside":76}],93:[function(t,e){var n=t("clone"),o=t("turf-union");e.exports=function(t){for(var e=n(t.features[0]),r=t.features,i=0,s=r.length;s>i;i++){var a=r[i];a.geometry&&(e=o(e,a))}return e}},{clone:94,"turf-union":120}],94:[function(t,e){(function(t){"use strict";function n(t){return Object.prototype.toString.call(t)}function o(e,n,o,i){function s(e,o){if(null===e)return null;if(0==o)return e;var g,l;if("object"!=typeof e)return e;if(r.isArray(e))g=[];else if(r.isRegExp(e))g=new RegExp(e.source,r.getRegExpFlags(e)),e.lastIndex&&(g.lastIndex=e.lastIndex);else if(r.isDate(e))g=new Date(e.getTime());else{if(p&&t.isBuffer(e))return g=new t(e.length),e.copy(g),g;"undefined"==typeof i?(l=Object.getPrototypeOf(e),g=Object.create(l)):(g=Object.create(i),l=i)}if(n){var h=a.indexOf(e);if(-1!=h)return u[h];a.push(e),u.push(g)}for(var d in e){var c;l&&(c=Object.getOwnPropertyDescriptor(l,d)),c&&null==c.set||(g[d]=s(e[d],o-1))}return g}var a=[],u=[],p="undefined"!=typeof t;return"undefined"==typeof n&&(n=!0),"undefined"==typeof o&&(o=1/0),s(e,o)}var r={isArray:function(t){return Array.isArray(t)||"object"==typeof t&&"[object Array]"===n(t)},isDate:function(t){return"object"==typeof t&&"[object Date]"===n(t)},isRegExp:function(t){return"object"==typeof t&&"[object RegExp]"===n(t)},getRegExpFlags:function(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}};"object"==typeof e&&(e.exports=o),o.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e}}).call(this,t("buffer").Buffer)},{buffer:2}],95:[function(t,e){var n=t("turf-point");e.exports=function(t,e){if(null===t||null===e)throw new Error("Less than two points passed.");var o=t.geometry.coordinates[0],r=e.geometry.coordinates[0],i=t.geometry.coordinates[1],s=e.geometry.coordinates[1],a=o+r,u=a/2,p=i+s,g=p/2;return n([u,g])}},{"turf-point":102}],96:[function(t,e){function n(t){for(var e,n=0;n0&&1>p&&(d.onLine1=!0),g>0&&1>g&&(d.onLine2=!0),d.onLine1&&d.onLine2?[d.x,d.y]:!1)}var r=t("turf-distance"),i=t("turf-point"),s=(t("turf-linestring"),t("turf-bearing")),a=t("turf-destination");e.exports=function(t,e){var o;if("Feature"===t.type)o=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");o=t.geometry.coordinates}return n(e,o)}},{"turf-bearing":13,"turf-destination":57,"turf-distance":60,"turf-linestring":90,"turf-point":102}],101:[function(t,e){function n(t,e,n,o,r,i){var s=Math.sqrt((r-n)*(r-n)+(i-o)*(i-o)),a=Math.sqrt((t-n)*(t-n)+(e-o)*(e-o)),u=Math.sqrt((r-t)*(r-t)+(i-e)*(i-e));return s===a+u?!0:void 0}var o=t("turf-featurecollection"),r=t("turf-center"),i=t("turf-distance"),s=t("turf-inside"),a=t("turf-explode");e.exports=function(t){"FeatureCollection"!=t.type&&("Feature"!=t.type&&(t={type:"Feature",geometry:t,properties:{}}),t=o([t]));for(var e=r(t),u=!1,p=0;!u&&pb&&(N=b,C=L.features[p])}return C}},{"turf-center":21,"turf-distance":60,"turf-explode":68,"turf-featurecollection":72,"turf-inside":76}],102:[function(t,e){var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t,e){if(!n(t))throw new Error("Coordinates must be an array");if(t.length<2)throw new Error("Coordinates must be at least 2 numbers long");return{type:"Feature",geometry:{type:"Point",coordinates:t},properties:e||{}}}},{}],103:[function(t,e){e.exports=function(t,e){if(null===t)throw new Error("No coordinates passed");for(var n=0;n0?t+n[e-1]:t}function u(t){t=2*t*Math.PI/c[c.length-1];var e=Math.random();d.push([e*r*Math.sin(t),e*r*Math.cos(t)])}"number"!=typeof e&&(e=10),"number"!=typeof r&&(r=10);var p=[];for(i=0;i=r[n][0]&&t.properties[e]<=r[n][1]&&(t.properties[o]=r[n][2]);i.features.push(t)}),i}},{"./index.js":108,"turf-featurecollection":72}],109:[function(t,e){var n=t("turf-featurecollection");e.exports=function(t,e,o){for(var r=n([]),i=0;is;)o=Math.floor((i+1)*Math.random()),n=r[o],r[o]=r[i],r[i]=n;return r.slice(s)}var o=t("turf-featurecollection");e.exports=function(t,e){var r=o(n(t.features,e));return r}},{"turf-featurecollection":72}],111:[function(t,e){function n(t,e){return{type:"Feature",geometry:t,properties:e}}var o=t("simplify-js");e.exports=function(t,e,r){if("LineString"===t.geometry.type){var i={type:"LineString",coordinates:[]},s=t.geometry.coordinates.map(function(t){return{x:t[0],y:t[1]}});return i.coordinates=o(s,e,r).map(function(t){return[t.x,t.y]}),n(i,t.properties)}if("Polygon"===t.geometry.type){var a={type:"Polygon",coordinates:[]};return t.geometry.coordinates.forEach(function(t){var n=t.map(function(t){return{x:t[0],y:t[1]}}),i=o(n,e,r).map(function(t){return[t.x,t.y]});a.coordinates.push(i)}),n(a,t.properties)}}},{"simplify-js":112}],112:[function(e,n){!function(){"use strict";function e(t,e){var n=t.x-e.x,o=t.y-e.y;return n*n+o*o}function o(t,e,n){var o=e.x,r=e.y,i=n.x-o,s=n.y-r;if(0!==i||0!==s){var a=((t.x-o)*i+(t.y-r)*s)/(i*i+s*s);a>1?(o=n.x,r=n.y):a>0&&(o+=i*a,r+=s*a)}return i=t.x-o,s=t.y-r,i*i+s*s}function r(t,n){for(var o,r=t[0],i=[r],s=1,a=t.length;a>s;s++)o=t[s],e(o,r)>n&&(i.push(o),r=o);return r!==o&&i.push(o),i}function i(t,e){var n,r,i,s,a=t.length,u="undefined"!=typeof Uint8Array?Uint8Array:Array,p=new u(a),g=0,l=a-1,h=[],d=[];for(p[g]=p[l]=1;l;){for(r=0,n=g+1;l>n;n++)i=o(t[n],t[g],t[l]),i>r&&(s=n,r=i);r>e&&(p[s]=1,h.push(g,s,s,l)),l=h.pop(),g=h.pop()}for(n=0;a>n;n++)p[n]&&d.push(t[n]);return d}function s(t,e,n){var o=void 0!==e?e*e:1;return t=n?t:r(t,o),t=i(t,o)}"function"==typeof t&&t.amd?t(function(){return s}):"undefined"!=typeof n?n.exports=s:"undefined"!=typeof self?self.simplify=s:window.simplify=s}()},{}],113:[function(t,e){e.exports=function(t,e){var n=t[2]-t[0],o=t[3]-t[1],r=n*e,i=o*e,s=r-n,a=i-o,u=t[0]-s/2,p=t[1]-a/2,g=s/2+t[2],l=a/2+t[3],h=[u,p,g,l];return h}},{}],114:[function(t,e){var n=t("turf-featurecollection"),o=t("turf-point"),r=t("turf-polygon"),i=t("turf-distance");e.exports=function(t,e,s){for(var a=n([]),u=e/i(o([t[0],t[1]]),o([t[2],t[1]]),s),p=u*(t[2]-t[0]),g=e/i(o([t[0],t[1]]),o([t[0],t[3]]),s),l=g*(t[3]-t[1]),h=t[0];h<=t[2];){for(var d=t[1];d<=t[3];){var c=r([[[h,d],[h,d+l],[h+p,d+l],[h+p,d],[h,d]]]);a.features.push(c),d+=l}h+=p}return a}},{"turf-distance":60,"turf-featurecollection":72,"turf-point":102,"turf-polygon":103}],115:[function(t,e){var n=t("turf-midpoint"),o=t("turf-point"),r=t("turf-distance");e.exports=function(t){var e=[0,0,0,0],i=o([t[0],t[1]]),s=o([t[0],t[3]]),a=(o([t[2],t[3]]),o([t[2],t[1]])),u=r(i,a,"miles"),p=r(i,s,"miles");if(u>=p){e[0]=t[0],e[2]=t[2];var g=n(i,s);return e[1]=g.geometry.coordinates[1]-(t[2]-t[0])/2,e[3]=g.geometry.coordinates[1]+(t[2]-t[0])/2,e}e[1]=t[1],e[3]=t[3];var l=n(i,a);return e[0]=l.geometry.coordinates[0]-(t[3]-t[1])/2,e[2]=l.geometry.coordinates[0]+(t[3]-t[1])/2,e}},{"turf-distance":60,"turf-midpoint":95,"turf-point":102}],116:[function(t,e){function n(t){for(var e=0,n=0;nu&&(u=t[e].y);var p,g,l,h=s-i,d=u-a,c=h>d?h:d,f=.5*(s+i),m=.5*(u+a),y=[new n({x:f-20*c,y:m-c,__sentinel:!0},{x:f,y:m+20*c,__sentinel:!0},{x:f+20*c,y:m-c,__sentinel:!0})],j=[],v=[];for(e=t.length;e--;){for(v.length=0,p=y.length;p--;)h=t[e].x-y[p].x,h>0&&h*h>y[p].r?(j.push(y[p]),y.splice(p,1)):(d=t[e].y-y[p].y,h*h+d*d>y[p].r||(v.push(y[p].a,y[p].b,y[p].b,y[p].c,y[p].c,y[p].a),y.splice(p,1)));for(r(v),p=v.length;p;)l=v[--p],g=v[--p],y.push(new n(g,l,t[e]))}for(Array.prototype.push.apply(j,y),e=j.length;e--;)(j[e].a.__sentinel||j[e].b.__sentinel||j[e].c.__sentinel)&&j.splice(e,1);return j}var s=t("turf-polygon"),a=t("turf-featurecollection");e.exports=function(t,e){return a(i(t.features.map(function(t){var n={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e&&(n.z=t.properties[e]),n})).map(function(t){return s([[[t.a.x,t.a.y],[t.b.x,t.b.y],[t.c.x,t.c.y],[t.a.x,t.a.y]]],{a:t.a.z,b:t.b.z,c:t.c.z})}))}},{"turf-featurecollection":72,"turf-polygon":103}],119:[function(t,e){var n=t("turf-featurecollection"),o=t("turf-point"),r=t("turf-polygon"),i=t("turf-distance");e.exports=function(t,e,s){for(var a=n([]),u=e/i(o([t[0],t[1]]),o([t[2],t[1]]),s),p=u*(t[2]-t[0]),g=e/i(o([t[0],t[1]]),o([t[0],t[3]]),s),l=g*(t[3]-t[1]),h=0,d=t[0];d<=t[2];){for(var c=0,f=t[1];f<=t[3];){if(h%2===0&&c%2===0){var m=r([[[d,f],[d,f+l],[d+p,f],[d,f]]]);a.features.push(m);var y=r([[[d,f+l],[d+p,f+l],[d+p,f],[d,f+l]]]);a.features.push(y)}else if(h%2===0&&c%2===1){var m=r([[[d,f],[d+p,f+l],[d+p,f],[d,f]]]);a.features.push(m);var y=r([[[d,f],[d,f+l],[d+p,f+l],[d,f]]]);a.features.push(y)}else if(c%2===0&&h%2===1){var m=r([[[d,f],[d,f+l],[d+p,f+l],[d,f]]]);a.features.push(m);var y=r([[[d,f],[d+p,f+l],[d+p,f],[d,f]]]);a.features.push(y)}else if(c%2===1&&h%2===1){var m=r([[[d,f],[d,f+l],[d+p,f],[d,f]]]);a.features.push(m);var y=r([[[d,f+l],[d+p,f+l],[d+p,f],[d,f+l]]]);a.features.push(y)}f+=l,c++}h++,d+=p}return a}},{"turf-distance":60,"turf-featurecollection":72,"turf-point":102,"turf-polygon":103}],120:[function(t,e){var n=t("jsts");e.exports=function(t,e){var o=new n.io.GeoJSONReader,r=o.read(JSON.stringify(t.geometry)),i=o.read(JSON.stringify(e.geometry)),s=r.union(i),a=new n.io.GeoJSONParser;return s=a.write(s),{type:"Feature",geometry:s,properties:t.properties}}},{jsts:121}],121:[function(t,e,n){arguments[4][17][0].apply(n,arguments)},{"./lib/jsts":122,dup:17,"javascript.util":124}],122:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{dup:18}],123:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{dup:19}],124:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{"./dist/javascript.util-node.min.js":123,dup:20}],125:[function(t,e){var n=t("simple-statistics"),o=t("turf-inside");e.exports=function(t,e,r,i){return t.features.forEach(function(t){t.properties||(t.properties={});var s=[];e.features.forEach(function(e){o(e,t)&&s.push(e.properties[r])}),t.properties[i]=n.variance(s)}),t}},{"simple-statistics":126,"turf-inside":76}],126:[function(t,e,n){arguments[4][59][0].apply(n,arguments)},{dup:59}],127:[function(t,e){var n=t("turf-inside"),o=t("turf-featurecollection");e.exports=function(t,e){for(var r=o([]),i=0;i