From 89fa34497bba01ca9d3ad26c28ad172a29f428d2 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Mon, 16 Dec 2019 16:07:16 +0700 Subject: [PATCH] Add Mappa.js and load it --- vocoder/static/mappajs/mappa.min.js | 1 + vocoder/templates/index.html | 1 + 2 files changed, 2 insertions(+) create mode 100644 vocoder/static/mappajs/mappa.min.js diff --git a/vocoder/static/mappajs/mappa.min.js b/vocoder/static/mappajs/mappa.min.js new file mode 100644 index 0000000..b08b84b --- /dev/null +++ b/vocoder/static/mappajs/mappa.min.js @@ -0,0 +1 @@ +(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["Mappa"]=factory();else root["Mappa"]=factory()})(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.i=function(value){return value};__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="/dist/";return __webpack_require__(__webpack_require__.s=6)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StaticMap=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;i640){Google.messages().size("width",this.options.width);this.options.width=640}if(this.options.height>640){Google.messages().size("height",this.options.height);this.options.height=640}}},{key:"createImage",value:function createImage(){!this.options.key&&delete this.options.key&&Google.messages().key();this.options.size=this.options.width+"x"+this.options.height;!this.options.center&&(this.options.center=this.options.lat+","+this.options.lng);!this.options.scale&&(this.options.scale=1);for(var option in this.options){Google.options().valid.indexOf(option)>-1&&(this.imgUrl+="&"+option+"="+this.options[option])}return this.imgUrl}}],[{key:"options",value:function options(){return{valid:["center","zoom","size","scale","format","maptype","language","region","markers","path","visible","style","signature","key","signature"],userInput:["lat","lng","zoom","width","height","scale","format","maptype","language","region","markers","path","visible","style","key","signature","center"]}}},{key:"messages",value:function messages(){return{size:function size(s,m){console.warn("You requested an image with a "+s+" of "+m+"px. Google Maps Static API max "+s+" value is 640px. For larger images, change the scale to 2 and keep the "+s+" between 1-640px. i.e: if you want an image 800x800px, set the width and height to 400x400 and the scale to 2.")},key:function key(){console.warn("For large requests please provide an API key for your Google Maps Static API.")}}}}]);return Google}(_StaticMap2.StaticMap);exports.Google=Google},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Mapbox=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;i1280){Mapbox.messages().size("width",this.options.width);this.options.width=1280}if(this.options.height>1280){Mapbox.messages().size("height",this.options.width);this.options.height=1280}}}},{key:"createImage",value:function createImage(){var _this2=this;if(!this.options.key){Mapbox.messages().key();return}this.options.username!=undefined?this.imgUrl+=this.options.username+"/":this.imgUrl+="mapbox/";this.options.style!=undefined?this.imgUrl+=this.options.style+"/":this.imgUrl+="streets-v10/";this.imgUrl+="static/";this.options.overlay!=undefined&&(this.imgUrl+=this.options.overlay+"/");this.imgUrl+=this.options.lng+","+this.options.lat+",";this.options.auto==false||this.options.auto==undefined?["zoom","bearing","pitch"].forEach(function(e,i){_this2.options[e]!=undefined?_this2.imgUrl+=_this2.options[e]:_this2.imgUrl+=0;i<2&&(_this2.imgUrl+=",")}):this.imgUrl+="auto";this.imgUrl+="/"+this.options.width+"x"+this.options.height;this.options.scale==2&&(this.imgUrl+="@2x");this.imgUrl+="?access_token="+this.options.key;this.options.attribution?this.imgUrl+="&attribution="+this.options.attribution:this.imgUrl+="&attribution=false";this.options.logo?this.imgUrl+="&logo="+this.options.logo:this.imgUrl+="&logo=false";this.options.before_layer?this.imgUrl+="&before_layer="+this.options.before_layer:this.imgUrl+="&before_layer=false";return this.imgUrl}}],[{key:"options",value:function options(){return{valid:["lat","lng","zoom","width","height","scale","bearing","pitch","style","username","overlay","attribution","logo","before_layer","center","size"],userInput:["lat","lng","zoom","width","height","scale","bearing","pitch","style","username","overlay","attribution","logo","before_layer","center","size"]}}},{key:"messages",value:function messages(){return{size:function size(s,m){return console.warn("You requested an image with a "+s+" of "+m+"px. Mapbox Static API max "+s+" value is 1280px. If you want a large image change the scale to 2.")},key:function key(){console.error("Mapbox Static API needs a key to work. To get a key visit: https://www.mapbox.com/api-documentation/#static")}}}}]);return Mapbox}(_StaticMap2.StaticMap);exports.Mapbox=Mapbox},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Mapquest=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;i1920){Mapquest.messages().size("width",this.options.width);this.options.width=1920}if(this.options.height>1920){Mapquest.messages().size("height",this.options.height);this.options.height=1920}}},{key:"createImage",value:function createImage(){if(!this.options.key){Mapquest.messages().key();return}this.options.size=this.options.width+","+this.options.height;this.options.scale==2&&(this.options.size+="@2x");!this.options.center&&(this.options.center=this.options.lat+","+this.options.lng);for(var option in this.options){Mapquest.options().valid.indexOf(option)>-1&&(this.imgUrl+="&"+option+"="+this.options[option])}return this.imgUrl}}],[{key:"options",value:function options(){return{valid:["key","size","zoom","center","boundingBox","margin","format","type","scalebar","locations","declutter","defaultMarker","banner","traffic","key"],userInput:["lat","lng","zoom","width","height","scale","boundingBox","margin","format","type","scalebar","locations","declutter","defaultMarker","banner","traffic","key"]}}},{key:"messages",value:function messages(){return{size:function size(s,m){console.warn("You requested an image with a "+s+" of "+m+"px. Mapquest Static API max "+s+" value is 1920px. For larger images, change the scale to 2 and keep the "+s+" between 170x30px. i.e: if you want an 3840x3840px image, set the width and height to 1920x1920 and the scale to 2.")},key:function key(){console.warn("Please provide and API key to work with Mapquest Static API. Get one here: https://developer.mapquest.com/documentation/")}}}}]);return Mapquest}(_StaticMap2.StaticMap);exports.Mapquest=Mapquest},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Google=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;i=2?pixels=4:pixels=2;var offsetX=-Math.round(_this2.canvas.width/pixels-center.x);var offsetY=-Math.round(_this2.canvas.height/pixels-center.y);var _canvas=_this2.canvas.getContext("webgl")||_this2.canvas.getContext("2d");_canvas.canvas.style.transform="translate("+offsetX+"px,"+offsetY+"px)"});google.maps.event.addListenerOnce(this.map,"tilesloaded",function(){_this2.ready=true})}},{key:"fromLatLngtoPixel",value:function fromLatLngtoPixel(position){if(this.ready){position=new google.maps.LatLng(position);var topRight=this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getNorthEast());var bottomLeft=this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getSouthWest());var scale=Math.pow(2,this.map.getZoom());var point=this.map.getProjection().fromLatLngToPoint(position);return new google.maps.Point((point.x-bottomLeft.x)*scale,(point.y-topRight.y)*scale)}else{return{x:-100,y:-100}}}},{key:"fromPointToLatLng",value:function fromPointToLatLng(){if(this.ready){var topRight=this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getNorthEast());var bottomLeft=this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getSouthWest());var scale=Math.pow(2,this.map.getZoom());var point=new google.maps.Point((arguments.length<=0?undefined:arguments[0])/scale+bottomLeft.x,(arguments.length<=1?undefined:arguments[1])/scale+topRight.y);var latlng=this.map.getProjection().fromPointToLatLng(point);return{lat:latlng.lat(),lng:latlng.lng()}}else{return{lat:-100,lng:-100}}}},{key:"getZoom",value:function getZoom(){if(this.ready){return this.map.getZoom()}else{return 0}}},{key:"onChange",value:function onChange(callback){var _this3=this;if(this.ready){callback();this.onChangeMetods[callback]=google.maps.event.addListener(this.map,"bounds_changed",callback)}else{setTimeout(function(){_this3.onChange(callback)},200)}}},{key:"removeOnChange",value:function removeOnChange(callback){google.maps.event.removeListener(this.onChangeMetods[callback])}}],[{key:"messages",value:function messages(){return{key:function key(){console.warn("Please provide a Goolge Maps API Key. Get one here: https://developers.google.com/maps/documentation/javascript/ ")}}}}]);return Google}(_TileMap2.TileMap);exports.Google=Google},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Mapbox=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;iTangram | © OSM contributors | Mapzen'});this.tangramScene.addTo(this.map);this.map.setView([this.options.lat,this.options.lng],this.options.zoom);this.tangramScene.scene.subscribe({load:function load(){_this2.ready=true}});this.canvasOverlay()}}],[{key:"messages",value:function messages(){return{key:function key(){console.warn("Please provide a API key for your Mapzen map.")}}}}]);return Tangram}(_Leaflet2.Leaflet);exports.Tangram=Tangram}])}); \ No newline at end of file diff --git a/vocoder/templates/index.html b/vocoder/templates/index.html index d29a865..c7d0bff 100644 --- a/vocoder/templates/index.html +++ b/vocoder/templates/index.html @@ -9,5 +9,6 @@ Coming Soon TM. +