@targomo/leaflet
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,1 @@ | ||
{"name":"@targomo/leaflet","description":"Leaflet maps extensions for Targomo's time-based access mapping services.","author":"Targomo","version":"0.0.2","license":"MIT","repository":"github:targomo/targomo-js-extensions","homepage":"https://targomo.com/developers","bugs":{"url":"https://github.com/targomo/targomo-js-extensions/issues"},"keywords":["map","gis","api","rest","isochrone","reachability"],"main":"targomo-leaflet.js","module":"targomo-leaflet.js","browser":"targomo-leaflet.umd.min.js","typings":"./typings/index.d.ts","scripts":{"dev":"npm run clean && webpack --watch","build":"npm run clean && node build.js","lint":"tslint -p tsconfig.json","clean":"shx rm -rf dist","test":"npm run test:browser && npm run test:browser","test:browser":"jest --config=jest.config.json --env=jsdom","test:debug":"node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --config=jest.config.json","test:coverage":"npm run test:browser --coverage"},"devDependencies":{"@types/fs-extra":"^5.0.4","@types/jest":"^21.1.5","@types/node":"^6.0.60","fs-extra":"^7.0.0","jest":"^21.2.1","rollup":"^0.51.8","rollup-plugin-commonjs":"^8.2.6","rollup-plugin-copy":"^0.2.3","rollup-plugin-node-resolve":"^3.0.0","rollup-plugin-resolve":"0.0.1-predev.1","rollup-plugin-typescript2":"^0.8.2","rollup-plugin-uglify":"^2.0.1","shx":"^0.2.2","ts-jest":"^21.1.4","ts-loader":"^3.1.1","tslint":"^5.8.0","typescript":"^2.5.0"},"dependencies":{"@targomo/core":"^0.2.3","@types/leaflet":"^1.2.8","leaflet":"^1.3.1"}} | ||
{"name":"@targomo/leaflet","description":"Leaflet maps extensions for Targomo's time-based access mapping services.","author":"Targomo","version":"0.0.3","license":"MIT","repository":"github:targomo/targomo-js-extensions","homepage":"https://targomo.com/developers","bugs":{"url":"https://github.com/targomo/targomo-js-extensions/issues"},"keywords":["map","gis","api","rest","isochrone","reachability"],"main":"targomo-leaflet.js","module":"targomo-leaflet.js","browser":"targomo-leaflet.umd.min.js","typings":"./typings/index.d.ts","scripts":{"dev":"npm run clean && webpack --watch","build":"npm run clean && node build.js","lint":"tslint -p tsconfig.json","clean":"shx rm -rf dist","test":"npm run test:browser && npm run test:browser","test:browser":"jest --config=jest.config.json --env=jsdom","test:debug":"node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --config=jest.config.json","test:coverage":"npm run test:browser --coverage"},"devDependencies":{"@types/fs-extra":"^5.0.4","@types/jest":"^21.1.5","@types/node":"^6.0.60","fs-extra":"^7.0.0","jest":"^21.2.1","rollup":"^0.51.8","rollup-plugin-commonjs":"^8.2.6","rollup-plugin-copy":"^0.2.3","rollup-plugin-node-resolve":"^3.0.0","rollup-plugin-resolve":"0.0.1-predev.1","rollup-plugin-typescript2":"^0.8.2","rollup-plugin-uglify":"^2.0.1","shx":"^0.2.2","ts-jest":"^21.1.4","ts-loader":"^3.1.1","tslint":"^5.8.0","typescript":"^2.5.0"},"dependencies":{"@targomo/core":"^0.2.3","@types/leaflet":"^1.2.8","leaflet":"^1.3.1"}} |
@@ -12,7 +12,7 @@ /** | ||
/** | ||
* @targomo/js-extensions "0.0.2" http://targomo.com | ||
* @targomo/js-extensions "0.0.3" http://targomo.com | ||
* Google and Leaflet JavaScript (& TypeScript) extensions for Targomo's time-based access mapping services. | ||
* (c) 2018 Targomo | ||
* (c) 2019 Targomo | ||
*/ | ||
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("leaflet"),require("@targomo/core")):"function"==typeof define&&define.amd?define(["exports","leaflet","@targomo/core"],o):o((t.tgm=t.tgm||{},t.tgm.leaflet={}),t.L,t.tgm)}(this,function(t,c,d){"use strict";var n=function(t,o){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)o.hasOwnProperty(e)&&(t[e]=o[e])})(t,o)};function i(t,o){function e(){this.constructor=t}n(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}var s,r,E=function(){return(E=Object.assign||function(t){for(var o,e=1,n=arguments.length;e<n;e++)for(var s in o=arguments[e])Object.prototype.hasOwnProperty.call(o,s)&&(t[s]=o[s]);return t}).apply(this,arguments)},h=(s=.5/Math.PI,r=-.5/Math.PI,function(t,o,e){return void 0===e&&(e=1),{x:t=e*(s*t+.5),y:o=e*(r*o+.5)}});function W(t,o,e){return void 0===e&&(e=1),h(t/6378137,o/6378137,e)}var b=function(){function o(t){this.southWest=new T(1/0,1/0),this.northEast=new T(-1/0,-1/0),t&&(this.southWest=new T(t.southWest.x,t.southWest.y),this.northEast=new T(t.northEast.x,t.northEast.y))}return o.prototype.expandPoint=function(t,o){this.southWest.x=Math.min(this.southWest.x,t),this.northEast.x=Math.max(this.northEast.x,t),this.southWest.y=Math.min(this.southWest.y,o),this.northEast.y=Math.max(this.northEast.y,o)},o.prototype.expand=function(t){this.expandPoint(t.northEast.x,t.northEast.y),this.expandPoint(t.southWest.x,t.southWest.y)},o.prototype.modifyIntersect=function(t){return this.southWest.x=Math.max(this.southWest.x,t.southWest.x),this.northEast.x=Math.min(this.northEast.x,t.northEast.x),this.southWest.y=Math.max(this.southWest.y,t.southWest.y),this.northEast.y=Math.min(this.northEast.y,t.northEast.y),this},o.prototype.contains=function(t){return this.northEast.x>=t.northEast.x&&this.northEast.y>=t.northEast.y&&this.southWest.x<=t.southWest.x&&this.southWest.y<=t.southWest.y},o.prototype.intersects=function(t){return!(this.northEast.x<t.southWest.x||this.northEast.y<t.southWest.y||this.southWest.x>t.northEast.x||this.southWest.y>t.northEast.y)},o.prototype.growOutwardsFactor=function(t){void 0===t&&(t=1);var o=(this.northEast.x-this.southWest.x)*t,e=(this.northEast.y-this.southWest.y)*t;return this.northEast.x+=o,this.northEast.y+=e,this.southWest.x-=o,this.southWest.y-=e,this},o.prototype.growOutwardsAmount=function(t){return this.northEast.x+=t,this.northEast.y+=t,this.southWest.x-=t,this.southWest.y-=t,this},o.prototype.toLineString=function(){return[new T(this.southWest.x,this.northEast.y),new T(this.northEast.x,this.northEast.y),new T(this.northEast.x,this.southWest.y),new T(this.southWest.x,this.southWest.y)]},o.prototype.reproject=function(t){return new o({northEast:t(this.northEast.x,this.northEast.y),southWest:t(this.southWest.x,this.southWest.y)})},o}(),T=function(){function t(t,o){this.x=t,this.y=o}return t.prototype.isCollinear=function(t,o,e){if(t.x==o.x&&t.y==o.y)return!1;if(t.x==this.x&&this.x==o.x)return!0;if(t.y==this.y&&this.y==o.y)return!0;var n=t.x*(this.y-o.y)+this.x*(o.y-t.y)+o.x*(t.y-this.y);return n<e&&-e<n&&t.x!=o.x&&t.y!=o.y},t.prototype.euclideanDistance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},t}(),a=function(t){var e=this;this.bounds3857=new b,this.points=t.map(function(t){e.bounds3857.expandPoint(t[0],t[1]);var o=W(t[0],t[1],1);return new T(o.x,o.y)})},u=function(){function t(t){var e=this;this.bounds3857=new b,this.travelTime=t.travelTime,this.area=t.area,this.lineStrings=[new a(t.outerBoundary)],this.bounds3857.expand(this.lineStrings[0].bounds3857),t.innerBoundary&&t.innerBoundary.forEach(function(t){var o=new a(t);e.lineStrings.push(o),e.bounds3857.expand(o.bounds3857)})}return t.prototype.getOuterBoundary=function(){return this.lineStrings[0]},t.prototype.getInnerBoundary=function(){return this.lineStrings.slice(1)},t}(),o=function(){function t(t){var e=this;this.polygons={},this.bounds3857=new b,t.forEach(function(t){t.polygons.forEach(function(t){var o=new u(t);e.polygons[o.travelTime]=e.polygons[o.travelTime]||[],e.polygons[o.travelTime].push(o),e.bounds3857.expand(o.bounds3857)})})}return t.prototype.forEach=function(e){var n=this;Object.keys(this.polygons).map(function(t){return+t}).sort(function(t,o){return o-t}).forEach(function(t,o){return e(+t,n.polygons[t],o)})},t}();var e={};["#006837","#39B54A","#8CC63F","#F7931E","#F15A24","#C1272D"].forEach(function(t,o){e[300*(o+1)]=t});var l=function(){this.inverse=!1,this.colors=e,this.opacity=.5,this.strokeWidth=5},y=function(e){function t(t){var o=e.call(this)||this;return Object.assign(o,t),o}return i(t,e),t.prototype.getColorOpacity=function(t,o){var e,n=null;return n=this.colors instanceof Array?this.colors[o]:this.colors[t],(e=n)&&null!=e.color?{color:n.color||"#ccc",opacity:n.opacity||1}:{color:n||"#ccc",opacity:1}},t}(l),L=0;function p(h,t,s,o,a){var e,n=W(t.southWest.x,t.southWest.y,s),i=W(t.northEast.x,t.northEast.y,s);i.y<n.y&&(e=[n.y,i.y],i.y=e[0],n.y=e[1]);var r=Math.floor(n.x),u=Math.floor(n.y),l=Math.ceil(i.x),y=Math.ceil(i.y),p=new b(h).reproject(W).toLineString();function c(n,t){return(t=function(t,o){var i,r,h,a,e=function(t){return(r.x-i.x)*(t.y-i.y)>(r.y-i.y)*(t.x-i.x)},n=function(){var t=new T(i.x-r.x,i.y-r.y),o=new T(h.x-a.x,h.y-a.y),e=i.x*r.y-i.y*r.x,n=h.x*a.y-h.y*a.x,s=1/(t.x*o.y-t.y*o.x);return new T((e*o.x-n*t.x)*s,(e*o.y-n*t.y)*s)},s=t;for(var u in i=o[o.length-1],o){r=o[u];var l=s;for(var y in s=[],h=l[l.length-1],l)e(a=l[y])?(e(h)||s.push(n()),s.push(a)):e(h)&&s.push(n()),h=a;i=r}return s}(t,p)).forEach(function(t,o){var e=(0<o?"L":"M")+" "+(Math.round(t.x*s)-r)+" "+(Math.round(t.y*s)-u);n.push(e)}),0<n.length&&n.push("z"),n}var d=[];o.forEach(function(t,o,e){var n,s,i=o.map(function(t){return(o=t,e=[],h.intersects(o.bounds3857)&&(c(e,o.getOuterBoundary().points),o.getInnerBoundary().forEach(function(t){h.intersects(t.bounds3857)&&c(e,t.points)})),e).join(" ");var o,e}).join(" ");if(0!=i.length){var r=a.getColorOpacity(t,e);d.push((n=i,"\n <g style='opacity: "+(s=E({},r,{strokeWidth:a.strokeWidth,color:a.inverse?"black":r.color})).opacity+"'>\n <path style='stroke: "+s.color+";\n fill: "+s.color+";\n stroke-opacity: "+s.opacity+";\n stroke-width: "+s.strokeWidth+";\n fill-opacity: "+s.opacity+"'\n\n d='"+n+"'/>\n </g>\n "))}});var f,m,g,v,x=l-r,w=y-u;return a.inverse?(g="tgm:inverse:"+L++,'\n <svg height="100%" width="100%" viewbox="0 0 '+(f=x)+" "+(m=w)+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n <path style='mask: url(#mask_"+g+")' d='"+(v="M 0 0 L "+f+" 0 L "+f+" "+m+" L 0 "+m+" z")+"'/>\n \n <defs>\n <mask id='mask_"+g+"'>\n <path style='fill-opacity:1; stroke: white; fill:white;' d='"+v+"'/>\"\n "+d.join("\n")+"\n </mask>\n </defs>\n \n </svg>"):'\n <svg height="100%" width="100%" viewbox="0 0 '+x+" "+w+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n "+d.join("\n")+"\n </svg>"}var f=function(){function t(t,o){void 0===t&&(t=50),void 0===o&&(o=500),this.min=t,this.max=o}return t.prototype.schedule=function(t){var o=this,e=function(){clearTimeout(o.longTimeout),clearTimeout(o.shortTimeout),o.longTimeout=null,o.shortTimeout=null,t()};this.longTimeout||(this.longTimeout=setTimeout(e,this.max)),clearTimeout(this.shortTimeout),this.shortTimeout=setTimeout(e,this.min)},t}(),m=function(){function t(t,o){this.plugin=t,this.options=o,this.renderTimeout=new f}return t.prototype.getElement=function(){return this.divElement},t.prototype.draw=function(t){var o=this;void 0===t&&(t=!1),this.resize(),t?this.render():this.renderTimeout.schedule(function(){return o.render()})},t.prototype.resize=function(){if(this.divElement&&this.bounds){var t=this.plugin.getElementPixels(this.bounds),o=t.southWest,e=t.northEast,n=this.divElement;n.style.left=o.x+"px",n.style.top=e.y+"px",n.style.width=e.x-o.x+"px",n.style.height=o.y-e.y+"px"}},t.prototype.initElement=function(){var t=document.createElement("div");return t.style.borderStyle="none",t.style.borderWidth="0px",t.style.position="absolute",t.style.opacity=""+this.options.opacity||"0.5",this.divElement=t,this.divElement},t.prototype.onRemove=function(){this.divElement.parentNode.removeChild(this.divElement),this.divElement=null},t.prototype.setData=function(t){this.model=new o(t),this.render()},t.prototype.setInverse=function(t){this.options.inverse=t,this.render()},t.prototype.setColors=function(t){this.options.colors=t,this.render()},t.prototype.setOpacity=function(t){this.options.opacity=t,this.divElement&&(this.divElement.style.opacity=""+this.options.opacity||"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.render()},t.prototype.boundsCalculation=function(t){var o=this.model,e=this.options.inverse,n=new b(this.plugin.getViewPort()),s=new b(n),i=new b(s).growOutwardsFactor(t).modifyIntersect(o.bounds3857);e&&(i.expand(n),i.growOutwardsFactor(t)),s.growOutwardsFactor(t);var r=d.geometry.webMercatorToLatLng(n.southWest,void 0),h=d.geometry.webMercatorToLatLng(n.northEast,void 0),a=this.plugin.getElementPixels({southWest:r,northEast:h}),u=Math.abs((n.northEast.x-n.southWest.x)/a.northEast.x-a.southWest.x);return i.growOutwardsAmount(this.options&&u*this.options.strokeWidth||0),{bounds:s,newBounds:i}},t.prototype.render=function(){if(this.model&&this.divElement){var t=this.plugin.getZoom(),o=256*Math.pow(2,t);o=Math.min(1e7,o);var e=Math.min(5,Math.max(2,(t-12)/2)),n=this.boundsCalculation(e),s=n.bounds,i=n.newBounds,r=p(s,i,o,this.model,new y(this.options));this.divElement.innerHTML=r;var h=d.geometry.webMercatorToLatLng(i.southWest,void 0),a=d.geometry.webMercatorToLatLng(i.northEast,void 0);this.bounds={southWest:h,northEast:a},this.resize()}},t}(),g=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return i(o,t),o}(l),v=function(e){function t(t){var o=e.call(this)||this;return o.readyPromise=new Promise(function(t){return o.readyResolve=t}),o.options=Object.assign(new g,t||{}),o}return i(t,e),t.prototype.setData=function(t){var o=this;this.readyPromise.then(function(){o.element.setData(t)})},t.prototype.draw=function(){this.element&&(c.DomUtil.setTransform(this.element.getElement(),new c.Point(0,0),null),this.element.draw(!0))},t.prototype.onAdd=function(l){var y=this;this.element=new m({getZoom:function(){return l.getZoom()},getViewPort:function(){var t=l.getBounds();return new b({northEast:d.geometry.latLngToWebMercator({lng:t.getNorthEast().lng,lat:t.getNorthEast().lat}),southWest:d.geometry.latLngToWebMercator({lng:t.getSouthWest().lng,lat:t.getSouthWest().lat})})},getElementPixels:function(t){return{northEast:l.latLngToLayerPoint(t.northEast),southWest:l.latLngToLayerPoint(t.southWest)}}},this.options);var p=this.element.initElement();return p.style.transformOrigin="center",c.DomUtil.addClass(p,"leaflet-zoom-animated"),l.getPanes().overlayPane.appendChild(p),l.on("moveend",this.draw,this),l.on("resize",this.draw,this),l.on("zoomend",this.draw,this),this._map.options.zoomAnimation&&c.Browser.any3d&&l.on("zoomanim",function(t){if(y.element.bounds){var o=l.getZoomScale(t.zoom,l.getZoom()),e=l._latLngToNewLayerPoint(y.element.bounds.southWest,t.zoom,t.center).round(),n=l._latLngToNewLayerPoint(y.element.bounds.northEast,t.zoom,t.center).round(),s=l._latLngToNewLayerPoint(y.element.bounds.southWest,l.getZoom(),l.getCenter()).round(),i=l._latLngToNewLayerPoint(y.element.bounds.northEast,l.getZoom(),l.getCenter()).round(),r=(e.x+n.x)/2,h=(e.y+n.y)/2,a=(s.x+i.x)/2,u=(s.y+i.y)/2;c.DomUtil.setTransform(p,new c.Point(r-a,h-u),o)}}),this.readyResolve(),this.draw(),this},t.prototype.setInverse=function(t){this.options.inverse=t,this.draw()},t.prototype.setColors=function(t){this.options.colors=t,this.draw()},t.prototype.setOpacity=function(t){(this.options.opacity=t,this.element)&&(this.element.getElement().style.opacity=null!=this.options.opacity?""+this.options.opacity:"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.draw()},t}(c.Layer),x=function(s){function n(t,o,e){if(!o&&!t.basemaps.basemapsLookup[o])throw new Error("valid style name required to access Targomo basemap");var n="https://maps.targomo.com/styles/"+t.basemaps.basemapsLookup[o]+"/rendered/{z}/{x}/{y}.png?key="+t.serviceKey;return s.call(this,n,e)||this}return i(n,s),n.getTileLayerList=function(o){var e={};return o.basemaps.basemapNames.forEach(function(t){e[t]=new n(o,t,{})}),e},n}(c.TileLayer),w=function(){function t(t,o,e,n){this.tgmClient=t,this.sources=o,this.multigraphOptions=e,this.vectorTileoptions=n,this.createLayer()}return t.prototype.addTo=function(t){this.map=t,this.layer.addTo(t)},t.prototype.updateMultigraphOptions=function(t){this.multigraphOptions=t,this.createLayer()},t.prototype.updateVectorTileOptions=function(t){this.vectorTileoptions=t,this.createLayer()},t.prototype.updateSources=function(t){this.sources=t,this.createLayer()},t.prototype.createLayer=function(){this.map&&this.layer&&this.map.removeLayer(this.layer),this.layer=c.vectorGrid.protobuf(this.tgmClient.multigraph.getTiledMultigraphUrl(this.sources,this.multigraphOptions,"mvt"),this.vectorTileoptions),this.map&&this.layer&&this.layer.addTo(this.map)},t}();t.LeafletPolygonOverlayOptions=g,t.TgmLeafletPolygonOverlay=v,t.TgmLeafletTileLayer=x,t.TgmLeafletMultigraphTileLayer=w,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet"),require("@targomo/core")):"function"==typeof define&&define.amd?define(["exports","leaflet","@targomo/core"],e):e((t.tgm=t.tgm||{},t.tgm.leaflet={}),t.L,t.tgm)}(this,function(t,c,d){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)};function i(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var s,r,E=function(){return(E=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},h=(s=.5/Math.PI,r=-.5/Math.PI,function(t,e,o){return void 0===o&&(o=1),{x:t=o*(s*t+.5),y:e=o*(r*e+.5)}});function W(t,e,o){return void 0===o&&(o=1),h(t/6378137,e/6378137,o)}var b=function(){function e(t){this.southWest=new T(1/0,1/0),this.northEast=new T(-1/0,-1/0),t&&(this.southWest=new T(t.southWest.x,t.southWest.y),this.northEast=new T(t.northEast.x,t.northEast.y))}return e.prototype.expandPoint=function(t,e){this.southWest.x=Math.min(this.southWest.x,t),this.northEast.x=Math.max(this.northEast.x,t),this.southWest.y=Math.min(this.southWest.y,e),this.northEast.y=Math.max(this.northEast.y,e)},e.prototype.expand=function(t){this.expandPoint(t.northEast.x,t.northEast.y),this.expandPoint(t.southWest.x,t.southWest.y)},e.prototype.modifyIntersect=function(t){return this.southWest.x=Math.max(this.southWest.x,t.southWest.x),this.northEast.x=Math.min(this.northEast.x,t.northEast.x),this.southWest.y=Math.max(this.southWest.y,t.southWest.y),this.northEast.y=Math.min(this.northEast.y,t.northEast.y),this},e.prototype.contains=function(t){return this.northEast.x>=t.northEast.x&&this.northEast.y>=t.northEast.y&&this.southWest.x<=t.southWest.x&&this.southWest.y<=t.southWest.y},e.prototype.intersects=function(t){return!(this.northEast.x<t.southWest.x||this.northEast.y<t.southWest.y||this.southWest.x>t.northEast.x||this.southWest.y>t.northEast.y)},e.prototype.growOutwardsFactor=function(t){void 0===t&&(t=1);var e=(this.northEast.x-this.southWest.x)*t,o=(this.northEast.y-this.southWest.y)*t;return this.northEast.x+=e,this.northEast.y+=o,this.southWest.x-=e,this.southWest.y-=o,this},e.prototype.growOutwardsAmount=function(t){return this.northEast.x+=t,this.northEast.y+=t,this.southWest.x-=t,this.southWest.y-=t,this},e.prototype.toLineString=function(){return[new T(this.southWest.x,this.northEast.y),new T(this.northEast.x,this.northEast.y),new T(this.northEast.x,this.southWest.y),new T(this.southWest.x,this.southWest.y)]},e.prototype.reproject=function(t){return new e({northEast:t(this.northEast.x,this.northEast.y),southWest:t(this.southWest.x,this.southWest.y)})},e}(),T=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.isCollinear=function(t,e,o){if(t.x==e.x&&t.y==e.y)return!1;if(t.x==this.x&&this.x==e.x)return!0;if(t.y==this.y&&this.y==e.y)return!0;var n=t.x*(this.y-e.y)+this.x*(e.y-t.y)+e.x*(t.y-this.y);return n<o&&-o<n&&t.x!=e.x&&t.y!=e.y},t.prototype.euclideanDistance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},t}(),a=function(t){var o=this;this.bounds3857=new b,this.points=t.map(function(t){o.bounds3857.expandPoint(t[0],t[1]);var e=W(t[0],t[1],1);return new T(e.x,e.y)})},u=function(){function t(t){var o=this;this.bounds3857=new b,this.travelTime=t.travelTime,this.area=t.area,this.lineStrings=[new a(t.outerBoundary)],this.bounds3857.expand(this.lineStrings[0].bounds3857),t.innerBoundary&&t.innerBoundary.forEach(function(t){var e=new a(t);o.lineStrings.push(e),o.bounds3857.expand(e.bounds3857)})}return t.prototype.getOuterBoundary=function(){return this.lineStrings[0]},t.prototype.getInnerBoundary=function(){return this.lineStrings.slice(1)},t}(),e=function(){function t(t){var o=this;this.polygons={},this.bounds3857=new b,t.forEach(function(t){t.polygons.forEach(function(t){var e=new u(t);o.polygons[e.travelTime]=o.polygons[e.travelTime]||[],o.polygons[e.travelTime].push(e),o.bounds3857.expand(e.bounds3857)})})}return t.prototype.forEach=function(o){var n=this;Object.keys(this.polygons).map(function(t){return+t}).sort(function(t,e){return e-t}).forEach(function(t,e){return o(+t,n.polygons[t],e)})},t}();var o={};["#006837","#39B54A","#8CC63F","#F7931E","#F15A24","#C1272D"].forEach(function(t,e){o[300*(e+1)]=t});var l=function(){this.inverse=!1,this.colors=o,this.opacity=.5,this.strokeWidth=5},y=function(o){function t(t){var e=o.call(this)||this;return Object.assign(e,t),e}return i(t,o),t.prototype.getColorOpacity=function(t,e){var o,n=null;return n=this.colors instanceof Array?this.colors[e]:this.colors[t],(o=n)&&null!=o.color?{color:n.color||"#ccc",opacity:n.opacity||1}:{color:n||"#ccc",opacity:1}},t}(l),L=0;function p(h,t,s,e,a){var o,n=W(t.southWest.x,t.southWest.y,s),i=W(t.northEast.x,t.northEast.y,s);i.y<n.y&&(o=[n.y,i.y],i.y=o[0],n.y=o[1]);var r=Math.floor(n.x),u=Math.floor(n.y),l=Math.ceil(i.x),y=Math.ceil(i.y),p=new b(h).reproject(W).toLineString();function c(n,t){return(t=function(t,e){var i,r,h,a,o=function(t){return(r.x-i.x)*(t.y-i.y)>(r.y-i.y)*(t.x-i.x)},n=function(){var t=new T(i.x-r.x,i.y-r.y),e=new T(h.x-a.x,h.y-a.y),o=i.x*r.y-i.y*r.x,n=h.x*a.y-h.y*a.x,s=1/(t.x*e.y-t.y*e.x);return new T((o*e.x-n*t.x)*s,(o*e.y-n*t.y)*s)},s=t;for(var u in i=e[e.length-1],e){r=e[u];var l=s;for(var y in s=[],h=l[l.length-1],l)o(a=l[y])?(o(h)||s.push(n()),s.push(a)):o(h)&&s.push(n()),h=a;i=r}return s}(t,p)).forEach(function(t,e){var o=(0<e?"L":"M")+" "+(Math.round(t.x*s)-r)+" "+(Math.round(t.y*s)-u);n.push(o)}),0<n.length&&n.push("z"),n}var d=[];e.forEach(function(t,e,o){var n,s,i=e.map(function(t){return(e=t,o=[],h.intersects(e.bounds3857)&&(c(o,e.getOuterBoundary().points),e.getInnerBoundary().forEach(function(t){h.intersects(t.bounds3857)&&c(o,t.points)})),o).join(" ");var e,o}).join(" ");if(0!=i.length){var r=a.getColorOpacity(t,o);d.push((n=i,"\n <g style='opacity: "+(s=E({},r,{strokeWidth:a.strokeWidth,color:a.inverse?"black":r.color})).opacity+"'>\n <path style='stroke: "+s.color+";\n fill: "+s.color+";\n stroke-opacity: "+s.opacity+";\n stroke-width: "+s.strokeWidth+";\n fill-opacity: "+s.opacity+"'\n\n d='"+n+"'/>\n </g>\n "))}});var m,f,g,v,x=l-r,w=y-u;return a.inverse?(g="tgm:inverse:"+L++,'\n <svg height="100%" width="100%" viewbox="0 0 '+(m=x)+" "+(f=w)+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n <path style='mask: url(#mask_"+g+")' d='"+(v="M 0 0 L "+m+" 0 L "+m+" "+f+" L 0 "+f+" z")+"'/>\n \n <defs>\n <mask id='mask_"+g+"'>\n <path style='fill-opacity:1; stroke: white; fill:white;' d='"+v+"'/>\"\n "+d.join("\n")+"\n </mask>\n </defs>\n \n </svg>"):'\n <svg height="100%" width="100%" viewbox="0 0 '+x+" "+w+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n "+d.join("\n")+"\n </svg>"}var m=function(){function t(t,e){void 0===t&&(t=50),void 0===e&&(e=500),this.min=t,this.max=e}return t.prototype.schedule=function(t){var e=this,o=function(){clearTimeout(e.longTimeout),clearTimeout(e.shortTimeout),e.longTimeout=null,e.shortTimeout=null,t()};this.longTimeout||(this.longTimeout=setTimeout(o,this.max)),clearTimeout(this.shortTimeout),this.shortTimeout=setTimeout(o,this.min)},t}(),f=function(){function t(t,e){this.plugin=t,this.options=e,this.renderTimeout=new m}return t.prototype.getElement=function(){return this.divElement},t.prototype.draw=function(t){var e=this;void 0===t&&(t=!1),this.resize(),t?this.render():this.renderTimeout.schedule(function(){return e.render()})},t.prototype.resize=function(){if(this.divElement&&this.bounds){var t=this.plugin.getElementPixels(this.bounds),e=t.southWest,o=t.northEast,n=this.divElement;n.style.left=e.x+"px",n.style.top=o.y+"px",n.style.width=o.x-e.x+"px",n.style.height=e.y-o.y+"px"}},t.prototype.initElement=function(){var t=document.createElement("div");return t.style.borderStyle="none",t.style.borderWidth="0px",t.style.position="absolute",t.style.opacity=""+this.options.opacity||"0.5",this.divElement=t,this.divElement},t.prototype.onRemove=function(){this.divElement.parentNode.removeChild(this.divElement),this.divElement=null},t.prototype.setData=function(t){this.model=t?new e(t):null,this.render()},t.prototype.setInverse=function(t){this.options.inverse=t,this.render()},t.prototype.setColors=function(t){this.options.colors=t,this.render()},t.prototype.setOpacity=function(t){this.options.opacity=t,this.divElement&&(this.divElement.style.opacity=""+this.options.opacity||"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.render()},t.prototype.boundsCalculation=function(t){var e=this.model,o=this.options.inverse,n=new b(this.plugin.getViewPort()),s=new b(n),i=new b(s).growOutwardsFactor(t).modifyIntersect(e.bounds3857);o&&(i.expand(n),i.growOutwardsFactor(t)),s.growOutwardsFactor(t);var r=d.geometry.webMercatorToLatLng(n.southWest,void 0),h=d.geometry.webMercatorToLatLng(n.northEast,void 0),a=this.plugin.getElementPixels({southWest:r,northEast:h}),u=Math.abs((n.northEast.x-n.southWest.x)/a.northEast.x-a.southWest.x);return i.growOutwardsAmount(this.options&&u*this.options.strokeWidth||0),{bounds:s,newBounds:i}},t.prototype.render=function(){if(this.divElement)if(this.model){var t=this.plugin.getZoom(),e=256*Math.pow(2,t);e=Math.min(1e7,e);var o=Math.min(5,Math.max(2,(t-12)/2)),n=this.boundsCalculation(o),s=n.bounds,i=n.newBounds,r=p(s,i,e,this.model,new y(this.options));this.divElement.innerHTML=r;var h=d.geometry.webMercatorToLatLng(i.southWest,void 0),a=d.geometry.webMercatorToLatLng(i.northEast,void 0);this.bounds={southWest:h,northEast:a},this.resize()}else this.divElement.innerHTML=""},t}(),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(l),v=function(o){function t(t){var e=o.call(this)||this;return e.readyPromise=new Promise(function(t){return e.readyResolve=t}),e.options=Object.assign(new g,t||{}),e}return i(t,o),t.prototype.setData=function(t){var e=this;this.readyPromise.then(function(){e.element&&e.element.setData(t)})},t.prototype.draw=function(){this.element&&(c.DomUtil.setTransform(this.element.getElement(),new c.Point(0,0),null),this.element.draw(!0))},t.prototype.onAdd=function(l){var y=this;this.element=new f({getZoom:function(){return l.getZoom()},getViewPort:function(){var t=l.getBounds();return new b({northEast:d.geometry.latLngToWebMercator({lng:t.getNorthEast().lng,lat:t.getNorthEast().lat}),southWest:d.geometry.latLngToWebMercator({lng:t.getSouthWest().lng,lat:t.getSouthWest().lat})})},getElementPixels:function(t){return{northEast:l.latLngToLayerPoint(t.northEast),southWest:l.latLngToLayerPoint(t.southWest)}}},this.options);var p=this.element.initElement();return p.style.transformOrigin="center",c.DomUtil.addClass(p,"leaflet-zoom-animated"),l.getPanes().overlayPane.appendChild(p),l.on("moveend",this.draw,this),l.on("resize",this.draw,this),l.on("zoomend",this.draw,this),this._map.options.zoomAnimation&&c.Browser.any3d&&l.on("zoomanim",function(t){if(y.element.bounds){var e=l.getZoomScale(t.zoom,l.getZoom()),o=l._latLngToNewLayerPoint(y.element.bounds.southWest,t.zoom,t.center).round(),n=l._latLngToNewLayerPoint(y.element.bounds.northEast,t.zoom,t.center).round(),s=l._latLngToNewLayerPoint(y.element.bounds.southWest,l.getZoom(),l.getCenter()).round(),i=l._latLngToNewLayerPoint(y.element.bounds.northEast,l.getZoom(),l.getCenter()).round(),r=(o.x+n.x)/2,h=(o.y+n.y)/2,a=(s.x+i.x)/2,u=(s.y+i.y)/2;c.DomUtil.setTransform(p,new c.Point(r-a,h-u),e)}}),this.readyResolve(),this.draw(),this},t.prototype.onRemove=function(){return this.element&&(this.element.onRemove(),this.element=null),this},t.prototype.setInverse=function(t){this.options.inverse=t,this.draw()},t.prototype.setColors=function(t){this.options.colors=t,this.draw()},t.prototype.setOpacity=function(t){(this.options.opacity=t,this.element)&&(this.element.getElement().style.opacity=null!=this.options.opacity?""+this.options.opacity:"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.draw()},t}(c.Layer),x=function(s){function n(t,e,o){if(!e&&!t.basemaps.basemapsLookup[e])throw new Error("valid style name required to access Targomo basemap");var n="https://maps.targomo.com/styles/"+t.basemaps.basemapsLookup[e]+"/rendered/{z}/{x}/{y}.png?key="+t.serviceKey;return s.call(this,n,o)||this}return i(n,s),n.getTileLayerList=function(e){var o={};return e.basemaps.basemapNames.forEach(function(t){o[t]=new n(e,t,{})}),o},n}(c.TileLayer),w=function(){function t(t,e,o,n){this.tgmClient=t,this.sources=e,this.multigraphOptions=o,this.vectorTileoptions=n,this.createLayer()}return t.prototype.addTo=function(t){this.map=t,this.layer.addTo(t)},t.prototype.updateMultigraphOptions=function(t){this.multigraphOptions=t,this.createLayer()},t.prototype.updateVectorTileOptions=function(t){this.vectorTileoptions=t,this.createLayer()},t.prototype.updateSources=function(t){this.sources=t,this.createLayer()},t.prototype.createLayer=function(){this.map&&this.layer&&this.map.removeLayer(this.layer),this.layer=c.vectorGrid.protobuf(this.tgmClient.multigraph.getTiledMultigraphUrl(this.sources,this.multigraphOptions,"mvt"),this.vectorTileoptions),this.map&&this.layer&&this.layer.addTo(this.map)},t}();t.LeafletPolygonOverlayOptions=g,t.TgmLeafletPolygonOverlay=v,t.TgmLeafletTileLayer=x,t.TgmLeafletMultigraphTileLayer=w,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=targomo-leaflet.umd.min.js.map |
/** | ||
* @targomo/js-extensions "0.0.2" http://targomo.com | ||
* @targomo/js-extensions "0.0.3" http://targomo.com | ||
* Google and Leaflet JavaScript (& TypeScript) extensions for Targomo's time-based access mapping services. | ||
* (c) 2018 Targomo | ||
* (c) 2019 Targomo | ||
*/ | ||
@@ -509,3 +509,8 @@ (function (global, factory) { | ||
PolygonOverlayElement.prototype.setData = function (multipolygon) { | ||
this.model = new ProjectedMultiPolygon(multipolygon); | ||
if (multipolygon) { | ||
this.model = new ProjectedMultiPolygon(multipolygon); | ||
} | ||
else { | ||
this.model = null; | ||
} | ||
this.render(); | ||
@@ -553,5 +558,9 @@ }; | ||
// const inverse = this.options.inverse | ||
if (!this.model || !this.divElement) { | ||
if (!this.divElement) { | ||
return; | ||
} | ||
if (!this.model) { | ||
this.divElement.innerHTML = ''; | ||
return; | ||
} | ||
var zoom = this.plugin.getZoom(); | ||
@@ -601,3 +610,5 @@ var zoomFactor = Math.pow(2, zoom) * 256; | ||
this.readyPromise.then(function () { | ||
_this.element.setData(multipolygon); | ||
if (_this.element) { | ||
_this.element.setData(multipolygon); | ||
} | ||
}); | ||
@@ -670,2 +681,9 @@ }; | ||
}; | ||
TgmLeafletPolygonOverlay.prototype.onRemove = function () { | ||
if (this.element) { | ||
this.element.onRemove(); | ||
this.element = null; | ||
} | ||
return this; | ||
}; | ||
/** | ||
@@ -672,0 +690,0 @@ * |
/** | ||
* @targomo/js-extensions "0.0.2" http://targomo.com | ||
* @targomo/js-extensions "0.0.3" http://targomo.com | ||
* Google and Leaflet JavaScript (& TypeScript) extensions for Targomo's time-based access mapping services. | ||
* (c) 2018 Targomo | ||
* (c) 2019 Targomo | ||
*/ | ||
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("leaflet"),require("@targomo/core")):"function"==typeof define&&define.amd?define(["exports","leaflet","@targomo/core"],o):o((t.tgm=t.tgm||{},t.tgm.leaflet={}),t.L,t.tgm)}(this,function(t,c,d){"use strict";var n=function(t,o){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)o.hasOwnProperty(e)&&(t[e]=o[e])})(t,o)};function i(t,o){function e(){this.constructor=t}n(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}var s,r,E=function(){return(E=Object.assign||function(t){for(var o,e=1,n=arguments.length;e<n;e++)for(var s in o=arguments[e])Object.prototype.hasOwnProperty.call(o,s)&&(t[s]=o[s]);return t}).apply(this,arguments)},h=(s=.5/Math.PI,r=-.5/Math.PI,function(t,o,e){return void 0===e&&(e=1),{x:t=e*(s*t+.5),y:o=e*(r*o+.5)}});function W(t,o,e){return void 0===e&&(e=1),h(t/6378137,o/6378137,e)}var b=function(){function o(t){this.southWest=new T(1/0,1/0),this.northEast=new T(-1/0,-1/0),t&&(this.southWest=new T(t.southWest.x,t.southWest.y),this.northEast=new T(t.northEast.x,t.northEast.y))}return o.prototype.expandPoint=function(t,o){this.southWest.x=Math.min(this.southWest.x,t),this.northEast.x=Math.max(this.northEast.x,t),this.southWest.y=Math.min(this.southWest.y,o),this.northEast.y=Math.max(this.northEast.y,o)},o.prototype.expand=function(t){this.expandPoint(t.northEast.x,t.northEast.y),this.expandPoint(t.southWest.x,t.southWest.y)},o.prototype.modifyIntersect=function(t){return this.southWest.x=Math.max(this.southWest.x,t.southWest.x),this.northEast.x=Math.min(this.northEast.x,t.northEast.x),this.southWest.y=Math.max(this.southWest.y,t.southWest.y),this.northEast.y=Math.min(this.northEast.y,t.northEast.y),this},o.prototype.contains=function(t){return this.northEast.x>=t.northEast.x&&this.northEast.y>=t.northEast.y&&this.southWest.x<=t.southWest.x&&this.southWest.y<=t.southWest.y},o.prototype.intersects=function(t){return!(this.northEast.x<t.southWest.x||this.northEast.y<t.southWest.y||this.southWest.x>t.northEast.x||this.southWest.y>t.northEast.y)},o.prototype.growOutwardsFactor=function(t){void 0===t&&(t=1);var o=(this.northEast.x-this.southWest.x)*t,e=(this.northEast.y-this.southWest.y)*t;return this.northEast.x+=o,this.northEast.y+=e,this.southWest.x-=o,this.southWest.y-=e,this},o.prototype.growOutwardsAmount=function(t){return this.northEast.x+=t,this.northEast.y+=t,this.southWest.x-=t,this.southWest.y-=t,this},o.prototype.toLineString=function(){return[new T(this.southWest.x,this.northEast.y),new T(this.northEast.x,this.northEast.y),new T(this.northEast.x,this.southWest.y),new T(this.southWest.x,this.southWest.y)]},o.prototype.reproject=function(t){return new o({northEast:t(this.northEast.x,this.northEast.y),southWest:t(this.southWest.x,this.southWest.y)})},o}(),T=function(){function t(t,o){this.x=t,this.y=o}return t.prototype.isCollinear=function(t,o,e){if(t.x==o.x&&t.y==o.y)return!1;if(t.x==this.x&&this.x==o.x)return!0;if(t.y==this.y&&this.y==o.y)return!0;var n=t.x*(this.y-o.y)+this.x*(o.y-t.y)+o.x*(t.y-this.y);return n<e&&-e<n&&t.x!=o.x&&t.y!=o.y},t.prototype.euclideanDistance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},t}(),a=function(t){var e=this;this.bounds3857=new b,this.points=t.map(function(t){e.bounds3857.expandPoint(t[0],t[1]);var o=W(t[0],t[1],1);return new T(o.x,o.y)})},u=function(){function t(t){var e=this;this.bounds3857=new b,this.travelTime=t.travelTime,this.area=t.area,this.lineStrings=[new a(t.outerBoundary)],this.bounds3857.expand(this.lineStrings[0].bounds3857),t.innerBoundary&&t.innerBoundary.forEach(function(t){var o=new a(t);e.lineStrings.push(o),e.bounds3857.expand(o.bounds3857)})}return t.prototype.getOuterBoundary=function(){return this.lineStrings[0]},t.prototype.getInnerBoundary=function(){return this.lineStrings.slice(1)},t}(),o=function(){function t(t){var e=this;this.polygons={},this.bounds3857=new b,t.forEach(function(t){t.polygons.forEach(function(t){var o=new u(t);e.polygons[o.travelTime]=e.polygons[o.travelTime]||[],e.polygons[o.travelTime].push(o),e.bounds3857.expand(o.bounds3857)})})}return t.prototype.forEach=function(e){var n=this;Object.keys(this.polygons).map(function(t){return+t}).sort(function(t,o){return o-t}).forEach(function(t,o){return e(+t,n.polygons[t],o)})},t}();var e={};["#006837","#39B54A","#8CC63F","#F7931E","#F15A24","#C1272D"].forEach(function(t,o){e[300*(o+1)]=t});var l=function(){this.inverse=!1,this.colors=e,this.opacity=.5,this.strokeWidth=5},y=function(e){function t(t){var o=e.call(this)||this;return Object.assign(o,t),o}return i(t,e),t.prototype.getColorOpacity=function(t,o){var e,n=null;return n=this.colors instanceof Array?this.colors[o]:this.colors[t],(e=n)&&null!=e.color?{color:n.color||"#ccc",opacity:n.opacity||1}:{color:n||"#ccc",opacity:1}},t}(l),L=0;function p(h,t,s,o,a){var e,n=W(t.southWest.x,t.southWest.y,s),i=W(t.northEast.x,t.northEast.y,s);i.y<n.y&&(e=[n.y,i.y],i.y=e[0],n.y=e[1]);var r=Math.floor(n.x),u=Math.floor(n.y),l=Math.ceil(i.x),y=Math.ceil(i.y),p=new b(h).reproject(W).toLineString();function c(n,t){return(t=function(t,o){var i,r,h,a,e=function(t){return(r.x-i.x)*(t.y-i.y)>(r.y-i.y)*(t.x-i.x)},n=function(){var t=new T(i.x-r.x,i.y-r.y),o=new T(h.x-a.x,h.y-a.y),e=i.x*r.y-i.y*r.x,n=h.x*a.y-h.y*a.x,s=1/(t.x*o.y-t.y*o.x);return new T((e*o.x-n*t.x)*s,(e*o.y-n*t.y)*s)},s=t;for(var u in i=o[o.length-1],o){r=o[u];var l=s;for(var y in s=[],h=l[l.length-1],l)e(a=l[y])?(e(h)||s.push(n()),s.push(a)):e(h)&&s.push(n()),h=a;i=r}return s}(t,p)).forEach(function(t,o){var e=(0<o?"L":"M")+" "+(Math.round(t.x*s)-r)+" "+(Math.round(t.y*s)-u);n.push(e)}),0<n.length&&n.push("z"),n}var d=[];o.forEach(function(t,o,e){var n,s,i=o.map(function(t){return(o=t,e=[],h.intersects(o.bounds3857)&&(c(e,o.getOuterBoundary().points),o.getInnerBoundary().forEach(function(t){h.intersects(t.bounds3857)&&c(e,t.points)})),e).join(" ");var o,e}).join(" ");if(0!=i.length){var r=a.getColorOpacity(t,e);d.push((n=i,"\n <g style='opacity: "+(s=E({},r,{strokeWidth:a.strokeWidth,color:a.inverse?"black":r.color})).opacity+"'>\n <path style='stroke: "+s.color+";\n fill: "+s.color+";\n stroke-opacity: "+s.opacity+";\n stroke-width: "+s.strokeWidth+";\n fill-opacity: "+s.opacity+"'\n\n d='"+n+"'/>\n </g>\n "))}});var f,m,g,v,x=l-r,w=y-u;return a.inverse?(g="tgm:inverse:"+L++,'\n <svg height="100%" width="100%" viewbox="0 0 '+(f=x)+" "+(m=w)+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n <path style='mask: url(#mask_"+g+")' d='"+(v="M 0 0 L "+f+" 0 L "+f+" "+m+" L 0 "+m+" z")+"'/>\n \n <defs>\n <mask id='mask_"+g+"'>\n <path style='fill-opacity:1; stroke: white; fill:white;' d='"+v+"'/>\"\n "+d.join("\n")+"\n </mask>\n </defs>\n \n </svg>"):'\n <svg height="100%" width="100%" viewbox="0 0 '+x+" "+w+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n "+d.join("\n")+"\n </svg>"}var f=function(){function t(t,o){void 0===t&&(t=50),void 0===o&&(o=500),this.min=t,this.max=o}return t.prototype.schedule=function(t){var o=this,e=function(){clearTimeout(o.longTimeout),clearTimeout(o.shortTimeout),o.longTimeout=null,o.shortTimeout=null,t()};this.longTimeout||(this.longTimeout=setTimeout(e,this.max)),clearTimeout(this.shortTimeout),this.shortTimeout=setTimeout(e,this.min)},t}(),m=function(){function t(t,o){this.plugin=t,this.options=o,this.renderTimeout=new f}return t.prototype.getElement=function(){return this.divElement},t.prototype.draw=function(t){var o=this;void 0===t&&(t=!1),this.resize(),t?this.render():this.renderTimeout.schedule(function(){return o.render()})},t.prototype.resize=function(){if(this.divElement&&this.bounds){var t=this.plugin.getElementPixels(this.bounds),o=t.southWest,e=t.northEast,n=this.divElement;n.style.left=o.x+"px",n.style.top=e.y+"px",n.style.width=e.x-o.x+"px",n.style.height=o.y-e.y+"px"}},t.prototype.initElement=function(){var t=document.createElement("div");return t.style.borderStyle="none",t.style.borderWidth="0px",t.style.position="absolute",t.style.opacity=""+this.options.opacity||"0.5",this.divElement=t,this.divElement},t.prototype.onRemove=function(){this.divElement.parentNode.removeChild(this.divElement),this.divElement=null},t.prototype.setData=function(t){this.model=new o(t),this.render()},t.prototype.setInverse=function(t){this.options.inverse=t,this.render()},t.prototype.setColors=function(t){this.options.colors=t,this.render()},t.prototype.setOpacity=function(t){this.options.opacity=t,this.divElement&&(this.divElement.style.opacity=""+this.options.opacity||"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.render()},t.prototype.boundsCalculation=function(t){var o=this.model,e=this.options.inverse,n=new b(this.plugin.getViewPort()),s=new b(n),i=new b(s).growOutwardsFactor(t).modifyIntersect(o.bounds3857);e&&(i.expand(n),i.growOutwardsFactor(t)),s.growOutwardsFactor(t);var r=d.geometry.webMercatorToLatLng(n.southWest,void 0),h=d.geometry.webMercatorToLatLng(n.northEast,void 0),a=this.plugin.getElementPixels({southWest:r,northEast:h}),u=Math.abs((n.northEast.x-n.southWest.x)/a.northEast.x-a.southWest.x);return i.growOutwardsAmount(this.options&&u*this.options.strokeWidth||0),{bounds:s,newBounds:i}},t.prototype.render=function(){if(this.model&&this.divElement){var t=this.plugin.getZoom(),o=256*Math.pow(2,t);o=Math.min(1e7,o);var e=Math.min(5,Math.max(2,(t-12)/2)),n=this.boundsCalculation(e),s=n.bounds,i=n.newBounds,r=p(s,i,o,this.model,new y(this.options));this.divElement.innerHTML=r;var h=d.geometry.webMercatorToLatLng(i.southWest,void 0),a=d.geometry.webMercatorToLatLng(i.northEast,void 0);this.bounds={southWest:h,northEast:a},this.resize()}},t}(),g=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return i(o,t),o}(l),v=function(e){function t(t){var o=e.call(this)||this;return o.readyPromise=new Promise(function(t){return o.readyResolve=t}),o.options=Object.assign(new g,t||{}),o}return i(t,e),t.prototype.setData=function(t){var o=this;this.readyPromise.then(function(){o.element.setData(t)})},t.prototype.draw=function(){this.element&&(c.DomUtil.setTransform(this.element.getElement(),new c.Point(0,0),null),this.element.draw(!0))},t.prototype.onAdd=function(l){var y=this;this.element=new m({getZoom:function(){return l.getZoom()},getViewPort:function(){var t=l.getBounds();return new b({northEast:d.geometry.latLngToWebMercator({lng:t.getNorthEast().lng,lat:t.getNorthEast().lat}),southWest:d.geometry.latLngToWebMercator({lng:t.getSouthWest().lng,lat:t.getSouthWest().lat})})},getElementPixels:function(t){return{northEast:l.latLngToLayerPoint(t.northEast),southWest:l.latLngToLayerPoint(t.southWest)}}},this.options);var p=this.element.initElement();return p.style.transformOrigin="center",c.DomUtil.addClass(p,"leaflet-zoom-animated"),l.getPanes().overlayPane.appendChild(p),l.on("moveend",this.draw,this),l.on("resize",this.draw,this),l.on("zoomend",this.draw,this),this._map.options.zoomAnimation&&c.Browser.any3d&&l.on("zoomanim",function(t){if(y.element.bounds){var o=l.getZoomScale(t.zoom,l.getZoom()),e=l._latLngToNewLayerPoint(y.element.bounds.southWest,t.zoom,t.center).round(),n=l._latLngToNewLayerPoint(y.element.bounds.northEast,t.zoom,t.center).round(),s=l._latLngToNewLayerPoint(y.element.bounds.southWest,l.getZoom(),l.getCenter()).round(),i=l._latLngToNewLayerPoint(y.element.bounds.northEast,l.getZoom(),l.getCenter()).round(),r=(e.x+n.x)/2,h=(e.y+n.y)/2,a=(s.x+i.x)/2,u=(s.y+i.y)/2;c.DomUtil.setTransform(p,new c.Point(r-a,h-u),o)}}),this.readyResolve(),this.draw(),this},t.prototype.setInverse=function(t){this.options.inverse=t,this.draw()},t.prototype.setColors=function(t){this.options.colors=t,this.draw()},t.prototype.setOpacity=function(t){(this.options.opacity=t,this.element)&&(this.element.getElement().style.opacity=null!=this.options.opacity?""+this.options.opacity:"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.draw()},t}(c.Layer),x=function(s){function n(t,o,e){if(!o&&!t.basemaps.basemapsLookup[o])throw new Error("valid style name required to access Targomo basemap");var n="https://maps.targomo.com/styles/"+t.basemaps.basemapsLookup[o]+"/rendered/{z}/{x}/{y}.png?key="+t.serviceKey;return s.call(this,n,e)||this}return i(n,s),n.getTileLayerList=function(o){var e={};return o.basemaps.basemapNames.forEach(function(t){e[t]=new n(o,t,{})}),e},n}(c.TileLayer),w=function(){function t(t,o,e,n){this.tgmClient=t,this.sources=o,this.multigraphOptions=e,this.vectorTileoptions=n,this.createLayer()}return t.prototype.addTo=function(t){this.map=t,this.layer.addTo(t)},t.prototype.updateMultigraphOptions=function(t){this.multigraphOptions=t,this.createLayer()},t.prototype.updateVectorTileOptions=function(t){this.vectorTileoptions=t,this.createLayer()},t.prototype.updateSources=function(t){this.sources=t,this.createLayer()},t.prototype.createLayer=function(){this.map&&this.layer&&this.map.removeLayer(this.layer),this.layer=c.vectorGrid.protobuf(this.tgmClient.multigraph.getTiledMultigraphUrl(this.sources,this.multigraphOptions,"mvt"),this.vectorTileoptions),this.map&&this.layer&&this.layer.addTo(this.map)},t}();t.LeafletPolygonOverlayOptions=g,t.TgmLeafletPolygonOverlay=v,t.TgmLeafletTileLayer=x,t.TgmLeafletMultigraphTileLayer=w,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet"),require("@targomo/core")):"function"==typeof define&&define.amd?define(["exports","leaflet","@targomo/core"],e):e((t.tgm=t.tgm||{},t.tgm.leaflet={}),t.L,t.tgm)}(this,function(t,c,d){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)};function i(t,e){function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var s,r,E=function(){return(E=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},h=(s=.5/Math.PI,r=-.5/Math.PI,function(t,e,o){return void 0===o&&(o=1),{x:t=o*(s*t+.5),y:e=o*(r*e+.5)}});function W(t,e,o){return void 0===o&&(o=1),h(t/6378137,e/6378137,o)}var b=function(){function e(t){this.southWest=new T(1/0,1/0),this.northEast=new T(-1/0,-1/0),t&&(this.southWest=new T(t.southWest.x,t.southWest.y),this.northEast=new T(t.northEast.x,t.northEast.y))}return e.prototype.expandPoint=function(t,e){this.southWest.x=Math.min(this.southWest.x,t),this.northEast.x=Math.max(this.northEast.x,t),this.southWest.y=Math.min(this.southWest.y,e),this.northEast.y=Math.max(this.northEast.y,e)},e.prototype.expand=function(t){this.expandPoint(t.northEast.x,t.northEast.y),this.expandPoint(t.southWest.x,t.southWest.y)},e.prototype.modifyIntersect=function(t){return this.southWest.x=Math.max(this.southWest.x,t.southWest.x),this.northEast.x=Math.min(this.northEast.x,t.northEast.x),this.southWest.y=Math.max(this.southWest.y,t.southWest.y),this.northEast.y=Math.min(this.northEast.y,t.northEast.y),this},e.prototype.contains=function(t){return this.northEast.x>=t.northEast.x&&this.northEast.y>=t.northEast.y&&this.southWest.x<=t.southWest.x&&this.southWest.y<=t.southWest.y},e.prototype.intersects=function(t){return!(this.northEast.x<t.southWest.x||this.northEast.y<t.southWest.y||this.southWest.x>t.northEast.x||this.southWest.y>t.northEast.y)},e.prototype.growOutwardsFactor=function(t){void 0===t&&(t=1);var e=(this.northEast.x-this.southWest.x)*t,o=(this.northEast.y-this.southWest.y)*t;return this.northEast.x+=e,this.northEast.y+=o,this.southWest.x-=e,this.southWest.y-=o,this},e.prototype.growOutwardsAmount=function(t){return this.northEast.x+=t,this.northEast.y+=t,this.southWest.x-=t,this.southWest.y-=t,this},e.prototype.toLineString=function(){return[new T(this.southWest.x,this.northEast.y),new T(this.northEast.x,this.northEast.y),new T(this.northEast.x,this.southWest.y),new T(this.southWest.x,this.southWest.y)]},e.prototype.reproject=function(t){return new e({northEast:t(this.northEast.x,this.northEast.y),southWest:t(this.southWest.x,this.southWest.y)})},e}(),T=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.isCollinear=function(t,e,o){if(t.x==e.x&&t.y==e.y)return!1;if(t.x==this.x&&this.x==e.x)return!0;if(t.y==this.y&&this.y==e.y)return!0;var n=t.x*(this.y-e.y)+this.x*(e.y-t.y)+e.x*(t.y-this.y);return n<o&&-o<n&&t.x!=e.x&&t.y!=e.y},t.prototype.euclideanDistance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},t}(),a=function(t){var o=this;this.bounds3857=new b,this.points=t.map(function(t){o.bounds3857.expandPoint(t[0],t[1]);var e=W(t[0],t[1],1);return new T(e.x,e.y)})},u=function(){function t(t){var o=this;this.bounds3857=new b,this.travelTime=t.travelTime,this.area=t.area,this.lineStrings=[new a(t.outerBoundary)],this.bounds3857.expand(this.lineStrings[0].bounds3857),t.innerBoundary&&t.innerBoundary.forEach(function(t){var e=new a(t);o.lineStrings.push(e),o.bounds3857.expand(e.bounds3857)})}return t.prototype.getOuterBoundary=function(){return this.lineStrings[0]},t.prototype.getInnerBoundary=function(){return this.lineStrings.slice(1)},t}(),e=function(){function t(t){var o=this;this.polygons={},this.bounds3857=new b,t.forEach(function(t){t.polygons.forEach(function(t){var e=new u(t);o.polygons[e.travelTime]=o.polygons[e.travelTime]||[],o.polygons[e.travelTime].push(e),o.bounds3857.expand(e.bounds3857)})})}return t.prototype.forEach=function(o){var n=this;Object.keys(this.polygons).map(function(t){return+t}).sort(function(t,e){return e-t}).forEach(function(t,e){return o(+t,n.polygons[t],e)})},t}();var o={};["#006837","#39B54A","#8CC63F","#F7931E","#F15A24","#C1272D"].forEach(function(t,e){o[300*(e+1)]=t});var l=function(){this.inverse=!1,this.colors=o,this.opacity=.5,this.strokeWidth=5},y=function(o){function t(t){var e=o.call(this)||this;return Object.assign(e,t),e}return i(t,o),t.prototype.getColorOpacity=function(t,e){var o,n=null;return n=this.colors instanceof Array?this.colors[e]:this.colors[t],(o=n)&&null!=o.color?{color:n.color||"#ccc",opacity:n.opacity||1}:{color:n||"#ccc",opacity:1}},t}(l),L=0;function p(h,t,s,e,a){var o,n=W(t.southWest.x,t.southWest.y,s),i=W(t.northEast.x,t.northEast.y,s);i.y<n.y&&(o=[n.y,i.y],i.y=o[0],n.y=o[1]);var r=Math.floor(n.x),u=Math.floor(n.y),l=Math.ceil(i.x),y=Math.ceil(i.y),p=new b(h).reproject(W).toLineString();function c(n,t){return(t=function(t,e){var i,r,h,a,o=function(t){return(r.x-i.x)*(t.y-i.y)>(r.y-i.y)*(t.x-i.x)},n=function(){var t=new T(i.x-r.x,i.y-r.y),e=new T(h.x-a.x,h.y-a.y),o=i.x*r.y-i.y*r.x,n=h.x*a.y-h.y*a.x,s=1/(t.x*e.y-t.y*e.x);return new T((o*e.x-n*t.x)*s,(o*e.y-n*t.y)*s)},s=t;for(var u in i=e[e.length-1],e){r=e[u];var l=s;for(var y in s=[],h=l[l.length-1],l)o(a=l[y])?(o(h)||s.push(n()),s.push(a)):o(h)&&s.push(n()),h=a;i=r}return s}(t,p)).forEach(function(t,e){var o=(0<e?"L":"M")+" "+(Math.round(t.x*s)-r)+" "+(Math.round(t.y*s)-u);n.push(o)}),0<n.length&&n.push("z"),n}var d=[];e.forEach(function(t,e,o){var n,s,i=e.map(function(t){return(e=t,o=[],h.intersects(e.bounds3857)&&(c(o,e.getOuterBoundary().points),e.getInnerBoundary().forEach(function(t){h.intersects(t.bounds3857)&&c(o,t.points)})),o).join(" ");var e,o}).join(" ");if(0!=i.length){var r=a.getColorOpacity(t,o);d.push((n=i,"\n <g style='opacity: "+(s=E({},r,{strokeWidth:a.strokeWidth,color:a.inverse?"black":r.color})).opacity+"'>\n <path style='stroke: "+s.color+";\n fill: "+s.color+";\n stroke-opacity: "+s.opacity+";\n stroke-width: "+s.strokeWidth+";\n fill-opacity: "+s.opacity+"'\n\n d='"+n+"'/>\n </g>\n "))}});var m,f,g,v,x=l-r,w=y-u;return a.inverse?(g="tgm:inverse:"+L++,'\n <svg height="100%" width="100%" viewbox="0 0 '+(m=x)+" "+(f=w)+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n <path style='mask: url(#mask_"+g+")' d='"+(v="M 0 0 L "+m+" 0 L "+m+" "+f+" L 0 "+f+" z")+"'/>\n \n <defs>\n <mask id='mask_"+g+"'>\n <path style='fill-opacity:1; stroke: white; fill:white;' d='"+v+"'/>\"\n "+d.join("\n")+"\n </mask>\n </defs>\n \n </svg>"):'\n <svg height="100%" width="100%" viewbox="0 0 '+x+" "+w+"\"\n style='opacity: 1; stroke-linejoin:round; stroke-linecap:round; fill-rule: evenodd'\n xmlns='http://www.w3.org/2000/svg'>\n "+d.join("\n")+"\n </svg>"}var m=function(){function t(t,e){void 0===t&&(t=50),void 0===e&&(e=500),this.min=t,this.max=e}return t.prototype.schedule=function(t){var e=this,o=function(){clearTimeout(e.longTimeout),clearTimeout(e.shortTimeout),e.longTimeout=null,e.shortTimeout=null,t()};this.longTimeout||(this.longTimeout=setTimeout(o,this.max)),clearTimeout(this.shortTimeout),this.shortTimeout=setTimeout(o,this.min)},t}(),f=function(){function t(t,e){this.plugin=t,this.options=e,this.renderTimeout=new m}return t.prototype.getElement=function(){return this.divElement},t.prototype.draw=function(t){var e=this;void 0===t&&(t=!1),this.resize(),t?this.render():this.renderTimeout.schedule(function(){return e.render()})},t.prototype.resize=function(){if(this.divElement&&this.bounds){var t=this.plugin.getElementPixels(this.bounds),e=t.southWest,o=t.northEast,n=this.divElement;n.style.left=e.x+"px",n.style.top=o.y+"px",n.style.width=o.x-e.x+"px",n.style.height=e.y-o.y+"px"}},t.prototype.initElement=function(){var t=document.createElement("div");return t.style.borderStyle="none",t.style.borderWidth="0px",t.style.position="absolute",t.style.opacity=""+this.options.opacity||"0.5",this.divElement=t,this.divElement},t.prototype.onRemove=function(){this.divElement.parentNode.removeChild(this.divElement),this.divElement=null},t.prototype.setData=function(t){this.model=t?new e(t):null,this.render()},t.prototype.setInverse=function(t){this.options.inverse=t,this.render()},t.prototype.setColors=function(t){this.options.colors=t,this.render()},t.prototype.setOpacity=function(t){this.options.opacity=t,this.divElement&&(this.divElement.style.opacity=""+this.options.opacity||"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.render()},t.prototype.boundsCalculation=function(t){var e=this.model,o=this.options.inverse,n=new b(this.plugin.getViewPort()),s=new b(n),i=new b(s).growOutwardsFactor(t).modifyIntersect(e.bounds3857);o&&(i.expand(n),i.growOutwardsFactor(t)),s.growOutwardsFactor(t);var r=d.geometry.webMercatorToLatLng(n.southWest,void 0),h=d.geometry.webMercatorToLatLng(n.northEast,void 0),a=this.plugin.getElementPixels({southWest:r,northEast:h}),u=Math.abs((n.northEast.x-n.southWest.x)/a.northEast.x-a.southWest.x);return i.growOutwardsAmount(this.options&&u*this.options.strokeWidth||0),{bounds:s,newBounds:i}},t.prototype.render=function(){if(this.divElement)if(this.model){var t=this.plugin.getZoom(),e=256*Math.pow(2,t);e=Math.min(1e7,e);var o=Math.min(5,Math.max(2,(t-12)/2)),n=this.boundsCalculation(o),s=n.bounds,i=n.newBounds,r=p(s,i,e,this.model,new y(this.options));this.divElement.innerHTML=r;var h=d.geometry.webMercatorToLatLng(i.southWest,void 0),a=d.geometry.webMercatorToLatLng(i.northEast,void 0);this.bounds={southWest:h,northEast:a},this.resize()}else this.divElement.innerHTML=""},t}(),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(l),v=function(o){function t(t){var e=o.call(this)||this;return e.readyPromise=new Promise(function(t){return e.readyResolve=t}),e.options=Object.assign(new g,t||{}),e}return i(t,o),t.prototype.setData=function(t){var e=this;this.readyPromise.then(function(){e.element&&e.element.setData(t)})},t.prototype.draw=function(){this.element&&(c.DomUtil.setTransform(this.element.getElement(),new c.Point(0,0),null),this.element.draw(!0))},t.prototype.onAdd=function(l){var y=this;this.element=new f({getZoom:function(){return l.getZoom()},getViewPort:function(){var t=l.getBounds();return new b({northEast:d.geometry.latLngToWebMercator({lng:t.getNorthEast().lng,lat:t.getNorthEast().lat}),southWest:d.geometry.latLngToWebMercator({lng:t.getSouthWest().lng,lat:t.getSouthWest().lat})})},getElementPixels:function(t){return{northEast:l.latLngToLayerPoint(t.northEast),southWest:l.latLngToLayerPoint(t.southWest)}}},this.options);var p=this.element.initElement();return p.style.transformOrigin="center",c.DomUtil.addClass(p,"leaflet-zoom-animated"),l.getPanes().overlayPane.appendChild(p),l.on("moveend",this.draw,this),l.on("resize",this.draw,this),l.on("zoomend",this.draw,this),this._map.options.zoomAnimation&&c.Browser.any3d&&l.on("zoomanim",function(t){if(y.element.bounds){var e=l.getZoomScale(t.zoom,l.getZoom()),o=l._latLngToNewLayerPoint(y.element.bounds.southWest,t.zoom,t.center).round(),n=l._latLngToNewLayerPoint(y.element.bounds.northEast,t.zoom,t.center).round(),s=l._latLngToNewLayerPoint(y.element.bounds.southWest,l.getZoom(),l.getCenter()).round(),i=l._latLngToNewLayerPoint(y.element.bounds.northEast,l.getZoom(),l.getCenter()).round(),r=(o.x+n.x)/2,h=(o.y+n.y)/2,a=(s.x+i.x)/2,u=(s.y+i.y)/2;c.DomUtil.setTransform(p,new c.Point(r-a,h-u),e)}}),this.readyResolve(),this.draw(),this},t.prototype.onRemove=function(){return this.element&&(this.element.onRemove(),this.element=null),this},t.prototype.setInverse=function(t){this.options.inverse=t,this.draw()},t.prototype.setColors=function(t){this.options.colors=t,this.draw()},t.prototype.setOpacity=function(t){(this.options.opacity=t,this.element)&&(this.element.getElement().style.opacity=null!=this.options.opacity?""+this.options.opacity:"0.5")},t.prototype.setStrokeWidth=function(t){this.options.strokeWidth=t,this.draw()},t}(c.Layer),x=function(s){function n(t,e,o){if(!e&&!t.basemaps.basemapsLookup[e])throw new Error("valid style name required to access Targomo basemap");var n="https://maps.targomo.com/styles/"+t.basemaps.basemapsLookup[e]+"/rendered/{z}/{x}/{y}.png?key="+t.serviceKey;return s.call(this,n,o)||this}return i(n,s),n.getTileLayerList=function(e){var o={};return e.basemaps.basemapNames.forEach(function(t){o[t]=new n(e,t,{})}),o},n}(c.TileLayer),w=function(){function t(t,e,o,n){this.tgmClient=t,this.sources=e,this.multigraphOptions=o,this.vectorTileoptions=n,this.createLayer()}return t.prototype.addTo=function(t){this.map=t,this.layer.addTo(t)},t.prototype.updateMultigraphOptions=function(t){this.multigraphOptions=t,this.createLayer()},t.prototype.updateVectorTileOptions=function(t){this.vectorTileoptions=t,this.createLayer()},t.prototype.updateSources=function(t){this.sources=t,this.createLayer()},t.prototype.createLayer=function(){this.map&&this.layer&&this.map.removeLayer(this.layer),this.layer=c.vectorGrid.protobuf(this.tgmClient.multigraph.getTiledMultigraphUrl(this.sources,this.multigraphOptions,"mvt"),this.vectorTileoptions),this.map&&this.layer&&this.layer.addTo(this.map)},t}();t.LeafletPolygonOverlayOptions=g,t.TgmLeafletPolygonOverlay=v,t.TgmLeafletTileLayer=x,t.TgmLeafletMultigraphTileLayer=w,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=targomo-leaflet.umd.min.js.map |
@@ -34,2 +34,3 @@ import * as L from 'leaflet'; | ||
onAdd(map: L.Map): this; | ||
onRemove(): this; | ||
/** | ||
@@ -36,0 +37,0 @@ * |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
385369
5302