{"version":3,"sources":["maps/js/js/wicket.js","maps/js/js/wicket-gmap.js"],"names":["root","factory","define","amd","module","exports","Wkt","this","obj","_wrapped","beginsWith","str","sub","substring","length","endsWith","delimiter","isArray","constructor","Array","trim","initializer","wrapVertices","regExes","typeStr","spaces","numeric","comma","parenComma","coord","doubleParenComma","trimParens","ogcTypes","crudeJson","components","undefined","read","fromObject","prototype","isCollection","type","slice","sameCoords","a","b","x","y","result","hasOwnProperty","fromJson","deconstruct","call","isRectangle","toObject","config","construct","properties","toString","write","i","j","k","coords","iring","oring","toLowerCase","geometry","coordinates","push","toJson","ring","rings","cs","json","exec","s","toUpperCase","join","bbox","concat","merge","wkt","prefix","TypeError","matches","base","ingest","apply","test","console","log","name","message","JSON","parse","pieces","data","extract","point","String","multipoint","parts","linestring","multilinestring","polygon","multipolygon","box","geometrycollection","split","parseFloat","points","multipoints","line","lines","replace","subcomponents","x_cord","filter","n","y_cord","polygons","component","c","position","google","maps","LatLng","Marker","arr","editable","path","Polyline","bounds","LatLngBounds","Rectangle","verts","paths","area","reverse","v","extend","Polygon","multiFlag","features","sign","tmp","response","spherical","computeSignedArea","lng","lat","Point","getPosition","getPath","getAt","l","getPaths","areas","getArray","map","Math","abs","indexOf","lastIndexOf","equals","unshift","Circle","getCenter","radius","getRadius","d2r","PI","rlat","rlng","cos","theta","sin","getSouthWest","getNorthEast","getBounds","Data","Feature","getGeometry","get","LineString","getLength","vertex","MultiPoint","MultiLineString","linestrings","MultiPolygon","GeometryCollection","objects","object","comps","require"],"mappings":"CAqBC,CAAUA,KAAMC,WAES,YAAlB,OAAOC,QAAyBA,OAAOC,IAEvCD,OAAO,WACH,OAAOD,QAAQ,CACnB,CAAC,EACwB,aAAlB,OAAOG,QAA6C,UAAnB,OAAOC,QAE/CD,OAAOC,QAAUJ,QAAQ,EAGzBD,KAAKM,IAAML,QAAQ,CAE3B,GAAEM,KAAM,WAGJ,IAWAD,EAAM,SAAUE,KACZ,OAAIA,eAAeF,EAAYE,IACzB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,MAAO,aACX,KAAKH,OAAOC,KAAKM,SACb,MAAO,kBACX,KAAKP,OAAOC,KAAKgB,QACb,MAAO,eACX,QACI,MAAO,oBACX,CAEJ,GAAG,EACH3G,YAAa,KAKT,IAHA,IAEAgK,EAAQ,GACHvI,EAAI,EAAGA,EAAIoF,EAASjI,OAAQ6C,GAAK,EAC9BoF,EAASpF,GAAGzB,YACZgK,EAAM9H,KAAK2E,EAASpF,GAAGzB,UAAU,EAIzC,MAAO,CACHgK,MAAOA,CACX,CACJ,GAAG,CAEP,GACShK,WAAagH,EAAShH,WAAWgK,MACnChD,CAEX,CAEAzD,QAAQC,IAAI,8DAA8D,CAE9E,CACJ,GAAEpF,KAAO6L,QAAQ,UAAU,CAAE","file":"../wicket.js","sourcesContent":["/** @license\n *\n * Copyright (C) 2012 K. Arthur Endsley (kaendsle@mtu.edu)\n * Michigan Tech Research Institute (MTRI)\n * 3600 Green Court, Suite 100, Ann Arbor, MI, 48105\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n */\n\n(function (root, factory) {\n\n if (typeof define === \"function\" && define.amd) {\n // AMD (+ global for extensions)\n define(function () {\n return factory();\n });\n } else if (typeof module !== 'undefined' && typeof exports === \"object\") {\n // CommonJS\n module.exports = factory();\n } else {\n // Browser\n root.Wkt = factory();\n }\n}(this, function () {\n\n\n var beginsWith, endsWith, root, Wkt;\n\n // Establish the root object, window in the browser, or exports on the server\n root = this;\n\n /**\n * @desc The Wkt namespace.\n * @property {String} delimiter - The default delimiter for separating components of atomic geometry (coordinates)\n * @namespace\n * @global\n */\n Wkt = function (obj) {\n if (obj instanceof Wkt) return obj;\n if (!(this instanceof Wkt)) return new Wkt(obj);\n this._wrapped = obj;\n };\n\n\n\n /**\n * Returns true if the substring is found at the beginning of the string.\n * @param str {String} The String to search\n * @param sub {String} The substring of interest\n * @return {Boolean}\n * @private\n */\n beginsWith = function (str, sub) {\n return str.substring(0, sub.length) === sub;\n };\n\n /**\n * Returns true if the substring is found at the end of the string.\n * @param str {String} The String to search\n * @param sub {String} The substring of interest\n * @return {Boolean}\n * @private\n */\n endsWith = function (str, sub) {\n return str.substring(str.length - sub.length) === sub;\n };\n\n /**\n * The default delimiter for separating components of atomic geometry (coordinates)\n * @ignore\n */\n Wkt.delimiter = ' ';\n\n /**\n * Determines whether or not the passed Object is an Array.\n * @param obj {Object} The Object in question\n * @return {Boolean}\n * @member Wkt.isArray\n * @method\n */\n Wkt.isArray = function (obj) {\n return !!(obj && obj.constructor === Array);\n };\n\n /**\n * Removes given character String(s) from a String.\n * @param str {String} The String to search\n * @param sub {String} The String character(s) to trim\n * @return {String} The trimmed string\n * @member Wkt.trim\n * @method\n */\n Wkt.trim = function (str, sub) {\n sub = sub || ' '; // Defaults to trimming spaces\n // Trim beginning spaces\n while (beginsWith(str, sub)) {\n str = str.substring(1);\n }\n // Trim ending spaces\n while (endsWith(str, sub)) {\n str = str.substring(0, str.length - 1);\n }\n return str;\n };\n\n /**\n * An object for reading WKT strings and writing geographic features\n * @constructor this.Wkt.Wkt\n * @param initializer {String} An optional WKT string for immediate read\n * @property {Array} components - Holder for atomic geometry objects (internal representation of geometric components)\n * @property {String} delimiter - The default delimiter for separating components of atomic geometry (coordinates)\n * @property {Object} regExes - Some regular expressions copied from OpenLayers.Format.WKT.js\n * @property {String} type - The Well-Known Text name (e.g. 'point') of the geometry\n * @property {Boolean} wrapVerticies - True to wrap vertices in MULTIPOINT geometries; If true: MULTIPOINT((30 10),(10 30),(40 40)); If false: MULTIPOINT(30 10,10 30,40 40)\n * @return {this.Wkt.Wkt}\n * @memberof Wkt\n */\n Wkt.Wkt = function (initializer) {\n\n /**\n * The default delimiter between X and Y coordinates.\n * @ignore\n */\n this.delimiter = Wkt.delimiter || ' ';\n\n /**\n * Configuration parameter for controlling how Wicket seralizes\n * MULTIPOINT strings. Examples; both are valid WKT:\n * If true: MULTIPOINT((30 10),(10 30),(40 40))\n * If false: MULTIPOINT(30 10,10 30,40 40)\n * @ignore\n */\n this.wrapVertices = true;\n\n /**\n * Some regular expressions copied from OpenLayers.Format.WKT.js\n * @ignore\n */\n this.regExes = {\n 'typeStr': /^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,\n 'spaces': /\\s+|\\+/, // Matches the '+' or the empty space\n 'numeric': /-*\\d+(\\.*\\d+)?/,\n 'comma': /\\s*,\\s*/,\n 'parenComma': /\\)\\s*,\\s*\\(/,\n 'coord': /-*\\d+\\.*\\d+ -*\\d+\\.*\\d+/, // e.g. \"24 -14\"\n 'doubleParenComma': /\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,\n 'trimParens': /^\\s*\\(?(.*?)\\)?\\s*$/,\n 'ogcTypes': /^(multi)?(point|line|polygon|box)?(string)?$/i, // Captures e.g. \"Multi\",\"Line\",\"String\"\n 'crudeJson': /^{.*\"(type|coordinates|geometries|features)\":.*}$/ // Attempts to recognize JSON strings\n };\n\n /**\n * The internal representation of geometry--the \"components\" of geometry.\n * @ignore\n */\n this.components = undefined;\n\n // An initial WKT string may be provided\n if (initializer && typeof initializer === 'string') {\n this.read(initializer);\n } else if (initializer && typeof initializer !== undefined) {\n this.fromObject(initializer);\n }\n\n };\n\n\n\n /**\n * Returns true if the internal geometry is a collection of geometries.\n * @return {Boolean} Returns true when it is a collection\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.isCollection = function () {\n switch (this.type.slice(0, 5)) {\n case 'multi':\n // Trivial; any multi-geometry is a collection\n return true;\n case 'polyg':\n // Polygons with holes are \"collections\" of rings\n return true;\n default:\n // Any other geometry is not a collection\n return false;\n }\n };\n\n /**\n * Compares two x,y coordinates for equality.\n * @param a {Object} An object with x and y properties\n * @param b {Object} An object with x and y properties\n * @return {Boolean}\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.sameCoords = function (a, b) {\n return (a.x === b.x && a.y === b.y);\n };\n\n /**\n * Sets internal geometry (components) from framework geometry (e.g.\n * Google Polygon objects or google.maps.Polygon).\n * @param obj {Object} The framework-dependent geometry representation\n * @return {this.Wkt.Wkt} The object itself\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.fromObject = function (obj) {\n var result;\n\n if (obj.hasOwnProperty('type') && obj.hasOwnProperty('coordinates')) {\n result = this.fromJson(obj);\n } else {\n result = this.deconstruct.call(this, obj);\n }\n\n this.components = result.components;\n this.isRectangle = result.isRectangle || false;\n this.type = result.type;\n return this;\n };\n\n /**\n * Creates external geometry objects based on a plug-in framework's\n * construction methods and available geometry classes.\n * @param config {Object} An optional framework-dependent properties specification\n * @return {Object} The framework-dependent geometry representation\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.toObject = function (config) {\n var obj = this.construct[this.type].call(this, config);\n // Don't assign the \"properties\" property to an Array\n if (typeof obj === 'object' && !Wkt.isArray(obj)) {\n obj.properties = this.properties;\n }\n return obj;\n };\n\n /**\n * Returns the WKT string representation; the same as the write() method.\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.toString = function (config) {\n return this.write();\n };\n\n /**\n * Parses a JSON representation as an Object.\n * @param obj {Object} An Object with the GeoJSON schema\n * @return {this.Wkt.Wkt} The object itself\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.fromJson = function (obj) {\n var i, j, k, coords, iring, oring;\n\n this.type = obj.type.toLowerCase();\n this.components = [];\n if (obj.hasOwnProperty('geometry')) { //Feature\n this.fromJson(obj.geometry);\n this.properties = obj.properties;\n return this;\n }\n coords = obj.coordinates;\n\n if (!Wkt.isArray(coords[0])) { // Point\n this.components.push({\n x: coords[0],\n y: coords[1]\n });\n\n } else {\n\n for (i in coords) {\n if (coords.hasOwnProperty(i)) {\n\n if (!Wkt.isArray(coords[i][0])) { // LineString\n\n if (this.type === 'multipoint') { // MultiPoint\n this.components.push([{\n x: coords[i][0],\n y: coords[i][1]\n }]);\n\n } else {\n this.components.push({\n x: coords[i][0],\n y: coords[i][1]\n });\n\n }\n\n } else {\n\n oring = [];\n for (j in coords[i]) {\n if (coords[i].hasOwnProperty(j)) {\n\n if (!Wkt.isArray(coords[i][j][0])) {\n oring.push({\n x: coords[i][j][0],\n y: coords[i][j][1]\n });\n\n } else {\n\n iring = [];\n for (k in coords[i][j]) {\n if (coords[i][j].hasOwnProperty(k)) {\n\n iring.push({\n x: coords[i][j][k][0],\n y: coords[i][j][k][1]\n });\n\n }\n }\n\n oring.push(iring);\n\n }\n\n }\n }\n\n this.components.push(oring);\n }\n }\n }\n\n }\n\n return this;\n };\n\n /**\n * Creates a JSON representation, with the GeoJSON schema, of the geometry.\n * @return {Object} The corresponding GeoJSON representation\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.toJson = function () {\n var cs, json, i, j, k, ring, rings;\n\n cs = this.components;\n json = {\n coordinates: [],\n type: (function () {\n var i, type, s;\n\n type = this.regExes.ogcTypes.exec(this.type).slice(1);\n s = [];\n\n for (i in type) {\n if (type.hasOwnProperty(i)) {\n if (type[i] !== undefined) {\n s.push(type[i].toLowerCase().slice(0, 1).toUpperCase() + type[i].toLowerCase().slice(1));\n }\n }\n }\n\n return s;\n }.call(this)).join('')\n }\n\n // Wkt BOX type gets a special bbox property in GeoJSON\n if (this.type.toLowerCase() === 'box') {\n json.type = 'Polygon';\n json.bbox = [];\n\n for (i in cs) {\n if (cs.hasOwnProperty(i)) {\n json.bbox = json.bbox.concat([cs[i].x, cs[i].y]);\n }\n }\n\n json.coordinates = [\n [\n [cs[0].x, cs[0].y],\n [cs[0].x, cs[1].y],\n [cs[1].x, cs[1].y],\n [cs[1].x, cs[0].y],\n [cs[0].x, cs[0].y]\n ]\n ];\n\n return json;\n }\n\n // For the coordinates of most simple features\n for (i in cs) {\n if (cs.hasOwnProperty(i)) {\n\n // For those nested structures\n if (Wkt.isArray(cs[i])) {\n rings = [];\n\n for (j in cs[i]) {\n if (cs[i].hasOwnProperty(j)) {\n\n if (Wkt.isArray(cs[i][j])) { // MULTIPOLYGONS\n ring = [];\n\n for (k in cs[i][j]) {\n if (cs[i][j].hasOwnProperty(k)) {\n ring.push([cs[i][j][k].x, cs[i][j][k].y]);\n }\n }\n\n rings.push(ring);\n\n } else { // POLYGONS and MULTILINESTRINGS\n\n if (cs[i].length > 1) {\n rings.push([cs[i][j].x, cs[i][j].y]);\n\n } else { // MULTIPOINTS\n rings = rings.concat([cs[i][j].x, cs[i][j].y]);\n }\n }\n }\n }\n\n json.coordinates.push(rings);\n\n } else {\n if (cs.length > 1) { // For LINESTRING type\n json.coordinates.push([cs[i].x, cs[i].y]);\n\n } else { // For POINT type\n json.coordinates = json.coordinates.concat([cs[i].x, cs[i].y]);\n }\n }\n\n }\n }\n\n return json;\n };\n\n /**\n * Absorbs the geometry of another this.Wkt.Wkt instance, merging it with its own,\n * creating a collection (MULTI-geometry) based on their types, which must agree.\n * For example, creates a MULTIPOLYGON from a POLYGON type merged with another\n * POLYGON type, or adds a POLYGON instance to a MULTIPOLYGON instance.\n * @param wkt {String} A Wkt.Wkt object\n * @return {this.Wkt.Wkt} The object itself\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.merge = function (wkt) {\n var prefix = this.type.slice(0, 5);\n\n if (this.type !== wkt.type) {\n if (this.type.slice(5, this.type.length) !== wkt.type) {\n throw TypeError('The input geometry types must agree or the calling this.Wkt.Wkt instance must be a multigeometry of the other');\n }\n }\n\n switch (prefix) {\n\n case 'point':\n this.components = [this.components.concat(wkt.components)];\n break;\n\n case 'multi':\n this.components = this.components.concat((wkt.type.slice(0, 5) === 'multi') ? wkt.components : [wkt.components]);\n break;\n\n default:\n this.components = [\n this.components,\n wkt.components\n ];\n break;\n\n }\n\n if (prefix !== 'multi') {\n this.type = 'multi' + this.type;\n }\n return this;\n };\n\n /**\n * Reads a WKT string, validating and incorporating it.\n * @param str {String} A WKT or GeoJSON string\n * @return {this.Wkt.Wkt} The object itself\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.read = function (str) {\n var matches;\n matches = this.regExes.typeStr.exec(str);\n if (matches) {\n this.type = matches[1].toLowerCase();\n this.base = matches[2];\n if (this.ingest[this.type]) {\n this.components = this.ingest[this.type].apply(this, [this.base]);\n }\n\n } else {\n if (this.regExes.crudeJson.test(str)) {\n if (typeof JSON === 'object' && typeof JSON.parse === 'function') {\n this.fromJson(JSON.parse(str));\n\n } else {\n console.log('JSON.parse() is not available; cannot parse GeoJSON strings');\n throw {\n name: 'JSONError',\n message: 'JSON.parse() is not available; cannot parse GeoJSON strings'\n };\n }\n\n } else {\n console.log('Invalid WKT string provided to read()');\n throw {\n name: 'WKTError',\n message: 'Invalid WKT string provided to read()'\n };\n }\n }\n\n return this;\n }; // eo readWkt\n\n /**\n * Writes a WKT string.\n * @param components {Array} An Array of internal geometry objects\n * @return {String} The corresponding WKT representation\n * @memberof this.Wkt.Wkt\n * @method\n */\n Wkt.Wkt.prototype.write = function (components) {\n var i, pieces, data;\n\n components = components || this.components;\n\n pieces = [];\n\n pieces.push(this.type.toUpperCase() + '(');\n\n for (i = 0; i < components.length; i += 1) {\n if (this.isCollection() && i > 0) {\n pieces.push(',');\n }\n\n // There should be an extract function for the named type\n if (!this.extract[this.type]) {\n return null;\n }\n\n data = this.extract[this.type].apply(this, [components[i]]);\n if (this.isCollection() && this.type !== 'multipoint') {\n pieces.push('(' + data + ')');\n\n } else {\n pieces.push(data);\n\n // If not at the end of the components, add a comma\n if (i !== (components.length - 1) && this.type !== 'multipoint') {\n pieces.push(',');\n }\n\n }\n }\n\n pieces.push(')');\n\n return pieces.join('');\n };\n\n /**\n * This object contains functions as property names that extract WKT\n * strings from the internal representation.\n * @memberof this.Wkt.Wkt\n * @namespace this.Wkt.Wkt.extract\n * @instance\n */\n Wkt.Wkt.prototype.extract = {\n /**\n * Return a WKT string representing atomic (point) geometry\n * @param point {Object} An object with x and y properties\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n point: function (point) {\n return String(point.x) + this.delimiter + String(point.y);\n },\n\n /**\n * Return a WKT string representing multiple atoms (points)\n * @param multipoint {Array} Multiple x-and-y objects\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n multipoint: function (multipoint) {\n var i, parts = [],\n s;\n\n for (i = 0; i < multipoint.length; i += 1) {\n s = this.extract.point.apply(this, [multipoint[i]]);\n\n if (this.wrapVertices) {\n s = '(' + s + ')';\n }\n\n parts.push(s);\n }\n\n return parts.join(',');\n },\n\n /**\n * Return a WKT string representing a chain (linestring) of atoms\n * @param linestring {Array} Multiple x-and-y objects\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n linestring: function (linestring) {\n // Extraction of linestrings is the same as for points\n return this.extract.point.apply(this, [linestring]);\n },\n\n /**\n * Return a WKT string representing multiple chains (multilinestring) of atoms\n * @param multilinestring {Array} Multiple of multiple x-and-y objects\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n multilinestring: function (multilinestring) {\n var i, parts = [];\n\n if (multilinestring.length) {\n for (i = 0; i < multilinestring.length; i += 1) {\n parts.push(this.extract.linestring.apply(this, [multilinestring[i]]));\n }\n } else {\n parts.push(this.extract.point.apply(this, [multilinestring]));\n }\n\n return parts.join(',');\n },\n\n /**\n * Return a WKT string representing multiple atoms in closed series (polygon)\n * @param polygon {Array} Collection of ordered x-and-y objects\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n polygon: function (polygon) {\n // Extraction of polygons is the same as for multilinestrings\n return this.extract.multilinestring.apply(this, [polygon]);\n },\n\n /**\n * Return a WKT string representing multiple closed series (multipolygons) of multiple atoms\n * @param multipolygon {Array} Collection of ordered x-and-y objects\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n multipolygon: function (multipolygon) {\n var i, parts = [];\n for (i = 0; i < multipolygon.length; i += 1) {\n parts.push('(' + this.extract.polygon.apply(this, [multipolygon[i]]) + ')');\n }\n return parts.join(',');\n },\n\n /**\n * Return a WKT string representing a 2DBox\n * @param multipolygon {Array} Collection of ordered x-and-y objects\n * @return {String} The WKT representation\n * @memberof this.Wkt.Wkt.extract\n * @instance\n */\n box: function (box) {\n return this.extract.linestring.apply(this, [box]);\n },\n\n geometrycollection: function (str) {\n console.log('The geometrycollection WKT type is not yet supported.');\n }\n };\n\n /**\n * This object contains functions as property names that ingest WKT\n * strings into the internal representation.\n * @memberof this.Wkt.Wkt\n * @namespace this.Wkt.Wkt.ingest\n * @instance\n */\n Wkt.Wkt.prototype.ingest = {\n\n /**\n * Return point feature given a point WKT fragment.\n * @param str {String} A WKT fragment representing the point\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n point: function (str) {\n var coords = Wkt.trim(str).split(this.regExes.spaces);\n // In case a parenthetical group of coordinates is passed...\n return [{ // ...Search for numeric substrings\n x: parseFloat(this.regExes.numeric.exec(coords[0])[0]),\n y: parseFloat(this.regExes.numeric.exec(coords[1])[0])\n }];\n },\n\n /**\n * Return a multipoint feature given a multipoint WKT fragment.\n * @param str {String} A WKT fragment representing the multipoint\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n multipoint: function (str) {\n var i, components, points;\n components = [];\n points = Wkt.trim(str).split(this.regExes.comma);\n for (i = 0; i < points.length; i += 1) {\n components.push(this.ingest.point.apply(this, [points[i]]));\n }\n return components;\n },\n\n /**\n * Return a linestring feature given a linestring WKT fragment.\n * @param str {String} A WKT fragment representing the linestring\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n linestring: function (str) {\n var i, multipoints, components;\n\n // In our x-and-y representation of components, parsing\n // multipoints is the same as parsing linestrings\n multipoints = this.ingest.multipoint.apply(this, [str]);\n\n // However, the points need to be joined\n components = [];\n for (i = 0; i < multipoints.length; i += 1) {\n components = components.concat(multipoints[i]);\n }\n return components;\n },\n\n /**\n * Return a multilinestring feature given a multilinestring WKT fragment.\n * @param str {String} A WKT fragment representing the multilinestring\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n multilinestring: function (str) {\n var i, components, line, lines;\n components = [];\n\n lines = Wkt.trim(str).split(this.regExes.doubleParenComma);\n if (lines.length === 1) { // If that didn't work...\n lines = Wkt.trim(str).split(this.regExes.parenComma);\n }\n\n for (i = 0; i < lines.length; i += 1) {\n line = lines[i].replace(this.regExes.trimParens, '$1');\n components.push(this.ingest.linestring.apply(this, [line]));\n }\n\n return components;\n },\n\n /**\n * Return a polygon feature given a polygon WKT fragment.\n * @param str {String} A WKT fragment representing the polygon\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n polygon: function (str) {\n var i, j, components, subcomponents, ring, rings;\n rings = Wkt.trim(str).split(this.regExes.parenComma);\n components = []; // Holds one or more rings\n for (i = 0; i < rings.length; i += 1) {\n ring = rings[i].replace(this.regExes.trimParens, '$1').split(this.regExes.comma);\n subcomponents = []; // Holds the outer ring and any inner rings (holes)\n for (j = 0; j < ring.length; j += 1) {\n // Split on the empty space or '+' character (between coordinates)\n var split = ring[j].split(this.regExes.spaces);\n if (split.length > 2) {\n //remove the elements which are blanks\n split = split.filter(function (n) {\n return n != \"\"\n });\n }\n if (split.length === 2) {\n var x_cord = split[0];\n var y_cord = split[1];\n\n //now push\n subcomponents.push({\n x: parseFloat(x_cord),\n y: parseFloat(y_cord)\n });\n }\n }\n components.push(subcomponents);\n }\n return components;\n },\n\n /**\n * Return box vertices (which would become the Rectangle bounds) given a Box WKT fragment.\n * @param str {String} A WKT fragment representing the box\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n box: function (str) {\n var i, multipoints, components;\n\n // In our x-and-y representation of components, parsing\n // multipoints is the same as parsing linestrings\n multipoints = this.ingest.multipoint.apply(this, [str]);\n\n // However, the points need to be joined\n components = [];\n for (i = 0; i < multipoints.length; i += 1) {\n components = components.concat(multipoints[i]);\n }\n\n return components;\n },\n\n /**\n * Return a multipolygon feature given a multipolygon WKT fragment.\n * @param str {String} A WKT fragment representing the multipolygon\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n multipolygon: function (str) {\n var i, components, polygon, polygons;\n components = [];\n polygons = Wkt.trim(str).split(this.regExes.doubleParenComma);\n for (i = 0; i < polygons.length; i += 1) {\n polygon = polygons[i].replace(this.regExes.trimParens, '$1');\n components.push(this.ingest.polygon.apply(this, [polygon]));\n }\n return components;\n },\n\n /**\n * Return an array of features given a geometrycollection WKT fragment.\n * @param str {String} A WKT fragment representing the geometry collection\n * @memberof this.Wkt.Wkt.ingest\n * @instance\n */\n geometrycollection: function (str) {\n console.log('The geometrycollection WKT type is not yet supported.');\n }\n\n }; // eo ingest\n\n return Wkt;\n}));","/** @license\n *\n * Copyright (C) 2012 K. Arthur Endsley (kaendsle@mtu.edu)\n * Michigan Tech Research Institute (MTRI)\n * 3600 Green Court, Suite 100, Ann Arbor, MI, 48105\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n *\n */\n(function (Wkt) {\n\n /**\n * @augments Wkt.Wkt\n * A framework-dependent flag, set for each Wkt.Wkt() instance, that indicates\n * whether or not a closed polygon geometry should be interpreted as a rectangle.\n */\n Wkt.Wkt.prototype.isRectangle = false;\n\n /**\n * @augments Wkt.Wkt\n * An object of framework-dependent construction methods used to generate\n * objects belonging to the various geometry classes of the framework.\n */\n Wkt.Wkt.prototype.construct = {\n /**\n * Creates the framework's equivalent point geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @param component {Object} An optional component to build from\n * @return {google.maps.Marker}\n */\n point: function (config, component) {\n var c = component || this.components;\n\n config = config || {};\n\n config.position = new google.maps.LatLng(c[0].y, c[0].x);\n\n return new google.maps.Marker(config);\n },\n\n /**\n * Creates the framework's equivalent multipoint geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @return {Array} Array containing multiple google.maps.Marker\n */\n multipoint: function (config) {\n var i, c, arr;\n\n c = this.components;\n\n config = config || {};\n\n arr = [];\n\n for (i = 0; i < c.length; i += 1) {\n arr.push(this.construct.point(config, c[i]));\n }\n\n return arr;\n },\n\n /**\n * Creates the framework's equivalent linestring geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @param component {Object} An optional component to build from\n * @return {google.maps.Polyline}\n */\n linestring: function (config, component) {\n var i, c;\n\n c = component || this.components;\n\n config = config || {\n editable: false\n };\n\n config.path = [];\n\n for (i = 0; i < c.length; i += 1) {\n config.path.push(new google.maps.LatLng(c[i].y, c[i].x));\n }\n\n return new google.maps.Polyline(config);\n },\n\n /**\n * Creates the framework's equivalent multilinestring geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @return {Array} Array containing multiple google.maps.Polyline instances\n */\n multilinestring: function (config) {\n var i, c, arr;\n\n c = this.components;\n\n config = config || {\n editable: false\n };\n\n config.path = [];\n\n arr = [];\n\n for (i = 0; i < c.length; i += 1) {\n arr.push(this.construct.linestring(config, c[i]));\n }\n\n return arr;\n },\n\n /**\n * Creates the framework's equivalent Box or Rectangle geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @param component {Object} An optional component to build from\n * @return {google.maps.Rectangle}\n */\n box: function (config, component) {\n var c = component || this.components;\n\n config = config || {};\n\n config.bounds = new google.maps.LatLngBounds(\n new google.maps.LatLng(c[0].y, c[0].x),\n new google.maps.LatLng(c[1].y, c[1].x));\n\n return new google.maps.Rectangle(config);\n },\n\n /**\n * Creates the framework's equivalent polygon geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @param component {Object} An optional component to build from\n * @return {google.maps.Polygon}\n */\n polygon: function (config, component) {\n var j, k, c, rings, verts;\n\n var polygonIsClockwise = function (coords) {\n var area = 0,\n j = null,\n i = 0;\n\n for (i = 0; i < coords.length; i++) {\n j = (i + 1) % coords.length;\n area += coords[i].x * coords[j].x;\n area -= coords[j].y * coords[i].y;\n }\n\n return area > 0;\n };\n\n c = component || this.components;\n\n config = config || {\n editable: false // Editable geometry off by default\n };\n\n config.paths = [];\n\n rings = [];\n for (j = 0; j < c.length; j += 1) { // For each ring...\n\n verts = [];\n // NOTE: We iterate to one (1) less than the Array length to skip the last vertex\n for (k = 0; k < c[j].length - 1; k += 1) { // For each vertex...\n verts.push(new google.maps.LatLng(c[j][k].y, c[j][k].x));\n\n } // eo for each vertex\n\n if (j !== 0) {\n // Orient inner rings correctly\n if (polygonIsClockwise(c[j]) && this.type == 'polygon') {\n verts.reverse();\n }\n }\n\n rings.push(verts);\n } // eo for each ring\n\n config.paths = config.paths.concat(rings);\n\n if (this.isRectangle) {\n return (function () {\n var bounds, v;\n\n bounds = new google.maps.LatLngBounds();\n\n for (v in rings[0]) { // Ought to be only 1 ring in a Rectangle\n if (rings[0].hasOwnProperty(v)) {\n bounds.extend(rings[0][v]);\n }\n }\n\n return new google.maps.Rectangle({\n bounds: bounds\n });\n }());\n } else {\n return new google.maps.Polygon(config);\n }\n },\n\n /**\n * Creates the framework's equivalent multipolygon geometry object.\n * @param config {Object} An optional properties hash the object should use\n * @return {Array} Array containing multiple google.maps.Polygon\n */\n multipolygon: function (config) {\n var i, c, arr;\n\n c = this.components;\n\n config = config || {\n editable: false\n };\n\n config.path = [];\n\n arr = [];\n\n for (i = 0; i < c.length; i += 1) {\n arr.push(this.construct.polygon(config, c[i]));\n }\n\n return arr;\n }\n\n };\n\n /**\n * @augments Wkt.Wkt\n * A framework-dependent deconstruction method used to generate internal\n * geometric representations from instances of framework geometry. This method\n * uses object detection to attempt to classify members of framework geometry\n * classes into the standard WKT types.\n * @param obj {Object} An instance of one of the framework's geometry classes\n * @param multiFlag {Boolean} If true, then the deconstructor will be forced to return a MultiGeometry (multipoint, multilinestring or multipolygon)\n * @return {Object} A hash of the 'type' and 'components' thus derived, plus the WKT string of the feature.\n */\n Wkt.Wkt.prototype.deconstruct = function (obj, multiFlag) {\n var features, i, j, multiFlag, verts, rings, sign, tmp, response, lat, lng;\n\n // Shortcut to signed area function (determines clockwise vs counter-clock)\n if (google.maps.geometry) {\n sign = google.maps.geometry.spherical.computeSignedArea;\n };\n\n // google.maps.LatLng //////////////////////////////////////////////////////\n if (obj.constructor === google.maps.LatLng) {\n\n response = {\n type: 'point',\n components: [{\n x: obj.lng(),\n y: obj.lat()\n }]\n };\n return response;\n }\n\n // google.maps.Point //////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Point) {\n response = {\n type: 'point',\n components: [{\n x: obj.x,\n y: obj.y\n }]\n };\n return response;\n }\n\n // google.maps.Marker //////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Marker) {\n response = {\n type: 'point',\n components: [{\n x: obj.getPosition().lng(),\n y: obj.getPosition().lat()\n }]\n };\n return response;\n }\n\n // google.maps.Polyline ////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Polyline) {\n\n verts = [];\n for (i = 0; i < obj.getPath().length; i += 1) {\n tmp = obj.getPath().getAt(i);\n verts.push({\n x: tmp.lng(),\n y: tmp.lat()\n });\n }\n response = {\n type: 'linestring',\n components: verts\n };\n return response;\n\n }\n\n // google.maps.Polygon /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Polygon) {\n\n rings = [];\n\n if (multiFlag === undefined) {\n multiFlag = (function () {\n var areas, i, l;\n\n l = obj.getPaths().length;\n if (l <= 1) { // Trivial; this is a single polygon\n return false;\n }\n\n if (l === 2) {\n // If clockwise*clockwise or counter*counter, i.e.\n // (-1)*(-1) or (1)*(1), then result would be positive\n if (sign(obj.getPaths().getAt(0)) * sign(obj.getPaths().getAt(1)) < 0) {\n return false; // Most likely single polygon with 1 hole\n }\n\n return true;\n }\n\n // Must be longer than 3 polygons at this point...\n areas = obj.getPaths().getArray().map(function (k) {\n return sign(k) / Math.abs(sign(k)); // Unit normalization (outputs 1 or -1)\n });\n\n // If two clockwise or two counter-clockwise rings are found\n // (at different indices)...\n if (areas.indexOf(areas[0]) !== areas.lastIndexOf(areas[0])) {\n multiFlag = true; // Flag for holes in one or more polygons\n return true;\n }\n\n return false;\n\n }());\n }\n\n for (i = 0; i < obj.getPaths().length; i += 1) { // For each polygon (ring)...\n tmp = obj.getPaths().getAt(i);\n verts = [];\n for (j = 0; j < obj.getPaths().getAt(i).length; j += 1) { // For each vertex...\n verts.push({\n x: tmp.getAt(j).lng(),\n y: tmp.getAt(j).lat()\n });\n\n }\n\n if (!tmp.getAt(tmp.length - 1).equals(tmp.getAt(0))) {\n if (i % 2 !== 0) { // In inner rings, coordinates are reversed...\n verts.unshift({ // Add the first coordinate again for closure\n x: tmp.getAt(tmp.length - 1).lng(),\n y: tmp.getAt(tmp.length - 1).lat()\n });\n\n } else {\n verts.push({ // Add the first coordinate again for closure\n x: tmp.getAt(0).lng(),\n y: tmp.getAt(0).lat()\n });\n\n }\n\n }\n\n if (obj.getPaths().length > 1 && i > 0) {\n // If this and the last ring have the same signs...\n if (sign(obj.getPaths().getAt(i)) > 0 && sign(obj.getPaths().getAt(i - 1)) > 0 ||\n sign(obj.getPaths().getAt(i)) < 0 && sign(obj.getPaths().getAt(i - 1)) < 0 && !multiFlag) {\n // ...They must both be inner rings (or both be outer rings, in a multipolygon)\n verts = [verts]; // Wrap multipolygons once more (collection)\n }\n\n }\n\n //TODO This makes mistakes when a second polygon has holes; it sees them all as individual polygons\n if (i % 2 !== 0) { // In inner rings, coordinates are reversed...\n verts.reverse();\n }\n rings.push(verts);\n }\n\n response = {\n type: (multiFlag) ? 'multipolygon' : 'polygon',\n components: rings\n };\n return response;\n\n }\n\n // google.maps.Circle //////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Circle) {\n var point = obj.getCenter();\n var radius = obj.getRadius();\n verts = [];\n var d2r = Math.PI / 180; // degrees to radians\n var r2d = 180 / Math.PI; // radians to degrees\n radius = radius / 1609; // meters to miles\n var earthsradius = 3963; // 3963 is the radius of the earth in miles\n var num_seg = 32; // number of segments used to approximate a circle\n var rlat = (radius / earthsradius) * r2d;\n var rlng = rlat / Math.cos(point.lat() * d2r);\n\n for (var n = 0; n <= num_seg; n++) {\n var theta = Math.PI * (n / (num_seg / 2));\n lng = point.lng() + (rlng * Math.cos(theta)); // center a + radius x * cos(theta)\n lat = point.lat() + (rlat * Math.sin(theta)); // center b + radius y * sin(theta)\n verts.push({\n x: lng,\n y: lat\n });\n }\n\n response = {\n type: 'polygon',\n components: [verts]\n };\n\n return response;\n\n }\n\n // google.maps.LatLngBounds ///////////////////////////////////////////////////\n if (obj.constructor === google.maps.LatLngBounds) {\n\n tmp = obj;\n verts = [];\n verts.push({ // NW corner\n x: tmp.getSouthWest().lng(),\n y: tmp.getNorthEast().lat()\n });\n\n verts.push({ // NE corner\n x: tmp.getNorthEast().lng(),\n y: tmp.getNorthEast().lat()\n });\n\n verts.push({ // SE corner\n x: tmp.getNorthEast().lng(),\n y: tmp.getSouthWest().lat()\n });\n\n verts.push({ // SW corner\n x: tmp.getSouthWest().lng(),\n y: tmp.getSouthWest().lat()\n });\n\n verts.push({ // NW corner (again, for closure)\n x: tmp.getSouthWest().lng(),\n y: tmp.getNorthEast().lat()\n });\n\n\n response = {\n type: 'polygon',\n isRectangle: true,\n components: [verts]\n };\n\n return response;\n\n }\n\n // google.maps.Rectangle ///////////////////////////////////////////////////\n if (obj.constructor === google.maps.Rectangle) {\n\n tmp = obj.getBounds();\n verts = [];\n verts.push({ // NW corner\n x: tmp.getSouthWest().lng(),\n y: tmp.getNorthEast().lat()\n });\n\n verts.push({ // NE corner\n x: tmp.getNorthEast().lng(),\n y: tmp.getNorthEast().lat()\n });\n\n verts.push({ // SE corner\n x: tmp.getNorthEast().lng(),\n y: tmp.getSouthWest().lat()\n });\n\n verts.push({ // SW corner\n x: tmp.getSouthWest().lng(),\n y: tmp.getSouthWest().lat()\n });\n\n verts.push({ // NW corner (again, for closure)\n x: tmp.getSouthWest().lng(),\n y: tmp.getNorthEast().lat()\n });\n\n\n response = {\n type: 'polygon',\n isRectangle: true,\n components: [verts]\n };\n\n return response;\n\n }\n\n // google.maps.Data Geometry Types /////////////////////////////////////////////////////\n\n // google.maps.Data.Feature /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.Feature) {\n return this.deconstruct.call(this, obj.getGeometry());\n }\n\n // google.maps.Data.Point /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.Point) {\n //console.log('It is a google.maps.Data.Point');\n response = {\n type: 'point',\n components: [{\n x: obj.get().lng(),\n y: obj.get().lat()\n }]\n };\n return response;\n }\n\n // google.maps.Data.LineString /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.LineString) {\n verts = [];\n //console.log('It is a google.maps.Data.LineString');\n for (i = 0; i < obj.getLength(); i += 1) {\n vertex = obj.getAt(i);\n verts.push({\n x: vertex.lng(),\n y: vertex.lat()\n });\n }\n response = {\n type: 'linestring',\n components: verts\n };\n return response;\n }\n\n\n\n\n // google.maps.Data.Polygon /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.Polygon) {\n var rings = [];\n //console.log('It is a google.maps.Data.Polygon');\n for (i = 0; i < obj.getLength(); i += 1) { // For each ring...\n ring = obj.getAt(i);\n var verts = [];\n for (j = 0; j < ring.getLength(); j += 1) { // For each vertex...\n vertex = ring.getAt(j);\n verts.push({\n x: vertex.lng(),\n y: vertex.lat()\n });\n }\n verts.push({\n x: ring.getAt(0).lng(),\n y: ring.getAt(0).lat()\n });\n\n rings.push(verts);\n }\n response = {\n type: 'polygon',\n components: rings\n };\n\n return response;\n }\n\n\n // google.maps.Data.MultiPoint /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.MultiPoint) {\n verts = [];\n for (i = 0; i < obj.getLength(); i += 1) {\n vertex = obj.getAt(i);\n verts.push([{\n x: vertex.lng(),\n y: vertex.lat()\n }]);\n }\n response = {\n type: 'multipoint',\n components: verts\n };\n return response;\n }\n\n // google.maps.Data.MultiLineString /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.MultiLineString) {\n linestrings = []\n for (i = 0; i < obj.getLength(); i += 1) {\n verts = [];\n var linestring = obj.getAt(i);\n for (j = 0; j < linestring.getLength(); j += 1) {\n vertex = linestring.getAt(j);\n verts.push({\n x: vertex.lng(),\n y: vertex.lat()\n });\n }\n linestrings.push(verts);\n }\n response = {\n type: 'multilinestring',\n components: linestrings\n };\n return response;\n }\n\n // google.maps.Data.MultiPolygon /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.MultiPolygon) {\n\n var polygons = [];\n\n //console.log('It is a google.maps.Data.MultiPolygon');\n for (k = 0; k < obj.getLength(); k += 1) { // For each multipolygon\n var polygon = obj.getAt(k);\n var rings = [];\n for (i = 0; i < polygon.getLength(); i += 1) { // For each ring...\n ring = polygon.getAt(i);\n var verts = [];\n for (j = 0; j < ring.getLength(); j += 1) { // For each vertex...\n vertex = ring.getAt(j);\n verts.push({\n x: vertex.lng(),\n y: vertex.lat()\n });\n }\n verts.push({\n x: ring.getAt(0).lng(),\n y: ring.getAt(0).lat()\n });\n\n rings.push(verts);\n }\n polygons.push(rings);\n }\n\n response = {\n type: 'multipolygon',\n components: polygons\n };\n return response;\n }\n\n // google.maps.Data.GeometryCollection /////////////////////////////////////////////////////\n if (obj.constructor === google.maps.Data.GeometryCollection) {\n\n var objects = [];\n for (k = 0; k < obj.getLength(); k += 1) { // For each multipolygon\n var object = obj.getAt(k);\n objects.push(this.deconstruct.call(this, object));\n }\n //console.log('It is a google.maps.Data.GeometryCollection', objects);\n response = {\n type: 'geometrycollection',\n components: objects\n };\n return response;\n }\n\n\n // Array ///////////////////////////////////////////////////////////////////\n if (Wkt.isArray(obj)) {\n features = [];\n\n for (i = 0; i < obj.length; i += 1) {\n features.push(this.deconstruct.call(this, obj[i], true));\n }\n\n response = {\n\n type: (function () {\n var k, type = obj[0].constructor;\n\n for (k = 0; k < obj.length; k += 1) {\n // Check that all items have the same constructor as the first item\n if (obj[k].constructor !== type) {\n // If they don't, type is heterogeneous geometry collection\n return 'geometrycollection';\n }\n }\n\n switch (type) {\n case google.maps.Marker:\n return 'multipoint';\n case google.maps.Polyline:\n return 'multilinestring';\n case google.maps.Polygon:\n return 'multipolygon';\n default:\n return 'geometrycollection';\n }\n\n }()),\n components: (function () {\n // Pluck the components from each Wkt\n var i, comps;\n\n comps = [];\n for (i = 0; i < features.length; i += 1) {\n if (features[i].components) {\n comps.push(features[i].components);\n }\n }\n\n return {\n comps: comps\n };\n }())\n\n };\n response.components = response.components.comps;\n return response;\n\n }\n\n console.log('The passed object does not have any recognizable properties.');\n\n };\n}(Wkt || require('./wicket')));"]}