diff --git a/mappify-map.min.js b/mappify-map.min.js index 00a9817..f669b49 100644 --- a/mappify-map.min.js +++ b/mappify-map.min.js @@ -1 +1 @@ -!function(){"use strict";function e(e){function t(e,t){var o=e.split(":");if(2!==o.length)throw"icon could not be matched to existing options";var a=null;switch(o[0]){case"fa":a=n(o[1],t,"white");break;case"glyphicon":a=i(o[1],t,"white");break;default:a=r(e,t)}return a}function o(e){return L.AwesomeMarkers.icon({prefix:e.prefix,icon:e.icon,markerColor:e.markerColor,iconColor:e.iconColor})}function n(e,t,o){return L.AwesomeMarkers.icon({prefix:"fa",icon:e,markerColor:t,iconColor:o})}function i(e,t,o){return L.AwesomeMarkers.icon({prefix:"glyphicon",icon:e,markerColor:t,iconColor:o})}function r(t){if(!e.hasOwnProperty(t))throw'called icon "'+t+'" is not defined';var o=L.Icon.extend(e[t]);return new o}function a(e){void 0===e&&(e=["fa:home","fa:home"]),e=_.flatten([e]);var n=!1;return 1===e.length&&(e.push(e[0]),n=!0),e=e.map(function(e,i){var r=0===i?"blue":"red";return e instanceof Object?((!e.markerColor||1===i&&n)&&(e.markerColor=r),o(e)):t(e,r)}),{selected:e[1],unselected:e[0]}}return{generateMarker:a}}angular.module("mappify.markerGeneratorService",[]).value("mappifyDefaultMarkers",{"custom:leaflet":{options:{shadowUrl:"http://leafletjs.com/docs/images/leaf-shadow.png",iconUrl:"http://leafletjs.com/docs/images/leaf-green.png",iconSize:[38,95],shadowSize:[50,64],iconAnchor:[22,94],shadowAnchor:[4,62],popupAnchor:[-3,-76]}}}).factory("MarkerGeneratorService",e),e.$inject=["mappifyDefaultMarkers"]}(),function(){"use strict";function e(e){function t(e){if(!e.hasOwnProperty("type"))throw new Error("no type found ");return"point"!==e.type.toLowerCase(),"polygon"===e.type.toLowerCase()?L.polygon(e.coordinates):L.marker([e.latitude,e.longitude])}function o(e,t){return!1===t?c:void e.bindPopup(t)}function n(e,n,i){var r=t(n);o(r,i),r.addTo(e),r.on("click",function(){e.removeLayer(r)}),u[n.id]=r}function i(e,t){if(u.hasOwnProperty(t)){try{e.removeLayer(u[t]),console.log("removeAllElementsFromMap"+t)}catch(o){console.log(o),console.log(u[t])}delete u[t]}}function r(e){_.forOwn(u,function(t,o){i(e,o)})}function a(e,t,o){if(_.isEmpty(o))return!0;s(e);var n=new L.LayerGroup;n.addTo(e),p.addOverlay(n,o),l[t]=n}function s(e){null===p&&(p=new L.control.layers,p.addTo(e))}var c=this,u={},l={},p=null;return{addElementToMap:n,addLayer:a,removeElementFormMap:i,removeAllElementsFromMap:r}}angular.module("mappify.elementService",[]).factory("ElementService",e),e.$inject=["$rootScope"]}(),function(){"use strict";function e(e,t,o){function n(e,t,o){if(u(e),!t.hasOwnProperty("datasource"))throw new Error("no datasource defined");return _.isArray(t.datasource)?i(t.datasource,o):i([t.datasource],o)}function i(e,n){var i=_.map(e,function(e){var i=e.fetchData(n);return i=Promise.resolve(i).then(function(e){t.log("data was fetched"),e=s(e),o.removeAllElementsFromMap(c.map),_.forEach(e,function(e){o.addElementToMap(c.map,e)})})});return jassa.util.PromiseUtils.all(i)}function r(e){return _.map(e[0],function(e){return[e[1],e[0]]})}function a(e){var t={};if(e.hasOwnProperty("key")&&e.key.hasOwnProperty("uri")&&(t.id=e.key.uri),e.hasOwnProperty("val")&&e.val.hasOwnProperty("wkt")){var o=Terraformer.WKT.parse(e.val.wkt);return"Point"===o.type?(t.type="Point",t.latitude=o.coordinates[1],t.longitude=o.coordinates[0]):"Polygon"===o.type?(t.type="Polygon",t.coordinates=r(o.coordinates)):console.log(t),t}return[]}function s(e){t.debug("number elements in source:"+e.length);var o=[];return _.each(e,function(e){o.push(a(e))}),o}console.log(o);var c=this,u=function(e){c.map=e};return{fetchDataFormDataSources:n}}angular.module("mappify.dataService",["mappify.elementService"]).factory("DataService",e),e.$inject=["$timeout","$log","ElementService"]}(),function(){"use strict";function e(){function e(){var e={init:a,setZoom:c,arePopUpsEnabled:p,setViewCenter:s,events:r};return e.getView=function(){return{center:[t.latitude,t.longitude],zoom:o}},e}var t={latitude:51.339018,longitude:12.3797776},o=5,n=!0,i="mappify.",r={markerClicked:i+"markerClicked",selectedMarkerCollectionChanged:i+"selectedMarkerCollectionChanged"},a=function(e){return _.isObject(e)?(u(e),l(e),void f(e)):!0},s=function(e){_.isNumber(e.latitude)&&(t.latitude=e.latitude),_.isNumber(e.longitude)&&(t.longitude=e.longitude)},c=function(e){return _.isNumber(e)&&(o=e),this},u=function(e){e.zoom&&c(e.zoom)},l=function(e){e.viewCenter&&e.viewCenter.latitude&&e.viewCenter.longitude&&s({latitude:e.viewCenter.latitude,longitude:e.viewCenter.longitude})},p=function(){return n},f=function(e){if(e.popUp instanceof Object&&e.popUp.hasOwnProperty("enabled")){if(!_.isBoolean(e.popUp.enabled))throw"error: config.popUp.enabled must be from type boolean";n=e.popUp.enabled}},m={setZoom:c,setViewCenter:s};return m.$get=function(){return new e},m}angular.module("mappify.configurationProvider",[]).provider("mappifyConfiguration",e)}();var MappifyMap=MappifyMap||{};MappifyMap.helpers={isNotString:function(e){return"string"!=typeof e}},function(){"use strict";function e(e){return{restrict:"E",scope:!1,transclude:!0,require:"^mappify",link:{post:function(t,o,n,i){e.debug("mappifyMarker: post link"),i.setConceptIcon(n.concept,n.icon||"fa:home"),i.setPopUpTemplateUrl(n.concept,n.templateUrl),i.setLayer(n.concept,n.layer)}}}}angular.module("mappify.markerDirective",["mappify.ctrl","mappify.directive"]).directive("mappifyMarker",e),e.$inject=["$log"]}(),function(){"use strict";L.Map.BoxSelect=L.Handler.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(e){return!e.shiftKey||1!==e.which&&1!==e.button?!1:(L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(e),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),void L.DomEvent.preventDefault(e))},_onMouseMove:function(e){var t=this._map.mouseEventToLayerPoint(e),o=t.x-this._startLayerPoint.x,n=t.y-this._startLayerPoint.y,i=Math.min(t.x,this._startLayerPoint.x),r=Math.min(t.y,this._startLayerPoint.y),a=new L.Point(i,r);L.DomUtil.setPosition(this._box,a),this._box.style.width=Math.abs(o)-4+"px",this._box.style.height=Math.abs(n)-4+"px"},_onMouseUp:function(e){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var t=this._map.mouseEventToLayerPoint(e),o=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(t));this._map.fireEvent("boxSelect",o)}}),L.BoxSelect=function(e){return new L.Map.BoxSelect(e)}}(),function(){"use strict";L.Map.BoxDraw=L.Handler.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(e){return!e.shiftKey||1!==e.which&&1!==e.button?!1:(L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(e),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),void L.DomEvent.preventDefault(e))},_onMouseMove:function(e){var t=this._map.mouseEventToLayerPoint(e),o=t.x-this._startLayerPoint.x,n=t.y-this._startLayerPoint.y,i=Math.min(t.x,this._startLayerPoint.x),r=Math.min(t.y,this._startLayerPoint.y),a=new L.Point(i,r);L.DomUtil.setPosition(this._box,a),this._box.style.width=Math.abs(o)-4+"px",this._box.style.height=Math.abs(n)-4+"px"},_onMouseUp:function(e){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var t=this._map.mouseEventToLayerPoint(e),o=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(t));this._map.fireEvent("boxDrawn",o)}}),L.BoxDraw=function(e){return new L.Map.BoxDraw(e)}}(),function(){"use strict";function e(e,t,o){function n(e,t){t.setView(e.getView()),t.configTileLayer()}function i(e,t){e.config&&e.config.layers&&e.config.layers instanceof Array&&_.forEach(e.config.layers,function(e){r(e,t)})}function r(e,t){e.hasOwnProperty("concept")&&(e.hasOwnProperty("icon")?t.setConceptIcon(e.concept,e.icon):t.setConceptIcon(e.concept,"fa:home"),e.hasOwnProperty("template-url")&&t.setPopUpTemplateUrl(e.concept,e["template-url"]),t.setLayer(e.concept,e.layer))}function a(e,t){e.init(t)}function s(e,o){o=o||"mappify",t.debug(o+": "+e)}return{restrict:"E",scope:{config:"=",datasource:"=",latitude:"@",longitude:"@"},controller:"MappifyController",link:{pre:function(e,r,c,u){s("pre link"),a(o,e.config),i(e,u),n(o,u),e.$watch("config",function(){a(o,e.config),n(o,u),t.debug("config - changed")})},post:function(e,t,o,n){s("post link"),n.fetchDataFormDataSources(e)}}}}angular.module("mappify.directive",["mappify.configurationProvider","mappify.ctrl","mappify.jsonBoxDirective"]).directive("mappify",e),e.$inject=["$timeout","$log","mappifyConfiguration"]}(),function(){"use strict";function e(e,t,o,n,i,r,a,s,c,u,l){function p(e){$=e,a.debug("called - MappifyController::fetchDataFormDataSources"),Promise.resolve(D()).then(function(){var e=U.getMap().getBounds(),t=new jassa.geo.Bounds(e.getWest(),e.getSouth(),e.getEast(),e.getNorth()),o=l.fetchDataFormDataSources(O,$,t);return o},function(e){console.log(e)})}function f(e){a.debug("MappifyController: called setView"),a.debug(e),O.setView(e.center,e.zoom)}function m(){P();var e=new L.Google("ROADMAP");O.addLayer(e)}function d(){return O}function h(e){return u.removeMarkerFromMap(e)}function y(e,t){F[e]=t}function v(e,t){B.push(i.get(t).success(function(t){z[e]=t}).error(function(){throw'unable to load template from "'+t+'" for concept "'+e+'"'}))}function g(e,t){u.addLayer(O,e,t)}function w(e,t){z[e]=t}function M(){T="popup"===T?"select":"popup"}function D(){return o.all(B).then(function(){a.debug("templates: loaded")})}function P(){b()}function b(){if(null===O)throw"no map defined"}function k(){t(function(){n.$emit(c.events.selectedMarkerCollectionChanged,j)})}function x(){function e(e){console.log("You clicked the map at "+e.latlng.toString())}O.on("load",function(){t(function(){n.$emit("mappify.map.boundsChanged",O.getBounds())})}),O.on("moveend",function(){p($),t(function(){n.$emit("mappify.map.boundsChanged",O.getBounds())})}),O.on("toggleMode",function(){M()}),O.on("boxSelect",C),O.on("click",e)}function C(e){var t=new L.LatLngBounds(e._southWest,e._northEast);_.forEach(markerCollection,function(e,o){t.contains(e._latlng)&&E(e,o)}),k()}function E(e,t){var o=j.indexOf(t),n=A[t];return-1!==o?(j.splice(o,1),e.setIcon(n.unselected),!1):(j.push(t),e.setIcon(n.selected),!0)}function S(){O=L.map("map",{drawControl:!0}),x(),N.resolve(O)}var U=this;angular.extend(U,{configTileLayer:m,getMap:d,fetchDataFormDataSources:p,isReady:D,removeMarkerFromMap:h,setConceptIcon:y,setLayer:g,setPopUpTemplate:w,setPopUpTemplateUrl:v,setView:f,toggleMarkerMode:M});var T,$,O=null,B=[],j=[],A={},F={},z={},N=o.defer();angular.extend(U,{}),S()}angular.module("mappify.ctrl",["mappify.markerGeneratorService","mappify.configurationProvider","mappify.elementService","mappify.dataService"]).controller("MappifyController",e),e.$inject=["$scope","$timeout","$q","$rootScope","$http","$compile","$log","MarkerGeneratorService","mappifyConfiguration","ElementService","DataService"]}(),function(){"use strict";L.Control.ModeSelect=L.Control.extend({options:{position:"topleft"},onAdd:function(e){var t=L.DomUtil.create("div","leaflet-draw-toolbar leaflet-bar");L.DomEvent.addListener(t,"click",L.DomEvent.stopPropagation).addListener(t,"click",L.DomEvent.preventDefault).addListener(t,"click",function(){e.fireEvent("toggleMode")});var o=L.DomUtil.create("a","leaflet-draw-edit-remove",t);return o.title="select mode",o.href="#",t}})}(),function(){"use strict";function e(){return console.log("jsonBox:called"),{restrict:"A",require:"ngModel",link:function(e,t,o,n){function i(e){return console.log(JSON.parse(e)),JSON.parse(e)}function r(e){return JSON.stringify(e,null,4)}n.$parsers.push(i),n.$formatters.push(r)}}}angular.module("mappify.jsonBoxDirective",["mappify.directive"]).directive("jsonBox",e)}(),angular.module("mappify",["mappify.directive","mappify.markerDirective"]); \ No newline at end of file +!function(){"use strict";L.Map.BoxSelect=L.Handler.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(e){return!e.shiftKey||1!==e.which&&1!==e.button?!1:(L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(e),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),void L.DomEvent.preventDefault(e))},_onMouseMove:function(e){var t=this._map.mouseEventToLayerPoint(e),n=t.x-this._startLayerPoint.x,o=t.y-this._startLayerPoint.y,r=Math.min(t.x,this._startLayerPoint.x),i=Math.min(t.y,this._startLayerPoint.y),a=new L.Point(r,i);L.DomUtil.setPosition(this._box,a),this._box.style.width=Math.abs(n)-4+"px",this._box.style.height=Math.abs(o)-4+"px"},_onMouseUp:function(e){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var t=this._map.mouseEventToLayerPoint(e),n=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(t));this._map.fireEvent("boxSelect",n)}}),L.BoxSelect=function(e){return new L.Map.BoxSelect(e)}}(),function(){"use strict";L.Map.BoxDraw=L.Handler.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane},addHooks:function(){L.DomEvent.addListener(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){L.DomEvent.removeListener(this._container,"mousedown",this._onMouseDown)},_onMouseDown:function(e){return!e.shiftKey||1!==e.which&&1!==e.button?!1:(L.DomUtil.disableTextSelection(),this._startLayerPoint=this._map.mouseEventToLayerPoint(e),this._box=L.DomUtil.create("div","leaflet-zoom-box",this._pane),L.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",L.DomEvent.addListener(document,"mousemove",this._onMouseMove,this),L.DomEvent.addListener(document,"mouseup",this._onMouseUp,this),void L.DomEvent.preventDefault(e))},_onMouseMove:function(e){var t=this._map.mouseEventToLayerPoint(e),n=t.x-this._startLayerPoint.x,o=t.y-this._startLayerPoint.y,r=Math.min(t.x,this._startLayerPoint.x),i=Math.min(t.y,this._startLayerPoint.y),a=new L.Point(r,i);L.DomUtil.setPosition(this._box,a),this._box.style.width=Math.abs(n)-4+"px",this._box.style.height=Math.abs(o)-4+"px"},_onMouseUp:function(e){this._pane.removeChild(this._box),this._container.style.cursor="",L.DomUtil.enableTextSelection(),L.DomEvent.removeListener(document,"mousemove",this._onMouseMove),L.DomEvent.removeListener(document,"mouseup",this._onMouseUp);var t=this._map.mouseEventToLayerPoint(e),n=new L.LatLngBounds(this._map.layerPointToLatLng(this._startLayerPoint),this._map.layerPointToLatLng(t));this._map.fireEvent("boxDrawn",n)}}),L.BoxDraw=function(e){return new L.Map.BoxDraw(e)}}(),function(){"use strict";L.Control.ModeSelect=L.Control.extend({options:{position:"topleft"},onAdd:function(e){var t=L.DomUtil.create("div","leaflet-draw-toolbar leaflet-bar");L.DomEvent.addListener(t,"click",L.DomEvent.stopPropagation).addListener(t,"click",L.DomEvent.preventDefault).addListener(t,"click",function(){e.fireEvent("toggleMode")});var n=L.DomUtil.create("a","leaflet-draw-edit-remove",t);return n.title="select mode",n.href="#",t}})}(),function(){"use strict";function e(e){function t(e,t){var n=e.split(":");if(2!==n.length)throw"icon could not be matched to existing options";var a=null;switch(n[0]){case"fa":a=o(n[1],t,"white");break;case"glyphicon":a=r(n[1],t,"white");break;default:a=i(e,t)}return a}function n(e){return L.AwesomeMarkers.icon({prefix:e.prefix,icon:e.icon,markerColor:e.markerColor,iconColor:e.iconColor})}function o(e,t,n){return L.AwesomeMarkers.icon({prefix:"fa",icon:e,markerColor:t,iconColor:n})}function r(e,t,n){return L.AwesomeMarkers.icon({prefix:"glyphicon",icon:e,markerColor:t,iconColor:n})}function i(t){if(!e.hasOwnProperty(t))throw'called icon "'+t+'" is not defined';var n=L.Icon.extend(e[t]);return new n}function a(e){void 0===e&&(e=["fa:home","fa:home"]),e=_.flatten([e]);var o=!1;return 1===e.length&&(e.push(e[0]),o=!0),e=e.map(function(e,r){var i=0===r?"blue":"red";return e instanceof Object?((!e.markerColor||1===r&&o)&&(e.markerColor=i),n(e)):t(e,i)}),{selected:e[1],unselected:e[0]}}return{generateMarker:a}}angular.module("mappify.markerGeneratorService",[]).value("mappifyDefaultMarkers",{"custom:leaflet":{options:{shadowUrl:"http://leafletjs.com/docs/images/leaf-shadow.png",iconUrl:"http://leafletjs.com/docs/images/leaf-green.png",iconSize:[38,95],shadowSize:[50,64],iconAnchor:[22,94],shadowAnchor:[4,62],popupAnchor:[-3,-76]}}}).factory("MarkerGeneratorService",e),e.$inject=["mappifyDefaultMarkers"]}(),function(){"use strict";function e(e,t,n,o){function r(e,t){return!1===t?d:void e.bindPopup(t)}function i(e){if(!e.hasOwnProperty("type"))throw new Error("no type found ");var n=e.type.toLowerCase();switch(n){case"point":return c(e);case"polygon":return s(e);default:t.warn("dataSource contains the unsupported type ("+n.toString()+")")}return null}function a(){var e=[];return n.containsIconForUnSelectedMarker&&e.push(n.getIconForUnSelectedMarker()),n.containsIconForSelectedMarker&&e.push(n.getIconForSelectedMarker()),_.isEmpty(e)&&(e=void 0),o.generateMarker(e).unselected}function c(e){var t=L.marker([e.latitude,e.longitude]);return n.containsMarkerIcons&&t.setIcon(a()),t}function s(e){return L.polygon(e.coordinates)}function u(e,t,n){var o=i(t);null!==o&&(r(o,n),o.addTo(e),o.on("click",function(){e.removeLayer(o)}),h[t.id]=o)}function l(e,n){if(h.hasOwnProperty(n)){try{e.removeLayer(h[n]),t.info("removedElementFromMap"+n)}catch(o){console.log(o),console.log(h[n])}delete h[n]}}function p(e){_.forOwn(h,function(t,n){l(e,n)})}function f(e,t,n){if(_.isEmpty(n))return!0;m(e);var o=new L.LayerGroup;o.addTo(e),v.addOverlay(o,n),y[t]=o}function m(e){null===v&&(v=new L.control.layers,v.addTo(e))}var d=this,h={},y={},v=null;return{addElementToMap:u,addLayer:f,removeElementFormMap:l,removeAllElementsFromMap:p}}angular.module("mappify.elementService",["mappify.configurationProvider","mappify.markerGeneratorService"]).factory("ElementService",e),e.$inject=["$rootScope","$log","mappifyConfiguration","MarkerGeneratorService"]}(),function(){"use strict";function e(e,n){function o(e,t,n){return u(e),t.hasOwnProperty("datasource")?_.isArray(t.datasource)?r(t.datasource,n):r([t.datasource],n):null}function r(o,r){var i=_.map(o,function(o){var i=o.fetchData(r);return i=Promise.resolve(i).then(function(o){e.info(t+"data was fetched"),o=c(o),_.forEach(o,function(e){n.addElementToMap(s.map,e)})})});return jassa.util.PromiseUtils.all(i)}function i(e){return _.map(e[0],function(e){return[e[1],e[0]]})}function a(e){var t={};if(e.hasOwnProperty("key")&&e.key.hasOwnProperty("uri")&&(t.id=e.key.uri),e.hasOwnProperty("val")&&e.val.hasOwnProperty("wkt")){var n=Terraformer.WKT.parse(e.val.wkt);return"Point"===n.type?(t.type="Point",t.latitude=n.coordinates[1],t.longitude=n.coordinates[0]):"Polygon"===n.type?(t.type="Polygon",t.coordinates=i(n.coordinates)):console.log(t),t}return[]}function c(n){e.info(t+"number elements in source:"+n.length);var o=[];return _.each(n,function(e){o.push(a(e))}),o}var s=this,u=function(e){s.map=e};return{fetchDataFormDataSources:o}}angular.module("mappify.dataService",["mappify.elementService"]).factory("DataService",e);var t="dataService: ";e.$inject=["$log","ElementService"]}(),function(){"use strict";function e(){function e(){var e={init:a,setZoom:y,arePopUpsEnabled:L,setViewCenter:h,events:i,containsMarkerIcons:l,containsIconForSelectedMarker:f,containsIconForUnSelectedMarker:p,getIconForSelectedMarker:d,getIconForUnSelectedMarker:m};return e.getView=function(){return{center:[t.latitude,t.longitude],zoom:n}},e}var t={latitude:51.339018,longitude:12.3797776},n=5,o=!0,r="mappify.",i={markerClicked:r+"markerClicked",selectedMarkerCollectionChanged:r+"selectedMarkerCollectionChanged"},a=function(e){return _.isObject(e)?(v(e),g(e),M(e),void u(e)):!0},c={},s={},u=function(e){if(e.hasOwnProperty("marker")&&!_.isEmpty(e.marker)){var t=e.marker;t.hasOwnProperty("unselected")&&(c=e.marker.unselected),t.hasOwnProperty("selected")&&(s=e.marker.selected)}},l=function(){return!_.empty(c)||!_.empty(s)},p=function(){return!_.empty(c)},f=function(){return!_.empty(s)},m=function(){return c},d=function(){return s},h=function(e){_.isNumber(e.latitude)&&(t.latitude=e.latitude),_.isNumber(e.longitude)&&(t.longitude=e.longitude)},y=function(e){return _.isNumber(e)&&(n=e),this},v=function(e){e.zoom&&y(e.zoom)},g=function(e){e.viewCenter&&e.viewCenter.latitude&&e.viewCenter.longitude&&h({latitude:e.viewCenter.latitude,longitude:e.viewCenter.longitude})},L=function(){return o},M=function(e){if(e.popUp instanceof Object&&e.popUp.hasOwnProperty("enabled")){if(!_.isBoolean(e.popUp.enabled))throw"error: config.popUp.enabled must be from type boolean";o=e.popUp.enabled}},w={setZoom:y,setViewCenter:h};return w.$get=function(){return new e},w}angular.module("mappify.configurationProvider",[]).provider("mappifyConfiguration",e)}();var MappifyMap=MappifyMap||{};MappifyMap.helpers={isNotString:function(e){return"string"!=typeof e}},function(){"use strict";function e(e){return{restrict:"E",scope:!1,transclude:!0,require:"^mappify",link:{post:function(t,n,o,r){e.debug("mappifyMarker: post link"),r.setConceptIcon(o.concept,o.icon||"fa:home"),r.setPopUpTemplateUrl(o.concept,o.templateUrl),r.setLayer(o.concept,o.layer)}}}}angular.module("mappify.markerDirective",["mappify.ctrl","mappify.directive"]).directive("mappifyMarker",e),e.$inject=["$log"]}(),function(){"use strict";function e(e,n){function o(e,t){t.setView(e.getView()),t.configTileLayer()}function r(e,t){e.config&&e.config.layers&&e.config.layers instanceof Array&&_.forEach(e.config.layers,function(e){i(e,t)})}function i(e,t){e.hasOwnProperty("concept")&&(e.hasOwnProperty("icon")?t.setConceptIcon(e.concept,e.icon):t.setConceptIcon(e.concept,"fa:home"),e.hasOwnProperty("template-url")&&t.setPopUpTemplateUrl(e.concept,e["template-url"]),t.setLayer(e.concept,e.layer))}function a(e,t){e.init(t)}return{restrict:"E",scope:{config:"=",datasource:"=",latitude:"@",longitude:"@"},controller:"MappifyController",link:{pre:function(i,c,s,u){e.debug(t+"pre link"),a(n,i.config),r(i,u),o(n,u),i.$watch("config",function(){a(n,i.config),o(n,u),e.debug(t+"config changed")})},post:function(n,o,r,i){e.debug(t+"post link"),i.fetchDataFormDataSources(n)}}}}var t="mappify-directive:";angular.module("mappify.directive",["mappify.configurationProvider","mappify.ctrl","mappify.jsonBoxDirective"]).directive("mappify",e),e.$inject=["$log","mappifyConfiguration"]}(),function(){"use strict";function e(e,t,n,o,r,i,a,c,s,u,l){function p(e){T=e,Promise.resolve(k()).then(function(){var e=U.getMap().getBounds(),t=new jassa.geo.Bounds(e.getWest(),e.getSouth(),e.getEast(),e.getNorth());return l.fetchDataFormDataSources(O,T,t)},function(e){console.log(e)})}function f(e){a.debug("MappifyController: called setView"),O.setView(e.center,e.zoom)}function m(){P();var e=new L.Google("ROADMAP");O.addLayer(e)}function d(){return O}function h(e){return u.removeMarkerFromMap(e)}function y(e,t){F[e]=t}function v(e,t){B.push(r.get(t).success(function(t){A[e]=t}).error(function(){throw'unable to load template from "'+t+'" for concept "'+e+'"'}))}function g(e,t){u.addLayer(O,e,t)}function M(e,t){A[e]=t}function w(){$="popup"===$?"select":"popup"}function k(){return n.all(B).then(function(){a.debug("templates: loaded")})}function P(){D()}function D(){if(null===O)throw"no map defined"}function b(){t(function(){o.$emit(s.events.selectedMarkerCollectionChanged,I)})}function x(){O.on("load",function(){t(function(){o.$emit("mappify.map.boundsChanged",O.getBounds())})}),O.on("moveend",function(){p(T),t(function(){o.$emit("mappify.map.boundsChanged",O.getBounds())})}),O.on("toggleMode",function(){w()}),O.on("boxSelect",S)}function S(e){var t=new L.LatLngBounds(e._southWest,e._northEast);_.forEach(markerCollection,function(e,n){t.contains(e._latlng)&&E(e,n)}),b()}function E(e,t){var n=I.indexOf(t),o=j[t];return-1!==n?(I.splice(n,1),e.setIcon(o.unselected),!1):(I.push(t),e.setIcon(o.selected),!0)}function C(){O=L.map("map"),x(),z.resolve(O)}var U=this;angular.extend(U,{configTileLayer:m,getMap:d,fetchDataFormDataSources:p,isReady:k,removeMarkerFromMap:h,setConceptIcon:y,setLayer:g,setPopUpTemplate:M,setPopUpTemplateUrl:v,setView:f,toggleMarkerMode:w});var T,O=null,$="select",B=[],I=[],j={},F={},A={},z=n.defer();C()}angular.module("mappify.ctrl",["mappify.markerGeneratorService","mappify.configurationProvider","mappify.elementService","mappify.dataService"]).controller("MappifyController",e),e.$inject=["$scope","$timeout","$q","$rootScope","$http","$compile","$log","MarkerGeneratorService","mappifyConfiguration","ElementService","DataService"]}(),function(){"use strict";function e(){return console.log("jsonBox:called"),{restrict:"A",require:"ngModel",link:function(e,t,n,o){function r(e){return console.log(JSON.parse(e)),JSON.parse(e)}function i(e){return JSON.stringify(e,null,4)}o.$parsers.push(r),o.$formatters.push(i)}}}angular.module("mappify.jsonBoxDirective",["mappify.directive"]).directive("jsonBox",e)}(),angular.module("mappify",["mappify.directive","mappify.markerDirective"]);