ekylibre-cartography 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +3 -0
  3. data/Rakefile +10 -0
  4. data/app/assets/javascripts/cartography.coffee +535 -0
  5. data/app/assets/javascripts/cartography/base.coffee +11 -0
  6. data/app/assets/javascripts/cartography/controls.coffee +463 -0
  7. data/app/assets/javascripts/cartography/events.coffee +36 -0
  8. data/app/assets/javascripts/cartography/layers.coffee +127 -0
  9. data/app/assets/javascripts/cartography/layers/simple.coffee +37 -0
  10. data/app/assets/javascripts/cartography/leaflet/controls.coffee +420 -0
  11. data/app/assets/javascripts/cartography/leaflet/handlers.coffee +461 -0
  12. data/app/assets/javascripts/cartography/leaflet/i18n.coffee +31 -0
  13. data/app/assets/javascripts/cartography/leaflet/layers.coffee +60 -0
  14. data/app/assets/javascripts/cartography/leaflet/toolbars.coffee +450 -0
  15. data/app/assets/javascripts/cartography/patches.js +8 -0
  16. data/app/assets/javascripts/cartography/util.coffee +18 -0
  17. data/app/assets/javascripts/main.js +18 -0
  18. data/app/assets/stylesheets/cartography.css +86 -0
  19. data/app/helpers/cartography_helper.rb +55 -0
  20. data/lib/cartography.rb +1 -0
  21. data/lib/cartography/engine.rb +11 -0
  22. data/lib/cartography/version.rb +3 -0
  23. data/vendor/assets/components/d3-array/dist/d3-array.js +590 -0
  24. data/vendor/assets/components/d3-array/dist/d3-array.min.js +2 -0
  25. data/vendor/assets/components/geojson-equality/dist/geojson-equality.js +295 -0
  26. data/vendor/assets/components/geojson-equality/dist/geojson-equality.js.map +21 -0
  27. data/vendor/assets/components/geojson-equality/dist/geojson-equality.min.js +1 -0
  28. data/vendor/assets/components/leaflet-controlpanel/dist/leaflet.controlpanel.css +29 -0
  29. data/vendor/assets/components/leaflet-controlpanel/dist/leaflet.controlpanel.js +269 -0
  30. data/vendor/assets/components/leaflet-draw-cut/dist/leaflet.draw.cut.css +1 -0
  31. data/vendor/assets/components/leaflet-draw-cut/dist/leaflet.draw.cut.js +8 -0
  32. data/vendor/assets/components/leaflet-draw-merge/dist/leaflet.draw.merge.css +0 -0
  33. data/vendor/assets/components/leaflet-draw-merge/dist/leaflet.draw.merge.js +48026 -0
  34. data/vendor/assets/components/leaflet-draw/dist/leaflet.draw-src.css +326 -0
  35. data/vendor/assets/components/leaflet-draw/dist/leaflet.draw-src.js +4653 -0
  36. data/vendor/assets/components/leaflet-draw/dist/leaflet.draw-src.map +1 -0
  37. data/vendor/assets/components/leaflet-draw/dist/leaflet.draw.css +10 -0
  38. data/vendor/assets/components/leaflet-draw/dist/leaflet.draw.js +10 -0
  39. data/vendor/assets/components/leaflet-geographicutil/dist/leaflet.geographicutil.js +3220 -0
  40. data/vendor/assets/components/leaflet-reactive_measure/dist/reactive_measure.css +30 -0
  41. data/vendor/assets/components/leaflet-reactive_measure/dist/reactive_measure.js +3764 -0
  42. data/vendor/assets/components/leaflet/dist/leaflet-src.js +13609 -0
  43. data/vendor/assets/components/leaflet/dist/leaflet-src.js.map +1 -0
  44. data/vendor/assets/components/leaflet/dist/leaflet-src.map +1 -0
  45. data/vendor/assets/components/leaflet/dist/leaflet.css +632 -0
  46. data/vendor/assets/components/leaflet/dist/leaflet.js +5 -0
  47. data/vendor/assets/components/leaflet/dist/leaflet.js.map +1 -0
  48. data/vendor/assets/components/martinez-polygon-clipping/dist/martinez.min.js +9 -0
  49. data/vendor/assets/components/martinez-polygon-clipping/dist/martinez.umd.js +1716 -0
  50. data/vendor/assets/components/martinez-polygon-clipping/dist/martinez.umd.js.map +1 -0
  51. data/vendor/assets/components/polygon-clipping/dist/polygon-clipping.js +279 -0
  52. data/vendor/assets/components/polygon-clipping/dist/polygon-clipping.min.js +1 -0
  53. data/vendor/assets/components/rtree/dist/rtree.js +911 -0
  54. data/vendor/assets/components/rtree/dist/rtree.min.js +1 -0
  55. data/vendor/assets/components/splaytree/dist/splay.es6.js +765 -0
  56. data/vendor/assets/components/splaytree/dist/splay.es6.js.map +1 -0
  57. data/vendor/assets/components/splaytree/dist/splay.js +797 -0
  58. data/vendor/assets/components/splaytree/dist/splay.js.map +1 -0
  59. metadata +156 -0
