angular-heremaps
Version:
Angular directive for working with Nokia Here Maps
1 lines • 22.1 kB
JavaScript
!function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var p=r[a]={exports:{}};t[a][0].call(p.exports,function(e){var r=t[a][1][e];return o(r||e)},p,p.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){function n(e,t,r,n,o,i,a,s,u,c,p,d){function l(r,n,l){function f(){m(),h()}function m(){if(!o.app_id||!o.app_code)throw new Error("app_id or app_code were missed. Please specify their in HereMapsConfig");L.platform=new H.service.Platform(o),L.layers=L.platform.createDefaultLayers()}function g(e,t){var r=!!e,n=t||0;return i.getPosition({enableHighAccuracy:r,maximumAge:n})}function h(){v(function(){i.loadModules(l.$attr,{controls:E,events:M})})}function v(e){var t=L.map=new H.Map(n[0],L.layers.normal.map,{zoom:a.isValidCoords(C)?I.zoom:I.maxZoom,center:new H.geo.Point(C.latitude,C.longitude)});s.addMarkersToMap(t,T,!0),o.mapTileConfig&&b(t,o.mapTileConfig),U&&U(y()),e&&e()}function E(){d.start({platform:L,alignment:l.controls})}function M(){p.start({platform:L,listeners:x,options:I,injector:S})}function S(){return function(e){return L[e]}}function w(e,t){k.apply(null,arguments),L.map.getViewPort().resize()}function k(e,t){var e=e||n[0].parentNode.offsetHeight||I.height,t=t||n[0].parentNode.offsetWidth||I.width;r.mapHeight=e+"px",r.mapWidth=t+"px",a.runScopeDigestIfNeed(r)}function b(e,t){var r=L.platform.getMapTileService({type:"base"}),n=r.createTileLayer("maptile",t.scheme||"normal.day",t.size||256,t.format||"png8",t.metadataQueryParams||{});e.setBaseLayer(n)}function y(){return{refresh:function(){var e=this.getViewBounds();this.setMapSizes(),this.setViewBounds(e)},setMapSizes:function(e,t){w.apply(null,arguments)},getPlatform:function(){return L},calculateRoute:function(e,t){return u.calculateRoute(L,{driveType:e,direction:t})},addRouteToMap:function(e,t){u.addRouteToMap(L.map,e,t)},setZoom:function(e,t){a.zoom(L.map,e||10,t)},getZoom:function(){return L.map.getZoom()},getCenter:function(){return L.map.getCenter()},getViewBounds:function(){return L.map.getViewBounds()},setViewBounds:function(e,t){s.setViewBounds(L.map,e,t)},getBoundsRectFromPoints:function(e,t){return a.getBoundsRectFromPoints.apply(null,arguments)},setCenter:function(e){if(!e)return console.error("coords are not specified!");L.map.setCenter(e)},cleanRoutes:function(){u.cleanRoutes(L.map)},getUserLocation:function(e,t){return g.apply(null,arguments).then(function(e){var t=e.coords;return{lat:t.latitude,lng:t.longitude}})},geocodePosition:function(e,t){return i.geocodePosition(L.platform,{coords:e,radius:t&&t.radius,lang:t&&t.lang})},geocodeAddress:function(e){return i.geocodeAddress(L.platform,{searchtext:e&&e.searchtext,country:e&&e.country,city:e&&e.city,street:e&&e.street,housenumber:e&&e.housenumber})},geocodeAutocomplete:function(e,t){return i.geocodeAutocomplete({query:e,beginHighlight:t&&t.beginHighlight,endHighlight:t&&t.endHighlight,maxresults:t&&t.maxresults})},findLocationById:function(e){return i.findLocationById(e)},updateMarkers:function(e,t){s.updateMarkers(L.map,e,t)},getMapFactory:function(){return a.getMapFactory()}}}var T=(c.CONTROLS.NAMES,r.places()),O=r.opts(),x=r.events(),I=angular.extend({},c.DEFAULT_MAP_OPTIONS,O),C=a.isValidCoords(I.coords)?I.coords:c.DEFAULT_MAP_OPTIONS.coords,L={id:a.generateId()},U=r.onMapReady(),B=null;e(function(){return k()}).then(function(){i.loadApi().then(f)}),I.resize&&function(){B=a.throttle(w,c.UPDATE_MAP_RESIZE_TIMEOUT),t.addEventListener("resize",B)}(),r.$on("$destroy",function(){t.removeEventListener("resize",B)})}return l.$inject=["$scope","$element","$attrs"],{restrict:"EA",template:"<div ng-style=\"{'width': mapWidth, 'height': mapHeight}\"></div>",replace:!0,scope:{opts:"&options",places:"&",onMapReady:"&mapReady",events:"&"},controller:l}}t.exports=n,n.$inject=["$timeout","$window","$rootScope","$filter","HereMapsConfig","HereMapsAPIService","HereMapsUtilsService","HereMapsMarkerService","HereMapsRoutesService","HereMapsCONSTS","HereMapsEventsFactory","HereMapsUiFactory"]},{}],2:[function(e,t,r){e("./providers/markers"),e("./providers/map-modules"),e("./providers/routes"),t.exports=angular.module("heremaps",["heremaps-markers-module","heremaps-routes-module","heremaps-map-modules"]).provider("HereMapsConfig",e("./providers/mapconfig.provider")).service("HereMapsUtilsService",e("./providers/maputils.service")).service("HereMapsAPIService",e("./providers/api.service")).constant("HereMapsCONSTS",e("./providers/consts")).directive("heremaps",e("./heremaps.directive"))},{"./heremaps.directive":1,"./providers/api.service":3,"./providers/consts":4,"./providers/map-modules":7,"./providers/mapconfig.provider":9,"./providers/maputils.service":10,"./providers/markers":13,"./providers/routes":17}],3:[function(e,t,r){function n(e,t,r,n,o){function i(){return h(O.CORE).then(function(){return h(O.SERVICE)})}function a(e,t){for(var r in t)if(t.hasOwnProperty(r)&&e[r]){var n=l(r);n().then(t[r])}}function s(t){var r=e.defer();return t&&n.isValidCoords(t.coords)?r.resolve({coords:t.coords}):navigator.geolocation.getCurrentPosition(function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise}function u(t,r){if(!r.coords)return console.error("Missed required coords");var n=t.getGeocodingService(),o=e.defer(),i={prox:[r.coords.lat,r.coords.lng,r.radius||250].join(","),mode:"retrieveAddresses",maxresults:"1",gen:"8",language:r.lang||"en-gb"};return n.reverseGeocode(i,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}function c(t,r){if(!r)return console.error("Missed required parameters");var n=t.getGeocodingService(),o=e.defer(),i={gen:8};for(var a in r)i[a]=r[a];return n.geocode(i,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}function p(n){if(!n)return console.error("Missing required parameters");var o=T+O.AUTOCOMPLETE_URL,i=e.defer(),a={query:"",beginHighlight:"<mark>",endHighlight:"</mark>",maxresults:"5"};for(var s in a)angular.isDefined(n[s])&&(a[s]=n[s]);return a.app_id=r.app_id,a.app_code=r.app_code,t.get(o,{params:a}).success(function(e){i.resolve(e)}).error(function(e){i.reject(e)}),i.promise}function d(n){if(!n)return console.error("Missing Location Identifier");var o=T+O.LOCATION_URL,i=e.defer(),a={locationid:n,gen:9,app_id:r.app_id,app_code:r.app_code};return t.get(o,{params:a}).success(function(e){i.resolve(e)}).error(function(e){i.reject(e)}),i.promise}function l(e){var t;switch(e){case o.MODULES.UI:t=f;break;case o.MODULES.EVENTS:t=m;break;default:throw new Error("Unknown module",e)}return t}function f(){if(!v(O.UI.src)){var e=n.createLinkTag({rel:"stylesheet",type:"text/css",href:g(O.UI.href)});e&&I.appendChild(e)}return h(O.UI.src)}function m(){return h(O.EVENTS)}function g(e){return[T,O.BASE,H.V,"/",H.SUB,"/",e].join("")}function h(t){var r,o,i=e.defer();return v(t)?i.resolve():(r=g(t),o=n.createScriptTag({src:r}),o&&I.appendChild(o),x[t].push(i),o.onload=k.bind(null,t),o.onerror=b.bind(null,t)),i.promise}function v(e){var t=null;switch(e){case O.CORE:t=E;break;case O.SERVICE:t=M;break;case O.UI.src:t=S;break;case O.EVENTS:t=w;break;default:t=function(){return!1}}return t()}function E(){return!!window.H}function M(){return!(!window.H||!window.H.service)}function S(){return!(!window.H||!window.H.ui)}function w(){return!(!window.H||!window.H.mapevents)}function k(e){for(var t=x[e],r=0,n=t.length;r<n;++r){t[r].resolve()}x[e]=[]}function b(e){for(var t=x[e],r=0,n=t.length;r<n;++r){t[r].reject()}x[e]=[]}var y=r.apiVersion,T=r.useHTTPS?"https":"http",H={V:parseInt(y),SUB:y},O={BASE:"://js.api.here.com/v",CORE:"mapsjs-core.js",SERVICE:"mapsjs-service.js",UI:{src:"mapsjs-ui.js",href:"mapsjs-ui.css"},EVENTS:"mapsjs-mapevents.js",AUTOCOMPLETE_URL:"://autocomplete.geocoder.cit.api.here.com/6.2/suggest.json",LOCATION_URL:"://geocoder.cit.api.here.com/6.2/geocode.json"},x={};x[O.CORE]=[],x[O.SERVICE]=[],x[O.UI.src]=[],x[O.PANO]=[],x[O.EVENTS]=[];var I=document.getElementsByTagName("head")[0];return{loadApi:i,loadModules:a,getPosition:s,geocodePosition:u,geocodeAddress:c,geocodeAutocomplete:p,findLocationById:d}}t.exports=n,n.$inject=["$q","$http","HereMapsConfig","HereMapsUtilsService","HereMapsCONSTS"]},{}],4:[function(e,t,r){t.exports={UPDATE_MAP_RESIZE_TIMEOUT:500,ANIMATION_ZOOM_STEP:.05,MODULES:{UI:"controls",EVENTS:"events",PANO:"pano"},DEFAULT_MAP_OPTIONS:{height:480,width:640,zoom:12,maxZoom:2,resize:!1,draggable:!1,coords:{longitude:0,latitude:0}},MARKER_TYPES:{DOM:"DOM",SVG:"SVG"},CONTROLS:{NAMES:{SCALE:"scalebar",SETTINGS:"mapsettings",ZOOM:"zoom",USER:"userposition"},POSITIONS:["top-right","top-center","top-left","left-top","left-middle","left-bottom","right-top","right-middle","right-bottom","bottom-right","bottom-center","bottom-left"]},INFOBUBBLE:{STATE:{OPEN:"open",CLOSED:"closed"},DISPLAY_EVENT:{pointermove:"onHover",tap:"onClick"}},USER_EVENTS:{tap:"click",pointermove:"mousemove",pointerleave:"mouseleave",pointerenter:"mouseenter",drag:"drag",dragstart:"dragstart",dragend:"dragend",mapviewchange:"mapviewchange",mapviewchangestart:"mapviewchangestart",mapviewchangeend:"mapviewchangeend"}}},{}],5:[function(e,t,r){function n(e,t,r,n){function o(e,t,r){this.map=e.map,this.listeners=r,this.inject=new t,this.events=e.events=new H.mapevents.MapEvents(this.map),this.behavior=e.behavior=new H.mapevents.Behavior(this.events),this.bubble=n.create(),this.setupEventListeners()}function i(){var n=this;e.addEventListener(this.map,"tap",this.infoBubbleHandler.bind(this)),e.addEventListener(this.map,"pointermove",this.infoBubbleHandler.bind(this)),e.addEventListener(this.map,"dragstart",function(e){t.isMarkerInstance(e.target)&&n.behavior.disable(),n.triggerUserListener(r.USER_EVENTS[e.type],e)}),e.addEventListener(this.map,"drag",function(e){var o=e.currentPointer,i=e.target;t.isMarkerInstance(i)&&i.setPosition(n.map.screenToGeo(o.viewportX,o.viewportY)),n.triggerUserListener(r.USER_EVENTS[e.type],e)}),e.addEventListener(this.map,"dragend",function(e){t.isMarkerInstance(e.target)&&n.behavior.enable(),n.triggerUserListener(r.USER_EVENTS[e.type],e)}),e.addEventListener(this.map,"mapviewchangestart",function(e){n.triggerUserListener(r.USER_EVENTS[e.type],e)}),e.addEventListener(this.map,"mapviewchange",function(e){n.triggerUserListener(r.USER_EVENTS[e.type],e)}),e.addEventListener(this.map,"mapviewchangeend",function(e){n.triggerUserListener(r.USER_EVENTS[e.type],e)})}function a(e){e&&(this.map.draggable=!!e.draggable)}function s(e,t){if(this.listeners){var r=this.listeners[e];r&&r(t)}}function u(e){var t=this.inject("ui");t&&this.bubble.toggle(e,t),this.triggerUserListener(r.USER_EVENTS[e.type],e)}var c=o.prototype;return c.setupEventListeners=i,c.setupOptions=a,c.triggerUserListener=s,c.infoBubbleHandler=u,{start:function(e){if(!(e.platform.map instanceof H.Map))return console.error("Missed required map instance");var t=new o(e.platform,e.injector,e.listeners);e.options&&t.setupOptions(e.options)}}}t.exports=n,n.$inject=["HereMapsUtilsService","HereMapsMarkerService","HereMapsCONSTS","HereMapsInfoBubbleFactory"]},{}],6:[function(e,t,r){function n(e,t,r){function n(){}function o(t,r){e.isMarkerInstance(t.target)?this.show(t,r):this.close(t,r)}function i(e,t){e.display=t.display,e.setPosition(t.position),e.setContent(t.markup),e.setState(r.INFOBUBBLE.STATE.OPEN)}function a(e){var n=new H.ui.InfoBubble(e.position,{content:e.markup});return n.display=e.display,n.addClass(r.INFOBUBBLE.STATE.OPEN),t.addEventListener(n,"statechange",function(e){var t=this.getState(),n=this.getElement();t===r.INFOBUBBLE.STATE.CLOSED?n.classList.remove(r.INFOBUBBLE.STATE.OPEN):this.addClass(t)}),n}function s(e,t,n){var o=e.target,n=o.getData();if(n&&n.display&&n.markup&&n.display===r.INFOBUBBLE.DISPLAY_EVENT[e.type]){var i={position:o.getPosition(),markup:n.markup,display:n.display};if(!t.bubble)return t.bubble=this.create(i),void t.addBubble(t.bubble);this.update(t.bubble,i)}}function u(e,t){t.bubble&&t.bubble.display===r.INFOBUBBLE.DISPLAY_EVENT[e.type]&&t.bubble.setState(r.INFOBUBBLE.STATE.CLOSED)}var c=n.prototype;return c.create=a,c.update=i,c.toggle=o,c.show=s,c.close=u,{create:function(){return new n}}}t.exports=n,n.$inject=["HereMapsMarkerService","HereMapsUtilsService","HereMapsCONSTS"]},{}],7:[function(e,t,r){angular.module("heremaps-events-module",[]).factory("HereMapsEventsFactory",e("./events/events.js")).factory("HereMapsInfoBubbleFactory",e("./events/infobubble.js")),angular.module("heremaps-ui-module",[]).factory("HereMapsUiFactory",e("./ui/ui.js")),t.exports=angular.module("heremaps-map-modules",["heremaps-events-module","heremaps-ui-module"])},{"./events/events.js":5,"./events/infobubble.js":6,"./ui/ui.js":8}],8:[function(e,t,r){function n(e,t,r,n){function o(e,t){this.map=e.map,this.layers=e.layers,this.alignment=t,this.ui=e.ui=H.ui.UI.createDefault(this.map,this.layers),this.setupControls()}function i(){var e=n.CONTROLS.NAMES,t=this.createUserControl();this.ui.getControl(e.SETTINGS).setIncidentsLayer(!1),this.ui.addControl(e.USER,t),this.setControlsAlignment(e)}function a(){var n=this,o=new H.ui.Control,i=new H.ui.base.Button({label:'<svg class="H_icon" fill="#fff" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path class="middle_location_stroke" d="M8 12c-2.206 0-4-1.795-4-4 0-2.206 1.794-4 4-4s4 1.794 4 4c0 2.205-1.794 4-4 4M8 1.25a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5"></path><path class="inner_location_stroke" d="M8 5a3 3 0 1 1 .001 6A3 3 0 0 1 8 5m0-1C5.794 4 4 5.794 4 8c0 2.205 1.794 4 4 4s4-1.795 4-4c0-2.206-1.794-4-4-4"></path><path class="outer_location_stroke" d="M8 1.25a6.75 6.75 0 1 1 0 13.5 6.75 6.75 0 0 1 0-13.5M8 0C3.59 0 0 3.59 0 8c0 4.411 3.59 8 8 8s8-3.589 8-8c0-4.41-3.59-8-8-8"></path></svg>',onStateChange:function(o){i.getState()!==H.ui.base.Button.State.DOWN&&e.getPosition().then(function(e){var o={lng:e.coords.longitude,lat:e.coords.latitude};if(n.map.setCenter(o),r.zoom(n.map,17,.08),n.userMarker)return void n.userMarker.setPosition(o);n.userMarker=t.addUserMarker(n.map,{pos:o})})}});return o.addChild(i),o}function s(e){if(o.isValidAlignment(this.alignment))for(var t in e){var r=this.ui.getControl(e[t]);e.hasOwnProperty(t)&&r&&r.setAlignment(this.alignment)}}function u(e){return!!(n.CONTROLS.POSITIONS.indexOf(e)+1)}o.isValidAlignment=u;var c=o.prototype;return c.setupControls=i,c.createUserControl=a,c.setControlsAlignment=s,{start:function(e){if(!(e.platform.map instanceof H.Map||e.platform.layers))return console.error("Missed ui module dependencies");new o(e.platform,e.alignment)}}}t.exports=n,n.$inject=["HereMapsAPIService","HereMapsMarkerService","HereMapsUtilsService","HereMapsCONSTS"]},{}],9:[function(e,t,r){t.exports=function(){var e={};this.$get=function(){return{app_id:e.app_id,app_code:e.app_code,apiVersion:e.apiVersion||"3.0",useHTTPS:e.useHTTPS,useCIT:!!e.useCIT,mapTileConfig:e.mapTileConfig}},this.setOptions=function(t){e=t}}},{}],10:[function(e,t,r){function n(e,t,r){function n(e,r){var n=null;return function(){t&&t.cancel(n),n=t(e,r)}}function o(e,t,r,n){e.addEventListener(t,r,!!n)}function i(e,t){return!(!e.$root||"$apply"===e.$root.$$phase||"$digest"===e.$root.$$phase)&&(e.$digest(t||angular.noop),!0)}function a(e){var t=document.getElementById(e.src);return!t&&(t=document.createElement("script"),t.type="text/javascript",t.id=e.src,f(t,e),t)}function s(e){var t=document.getElementById(e.href);return!t&&(t=document.createElement("link"),t.id=e.href,f(t,e),t)}function u(e){return e&&("string"==typeof e.latitude||"number"==typeof e.latitude)&&("string"==typeof e.longitude||"number"==typeof e.longitude)}function c(e,t,n){var o=e.getZoom(),i=(n||r.ANIMATION_ZOOM_STEP,o>=t?-1:1),a=n*i;return function r(){if(!n||Math.floor(o)===Math.floor(t))return void e.setZoom(t);o+=a,e.setZoom(o),requestAnimationFrame(r)}()}function p(){return H}function d(e,t){return H.geo.Rect.fromPoints(e,t,!0)}function l(){var e=/[xy]/g,t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(e,function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)})}function f(e,t){if(!e||!t)throw new Error("Missed attributes");for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}return{throttle:n,createScriptTag:a,createLinkTag:s,runScopeDigestIfNeed:i,isValidCoords:u,addEventListener:o,zoom:c,getBoundsRectFromPoints:d,generateId:l,getMapFactory:p}}t.exports=n,n.$inject=["$rootScope","$timeout","HereMapsCONSTS"]},{}],11:[function(e,t,r){function n(e){function t(e){this.place=e,this.setCoords()}function r(){var e=new H.map.Marker(this.coords);return this.addInfoBubble(e),e}var n=t.prototype=new e;return n.constructor=t,n.create=r,t}t.exports=n,n.$inject=["HereMapsMarkerInterface"]},{}],12:[function(e,t,r){function n(e){function t(e){this.place=e,this.setCoords()}function r(){var e=new H.map.DomMarker(this.coords,{icon:this.getIcon()});return this.addInfoBubble(e),e}function n(){var e=this.place.markup;if(!e)throw new Error("markup missed");return new H.map.DomIcon(e)}function o(e,t,r){var n=r?"removeEventListener":"addEventListener";for(var o in t)t.hasOwnProperty(o)&&e[n].call(null,o,t[o])}var i=t.prototype=new e;return i.constructor=t,i.create=r,i.getIcon=n,i.setupEvents=o,t}t.exports=n,n.$inject=["HereMapsMarkerInterface"]},{}],13:[function(e,t,r){t.exports=angular.module("heremaps-markers-module",[]).factory("HereMapsMarkerInterface",e("./marker.js")).factory("HereMapsDefaultMarker",e("./default.marker.js")).factory("HereMapsDOMMarker",e("./dom.marker.js")).factory("HereMapsSVGMarker",e("./svg.marker.js")).service("HereMapsMarkerService",e("./markers.service.js"))},{"./default.marker.js":11,"./dom.marker.js":12,"./marker.js":14,"./markers.service.js":15,"./svg.marker.js":16}],14:[function(e,t,r){t.exports=function(){function e(){throw new Error("Abstract class! The Instance should be created")}function t(){}function r(){throw new Error("create:: not implemented")}function n(){this.coords={lat:this.place.pos.lat,lng:this.place.pos.lng}}function o(e){this.place.popup&&e.setData(this.place.popup)}var i=e.prototype;return i.create=r,i.setCoords=n,i.addInfoBubble=o,t.prototype=i,t}},{}],15:[function(e,t,r){function n(e,t,r,n){function o(e){return e instanceof H.map.Marker||e instanceof H.map.DomMarker}function i(e,t){return e.userMarker?e.userMarker:(t.markup='<svg width="35px" height="35px" viewBox="0 0 90 90" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><circle id="path-1" cx="302" cy="802" r="15"></circle><mask id="mask-2" maskContentUnits="userSpaceOnUse" maskUnits="objectBoundingBox" x="-30" y="-30" width="90" height="90"><rect x="257" y="757" width="90" height="90" fill="white"></rect><use xlink:href="#path-1" fill="black"></use></mask></defs><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Service-Options---directions---map" transform="translate(-257.000000, -757.000000)"><g id="Oval-15"><use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-1"></use><use stroke-opacity="0.29613904" stroke="#3F34A0" mask="url(#mask-2)" stroke-width="60" xlink:href="#path-1"></use><use stroke="#3F34A0" stroke-width="5" xlink:href="#path-1"></use></g></g></g></svg>',e.userMarker=new r(t).create(),e.addObject(e.userMarker),e.userMarker)}function a(e,t,r){if(t&&t.length){if(!(e instanceof H.Map))throw new Error("Unsupported map instance");e.markersGroup||(e.markersGroup=new H.map.Group),t.forEach(function(t,r){var n=c(t),o=t.draggable?p(n.create()):n.create();e.markersGroup.addObject(o)}),e.addObject(e.markersGroup),r&&s(e,e.markersGroup.getBounds())}}function s(e,t,r){e.setViewBounds(t,!!r)}function u(e,t,r){e.markersGroup&&(e.markersGroup.removeAll(),e.removeObject(e.markersGroup),e.markersGroup=null),a.apply(null,arguments)}function c(n){var o;switch(n.type?n.type.toUpperCase():null){case d.DOM:o=t;break;case d.SVG:o=r;break;default:o=e}return new o(n)}function p(e){return e.draggable=!0,e}var d=n.MARKER_TYPES;return{addMarkersToMap:a,addUserMarker:i,updateMarkers:u,isMarkerInstance:o,setViewBounds:s}}t.exports=n,n.$inject=["HereMapsDefaultMarker","HereMapsDOMMarker","HereMapsSVGMarker","HereMapsCONSTS"]},{}],16:[function(e,t,r){function n(e){function t(e){this.place=e,this.setCoords()}function r(){var e=new H.map.Marker(this.coords,{icon:this.getIcon()});return this.addInfoBubble(e),e}function n(){var e=this.place.markup;if(!e)throw new Error("markup missed");return new H.map.Icon(e)}var o=t.prototype=new e;return o.constructor=t,o.create=r,o.getIcon=n,t}t.exports=n,n.$inject=["HereMapsMarkerInterface"]},{}],17:[function(e,t,r){t.exports=angular.module("heremaps-routes-module",[]).service("HereMapsRoutesService",e("./routes.service.js"))},{"./routes.service.js":18}],18:[function(e,t,r){function n(e,t){function r(t,r){var n=t.platform,o=(t.map,n.getRoutingService()),a=r.direction,s=a.waypoints,u="{{MODE}};{{VECHILE}}".replace(/{{MODE}}/,a.mode||"fastest").replace(/{{VECHILE}}/,r.driveType),c={mode:u,representation:a.representation||"display",language:a.language||"en-gb"};s.forEach(function(e,t){c["waypoint"+t]=[e.lat,e.lng].join(",")}),i(c,a.attrs);var p=e.defer();return o.calculateRoute(c,function(e){p.resolve(e)},function(e){p.reject(e)}),p.promise}function n(e){var t=e.routesGroup;t&&(t.removeAll(),e.removeObject(t),e.routesGroup=null)}function o(e,r,o){o&&n(e);var i=r.route;if(e&&i&&i.shape){var a=new H.geo.Strip,s=null;i.shape.forEach(function(e){var t=e.split(",");a.pushLatLngAlt(t[0],t[1])});var u=r.style||{};s=new H.map.Polyline(a,{style:{lineWidth:u.lineWidth||4,strokeColor:u.color||"rgba(0, 128, 255, 0.7)"}});var c=e.routesGroup;c||(c=e.routesGroup=new H.map.Group,e.addObject(c)),c.addObject(s),r.zoomToBounds&&t.setViewBounds(e,s.getBounds(),!0)}}function i(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r+"attributes"]=t[r])}return{calculateRoute:r,addRouteToMap:o,cleanRoutes:n}}t.exports=n,n.$inject=["$q","HereMapsMarkerService"]},{}]},{},[2]);