From ec276bb3ca7bb0f3ae38f5227fb69f672d4ccf87 Mon Sep 17 00:00:00 2001 From: Gagan Bansal Date: Wed, 12 Aug 2015 05:50:48 -0400 Subject: [PATCH] rebuild dist --- dist/geojson2svg.js | 3 ++- dist/geojson2svg.js.map | 4 ++-- dist/geojson2svg.min.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/geojson2svg.js b/dist/geojson2svg.js index 1191270..386f3cc 100644 --- a/dist/geojson2svg.js +++ b/dist/geojson2svg.js @@ -247,7 +247,8 @@ g2svg.prototype.convertFeature = function(feature,options) { if(!feature && !feature.geometry) return; var opt = merge(merge({},this.options), options || {}); opt.attributes = opt.attributes || {}; - opt.attributes.id = opt.attributes.id || feature.id || null; + opt.attributes.id = opt.attributes.id || feature.id || + (feature.properties && feature.properties.id ? feature.properties.id : null); return this.convertGeometry(feature.geometry,opt); }; g2svg.prototype.convertGeometry = function(geom,options) { diff --git a/dist/geojson2svg.js.map b/dist/geojson2svg.js.map index 2e63420..f436204 100644 --- a/dist/geojson2svg.js.map +++ b/dist/geojson2svg.js.map @@ -9,7 +9,7 @@ "/home/gaganb/projects/geojson2svg/src/main.js" ], "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5HA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ @@ -17,7 +17,7 @@ "(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define(factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.deepmerge = factory();\n }\n}(this, function () {\n\nreturn function deepmerge(target, src) {\n var array = Array.isArray(src);\n var dst = array && [] || {};\n\n if (array) {\n target = target || [];\n dst = dst.concat(target);\n src.forEach(function(e, i) {\n if (typeof dst[i] === 'undefined') {\n dst[i] = e;\n } else if (typeof e === 'object') {\n dst[i] = deepmerge(target[i], e);\n } else {\n if (target.indexOf(e) === -1) {\n dst.push(e);\n }\n }\n });\n } else {\n if (target && typeof target === 'object') {\n Object.keys(target).forEach(function (key) {\n dst[key] = target[key];\n })\n }\n Object.keys(src).forEach(function (key) {\n if (typeof src[key] !== 'object' || !src[key]) {\n dst[key] = src[key];\n }\n else {\n if (!target[key]) {\n dst[key] = src[key];\n } else {\n dst[key] = deepmerge(target[key], src[key]);\n }\n }\n });\n }\n\n return dst;\n}\n\n}));\n", "//index.js \n(function() { \n\tvar singles = ['Point', 'LineString', 'Polygon'];\n\tvar multies = ['MultiPoint', 'MultiLineString', 'MultiPolygon'];\n\tfunction explode(g) {\n\t if( multies.indexOf(g.type) > -1) {\n\t return g.coordinates.map(function(part) {\n\t var single = {};\n\t single.type = g.type.replace('Multi','');\n\t single.coordinates = part;\n if(g.crs) single.crs = g.crs;\n\t return single;\n\t }); \n\t } else {\n\t return false;\n\t }\n\t}\n\tfunction implode(gs) {\n\t var sameType = gs.every(function(g) { \n\t return singles.indexOf(g.type) > -1;\n\t })\n var crs = gs[0].crs || 0;\n var sameCrs = gs.every(function(g) {\n var gcrs = g.crs || 0;\n return gcrs == crs;\n });\n\t if(sameType && sameCrs) {\n\t var multi = {};\n\t multi.type = 'Multi' + gs[0].type;\n\t multi.coordinates = [];\n if(crs != 0) multi.crs = crs;\n\t gs.forEach(function(g) {\n\t multi.coordinates.push(g.coordinates);\n\t });\n\t return multi;\n\t } else {\n\t return false;\n\t }\n\t};\n\tvar multigeojson = {\n\t explode: explode,\n\t implode: implode\n\t};\n\tif(typeof module !== 'undefined' && module.exports) {\n\t module.exports = multigeojson;\n\t} else if(window) {\n\t window.multigeojson = multigeojson;\n\t}\n})();\n", "//converter.js\nvar multi = require('multigeojson');\nfunction getCoordString(coords,res,origin) {\n //origin - svg image origin \n var coordStr = coords.map(function(coord) {\n return (coord[0] - origin.x)/res + ',' + (origin.y - coord[1])/res;\n });\n return coordStr.join(' ');\n}\nfunction addAttributes(ele,attributes) {\n var part = ele.split('/>')[0];\n for(var key in attributes) {\n if(attributes[key]) {\n part += ' ' + key + '=\"' + attributes[key] + '\"';\n }\n }\n return part + ' />';\n}\n\nfunction point(geom,res,origin,opt) {\n var r = opt && opt.r ? opt.r : 1;\n var path = 'M' + getCoordString([geom.coordinates],res,origin)\n +' m'+ -r+ ',0'+ ' a'+r+','+ r + ' 0 1,1 '+ 2*r + ','+0\n +' a'+r+','+ r + ' 0 1,1 '+ -2*r + ','+0;\n return [path];\n}\nfunction multiPoint(geom,res,origin,opt) {\n var explode = opt && opt.hasOwnProperty('explode') ? opt.explode : false;\n var paths = multi.explode(geom).map(function(single) {\n return point(single,res,origin,opt)[0];\n });\n if(!explode) return [paths.join(' ')];\n return paths;\n\n}\nfunction lineString(geom,res,origin,otp) {\n var coords = getCoordString(geom.coordinates,res,origin);\n var path = 'M'+ coords; \n return [path];\n}\nfunction multiLineString(geom,res,origin,opt) {\n var explode = opt && opt.hasOwnProperty('explode') ? opt.explode : false;\n var paths = multi.explode(geom).map(function(single) {\n return lineString(single,res,origin,opt)[0];\n });\n if(!explode) return [paths.join(' ')];\n return paths;\n}\nfunction polygon(geom,res,origin,opt) {\n var mainStr,holes,holeStr;\n mainStr = getCoordString(geom.coordinates[0],res,origin);\n if (geom.coordinates.length > 1) {\n holes = geom.coordinates.slice(1,geom.coordinates.length);\n }\n var path = 'M'+ mainStr;\n if(holes) {\n for(var i=0;i-1?g.coordinates.map(function(part){var single={};return single.type=g.type.replace("Multi",""),single.coordinates=part,g.crs&&(single.crs=g.crs),single}):!1}function implode(gs){var sameType=gs.every(function(g){return singles.indexOf(g.type)>-1}),crs=gs[0].crs||0,sameCrs=gs.every(function(g){var gcrs=g.crs||0;return gcrs==crs});if(sameType&&sameCrs){var multi={};return multi.type="Multi"+gs[0].type,multi.coordinates=[],0!=crs&&(multi.crs=crs),gs.forEach(function(g){multi.coordinates.push(g.coordinates)}),multi}return!1}var singles=["Point","LineString","Polygon"],multies=["MultiPoint","MultiLineString","MultiPolygon"],multigeojson={explode:explode,implode:implode};"undefined"!=typeof module&&module.exports?module.exports=multigeojson:window&&(window.multigeojson=multigeojson)}()},{}],3:[function(require,module,exports){function getCoordString(coords,res,origin){var coordStr=coords.map(function(coord){return(coord[0]-origin.x)/res+","+(origin.y-coord[1])/res});return coordStr.join(" ")}function point(geom,res,origin,opt){var r=opt&&opt.r?opt.r:1,path="M"+getCoordString([geom.coordinates],res,origin)+" m"+-r+",0 a"+r+","+r+" 0 1,1 "+2*r+",0 a"+r+","+r+" 0 1,1 "+-2*r+",0";return[path]}function multiPoint(geom,res,origin,opt){var explode=opt&&opt.hasOwnProperty("explode")?opt.explode:!1,paths=multi.explode(geom).map(function(single){return point(single,res,origin,opt)[0]});return explode?paths:[paths.join(" ")]}function lineString(geom,res,origin,otp){var coords=getCoordString(geom.coordinates,res,origin),path="M"+coords;return[path]}function multiLineString(geom,res,origin,opt){var explode=opt&&opt.hasOwnProperty("explode")?opt.explode:!1,paths=multi.explode(geom).map(function(single){return lineString(single,res,origin,opt)[0]});return explode?paths:[paths.join(" ")]}function polygon(geom,res,origin,opt){var mainStr,holes;mainStr=getCoordString(geom.coordinates[0],res,origin),geom.coordinates.length>1&&(holes=geom.coordinates.slice(1,geom.coordinates.length));var path="M"+mainStr;if(holes)for(var i=0;i-1?g.coordinates.map(function(part){var single={};return single.type=g.type.replace("Multi",""),single.coordinates=part,g.crs&&(single.crs=g.crs),single}):!1}function implode(gs){var sameType=gs.every(function(g){return singles.indexOf(g.type)>-1}),crs=gs[0].crs||0,sameCrs=gs.every(function(g){var gcrs=g.crs||0;return gcrs==crs});if(sameType&&sameCrs){var multi={};return multi.type="Multi"+gs[0].type,multi.coordinates=[],0!=crs&&(multi.crs=crs),gs.forEach(function(g){multi.coordinates.push(g.coordinates)}),multi}return!1}var singles=["Point","LineString","Polygon"],multies=["MultiPoint","MultiLineString","MultiPolygon"],multigeojson={explode:explode,implode:implode};"undefined"!=typeof module&&module.exports?module.exports=multigeojson:window&&(window.multigeojson=multigeojson)}()},{}],3:[function(require,module,exports){function getCoordString(coords,res,origin){var coordStr=coords.map(function(coord){return(coord[0]-origin.x)/res+","+(origin.y-coord[1])/res});return coordStr.join(" ")}function point(geom,res,origin,opt){var r=opt&&opt.r?opt.r:1,path="M"+getCoordString([geom.coordinates],res,origin)+" m"+-r+",0 a"+r+","+r+" 0 1,1 "+2*r+",0 a"+r+","+r+" 0 1,1 "+-2*r+",0";return[path]}function multiPoint(geom,res,origin,opt){var explode=opt&&opt.hasOwnProperty("explode")?opt.explode:!1,paths=multi.explode(geom).map(function(single){return point(single,res,origin,opt)[0]});return explode?paths:[paths.join(" ")]}function lineString(geom,res,origin,otp){var coords=getCoordString(geom.coordinates,res,origin),path="M"+coords;return[path]}function multiLineString(geom,res,origin,opt){var explode=opt&&opt.hasOwnProperty("explode")?opt.explode:!1,paths=multi.explode(geom).map(function(single){return lineString(single,res,origin,opt)[0]});return explode?paths:[paths.join(" ")]}function polygon(geom,res,origin,opt){var mainStr,holes;mainStr=getCoordString(geom.coordinates[0],res,origin),geom.coordinates.length>1&&(holes=geom.coordinates.slice(1,geom.coordinates.length));var path="M"+mainStr;if(holes)for(var i=0;i