@@ -0,0 +1,2 @@
1
+ // https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock
2
+ !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.d3=n.d3||{})}(this,function(n){"use strict";function r(n,r){return n<r?-1:n>r?1:n>=r?0:NaN}function t(n){var t;return 1===n.length&&(t=n,n=function(n,e){return r(t(n),e)}),{left:function(r,t,e,o){for(null==e&&(e=0),null==o&&(o=r.length);e<o;){var u=e+o>>>1;n(r[u],t)<0?e=u+1:o=u}return e},right:function(r,t,e,o){for(null==e&&(e=0),null==o&&(o=r.length);e<o;){var u=e+o>>>1;n(r[u],t)>0?o=u:e=u+1}return e}}}var e=t(r),o=e.right,u=e.left;function f(n,r){return[n,r]}function l(n){return null===n?NaN:+n}function i(n,r){var t,e,o=n.length,u=0,f=-1,i=0,a=0;if(null==r)for(;++f<o;)isNaN(t=l(n[f]))||(a+=(e=t-i)*(t-(i+=e/++u)));else for(;++f<o;)isNaN(t=l(r(n[f],f,n)))||(a+=(e=t-i)*(t-(i+=e/++u)));if(u>1)return a/(u-1)}function a(n,r){var t=i(n,r);return t?Math.sqrt(t):t}function h(n,r){var t,e,o,u=n.length,f=-1;if(null==r){for(;++f<u;)if(null!=(t=n[f])&&t>=t)for(e=o=t;++f<u;)null!=(t=n[f])&&(e>t&&(e=t),o<t&&(o=t))}else for(;++f<u;)if(null!=(t=r(n[f],f,n))&&t>=t)for(e=o=t;++f<u;)null!=(t=r(n[f],f,n))&&(e>t&&(e=t),o<t&&(o=t));return[e,o]}var c=Array.prototype,s=c.slice,g=c.map;function v(n){return function(){return n}}function M(n){return n}function p(n,r,t){n=+n,r=+r,t=(o=arguments.length)<2?(r=n,n=0,1):o<3?1:+t;for(var e=-1,o=0|Math.max(0,Math.ceil((r-n)/t)),u=new Array(o);++e<o;)u[e]=n+e*t;return u}var d=Math.sqrt(50),y=Math.sqrt(10),N=Math.sqrt(2);function m(n,r,t){var e=(r-n)/Math.max(0,t),o=Math.floor(Math.log(e)/Math.LN10),u=e/Math.pow(10,o);return o>=0?(u>=d?10:u>=y?5:u>=N?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(u>=d?10:u>=y?5:u>=N?2:1)}function w(n,r,t){var e=Math.abs(r-n)/Math.max(0,t),o=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),u=e/o;return u>=d?o*=10:u>=y?o*=5:u>=N&&(o*=2),r<n?-o:o}function A(n){return Math.ceil(Math.log(n.length)/Math.LN2)+1}function x(n,r,t){if(null==t&&(t=l),e=n.length){if((r=+r)<=0||e<2)return+t(n[0],0,n);if(r>=1)return+t(n[e-1],e-1,n);var e,o=(e-1)*r,u=Math.floor(o),f=+t(n[u],u,n);return f+(+t(n[u+1],u+1,n)-f)*(o-u)}}function b(n,r){var t,e,o=n.length,u=-1;if(null==r){for(;++u<o;)if(null!=(t=n[u])&&t>=t)for(e=t;++u<o;)null!=(t=n[u])&&e>t&&(e=t)}else for(;++u<o;)if(null!=(t=r(n[u],u,n))&&t>=t)for(e=t;++u<o;)null!=(t=r(n[u],u,n))&&e>t&&(e=t);return e}function q(n){if(!(o=n.length))return[];for(var r=-1,t=b(n,L),e=new Array(t);++r<t;)for(var o,u=-1,f=e[r]=new Array(o);++u<o;)f[u]=n[u][r];return e}function L(n){return n.length}n.bisect=o,n.bisectRight=o,n.bisectLeft=u,n.ascending=r,n.bisector=t,n.cross=function(n,r,t){var e,o,u,l,i=n.length,a=r.length,h=new Array(i*a);for(null==t&&(t=f),e=u=0;e<i;++e)for(l=n[e],o=0;o<a;++o,++u)h[u]=t(l,r[o]);return h},n.descending=function(n,r){return r<n?-1:r>n?1:r>=n?0:NaN},n.deviation=a,n.extent=h,n.histogram=function(){var n=M,r=h,t=A;function e(e){var u,f,l=e.length,i=new Array(l);for(u=0;u<l;++u)i[u]=n(e[u],u,e);var a=r(i),h=a[0],c=a[1],s=t(i,h,c);Array.isArray(s)||(s=w(h,c,s),s=p(Math.ceil(h/s)*s,c,s));for(var g=s.length;s[0]<=h;)s.shift(),--g;for(;s[g-1]>c;)s.pop(),--g;var v,M=new Array(g+1);for(u=0;u<=g;++u)(v=M[u]=[]).x0=u>0?s[u-1]:h,v.x1=u<g?s[u]:c;for(u=0;u<l;++u)h<=(f=i[u])&&f<=c&&M[o(s,f,0,g)].push(e[u]);return M}return e.value=function(r){return arguments.length?(n="function"==typeof r?r:v(r),e):n},e.domain=function(n){return arguments.length?(r="function"==typeof n?n:v([n[0],n[1]]),e):r},e.thresholds=function(n){return arguments.length?(t="function"==typeof n?n:Array.isArray(n)?v(s.call(n)):v(n),e):t},e},n.thresholdFreedmanDiaconis=function(n,t,e){return n=g.call(n,l).sort(r),Math.ceil((e-t)/(2*(x(n,.75)-x(n,.25))*Math.pow(n.length,-1/3)))},n.thresholdScott=function(n,r,t){return Math.ceil((t-r)/(3.5*a(n)*Math.pow(n.length,-1/3)))},n.thresholdSturges=A,n.max=function(n,r){var t,e,o=n.length,u=-1;if(null==r){for(;++u<o;)if(null!=(t=n[u])&&t>=t)for(e=t;++u<o;)null!=(t=n[u])&&t>e&&(e=t)}else for(;++u<o;)if(null!=(t=r(n[u],u,n))&&t>=t)for(e=t;++u<o;)null!=(t=r(n[u],u,n))&&t>e&&(e=t);return e},n.mean=function(n,r){var t,e=n.length,o=e,u=-1,f=0;if(null==r)for(;++u<e;)isNaN(t=l(n[u]))?--o:f+=t;else for(;++u<e;)isNaN(t=l(r(n[u],u,n)))?--o:f+=t;if(o)return f/o},n.median=function(n,t){var e,o=n.length,u=-1,f=[];if(null==t)for(;++u<o;)isNaN(e=l(n[u]))||f.push(e);else for(;++u<o;)isNaN(e=l(t(n[u],u,n)))||f.push(e);return x(f.sort(r),.5)},n.merge=function(n){for(var r,t,e,o=n.length,u=-1,f=0;++u<o;)f+=n[u].length;for(t=new Array(f);--o>=0;)for(r=(e=n[o]).length;--r>=0;)t[--f]=e[r];return t},n.min=b,n.pairs=function(n,r){null==r&&(r=f);for(var t=0,e=n.length-1,o=n[0],u=new Array(e<0?0:e);t<e;)u[t]=r(o,o=n[++t]);return u},n.permute=function(n,r){for(var t=r.length,e=new Array(t);t--;)e[t]=n[r[t]];return e},n.quantile=x,n.range=p,n.scan=function(n,t){if(e=n.length){var e,o,u=0,f=0,l=n[f];for(null==t&&(t=r);++u<e;)(t(o=n[u],l)<0||0!==t(l,l))&&(l=o,f=u);return 0===t(l,l)?f:void 0}},n.shuffle=function(n,r,t){for(var e,o,u=(null==t?n.length:t)-(r=null==r?0:+r);u;)o=Math.random()*u--|0,e=n[u+r],n[u+r]=n[o+r],n[o+r]=e;return n},n.sum=function(n,r){var t,e=n.length,o=-1,u=0;if(null==r)for(;++o<e;)(t=+n[o])&&(u+=t);else for(;++o<e;)(t=+r(n[o],o,n))&&(u+=t);return u},n.ticks=function(n,r,t){var e,o,u,f,l=-1;if(t=+t,(n=+n)==(r=+r)&&t>0)return[n];if((e=r<n)&&(o=n,n=r,r=o),0===(f=m(n,r,t))||!isFinite(f))return[];if(f>0)for(n=Math.ceil(n/f),r=Math.floor(r/f),u=new Array(o=Math.ceil(r-n+1));++l<o;)u[l]=(n+l)*f;else for(n=Math.floor(n*f),r=Math.ceil(r*f),u=new Array(o=Math.ceil(n-r+1));++l<o;)u[l]=(n-l)/f;return e&&u.reverse(),u},n.tickIncrement=m,n.tickStep=w,n.transpose=q,n.variance=i,n.zip=function(){return q(arguments)},Object.defineProperty(n,"__esModule",{value:!0})});
@@ -0,0 +1,295 @@
1
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o;"undefined"!=typeof window?o=window:"undefined"!=typeof global?o=global:"undefined"!=typeof self&&(o=self),o.GeojsonEquality=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
+ //index.js
3
+ var deepEqual = require('deep-equal');
4
+
5
+ var Equality = function(opt) {
6
+ this.precision = opt && opt.precision ? opt.precision : 17;
7
+ this.direction = opt && opt.direction ? opt.direction : false;
8
+ this.pseudoNode = opt && opt.pseudoNode ? opt.pseudoNode : false;
9
+ this.objectComparator = opt && opt.objectComparator ? opt.objectComparator : objectComparator;
10
+ };
11
+
12
+ Equality.prototype.compare = function(g1,g2) {
13
+ if (g1.type !== g2.type || !sameLength(g1,g2)) return false;
14
+
15
+ switch(g1.type) {
16
+ case 'Point':
17
+ return this.compareCoord(g1.coordinates, g2.coordinates);
18
+ break;
19
+ case 'LineString':
20
+ return this.compareLine(g1.coordinates, g2.coordinates,0,false);
21
+ break;
22
+ case 'Polygon':
23
+ return this.comparePolygon(g1,g2);
24
+ break;
25
+ case 'Feature':
26
+ return this.compareFeature(g1, g2);
27
+ default:
28
+ if (g1.type.indexOf('Multi') === 0) {
29
+ var context = this;
30
+ var g1s = explode(g1);
31
+ var g2s = explode(g2);
32
+ return g1s.every(function(g1part) {
33
+ return this.some(function(g2part) {
34
+ return context.compare(g1part,g2part);
35
+ });
36
+ },g2s);
37
+ }
38
+ }
39
+ return false;
40
+ };
41
+
42
+ function explode(g) {
43
+ return g.coordinates.map(function(part) {
44
+ return {
45
+ type: g.type.replace('Multi', ''),
46
+ coordinates: part}
47
+ });
48
+ }
49
+ //compare length of coordinates/array
50
+ function sameLength(g1,g2) {
51
+ return g1.hasOwnProperty('coordinates') ?
52
+ g1.coordinates.length === g2.coordinates.length
53
+ : g1.length === g2.length;
54
+ }
55
+
56
+ // compare the two coordinates [x,y]
57
+ Equality.prototype.compareCoord = function(c1,c2) {
58
+ if (c1.length !== c2.length) {
59
+ return false;
60
+ }
61
+
62
+ for (var i=0; i < c1.length; i++) {
63
+ if (c1[i].toFixed(this.precision) !== c2[i].toFixed(this.precision)) {
64
+ return false;
65
+ }
66
+ }
67
+ return true;
68
+ };
69
+
70
+ Equality.prototype.compareLine = function(path1,path2,ind,isPoly) {
71
+ if (!sameLength(path1,path2)) return false;
72
+ var p1 = this.pseudoNode ? path1 : this.removePseudo(path1);
73
+ var p2 = this.pseudoNode ? path2 : this.removePseudo(path2);
74
+ if (isPoly && !this.compareCoord(p1[0],p2[0])) {
75
+ // fix start index of both to same point
76
+ p2 = this.fixStartIndex(p2,p1);
77
+ if(!p2) return;
78
+ }
79
+ // for linestring ind =0 and for polygon ind =1
80
+ var sameDirection = this.compareCoord(p1[ind],p2[ind]);
81
+ if (this.direction || sameDirection
82
+ ) {
83
+ return this.comparePath(p1, p2);
84
+ } else {
85
+ if (this.compareCoord(p1[ind],p2[p2.length - (1+ind)])
86
+ ) {
87
+ return this.comparePath(p1.slice().reverse(), p2);
88
+ }
89
+ return false;
90
+ }
91
+ };
92
+ Equality.prototype.fixStartIndex = function(sourcePath,targetPath) {
93
+ //make sourcePath first point same as of targetPath
94
+ var correctPath,ind = -1;
95
+ for (var i=0; i< sourcePath.length; i++) {
96
+ if(this.compareCoord(sourcePath[i],targetPath[0])) {
97
+ ind = i;
98
+ break;
99
+ }
100
+ }
101
+ if (ind >= 0) {
102
+ correctPath = [].concat(
103
+ sourcePath.slice(ind,sourcePath.length),
104
+ sourcePath.slice(1,ind+1));
105
+ }
106
+ return correctPath;
107
+ };
108
+ Equality.prototype.comparePath = function (p1,p2) {
109
+ var cont = this;
110
+ return p1.every(function(c,i) {
111
+ return cont.compareCoord(c,this[i]);
112
+ },p2);
113
+ };
114
+
115
+ Equality.prototype.comparePolygon = function(g1,g2) {
116
+ if (this.compareLine(g1.coordinates[0],g2.coordinates[0],1,true)) {
117
+ var holes1 = g1.coordinates.slice(1,g1.coordinates.length);
118
+ var holes2 = g2.coordinates.slice(1,g2.coordinates.length);
119
+ var cont = this;
120
+ return holes1.every(function(h1) {
121
+ return this.some(function(h2) {
122
+ return cont.compareLine(h1,h2,1,true);
123
+ });
124
+ },holes2);
125
+ } else {
126
+ return false;
127
+ }
128
+ };
129
+
130
+ Equality.prototype.compareFeature = function(g1,g2) {
131
+ if (
132
+ g1.id !== g2.id ||
133
+ !this.objectComparator(g1.properties, g2.properties) ||
134
+ !this.compareBBox(g1,g2)
135
+ ) {
136
+ return false;
137
+ }
138
+ return this.compare(g1.geometry, g2.geometry);
139
+ };
140
+
141
+ Equality.prototype.compareBBox = function(g1,g2) {
142
+ if (
143
+ (!g1.bbox && !g2.bbox) ||
144
+ (
145
+ g1.bbox && g2.bbox &&
146
+ this.compareCoord(g1.bbox, g2.bbox)
147
+ )
148
+ ) {
149
+ return true;
150
+ }
151
+ return false;
152
+ };
153
+ Equality.prototype.removePseudo = function(path) {
154
+ //TODO to be implement
155
+ return path;
156
+ };
157
+
158
+ function objectComparator(obj1, obj2) {
159
+ return deepEqual(obj1, obj2, {strict: true});
160
+ }
161
+
162
+ module.exports = Equality;
163
+
164
+ },{"deep-equal":2}],2:[function(require,module,exports){
165
+ var pSlice = Array.prototype.slice;
166
+ var objectKeys = require('./lib/keys.js');
167
+ var isArguments = require('./lib/is_arguments.js');
168
+
169
+ var deepEqual = module.exports = function (actual, expected, opts) {
170
+ if (!opts) opts = {};
171
+ // 7.1. All identical values are equivalent, as determined by ===.
172
+ if (actual === expected) {
173
+ return true;
174
+
175
+ } else if (actual instanceof Date && expected instanceof Date) {
176
+ return actual.getTime() === expected.getTime();
177
+
178
+ // 7.3. Other pairs that do not both pass typeof value == 'object',
179
+ // equivalence is determined by ==.
180
+ } else if (typeof actual != 'object' && typeof expected != 'object') {
181
+ return opts.strict ? actual === expected : actual == expected;
182
+
183
+ // 7.4. For all other Object pairs, including Array objects, equivalence is
184
+ // determined by having the same number of owned properties (as verified
185
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
186
+ // (although not necessarily the same order), equivalent values for every
187
+ // corresponding key, and an identical 'prototype' property. Note: this
188
+ // accounts for both named and indexed properties on Arrays.
189
+ } else {
190
+ return objEquiv(actual, expected, opts);
191
+ }
192
+ }
193
+
194
+ function isUndefinedOrNull(value) {
195
+ return value === null || value === undefined;
196
+ }
197
+
198
+ function isBuffer (x) {
199
+ if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
200
+ if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
201
+ return false;
202
+ }
203
+ if (x.length > 0 && typeof x[0] !== 'number') return false;
204
+ return true;
205
+ }
206
+
207
+ function objEquiv(a, b, opts) {
208
+ var i, key;
209
+ if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
210
+ return false;
211
+ // an identical 'prototype' property.
212
+ if (a.prototype !== b.prototype) return false;
213
+ //~~~I've managed to break Object.keys through screwy arguments passing.
214
+ // Converting to array solves the problem.
215
+ if (isArguments(a)) {
216
+ if (!isArguments(b)) {
217
+ return false;
218
+ }
219
+ a = pSlice.call(a);
220
+ b = pSlice.call(b);
221
+ return deepEqual(a, b, opts);
222
+ }
223
+ if (isBuffer(a)) {
224
+ if (!isBuffer(b)) {
225
+ return false;
226
+ }
227
+ if (a.length !== b.length) return false;
228
+ for (i = 0; i < a.length; i++) {
229
+ if (a[i] !== b[i]) return false;
230
+ }
231
+ return true;
232
+ }
233
+ try {
234
+ var ka = objectKeys(a),
235
+ kb = objectKeys(b);
236
+ } catch (e) {//happens when one is a string literal and the other isn't
237
+ return false;
238
+ }
239
+ // having the same number of owned properties (keys incorporates
240
+ // hasOwnProperty)
241
+ if (ka.length != kb.length)
242
+ return false;
243
+ //the same set of keys (although not necessarily the same order),
244
+ ka.sort();
245
+ kb.sort();
246
+ //~~~cheap key test
247
+ for (i = ka.length - 1; i >= 0; i--) {
248
+ if (ka[i] != kb[i])
249
+ return false;
250
+ }
251
+ //equivalent values for every corresponding key, and
252
+ //~~~possibly expensive deep test
253
+ for (i = ka.length - 1; i >= 0; i--) {
254
+ key = ka[i];
255
+ if (!deepEqual(a[key], b[key], opts)) return false;
256
+ }
257
+ return typeof a === typeof b;
258
+ }
259
+
260
+ },{"./lib/is_arguments.js":3,"./lib/keys.js":4}],3:[function(require,module,exports){
261
+ var supportsArgumentsClass = (function(){
262
+ return Object.prototype.toString.call(arguments)
263
+ })() == '[object Arguments]';
264
+
265
+ exports = module.exports = supportsArgumentsClass ? supported : unsupported;
266
+
267
+ exports.supported = supported;
268
+ function supported(object) {
269
+ return Object.prototype.toString.call(object) == '[object Arguments]';
270
+ };
271
+
272
+ exports.unsupported = unsupported;
273
+ function unsupported(object){
274
+ return object &&
275
+ typeof object == 'object' &&
276
+ typeof object.length == 'number' &&
277
+ Object.prototype.hasOwnProperty.call(object, 'callee') &&
278
+ !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
279
+ false;
280
+ };
281
+
282
+ },{}],4:[function(require,module,exports){
283
+ exports = module.exports = typeof Object.keys === 'function'
284
+ ? Object.keys : shim;
285
+
286
+ exports.shim = shim;
287
+ function shim (obj) {
288
+ var keys = [];
289
+ for (var key in obj) keys.push(key);
290
+ return keys;
291
+ }
292
+
293
+ },{}]},{},[1])(1)
294
+ });
295
+ //# sourceMappingURL=geojson-equality.js.map
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [
4
+ "node_modules/browserify/node_modules/browser-pack/_prelude.js",
5
+ "/home/gaganb/projects/geosquare/geojson-equality/index.js",
6
+ "/home/gaganb/projects/geosquare/geojson-equality/node_modules/deep-equal/index.js",
7
+ "/home/gaganb/projects/geosquare/geojson-equality/node_modules/deep-equal/lib/is_arguments.js",
8
+ "/home/gaganb/projects/geosquare/geojson-equality/node_modules/deep-equal/lib/keys.js"
9
+ ],
10
+ "names": [],
11
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA",
12
+ "file": "generated.js",
13
+ "sourceRoot": "",
14
+ "sourcesContent": [
15
+ "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})",
16
+ "//index.js\nvar deepEqual = require('deep-equal');\n\nvar Equality = function(opt) {\n this.precision = opt && opt.precision ? opt.precision : 17;\n this.direction = opt && opt.direction ? opt.direction : false;\n this.pseudoNode = opt && opt.pseudoNode ? opt.pseudoNode : false;\n this.objectComparator = opt && opt.objectComparator ? opt.objectComparator : objectComparator;\n};\n\nEquality.prototype.compare = function(g1,g2) {\n if (g1.type !== g2.type || !sameLength(g1,g2)) return false;\n\n switch(g1.type) {\n case 'Point':\n return this.compareCoord(g1.coordinates, g2.coordinates);\n break;\n case 'LineString':\n return this.compareLine(g1.coordinates, g2.coordinates,0,false);\n break;\n case 'Polygon':\n return this.comparePolygon(g1,g2);\n break;\n case 'Feature':\n return this.compareFeature(g1, g2);\n default:\n if (g1.type.indexOf('Multi') === 0) {\n var context = this;\n var g1s = explode(g1);\n var g2s = explode(g2);\n return g1s.every(function(g1part) {\n return this.some(function(g2part) {\n return context.compare(g1part,g2part);\n });\n },g2s);\n }\n }\n return false;\n};\n\nfunction explode(g) {\n return g.coordinates.map(function(part) {\n return {\n type: g.type.replace('Multi', ''),\n coordinates: part}\n });\n}\n//compare length of coordinates/array\nfunction sameLength(g1,g2) {\n return g1.hasOwnProperty('coordinates') ?\n g1.coordinates.length === g2.coordinates.length\n : g1.length === g2.length;\n}\n\n// compare the two coordinates [x,y]\nEquality.prototype.compareCoord = function(c1,c2) {\n if (c1.length !== c2.length) {\n return false;\n }\n\n for (var i=0; i < c1.length; i++) {\n if (c1[i].toFixed(this.precision) !== c2[i].toFixed(this.precision)) {\n return false;\n }\n }\n return true;\n};\n\nEquality.prototype.compareLine = function(path1,path2,ind,isPoly) {\n if (!sameLength(path1,path2)) return false;\n var p1 = this.pseudoNode ? path1 : this.removePseudo(path1);\n var p2 = this.pseudoNode ? path2 : this.removePseudo(path2);\n if (isPoly && !this.compareCoord(p1[0],p2[0])) {\n // fix start index of both to same point\n p2 = this.fixStartIndex(p2,p1);\n if(!p2) return;\n }\n // for linestring ind =0 and for polygon ind =1\n var sameDirection = this.compareCoord(p1[ind],p2[ind]);\n if (this.direction || sameDirection\n ) {\n return this.comparePath(p1, p2);\n } else {\n if (this.compareCoord(p1[ind],p2[p2.length - (1+ind)])\n ) {\n return this.comparePath(p1.slice().reverse(), p2);\n }\n return false;\n }\n};\nEquality.prototype.fixStartIndex = function(sourcePath,targetPath) {\n //make sourcePath first point same as of targetPath\n var correctPath,ind = -1;\n for (var i=0; i< sourcePath.length; i++) {\n if(this.compareCoord(sourcePath[i],targetPath[0])) {\n ind = i;\n break;\n }\n }\n if (ind >= 0) {\n correctPath = [].concat(\n sourcePath.slice(ind,sourcePath.length),\n sourcePath.slice(1,ind+1));\n }\n return correctPath;\n};\nEquality.prototype.comparePath = function (p1,p2) {\n var cont = this;\n return p1.every(function(c,i) {\n return cont.compareCoord(c,this[i]);\n },p2);\n};\n\nEquality.prototype.comparePolygon = function(g1,g2) {\n if (this.compareLine(g1.coordinates[0],g2.coordinates[0],1,true)) {\n var holes1 = g1.coordinates.slice(1,g1.coordinates.length);\n var holes2 = g2.coordinates.slice(1,g2.coordinates.length);\n var cont = this;\n return holes1.every(function(h1) {\n return this.some(function(h2) {\n return cont.compareLine(h1,h2,1,true);\n });\n },holes2);\n } else {\n return false;\n }\n};\n\nEquality.prototype.compareFeature = function(g1,g2) {\n if (\n g1.id !== g2.id ||\n !this.objectComparator(g1.properties, g2.properties) ||\n !this.compareBBox(g1,g2)\n ) {\n return false;\n }\n return this.compare(g1.geometry, g2.geometry);\n};\n\nEquality.prototype.compareBBox = function(g1,g2) {\n if (\n (!g1.bbox && !g2.bbox) || \n (\n g1.bbox && g2.bbox &&\n this.compareCoord(g1.bbox, g2.bbox)\n )\n ) {\n return true;\n }\n return false;\n};\nEquality.prototype.removePseudo = function(path) {\n //TODO to be implement\n return path;\n};\n\nfunction objectComparator(obj1, obj2) {\n return deepEqual(obj1, obj2, {strict: true});\n}\n\nmodule.exports = Equality;\n",
17
+ "var pSlice = Array.prototype.slice;\nvar objectKeys = require('./lib/keys.js');\nvar isArguments = require('./lib/is_arguments.js');\n\nvar deepEqual = module.exports = function (actual, expected, opts) {\n if (!opts) opts = {};\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n\n } else if (actual instanceof Date && expected instanceof Date) {\n return actual.getTime() === expected.getTime();\n\n // 7.3. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if (typeof actual != 'object' && typeof expected != 'object') {\n return opts.strict ? actual === expected : actual == expected;\n\n // 7.4. For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else {\n return objEquiv(actual, expected, opts);\n }\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isBuffer (x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') return false;\n return true;\n}\n\nfunction objEquiv(a, b, opts) {\n var i, key;\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b))\n return false;\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) return false;\n //~~~I've managed to break Object.keys through screwy arguments passing.\n // Converting to array solves the problem.\n if (isArguments(a)) {\n if (!isArguments(b)) {\n return false;\n }\n a = pSlice.call(a);\n b = pSlice.call(b);\n return deepEqual(a, b, opts);\n }\n if (isBuffer(a)) {\n if (!isBuffer(b)) {\n return false;\n }\n if (a.length !== b.length) return false;\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n try {\n var ka = objectKeys(a),\n kb = objectKeys(b);\n } catch (e) {//happens when one is a string literal and the other isn't\n return false;\n }\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length != kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepEqual(a[key], b[key], opts)) return false;\n }\n return typeof a === typeof b;\n}\n",
18
+ "var supportsArgumentsClass = (function(){\n return Object.prototype.toString.call(arguments)\n})() == '[object Arguments]';\n\nexports = module.exports = supportsArgumentsClass ? supported : unsupported;\n\nexports.supported = supported;\nfunction supported(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n};\n\nexports.unsupported = unsupported;\nfunction unsupported(object){\n return object &&\n typeof object == 'object' &&\n typeof object.length == 'number' &&\n Object.prototype.hasOwnProperty.call(object, 'callee') &&\n !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||\n false;\n};\n",
19
+ "exports = module.exports = typeof Object.keys === 'function'\n ? Object.keys : shim;\n\nexports.shim = shim;\nfunction shim (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n}\n"
20
+ ]
21
+ }
@@ -0,0 +1 @@
1
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.GeojsonEquality=e()}}(function(){return function e(t,r,o){function n(c,u){if(!r[c]){if(!t[c]){var p="function"==typeof require&&require;if(!u&&p)return p(c,!0);if(i)return i(c,!0);var s=new Error("Cannot find module '"+c+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[c]={exports:{}};t[c][0].call(a.exports,function(e){var r=t[c][1][e];return n(r?r:e)},a,a.exports,e,t,r,o)}return r[c].exports}for(var i="function"==typeof require&&require,c=0;c<o.length;c++)n(o[c]);return n}({1:[function(e,t){function r(e){return e.coordinates.map(function(t){return{type:e.type.replace("Multi",""),coordinates:t}})}function o(e,t){return e.hasOwnProperty("coordinates")?e.coordinates.length===t.coordinates.length:e.length===t.length}function n(e,t){return i(e,t,{strict:!0})}var i=e("deep-equal"),c=function(e){this.precision=e&&e.precision?e.precision:17,this.direction=e&&e.direction?e.direction:!1,this.pseudoNode=e&&e.pseudoNode?e.pseudoNode:!1,this.objectComparator=e&&e.objectComparator?e.objectComparator:n};c.prototype.compare=function(e,t){if(e.type!==t.type||!o(e,t))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,t.coordinates);case"LineString":return this.compareLine(e.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(e,t);case"Feature":return this.compareFeature(e,t);default:if(0===e.type.indexOf("Multi")){var n=this,i=r(e),c=r(t);return i.every(function(e){return this.some(function(t){return n.compare(e,t)})},c)}}return!1},c.prototype.compareCoord=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r].toFixed(this.precision)!==t[r].toFixed(this.precision))return!1;return!0},c.prototype.compareLine=function(e,t,r,n){if(!o(e,t))return!1;var i=this.pseudoNode?e:this.removePseudo(e),c=this.pseudoNode?t:this.removePseudo(t);if(!n||this.compareCoord(i[0],c[0])||(c=this.fixStartIndex(c,i))){var u=this.compareCoord(i[r],c[r]);return this.direction||u?this.comparePath(i,c):this.compareCoord(i[r],c[c.length-(1+r)])?this.comparePath(i.slice().reverse(),c):!1}},c.prototype.fixStartIndex=function(e,t){for(var r,o=-1,n=0;n<e.length;n++)if(this.compareCoord(e[n],t[0])){o=n;break}return o>=0&&(r=[].concat(e.slice(o,e.length),e.slice(1,o+1))),r},c.prototype.comparePath=function(e,t){var r=this;return e.every(function(e,t){return r.compareCoord(e,this[t])},t)},c.prototype.comparePolygon=function(e,t){if(this.compareLine(e.coordinates[0],t.coordinates[0],1,!0)){var r=e.coordinates.slice(1,e.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),n=this;return r.every(function(e){return this.some(function(t){return n.compareLine(e,t,1,!0)})},o)}return!1},c.prototype.compareFeature=function(e,t){return e.id===t.id&&this.objectComparator(e.properties,t.properties)&&this.compareBBox(e,t)?this.compare(e.geometry,t.geometry):!1},c.prototype.compareBBox=function(e,t){return!e.bbox&&!t.bbox||e.bbox&&t.bbox&&this.compareCoord(e.bbox,t.bbox)?!0:!1},c.prototype.removePseudo=function(e){return e},t.exports=c},{"deep-equal":2}],2:[function(e,t){function r(e){return null===e||void 0===e}function o(e){return e&&"object"==typeof e&&"number"==typeof e.length?"function"!=typeof e.copy||"function"!=typeof e.slice?!1:e.length>0&&"number"!=typeof e[0]?!1:!0:!1}function n(e,t,n){var s,a;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(u(e))return u(t)?(e=i.call(e),t=i.call(t),p(e,t,n)):!1;if(o(e)){if(!o(t))return!1;if(e.length!==t.length)return!1;for(s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}try{var f=c(e),l=c(t)}catch(d){return!1}if(f.length!=l.length)return!1;for(f.sort(),l.sort(),s=f.length-1;s>=0;s--)if(f[s]!=l[s])return!1;for(s=f.length-1;s>=0;s--)if(a=f[s],!p(e[a],t[a],n))return!1;return typeof e==typeof t}var i=Array.prototype.slice,c=e("./lib/keys.js"),u=e("./lib/is_arguments.js"),p=t.exports=function(e,t,r){return r||(r={}),e===t?!0:e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():"object"!=typeof e&&"object"!=typeof t?r.strict?e===t:e==t:n(e,t,r)}},{"./lib/is_arguments.js":3,"./lib/keys.js":4}],3:[function(e,t,r){function o(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function n(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var i="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();r=t.exports=i?o:n,r.supported=o,r.unsupported=n},{}],4:[function(e,t,r){function o(e){var t=[];for(var r in e)t.push(r);return t}r=t.exports="function"==typeof Object.keys?Object.keys:o,r.shim=o},{}]},{},[1])(1)});
@@ -0,0 +1,29 @@
1
+ .leaflet-control-controlPanel {
2
+ background-color: #fff;
3
+ border: 2px solid rgba(0, 0, 0, 0.2);
4
+ border-radius: 2px; }
5
+ .leaflet-control-controlPanel.large {
6
+ width: 200px;
7
+ height: 390px; }
8
+ .leaflet-control-controlPanel .leaflet-control-controlPanel-properties {
9
+ width: 98%;
10
+ height: 80%;
11
+ padding: 1%;
12
+ float: left; }
13
+ .leaflet-control-controlPanel .leaflet-control-controlPanel-properties .property {
14
+ margin-top: 10px; }
15
+ .leaflet-control-controlPanel .leaflet-control-controlPanel-actions {
16
+ padding: 2%;
17
+ width: 96%;
18
+ height: 16%;
19
+ float: left;
20
+ text-align: center;
21
+ border-top: 1px solid rgba(0, 0, 0, 0.2); }
22
+ .leaflet-control-controlPanel .leaflet-control-controlPanel-actions .button {
23
+ border: 2px solid rgba(0, 0, 0, 0.2);
24
+ font-size: 0.8em;
25
+ display: inline-block;
26
+ margin-right: 5%;
27
+ padding: 1%;
28
+ border-radius: 2px;
29
+ margin-top: 8%; }
@@ -0,0 +1,269 @@
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, {
40
+ /******/ configurable: false,
41
+ /******/ enumerable: true,
42
+ /******/ get: getter
43
+ /******/ });
44
+ /******/ }
45
+ /******/ };
46
+ /******/
47
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
48
+ /******/ __webpack_require__.n = function(module) {
49
+ /******/ var getter = module && module.__esModule ?
50
+ /******/ function getDefault() { return module['default']; } :
51
+ /******/ function getModuleExports() { return module; };
52
+ /******/ __webpack_require__.d(getter, 'a', getter);
53
+ /******/ return getter;
54
+ /******/ };
55
+ /******/
56
+ /******/ // Object.prototype.hasOwnProperty.call
57
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58
+ /******/
59
+ /******/ // __webpack_public_path__
60
+ /******/ __webpack_require__.p = "";
61
+ /******/
62
+ /******/ // Load entry module and return exports
63
+ /******/ return __webpack_require__(__webpack_require__.s = 0);
64
+ /******/ })
65
+ /************************************************************************/
66
+ /******/ ([
67
+ /* 0 */
68
+ /***/ (function(module, exports, __webpack_require__) {
69
+
70
+ __webpack_require__(1);
71
+ module.exports = __webpack_require__(4);
72
+
73
+
74
+ /***/ }),
75
+ /* 1 */
76
+ /***/ (function(module, exports, __webpack_require__) {
77
+
78
+ var L, _,
79
+ extend = 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; },
80
+ hasProp = {}.hasOwnProperty;
81
+
82
+ L = __webpack_require__(2);
83
+
84
+ _ = __webpack_require__(3);
85
+
86
+ L.Control.ControlPanel = (function(superClass) {
87
+ extend(ControlPanel, superClass);
88
+
89
+ ControlPanel.prototype.options = {
90
+ position: 'bottomleft',
91
+ className: 'leaflet-control-controlPanel',
92
+ titleClassName: 'leaflet-control-controlPanel-title',
93
+ propertiesClassName: 'leaflet-control-controlPanel-properties',
94
+ actionsClassName: 'leaflet-control-controlPanel-actions',
95
+ expanded: true,
96
+ ignoreActions: false
97
+ };
98
+
99
+ function ControlPanel(_toolbar, options) {
100
+ this._toolbar = _toolbar;
101
+ if (options == null) {
102
+ options = {};
103
+ }
104
+ this.options = _.merge(this.options, options);
105
+ this._toolbar.on('enable', this.addPanel, this);
106
+ this._toolbar.on('disable', this.removePanel, this);
107
+ this._actionButtons = [];
108
+ }
109
+
110
+ ControlPanel.prototype.addPanel = function() {
111
+ L.DomUtil.remove(this._toolbar._actionsContainer);
112
+ this._toolbar._map.addControl(this);
113
+ return L.DomEvent.on(this._toolbar._map._container, 'keyup', this._onCancel, this);
114
+ };
115
+
116
+ ControlPanel.prototype.removePanel = function() {
117
+ L.DomEvent.off(this._toolbar._map._container, 'keyup', this._onCancel, this);
118
+ return this._toolbar._map.removeControl(this);
119
+ };
120
+
121
+ ControlPanel.prototype._onCancel = function(e) {
122
+ if (e.keyCode === 27) {
123
+ return this._toolbar.disable();
124
+ }
125
+ };
126
+
127
+ ControlPanel.prototype.onAdd = function(map) {
128
+ this._container = L.DomUtil.create('div', this.options.className);
129
+ if (this.options.expanded) {
130
+ L.DomUtil.addClass(this._container, 'large');
131
+ }
132
+ if (this.options.title) {
133
+ this._titleContainer = L.DomUtil.create('div', this.options.titleClassName, this._container);
134
+ this._titleContainer.innerHTML = this.options.title;
135
+ }
136
+ this._propertiesContainer = L.DomUtil.create('div', this.options.propertiesClassName, this._container);
137
+ L.DomEvent.disableScrollPropagation(this._container);
138
+ if (!this.options.ignoreActions) {
139
+ this._actionsContainer = L.DomUtil.create('div', this.options.actionsClassName, this._container);
140
+ this._showActionsToolbar();
141
+ }
142
+ this.addProperties();
143
+ return this._container;
144
+ };
145
+
146
+ ControlPanel.prototype.addProperties = function() {
147
+ this._addAnimatedHelper();
148
+ return this._addPointerCoordinates();
149
+ };
150
+
151
+ ControlPanel.prototype.onRemove = function() {};
152
+
153
+ ControlPanel.prototype._createActions = function(handler) {
154
+ var button, buttons, container, di, div, dl, i, l, results;
155
+ container = this._actionsContainer;
156
+ buttons = this._toolbar.getActions(handler);
157
+ l = buttons.length;
158
+ di = 0;
159
+ dl = this._actionButtons.length;
160
+ while (di < dl) {
161
+ this._toolbar._disposeButton(this._actionButtons[di].button, this._actionButtons[di].callback);
162
+ di++;
163
+ }
164
+ this._actionButtons = [];
165
+ while (container.firstChild) {
166
+ container.removeChild(container.firstChild);
167
+ }
168
+ i = 0;
169
+ results = [];
170
+ while (i < l) {
171
+ if ('enabled' in buttons[i] && !buttons[i].enabled) {
172
+ i++;
173
+ continue;
174
+ }
175
+ div = L.DomUtil.create('div', 'button', container);
176
+ button = this._toolbar._createButton({
177
+ title: buttons[i].title,
178
+ text: buttons[i].text,
179
+ container: div,
180
+ callback: buttons[i].callback,
181
+ context: buttons[i].context
182
+ });
183
+ this._actionButtons.push({
184
+ button: button,
185
+ callback: buttons[i].callback
186
+ });
187
+ results.push(i++);
188
+ }
189
+ return results;
190
+ };
191
+
192
+ ControlPanel.prototype._showActionsToolbar = function() {
193
+ var buttonIndex, lastButtonIndex, toolbarPosition;
194
+ buttonIndex = this._toolbar._activeMode.buttonIndex;
195
+ lastButtonIndex = this._toolbar._lastButtonIndex;
196
+ toolbarPosition = this._toolbar._activeMode.button.offsetTop - 1;
197
+ this._createActions(this._toolbar._activeMode.handler);
198
+ this._actionsContainer.style.top = toolbarPosition + 'px';
199
+ if (buttonIndex === 0) {
200
+ L.DomUtil.addClass(this._actionsContainer, 'leaflet-draw-actions-top');
201
+ }
202
+ if (buttonIndex === lastButtonIndex) {
203
+ L.DomUtil.addClass(this._actionsContainer, 'leaflet-draw-actions-bottom');
204
+ }
205
+ this._actionsContainer.style.display = 'block';
206
+ };
207
+
208
+ ControlPanel.prototype._hideActionsToolbar = function() {
209
+ this._actionsContainer.style.display = 'none';
210
+ L.DomUtil.removeClass(this._actionsContainer, 'leaflet-draw-actions-top');
211
+ L.DomUtil.removeClass(this._actionsContainer, 'leaflet-draw-actions-bottom');
212
+ };
213
+
214
+ ControlPanel.prototype._addAnimatedHelper = function() {
215
+ var container, img;
216
+ container = L.DomUtil.create('div', 'property', this._propertiesContainer);
217
+ this._animatedHelperContainer = L.DomUtil.create('div', 'property-content', container);
218
+ if (this.options.animatedHelper) {
219
+ img = L.DomUtil.create('img', 'animated-helper', this._animatedHelperContainer);
220
+ return img.src = this.options.animatedHelper;
221
+ }
222
+ };
223
+
224
+ ControlPanel.prototype._addPointerCoordinates = function() {
225
+ var container, containerTitle;
226
+ container = L.DomUtil.create('div', 'property', this._propertiesContainer);
227
+ containerTitle = L.DomUtil.create('div', 'property-title', container);
228
+ containerTitle.innerHTML = this.options.coordinatesProperty;
229
+ this._pointerCoordinatesContainer = L.DomUtil.create('div', 'property-content', container);
230
+ return this._map.on('mousemove', this._onUpdateCoordinates, this);
231
+ };
232
+
233
+ ControlPanel.prototype._onUpdateCoordinates = function(e) {
234
+ var coordinates, lat, latRow, lng, lngRow;
235
+ coordinates = e.latlng;
236
+ L.DomUtil.empty(this._pointerCoordinatesContainer);
237
+ latRow = L.DomUtil.create('div', 'coordinates-row', this._pointerCoordinatesContainer);
238
+ lat = L.DomUtil.create('div', 'coordinate', latRow);
239
+ lat.innerHTML = "lat: " + coordinates.lat;
240
+ lngRow = L.DomUtil.create('div', 'coordinates-row', this._pointerCoordinatesContainer);
241
+ lng = L.DomUtil.create('div', 'coordinate', lngRow);
242
+ return lng.innerHTML = "lng: " + coordinates.lng;
243
+ };
244
+
245
+ return ControlPanel;
246
+
247
+ })(L.Control);
248
+
249
+
250
+ /***/ }),
251
+ /* 2 */
252
+ /***/ (function(module, exports) {
253
+
254
+ module.exports = L;
255
+
256
+ /***/ }),
257
+ /* 3 */
258
+ /***/ (function(module, exports) {
259
+
260
+ module.exports = _;
261
+
262
+ /***/ }),
263
+ /* 4 */
264
+ /***/ (function(module, exports) {
265
+
266
+ // removed by extract-text-webpack-plugin
267
+
268
+ /***/ })
269
+ /******/ ]);