Skip to content
Browse files

refactored code and added dot grid maps

  • Loading branch information...
1 parent 9188cc5 commit 7328a893431772e1d285a2c9d48c081c039d9ebd @gka gka committed Feb 28, 2012
View
1 .gitignore
@@ -0,0 +1 @@
+_build
View
4 .watchr
@@ -1,3 +1,3 @@
-watch ( 'src/(.*)\.coffee' ) { |md| system("build.sh; node tests/test.#{md[1]}.js") }
+watch ( 'src/(.*)\.coffee' ) { |md| system("build.sh; ") }
watch ( 'src/colors/(.*)\.coffee' ) { |md| system("build.sh; node tests/test.#{md[1]}.js") }
-watch ( 'tests/test.(.*)\.js' ) { |md| system("node tests/test.#{md[1]}.js") }
+# watch ( 'tests/test.(.*)\.js' ) { |md| system("node tests/test.#{md[1]}.js") }
View
0 build/bbox.js → _build/bbox.js
File renamed without changes.
View
0 build/clipping.js → _build/clipping.js
File renamed without changes.
View
0 build/filter.js → _build/filter.js
File renamed without changes.
View
67 build/kartograph.js → _build/kartograph.js
@@ -105,7 +105,12 @@
left: '0px',
'z-index': lid + 5
});
- if (cnt.css('position') === 'static') cnt.css('position', 'relative');
+ if (cnt.css('position') === 'static') {
+ cnt.css({
+ position: 'relative',
+ height: vp.height + 'px'
+ });
+ }
svg.addClass(id);
about = $('desc', paper.canvas).text();
$('desc', paper.canvas).text(about.replace('with ', 'with kartograph ' + kartograph.version + ' and '));
@@ -284,66 +289,6 @@
return me.markers = [];
};
- Kartograph.prototype.choropleth = function(opts) {
- var anim, col, colors, data, data_col, data_key, delay, dur, id, layer_id, me, ncol, path, pathData, paths, pd, row, _i, _j, _len, _len2, _ref3, _ref4, _ref5;
- me = this;
- layer_id = (_ref3 = opts.layer) != null ? _ref3 : me.layerIds[me.layerIds.length - 1];
- if (!me.layers.hasOwnProperty(layer_id)) {
- warn('choropleth error: layer "' + layer_ihad + '" not found');
- return;
- }
- data = opts.data;
- data_col = opts.value;
- data_key = opts.key;
- colors = opts.colors;
- pathData = {};
- if ((data_key != null) && __type(data) === "array") {
- for (_i = 0, _len = data.length; _i < _len; _i++) {
- row = data[_i];
- id = row[data_key];
- pathData[String(id)] = row;
- }
- } else {
- for (id in data) {
- row = data[id];
- pathData[String(id)] = row;
- }
- }
- _ref4 = me.layers[layer_id].pathsById;
- for (id in _ref4) {
- paths = _ref4[id];
- for (_j = 0, _len2 = paths.length; _j < _len2; _j++) {
- path = paths[_j];
- pd = (_ref5 = pathData[id]) != null ? _ref5 : null;
- col = colors(pd);
- if (opts.duration != null) {
- if (__type(opts.duration) === "function") {
- dur = opts.duration(pd);
- } else {
- dur = opts.duration;
- }
- if (opts.delay != null) {
- if (__type(opts.delay) === 'function') {
- delay = opts.delay(pd);
- } else {
- delay = opts.delay;
- }
- } else {
- delay = 0;
- }
- ncol = colors(null);
- path.svgPath.attr('fill', ncol);
- anim = Raphael.animation({
- fill: col
- }, dur);
- path.svgPath.animate(anim.delay(delay));
- } else {
- path.svgPath.attr('fill', col);
- }
- }
- }
- };
-
Kartograph.prototype.tooltips = function(opts) {
var cfg, id, layer_id, me, path, paths, tooltips, tt, _ref3, _ref4, _results;
me = this;
View
0 build/lonlat.js → _build/lonlat.js
File renamed without changes.
View
0 build/marker.js → _build/marker.js
File renamed without changes.
View
0 build/panzoom.js → _build/panzoom.js
File renamed without changes.
View
0 build/parsecss.js → _build/parsecss.js
File renamed without changes.
View
0 build/path.js → _build/path.js
File renamed without changes.
View
0 build/proj.js → _build/proj.js
File renamed without changes.
View
0 build/view.js → _build/view.js
File renamed without changes.
View
6 build.sh
@@ -4,8 +4,8 @@
# builds all coffee script sources
# to one single minified js file
#
-coffee -o build/ src/*.coffee
-cat src/*.coffee | coffee -sp > tmp
+cat src/core/*.coffee | coffee -sp > tmp
+cat src/modules/*.coffee | coffee -sp >> tmp
cat src/license tmp > kartograph.js
rm tmp
uglifyjs kartograph.js > kartograph.min.js
@@ -18,4 +18,4 @@ echo "build complete"
cp dist/kartograph.* ~/Incubator/maps/unrefugee/his.locsis.com/js
cp dist/kartograph.* ~/Incubator/maps/kenya/demo/js/lib
cp dist/kartograph.* ~/Incubator/okfn/_yourtopia/italymap/
-cp dist/kartograph.* ~/Incubator/sketches/parteispenden-map/map/
+cp dist/kartograph.* ~/Incubator/libraries/kartograph/website/js/
View
4 dist/kartograph-chroma.min.js
2 additions, 2 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
470 dist/kartograph.js
@@ -40,7 +40,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
- var Aitoff, Azimuthal, BBox, Balthasart, Behrmann, BlurFilter, Bubble, CEA, CanvasLayer, Circle, CohenSutherland, Conic, Cylindrical, EckertIV, EquidistantAzimuthal, Equirectangular, Filter, GallPeters, GlowFilter, HoboDyer, HtmlLabel, Icon, Kartograph, LAEA, LCC, LatLon, Line, LonLat, Loximuthal, MapLayer, MapLayerPath, Mercator, Mollweide, NaturalEarth, Orthographic, PanAndZoomControl, Path, Proj, PseudoConic, PseudoCylindrical, REbraces, REcomment_string, REfull, REmunged, Robinson, Satellite, Sinusoidal, Stereographic, SvgLabel, Symbol, SymbolGroup, View, WagnerIV, WagnerV, filter, kartograph, log, map_layer_path_uid, munge, munged, parsedeclarations, restore, root, uid, warn, __proj, __type, _base, _base2, _ref, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
+ var Aitoff, Azimuthal, BBox, Balthasart, Behrmann, BlurFilter, Bubble, CEA, CanvasLayer, Circle, CohenSutherland, Conic, Cylindrical, EckertIV, EquidistantAzimuthal, Equirectangular, Filter, GallPeters, GlowFilter, HoboDyer, HtmlLabel, Icon, Kartograph, LAEA, LCC, LatLon, Line, LonLat, Loximuthal, MapLayer, MapLayerPath, Mercator, Mollweide, NaturalEarth, Orthographic, Path, Proj, PseudoConic, PseudoCylindrical, REbraces, REcomment_string, REfull, REmunged, Robinson, Satellite, Sinusoidal, Stereographic, SvgLabel, Symbol, SymbolGroup, View, WagnerIV, WagnerV, filter, kartograph, log, map_layer_path_uid, munge, munged, parsedeclarations, restore, root, uid, warn, __point_in_polygon, __proj, __type, _base, _base2, _ref, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
root = typeof exports !== "undefined" && exports !== null ? exports : this;
@@ -549,7 +549,12 @@
left: '0px',
'z-index': lid + 5
});
- if (cnt.css('position') === 'static') cnt.css('position', 'relative');
+ if (cnt.css('position') === 'static') {
+ cnt.css({
+ position: 'relative',
+ height: vp.height + 'px'
+ });
+ }
svg.addClass(id);
about = $('desc', paper.canvas).text();
$('desc', paper.canvas).text(about.replace('with ', 'with kartograph ' + kartograph.version + ' and '));
@@ -728,66 +733,6 @@
return me.markers = [];
};
- Kartograph.prototype.choropleth = function(opts) {
- var anim, col, colors, data, data_col, data_key, delay, dur, id, layer_id, me, ncol, path, pathData, paths, pd, row, _i, _j, _len, _len2, _ref10, _ref11, _ref9;
- me = this;
- layer_id = (_ref9 = opts.layer) != null ? _ref9 : me.layerIds[me.layerIds.length - 1];
- if (!me.layers.hasOwnProperty(layer_id)) {
- warn('choropleth error: layer "' + layer_ihad + '" not found');
- return;
- }
- data = opts.data;
- data_col = opts.value;
- data_key = opts.key;
- colors = opts.colors;
- pathData = {};
- if ((data_key != null) && __type(data) === "array") {
- for (_i = 0, _len = data.length; _i < _len; _i++) {
- row = data[_i];
- id = row[data_key];
- pathData[String(id)] = row;
- }
- } else {
- for (id in data) {
- row = data[id];
- pathData[String(id)] = row;
- }
- }
- _ref10 = me.layers[layer_id].pathsById;
- for (id in _ref10) {
- paths = _ref10[id];
- for (_j = 0, _len2 = paths.length; _j < _len2; _j++) {
- path = paths[_j];
- pd = (_ref11 = pathData[id]) != null ? _ref11 : null;
- col = colors(pd);
- if (opts.duration != null) {
- if (__type(opts.duration) === "function") {
- dur = opts.duration(pd);
- } else {
- dur = opts.duration;
- }
- if (opts.delay != null) {
- if (__type(opts.delay) === 'function') {
- delay = opts.delay(pd);
- } else {
- delay = opts.delay;
- }
- } else {
- delay = 0;
- }
- ncol = colors(null);
- path.svgPath.attr('fill', ncol);
- anim = Raphael.animation({
- fill: col
- }, dur);
- path.svgPath.animate(anim.delay(delay));
- } else {
- path.svgPath.attr('fill', col);
- }
- }
- }
- };
-
Kartograph.prototype.tooltips = function(opts) {
var cfg, id, layer_id, me, path, paths, tooltips, tt, _ref10, _ref9, _results;
me = this;
@@ -1170,7 +1115,8 @@
paper = map.paper;
view = map.viewBC;
me.path = path = kartograph.geom.Path.fromSVG(svg_path);
- me.svgPath = view.projectPath(path).toSVG(paper);
+ me.vpath = view.projectPath(path);
+ me.svgPath = me.vpath.toSVG(paper);
if (!(map.styles != null)) {
me.svgPath.node.setAttribute('class', layer_id);
} else {
@@ -1199,6 +1145,7 @@
var me, path, path_str;
me = this;
path = view.projectPath(me.path);
+ me.vpath = path;
if (me.path.type === "path") {
path_str = path.svgString();
return me.svgPath.attr({
@@ -2001,80 +1948,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
- PanAndZoomControl = (function() {
-
- function PanAndZoomControl(map) {
- this.zoomOut = __bind(this.zoomOut, this);
- this.zoomIn = __bind(this.zoomIn, this);
- var c, div, mdown, me, mup, zc, zcm, zcp;
- me = this;
- me.map = map;
- c = map.container;
- div = function(className, childNodes) {
- var child, d, _i, _len;
- if (childNodes == null) childNodes = [];
- d = $('<div class="' + className + '" />');
- for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
- child = childNodes[_i];
- d.append(child);
- }
- return d;
- };
- mdown = function(evt) {
- return $(evt.target).addClass('md');
- };
- mup = function(evt) {
- return $(evt.target).removeClass('md');
- };
- zcp = div('plus');
- zcp.mousedown(mdown);
- zcp.mouseup(mup);
- zcp.click(me.zoomIn);
- zcm = div('minus');
- zcm.mousedown(mdown);
- zcm.mouseup(mup);
- zcm.click(me.zoomOut);
- zc = div('zoom-control', [zcp, zcm]);
- c.append(zc);
- }
-
- PanAndZoomControl.prototype.zoomIn = function(evt) {
- var me;
- me = this;
- me.map.opts.zoom += 1;
- return me.map.resize();
- };
-
- PanAndZoomControl.prototype.zoomOut = function(evt) {
- var me;
- me = this;
- me.map.opts.zoom -= 1;
- if (me.map.opts.zoom < 1) me.map.opts.zoom = 1;
- return me.map.resize();
- };
-
- return PanAndZoomControl;
-
- })();
-
- /*
- kartograph - a svg mapping library
- Copyright (C) 2011 Gregor Aisch
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
root = typeof exports !== "undefined" && exports !== null ? exports : this;
kartograph = (_ref13 = root.kartograph) != null ? _ref13 : root.kartograph = {};
@@ -2235,8 +2108,7 @@
};
Path.prototype.toSVG = function(paper) {
- /*
- translates this path to a SVG path string
+ /* translates this path to a SVG path string
*/
var str;
str = this.svgString();
@@ -2311,6 +2183,18 @@
return me._centroid;
};
+ Path.prototype.isInside = function(x, y) {
+ var bbox, cnt, i, me, _ref16;
+ me = this;
+ bbox = me._bbox;
+ if (x < bbox[0] || x > bbox[2] || y < bbox[1] || y > bbox[3]) return false;
+ for (i = 0, _ref16 = me.contours.length - 1; 0 <= _ref16 ? i <= _ref16 : i >= _ref16; 0 <= _ref16 ? i++ : i--) {
+ cnt = me.contours[i];
+ if (__point_in_polygon(cnt, [x, y])) return true;
+ }
+ return false;
+ };
+
return Path;
})();
@@ -2446,6 +2330,32 @@
kartograph.geom.Line = Line;
+ __point_in_polygon = function(polygon, p) {
+ var angle, atan2, dtheta, i, n, pi, theta1, theta2, twopi, x1, x2, y1, y2, _ref16;
+ pi = Math.PI;
+ atan2 = Math.atan2;
+ twopi = pi * 2;
+ n = polygon.length;
+ angle = 0;
+ for (i = 0, _ref16 = n - 1; 0 <= _ref16 ? i <= _ref16 : i >= _ref16; 0 <= _ref16 ? i++ : i--) {
+ x1 = polygon[i][0] - p[0];
+ y1 = polygon[i][1] - p[1];
+ x2 = polygon[(i + 1) % n][0] - p[0];
+ y2 = polygon[(i + 1) % n][1] - p[1];
+ theta1 = atan2(y1, x1);
+ theta2 = atan2(y2, x2);
+ dtheta = theta2 - theta1;
+ while (dtheta > pi) {
+ dtheta -= twopi;
+ }
+ while (dtheta < -pi) {
+ dtheta += twopi;
+ }
+ angle += dtheta;
+ }
+ return Math.abs(angle) >= pi;
+ };
+
/*
kartograph - a svg mapping library
Copyright (C) 2011 Gregor Aisch
@@ -3641,10 +3551,11 @@
};
View.prototype.projectPath = function(path) {
- var cont, contours, me, pcont, r, x, y, _i, _j, _len, _len2, _ref17, _ref18, _ref19, _ref20;
+ var bbox, cont, contours, me, new_path, pcont, r, x, y, _i, _j, _len, _len2, _ref17, _ref18, _ref19, _ref20;
me = this;
if (path.type === "path") {
contours = [];
+ bbox = [99999, 99999, -99999, -99999];
_ref17 = path.contours;
for (_i = 0, _len = _ref17.length; _i < _len; _i++) {
pcont = _ref17[_i];
@@ -3653,10 +3564,16 @@
_ref18 = pcont[_j], x = _ref18[0], y = _ref18[1];
_ref19 = me.project(x, y), x = _ref19[0], y = _ref19[1];
cont.push([x, y]);
+ bbox[0] = Math.min(bbox[0], x);
+ bbox[1] = Math.min(bbox[1], y);
+ bbox[2] = Math.max(bbox[2], x);
+ bbox[3] = Math.max(bbox[3], y);
}
contours.push(cont);
}
- return new kartograph.geom.Path(path.type, contours, path.closed);
+ new_path = new kartograph.geom.Path(path.type, contours, path.closed);
+ new_path._bbox = bbox;
+ return new_path;
} else if (path.type === "circle") {
_ref20 = me.project(path.x, path.y), x = _ref20[0], y = _ref20[1];
r = path.r * me.scale;
@@ -3694,3 +3611,274 @@
root.kartograph.View = View;
}).call(this);
+(function() {
+
+ /*
+ kartograph - a svg mapping library
+ Copyright (C) 2011 Gregor Aisch
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ var PanAndZoomControl;
+ var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ kartograph.Kartograph.prototype.choropleth = function(opts) {
+ var anim, col, colors, data, data_col, data_key, delay, dur, id, layer_id, me, ncol, path, pathData, paths, pd, row, _i, _j, _len, _len2, _ref, _ref2, _ref3;
+ me = this;
+ layer_id = (_ref = opts.layer) != null ? _ref : me.layerIds[me.layerIds.length - 1];
+ if (!me.layers.hasOwnProperty(layer_id)) {
+ warn('choropleth error: layer "' + layer_ihad + '" not found');
+ return;
+ }
+ data = opts.data;
+ data_col = opts.value;
+ data_key = opts.key;
+ colors = opts.colors;
+ pathData = {};
+ if ((data_key != null) && __type(data) === "array") {
+ for (_i = 0, _len = data.length; _i < _len; _i++) {
+ row = data[_i];
+ id = row[data_key];
+ pathData[String(id)] = row;
+ }
+ } else {
+ for (id in data) {
+ row = data[id];
+ pathData[String(id)] = row;
+ }
+ }
+ _ref2 = me.layers[layer_id].pathsById;
+ for (id in _ref2) {
+ paths = _ref2[id];
+ for (_j = 0, _len2 = paths.length; _j < _len2; _j++) {
+ path = paths[_j];
+ pd = (_ref3 = pathData[id]) != null ? _ref3 : null;
+ col = colors(pd);
+ if (opts.duration != null) {
+ if (__type(opts.duration) === "function") {
+ dur = opts.duration(pd);
+ } else {
+ dur = opts.duration;
+ }
+ if (opts.delay != null) {
+ if (__type(opts.delay) === 'function') {
+ delay = opts.delay(pd);
+ } else {
+ delay = opts.delay;
+ }
+ } else {
+ delay = 0;
+ }
+ if (path.svgPath.attrs['fill'] === "none") {
+ ncol = colors(null);
+ path.svgPath.attr('fill', ncol);
+ }
+ anim = Raphael.animation({
+ fill: col
+ }, dur);
+ path.svgPath.animate(anim.delay(delay));
+ } else {
+ path.svgPath.attr('fill', col);
+ }
+ }
+ }
+ };
+
+ /*
+ kartograph - a svg mapping library
+ Copyright (C) 2011 Gregor Aisch
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ kartograph.Kartograph.prototype.dotgrid = function(opts) {
+ var data, data_col, data_key, dotgrid, dotstyle, ds, f, g, gridsize, id, layer, layer_id, me, path, pathData, paths, pd, row, size, sizes, x, y, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
+ me = this;
+ layer_id = (_ref = opts.layer) != null ? _ref : me.layerIds[me.layerIds.length - 1];
+ if (!me.layers.hasOwnProperty(layer_id)) {
+ warn('dotgrid error: layer "' + layer_id + '" not found');
+ return;
+ }
+ layer = me.layers[layer_id];
+ data = opts.data;
+ data_col = opts.value;
+ data_key = opts.key;
+ pathData = {};
+ if ((data_key != null) && __type(data) === "array") {
+ for (_i = 0, _len = data.length; _i < _len; _i++) {
+ row = data[_i];
+ id = row[data_key];
+ pathData[String(id)] = row;
+ }
+ } else {
+ for (id in data) {
+ row = data[id];
+ pathData[String(id)] = row;
+ }
+ }
+ dotstyle = (_ref2 = opts.style) != null ? _ref2 : {
+ fill: 'black',
+ stroke: 'none'
+ };
+ sizes = opts.size;
+ gridsize = (_ref3 = opts.gridsize) != null ? _ref3 : 15;
+ dotgrid = (_ref4 = layer.dotgrid) != null ? _ref4 : {
+ gridsize: gridsize,
+ grid: []
+ };
+ if (dotgrid.gridsize !== gridsize) {
+ _ref5 = dotgrid.grid;
+ for (_j = 0, _len2 = _ref5.length; _j < _len2; _j++) {
+ g = _ref5[_j];
+ if (g.shape != null) {
+ g.shape.remove();
+ g.shape = null;
+ }
+ }
+ }
+ if (gridsize > 0) {
+ if (dotgrid.grid.length === 0) {
+ for (x = 0, _ref6 = me.viewport.width; 0 <= _ref6 ? x <= _ref6 : x >= _ref6; x += gridsize) {
+ for (y = 0, _ref7 = me.viewport.height; 0 <= _ref7 ? y <= _ref7 : y >= _ref7; y += gridsize) {
+ g = {
+ x: x + (Math.random() - 0.5) * gridsize * 0.3,
+ y: y + (Math.random() - 0.5) * gridsize * 0.3,
+ pathid: false
+ };
+ f = false;
+ _ref8 = layer.pathsById;
+ for (id in _ref8) {
+ paths = _ref8[id];
+ for (_k = 0, _len3 = paths.length; _k < _len3; _k++) {
+ path = paths[_k];
+ if (path.vpath.isInside(g.x, g.y)) {
+ f = true;
+ g.pathid = id;
+ g.shape = layer.paper.circle(g.x, g.y, 1);
+ break;
+ }
+ }
+ if (f) break;
+ }
+ dotgrid.grid.push(g);
+ }
+ }
+ }
+ _ref9 = dotgrid.grid;
+ for (_l = 0, _len4 = _ref9.length; _l < _len4; _l++) {
+ g = _ref9[_l];
+ if (g.pathid) {
+ pd = (_ref10 = pathData[g.pathid]) != null ? _ref10 : null;
+ size = sizes(pd);
+ g.shape.attr({
+ r: size * 0.5
+ });
+ if (__type(dotstyle) === "function") {
+ ds = dotstyle(pd);
+ } else {
+ ds = dotstyle;
+ }
+ g.shape.attr(ds);
+ }
+ }
+ }
+ };
+
+ /*
+ kartograph - a svg mapping library
+ Copyright (C) 2011 Gregor Aisch
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ PanAndZoomControl = (function() {
+
+ function PanAndZoomControl(map) {
+ this.zoomOut = __bind(this.zoomOut, this);
+ this.zoomIn = __bind(this.zoomIn, this);
+ var c, div, mdown, me, mup, zc, zcm, zcp;
+ me = this;
+ me.map = map;
+ c = map.container;
+ div = function(className, childNodes) {
+ var child, d, _i, _len;
+ if (childNodes == null) childNodes = [];
+ d = $('<div class="' + className + '" />');
+ for (_i = 0, _len = childNodes.length; _i < _len; _i++) {
+ child = childNodes[_i];
+ d.append(child);
+ }
+ return d;
+ };
+ mdown = function(evt) {
+ return $(evt.target).addClass('md');
+ };
+ mup = function(evt) {
+ return $(evt.target).removeClass('md');
+ };
+ zcp = div('plus');
+ zcp.mousedown(mdown);
+ zcp.mouseup(mup);
+ zcp.click(me.zoomIn);
+ zcm = div('minus');
+ zcm.mousedown(mdown);
+ zcm.mouseup(mup);
+ zcm.click(me.zoomOut);
+ zc = div('zoom-control', [zcp, zcm]);
+ c.append(zc);
+ }
+
+ PanAndZoomControl.prototype.zoomIn = function(evt) {
+ var me;
+ me = this;
+ me.map.opts.zoom += 1;
+ return me.map.resize();
+ };
+
+ PanAndZoomControl.prototype.zoomOut = function(evt) {
+ var me;
+ me = this;
+ me.map.opts.zoom -= 1;
+ if (me.map.opts.zoom < 1) me.map.opts.zoom = 1;
+ return me.map.resize();
+ };
+
+ return PanAndZoomControl;
+
+ })();
+
+}).call(this);
View
4 dist/kartograph.min.js
@@ -17,5 +17,5 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
- */(function(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,t,u,v,w,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL=Object.prototype.hasOwnProperty,bM=function(a,b){function d(){this.constructor=a}for(var c in b)bL.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a},bN=function(a,b){return function(){return a.apply(b,arguments)}};bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bu=bn.kartograph)!=null?bu:bn.kartograph={},c=function(){function a(a,b,c,d){var e;a==null&&(a=0),b==null&&(b=0),c==null&&(c=null),d==null&&(d=null),e=this,c===null?(e.xmin=Number.MAX_VALUE,e.xmax=Number.MAX_VALUE*-1):(e.xmin=e.left=a,e.xmax=e.right=a+c,e.width=c),d===null?(e.ymin=Number.MAX_VALUE,e.ymax=Number.MAX_VALUE*-1):(e.ymin=e.top=b,e.ymax=e.bottom=d+b,e.height=d);return}a.prototype.update=function(a,b){var c;b==null&&(b=a[1],a=a[0]),c=this,c.xmin=Math.min(c.xmin,a),c.ymin=Math.min(c.ymin,b),c.xmax=Math.max(c.xmax,a),c.ymax=Math.max(c.ymax,b),c.left=c.xmin,c.top=c.ymin,c.right=c.xmax,c.bottom=c.ymax,c.width=c.xmax-c.xmin,c.height=c.ymax-c.ymin;return this},a.prototype.intersects=function(a){return a.left<s.right&&a.right>s.left&&a.top<s.bottom&&a.bottom>s.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bg.BBox(d,e,c,b)},bg.BBox=c,"kartograph - a svg mapping library \nCopyright (C) 2011 Gregor Aisch\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <http://www.gnu.org/licenses/>.",bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bD=bn.kartograph)!=null?bD:bn.kartograph={},(bE=bg.geom)==null&&(bg.geom={}),(bF=(bs=bg.geom).clipping)==null&&(bs.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,b<a.left?d|=e.LEFT:b>a.right&&(d|=e.RIGHT),c<a.top?d|=e.TOP:c>a.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bg.geom.clipping.CohenSutherland=k,bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bG=bn.kartograph)!=null?bG:bn.kartograph={},bf=(bH=bg.filter)!=null?bH:bg.filter={},r=function(){function a(a){this.params=a!=null?a:{}}a.prototype.getFilter=function(a){var b,c;c=this,b=c.SVG("filter",{id:a}),c.buildFilter(b);return b},a.prototype._getFilter=function(){throw"not implemented"},a.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a};return a}(),f=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,r),a.prototype.buildFilter=function(a){var b,c,d;d=this,b=d.SVG,c=b("feGaussianBlur",{stdDeviation:d.params.size||4,result:"blur"});return a.appendChild(c)};return a}(),bf.blur=f,u=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,r),a.prototype.buildFilter=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;g=this,c=(m=g.params.blur)!=null?m:4,i=(n=g.params.strength)!=null?n:1,d=(o=g.params.color)!=null?o:"#D1BEB0",typeof d=="string"&&(d=chroma.hex(d)),h=d.rgb,e=(j=g.params.inner)!=null?j:!1,f=(k=g.params.knockout)!=null?k:!1,b=(l=g.params.alpha)!=null?l:1,e?g.innerGlow(a,c,i,h,b,f):g.outerGlow(a,c,i,h,b,f)},a.prototype.outerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"mask"}),a.appendChild(j),c>0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,console.log("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 "+e,result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),bf.glow=u,bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=bn.$K=(bI=bn.kartograph)!=null?bI:bn.kartograph={},bg.version="0.4.6",bp=function(a){return console.warn("kartograph ("+bg.version+"): "+a)},bh=function(a){return console.log("kartograph ("+bg.version+"): "+a)},(bJ=(bt=String.prototype).trim)==null&&(bt.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this==null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e<c;e++)if(e in b&&b[e]===a)return e;return-1}),A=function(){function a(a,b,c){var d,e;e=this,e.container=d=$(a),b==null&&(b=d.width()),c==null&&(c=d.height()),c===0&&(c=b*.5),e.viewport=new bg.BBox(0,0,b,c),e.paper=e.createSVGLayer(),e.markers=[],e.pathById={},e.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css("position","relative"),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bg.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('<div class="layer '+a+'" />'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bg.__mapCache[a]!=null?d._mapLoaded(bg.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return bp(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((l=bg.__mapCache)==null&&(bg.__mapCache={}),bg.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){console.error("something went wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bg.View.fromXML(b),f=(i=e.opts.padding)!=null?i:0,d=(j=e.opts.halign)!=null?j:"center",g=(k=e.opts.valign)!=null?k:"center",e.viewBC=new bg.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bg.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(r=h.layerIds)==null&&(h.layerIds=[]),(q=h.layers)==null&&(h.layers={}),br(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new H(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m<o;m++)k=d[m],g.addPath(k,l);g.paths.length>0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n<p;n++)f=e[n],br(i[f])==="function"&&h.onLayerEvent(f,i[f],b);i.tooltip!=null&&h.tooltips(i.tooltip)}},a.prototype.getLayerPath=function(a,b){var c;c=this;return c.layers[a]!=null&&c.layers[a].hasPath(b)?c.layers[a].getPath(b):null},a.prototype.onLayerEvent=function(a,b,c){var d,e,f,g,h,i,j,k;f=this,f,c==null&&(c=f.layerIds[f.layerIds.length-1]),d=function(){function a(a,b,c){this.type=a,this.cb=b,this.map=c,this.handle=bN(this.handle,this)}a.prototype.handle=function(a){var b;f=this,b=f.map.pathById[a.target.getAttribute("id")];return f.cb(b.data)};return a}(),e=new d(a,b,f);if(f.layers[c]!=null){h=f.layers[c].paths,k=[];for(i=0,j=h.length;i<j;i++)g=h[i],k.push($(g.svgPath.node).bind(a,e.handle));return k}},a.prototype.addMarker=function(a){var b,c;b=this,b.markers.push(a),c=b.viewBC.project(b.viewAB.project(b.proj.project(a.lonlat.lon,a.lonlat.lat)));return a.render(c[0],c[1],b.container,b.paper)},a.prototype.clearMarkers=function(){var a,b,c,d,e;b=this,e=b.markers;for(c=0,d=e.length;c<d;c++)a=e[c],a.clear();return b.markers=[]},a.prototype.choropleth=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;l=this,k=(y=a.layer)!=null?y:l.layerIds[l.layerIds.length-1];if(!l.layers.hasOwnProperty(k))bp('choropleth error: layer "'+layer_ihad+'" not found');else{e=a.data,f=a.value,g=a.key,d=a.colors,o={};if(g!=null&&br(e)==="array")for(s=0,u=e.length;s<u;s++)r=e[s],j=r[g],o[String(j)]=r;else for(j in e)r=e[j],o[String(j)]=r;w=l.layers[k].pathsById;for(j in w){p=w[j];for(t=0,v=p.length;t<v;t++)n=p[t],q=(x=o[j])!=null?x:null,c=d(q),a.duration!=null?(br(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?br(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,m=d(null),n.svgPath.attr("fill",m),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},a.prototype.tooltips=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,h=a.content,d=(k=a.layer)!=null?k:e.layerIds[e.layerIds.length-1];if(!e.layers.hasOwnProperty(d))bp('tooltips error: layer "'+d+'" not found');else{j=e.layers[d].pathsById,l=[];for(c in j)g=j[c],l.push(function(){var d,e,j,k;k=[];for(d=0,e=g.length;d<e;d++)f=g[d],$.isFunction(h)?i=h(c,f):i=h[c],b={position:{target:"mouse",viewport:$(window),adjust:{x:7,y:7}},show:{delay:(j=a.delay)!=null?j:20},content:{}},i!=null?typeof i=="string"?b.content.text=i:$.isArray(i)&&(b.content.title=i[0],b.content.text=i[1]):b.content.text="n/a",k.push($(f.svgPath.node).qtip(b));return k}());return l}},a.prototype.fadeIn=function(a){var b,c,d,e,f,g,h,i,j,k,l;a==null&&(a={}),f=this,e=(k=a.layer)!=null?k:f.layerIds[f.layerIds.length-1],c=(i=a.duration)!=null?i:500,j=f.layers[e].pathsById,l=[];for(d in j)h=j[d],l.push(function(){var a,d,e;e=[];for(a=0,d=h.length;a<d;a++)g=h[a],br(c)==="function"?b=c(g.data):b=c,g.svgPath.attr("opacity",0),e.push(g.svgPath.animate({opacity:1},b));return e}());return l},a.prototype.loadCoastline=function(){var a;a=this;return $.ajax({url:"coastline.json",success:a.renderCoastline,context:a})},a.prototype.resize=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;g=this,c=g.container,a==null&&(a=c.width()),b==null&&(b=c.height()),g.viewport=k=new bg.BBox(0,0,a,b),g.paper.setSize(k.width,k.height),k=g.viewport,h=(s=g.opts.padding)!=null?s:0,d=(o=g.opts.halign)!=null?o:"center",j=(p=g.opts.valign)!=null?p:"center",l=g.opts.zoom,g.viewBC=new bg.View(g.viewAB.asBBox(),k.width*l,k.height*l,h,d,j),q=g.layers;for(e in q)f=q[e],f.setView(g.viewBC);if(g.symbolGroups!=null){r=g.symbolGroups;for(m=0,n=r.length;m<n;m++)i=r[m],i.onResize()}},a.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bg.filter[b]!=null)e=(new bg.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},a.prototype.applyFilter=function(a,b){var c;c=this;return $(".polygon."+a,c.paper.canvas).attr({filter:"url(#"+b+")"})},a.prototype.lonlat2xy=function(a){var b,c;c=this,a.length===2&&(a=new bg.LonLat(a[0],a[1])),a.length===3&&(a=new bg.LonLat(a[0],a[1],a[2])),b=c.proj.project(a.lon,a.lat,a.alt);return c.viewBC.project(c.viewAB.project(b))},a.prototype.addGeoPath=function(a,b,c){var d,e,f,g,h,i,j,k;b==null&&(b=[]),c==null&&(c=""),f=this,b.length===0&&b.push("M"),h="";for(e in a)i=a[e],d=(k=b[e])!=null?k:"L",j=f.lonlat2xy(i),h+=d+j[0]+","+j[1];g=f.paper.path(h),g.node.setAttribute("class",c)},a.prototype.showZoomControls=function(){var a;a=this,a.zc=new N(a);return a},a.prototype.addSymbolGroup=function(a){var b,c;b=this,(c=b.symbolGroups)==null&&(b.symbolGroups=[]);return b.symbolGroups.push(a)},a.prototype.clear=function(){var a,b,c,d,e,f;b=this;if(b.layers!=null){for(a in b.layers)b.layers[a].remove();b.layers={},b.layerIds=[]}if(b.symbolGroups!=null){f=b.symbolGroups;for(d=0,e=f.length;d<e;d++)c=f[d],c.remove();return b.symbolGroups=[]}},a.prototype.loadStyles=function(a,b){var c;c=this;if($.browser.msie)return $.ajax({url:a,dataType:"text",success:function(a){c.styles=bg.parsecss(a);return b()},error:function(b,c,d){return bp("error while loading "+a,b,c,d)}});$("body").append('<link rel="stylesheet" href="'+a+'" />');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(q=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(n=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,o=f.split(",");for(j=0,l=o.length;j<l;j++){i=o[j],f=i.split(" "),f=f[f.length-1],f=f.split(":");if(f.length>1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],p=e._regardStyles;for(k=0,m=p.length;k<m;k++)d=p[k],g[d]!=null&&a.attr(d,g[d])}}return a};return a}(),bg.Kartograph=A,bg.map=function(a,b,c){return new A(a,b,c)},bg.__mapCache={},H=function(){function a(a,b,c,d){var e;e=this,e.id=a,e.path_id=b,e.paper=c.paper,e.view=c.viewBC,e.map=c,e.filter=d}a.prototype.addPath=function(a,b){var c,d,e,f,g,h,i;d=this,(i=d.paths)==null&&(d.paths=[]),c=new I(a,d.id,d.map,b);if(br(d.filter)==="function"&&d.filter(c.data)===!1)c.remove();else{d.paths.push(c);if(d.path_id!=null){(g=d.pathsById)==null&&(d.pathsById={}),(h=(e=d.pathsById)[f=c.data[d.path_id]])==null&&(e[f]=[]);return d.pathsById[c.data[d.path_id]].push(c)}}},a.prototype.hasPath=function(a){var b;b=this;return b.pathsById!=null&&b.pathsById[a]!=null},a.prototype.getPath=function(a){var b;b=this;if(b.hasPath(a))return b.pathsById[a][0];throw"path "+a+" not found"},a.prototype.setView=function(a){var b,c,d,e,f,g;b=this,f=b.paths,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(c.setView(a));return g},a.prototype.remove=function(){var a,b,c,d,e,f;a=this,e=a.paths,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(b.remove());return f};return a}(),bi=0,I=function(){function a(a,b,c,d){var e,f,g,h,i,j,k,l,m,n;h=this,i=c.paper,m=c.viewBC,h.path=j=bg.geom.Path.fromSVG(a),h.svgPath=m.projectPath(j).toSVG(i),c.styles==null?h.svgPath.node.setAttribute("class",b):c.applyStyles(h.svgPath,b),l="path_"+bi++,h.svgPath.node.setAttribute("id",l),c.pathById[l]=h,f={};for(g=0,n=a.attributes.length-1;0<=n?g<=n:g>=n;0<=n?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(f[e.name.substr(5)]=e.value);h.data=f,br(d)==="string"?k=d:br(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path);if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),i=function(){function a(a,b,c,d){var e;e=this,e.layer_id=a,e.canvas=b,e.view=c,e.renderCallback=d}a.prototype.addPath=function(a){var b,c,d;b=this,(d=b.paths)==null&&(b.paths=[]),c=bg.geom.Path.fromSVG(a);return b.paths.push(c)},a.prototype.render=function(){var a,b,c,d,e,f;a=this,c=[],f=a.paths;for(d=0,e=f.length;d<e;d++)b=f[d],c.push(a.view.projectPath(b));return a.renderCallback(a,c)},a.prototype.drawPaths=function(){var a,b,c,d,e,f,g,h,i;c=this,a=c.canvas.getContext("2d"),h=c.paths,i=[];for(f=0,g=h.length;f<g;f++)d=h[f],d=c.view.projectPath(d),i.push(function(){var c,f,g,h;g=d.contours,h=[];for(c=0,f=g.length;c<f;c++)b=g[c],b.reverse(),h.push(function(){var c,d,f;f=[];for(c=0,d=b.length;c<d;c++)e=b[c],e===b[0]?f.push(a.moveTo(e[0],e[1])):f.push(a.lineTo(e[0],e[1]));return f}());return h}());return i};return a}(),br=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c<d;c++)b=e[c],a["[object "+b+"]"]=b.toLowerCase();return function(b){var c;c=Object.prototype.toString.call(b);return a[c]||"object"}}(),(bK=bn.__type)==null&&(bn.__type=br),bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bv=bn.kartograph)!=null?bv:bn.kartograph={},F=function(){function a(a,b,c){c==null&&(c=0),this.lon=Number(a),this.lat=Number(b),this.alt=Number(c)}a.prototype.distance=function(a){var b,c,d,e,f,g,h,i,j;j=this,b=6371,g=Math.PI/180,e=(a.lat-j.lat)*g,f=(a.lon-j.lon)*g,h=j.lat*g,i=a.lat*g,c=Math.sin(e/2)*Math.sin(e/2)+Math.sin(f/2)*Math.sin(f/2)*Math.cos(h)*Math.cos(i),d=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return b*d};return a}(),D=function(){function a(b,c,d){d==null&&(d=0),a.__super__.constructor.call(this,c,b,d)}bM(a,F);return a}(),bg.LonLat=F,bg.LatLon=D,bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bw=bn.kartograph)!=null?bw:bn.kartograph={},(bx=bg.marker)==null&&(bg.marker={}),bb=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=this;i=this,n=["data","location","type","map"],l=["filter","tooltip","layout","group","click"];for(p=0,t=n.length;p<t;p++){m=n[p];if(b[m]!=null)i[m]=b[m];else throw"SymbolGroup: missing argument "+m}for(q=0,u=l.length;q<u;q++)m=l[q],b[m]!=null&&(i[m]=b[m]);br(i.type)==="string"?c=bg[i.type]:c=i.type;if(c==null)bp("could not resolve symbol type",i.type);else{D=c.props;for(r=0,v=D.length;r<v;r++)m=D[r],b[m]!=null&&(i[m]=b[m]);i.layers={mapcanvas:i.map.paper},E=c.layers;for(s=0,w=E.length;s<w;s++)g=E[s],j=a._layerid++,f="sl_"+j,g.type==="svg"?h=i.map.createSVGLayer(f):g.type==="html"&&(h=i.map.createHTMLLayer(f)),i.layers[g.id]=h;i.symbols=[];for(e in i.data)d=i.data[e],br(i.filter)==="function"?i.filter(d)&&i.addSymbol(d):i.addSymbol(d);i.layoutSymbols(),F=i.symbols;for(A=0,x=F.length;A<x;A++)o=F[A],o.render();br(i.tooltip)==="function"&&i.initTooltips();if(br(i.click)==="function"){G=i.symbols;for(B=0,y=G.length;B<y;B++){o=G[B],H=o.nodes();for(C=0,z=H.length;C<z;C++)k=H[C],k.symbol=o,$(k).click(function(a){a.stopPropagation();return i.click(a.target.symbol.data)})}}i.map.addSymbolGroup(i)}}a.prototype.addSymbol=function(a){var b,c,d,e,f,g,h,i,j;d=this,b=d.type,c=d.evaluate(d.location,a),br(c)==="array"&&(c=new bg.LonLat(c[0],c[1])),f={layers:d.layers,location:c,data:a,map:d.map},j=b.props;for(h=0,i=j.length;h<i;h++)e=j[h],d[e]!=null&&(f[e]=d.evaluate(d[e],a));g=new b(f),d.symbols.push(g);return g},a.prototype.evaluate=function(a,b){var c;return br(a)==="function"?c=a(b):c=a},a.prototype.layoutSymbols=function(){var a,b,c,d,e,f,g,h,i,j,k;c=this,j=c.symbols;for(h=0,i=j.length;h<i;h++){f=j[h],b=f.location;if(br(b)==="string"){k=b.split("."),a=k[0],e=k[1],d=c.map.getLayerPath(a,e);if(d!=null)g=c.map.viewBC.project(d.path.centroid());else continue}else g=c.map.lonlat2xy(b);f.x=g[0],f.y=g[1]}if(c.layout==="group")return c.groupLayout()},a.prototype.groupLayout=function(){var a,b,c;a=this,(c=a.gsymbols)==null&&(a.gsymbols=[]);return b=!0},a.prototype.initTooltips=function(){var a,b,c,d,e,f,g,h,i,j,k,l;b=this,e=b.tooltip,k=b.symbols;for(g=0,i=k.length;g<i;g++){d=k[g],a={position:{target:"mouse",viewport:$(window),adjust:{x:7,y:7}},show:{delay:20},content:{}},f=e(d.data),br(f)==="string"?a.content.text=f:br(f)==="array"&&(a.content.title=f[0],a.content.text=f[1]),l=d.nodes();for(h=0,j=l.length;h<j;h++)c=l[h],$(c).qtip(a)}},a.prototype.remove=function(){var a,b,c,d,e,f,g,h,i;c=this,g=c.symbols;for(e=0,f=g.length;e<f;e++)d=g[e],d.clear();h=c.layers,i=[];for(a in h)b=h[a],a!=="mapcanvas"?i.push(b.remove()):i.push(void 0);return i},a.prototype.onResize=function(){var a,b,c,d,e,f;a=this,a.layoutSymbols(),e=a.symbols,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(b.update());return f};return a}(),bb._layerid=0,bg.SymbolGroup=bb,ba=function(){function a(a){var b;b=this,b.location=a.location,b.data=a.data,b.map=a.map,b.layers=a.layers,b.x=a.x,b.y=a.y}a.prototype.init=function(){},a.prototype.overlaps=function(a){return!1},a.prototype.nodes=function(){return[]},a.prototype.clear=function(){};return a}(),g=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.radius=(d=b.radius)!=null?d:4,c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bM(a,ba),a.prototype.overlaps=function(a){var b,c,d,e,f,g,h,i,j,k,l;d=this,k=[d.x,d.y,d.radius],g=k[0],i=k[1],e=k[2],l=[a.x,a.y,a.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+e<h-f||i-e>j+f||i+e<j-f)return!1;b=g-h,c=i-j;return b*b+c*c>(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.a.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class"],g.layers=[{id:"a",type:"svg"}],bg.Bubble=g,w=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bM(a,ba),a.prototype.render=function(a){var b,c,d;d=this,b=$("<div>"+d.text+"</div>"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('<div class="label" />'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),w.props=["text","style","class"],w.layers=[{id:"lbl",type:"html"}],bg.HtmlLabel=w,_=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bM(a,ba),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x,y:a.y}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),_.props=["text","style","class"],_.layers=[],bg.Label=_,z=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bM(a,ba),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$("<img />"),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),z.props=["icon","offset","class","title","iconsize"],z.layers=[],bg.Icon=z,N=function(){function a(a){this.zoomOut=bN(this.zoomOut,this),this.zoomIn=bN(this.zoomIn,this);var b,c,d,e,f,g,h,i;e=this,e.map=a,b=a.container,c=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('<div class="'+a+'" />');for(e=0,f=b.length;e<f;e++)c=b[e],d.append(c);return d},d=function(a){return $(a.target).addClass("md")},f=function(a){return $(a.target).removeClass("md")},i=c("plus"),i.mousedown(d),i.mouseup(f),i.click(e.zoomIn),h=c("minus"),h.mousedown(d),h.mouseup(f),h.click(e.zoomOut),g=c("zoom-control",[i,h]),b.append(g)}a.prototype.zoomIn=function(a){var b;b=this,b.map.opts.zoom+=1;return b.map.resize()},a.prototype.zoomOut=function(a){var b;b=this,b.map.opts.zoom-=1,b.map.opts.zoom<1&&(b.map.opts.zoom=1);return b.map.resize()};return a}(),bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(by=bn.kartograph)!=null?by:bn.kartograph={},bg.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=bj(a),j=a.split("`b%");for(h=0,i=j.length;h<i;h++){c=j[h],c=c.split("%b`");if(c.length<2)continue;c[0]=bm(c[0]),e=bl(c[1]);if(f[c[0]]!=null)for(d in e)g=e[d],f[c[0]][d]=g;else f[c[0]]=e}if(br(b)==="function")b(f);else return f},bk={},bl=function(a){var b,c,d,e,f,g;d=bk[a].replace(/^{|}$/g,""),d=bj(d),c={},g=d.split(";");for(e=0,f=g.length;e<f;e++){b=g[e],b=b.split(":");if(b.length<2)continue;c[bm(b[0])]=bm(b.slice(1).join(":"))}return c},S=/{[^{}]*}/,U=/\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/,T=/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g,V=/%\w`(\d+)`\w%/,bo=0,bj=function(a,b){var c,d,e;a=a.replace(T,function(a,b){var c;if(!b)return"";c="%s`"+ ++bo+"`s%",bk[bo]=b.replace(/^\\/,"");return c}),c=b?U:S;while(d=c.exec(a))e="%b`"+ ++bo+"`b%",bk[bo]=d[0],a=a.replace(c,e);return a},bm=function(a){var b;if(a==null)return a;while(b=V.exec(a))a=a.replace(V,bk[b[1]]);return a.trim()},bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bz=bn.kartograph)!=null?bz:bn.kartograph={},(bA=bg.geom)==null&&(bg.geom={}),O=function(){function a(a,b,c){var d;c==null&&(c=!0),d=this,d.type=a,d.contours=b,d.closed=c}a.prototype.clipToBBox=function(a){throw"path clipping is not implemented yet"},a.prototype.toSVG=function(a){var b;b=this.svgString();return a.path(b)},a.prototype.svgString=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;d=this,e="",c=d.closed?"Z M":"M",l=d.contours;for(h=0,j=l.length;h<j;h++){a=l[h],b=!0,e+=e===""?"M":c;for(i=0,k=a.length;i<k;i++)m=a[i],f=m[0],g=m[1],b||(e+="L"),e+=f+","+g,b=!1}d.closed&&(e+="Z");return e},a.prototype.area=function(){var a,b,c,d,e,f,g,h;d=this;if(d.areas!=null)return d._area;d.areas=[],d._area=0,g=d.contours;for(e=0,f=g.length;e<f;e++){b=g[e],a=0;for(c=0,h=b.length-2;0<=h?c<=h:c>=h;0<=h?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;i=this;if(i._centroid!=null)return i._centroid;b=i.area(),d=e=0;for(f=0,l=i.contours.length-1;0<=l?f<=l:f>=l;0<=l?f++:f--){c=i.contours[f],a=i.areas[f],j=k=0;for(g=0,m=c.length-2;0<=m?g<=m:g>=m;0<=m?g++:g--)h=c[g][0]*c[g+1][1]-c[g+1][0]*c[g][1],j+=(c[g][0]+c[g+1][0])*h,k+=(c[g][1]+c[g+1][1])*h;h=1/(6*a),j*=h,k*=h,h=a/b,d+=j*h,e+=k*h}i._centroid=[d,e];return i._centroid};return a}(),bg.geom.Path=O,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bM(a,O),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bg.geom.Circle=j,O.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),t=h.split(l);for(p=0,r=t.length;p<r;p++){d=t[p],c=[];if(d!==""){u=d.split("L");for(q=0,s=u.length;q<s;q++)i=u[q],v=i.split(","),n=v[0],o=v[1],c.push([Number(n),Number(o)]);e.push(c)}}k=new bg.geom.Path(m,e,b)}else m==="circle"&&(f=a.getAttribute("cx"),g=a.getAttribute("cy"),j=a.getAttribute("r"),k=new bg.geom.Circle(f,g,j));return k},E=function(){function a(a){this.points=a}a.prototype.clipToBBox=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;l=this,c=(new bg.geom.clipping.CohenSutherland).clip,k=[],f=[],e=!1;for(d=0,q=l.points.length-2;0<=q?d<=q:d>=q;0<=q?d++:d--){r=l.points[d],g=r[0],h=r[1],s=l.points[d+1],i=s[0],j=s[1];try{t=c(b,g,h,i,j),m=t[0],o=t[1],n=t[2],p=t[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],g=b.points;for(e=0,f=g.length;e<f;e++)h=g[e],c=h[0],d=h[1],a.push(c+","+d);return"M"+a.join("L")};return a}(),bg.geom.Line=E,bn=typeof exports!="undefined"&&exports!==null?exports:this,bg=(bB=bn.kartograph)!=null?bB:bn.kartograph={},bq=bg.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},P=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j<k;j++)l=a[j],e=l[0],d=l[1],g=this._visible(e,d),g&&(c=!1),m=this.project(e,d),h=m[0],i=m[1],!g&&b?f.push(this._truncate(h,i)):f.push([h,i]);return c?null:[f]},a.prototype.sea=function(){var a,b,c,d,e,f,g,h,i,j;f=this,e=f.project.bind(this),d=[],a=f.lon0,f.lon0=0;for(c=-180;c<=180;c++)d.push(e(c,f.maxLat));for(b=g=f.maxLat,h=f.minLat;g<=h?b<=h:b>=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bg.BBox;for(e=0,f=d.length;e<f;e++)c=d[e],a.update(c[0],c[1]);return a},a.prototype.toString=function(){var a;a=this;return"[Proj: "+a.name+"]"};return a}(),P.fromXML=function(a){var b,c,d,e,f,g;d=a.getAttribute("id"),e={};for(c=0,g=a.attributes.length-1;0<=g?c<=g:c>=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value)
-;f=new bg.proj[d](e),f.name=d;return f},bg.Proj=P,n=function(){function a(b){var c,d;c=this,c.flip=Number(b.flip)||0,c.flip===1&&(b.lon0=(d=-b.lon0)!=null?d:0),a.__super__.constructor.call(this,b)}bM(a,P),a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,n),a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bq.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bM(a,n),a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3,f*1e3]};return a}(),bq.cea=h,t=function(){function a(b,c){a.__super__.constructor.call(this,b,45)}bM(a,h);return a}(),bq.gallpeters=t,v=function(){function a(b){b.lat0=37.7,a.__super__.constructor.call(this,b)}bM(a,h);return a}(),bq.hobodyer=v,e=function(){function a(b){b.lat0=30,a.__super__.constructor.call(this,b)}bM(a,h);return a}(),bq.behrmann=e,d=function(){function a(b){b.lat0=50,a.__super__.constructor.call(this,b)}bM(a,h);return a}(),bq.balthasart=d,J=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bM(a,n),a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bq.mercator=J,R=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,n);return a}(),L=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bM(a,R),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bq.naturalearth=L,W=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bM(a,R),a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bq.robinson=W,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bM(a,R),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)<h.EPS)break;e-=1}e===0?(k=h.C_x*f,l=g<0?-h.C_y:h.C_y):(k=h.C_x*f*(1+Math.cos(g)),l=h.C_y*Math.sin(g));return[k,l]};return a}(),bq.eckert4=o,Y=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,R),a.prototype.project=function(a,b){var c,d,e,f,g,h;d=this,h=d.ll(a,b),a=h[0],b=h[1],c=d.rad(d.clon(a)),e=d.rad(b*-1),f=c*Math.cos(e),g=e;return[f,g]};return a}(),bq.sinusoidal=Y,K=function(){function a(b,c,d,e,f){var g,h,i,j;c==null&&(c=1.5707963267948966),d==null&&(d=null),e==null&&(e=null),f==null&&(f=null),a.__super__.constructor.call(this,b),g=this,g.MAX_ITER=10,g.TOLERANCE=1e-7,c!=null?(h=c+c,j=Math.sin(c),i=Math.sqrt(Math.PI*2*j/(h+Math.sin(h))),g.cx=2*i/Math.PI,g.cy=i/j,g.cp=h+Math.sin(h)):d!=null&&e!=null&&typeof cz!="undefined"&&cz!==null?(g.cx=d,g.cy=e,g.cp=f):console.error("kartograph.proj.Mollweide: either p or cx,cy,cp must be defined")}bM(a,R),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],g=Math,c=g.abs,f=h.rad(h.clon(a)),i=h.rad(b),e=h.cp*g.sin(i),d=h.MAX_ITER;while(d!==0){j=(i+g.sin(i)-e)/(1+g.cos(i)),i-=j;if(c(j)<h.TOLERANCE)break;d-=1}d===0?i=i>=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bq.mollweide=K,bd=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bM(a,K);return a}(),bq.wagner4=bd,be=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bM(a,K);return a}(),bq.wagner5=be,G=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bM(c,R),b=-89,a=89,c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bq.loximuthal=G,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bM(a,P),a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bg.BBox(0,0,a*2,a*2)};return a}(),M=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bq.ortho=M,B=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bq.laea=B,Z=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bq.stereo=Z,X=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bM(a,b),a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a,b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bq.satellite=X,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;i=this.rad(b),g=this.rad(a),h=Math,j=h.sin,d=h.cos,e=j(this.phi0)*j(i)+d(this.phi0)*d(i)*d(g-this.lam0),c=h.acos(e),f=.325*c/j(c),l=this.r*f*d(i)*j(g-this.lam0),n=-this.r*f*(d(this.phi0)*j(i)-j(this.phi0)*d(i)*d(g-this.lam0)),k=this.r+l,m=this.r+n;return[k,m]},a.prototype._visible=function(a,b){return!0};return a}(),bq.equi=p,a=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,p),a.prototype.project=function(a,b){return[x,y]},a.prototype._visible=function(a,b){return!0};return a}(),bq.aitoff=a,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bM(a,P),a.prototype._visible=function(a,b){return!0},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),C=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bh=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bh(f/e(k.phi2))/bh(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bM(a,l),"Lambert Conformal Conic Projection (spherical)",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bh=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*l.rho0-k*d(f);return[o,p*-1]};return a}(),bq.lcc=C,Q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,l);return a}(),bc=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;d=this;if(a.type==="path"){c=[],m=a.contours;for(i=0,k=m.length;i<k;i++){e=m[i],b=[];for(j=0,l=e.length;j<l;j++)n=e[j],g=n[0],h=n[1],o=d.project(g,h),g=o[0],h=o[1],b.push([g,h]);c.push(b)}return new bg.geom.Path(a.type,c,a.closed)}if(a.type==="circle"){p=d.project(a.x,a.y),g=p[0],h=p[1],f=a.r*d.scale;return new bg.geom.Circle(g,h,f)}},a.prototype.asBBox=function(){var a;a=this;return new bg.BBox(0,0,a.width,a.height)};return a}(),bc.fromXML=function(a){var b,d,e,f,g;g=Number(a.getAttribute("w")),e=Number(a.getAttribute("h")),f=Number(a.getAttribute("padding")),d=a.getElementsByTagName("bbox")[0],b=c.fromXML(d);return new bg.View(b,g,e,f)},bn=typeof exports!="undefined"&&exports!==null?exports:this,(bC=bn.kartograph)==null&&(bn.kartograph={}),bn.kartograph.View=bc}).call(this)
+ */(function(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,t,u,v,w,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK,bL=Object.prototype.hasOwnProperty,bM=function(a,b){function d(){this.constructor=a}for(var c in b)bL.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a},bN=function(a,b){return function(){return a.apply(b,arguments)}};bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bu=bm.kartograph)!=null?bu:bm.kartograph={},c=function(){function a(a,b,c,d){var e;a==null&&(a=0),b==null&&(b=0),c==null&&(c=null),d==null&&(d=null),e=this,c===null?(e.xmin=Number.MAX_VALUE,e.xmax=Number.MAX_VALUE*-1):(e.xmin=e.left=a,e.xmax=e.right=a+c,e.width=c),d===null?(e.ymin=Number.MAX_VALUE,e.ymax=Number.MAX_VALUE*-1):(e.ymin=e.top=b,e.ymax=e.bottom=d+b,e.height=d);return}a.prototype.update=function(a,b){var c;b==null&&(b=a[1],a=a[0]),c=this,c.xmin=Math.min(c.xmin,a),c.ymin=Math.min(c.ymin,b),c.xmax=Math.max(c.xmax,a),c.ymax=Math.max(c.ymax,b),c.left=c.xmin,c.top=c.ymin,c.right=c.xmax,c.bottom=c.ymax,c.width=c.xmax-c.xmin,c.height=c.ymax-c.ymin;return this},a.prototype.intersects=function(a){return a.left<s.right&&a.right>s.left&&a.top<s.bottom&&a.bottom>s.top},a.prototype.inside=function(a,b){var c;c=this;return a>=c.left&&a<=c.right&&b>=c.top&&b<=c.bottom},a.prototype.join=function(a){var b;b=this,b.update(a.left,a.top),b.update(a.right,a.bottom);return this};return a}(),c.fromXML=function(a){var b,c,d,e;d=Number(a.getAttribute("x")),e=Number(a.getAttribute("y")),c=Number(a.getAttribute("w")),b=Number(a.getAttribute("h"));return new bf.BBox(d,e,c,b)},bf.BBox=c,"kartograph - a svg mapping library \nCopyright (C) 2011 Gregor Aisch\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <http://www.gnu.org/licenses/>.",bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bD=bm.kartograph)!=null?bD:bm.kartograph={},(bE=bf.geom)==null&&(bf.geom={}),(bF=(bs=bf.geom).clipping)==null&&(bs.clipping={}),k=function(){function f(){}var a,b,c,d,e;b=0,c=1,d=2,a=4,e=8,f.prototype.compute_out_code=function(a,b,c){var d,e;e=this,d=e.INSIDE,b<a.left?d|=e.LEFT:b>a.right&&(d|=e.RIGHT),c<a.top?d|=e.TOP:c>a.bottom&&(d|=e.BOTTOM);return d},f.prototype.clip=function(a,b,c,d,e){var f,g,h,i,j,k,l;j=this,g=j.compute_out_code(a,b,c),h=j.compute_out_code(a,d,e),f=False;while(True){if(!(g|h)){f=True;break}if(g&h)break;i=code===0?h:g,i&j.TOP?(k=b+(d-b)*(a.top-c)/(e-c),l=a.top):i&j.BOTTOM?(k=b+(d-b)*(a.bottom-c)/(e-c),l=a.bottom):i&j.RIGHT?(l=c+(e-c)*(a.right-b)/(d-b),k=a.right):i&j.LEFT&&(l=c+(e-c)*(a.left-b)/(d-b),k=a.left),i===g?(b=k,c=l,g=j.compute_out_code(a,b,c)):(d=k,e=l,h=j.compute_out_code(a,d,e))}return f?[b,c,d,e]:null};return f}(),bf.geom.clipping.CohenSutherland=k,bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bG=bm.kartograph)!=null?bG:bm.kartograph={},be=(bH=bf.filter)!=null?bH:bf.filter={},r=function(){function a(a){this.params=a!=null?a:{}}a.prototype.getFilter=function(a){var b,c;c=this,b=c.SVG("filter",{id:a}),c.buildFilter(b);return b},a.prototype._getFilter=function(){throw"not implemented"},a.prototype.SVG=function(a,b){var c,d;typeof a=="string"&&(a=window.document.createElementNS("http://www.w3.org/2000/svg",a));if(b)for(c in b)d=b[c],a.setAttribute(c,d);return a};return a}(),f=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,r),a.prototype.buildFilter=function(a){var b,c,d;d=this,b=d.SVG,c=b("feGaussianBlur",{stdDeviation:d.params.size||4,result:"blur"});return a.appendChild(c)};return a}(),be.blur=f,u=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,r),a.prototype.buildFilter=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;g=this,c=(m=g.params.blur)!=null?m:4,i=(n=g.params.strength)!=null?n:1,d=(o=g.params.color)!=null?o:"#D1BEB0",typeof d=="string"&&(d=chroma.hex(d)),h=d.rgb,e=(j=g.params.inner)!=null?j:!1,f=(k=g.params.knockout)!=null?k:!1,b=(l=g.params.alpha)!=null?l:1,e?g.innerGlow(a,c,i,h,b,f):g.outerGlow(a,c,i,h,b,f)},a.prototype.outerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0",result:"mask"}),a.appendChild(j),c>0&&(m=g("feMorphology",{"in":"mask",radius:c,operator:"dilate",result:"mask"}),a.appendChild(m)),j=g("feColorMatrix",{"in":"mask",type:"matrix",values:"0 0 0 0 "+d[0]/255+" 0 0 0 0 "+d[1]/255+" 0 0 0 0 "+d[2]/255+" 0 0 0 1 0",result:"r0"}),a.appendChild(j),h=g("feGaussianBlur",{"in":"r0",stdDeviation:b,result:"r1"}),a.appendChild(h),i=g("feComposite",{operator:"out","in":"r1",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"r1"}));return a.appendChild(l)},a.prototype.innerGlow=function(a,b,c,d,e,f){var g,h,i,j,k,l,m;k=this,g=k.SVG,console.log("innerglow"),j=g("feColorMatrix",{"in":"SourceGraphic",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 500 0",result:"mask"}),a.appendChild(j),m=g("feMorphology",{"in":"mask",radius:c,operator:"erode",result:"r1"}),a.appendChild(m),h=g("feGaussianBlur",{"in":"r1",stdDeviation:b,result:"r2"}),a.appendChild(h),j=g("feColorMatrix",{type:"matrix","in":"r2",values:"1 0 0 0 "+d[0]/255+" 0 1 0 0 "+d[1]/255+" 0 0 1 0 "+d[2]/255+" 0 0 0 -1 "+e,result:"r3"}),a.appendChild(j),i=g("feComposite",{operator:"in","in":"r3",in2:"mask",result:"comp"}),a.appendChild(i),l=g("feMerge"),f||l.appendChild(g("feMergeNode",{"in":"SourceGraphic"})),l.appendChild(g("feMergeNode",{"in":"comp"}));return a.appendChild(l)};return a}(),be.glow=u,bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=bm.$K=(bI=bm.kartograph)!=null?bI:bm.kartograph={},bf.version="0.4.6",bo=function(a){return console.warn("kartograph ("+bf.version+"): "+a)},bg=function(a){return console.log("kartograph ("+bf.version+"): "+a)},(bJ=(bt=String.prototype).trim)==null&&(bt.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this==null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:d!=0&&d!=Infinity&&d!=-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e<c;e++)if(e in b&&b[e]===a)return e;return-1}),A=function(){function a(a,b,c){var d,e;e=this,e.container=d=$(a),b==null&&(b=d.width()),c==null&&(c=d.height()),c===0&&(c=b*.5),e.viewport=new bf.BBox(0,0,b,c),e.paper=e.createSVGLayer(),e.markers=[],e.pathById={},e.container.addClass("kartograph")}a.prototype.createSVGLayer=function(a){var b,c,d,e,f,g,h,i;e=this,(i=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,h=e.viewport,c=e.container,f=Raphael(c[0],h.width,h.height),g=$(f.canvas),g.css({position:"absolute",top:"0px",left:"0px","z-index":d+5}),c.css("position")==="static"&&c.css({position:"relative",height:h.height+"px"}),g.addClass(a),b=$("desc",f.canvas).text(),$("desc",f.canvas).text(b.replace("with ","with kartograph "+bf.version+" and "));return f},a.prototype.createHTMLLayer=function(a){var b,c,d,e,f,g;e=this,f=e.viewport,b=e.container,(g=e._layerCnt)==null&&(e._layerCnt=0),d=e._layerCnt++,c=$('<div class="layer '+a+'" />'),c.css({position:"absolute",top:"0px",left:"0px",width:f.width+"px",height:f.height+"px","z-index":d+5}),b.append(c);return c},a.prototype.loadMap=function(a,b,c){var d,e,f;d=this,d.clear(),d.opts=c!=null?c:{},(f=(e=d.opts).zoom)==null&&(e.zoom=1),d.mapLoadCallback=b,d._lastMapUrl=a,d.cacheMaps&&bf.__mapCache[a]!=null?d._mapLoaded(bf.__mapCache[a]):$.ajax({url:a,dataType:"text",success:d._mapLoaded,context:d,error:function(a,b,c){return bo(a,b,c)}})},a.prototype._mapLoaded=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,e.cacheMaps&&((l=bf.__mapCache)==null&&(bf.__mapCache={}),bf.__mapCache[e._lastMapUrl]=a);try{a=$(a)}catch(m){console.error("something went wrong while parsing svg");return}e.svgSrc=a,h=e.viewport,b=$("view",a)[0],e.viewAB=c=bf.View.fromXML(b),f=(i=e.opts.padding)!=null?i:0,d=(j=e.opts.halign)!=null?j:"center",g=(k=e.opts.valign)!=null?k:"center",e.viewBC=new bf.View(c.asBBox(),h.width,h.height,f,d,g),e.proj=bf.Proj.fromXML($("proj",b)[0]);return e.mapLoadCallback(e)},a.prototype.addLayer=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;h=this,(r=h.layerIds)==null&&(h.layerIds=[]),(q=h.layers)==null&&(h.layers={}),br(a)==="object"?(i=a,a=i.id,b=i.className,c=i.key,l=i.title):i={},b==null&&(b=a),j=$("#"+a,h.svgSrc);if(j.length!==0){g=new H(b,c,h,i.filter),d=$("*",j[0]);for(m=0,o=d.length;m<o;m++)k=d[m],g.addPath(k,l);g.paths.length>0&&(h.layers[b]=g,h.layerIds.push(b)),e=["click"];for(n=0,p=e.length;n<p;n++)f=e[n],br(i[f])==="function"&&h.onLayerEvent(f,i[f],b);i.tooltip!=null&&h.tooltips(i.tooltip)}},a.prototype.getLayerPath=function(a,b){var c;c=this;return c.layers[a]!=null&&c.layers[a].hasPath(b)?c.layers[a].getPath(b):null},a.prototype.onLayerEvent=function(a,b,c){var d,e,f,g,h,i,j,k;f=this,f,c==null&&(c=f.layerIds[f.layerIds.length-1]),d=function(){function a(a,b,c){this.type=a,this.cb=b,this.map=c,this.handle=bN(this.handle,this)}a.prototype.handle=function(a){var b;f=this,b=f.map.pathById[a.target.getAttribute("id")];return f.cb(b.data)};return a}(),e=new d(a,b,f);if(f.layers[c]!=null){h=f.layers[c].paths,k=[];for(i=0,j=h.length;i<j;i++)g=h[i],k.push($(g.svgPath.node).bind(a,e.handle));return k}},a.prototype.addMarker=function(a){var b,c;b=this,b.markers.push(a),c=b.viewBC.project(b.viewAB.project(b.proj.project(a.lonlat.lon,a.lonlat.lat)));return a.render(c[0],c[1],b.container,b.paper)},a.prototype.clearMarkers=function(){var a,b,c,d,e;b=this,e=b.markers;for(c=0,d=e.length;c<d;c++)a=e[c],a.clear();return b.markers=[]},a.prototype.tooltips=function(a){var b,c,d,e,f,g,h,i,j,k,l;e=this,h=a.content,d=(k=a.layer)!=null?k:e.layerIds[e.layerIds.length-1];if(!e.layers.hasOwnProperty(d))bo('tooltips error: layer "'+d+'" not found');else{j=e.layers[d].pathsById,l=[];for(c in j)g=j[c],l.push(function(){var d,e,j,k;k=[];for(d=0,e=g.length;d<e;d++)f=g[d],$.isFunction(h)?i=h(c,f):i=h[c],b={position:{target:"mouse",viewport:$(window),adjust:{x:7,y:7}},show:{delay:(j=a.delay)!=null?j:20},content:{}},i!=null?typeof i=="string"?b.content.text=i:$.isArray(i)&&(b.content.title=i[0],b.content.text=i[1]):b.content.text="n/a",k.push($(f.svgPath.node).qtip(b));return k}());return l}},a.prototype.fadeIn=function(a){var b,c,d,e,f,g,h,i,j,k,l;a==null&&(a={}),f=this,e=(k=a.layer)!=null?k:f.layerIds[f.layerIds.length-1],c=(i=a.duration)!=null?i:500,j=f.layers[e].pathsById,l=[];for(d in j)h=j[d],l.push(function(){var a,d,e;e=[];for(a=0,d=h.length;a<d;a++)g=h[a],br(c)==="function"?b=c(g.data):b=c,g.svgPath.attr("opacity",0),e.push(g.svgPath.animate({opacity:1},b));return e}());return l},a.prototype.loadCoastline=function(){var a;a=this;return $.ajax({url:"coastline.json",success:a.renderCoastline,context:a})},a.prototype.resize=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;g=this,c=g.container,a==null&&(a=c.width()),b==null&&(b=c.height()),g.viewport=k=new bf.BBox(0,0,a,b),g.paper.setSize(k.width,k.height),k=g.viewport,h=(s=g.opts.padding)!=null?s:0,d=(o=g.opts.halign)!=null?o:"center",j=(p=g.opts.valign)!=null?p:"center",l=g.opts.zoom,g.viewBC=new bf.View(g.viewAB.asBBox(),k.width*l,k.height*l,h,d,j),q=g.layers;for(e in q)f=q[e],f.setView(g.viewBC);if(g.symbolGroups!=null){r=g.symbolGroups;for(m=0,n=r.length;m<n;m++)i=r[m],i.onResize()}},a.prototype.addFilter=function(a,b,c){var d,e,f;c==null&&(c={}),f=this,d=window.document;if(bf.filter[b]!=null)e=(new bf.filter[b](c)).getFilter(a);else throw"unknown filter type "+b;return f.paper.defs.appendChild(e)},a.prototype.applyFilter=function(a,b){var c;c=this;return $(".polygon."+a,c.paper.canvas).attr({filter:"url(#"+b+")"})},a.prototype.lonlat2xy=function(a){var b,c;c=this,a.length===2&&(a=new bf.LonLat(a[0],a[1])),a.length===3&&(a=new bf.LonLat(a[0],a[1],a[2])),b=c.proj.project(a.lon,a.lat,a.alt);return c.viewBC.project(c.viewAB.project(b))},a.prototype.addGeoPath=function(a,b,c){var d,e,f,g,h,i,j,k;b==null&&(b=[]),c==null&&(c=""),f=this,b.length===0&&b.push("M"),h="";for(e in a)i=a[e],d=(k=b[e])!=null?k:"L",j=f.lonlat2xy(i),h+=d+j[0]+","+j[1];g=f.paper.path(h),g.node.setAttribute("class",c)},a.prototype.showZoomControls=function(){var a;a=this,a.zc=new PanAndZoomControl(a);return a},a.prototype.addSymbolGroup=function(a){var b,c;b=this,(c=b.symbolGroups)==null&&(b.symbolGroups=[]);return b.symbolGroups.push(a)},a.prototype.clear=function(){var a,b,c,d,e,f;b=this;if(b.layers!=null){for(a in b.layers)b.layers[a].remove();b.layers={},b.layerIds=[]}if(b.symbolGroups!=null){f=b.symbolGroups;for(d=0,e=f.length;d<e;d++)c=f[d],c.remove();return b.symbolGroups=[]}},a.prototype.loadStyles=function(a,b){var c;c=this;if($.browser.msie)return $.ajax({url:a,dataType:"text",success:function(a){c.styles=bf.parsecss(a);return b()},error:function(b,c,d){return bo("error while loading "+a,b,c,d)}});$("body").append('<link rel="stylesheet" href="'+a+'" />');return b()},a.prototype.applyStyles=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;e=this;if(e.styles==null)return a;(q=e._pathTypes)==null&&(e._pathTypes=["path","circle","rectangle","ellipse"]),(n=e._regardStyles)==null&&(e._regardStyles=["fill","stroke","fill-opacity","stroke-width","stroke-opacity"]);for(h in e.styles){f=h,o=f.split(",");for(j=0,l=o.length;j<l;j++){i=o[j],f=i.split(" "),f=f[f.length-1],f=f.split(":");if(f.length>1)continue;f=f[0].split("."),c=f.slice(1);if(c.length>0&&c.indexOf(b)<0)continue;f=f[0];if(e._pathTypes.indexOf(f)>=0&&f!==a.type)continue;g=e.styles[h],p=e._regardStyles;for(k=0,m=p.length;k<m;k++)d=p[k],g[d]!=null&&a.attr(d,g[d])}}return a};return a}(),bf.Kartograph=A,bf.map=function(a,b,c){return new A(a,b,c)},bf.__mapCache={},H=function(){function a(a,b,c,d){var e;e=this,e.id=a,e.path_id=b,e.paper=c.paper,e.view=c.viewBC,e.map=c,e.filter=d}a.prototype.addPath=function(a,b){var c,d,e,f,g,h,i;d=this,(i=d.paths)==null&&(d.paths=[]),c=new I(a,d.id,d.map,b);if(br(d.filter)==="function"&&d.filter(c.data)===!1)c.remove();else{d.paths.push(c);if(d.path_id!=null){(g=d.pathsById)==null&&(d.pathsById={}),(h=(e=d.pathsById)[f=c.data[d.path_id]])==null&&(e[f]=[]);return d.pathsById[c.data[d.path_id]].push(c)}}},a.prototype.hasPath=function(a){var b;b=this;return b.pathsById!=null&&b.pathsById[a]!=null},a.prototype.getPath=function(a){var b;b=this;if(b.hasPath(a))return b.pathsById[a][0];throw"path "+a+" not found"},a.prototype.setView=function(a){var b,c,d,e,f,g;b=this,f=b.paths,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(c.setView(a));return g},a.prototype.remove=function(){var a,b,c,d,e,f;a=this,e=a.paths,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(b.remove());return f};return a}(),bh=0,I=function(){function a(a,b,c,d){var e,f,g,h,i,j,k,l,m,n;h=this,i=c.paper,m=c.viewBC,h.path=j=bf.geom.Path.fromSVG(a),h.vpath=m.projectPath(j),h.svgPath=h.vpath.toSVG(i),c.styles==null?h.svgPath.node.setAttribute("class",b):c.applyStyles(h.svgPath,b),l="path_"+bh++,h.svgPath.node.setAttribute("id",l),c.pathById[l]=h,f={};for(g=0,n=a.attributes.length-1;0<=n?g<=n:g>=n;0<=n?g++:g--)e=a.attributes[g],e.name.substr(0,5)==="data-"&&(f[e.name.substr(5)]=e.value);h.data=f,br(d)==="string"?k=d:br(d)==="function"&&(k=d(f)),k!=null&&h.svgPath.attr("title",k)}a.prototype.setView=function(a){var b,c,d;b=this,c=a.projectPath(b.path),b.vpath=c;if(b.path.type==="path"){d=c.svgString();return b.svgPath.attr({path:d})}if(b.path.type==="circle")return b.svgPath.attr({cx:c.x,cy:c.y,r:c.r})},a.prototype.remove=function(){var a;a=this;return a.svgPath.remove()};return a}(),i=function(){function a(a,b,c,d){var e;e=this,e.layer_id=a,e.canvas=b,e.view=c,e.renderCallback=d}a.prototype.addPath=function(a){var b,c,d;b=this,(d=b.paths)==null&&(b.paths=[]),c=bf.geom.Path.fromSVG(a);return b.paths.push(c)},a.prototype.render=function(){var a,b,c,d,e,f;a=this,c=[],f=a.paths;for(d=0,e=f.length;d<e;d++)b=f[d],c.push(a.view.projectPath(b));return a.renderCallback(a,c)},a.prototype.drawPaths=function(){var a,b,c,d,e,f,g,h,i;c=this,a=c.canvas.getContext("2d"),h=c.paths,i=[];for(f=0,g=h.length;f<g;f++)d=h[f],d=c.view.projectPath(d),i.push(function(){var c,f,g,h;g=d.contours,h=[];for(c=0,f=g.length;c<f;c++)b=g[c],b.reverse(),h.push(function(){var c,d,f;f=[];for(c=0,d=b.length;c<d;c++)e=b[c],e===b[0]?f.push(a.moveTo(e[0],e[1])):f.push(a.lineTo(e[0],e[1]));return f}());return h}());return i};return a}(),br=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c<d;c++)b=e[c],a["[object "+b+"]"]=b.toLowerCase();return function(b){var c;c=Object.prototype.toString.call(b);return a[c]||"object"}}(),(bK=bm.__type)==null&&(bm.__type=br),bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bv=bm.kartograph)!=null?bv:bm.kartograph={},F=function(){function a(a,b,c){c==null&&(c=0),this.lon=Number(a),this.lat=Number(b),this.alt=Number(c)}a.prototype.distance=function(a){var b,c,d,e,f,g,h,i,j;j=this,b=6371,g=Math.PI/180,e=(a.lat-j.lat)*g,f=(a.lon-j.lon)*g,h=j.lat*g,i=a.lat*g,c=Math.sin(e/2)*Math.sin(e/2)+Math.sin(f/2)*Math.sin(f/2)*Math.cos(h)*Math.cos(i),d=2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c));return b*d};return a}(),D=function(){function a(b,c,d){d==null&&(d=0),a.__super__.constructor.call(this,c,b,d)}bM(a,F);return a}(),bf.LonLat=F,bf.LatLon=D,bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bw=bm.kartograph)!=null?bw:bm.kartograph={},(bx=bf.marker)==null&&(bf.marker={}),ba=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I=this;i=this,n=["data","location","type","map"],l=["filter","tooltip","layout","group","click"];for(p=0,t=n.length;p<t;p++){m=n[p];if(b[m]!=null)i[m]=b[m];else throw"SymbolGroup: missing argument "+m}for(q=0,u=l.length;q<u;q++)m=l[q],b[m]!=null&&(i[m]=b[m]);br(i.type)==="string"?c=bf[i.type]:c=i.type;if(c==null)bo("could not resolve symbol type",i.type);else{D=c.props;for(r=0,v=D.length;r<v;r++)m=D[r],b[m]!=null&&(i[m]=b[m]);i.layers={mapcanvas:i.map.paper},E=c.layers;for(s=0,w=E.length;s<w;s++)g=E[s],j=a._layerid++,f="sl_"+j,g.type==="svg"?h=i.map.createSVGLayer(f):g.type==="html"&&(h=i.map.createHTMLLayer(f)),i.layers[g.id]=h;i.symbols=[];for(e in i.data)d=i.data[e],br(i.filter)==="function"?i.filter(d)&&i.addSymbol(d):i.addSymbol(d);i.layoutSymbols(),F=i.symbols;for(A=0,x=F.length;A<x;A++)o=F[A],o.render();br(i.tooltip)==="function"&&i.initTooltips();if(br(i.click)==="function"){G=i.symbols;for(B=0,y=G.length;B<y;B++){o=G[B],H=o.nodes();for(C=0,z=H.length;C<z;C++)k=H[C],k.symbol=o,$(k).click(function(a){a.stopPropagation();return i.click(a.target.symbol.data)})}}i.map.addSymbolGroup(i)}}a.prototype.addSymbol=function(a){var b,c,d,e,f,g,h,i,j;d=this,b=d.type,c=d.evaluate(d.location,a),br(c)==="array"&&(c=new bf.LonLat(c[0],c[1])),f={layers:d.layers,location:c,data:a,map:d.map},j=b.props;for(h=0,i=j.length;h<i;h++)e=j[h],d[e]!=null&&(f[e]=d.evaluate(d[e],a));g=new b(f),d.symbols.push(g);return g},a.prototype.evaluate=function(a,b){var c;return br(a)==="function"?c=a(b):c=a},a.prototype.layoutSymbols=function(){var a,b,c,d,e,f,g,h,i,j,k;c=this,j=c.symbols;for(h=0,i=j.length;h<i;h++){f=j[h],b=f.location;if(br(b)==="string"){k=b.split("."),a=k[0],e=k[1],d=c.map.getLayerPath(a,e);if(d!=null)g=c.map.viewBC.project(d.path.centroid());else continue}else g=c.map.lonlat2xy(b);f.x=g[0],f.y=g[1]}if(c.layout==="group")return c.groupLayout()},a.prototype.groupLayout=function(){var a,b,c;a=this,(c=a.gsymbols)==null&&(a.gsymbols=[]);return b=!0},a.prototype.initTooltips=function(){var a,b,c,d,e,f,g,h,i,j,k,l;b=this,e=b.tooltip,k=b.symbols;for(g=0,i=k.length;g<i;g++){d=k[g],a={position:{target:"mouse",viewport:$(window),adjust:{x:7,y:7}},show:{delay:20},content:{}},f=e(d.data),br(f)==="string"?a.content.text=f:br(f)==="array"&&(a.content.title=f[0],a.content.text=f[1]),l=d.nodes();for(h=0,j=l.length;h<j;h++)c=l[h],$(c).qtip(a)}},a.prototype.remove=function(){var a,b,c,d,e,f,g,h,i;c=this,g=c.symbols;for(e=0,f=g.length;e<f;e++)d=g[e],d.clear();h=c.layers,i=[];for(a in h)b=h[a],a!=="mapcanvas"?i.push(b.remove()):i.push(void 0);return i},a.prototype.onResize=function(){var a,b,c,d,e,f;a=this,a.layoutSymbols(),e=a.symbols,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],f.push(b.update());return f};return a}(),ba._layerid=0,bf.SymbolGroup=ba,_=function(){function a(a){var b;b=this,b.location=a.location,b.data=a.data,b.map=a.map,b.layers=a.layers,b.x=a.x,b.y=a.y}a.prototype.init=function(){},a.prototype.overlaps=function(a){return!1},a.prototype.nodes=function(){return[]},a.prototype.clear=function(){};return a}(),g=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.radius=(d=b.radius)!=null?d:4,c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bM(a,_),a.prototype.overlaps=function(a){var b,c,d,e,f,g,h,i,j,k,l;d=this,k=[d.x,d.y,d.radius],g=k[0],i=k[1],e=k[2],l=[a.x,a.y,a.radius],h=l[0],j=l[1],f=l[2];if(g-e>h+f||g+e<h-f||i-e>j+f||i+e<j-f)return!1;b=g-h,c=i-j;return b*b+c*c>(e+f)*(e+f)?!1:!0},a.prototype.render=function(a){var b;b=this,b.path=b.layers.a.circle(b.x,b.y,b.radius),b.update(),b.map.applyStyles(b.path);return b},a.prototype.update=function(){var a,b;a=this,a.path.attr({x:a.x,y:a.y,r:a.radius}),b=a.path,b.node.setAttribute("style",a.style),b.node.setAttribute("class",a["class"]);return a},a.prototype.clear=function(){var a;a=this,a.path.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.path.node]};return a}(),g.props=["radius","style","class"],g.layers=[{id:"a",type:"svg"}],bf.Bubble=g,w=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bM(a,_),a.prototype.render=function(a){var b,c,d;d=this,b=$("<div>"+d.text+"</div>"),b.css({width:"50px",position:"absolute",left:"-25px","text-align":"center"}),d.lbl=c=$('<div class="label" />'),c.append(b),d.layers.lbl.append(c),b.css({height:b.height()+"px",top:b.height()*-0.4+"px"}),d.update();return d},a.prototype.update=function(){var a;a=this;return a.lbl.css({position:"absolute",left:a.x+"px",top:a.y+"px"})},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl[0]]};return a}(),w.props=["text","style","class"],w.layers=[{id:"lbl",type:"html"}],bf.HtmlLabel=w,Z=function(){function a(b){var c,d,e,f;c=this,a.__super__.constructor.call(this,b),c.text=(d=b.text)!=null?d:"",c.style=(e=b.style)!=null?e:"",c["class"]=(f=b["class"])!=null?f:""}bM(a,_),a.prototype.render=function(a){var b,c;c=this,c.lbl=b=c.layers.mapcanvas.text(c.x,c.y,c.text),c.update();return c},a.prototype.update=function(){var a;a=this,a.lbl.attr({x:a.x,y:a.y}),a.lbl.node.setAttribute("style",a.style);return a.lbl.node.setAttribute("class",a["class"])},a.prototype.clear=function(){var a;a=this,a.lbl.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.lbl.node]};return a}(),Z.props=["text","style","class"],Z.layers=[],bf.Label=Z,z=function(){function a(b){var c,d,e,f,g,h;c=this,a.__super__.constructor.call(this,b),c.icon=(d=b.icon)!=null?d:"",c.offset=(e=b.offset)!=null?e:[0,0],c.iconsize=(f=b.iconsize)!=null?f:[10,10],c["class"]=(g=b["class"])!=null?g:"",c.title=(h=b.title)!=null?h:""}bM(a,_),a.prototype.render=function(a){var b,c;c=this,b=c.map.container,c.img=$("<img />"),c.img.attr({src:c.icon,title:c.title,alt:c.title,width:c.iconsize[0],height:c.iconsize[1]}),c.img.addClass(c["class"]),c.img.css({position:"absolute","z-index":1e3,cursor:"pointer"}),c.img[0].symbol=c,b.append(c.img);return c.update()},a.prototype.update=function(){var a;a=this;return a.img.css({left:a.x+a.offset[0]+"px",top:a.y+a.offset[1]+"px"})},a.prototype.clear=function(){var a;a=this,a.img.remove();return a},a.prototype.nodes=function(){var a;a=this;return[a.img]};return a}(),z.props=["icon","offset","class","title","iconsize"],z.layers=[],bf.Icon=z,bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(by=bm.kartograph)!=null?by:bm.kartograph={},bf.parsecss=function(a,b){var c,d,e,f,g,h,i,j;f={},a=bi(a),j=a.split("`b%");for(h=0,i=j.length;h<i;h++){c=j[h],c=c.split("%b`");if(c.length<2)continue;c[0]=bl(c[0]),e=bk(c[1]);if(f[c[0]]!=null)for(d in e)g=e[d],f[c[0]][d]=g;else f[c[0]]=e}if(br(b)==="function")b(f);else return f},bj={},bk=function(a){var b,c,d,e,f,g;d=bj[a].replace(/^{|}$/g,""),d=bi(d),c={},g=d.split(";");for(e=0,f=g.length;e<f;e++){b=g[e],b=b.split(":");if(b.length<2)continue;c[bl(b[0])]=bl(b.slice(1).join(":"))}return c},R=/{[^{}]*}/,T=/\[[^\[\]]*\]|{[^{}]*}|\([^()]*\)|function(\s+\w+)?(\s*%b`\d+`b%){2}/,S=/(?:\/\*(?:[^\*]|\*[^\/])*\*\/)|(\\.|"(?:[^\\\"]|\\.|\\\n)*"|'(?:[^\\\']|\\.|\\\n)*')/g,U=/%\w`(\d+)`\w%/,bn=0,bi=function(a,b){var c,d,e;a=a.replace(S,function(a,b){var c;if(!b)return"";c="%s`"+ ++bn+"`s%",bj[bn]=b.replace(/^\\/,"");return c}),c=b?T:R;while(d=c.exec(a))e="%b`"+ ++bn+"`b%",bj[bn]=d[0],a=a.replace(c,e);return a},bl=function(a){var b;if(a==null)return a;while(b=U.exec(a))a=a.replace(U,bj[b[1]]);return a.trim()},bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bz=bm.kartograph)!=null?bz:bm.kartograph={},(bA=bf.geom)==null&&(bf.geom={}),N=function(){function a(a,b,c){var d;c==null&&(c=!0),d=this,d.type=a,d.contours=b,d.closed=c}a.prototype.clipToBBox=function(a){throw"path clipping is not implemented yet"},a.prototype.toSVG=function(a){var b;b=this.svgString();return a.path(b)},a.prototype.svgString=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;d=this,e="",c=d.closed?"Z M":"M",l=d.contours;for(h=0,j=l.length;h<j;h++){a=l[h],b=!0,e+=e===""?"M":c;for(i=0,k=a.length;i<k;i++)m=a[i],f=m[0],g=m[1],b||(e+="L"),e+=f+","+g,b=!1}d.closed&&(e+="Z");return e},a.prototype.area=function(){var a,b,c,d,e,f,g,h;d=this;if(d.areas!=null)return d._area;d.areas=[],d._area=0,g=d.contours;for(e=0,f=g.length;e<f;e++){b=g[e],a=0;for(c=0,h=b.length-2;0<=h?c<=h:c>=h;0<=h?c++:c--)a+=b[c][0]*b[c+1][1]-b[c+1][0]*b[c][1];a*=.5,a=a,d.areas.push(a),d._area+=a}return d._area},a.prototype.centroid=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;i=this;if(i._centroid!=null)return i._centroid;b=i.area(),d=e=0;for(f=0,l=i.contours.length-1;0<=l?f<=l:f>=l;0<=l?f++:f--){c=i.contours[f],a=i.areas[f],j=k=0;for(g=0,m=c.length-2;0<=m?g<=m:g>=m;0<=m?g++:g--)h=c[g][0]*c[g+1][1]-c[g+1][0]*c[g][1],j+=(c[g][0]+c[g+1][0])*h,k+=(c[g][1]+c[g+1][1])*h;h=1/(6*a),j*=h,k*=h,h=a/b,d+=j*h,e+=k*h}i._centroid=[d,e];return i._centroid},a.prototype.isInside=function(a,b){var c,d,e,f,g;f=this,c=f._bbox;if(a<c[0]||a>c[2]||b<c[1]||b>c[3])return!1;for(e=0,g=f.contours.length-1;0<=g?e<=g:e>=g;0<=g?e++:e--){d=f.contours[e];if(bp(d,[a,b]))return!0}return!1};return a}(),bf.geom.Path=N,j=function(){function a(b,c,d){this.x=b,this.y=c,this.r=d,a.__super__.constructor.call(this,"circle",null,!0)}bM(a,N),a.prototype.toSVG=function(a){var b;b=this;return a.circle(b.x,b.y,b.r)},a.prototype.centroid=function(){var a;a=this;return[a.x,a.y]},a.prototype.area=function(){var a;a=this;return Math.PI*a.r*m.r};return a}(),bf.geom.Circle=j,N.fromSVG=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=[],m=a.nodeName,k=null;if(m==="path"){h=a.getAttribute("d").trim(),b=h[h.length-1]==="Z",l=b?"Z M":"M",h=h.substring(1,h.length-(b?1:0)),t=h.split(l);for(p=0,r=t.length;p<r;p++){d=t[p],c=[];if(d!==""){u=d.split("L");for(q=0,s=u.length;q<s;q++)i=u[q],v=i.split(","),n=v[0],o=v[1],c.push([Number(n),Number(o)]);e.push(c)}}k=new bf.geom.Path(m,e,b)}else m==="circle"&&(f=a.getAttribute("cx"),g=a.getAttribute("cy"),j=a.getAttribute("r"),k=new bf.geom.Circle(f,g,j));return k},E=function(){function a(a){this.points=a}a.prototype.clipToBBox=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;l=this,c=(new bf.geom.clipping.CohenSutherland).clip,k=[],f=[],e=!1;for(d=0,q=l.points.length-2;0<=q?d<=q:d>=q;0<=q?d++:d--){r=l.points[d],g=r[0],h=r[1],s=l.points[d+1],i=s[0],j=s[1];try{t=c(b,g,h,i,j),m=t[0],o=t[1],n=t[2],p=t[3],e=!0,k.push([m,o]),(i!==n||j!==o||d===len(l.points)-2)&&k.push([n,p])}catch(u){e&&k.length>1&&(f.push(new a(k)),k=[]),e=!1}}k.length>1&&f.push(new a(k));return f},a.prototype.toSVG=function(){var a,b,c,d,e,f,g,h;b=this,a=[],g=b.points;for(e=0,f=g.length;e<f;e++)h=g[e],c=h[0],d=h[1],a.push(c+","+d);return"M"+a.join("L")};return a}(),bf.geom.Line=E,bp=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;h=Math.PI,d=Math.atan2,k=h*2,g=a.length,c=0;for(f=0,p=g-1;0<=p?f<=p:f>=p;0<=p?f++:f--){l=a[f][0]-b[0],n=a[f][1]-b[1],m=a[(f+1)%g][0]-b[0],o=a[(f+1)%g][1]-b[1],i=d(n,l),j=d(o,m),e=j-i;while(e>h)e-=k;while(e<-h)e+=k;c+=e}return Math.abs(c)>=h},bm=typeof exports!="undefined"&&exports!==null?exports:this,bf=(bB=bm.kartograph)!=null?bB:bm.kartograph={},bq=bf.proj={},Function.prototype.bind=function(a){var b;b=this;return function(){return b.apply(a,arguments)}},O=function(){function a(a){var b,c,d;b=this,b.lon0=(c=a.lon0)!=null?c:0,b.lat0=(d=a.lat0)!=null?d:0,b.PI=Math.PI,b.HALFPI=b.PI*.5,b.QUARTERPI=b.PI*.25,b.RAD=b.PI/180,b.DEG=180/b.PI,b.lam0=b.rad(this.lon0),b.phi0=b.rad(this.lat0),b.minLat=-90,b.maxLat=90}a.prototype.rad=function(a){return a*this.RAD},a.prototype.deg=function(a){return a*this.DEG},a.prototype.plot=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;b==null&&(b=!0),f=[],c=!0;for(j=0,k=a.length;j<k;j++)l=a[j],e=l[0],d=l[1],g=this._visible(e,d),g&&(c=!1),m=this.project(e,d),h=m[0],i=m[1],!g&&b?f.push(this._truncate(h,i)):f.push([h,i]);return c?null:[f]},a.prototype.sea=function(){var a,b,c,d,e,f,g,h,i,j;f=this,e=f.project.bind(this),d=[],a=f.lon0,f.lon0=0;for(c=-180;c<=180;c++)d.push(e(c,f.maxLat));for(b=g=f.maxLat,h=f.minLat;g<=h?b<=h:b>=h;g<=h?b++:b--)d.push(e(180,b));for(c=180;c>=-180;c--)d.push(e(c,f.minLat));for(b=i=f.minLat,j=f.maxLat;i<=j?b<=j:b>=j;i<=j?b++:b--)d.push(e(-180,b));f.lon0=a;return d},a.prototype.world_bbox=function(){var a,b,c,d,e,f;b=this.project.bind(this),d=this.sea(),a=new bf.BBox;for(e=0,f=d.length;e<f;e++)c=d[e],a.update(c[0],c[1]);return a},a.prototype.toString=function(){var a;a=this;return"[Proj: "+a.name+"]"};return a}(),O.fromXML=function(a){var b,c,d,e,f,g;d=a.getAttribute("id"),e={};for(c=0,g=a.attributes.length-1;0<=g?c<=g:c>=g;0<=g?c++:c--)b=a.attributes[c],b.name!=="id"&&(e[b.name]=b.value);f=new bf.proj[d](e),f.name=d;return f},bf.Proj=O,n=function(){function a(b){var c,d;c=this,c.flip=Number(b.flip)||0,c.flip===1&&(b.lon0=(d=-b.lon0)!=null?d:0),a.__super__.constructor.call(this,b)}bM(a,O),a.prototype._visible=function(a,b){return!0},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a},a.prototype.ll=function(a,b){return this.flip===1?[-a,-b]:[a,b]};return a}(),q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,n),a.prototype.project=function(a,b){var c;c=this.ll(a,b),a=c[0],b=c[1],a=this.clon(a);return[a*Math.cos(this.phi0)*1e3,b*-1*1e3]};return a}(),bq.lonlat=q,h=function(){function a(b){var c;a.__super__.constructor.call(this,b),this.lat1=(c=b.lat1)!=null?c:0,this.phi1=this.rad(this.lat1)}bM(a,n),a.prototype.project=function(a,b){var c,d,e,f,g;g=this.ll(a,b),a=g[0],b=g[1],c=this.rad(this.clon(a)),d=this.rad(b*-1),e=c*Math.cos(this.phi1),f=Math.sin(d)/Math.cos(this.phi1);return[e*1e3
+,f*1e3]};return a}(),bq.cea=h,t=function(){function a(b,c){a.__super__.constructor.call(this,b,45)}bM(a,h);return a}(),bq.gallpeters=t,v=function(){function a(b){b.lat0=37.7,a.__super__.constructor.call(this,b)}bM(a,h);return a}(),bq.hobodyer=v,e=function(){function a(b){b.lat0=30,a.__super__.constructor.call(this,b)}bM(a,h);return a}(),bq.behrmann=e,d=function(){function a(b){b.lat0=50,a.__super__.constructor.call(this,b)}bM(a,h);return a}(),bq.balthasart=d,J=function(){function a(b){a.__super__.constructor.call(this,b),this.minLat=-85,this.maxLat=85}bM(a,n),a.prototype.project=function(a,b){var c,d,e,f,g,h,i;f=this,i=f.ll(a,b),a=i[0],b=i[1],d=Math,c=f.rad(f.clon(a)),e=f.rad(b*-1),g=c*1e3,h=d.log((1+d.sin(e))/d.cos(e))*1e3;return[g,h]};return a}(),bq.mercator=J,Q=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,n);return a}(),L=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.A0=.8707,c.A1=-0.131979,c.A2=-0.013791,c.A3=.003971,c.A4=-0.001529,c.B0=1.007226,c.B1=.015085,c.B2=-0.044475,c.B3=.028874,c.B4=-0.005916,c.C0=c.B0,c.C1=3*c.B1,c.C2=7*c.B2,c.C3=9*c.B3,c.C4=11*c.B4,c.EPS=1e-11,c.MAX_Y=.8707*.52*Math.PI;return}bM(a,Q),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],c=g.rad(g.clon(a)),d=g.rad(b*-1),e=d*d,f=e*e,h=c*(g.A0+e*(g.A1+e*(g.A2+f*e*(g.A3+e*g.A4))))*180+500,i=d*(g.B0+e*(g.B1+f*(g.B2+g.B3*e+g.B4*f)))*180+270;return[h,i]};return a}(),bq.naturalearth=L,V=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.X=[1,-5.67239e-12,-0.0000715511,311028e-11,.9986,-0.000482241,-0.000024897,-0.00000133094,.9954,-0.000831031,-0.000044861,-9.86588e-7,.99,-0.00135363,-0.0000596598,367749e-11,.9822,-0.00167442,-0.0000044975,-0.00000572394,.973,-0.00214869,-0.0000903565,1.88767e-8,.96,-0.00305084,-0.0000900732,164869e-11,.9427,-0.00382792,-0.0000653428,-0.00000261493,.9216,-0.00467747,-0.000104566,48122e-10,.8962,-0.00536222,-0.0000323834,-0.00000543445,.8679,-0.00609364,-0.0001139,332521e-11,.835,-0.00698325,-0.0000640219,9.34582e-7,.7986,-0.00755337,-0.0000500038,9.35532e-7,.7597,-0.00798325,-0.0000359716,-0.00000227604,.7186,-0.00851366,-0.000070112,-0.00000863072,.6732,-0.00986209,-0.000199572,191978e-10,.6213,-0.010418,883948e-10,624031e-11,.5722,-0.00906601,181999e-9,624033e-11,.5322,0,0,0],c.Y=[0,.0124,3.72529e-10,1.15484e-9,.062,.0124001,1.76951e-8,-5.92321e-9,.124,.0123998,-7.09668e-8,2.25753e-8,.186,.0124008,2.66917e-7,-8.44523e-8,.248,.0123971,-9.99682e-7,3.15569e-7,.31,.0124108,373349e-11,-0.0000011779,.372,.0123598,-0.000013935,439588e-11,.434,.0125501,520034e-10,-0.0000100051,.4968,.0123198,-0.0000980735,922397e-11,.5571,.0120308,402857e-10,-0.0000052901,.6176,.0120369,-0.0000390662,7.36117e-7,.6769,.0117015,-0.0000280246,-8.54283e-7,.7346,.0113572,-0.0000408389,-5.18524e-7,.7903,.0109099,-0.0000486169,-0.0000010718,.8435,.0103433,-0.0000646934,5.36384e-9,.8936,.00969679,-0.0000646129,-0.00000854894,.9394,.00840949,-0.000192847,-0.00000421023,.9761,.00616525,-0.000256001,-0.00000421021,1,0,0,0],c.NODES=18,c.FXC=.8487,c.FYC=1.3523,c.C1=11.459155902616464,c.RC1=.08726646259971647,c.ONEEPS=1.000001,c.EPS=1e-8;return}bM(a,Q),a.prototype._poly=function(a,b,c){return a[b]+c*(a[b+1]+c*(a[b+2]+c*a[b+3]))},a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;g=this,j=g.ll(a,b),a=j[0],b=j[1],a=g.clon(a),d=g.rad(a),e=g.rad(b*-1),f=Math.abs(e),c=Math.floor(f*g.C1),c>=g.NODES&&(c=g.NODES-1),f=g.deg(f-g.RC1*c),c*=4,h=g._poly(g.X,c,f)*g.FXC*d,i=g._poly(g.Y,c,f)*g.FYC,e<0&&(i=-i);return[h,i]};return a}(),bq.robinson=V,o=function(){function a(b){var c;a.__super__.constructor.call(this,b),c=this,c.C_x=.4222382003157712,c.C_y=1.3265004281770023,c.RC_y=.7538633073600218,c.C_p=3.5707963267948966,c.RC_p=.2800495767557787,c.EPS=1e-7,c.NITER=6}bM(a,Q),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],f=h.rad(h.clon(a)),g=h.rad(b*-1),i=h.C_p*Math.sin(g),c=g*g,g*=.895168+c*(.0218849+c*.00826809),e=h.NITER;while(e>0){d=Math.cos(g),j=Math.sin(g),c=(g+j*(d+2)-i)/(1+d*(d+2)-j*j),g-=c;if(Math.abs(c)<h.EPS)break;e-=1}e===0?(k=h.C_x*f,l=g<0?-h.C_y:h.C_y):(k=h.C_x*f*(1+Math.cos(g)),l=h.C_y*Math.sin(g));return[k,l]};return a}(),bq.eckert4=o,X=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,Q),a.prototype.project=function(a,b){var c,d,e,f,g,h;d=this,h=d.ll(a,b),a=h[0],b=h[1],c=d.rad(d.clon(a)),e=d.rad(b*-1),f=c*Math.cos(e),g=e;return[f,g]};return a}(),bq.sinusoidal=X,K=function(){function a(b,c,d,e,f){var g,h,i,j;c==null&&(c=1.5707963267948966),d==null&&(d=null),e==null&&(e=null),f==null&&(f=null),a.__super__.constructor.call(this,b),g=this,g.MAX_ITER=10,g.TOLERANCE=1e-7,c!=null?(h=c+c,j=Math.sin(c),i=Math.sqrt(Math.PI*2*j/(h+Math.sin(h))),g.cx=2*i/Math.PI,g.cy=i/j,g.cp=h+Math.sin(h)):d!=null&&e!=null&&typeof cz!="undefined"&&cz!==null?(g.cx=d,g.cy=e,g.cp=f):console.error("kartograph.proj.Mollweide: either p or cx,cy,cp must be defined")}bM(a,Q),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this,m=h.ll(a,b),a=m[0],b=m[1],g=Math,c=g.abs,f=h.rad(h.clon(a)),i=h.rad(b),e=h.cp*g.sin(i),d=h.MAX_ITER;while(d!==0){j=(i+g.sin(i)-e)/(1+g.cos(i)),i-=j;if(c(j)<h.TOLERANCE)break;d-=1}d===0?i=i>=0?h.HALFPI:-h.HALFPI:i*=.5,k=1e3*h.cx*f*g.cos(i),l=1e3*h.cy*g.sin(i);return[k,l*-1]};return a}(),bq.mollweide=K,bc=function(){function a(b){a.__super__.constructor.call(this,b,1.0471975511965976)}bM(a,K);return a}(),bq.wagner4=bc,bd=function(){function a(b){a.__super__.constructor.call(this,b,null,.90977,1.65014,3.00896)}bM(a,K);return a}(),bq.wagner5=bd,G=function(){function c(){c.__super__.constructor.apply(this,arguments)}var a,b;bM(c,Q),b=-89,a=89,c.prototype.project=function(a,b){var c,d,e,f,g,h,i;e=this,i=e.ll(a,b),a=i[0],b=i[1],d=Math,c=e.rad(e.clon(a)),f=e.rad(b),f===e.phi0?g=c*d.cos(e.phi0):g=c*(f-e.phi0)/(d.log(d.tan(e.QUARTERPI+f*.5))-d.log(d.tan(e.QUARTERPI+e.phi0*.5))),g*=1e3,h=1e3*(f-e.phi0);return[g,h*-1]};return c}(),bq.loximuthal=G,b=function(){function a(b,c){var d;c==null&&(c=1e3),a.__super__.constructor.call(this,b),d=this,d.r=c,d.elevation0=d.to_elevation(d.lat0),d.azimuth0=d.to_azimuth(d.lon0)}bM(a,O),a.prototype.to_elevation=function(a){var b;b=this;return(a+90)/180*b.PI-b.HALFPI},a.prototype.to_azimuth=function(a){var b;b=this;return(a+180)/360*b.PI*2-b.PI},a.prototype._visible=function(a,b){var c,d,e,f,g;g=this,f=Math,e=g.to_elevation(b),c=g.to_azimuth(a),d=f.sin(e)*f.sin(g.elevation0)+f.cos(g.elevation0)*f.cos(e)*f.cos(c-g.azimuth0);return d>=0},a.prototype._truncate=function(a,b){var c,d,e,f,g;c=Math,d=this.r,e=c.atan2(b-d,a-d),f=d+d*c.cos(e),g=d+d*c.sin(e);return[f,g]},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b},a.prototype.world_bbox=function(){var a;a=this.r;return new bf.BBox(0,0,a*2,a*2)};return a}(),M=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j;f=this,e=Math,d=f.to_elevation(b),c=f.to_azimuth(a),h=f.r*e.cos(d)*e.sin(c-f.azimuth0),j=-f.r*(e.cos(f.elevation0)*e.sin(d)-e.sin(f.elevation0)*e.cos(d)*e.cos(c-f.azimuth0)),g=f.r+h,i=f.r+j;return[g,i]};return a}(),bq.ortho=M,B=function(){function a(b){a.__super__.constructor.call(this,b),this.scale=Math.sqrt(2)*.5}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l;g=this.rad(b),e=this.rad(a),f=Math,h=f.sin,c=f.cos,d=f.pow(2/(1+h(this.phi0)*h(g)+c(this.phi0)*c(g)*c(e-this.lam0)),.5),d*=this.scale,j=this.r*d*c(g)*h(e-this.lam0),l=-this.r*d*(c(this.phi0)*h(g)-h(this.phi0)*c(g)*c(e-this.lam0)),i=this.r+j,k=this.r+l;return[i,k]};return a}(),bq.laea=B,Y=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m;h=this.rad(b),f=this.rad(a),g=Math,i=g.sin,c=g.cos,e=.5,d=2*e/(1+i(this.phi0)*i(h)+c(this.phi0)*c(h)*c(f-this.lam0)),k=this.r*d*c(h)*i(f-this.lam0),m=-this.r*d*(c(this.phi0)*i(h)-i(this.phi0)*c(h)*c(f-this.lam0)),j=this.r+k,l=this.r+m;return[j,l]};return a}(),bq.stereo=Y,W=function(){function a(b){var c,d,e,f,g,h,i,j;a.__super__.constructor.call(this,{lon0:0,lat0:0}),this.dist=(h=b.dist)!=null?h:3,this.up=this.rad((i=b.up)!=null?i:0),this.tilt=this.rad((j=b.tilt)!=null?j:0),this.scale=1,f=Number.MAX_VALUE,e=Number.MAX_VALUE*-1;for(c=0;c<=179;c++)for(d=0;d<=360;d++)g=this.project(d-180,c-90),f=Math.min(g[0],f),e=Math.max(g[0],e);this.scale=this.r*2/(e-f),a.__super__.constructor.call(this,b);return}bM(a,b),a.prototype.project=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c==null&&(c=0),m=this.rad(b),k=this.rad(a),l=Math,p=l.sin,f=l.cos,n=this.r,o=n*(c+6371)/3671,g=p(this.phi0)*p(m)+f(this.phi0)*f(m)*f(k-this.lam0),j=(this.dist-1)/(this.dist-g),j=(this.dist-1)/(this.dist-g),j*=this.scale,t=o*j*f(m)*p(k-this.lam0),w=-o*j*(f(this.phi0)*p(m)-p(this.phi0)*f(m)*f(k-this.lam0)),i=f(this.up),r=p(this.up),h=f(this.tilt),q=p(this.tilt),e=o*(this.dist-1),d=(w*i+t*r)*p(this.tilt/e)+h,u=(t*i-w*r)*f(this.tilt/d),x=(w*i+t*r)/d,s=n+u,v=n+x;return[s,v]},a.prototype._visible=function(a,b){var c,d,e,f;e=this.to_elevation(b),c=this.to_azimuth(a),f=Math,d=f.sin(e)*f.sin(this.elevation0)+f.cos(this.elevation0)*f.cos(e)*f.cos(c-this.azimuth0);return d>=1/this.dist},a.prototype.sea=function(){var a,b,c,d;b=[],d=this.r,a=Math;for(c=0;c<=360;c++)b.push([d+a.cos(this.rad(c))*d,d+a.sin(this.rad(c))*d]);return b};return a}(),bq.satellite=W,p=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,b),a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;i=this.rad(b),g=this.rad(a),h=Math,j=h.sin,d=h.cos,e=j(this.phi0)*j(i)+d(this.phi0)*d(i)*d(g-this.lam0),c=h.acos(e),f=.325*c/j(c),l=this.r*f*d(i)*j(g-this.lam0),n=-this.r*f*(d(this.phi0)*j(i)-j(this.phi0)*d(i)*d(g-this.lam0)),k=this.r+l,m=this.r+n;return[k,m]},a.prototype._visible=function(a,b){return!0};return a}(),bq.equi=p,a=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,p),a.prototype.project=function(a,b){return[x,y]},a.prototype._visible=function(a,b){return!0};return a}(),bq.aitoff=a,l=function(){function a(b){var c,d,e;c=this,a.__super__.constructor.call(this,b),c.lat1=(d=b.lat1)!=null?d:30,c.phi1=c.rad(c.lat1),c.lat2=(e=b.lat2)!=null?e:50,c.phi2=c.rad(c.lat2)}bM(a,O),a.prototype._visible=function(a,b){return!0},a.prototype._truncate=function(a,b){return[a,b]},a.prototype.clon=function(a){a-=this.lon0,a<-180?a+=360:a>180&&(a-=360);return a};return a}(),C=function(){function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o;k=this,a.__super__.constructor.call(this,b),g=Math,o=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],l=o[0],e=o[1],c=o[2],bg=o[3],n=o[4],i=o[5],k.n=h=m=l(k.phi1),f=e(k.phi1),j=c(k.phi1-k.phi2)>=1e-10,j&&(h=bg(f/e(k.phi2))/bg(n(k.QUARTERPI+.5*k.phi2)/n(k.QUARTERPI+.5*k.phi1))),k.c=d=f*i(n(k.QUARTERPI+.5*k.phi1),h)/h,c(c(k.phi0)-k.HALFPI)<1e-10?k.rho0=0:k.rho0=d*i(n(k.QUARTERPI+.5*k.phi0),-h),k.minLat=-60,k.maxLat=85}bM(a,l),"Lambert Conformal Conic Projection (spherical)",a.prototype.project=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;l=this,i=l.rad(b),e=l.rad(l.clon(a)),g=Math,q=[g.sin,g.cos,g.abs,g.log,g.tan,g.pow],m=q[0],d=q[1],c=q[2],bg=q[3],n=q[4],j=q[5],h=l.n,c(c(i)-l.HALFPI)<1e-10?k=0:k=l.c*j(n(l.QUARTERPI+.5*i),-h),f=e*h,o=1e3*k*m(f),p=1e3*l.rho0-k*d(f);return[o,p*-1]};return a}(),bq.lcc=C,P=function(){function a(){a.__super__.constructor.apply(this,arguments)}bM(a,l);return a}(),bb=function(){function a(a,b,c,d,e,f){var g;g=this,g.bbox=a,g.width=b,g.padding=d!=null?d:0,g.halign=e!=null?e:"center",g.valign=f!=null?f:"center",g.height=c,g.scale=Math.min((b-d*2)/a.width,(c-d*2)/a.height)}a.prototype.project=function(a,b){var c,d,e,f,g,h,i;b==null&&(b=a[1],a=a[0]),e=this,f=e.scale,c=e.bbox,d=e.height,g=e.width,h=e.halign==="center"?(g-c.width*f)*.5:e.halign==="left"?e.padding*f:g-(c.width-e.padding)*f,i=e.valign==="center"?(d-c.height*f)*.5:e.valign==="top"?e.padding*f:0,a=(a-c.left)*f+h,b=(b-c.top)*f+i;return[a,b]},a.prototype.projectPath=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;e=this;if(a.type==="path"){d=[],b=[99999,99999,-99999,-99999],o=a.contours;for(k=0,m=o.length;k<m;k++){g=o[k],c=[];for(l=0,n=g.length;l<n;l++)p=g[l],i=p[0],j=p[1],q=e.project(i,j),i=q[0],j=q[1],c.push([i,j]),b[0]=Math.min(b[0],i),b[1]=Math.min(b[1],j),b[2]=Math.max(b[2],i),b[3]=Math.max(b[3],j);d.push(c)}f=new bf.geom.Path(a.type,d,a.closed),f._bbox=b;return f}if(a.type==="circle"){r=e.project(a.x,a.y),i=r[0],j=r[1],h=a.r*e.scale;return new bf.geom.Circle(i,j,h)}},a.prototype.asBBox=function(){var a;a=this;return new bf.BBox(0,0,a.width,a.height)};return a}(),bb.fromXML=function(a){var b,d,e,f,g;g=Number(a.getAttribute("w")),e=Number(a.getAttribute("h")),f=Number(a.getAttribute("padding")),d=a.getElementsByTagName("bbox")[0],b=c.fromXML(d);return new bf.View(b,g,e,f)},bm=typeof exports!="undefined"&&exports!==null?exports:this,(bC=bm.kartograph)==null&&(bm.kartograph={}),bm.kartograph.View=bb}).call(this),function(){var a,b=function(a,b){return function(){return a.apply(b,arguments)}};kartograph.Kartograph.prototype.choropleth=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;l=this,k=(w=a.layer)!=null?w:l.layerIds[l.layerIds.length-1];if(!l.layers.hasOwnProperty(k))warn('choropleth error: layer "'+layer_ihad+'" not found');else{e=a.data,f=a.value,g=a.key,d=a.colors,o={};if(g!=null&&__type(e)==="array")for(s=0,u=e.length;s<u;s++)r=e[s],j=r[g],o[String(j)]=r;else for(j in e)r=e[j],o[String(j)]=r;x=l.layers[k].pathsById;for(j in x){p=x[j];for(t=0,v=p.length;t<v;t++)n=p[t],q=(y=o[j])!=null?y:null,c=d(q),a.duration!=null?(__type(a.duration)==="function"?i=a.duration(q):i=a.duration,a.delay!=null?__type(a.delay)==="function"?h=a.delay(q):h=a.delay:h=0,n.svgPath.attrs.fill==="none"&&(m=d(null),n.svgPath.attr("fill",m)),b=Raphael.animation({fill:c},i),n.svgPath.animate(b.delay(h))):n.svgPath.attr("fill",c)}}},kartograph.Kartograph.prototype.dotgrid=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O;n=this,m=(F=a.layer)!=null?F:n.layerIds[n.layerIds.length-1];if(!n.layers.hasOwnProperty(m))warn('dotgrid error: layer "'+m+'" not found');else{l=n.layers[m],b=a.data,c=a.value,d=a.key,p={};if(d!=null&&__type(b)==="array")for(x=0,B=b.length;x<B;x++)s=b[x],k=s[d],p[String(k)]=s;else for(k in b)s=b[k],p[String(k)]=s;f=(H=a.style)!=null?H:{fill:"black",stroke:"none"},u=a.size,j=(I=a.gridsize)!=null?I:15,e=(J=l.dotgrid)!=null?J:{gridsize:j,grid:[]};if(e.gridsize!==j){K=e.grid;for(y=0,C=K.length;y<C;y++)i=K[y],i.shape!=null&&(i.shape.remove(),i.shape=null)}if(j>0){if(e.grid.length===0)for(v=0,L=n.viewport.width;0<=L?v<=L:v>=L;v+=j)for(w=0,M=n.viewport.height;0<=M?w<=M:w>=M;w+=j){i={x:v+(Math.random()-.5)*j*.3,y:w+(Math.random()-.5)*j*.3,pathid:!1},h=!1,N=l.pathsById;for(k in N){q=N[k];for(z=0,D=q.length;z<D;z++){o=q[z];if(o.vpath.isInside(i.x,i.y)){h=!0,i.pathid=k,i.shape=l.paper.circle(i.x,i.y,1);break}}if(h)break}e.grid.push(i)}O=e.grid;for(A=0,E=O.length;A<E;A++)i=O[A],i.pathid&&(r=(G=p[i.pathid])!=null?G:null,t=u(r),i.shape.attr({r:t*.5}),__type(f)==="function"?g=f(r):g=f,i.shape.attr(g))}}},a=function(){function a(a){this.zoomOut=b(this.zoomOut,this),this.zoomIn=b(this.zoomIn,this);var c,d,e,f,g,h,i,j;f=this,f.map=a,c=a.container,d=function(a,b){var c,d,e,f;b==null&&(b=[]),d=$('<div class="'+a+'" />');for(e=0,f=b.length;e<f;e++)c=b[e],d.append(c);return d},e=function(a){return $(a.target).addClass("md")},g=function(a){return $(a.target).removeClass("md")},j=d("plus"),j.mousedown(e),j.mouseup(g),j.click(f.zoomIn),i=d("minus"),i.mousedown(e),i.mouseup(g),i.click(f.zoomOut),h=d("zoom-control",[j,i]),c.append(h)}a.prototype.zoomIn=function(a){var b;b=this,b.map.opts.zoom+=1;return b.map.resize()},a.prototype.zoomOut=function(a){var b;b=this,b.map.opts.zoom-=1,b.map.opts.zoom<1&&(b.map.opts.zoom=1);return b.map.resize()};return a}()}.call(this)
View
0 src/bbox.coffee → src/core/bbox.coffee
File renamed without changes.
View
0 src/clipping.coffee → src/core/clipping.coffee
File renamed without changes.
View
0 src/filter.coffee → src/core/filter.coffee
File renamed without changes.
View
60 src/kartograph.coffee → src/core/kartograph.coffee
@@ -67,6 +67,7 @@ String::trim ?= () ->
class Kartograph
constructor: (container, width, height) ->
+ # instantiates a new map
me = @
me.container = cnt = $(container)
width ?= cnt.width()
@@ -95,7 +96,9 @@ class Kartograph
'z-index': lid+5
if cnt.css('position') == 'static'
- cnt.css 'position','relative'
+ cnt.css
+ position: 'relative'
+ height: vp.height+'px'
svg.addClass id
about = $('desc', paper.canvas).text()
@@ -259,56 +262,6 @@ class Kartograph
me.markers = []
- choropleth: (opts) ->
- me = @
- layer_id = opts.layer ? me.layerIds[me.layerIds.length-1]
-
- if not me.layers.hasOwnProperty layer_id
- warn 'choropleth error: layer "'+layer_ihad+'" not found'
- return
-
- data = opts.data
- data_col = opts.value
- data_key = opts.key
- colors = opts.colors
-
- pathData = {}
-
- if data_key? and __type(data) == "array"
- for row in data
- id = row[data_key]
- pathData[String(id)] = row
- else
- for id, row of data
- pathData[String(id)] = row
-
- for id, paths of me.layers[layer_id].pathsById
- for path in paths
- pd = pathData[id] ? null
- col = colors(pd)
-
- if opts.duration?
- if __type(opts.duration) == "function"
- dur = opts.duration(pd)
- else
- dur = opts.duration
- if opts.delay?
- if __type(opts.delay) == 'function'
- delay = opts.delay(pd)
- else
- delay = opts.delay
- else
- delay = 0
- ncol = colors(null)
- path.svgPath.attr('fill',ncol)
- anim = Raphael.animation({fill: col}, dur)
- path.svgPath.animate(anim.delay(delay))
- else
- path.svgPath.attr('fill', col)
- #path.svgPath.node.setAttribute('style', 'fill:'+col)
- return
-
-
tooltips: (opts) ->
me = @
tooltips = opts.content
@@ -593,7 +546,8 @@ class MapLayerPath
paper = map.paper
view = map.viewBC
me.path = path = kartograph.geom.Path.fromSVG(svg_path)
- me.svgPath = view.projectPath(path).toSVG(paper)
+ me.vpath = view.projectPath(path)
+ me.svgPath = me.vpath.toSVG(paper)
if not map.styles?
me.svgPath.node.setAttribute('class', layer_id)
else
@@ -619,6 +573,7 @@ class MapLayerPath
setView: (view) ->
me = @
path = view.projectPath(me.path)
+ me.vpath = path
if me.path.type == "path"
path_str = path.svgString()
me.svgPath.attr({ path: path_str })
@@ -684,6 +639,7 @@ __type = do ->
(obj) ->
strType = Object::toString.call(obj)
classToType[strType] or "object"
+
root.__type ?= __type
View
0 src/lonlat.coffee → src/core/lonlat.coffee
File renamed without changes.
View
0 src/marker.coffee → src/core/marker.coffee
File renamed without changes.
View
0 src/parsecss.coffee → src/core/parsecss.coffee
File renamed without changes.
View
43 src/path.coffee → src/core/path.coffee
@@ -35,13 +35,12 @@ class Path
throw "path clipping is not implemented yet"
toSVG: (paper) ->
- ###
- translates this path to a SVG path string
- ###
+ ### translates this path to a SVG path string ###
str = @svgString()
paper.path(str)
svgString: ->
+ # returns this path as svg string
me = @
str = ""
glue = if me.closed then "Z M" else "M"
@@ -56,6 +55,7 @@ class Path
str
area: ->
+ # computes the area of this path
me = @
if me.areas?
return me._area
@@ -72,6 +72,7 @@ class Path
me._area
centroid: ->
+ # computes the center of this path
me = @
if me._centroid?
return me._centroid
@@ -93,8 +94,21 @@ class Path
cy += y * k
me._centroid = [cx,cy]
me._centroid
+
+
+ isInside: (x,y) ->
+ # checks wether a given point is inside this path or not
+ me = @
+ bbox = me._bbox
+ if x < bbox[0] or x > bbox[2] or y < bbox[1] or y > bbox[3]
+ return false
-
+ for i in [0..me.contours.length-1]
+ cnt = me.contours[i]
+ if __point_in_polygon(cnt, [x,y])
+ return true
+ return false
+
kartograph.geom.Path = Path
@@ -118,6 +132,7 @@ class Circle extends Path
kartograph.geom.Circle = Circle
+
Path.fromSVG = (path) ->
###
loads a path from a SVG path string
@@ -196,3 +211,23 @@ class Line
kartograph.geom.Line = Line
+__point_in_polygon = (polygon, p) ->
+ pi = Math.PI
+ atan2 = Math.atan2
+ twopi = pi*2
+ n = polygon.length
+ angle = 0
+ for i in [0..n-1]
+ x1 = polygon[i][0] - p[0]
+ y1 = polygon[i][1] - p[1]
+ x2 = polygon[(i+1)%n][0] - p[0]
+ y2 = polygon[(i+1)%n][1] - p[1]
+ theta1 = atan2(y1,x1)
+ theta2 = atan2(y2,x2)
+ dtheta = theta2 - theta1
+ while dtheta > pi
+ dtheta -= twopi
+ while dtheta < -pi
+ dtheta += twopi
+ angle += dtheta
+ return Math.abs(angle) >= pi
View
0 src/proj.coffee → src/core/proj.coffee
File renamed without changes.
View
11 src/view.coffee → src/core/view.coffee
@@ -61,17 +61,26 @@ class View
y = (y - bbox.top) * s + yf
[x,y]
+
projectPath: (path) ->
me = @
if path.type == "path"
contours = []
+ bbox = [99999,99999,-99999,-99999] #minx miny maxx maxy
for pcont in path.contours
cont = []
for [x,y] in pcont
[x,y] = me.project x,y
cont.push([x,y])
+ bbox[0] = Math.min bbox[0],x
+ bbox[1] = Math.min bbox[1],y
+ bbox[2] = Math.max bbox[2],x
+ bbox[3] = Math.max bbox[3],y
contours.push(cont)
- new kartograph.geom.Path path.type,contours,path.closed
+ new_path = new kartograph.geom.Path path.type,contours, path.closed
+ new_path._bbox = bbox
+ new_path
+
else if path.type == "circle"
[x,y] = me.project path.x,path.y
r = path.r * me.scale
View
69 src/modules/choropleth.coffee
@@ -0,0 +1,69 @@
+###
+ kartograph - a svg mapping library
+ Copyright (C) 2011 Gregor Aisch
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+
+
+kartograph.Kartograph::choropleth = (opts) ->
+ me = @
+ layer_id = opts.layer ? me.layerIds[me.layerIds.length-1]
+
+ if not me.layers.hasOwnProperty layer_id
+ warn 'choropleth error: layer "'+layer_ihad+'" not found'
+ return
+
+ data = opts.data
+ data_col = opts.value
+ data_key = opts.key
+ colors = opts.colors
+
+ pathData = {}
+
+ if data_key? and __type(data) == "array"
+ for row in data
+ id = row[data_key]
+ pathData[String(id)] = row
+ else
+ for id, row of data
+ pathData[String(id)] = row
+
+ for id, paths of me.layers[layer_id].pathsById
+ for path in paths
+ pd = pathData[id] ? null
+ col = colors(pd)
+
+ if opts.duration?
+ if __type(opts.duration) == "function"
+ dur = opts.duration(pd)
+ else
+ dur = opts.duration
+ if opts.delay?
+ if __type(opts.delay) == 'function'
+ delay = opts.delay(pd)
+ else
+ delay = opts.delay
+ else
+ delay = 0
+ if path.svgPath.attrs['fill'] == "none"
+ ncol = colors(null)
+ path.svgPath.attr('fill',ncol)
+ anim = Raphael.animation({fill: col}, dur)
+ path.svgPath.animate(anim.delay(delay))
+ else
+ path.svgPath.attr('fill', col)
+ #path.svgPath.node.setAttribute('style', 'fill:'+col)
+ return
+
View
99 src/modules/dotgrid.coffee
@@ -0,0 +1,99 @@
+###
+ kartograph - a svg mapping library
+ Copyright (C) 2011 Gregor Aisch
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+###
+
+
+kartograph.Kartograph::dotgrid = (opts) ->
+ me = @
+ # use specified layer or the last added
+ layer_id = opts.layer ? me.layerIds[me.layerIds.length-1]
+
+ if not me.layers.hasOwnProperty layer_id
+ warn 'dotgrid error: layer "'+layer_id+'" not found'
+ return
+
+ layer = me.layers[layer_id]
+
+ # initialize path data dictionary
+
+ data = opts.data
+ data_col = opts.value
+ data_key = opts.key
+
+ pathData = {}
+ if data_key? and __type(data) == "array"
+ for row in data
+ id = row[data_key]
+ pathData[String(id)] = row
+ else
+ for id, row of data
+ pathData[String(id)] = row
+
+
+ # initialize grid
+
+ dotstyle = opts.style ? { fill: 'black', stroke: 'none' }
+ sizes = opts.size
+ gridsize = opts.gridsize ? 15
+ dotgrid = layer.dotgrid ? { gridsize: gridsize, grid: [] }
+
+ if dotgrid.gridsize != gridsize
+ # assigning a new grid with a different grid size
+ # remove all grid shapes
+ for g in dotgrid.grid
+ if g.shape?
+ g.shape.remove()
+ g.shape = null
+
+ if gridsize > 0
+ # a grid size of 0 will be ignored
+
+ if dotgrid.grid.length == 0
+ # the grid was not yet initialised
+ for x in [0..me.viewport.width] by gridsize
+ for y in [0..me.viewport.height] by gridsize
+ g =
+ x: x+(Math.random()-0.5)*gridsize*0.3
+ y: y+(Math.random()-0.5)*gridsize*0.3
+ pathid: false
+ # assign path id
+ f = false
+ for id, paths of layer.pathsById
+ for path in paths
+ if path.vpath.isInside g.x,g.y
+ f = true
+ g.pathid = id
+ g.shape = layer.paper.circle(g.x,g.y,1)
+ break
+ if f then break
+ dotgrid.grid.push g
+
+ for g in dotgrid.grid
+ if g.pathid
+ pd = pathData[g.pathid] ? null
+ size = sizes(pd)
+ g.shape.attr
+ r: size*0.5
+ if __type(dotstyle) == "function"
+ ds = dotstyle(pd)
+ else
+ ds = dotstyle
+ g.shape.attr ds
+
+ return
+
+
View
0 src/panzoom.coffee → src/modules/panzoom.coffee
File renamed without changes.

0 comments on commit 7328a89

Please sign in to comment.
Something went wrong with that request. Please try again.