From 4127ae91822f9abeffeb614e95b6f9d832ecf7c6 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sat, 6 Jun 2020 11:39:50 -0600 Subject: replace bad checkboxes with good map-based UI --- dev/georgia/convert.py | 2 +- dev/nyc/convert.py | 2 +- dev/utah/convert.py | 12 +- dist/dragula.min.js | 1 - dist/georgia/index.html | 11 +- dist/georgia/sources.js | 19956 +++++++++++++++------ dist/hls.min.js | 2 - dist/hls.min.js.map | 1 - dist/lib/dragula.min.js | 1 + dist/lib/hls.min.js | 2 + dist/lib/hls.min.js.map | 1 + dist/lib/images/layers-2x.png | Bin 0 -> 1259 bytes dist/lib/images/layers.png | Bin 0 -> 696 bytes dist/lib/images/marker-icon-2x.png | Bin 0 -> 2464 bytes dist/lib/images/marker-icon.png | Bin 0 -> 1466 bytes dist/lib/images/marker-shadow.png | Bin 0 -> 618 bytes dist/lib/leaflet.css | 640 + dist/lib/leaflet.js | 5 + dist/lib/leaflet.js.map | 1 + dist/nyc/index.html | 9 +- dist/nyc/sources.js | 3606 +++- dist/script.js | 42 +- dist/seattle/index.html | 11 +- dist/seattle/sources.js | 4725 +++-- dist/style.css | 4 + dist/utah/index.html | 9 +- dist/utah/sources.js | 33212 +++++++++++++++++++++-------------- 27 files changed, 40763 insertions(+), 21492 deletions(-) delete mode 100644 dist/dragula.min.js delete mode 100644 dist/hls.min.js delete mode 100644 dist/hls.min.js.map create mode 100644 dist/lib/dragula.min.js create mode 100644 dist/lib/hls.min.js create mode 100644 dist/lib/hls.min.js.map create mode 100644 dist/lib/images/layers-2x.png create mode 100644 dist/lib/images/layers.png create mode 100644 dist/lib/images/marker-icon-2x.png create mode 100644 dist/lib/images/marker-icon.png create mode 100644 dist/lib/images/marker-shadow.png create mode 100644 dist/lib/leaflet.css create mode 100644 dist/lib/leaflet.js create mode 100644 dist/lib/leaflet.js.map diff --git a/dev/georgia/convert.py b/dev/georgia/convert.py index f734030..37a9e56 100644 --- a/dev/georgia/convert.py +++ b/dev/georgia/convert.py @@ -8,7 +8,7 @@ cameras = raw_data['features'] sources = [] for camera in cameras: - coord = [float(x) for x in camera['geometry']['coordinates']] + coord = [float(x) for x in reversed(camera['geometry']['coordinates'])] cam = dict() cam['id'] = camera['properties']['cctv_id'] if 'HLS' in camera['properties']: diff --git a/dev/nyc/convert.py b/dev/nyc/convert.py index 2f21861..f6a10f5 100644 --- a/dev/nyc/convert.py +++ b/dev/nyc/convert.py @@ -22,4 +22,4 @@ for camera in data: cam['url'] = url sources.append({'coord': coord, 'cams': [cam]}) with open('sources.json', 'w') as f: - json.dump({'NYC': sources}, f) + json.dump(sources, f) diff --git a/dev/utah/convert.py b/dev/utah/convert.py index b02fc5c..763bc39 100644 --- a/dev/utah/convert.py +++ b/dev/utah/convert.py @@ -5,20 +5,20 @@ from pprint import pprint info = dict() for place in ET.parse('UtahKML.xml').findall('.//{*}Placemark'): - cam_id = int(place.attrib['id']) + cam_id = place.attrib['id'] cam_name = place.find(".//{*}SimpleData[@name='DisplayName']").text - coords = [float(x) for x in place.find(".//{*}coordinates").text.split(',')] - info[cam_id] = {'name': cam_name, 'coords': coords} + coord = [float(x) for x in reversed(place.find(".//{*}coordinates").text.split(','))] + info[cam_id] = {'name': cam_name, 'coord': coord} sources = [] with open('cameras.json', 'r') as f: places = json.load(f) for place in places: - cam_id = place['entityId'] + cam_id = str(place['entityId']) url = place['url'] this_info = info[cam_id] name = this_info['name'] - coords = this_info['coords'] - sources.append({'coords': coords, 'cams': [{'id': cam_id, 'url': url, 'name': name}]}) + coord = this_info['coord'] + sources.append({'coord': coord, 'cams': [{'id': cam_id, 'url': url, 'name': name}]}) with open('sources.json', 'w') as f: json.dump(sources, f) diff --git a/dist/dragula.min.js b/dist/dragula.min.js deleted file mode 100644 index 41e2c18..0000000 --- a/dist/dragula.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.dragula=e()}}(function(){return function e(n,t,r){function o(u,c){if(!t[u]){if(!n[u]){var a="function"==typeof require&&require;if(!c&&a)return a(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=t[u]={exports:{}};n[u][0].call(l.exports,function(e){var t=n[u][1][e];return o(t?t:e)},l,l.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u0?e:fe.revertOnSpill,t=ie||W,r=v(t),o=k(r);o===!1&&n&&(ie?r&&r.removeChild(ie):Q.insertBefore(t,re)),o||n?le.emit("cancel",t,Q,Q):le.emit("drop",t,r,Q,oe),j()}}function j(){var e=ie||W;I(),z(),e&&E.rm(e,"gu-transit"),ue&&clearTimeout(ue),le.dragging=!1,ae&&le.emit("out",e,ae,Q),le.emit("dragend",e),Q=W=ie=re=oe=ue=ae=null}function k(e,n){var t;return t=void 0!==n?n:J?oe:g(ie||W),e===Q&&t===re}function q(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var u=H(i,e),c=V(i,u,n,r),a=k(i,c);return a?!0:fe.accepts(W,i,Q,c)}for(var i=e;i&&!o();)i=v(i);return i}function U(e){function n(e){le.emit(e,f,ae,Q)}function t(){s&&n("over")}function r(){ae&&n("out")}if(J){e.preventDefault();var o=y("clientX",e),i=y("clientY",e),u=o-Z,c=i-ee;J.style.left=u+"px",J.style.top=c+"px";var f=ie||W,l=a(J,o,i),d=q(l,o,i),s=null!==d&&d!==ae;(s||null===d)&&(r(),ae=d,t());var p=v(f);if(d===Q&&ie&&!fe.copySortSource)return void(p&&p.removeChild(f));var m,h=H(d,l);if(null!==h)m=V(d,h,o,i);else{if(fe.revertOnSpill!==!0||ie)return void(ie&&p&&p.removeChild(f));m=re,d=Q}(null===m&&s||m!==f&&m!==g(f))&&(oe=m,d.insertBefore(f,m),le.emit("shadow",f,d,Q))}}function _(e){E.rm(e,"gu-hide")}function F(e){le.dragging&&E.add(e,"gu-hide")}function K(){if(!J){var e=W.getBoundingClientRect();J=W.cloneNode(!0),J.style.width=d(e)+"px",J.style.height=s(e)+"px",E.rm(J,"gu-transit"),E.add(J,"gu-mirror"),fe.mirrorContainer.appendChild(J),o(S,"add","mousemove",U),E.add(fe.mirrorContainer,"gu-unselectable"),le.emit("cloned",J,W,"mirror")}}function z(){J&&(E.rm(fe.mirrorContainer,"gu-unselectable"),o(S,"remove","mousemove",U),v(J).removeChild(J),J=null)}function H(e,n){for(var t=n;t!==e&&v(t)!==e;)t=v(t);return t===S?null:t}function V(e,n,t,r){function o(){var n,o,i,u=e.children.length;for(n=0;u>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),c&&i.left+i.width/2>t)return o;if(!c&&i.top+i.height/2>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(c?t>e.left+d(e)/2:r>e.top+s(e)/2)}function u(e){return e?g(n):n}var c="horizontal"===fe.direction,a=n!==e?i():o();return a}function $(e,n){return"boolean"==typeof fe.copy?fe.copy:fe.copy(e,n)}var G=arguments.length;1===G&&Array.isArray(e)===!1&&(n=e,e=[]);var J,Q,W,Z,ee,ne,te,re,oe,ie,ue,ce,ae=null,fe=n||{};void 0===fe.moves&&(fe.moves=l),void 0===fe.accepts&&(fe.accepts=l),void 0===fe.invalid&&(fe.invalid=P),void 0===fe.containers&&(fe.containers=e||[]),void 0===fe.isContainer&&(fe.isContainer=f),void 0===fe.copy&&(fe.copy=!1),void 0===fe.copySortSource&&(fe.copySortSource=!1),void 0===fe.revertOnSpill&&(fe.revertOnSpill=!1),void 0===fe.removeOnSpill&&(fe.removeOnSpill=!1),void 0===fe.direction&&(fe.direction="vertical"),void 0===fe.ignoreInputTextSelection&&(fe.ignoreInputTextSelection=!0),void 0===fe.mirrorContainer&&(fe.mirrorContainer=x.body);var le=b({containers:fe.containers,start:Y,end:D,cancel:A,remove:R,destroy:h,canMove:X,dragging:!1});return fe.removeOnSpill===!0&&le.on("over",_).on("out",F),r(),le}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},u={mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"},c={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.pointerEnabled?w[n](e,u[r],o):t.navigator.msPointerEnabled?w[n](e,c[r],o):(w[n](e,i[r],o),w[n](e,r,o))}function i(e){if(void 0!==e.touches)return e.touches.length;if(void 0!==e.which&&0!==e.which)return e.which;if(void 0!==e.buttons)return e.buttons;var n=e.button;return void 0!==n?1&n?1:2&n?3:4&n?2:0:void 0}function u(e){var n=e.getBoundingClientRect();return{left:n.left+c("scrollLeft","pageXOffset"),top:n.top+c("scrollTop","pageYOffset")}}function c(e,n){return"undefined"!=typeof t[n]?t[n]:S.clientHeight?S[e]:x.body[e]}function a(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=x.elementFromPoint(n,t),o.className=i,r}function f(){return!1}function l(){return!0}function d(e){return e.width||e.right-e.left}function s(e){return e.height||e.bottom-e.top}function v(e){return e.parentNode===x?null:e.parentNode}function p(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||m(e)}function m(e){return e?"false"===e.contentEditable?!1:"true"===e.contentEditable?!0:m(v(e)):!1}function g(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function h(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function y(e,n){var t=h(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}var b=e("contra/emitter"),w=e("crossvent"),E=e("./classes"),x=document,S=x.documentElement;n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":1,"contra/emitter":5,crossvent:6}],3:[function(e,n,t){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],4:[function(e,n,t){"use strict";var r=e("ticky");n.exports=function(e,n,t){e&&r(function(){e.apply(t||null,n||[])})}},{ticky:9}],5:[function(e,n,t){"use strict";var r=e("atoa"),o=e("./debounce");n.exports=function(e,n){var t=n||{},i={};return void 0===e&&(e={}),e.on=function(n,t){return i[n]?i[n].push(t):i[n]=[t],e},e.once=function(n,t){return t._once=!0,e.on(n,t),e},e.off=function(n,t){var r=arguments.length;if(1===r)delete i[n];else if(0===r)i={};else{var o=i[n];if(!o)return e;o.splice(o.indexOf(t),1)}return e},e.emit=function(){var n=r(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var u=(i[n]||[]).slice(0);return function(){var i=r(arguments),c=this||e;if("error"===n&&t["throws"]!==!1&&!u.length)throw 1===i.length?i[0]:i;return u.forEach(function(r){t.async?o(r,i,c):r.apply(c,i),r._once&&e.off(n,r)}),e}},e}},{"./debounce":4,atoa:3}],6:[function(e,n,t){(function(t){"use strict";function r(e,n,t,r){return e.addEventListener(n,t,r)}function o(e,n,t){return e.attachEvent("on"+n,f(e,n,t))}function i(e,n,t,r){return e.removeEventListener(n,t,r)}function u(e,n,t){var r=l(e,n,t);return r?e.detachEvent("on"+n,r):void 0}function c(e,n,t){function r(){var e;return p.createEvent?(e=p.createEvent("Event"),e.initEvent(n,!0,!0)):p.createEventObject&&(e=p.createEventObject()),e}function o(){return new s(n,{detail:t})}var i=-1===v.indexOf(n)?o():r();e.dispatchEvent?e.dispatchEvent(i):e.fireEvent("on"+n,i)}function a(e,n,r){return function(n){var o=n||t.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}function f(e,n,t){var r=l(e,n,t)||a(e,n,t);return h.push({wrapper:r,element:e,type:n,fn:t}),r}function l(e,n,t){var r=d(e,n,t);if(r){var o=h[r].wrapper;return h.splice(r,1),o}}function d(e,n,t){var r,o;for(r=0;rGeorgia traffic cameras + +

Georgia traffic cams (donate to bail @@ -29,11 +31,8 @@
-