{"size": 4277, "ext": "js", "max_stars_repo_path": "ajax/libs/openlayers/2.12/lib/OpenLayers/Format/WKT.min.js", "max_stars_repo_name": "Versal/cdnjs", "max_stars_repo_stars_event_min_datetime": "2015-02-20T16:11:30.000Z", "max_stars_repo_stars_event_max_datetime": "2017-05-15T11:50:44.000Z", "max_issues_repo_path": "ajax/libs/openlayers/2.12/lib/OpenLayers/Format/WKT.min.js", "max_issues_repo_name": "kangax/cdnjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ajax/libs/openlayers/2.12/lib/OpenLayers/Format/WKT.min.js", "max_forks_repo_name": "kangax/cdnjs", "max_forks_repo_forks_event_min_datetime": "2015-07-14T16:16:05.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-10T08:15:54.000Z"}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 4277.0, "max_line_length": 4277, "alphanum_fraction": 0.714519523}
OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(e){this.regExes={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},OpenLayers.Format.prototype.initialize.apply(this,[e])},read:function(e){var t,i,n;e=e.replace(/[\n\r]/g," ");var r=this.regExes.typeStr.exec(e);if(r&&(i=r[1].toLowerCase(),n=r[2],this.parse[i]&&(t=this.parse[i].apply(this,[n])),this.internalProjection&&this.externalProjection))if(t&&"OpenLayers.Feature.Vector"==t.CLASS_NAME)t.geometry.transform(this.externalProjection,this.internalProjection);else if(t&&"geometrycollection"!=i&&"object"==typeof t)for(var o=0,s=t.length;s>o;o++){var a=t[o];a.geometry.transform(this.externalProjection,this.internalProjection)}return t},write:function(e){var t,i,n;e.constructor==Array?(t=e,n=!0):(t=[e],n=!1);var r=[];n&&r.push("GEOMETRYCOLLECTION(");for(var o=0,s=t.length;s>o;++o)n&&o>0&&r.push(","),i=t[o].geometry,r.push(this.extractGeometry(i));return n&&r.push(")"),r.join("")},extractGeometry:function(e){var t=e.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[t])return null;this.internalProjection&&this.externalProjection&&(e=e.clone(),e.transform(this.internalProjection,this.externalProjection));var i="collection"==t?"GEOMETRYCOLLECTION":t.toUpperCase(),n=i+"("+this.extract[t].apply(this,[e])+")";return n},extract:{point:function(e){return e.x+" "+e.y},multipoint:function(e){for(var t=[],i=0,n=e.components.length;n>i;++i)t.push("("+this.extract.point.apply(this,[e.components[i]])+")");return t.join(",")},linestring:function(e){for(var t=[],i=0,n=e.components.length;n>i;++i)t.push(this.extract.point.apply(this,[e.components[i]]));return t.join(",")},multilinestring:function(e){for(var t=[],i=0,n=e.components.length;n>i;++i)t.push("("+this.extract.linestring.apply(this,[e.components[i]])+")");return t.join(",")},polygon:function(e){for(var t=[],i=0,n=e.components.length;n>i;++i)t.push("("+this.extract.linestring.apply(this,[e.components[i]])+")");return t.join(",")},multipolygon:function(e){for(var t=[],i=0,n=e.components.length;n>i;++i)t.push("("+this.extract.polygon.apply(this,[e.components[i]])+")");return t.join(",")},collection:function(e){for(var t=[],i=0,n=e.components.length;n>i;++i)t.push(this.extractGeometry.apply(this,[e.components[i]]));return t.join(",")}},parse:{point:function(e){var t=OpenLayers.String.trim(e).split(this.regExes.spaces);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t[0],t[1]))},multipoint:function(e){for(var t,i=OpenLayers.String.trim(e).split(","),n=[],r=0,o=i.length;o>r;++r)t=i[r].replace(this.regExes.trimParens,"$1"),n.push(this.parse.point.apply(this,[t]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(n))},linestring:function(e){for(var t=OpenLayers.String.trim(e).split(","),i=[],n=0,r=t.length;r>n;++n)i.push(this.parse.point.apply(this,[t[n]]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(i))},multilinestring:function(e){for(var t,i=OpenLayers.String.trim(e).split(this.regExes.parenComma),n=[],r=0,o=i.length;o>r;++r)t=i[r].replace(this.regExes.trimParens,"$1"),n.push(this.parse.linestring.apply(this,[t]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(n))},polygon:function(e){for(var t,i,n,r=OpenLayers.String.trim(e).split(this.regExes.parenComma),o=[],s=0,a=r.length;a>s;++s)t=r[s].replace(this.regExes.trimParens,"$1"),i=this.parse.linestring.apply(this,[t]).geometry,n=new OpenLayers.Geometry.LinearRing(i.components),o.push(n);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(o))},multipolygon:function(e){for(var t,i=OpenLayers.String.trim(e).split(this.regExes.doubleParenComma),n=[],r=0,o=i.length;o>r;++r)t=i[r].replace(this.regExes.trimParens,"$1"),n.push(this.parse.polygon.apply(this,[t]).geometry);return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(n))},geometrycollection:function(e){e=e.replace(/,\s*([A-Za-z])/g,"|$1");for(var t=OpenLayers.String.trim(e).split("|"),i=[],n=0,r=t.length;r>n;++n)i.push(OpenLayers.Format.WKT.prototype.read.apply(this,[t[n]]));return i}},CLASS_NAME:"OpenLayers.Format.WKT"});