Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
4 righe
17 KiB
4 righe
17 KiB
2 anni fa
|
/*! Terraformer JS - 1.1.2 - 2016-08-17
|
||
|
* https://github.com/esri/terraformer-wkt-parser
|
||
|
* Copyright (c) 2016 Esri, Inc.
|
||
|
* Licensed MIT */!function(a,b){if("object"==typeof module&&"object"==typeof module.exports)exports=module.exports=b(require("terraformer"));else if("object"==typeof navigator){if(!a.Terraformer)throw new Error("Terraformer.WKT requires the core Terraformer library. http://github.com/esri/terraformer");a.Terraformer.WKT=b(a.Terraformer)}}(this,function(a){function b(a){this.data=[a],this.type="PointArray"}function c(a){this.data=a,this.type="Ring"}function d(a){this.data=[a],this.type="RingList"}function e(a){this.data=[a],this.type="PolygonList"}function f(b){var c;try{c=p.parse(b)}catch(d){throw Error("Unable to parse: "+d)}return a.Primitive(c)}function g(a){for(var b=[],c="",d=0;d<a.length;d++)b.push(a[d].join(" "));return c+="("+b.join(", ")+")"}function h(a){var b="POINT ";return void 0===a.coordinates||0===a.coordinates.length?b+="EMPTY":(3===a.coordinates.length?b+=a.properties&&a.properties.m===!0?"M ":"Z ":4===a.coordinates.length&&(b+="ZM "),b+="("+a.coordinates.join(" ")+")")}function i(a){var b="LINESTRING ";return void 0===a.coordinates||0===a.coordinates.length||0===a.coordinates[0].length?b+="EMPTY":(3===a.coordinates[0].length?b+=a.properties&&a.properties.m===!0?"M ":"Z ":4===a.coordinates[0].length&&(b+="ZM "),b+=g(a.coordinates))}function j(a){var b="POLYGON ";if(void 0===a.coordinates||0===a.coordinates.length||0===a.coordinates[0].length)return b+="EMPTY";3===a.coordinates[0][0].length?b+=a.properties&&a.properties.m===!0?"M ":"Z ":4===a.coordinates[0][0].length&&(b+="ZM "),b+="(";for(var c=[],d=0;d<a.coordinates.length;d++)c.push(g(a.coordinates[d]));return b+=c.join(", "),b+=")"}function k(a){var b="MULTIPOINT ";return void 0===a.coordinates||0===a.coordinates.length||0===a.coordinates[0].length?b+="EMPTY":(3===a.coordinates[0].length?b+=a.properties&&a.properties.m===!0?"M ":"Z ":4===a.coordinates[0].length&&(b+="ZM "),b+=g(a.coordinates))}function l(a){var b="MULTILINESTRING ";if(void 0===a.coordinates||0===a.coordinates.length||0===a.coordinates[0].length)return b+="EMPTY";3===a.coordinates[0][0].length?b+=a.properties&&a.properties.m===!0?"M ":"Z ":4===a.coordinates[0][0].length&&(b+="ZM "),b+="(";for(var c=[],d=0;d<a.coordinates.length;d++)c.push(g(a.coordinates[d]));return b+=c.join(", "),b+=")"}function m(a){var b="MULTIPOLYGON ";if(void 0===a.coordinates||0===a.coordinates.length||0===a.coordinates[0].length)return b+="EMPTY";3===a.coordinates[0][0][0].length?b+=a.properties&&a.properties.m===!0?"M ":"Z ":4===a.coordinates[0][0][0].length&&(b+="ZM "),b+="(";for(var c=[],d=0;d<a.coordinates.length;d++){for(var e="(",f=[],h=0;h<a.coordinates[d].length;h++)f.push(g(a.coordinates[d][h]));e+=f.join(", "),e+=")",c.push(e)}return b+=c.join(", "),b+=")"}function n(a){switch(a.type){case"Point":return h(a);case"LineString":return i(a);case"Polygon":return j(a);case"MultiPoint":return k(a);case"MultiLineString":return l(a);case"MultiPolygon":return m(a);default:throw Error("Unknown Type: "+a.type)}}var o={},p=function(){function a(){this.yy={}}var f={trace:function(){},yy:{},symbols_:{error:2,expressions:3,point:4,EOF:5,linestring:6,polygon:7,multipoint:8,multilinestring:9,multipolygon:10,coordinate:11,DOUBLE_TOK:12,ptarray:13,COMMA:14,ring_list:15,ring:16,"(":17,")":18,POINT:19,Z:20,ZM:21,M:22,EMPTY:23,point_untagged:24,polygon_list:25,polygon_untagged:26,point_list:27,LINESTRING:28,POLYGON:29,MULTIPOINT:30,MULTILINESTRING:31,MULTIPOLYGON:32,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"DOUBLE_TOK",14:"COMMA",17:"(",18:")",19:"POINT",20:"Z",21:"ZM",22:"M",23:"EMPTY",28:"LINESTRING",29:"POLYGON",30:"MULTIPOINT",31:"MULTILINESTRING",32:"MULTIPOLYGON"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[11,2],[11,3],[11,4],[13,3],[13,1],[15,3],[15,1],[16,3],[4,4],[4,5],[4,5],[4,5],[4,2],[24,1],[24,3],[25,3],[25,1],[26,3],[27,3],[27,1],[6,4],[6,5],[6,5],[6,5],[6,2],[7,4],[7,5],[7,5],[7,5],[7,2],[8,4],[8,5],[8,5],[8,5],[8,2],[9,4],[9,5],[9,5],[9,5],[9,2],[10,4],[10,5],[10,5],[10,5],[10,2]],performAction:function(a,f,g,h,i,j,k){var l=j.length-1;switch(i){case 1:return j[l-1];case 2:return j[l-1
|