diff --git a/Resources/Private/Build/JavaScript/GoogleMaps2.js b/Resources/Private/Build/JavaScript/GoogleMaps2.js index c2057b99..3523ca5b 100644 --- a/Resources/Private/Build/JavaScript/GoogleMaps2.js +++ b/Resources/Private/Build/JavaScript/GoogleMaps2.js @@ -667,15 +667,15 @@ function initMap () { // Pass in the objects to merge as arguments. // For a deep extend, set the first argument to `true`. - const extend = (...arguments) => { + const extend = (...args) => { let extended = {}; let deep = false; let i = 0; - let length = arguments.length; + let length = args.length; // Check for deep merge - if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') { - deep = arguments[0]; + if (Object.prototype.toString.call(args[0]) === '[object Boolean]') { + deep = args[0]; i++; } @@ -695,7 +695,7 @@ function initMap () { // Loop through each object and conduct a merge for ( ; i < length; i++ ) { - var obj = arguments[i]; + var obj = args[i]; merge(obj); } diff --git a/Resources/Private/Build/JavaScript/OpenStreetMap2.js b/Resources/Private/Build/JavaScript/OpenStreetMap2.js index 927ad40c..e16b5a31 100644 --- a/Resources/Private/Build/JavaScript/OpenStreetMap2.js +++ b/Resources/Private/Build/JavaScript/OpenStreetMap2.js @@ -551,15 +551,15 @@ document.querySelectorAll(".maps2").forEach((element) => { // Pass in the objects to merge as arguments. // For a deep extend, set the first argument to `true`. - const extend = (...arguments) => { + const extend = (...args) => { let extended = {}; let deep = false; let i = 0; - let length = arguments.length; + let length = args.length; // Check for deep merge - if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') { - deep = arguments[0]; + if (Object.prototype.toString.call(args[0]) === '[object Boolean]') { + deep = args[0]; i++; } @@ -579,7 +579,7 @@ document.querySelectorAll(".maps2").forEach((element) => { // Loop through each object and conduct a merge for ( ; i < length; i++ ) { - var obj = arguments[i]; + var obj = args[i]; merge(obj); } diff --git a/Resources/Public/JavaScript/GoogleMaps2.min.js b/Resources/Public/JavaScript/GoogleMaps2.min.js index c506f852..61c574cd 100644 --- a/Resources/Public/JavaScript/GoogleMaps2.min.js +++ b/Resources/Public/JavaScript/GoogleMaps2.min.js @@ -3,5 +3,5 @@ class GoogleMaps2{allMarkers=[];categorizedMarkers={};pointMarkers=[];bounds={}; - `,t}countObjectProperties=e=>{let t=0;for(var o in e)e.hasOwnProperty(o)&&t++;return t};createPointByCollectionType=(e,o)=>{let i,s=0;null!==this.poiCollections&&this.poiCollections.length&&this.poiCollections.forEach(t=>{switch(""===t.strokeColor&&(t.strokeColor=o.extConf.strokeColor),""===t.strokeOpacity&&(t.strokeOpacity=o.extConf.strokeOpacity),""===t.strokeWeight&&(t.strokeWeight=o.extConf.strokeWeight),""===t.fillColor&&(t.fillColor=o.extConf.fillColor),""===t.fillOpacity&&(t.fillOpacity=o.extConf.fillOpacity),i=null,t.collectionType){case"Point":i=this.createMarker(t,e,o);break;case"Area":i=this.createArea(t,o);break;case"Route":i=this.createRoute(t,o);break;case"Radius":i=this.createRadius(t,o)}if(null!==i){this.allMarkers.push({marker:i,poiCollection:t});for(let e=s=0;e{var i,s=new google.maps.Marker({position:new google.maps.LatLng(e.latitude,e.longitude),map:this.map});return s.setDraggable(this.editable),e.hasOwnProperty("markerIcon")&&""!==e.markerIcon&&(i={url:e.markerIcon,scaledSize:new google.maps.Size(e.markerIconWidth,e.markerIconHeight),anchor:new google.maps.Point(e.markerIconAnchorPosX,e.markerIconAnchorPosY)},s.setIcon(i)),this.pointMarkers.push(s),this.bounds.extend(s.position),this.editable?this.addEditListeners(t,s,e,o):this.addInfoWindow(s,e,o),s};createArea=(t,e)=>{var o,i=[];for(let e=0;e{var o,i=[];for(let e=0;e{var o=new google.maps.Circle(this.getCircleOptions(this.map,new google.maps.LatLng(e.latitude,e.longitude),e));return this.bounds.union(o.getBounds()),this.addInfoWindow(o,e,t),o};addInfoWindow=(t,o,i)=>{let s=this.infoWindow,r=this.map;google.maps.event.addListener(t,"click",e=>{fetch(i.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({poiCollection:o.uid})}).then(e=>e.json()).then(e=>{s.close(),s.setContent(e.content),"Point"===o.collectionType?(s.setPosition(null),s.open(r,t)):(s.setPosition(new google.maps.LatLng(o.latitude,o.longitude)),s.open(r))}).catch(e=>console.error("Error:",e))})};inList=(e,t)=>{return(","+e+",").search(t=","+t+",")};createMarkerByLatLng=(e,t)=>{e=new google.maps.Marker({position:new google.maps.LatLng(e,t),map:this.map});this.bounds.extend(e.position)};addEditListeners=(o,i,e,s)=>{google.maps.event.addListener(i,"dragend",()=>{var e=i.getPosition().lat().toFixed(6),t=i.getPosition().lng().toFixed(6);o.prevAll("input.latitude-"+s.contentRecord.uid).val(e),o.prevAll("input.longitude-"+s.contentRecord.uid).val(t)}),google.maps.event.addListener(this.map,"click",e=>{i.setPosition(e.latLng),o.prevAll("input.latitude-"+s.contentRecord.uid).val(e.latLng.lat().toFixed(6)),o.prevAll("input.longitude-"+s.contentRecord.uid).val(e.latLng.lng().toFixed(6))})}}let maps2GoogleMaps=[];function initMap(){document.querySelectorAll(".maps2").forEach(e=>{var t=void 0!==e.dataset.environment?e.dataset.environment:"{}",o=void 0!==e.dataset.override?e.dataset.override:"{}";const n=(...arguments)=>{let e={},t=!1,o=0;var i=arguments.length;for("[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],o++);o{if(13===e.keyCode)return!1}))} + `,t}countObjectProperties=e=>{let t=0;for(var o in e)e.hasOwnProperty(o)&&t++;return t};createPointByCollectionType=(e,o)=>{let i,s=0;null!==this.poiCollections&&this.poiCollections.length&&this.poiCollections.forEach(t=>{switch(""===t.strokeColor&&(t.strokeColor=o.extConf.strokeColor),""===t.strokeOpacity&&(t.strokeOpacity=o.extConf.strokeOpacity),""===t.strokeWeight&&(t.strokeWeight=o.extConf.strokeWeight),""===t.fillColor&&(t.fillColor=o.extConf.fillColor),""===t.fillOpacity&&(t.fillOpacity=o.extConf.fillOpacity),i=null,t.collectionType){case"Point":i=this.createMarker(t,e,o);break;case"Area":i=this.createArea(t,o);break;case"Route":i=this.createRoute(t,o);break;case"Radius":i=this.createRadius(t,o)}if(null!==i){this.allMarkers.push({marker:i,poiCollection:t});for(let e=s=0;e{var i,s=new google.maps.Marker({position:new google.maps.LatLng(e.latitude,e.longitude),map:this.map});return s.setDraggable(this.editable),e.hasOwnProperty("markerIcon")&&""!==e.markerIcon&&(i={url:e.markerIcon,scaledSize:new google.maps.Size(e.markerIconWidth,e.markerIconHeight),anchor:new google.maps.Point(e.markerIconAnchorPosX,e.markerIconAnchorPosY)},s.setIcon(i)),this.pointMarkers.push(s),this.bounds.extend(s.position),this.editable?this.addEditListeners(t,s,e,o):this.addInfoWindow(s,e,o),s};createArea=(t,e)=>{var o,i=[];for(let e=0;e{var o,i=[];for(let e=0;e{var o=new google.maps.Circle(this.getCircleOptions(this.map,new google.maps.LatLng(e.latitude,e.longitude),e));return this.bounds.union(o.getBounds()),this.addInfoWindow(o,e,t),o};addInfoWindow=(t,o,i)=>{let s=this.infoWindow,r=this.map;google.maps.event.addListener(t,"click",e=>{fetch(i.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({poiCollection:o.uid})}).then(e=>e.json()).then(e=>{s.close(),s.setContent(e.content),"Point"===o.collectionType?(s.setPosition(null),s.open(r,t)):(s.setPosition(new google.maps.LatLng(o.latitude,o.longitude)),s.open(r))}).catch(e=>console.error("Error:",e))})};inList=(e,t)=>{return(","+e+",").search(t=","+t+",")};createMarkerByLatLng=(e,t)=>{e=new google.maps.Marker({position:new google.maps.LatLng(e,t),map:this.map});this.bounds.extend(e.position)};addEditListeners=(o,i,e,s)=>{google.maps.event.addListener(i,"dragend",()=>{var e=i.getPosition().lat().toFixed(6),t=i.getPosition().lng().toFixed(6);o.prevAll("input.latitude-"+s.contentRecord.uid).val(e),o.prevAll("input.longitude-"+s.contentRecord.uid).val(t)}),google.maps.event.addListener(this.map,"click",e=>{i.setPosition(e.latLng),o.prevAll("input.latitude-"+s.contentRecord.uid).val(e.latLng.lat().toFixed(6)),o.prevAll("input.longitude-"+s.contentRecord.uid).val(e.latLng.lng().toFixed(6))})}}let maps2GoogleMaps=[];function initMap(){document.querySelectorAll(".maps2").forEach(e=>{var t=void 0!==e.dataset.environment?e.dataset.environment:"{}",o=void 0!==e.dataset.override?e.dataset.override:"{}";const l=(...e)=>{let t={},o=!1,i=0;var s=e.length;for("[object Boolean]"===Object.prototype.toString.call(e[0])&&(o=e[0],i++);i{if(13===e.keyCode)return!1}))} //# sourceMappingURL=GoogleMaps2.min.js.map diff --git a/Resources/Public/JavaScript/GoogleMaps2.min.js.map b/Resources/Public/JavaScript/GoogleMaps2.min.js.map index d1c9a29c..42264e57 100644 --- a/Resources/Public/JavaScript/GoogleMaps2.min.js.map +++ b/Resources/Public/JavaScript/GoogleMaps2.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["GoogleMaps2.js"],"names":["GoogleMaps2","allMarkers","categorizedMarkers","pointMarkers","bounds","infoWindow","poiCollections","editable","map","constructor","element","environment","lat","lng","this","google","maps","LatLngBounds","InfoWindow","JSON","parse","dataset","pois","classList","contains","setMapDimensions","settings","createMap","Number","latitude","longitude","createMarkerByLatLng","setCenter","LatLng","extConf","defaultLatitude","defaultLongitude","createPointByCollectionType","markerClusterer","enable","MarkerClusterer","imagePath","countObjectProperties","showSwitchableCategories","shouldFitBounds","fitBounds","getMapOptions","let","mapOptions","mapTypeId","zoom","parseInt","zoomControl","mapTypeControl","scaleControl","streetViewControl","fullscreenControl","fullScreenControl","scrollwheel","activateScrollWheel","styles","eval","MapTypeId","HYBRID","ROADMAP","SATELLITE","TERRAIN","getCircleOptions","centerPosition","poiCollection","center","radius","strokeColor","strokeOpacity","strokeWeight","fillColor","fillOpacity","getPolygonOptions","paths","getPolylineOptions","path","Map","canBeInterpretedAsNumber","value","isNaN","normalizeDimension","dimension","normalizedDimension","String","forceZoom","length","collectionType","style","height","mapHeight","width","mapWidth","groupCategories","categoryUid","groupedCategories","x","y","categories","uid","inList","hasOwnProperty","getCategoriesOfCheckboxesWithStatus","form","isChecked","querySelectorAll","forEach","checkbox","push","getMarkersToChangeVisibilityFor","markers","marker","allCategoriesOfMarker","categoriesOfCheckboxesWithStatus","i","markerCategoryHasCheckboxWithStatus","j","k","document","createElement","add","setAttribute","contentRecord","appendChild","getCheckbox","querySelector","insertAdjacentHTML","title","addEventListener","checked","setVisible","insertAdjacentElement","category","div","innerHTML","obj","count","key","createMarker","createArea","createRoute","createRadius","c","relatedCategories","icon","Marker","position","setDraggable","markerIcon","url","scaledSize","Size","markerIconWidth","markerIconHeight","anchor","Point","markerIconAnchorPosX","markerIconAnchorPosY","setIcon","extend","addEditListeners","addInfoWindow","latLng","mapPosition","area","Polygon","setMap","route","Polyline","circle","Circle","union","getBounds","event","addListener","fetch","ajaxUrl","method","headers","Content-Type","body","stringify","then","response","json","data","close","setContent","content","setPosition","open","catch","error","console","list","item","search","mapContainer","getPosition","toFixed","prevAll","val","maps2GoogleMaps","initMap","override","arguments","extended","deep","Object","prototype","toString","call","prop","address","places","Autocomplete","fields","keyCode"],"mappings":"MAAAA,YACAC,WAAA,GACAC,mBAAA,GACAC,aAAA,GACAC,OAAA,GACAC,WAAA,GACAC,eAAA,GACAC,SAAA,GACAC,IAAA,GAOAC,YAAAC,EAAAC,GAaA,IAEAC,EACAC,EAfAC,KAAAb,WAAA,GACAa,KAAAZ,mBAAA,GACAY,KAAAX,aAAA,GACAW,KAAAV,OAAA,IAAAW,OAAAC,KAAAC,aACAH,KAAAT,WAAA,IAAAU,OAAAC,KAAAE,WACAJ,KAAAR,eAAAa,KAAAC,MAAAV,EAAAW,QAAAC,MAAA,MAAA,EACAR,KAAAP,SAAAG,EAAAa,UAAAC,SAAA,YAAA,EAEAV,KAAAW,iBAAAf,EAAAC,EAAAe,QAAA,EAEAZ,KAAAa,UAAAjB,EAAAC,CAAA,EAEA,KAAA,IAAAG,KAAAR,gBAAA,OAAAQ,KAAAR,gBAEAM,EAAAgB,OAAAlB,EAAAW,QAAAQ,QAAA,EACAhB,EAAAe,OAAAlB,EAAAW,QAAAS,SAAA,EACAlB,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C,aAAAF,EAAA,CACAG,OAAA,CACA,WAEA,CAAA,EAEAH,EAAArF,iBAAA,UAAA6C,IACA,GAAA,KAAAA,EAAA4C,QAAA,MAAA,CAAA,CACA,CAAA,EAEA","file":"GoogleMaps2.min.js","sourcesContent":["class GoogleMaps2 {\n allMarkers = [];\n categorizedMarkers = {};\n pointMarkers = [];\n bounds = {};\n infoWindow = {};\n poiCollections = {};\n editable = {};\n map = {};\n\n /**\n * @param {HTMLElement} element\n * @param {Environment} environment\n * @constructor\n */\n constructor (element, environment) {\n this.allMarkers = [];\n this.categorizedMarkers = {};\n this.pointMarkers = [];\n this.bounds = new google.maps.LatLngBounds();\n this.infoWindow = new google.maps.InfoWindow();\n this.poiCollections = JSON.parse(element.dataset.pois || \"null\");\n this.editable = element.classList.contains('editMarker');\n\n this.setMapDimensions(element, environment.settings);\n\n this.createMap(element, environment);\n\n if (typeof this.poiCollections === 'undefined' || this.poiCollections === null) {\n // Plugin: CityMap\n let lat = Number(element.dataset.latitude);\n let lng = Number(element.dataset.longitude);\n if (lat && lng) {\n this.createMarkerByLatLng(lat, lng);\n this.map.setCenter(new google.maps.LatLng(lat, lng));\n } else {\n // Fallback\n this.map.setCenter(new google.maps.LatLng(environment.extConf.defaultLatitude, environment.extConf.defaultLongitude));\n }\n } else {\n // normal case\n this.createPointByCollectionType(element, environment);\n if (\n typeof environment.settings.markerClusterer !== 'undefined'\n && environment.settings.markerClusterer.enable === 1\n ) {\n new MarkerClusterer(\n this.map,\n this.pointMarkers,\n { imagePath: environment.settings.markerClusterer.imagePath }\n );\n }\n\n if (this.countObjectProperties(this.categorizedMarkers) > 1) {\n this.showSwitchableCategories(element, environment);\n }\n\n if (this.shouldFitBounds(environment.settings)) {\n this.map.fitBounds(this.bounds);\n } else {\n this.map.setCenter(new google.maps.LatLng(this.poiCollections[0].latitude, this.poiCollections[0].longitude));\n }\n }\n }\n\n /**\n * Return a MapOptions object which can be assigned to the Map object of Google\n *\n * @param {Settings} settings\n * @return {object}\n */\n getMapOptions = settings => {\n let mapOptions = {\n mapTypeId: '',\n zoom: parseInt(settings.zoom),\n zoomControl: (parseInt(settings.zoomControl) !== 0),\n mapTypeControl: (parseInt(settings.mapTypeControl) !== 0),\n scaleControl: (parseInt(settings.scaleControl) !== 0),\n streetViewControl: (parseInt(settings.streetViewControl) !== 0),\n fullscreenControl: (parseInt(settings.fullScreenControl) !== 0),\n scrollwheel: settings.activateScrollWheel,\n styles: ''\n };\n\n if (settings.styles) {\n mapOptions.styles = eval(settings.styles);\n }\n\n switch (settings.mapTypeId) {\n case 'google.maps.MapTypeId.HYBRID':\n case 'hybrid':\n mapOptions.mapTypeId = google.maps.MapTypeId.HYBRID;\n break;\n case 'google.maps.MapTypeId.ROADMAP':\n case 'roadmap':\n mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP;\n break;\n case 'google.maps.MapTypeId.SATELLITE':\n case 'satellite':\n mapOptions.mapTypeId = google.maps.MapTypeId.SATELLITE;\n break;\n case 'google.maps.MapTypeId.TERRAIN':\n case 'terrain':\n mapOptions.mapTypeId = google.maps.MapTypeId.TERRAIN;\n break;\n }\n\n return mapOptions;\n }\n\n /**\n * Returns CircleOptions which can be assigned to the Circle object of Google\n *\n * @param {L.Map} map\n * @param {object} centerPosition\n * @param {PoiCollection} poiCollection\n * @return {object}\n */\n getCircleOptions (map, centerPosition, poiCollection) {\n return {\n map: map,\n center: centerPosition,\n radius: poiCollection.radius,\n strokeColor: poiCollection.strokeColor,\n strokeOpacity: poiCollection.strokeOpacity,\n strokeWeight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n };\n }\n\n /**\n * Returns PolygonOptions which can be assigned to the Polygon object of Google\n *\n * @param {object} paths\n * @param {PoiCollection} poiCollection\n * @return {object}\n */\n getPolygonOptions (paths, poiCollection) {\n return {\n paths: paths,\n strokeColor: poiCollection.strokeColor,\n strokeOpacity: poiCollection.strokeOpacity,\n strokeWeight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n };\n }\n\n /**\n * Return PolylineOptions which can be assigned to the Polyline object of Google\n *\n * @param {object} paths\n * @param {PoiCollection} poiCollection\n * @return {object}\n */\n getPolylineOptions (paths, poiCollection) {\n return {\n path: paths,\n strokeColor: poiCollection.strokeColor,\n strokeOpacity: poiCollection.strokeOpacity,\n strokeWeight: poiCollection.strokeWeight,\n };\n }\n\n /**\n * Create Map\n *\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n createMap (element, environment) {\n this.map = new google.maps.Map(\n element,\n this.getMapOptions(environment.settings)\n );\n }\n\n /**\n * @param {string | number} value\n * @return {boolean}\n */\n canBeInterpretedAsNumber(value) {\n return typeof value === 'number' || !isNaN(Number(value));\n }\n\n /**\n * @param {string | number} dimension\n * @returns {string}\n */\n normalizeDimension(dimension) {\n let normalizedDimension = String(dimension);\n\n if (this.canBeInterpretedAsNumber(normalizedDimension)) {\n normalizedDimension += 'px';\n }\n\n return normalizedDimension;\n }\n\n /**\n * @param {Settings} settings\n * @returns {boolean}\n */\n shouldFitBounds(settings) {\n if (settings.forceZoom === true) {\n return false;\n }\n\n if (this.poiCollections === null) {\n return false;\n }\n\n if (this.poiCollections.length > 1) {\n return true;\n }\n\n if (\n this.poiCollections.length === 1\n && (\n this.poiCollections[0].collectionType === \"Area\"\n || this.poiCollections[0].collectionType === \"Route\"\n )\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * @param {HTMLElement} element\n * @param {Settings} settings\n */\n setMapDimensions(element, settings) {\n element.style.height = this.normalizeDimension(settings.mapHeight);\n element.style.width = this.normalizeDimension(settings.mapWidth);\n }\n\n /**\n * Group Categories\n *\n * @param {Environment} environment\n */\n groupCategories = environment => {\n let groupedCategories = {};\n let categoryUid = \"0\";\n for (let x = 0; x < this.poiCollections.length; x++) {\n for (let y = 0; y < this.poiCollections[x].categories.length; y++) {\n categoryUid = String(this.poiCollections[x].categories[y].uid);\n if (this.inList(environment.settings.categories, categoryUid) > -1 && !groupedCategories.hasOwnProperty(categoryUid)) {\n groupedCategories[categoryUid] = this.poiCollections[x].categories[y];\n }\n }\n }\n\n return groupedCategories;\n };\n\n /**\n * Get categories of all checkboxes with a given status\n *\n * @param {HTMLElement} form The HTML form element containing the checkboxes\n * @param {boolean} isChecked Get checkboxes of this status only\n */\n getCategoriesOfCheckboxesWithStatus = (form, isChecked) => {\n let categories = [];\n let checkboxes = isChecked ? form.querySelectorAll(\"input:checked\") : form.querySelectorAll(\"input:not(input:checked)\");\n\n checkboxes.forEach(checkbox => {\n categories.push(parseInt(checkbox.value));\n });\n\n return categories;\n }\n\n getMarkersToChangeVisibilityFor = (categoryUid, form, isChecked) => {\n let markers = [];\n if (this.allMarkers.length === 0) {\n return markers;\n }\n\n let marker = null;\n let allCategoriesOfMarker = null;\n let categoriesOfCheckboxesWithStatus = this.getCategoriesOfCheckboxesWithStatus(form, isChecked);\n for (let i = 0; i < this.allMarkers.length; i++) {\n marker = this.allMarkers[i];\n allCategoriesOfMarker = marker.poiCollection.categories;\n if (allCategoriesOfMarker.length === 0) {\n continue;\n }\n\n let markerCategoryHasCheckboxWithStatus;\n for (let j = 0; j < allCategoriesOfMarker.length; j++) {\n markerCategoryHasCheckboxWithStatus = false;\n for (let k = 0; k < categoriesOfCheckboxesWithStatus.length; k++) {\n if (allCategoriesOfMarker[j].uid === categoriesOfCheckboxesWithStatus[k]) {\n markerCategoryHasCheckboxWithStatus = true;\n }\n }\n if (markerCategoryHasCheckboxWithStatus === isChecked) {\n break;\n }\n }\n\n if (markerCategoryHasCheckboxWithStatus) {\n markers.push(marker.marker);\n }\n }\n\n return markers;\n }\n\n /**\n * Show switchable categories\n *\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n showSwitchableCategories = (element, environment) => {\n let categories = this.groupCategories(environment);\n let form = document.createElement(\"form\");\n let span = {};\n\n form.classList.add(\"txMaps2Form\");\n form.setAttribute(\"id\", \"txMaps2Form-\" + environment.contentRecord.uid);\n\n // Add checkbox for category\n for (let categoryUid in categories) {\n if (categories.hasOwnProperty(categoryUid)) {\n form.appendChild(this.getCheckbox(categories[categoryUid]));\n form.querySelector(\"#checkCategory_\" + categoryUid)?.insertAdjacentHTML(\n \"afterend\",\n `${categories[categoryUid].title}`\n );\n }\n }\n\n // Add listener for checkboxes\n form.querySelectorAll(\"input\").forEach((checkbox) => {\n checkbox.addEventListener(\"click\", () => {\n let isChecked = (checkbox).checked;\n let categoryUid = (checkbox).value;\n let markers = this.getMarkersToChangeVisibilityFor(categoryUid, form, isChecked);\n\n markers.forEach((marker) => {\n marker.setVisible(isChecked);\n });\n });\n });\n\n element.insertAdjacentElement(\"afterend\", form);\n }\n\n /**\n * Get Checkbox for Category\n *\n * @param category\n */\n getCheckbox(category) {\n let div = document.createElement(\"div\");\n div.classList.add(\"form-group\");\n div.innerHTML = `\n
\n \n
`;\n\n return div;\n }\n\n /**\n * Count Object properties\n *\n * @param obj\n */\n countObjectProperties = obj => {\n let count = 0;\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n count++;\n }\n }\n return count;\n }\n\n /**\n * Create Point by CollectionType\n *\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n createPointByCollectionType = (element, environment) => {\n let marker;\n let categoryUid = 0;\n\n if (this.poiCollections !== null && this.poiCollections.length) {\n this.poiCollections.forEach(poiCollection => {\n if (poiCollection.strokeColor === \"\") {\n poiCollection.strokeColor = environment.extConf.strokeColor;\n }\n if (poiCollection.strokeOpacity === \"\") {\n poiCollection.strokeOpacity = environment.extConf.strokeOpacity;\n }\n if (poiCollection.strokeWeight === \"\") {\n poiCollection.strokeWeight = environment.extConf.strokeWeight;\n }\n if (poiCollection.fillColor === \"\") {\n poiCollection.fillColor = environment.extConf.fillColor;\n }\n if (poiCollection.fillOpacity === \"\") {\n poiCollection.fillOpacity = environment.extConf.fillOpacity;\n }\n\n marker = null;\n switch (poiCollection.collectionType) {\n case \"Point\":\n marker = this.createMarker(poiCollection, element, environment);\n break;\n case \"Area\":\n marker = this.createArea(poiCollection, environment);\n break;\n case \"Route\":\n marker = this.createRoute(poiCollection, environment);\n break;\n case \"Radius\":\n marker = this.createRadius(poiCollection, environment);\n break;\n }\n\n if (marker !== null) {\n this.allMarkers.push({\n marker: marker,\n poiCollection: poiCollection\n });\n\n categoryUid = 0;\n for (let c = 0; c < poiCollection.categories.length; c++) {\n categoryUid = poiCollection.categories[c].uid;\n if (!this.categorizedMarkers.hasOwnProperty(categoryUid)) {\n this.categorizedMarkers[categoryUid] = [];\n }\n this.categorizedMarkers[categoryUid].push({\n marker: marker,\n relatedCategories: poiCollection.categories\n });\n }\n }\n });\n }\n }\n\n /**\n * Create Marker with InfoWindow\n *\n * @param {PoiCollection} poiCollection\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n createMarker = (poiCollection, element, environment) => {\n let categoryUid = \"0\";\n let marker = new google.maps.Marker({\n position: new google.maps.LatLng(poiCollection.latitude, poiCollection.longitude),\n map: this.map\n });\n marker.setDraggable(this.editable);\n\n // assign first found marker icon, if available\n if (poiCollection.hasOwnProperty(\"markerIcon\") && poiCollection.markerIcon !== \"\") {\n let icon = {\n url: poiCollection.markerIcon,\n scaledSize: new google.maps.Size(poiCollection.markerIconWidth, poiCollection.markerIconHeight),\n anchor: new google.maps.Point(poiCollection.markerIconAnchorPosX, poiCollection.markerIconAnchorPosY)\n };\n marker.setIcon(icon);\n }\n\n this.pointMarkers.push(marker);\n this.bounds.extend(marker.position);\n\n if (this.editable) {\n this.addEditListeners(element, marker, poiCollection, environment);\n } else {\n this.addInfoWindow(marker, poiCollection, environment);\n }\n\n return marker;\n }\n\n /**\n * Create Area\n *\n * @param poiCollection\n * @param environment\n */\n createArea = (poiCollection, environment) => {\n let latLng;\n let paths = [];\n for (let i = 0; i < poiCollection.pois.length; i++) {\n latLng = new google.maps.LatLng(poiCollection.pois[i].latitude, poiCollection.pois[i].longitude);\n this.bounds.extend(latLng);\n paths.push(latLng);\n }\n\n if (paths.length === 0) {\n paths.push(this.mapPosition);\n }\n\n let area = new google.maps.Polygon(this.getPolygonOptions(paths, poiCollection));\n area.setMap(this.map);\n this.addInfoWindow(area, poiCollection, environment);\n\n return area;\n }\n\n /**\n * Create Route\n *\n * @param poiCollection\n * @param environment\n */\n createRoute = (poiCollection, environment) => {\n let latLng;\n let paths = [];\n for (let i = 0; i < poiCollection.pois.length; i++) {\n latLng = new google.maps.LatLng(poiCollection.pois[i].latitude, poiCollection.pois[i].longitude);\n this.bounds.extend(latLng);\n paths.push(latLng);\n }\n\n if (paths.length === 0) {\n paths.push(this.mapPosition);\n }\n\n let route = new google.maps.Polyline(this.getPolylineOptions(paths, poiCollection));\n route.setMap(this.map);\n this.addInfoWindow(route, poiCollection, environment);\n\n return route;\n }\n\n /**\n * Create Radius\n *\n * @param poiCollection\n * @param environment\n */\n createRadius = (poiCollection, environment) => {\n let circle = new google.maps.Circle(\n this.getCircleOptions(\n this.map,\n new google.maps.LatLng(poiCollection.latitude, poiCollection.longitude),\n poiCollection\n )\n );\n\n this.bounds.union(circle.getBounds());\n this.addInfoWindow(circle, poiCollection, environment);\n\n return circle;\n }\n\n /**\n * Add Info Window to element\n *\n * @param element\n * @param poiCollection\n * @param environment\n */\n addInfoWindow = (element, poiCollection, environment) => {\n // we need these both vars to be set global. So that we can access them in Listener\n let infoWindow = this.infoWindow;\n let map = this.map;\n google.maps.event.addListener(element, \"click\", event => {\n fetch(environment.ajaxUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n poiCollection: poiCollection.uid\n })\n })\n .then(response => response.json())\n .then(data => {\n infoWindow.close();\n infoWindow.setContent(data.content);\n\n // Do not set pointer of InfoWindow to the same pointer of the POI icon.\n // In case of Point the pointer of InfoWindow should be at mouse position.\n if (poiCollection.collectionType === \"Point\") {\n infoWindow.setPosition(null);\n infoWindow.open(map, element);\n } else {\n infoWindow.setPosition(new google.maps.LatLng(poiCollection.latitude, poiCollection.longitude));\n infoWindow.open(map);\n }\n })\n .catch(error => console.error('Error:', error));\n });\n }\n\n /**\n * Check for item in list\n * Check if an item exists in a comma-separated list of items.\n *\n * @param list\n * @param item\n */\n inList = (list, item) => {\n let catSearch = ',' + list + ',';\n item = ',' + item + ',';\n return catSearch.search(item);\n };\n\n /**\n * Create Marker with InfoWindow\n *\n * @param latitude\n * @param longitude\n */\n createMarkerByLatLng = (latitude, longitude) => {\n let marker = new google.maps.Marker({\n position: new google.maps.LatLng(latitude, longitude),\n map: this.map\n });\n this.bounds.extend(marker.position);\n };\n\n /**\n * Add Edit Listeners\n * This will only work for Markers (Point)\n *\n * @param mapContainer\n * @param marker\n * @param poiCollection\n * @param environment\n */\n addEditListeners = (mapContainer, marker, poiCollection, environment) => {\n // update fields and marker while dragging\n google.maps.event.addListener(marker, 'dragend', () => {\n let lat = marker.getPosition().lat().toFixed(6);\n let lng = marker.getPosition().lng().toFixed(6);\n mapContainer.prevAll(\"input.latitude-\" + environment.contentRecord.uid).val(lat);\n mapContainer.prevAll(\"input.longitude-\" + environment.contentRecord.uid).val(lng);\n });\n\n // update fields and marker when clicking on the map\n google.maps.event.addListener(this.map, 'click', event => {\n marker.setPosition(event.latLng);\n mapContainer.prevAll(\"input.latitude-\" + environment.contentRecord.uid).val(event.latLng.lat().toFixed(6));\n mapContainer.prevAll(\"input.longitude-\" + environment.contentRecord.uid).val(event.latLng.lng().toFixed(6));\n });\n };\n}\n\nlet maps2GoogleMaps = [];\n\n/**\n * This function will be called by the &callback argument of the Google Maps API library\n */\nfunction initMap () {\n document.querySelectorAll(\".maps2\").forEach(element => {\n const environment = typeof element.dataset.environment !== 'undefined' ? element.dataset.environment : '{}';\n const override = typeof element.dataset.override !== 'undefined' ? element.dataset.override : '{}';\n\n // Pass in the objects to merge as arguments.\n // For a deep extend, set the first argument to `true`.\n const extend = (...arguments) => {\n let extended = {};\n let deep = false;\n let i = 0;\n let length = arguments.length;\n\n // Check for deep merge\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\n deep = arguments[0];\n i++;\n }\n\n // Merge the object into the extended object\n const merge = function (obj) {\n for ( var prop in obj ) {\n if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {\n // If deep merge and property is an object, merge properties\n if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {\n extended[prop] = extend( true, extended[prop], obj[prop] );\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for ( ; i < length; i++ ) {\n var obj = arguments[i];\n merge(obj);\n }\n\n return extended;\n };\n\n maps2GoogleMaps.push(new GoogleMaps2(\n element,\n extend(JSON.parse(environment), JSON.parse(override))\n ));\n });\n\n // Initialize radius search\n let address = document.querySelector('#maps2Address');\n let radius = document.querySelector('#maps2Radius');\n if (address !== null && radius !== null) {\n let autocomplete = new google.maps.places.Autocomplete(address, {\n fields: [\n \"place_id\"\n ]\n });\n\n address.addEventListener(\"keydown\", event => {\n if (event.keyCode === 13) return false;\n });\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["GoogleMaps2.js"],"names":["GoogleMaps2","allMarkers","categorizedMarkers","pointMarkers","bounds","infoWindow","poiCollections","editable","map","constructor","element","environment","lat","lng","this","google","maps","LatLngBounds","InfoWindow","JSON","parse","dataset","pois","classList","contains","setMapDimensions","settings","createMap","Number","latitude","longitude","createMarkerByLatLng","setCenter","LatLng","extConf","defaultLatitude","defaultLongitude","createPointByCollectionType","markerClusterer","enable","MarkerClusterer","imagePath","countObjectProperties","showSwitchableCategories","shouldFitBounds","fitBounds","getMapOptions","let","mapOptions","mapTypeId","zoom","parseInt","zoomControl","mapTypeControl","scaleControl","streetViewControl","fullscreenControl","fullScreenControl","scrollwheel","activateScrollWheel","styles","eval","MapTypeId","HYBRID","ROADMAP","SATELLITE","TERRAIN","getCircleOptions","centerPosition","poiCollection","center","radius","strokeColor","strokeOpacity","strokeWeight","fillColor","fillOpacity","getPolygonOptions","paths","getPolylineOptions","path","Map","canBeInterpretedAsNumber","value","isNaN","normalizeDimension","dimension","normalizedDimension","String","forceZoom","length","collectionType","style","height","mapHeight","width","mapWidth","groupCategories","categoryUid","groupedCategories","x","y","categories","uid","inList","hasOwnProperty","getCategoriesOfCheckboxesWithStatus","form","isChecked","querySelectorAll","forEach","checkbox","push","getMarkersToChangeVisibilityFor","markers","marker","allCategoriesOfMarker","categoriesOfCheckboxesWithStatus","i","markerCategoryHasCheckboxWithStatus","j","k","document","createElement","add","setAttribute","contentRecord","appendChild","getCheckbox","querySelector","insertAdjacentHTML","title","addEventListener","checked","setVisible","insertAdjacentElement","category","div","innerHTML","obj","count","key","createMarker","createArea","createRoute","createRadius","c","relatedCategories","icon","Marker","position","setDraggable","markerIcon","url","scaledSize","Size","markerIconWidth","markerIconHeight","anchor","Point","markerIconAnchorPosX","markerIconAnchorPosY","setIcon","extend","addEditListeners","addInfoWindow","latLng","mapPosition","area","Polygon","setMap","route","Polyline","circle","Circle","union","getBounds","event","addListener","fetch","ajaxUrl","method","headers","Content-Type","body","stringify","then","response","json","data","close","setContent","content","setPosition","open","catch","error","console","list","item","search","mapContainer","getPosition","toFixed","prevAll","val","maps2GoogleMaps","initMap","override","args","extended","deep","Object","prototype","toString","call","prop","address","places","Autocomplete","fields","keyCode"],"mappings":"MAAAA,YACAC,WAAA,GACAC,mBAAA,GACAC,aAAA,GACAC,OAAA,GACAC,WAAA,GACAC,eAAA,GACAC,SAAA,GACAC,IAAA,GAOAC,YAAAC,EAAAC,GAaA,IAEAC,EACAC,EAfAC,KAAAb,WAAA,GACAa,KAAAZ,mBAAA,GACAY,KAAAX,aAAA,GACAW,KAAAV,OAAA,IAAAW,OAAAC,KAAAC,aACAH,KAAAT,WAAA,IAAAU,OAAAC,KAAAE,WACAJ,KAAAR,eAAAa,KAAAC,MAAAV,EAAAW,QAAAC,MAAA,MAAA,EACAR,KAAAP,SAAAG,EAAAa,UAAAC,SAAA,YAAA,EAEAV,KAAAW,iBAAAf,EAAAC,EAAAe,QAAA,EA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AA4L,CAAA,CAAA,CACA,CAAA,CACA,CAAA,EAGAjK,IAAA0K,EAAA/F,SAAAO,cAAA,eAAA,EACA1D,EAAAmD,SAAAO,cAAA,cAAA,EACA,OAAAwF,GAAA,OAAAlJ,IACA,IAAAxD,OAAAC,KAAA0M,OAAAC,aAAAF,EAAA,CACAG,OAAA,CACA,WAEA,CAAA,EAEAH,EAAArF,iBAAA,UAAA6C,IACA,GAAA,KAAAA,EAAA4C,QAAA,MAAA,CAAA,CACA,CAAA,EAEA","file":"GoogleMaps2.min.js","sourcesContent":["class GoogleMaps2 {\n allMarkers = [];\n categorizedMarkers = {};\n pointMarkers = [];\n bounds = {};\n infoWindow = {};\n poiCollections = {};\n editable = {};\n map = {};\n\n /**\n * @param {HTMLElement} element\n * @param {Environment} environment\n * @constructor\n */\n constructor (element, environment) {\n this.allMarkers = [];\n this.categorizedMarkers = {};\n this.pointMarkers = [];\n this.bounds = new google.maps.LatLngBounds();\n this.infoWindow = new google.maps.InfoWindow();\n this.poiCollections = JSON.parse(element.dataset.pois || \"null\");\n this.editable = element.classList.contains('editMarker');\n\n this.setMapDimensions(element, environment.settings);\n\n this.createMap(element, environment);\n\n if (typeof this.poiCollections === 'undefined' || this.poiCollections === null) {\n // Plugin: CityMap\n let lat = Number(element.dataset.latitude);\n let lng = Number(element.dataset.longitude);\n if (lat && lng) {\n this.createMarkerByLatLng(lat, lng);\n this.map.setCenter(new google.maps.LatLng(lat, lng));\n } else {\n // Fallback\n this.map.setCenter(new google.maps.LatLng(environment.extConf.defaultLatitude, environment.extConf.defaultLongitude));\n }\n } else {\n // normal case\n this.createPointByCollectionType(element, environment);\n if (\n typeof environment.settings.markerClusterer !== 'undefined'\n && environment.settings.markerClusterer.enable === 1\n ) {\n new MarkerClusterer(\n this.map,\n this.pointMarkers,\n { imagePath: environment.settings.markerClusterer.imagePath }\n );\n }\n\n if (this.countObjectProperties(this.categorizedMarkers) > 1) {\n this.showSwitchableCategories(element, environment);\n }\n\n if (this.shouldFitBounds(environment.settings)) {\n this.map.fitBounds(this.bounds);\n } else {\n this.map.setCenter(new google.maps.LatLng(this.poiCollections[0].latitude, this.poiCollections[0].longitude));\n }\n }\n }\n\n /**\n * Return a MapOptions object which can be assigned to the Map object of Google\n *\n * @param {Settings} settings\n * @return {object}\n */\n getMapOptions = settings => {\n let mapOptions = {\n mapTypeId: '',\n zoom: parseInt(settings.zoom),\n zoomControl: (parseInt(settings.zoomControl) !== 0),\n mapTypeControl: (parseInt(settings.mapTypeControl) !== 0),\n scaleControl: (parseInt(settings.scaleControl) !== 0),\n streetViewControl: (parseInt(settings.streetViewControl) !== 0),\n fullscreenControl: (parseInt(settings.fullScreenControl) !== 0),\n scrollwheel: settings.activateScrollWheel,\n styles: ''\n };\n\n if (settings.styles) {\n mapOptions.styles = eval(settings.styles);\n }\n\n switch (settings.mapTypeId) {\n case 'google.maps.MapTypeId.HYBRID':\n case 'hybrid':\n mapOptions.mapTypeId = google.maps.MapTypeId.HYBRID;\n break;\n case 'google.maps.MapTypeId.ROADMAP':\n case 'roadmap':\n mapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP;\n break;\n case 'google.maps.MapTypeId.SATELLITE':\n case 'satellite':\n mapOptions.mapTypeId = google.maps.MapTypeId.SATELLITE;\n break;\n case 'google.maps.MapTypeId.TERRAIN':\n case 'terrain':\n mapOptions.mapTypeId = google.maps.MapTypeId.TERRAIN;\n break;\n }\n\n return mapOptions;\n }\n\n /**\n * Returns CircleOptions which can be assigned to the Circle object of Google\n *\n * @param {L.Map} map\n * @param {object} centerPosition\n * @param {PoiCollection} poiCollection\n * @return {object}\n */\n getCircleOptions (map, centerPosition, poiCollection) {\n return {\n map: map,\n center: centerPosition,\n radius: poiCollection.radius,\n strokeColor: poiCollection.strokeColor,\n strokeOpacity: poiCollection.strokeOpacity,\n strokeWeight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n };\n }\n\n /**\n * Returns PolygonOptions which can be assigned to the Polygon object of Google\n *\n * @param {object} paths\n * @param {PoiCollection} poiCollection\n * @return {object}\n */\n getPolygonOptions (paths, poiCollection) {\n return {\n paths: paths,\n strokeColor: poiCollection.strokeColor,\n strokeOpacity: poiCollection.strokeOpacity,\n strokeWeight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n };\n }\n\n /**\n * Return PolylineOptions which can be assigned to the Polyline object of Google\n *\n * @param {object} paths\n * @param {PoiCollection} poiCollection\n * @return {object}\n */\n getPolylineOptions (paths, poiCollection) {\n return {\n path: paths,\n strokeColor: poiCollection.strokeColor,\n strokeOpacity: poiCollection.strokeOpacity,\n strokeWeight: poiCollection.strokeWeight,\n };\n }\n\n /**\n * Create Map\n *\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n createMap (element, environment) {\n this.map = new google.maps.Map(\n element,\n this.getMapOptions(environment.settings)\n );\n }\n\n /**\n * @param {string | number} value\n * @return {boolean}\n */\n canBeInterpretedAsNumber(value) {\n return typeof value === 'number' || !isNaN(Number(value));\n }\n\n /**\n * @param {string | number} dimension\n * @returns {string}\n */\n normalizeDimension(dimension) {\n let normalizedDimension = String(dimension);\n\n if (this.canBeInterpretedAsNumber(normalizedDimension)) {\n normalizedDimension += 'px';\n }\n\n return normalizedDimension;\n }\n\n /**\n * @param {Settings} settings\n * @returns {boolean}\n */\n shouldFitBounds(settings) {\n if (settings.forceZoom === true) {\n return false;\n }\n\n if (this.poiCollections === null) {\n return false;\n }\n\n if (this.poiCollections.length > 1) {\n return true;\n }\n\n if (\n this.poiCollections.length === 1\n && (\n this.poiCollections[0].collectionType === \"Area\"\n || this.poiCollections[0].collectionType === \"Route\"\n )\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * @param {HTMLElement} element\n * @param {Settings} settings\n */\n setMapDimensions(element, settings) {\n element.style.height = this.normalizeDimension(settings.mapHeight);\n element.style.width = this.normalizeDimension(settings.mapWidth);\n }\n\n /**\n * Group Categories\n *\n * @param {Environment} environment\n */\n groupCategories = environment => {\n let groupedCategories = {};\n let categoryUid = \"0\";\n for (let x = 0; x < this.poiCollections.length; x++) {\n for (let y = 0; y < this.poiCollections[x].categories.length; y++) {\n categoryUid = String(this.poiCollections[x].categories[y].uid);\n if (this.inList(environment.settings.categories, categoryUid) > -1 && !groupedCategories.hasOwnProperty(categoryUid)) {\n groupedCategories[categoryUid] = this.poiCollections[x].categories[y];\n }\n }\n }\n\n return groupedCategories;\n };\n\n /**\n * Get categories of all checkboxes with a given status\n *\n * @param {HTMLElement} form The HTML form element containing the checkboxes\n * @param {boolean} isChecked Get checkboxes of this status only\n */\n getCategoriesOfCheckboxesWithStatus = (form, isChecked) => {\n let categories = [];\n let checkboxes = isChecked ? form.querySelectorAll(\"input:checked\") : form.querySelectorAll(\"input:not(input:checked)\");\n\n checkboxes.forEach(checkbox => {\n categories.push(parseInt(checkbox.value));\n });\n\n return categories;\n }\n\n getMarkersToChangeVisibilityFor = (categoryUid, form, isChecked) => {\n let markers = [];\n if (this.allMarkers.length === 0) {\n return markers;\n }\n\n let marker = null;\n let allCategoriesOfMarker = null;\n let categoriesOfCheckboxesWithStatus = this.getCategoriesOfCheckboxesWithStatus(form, isChecked);\n for (let i = 0; i < this.allMarkers.length; i++) {\n marker = this.allMarkers[i];\n allCategoriesOfMarker = marker.poiCollection.categories;\n if (allCategoriesOfMarker.length === 0) {\n continue;\n }\n\n let markerCategoryHasCheckboxWithStatus;\n for (let j = 0; j < allCategoriesOfMarker.length; j++) {\n markerCategoryHasCheckboxWithStatus = false;\n for (let k = 0; k < categoriesOfCheckboxesWithStatus.length; k++) {\n if (allCategoriesOfMarker[j].uid === categoriesOfCheckboxesWithStatus[k]) {\n markerCategoryHasCheckboxWithStatus = true;\n }\n }\n if (markerCategoryHasCheckboxWithStatus === isChecked) {\n break;\n }\n }\n\n if (markerCategoryHasCheckboxWithStatus) {\n markers.push(marker.marker);\n }\n }\n\n return markers;\n }\n\n /**\n * Show switchable categories\n *\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n showSwitchableCategories = (element, environment) => {\n let categories = this.groupCategories(environment);\n let form = document.createElement(\"form\");\n let span = {};\n\n form.classList.add(\"txMaps2Form\");\n form.setAttribute(\"id\", \"txMaps2Form-\" + environment.contentRecord.uid);\n\n // Add checkbox for category\n for (let categoryUid in categories) {\n if (categories.hasOwnProperty(categoryUid)) {\n form.appendChild(this.getCheckbox(categories[categoryUid]));\n form.querySelector(\"#checkCategory_\" + categoryUid)?.insertAdjacentHTML(\n \"afterend\",\n `${categories[categoryUid].title}`\n );\n }\n }\n\n // Add listener for checkboxes\n form.querySelectorAll(\"input\").forEach((checkbox) => {\n checkbox.addEventListener(\"click\", () => {\n let isChecked = (checkbox).checked;\n let categoryUid = (checkbox).value;\n let markers = this.getMarkersToChangeVisibilityFor(categoryUid, form, isChecked);\n\n markers.forEach((marker) => {\n marker.setVisible(isChecked);\n });\n });\n });\n\n element.insertAdjacentElement(\"afterend\", form);\n }\n\n /**\n * Get Checkbox for Category\n *\n * @param category\n */\n getCheckbox(category) {\n let div = document.createElement(\"div\");\n div.classList.add(\"form-group\");\n div.innerHTML = `\n
\n \n
`;\n\n return div;\n }\n\n /**\n * Count Object properties\n *\n * @param obj\n */\n countObjectProperties = obj => {\n let count = 0;\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n count++;\n }\n }\n return count;\n }\n\n /**\n * Create Point by CollectionType\n *\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n createPointByCollectionType = (element, environment) => {\n let marker;\n let categoryUid = 0;\n\n if (this.poiCollections !== null && this.poiCollections.length) {\n this.poiCollections.forEach(poiCollection => {\n if (poiCollection.strokeColor === \"\") {\n poiCollection.strokeColor = environment.extConf.strokeColor;\n }\n if (poiCollection.strokeOpacity === \"\") {\n poiCollection.strokeOpacity = environment.extConf.strokeOpacity;\n }\n if (poiCollection.strokeWeight === \"\") {\n poiCollection.strokeWeight = environment.extConf.strokeWeight;\n }\n if (poiCollection.fillColor === \"\") {\n poiCollection.fillColor = environment.extConf.fillColor;\n }\n if (poiCollection.fillOpacity === \"\") {\n poiCollection.fillOpacity = environment.extConf.fillOpacity;\n }\n\n marker = null;\n switch (poiCollection.collectionType) {\n case \"Point\":\n marker = this.createMarker(poiCollection, element, environment);\n break;\n case \"Area\":\n marker = this.createArea(poiCollection, environment);\n break;\n case \"Route\":\n marker = this.createRoute(poiCollection, environment);\n break;\n case \"Radius\":\n marker = this.createRadius(poiCollection, environment);\n break;\n }\n\n if (marker !== null) {\n this.allMarkers.push({\n marker: marker,\n poiCollection: poiCollection\n });\n\n categoryUid = 0;\n for (let c = 0; c < poiCollection.categories.length; c++) {\n categoryUid = poiCollection.categories[c].uid;\n if (!this.categorizedMarkers.hasOwnProperty(categoryUid)) {\n this.categorizedMarkers[categoryUid] = [];\n }\n this.categorizedMarkers[categoryUid].push({\n marker: marker,\n relatedCategories: poiCollection.categories\n });\n }\n }\n });\n }\n }\n\n /**\n * Create Marker with InfoWindow\n *\n * @param {PoiCollection} poiCollection\n * @param {HTMLElement} element\n * @param {Environment} environment\n */\n createMarker = (poiCollection, element, environment) => {\n let categoryUid = \"0\";\n let marker = new google.maps.Marker({\n position: new google.maps.LatLng(poiCollection.latitude, poiCollection.longitude),\n map: this.map\n });\n marker.setDraggable(this.editable);\n\n // assign first found marker icon, if available\n if (poiCollection.hasOwnProperty(\"markerIcon\") && poiCollection.markerIcon !== \"\") {\n let icon = {\n url: poiCollection.markerIcon,\n scaledSize: new google.maps.Size(poiCollection.markerIconWidth, poiCollection.markerIconHeight),\n anchor: new google.maps.Point(poiCollection.markerIconAnchorPosX, poiCollection.markerIconAnchorPosY)\n };\n marker.setIcon(icon);\n }\n\n this.pointMarkers.push(marker);\n this.bounds.extend(marker.position);\n\n if (this.editable) {\n this.addEditListeners(element, marker, poiCollection, environment);\n } else {\n this.addInfoWindow(marker, poiCollection, environment);\n }\n\n return marker;\n }\n\n /**\n * Create Area\n *\n * @param poiCollection\n * @param environment\n */\n createArea = (poiCollection, environment) => {\n let latLng;\n let paths = [];\n for (let i = 0; i < poiCollection.pois.length; i++) {\n latLng = new google.maps.LatLng(poiCollection.pois[i].latitude, poiCollection.pois[i].longitude);\n this.bounds.extend(latLng);\n paths.push(latLng);\n }\n\n if (paths.length === 0) {\n paths.push(this.mapPosition);\n }\n\n let area = new google.maps.Polygon(this.getPolygonOptions(paths, poiCollection));\n area.setMap(this.map);\n this.addInfoWindow(area, poiCollection, environment);\n\n return area;\n }\n\n /**\n * Create Route\n *\n * @param poiCollection\n * @param environment\n */\n createRoute = (poiCollection, environment) => {\n let latLng;\n let paths = [];\n for (let i = 0; i < poiCollection.pois.length; i++) {\n latLng = new google.maps.LatLng(poiCollection.pois[i].latitude, poiCollection.pois[i].longitude);\n this.bounds.extend(latLng);\n paths.push(latLng);\n }\n\n if (paths.length === 0) {\n paths.push(this.mapPosition);\n }\n\n let route = new google.maps.Polyline(this.getPolylineOptions(paths, poiCollection));\n route.setMap(this.map);\n this.addInfoWindow(route, poiCollection, environment);\n\n return route;\n }\n\n /**\n * Create Radius\n *\n * @param poiCollection\n * @param environment\n */\n createRadius = (poiCollection, environment) => {\n let circle = new google.maps.Circle(\n this.getCircleOptions(\n this.map,\n new google.maps.LatLng(poiCollection.latitude, poiCollection.longitude),\n poiCollection\n )\n );\n\n this.bounds.union(circle.getBounds());\n this.addInfoWindow(circle, poiCollection, environment);\n\n return circle;\n }\n\n /**\n * Add Info Window to element\n *\n * @param element\n * @param poiCollection\n * @param environment\n */\n addInfoWindow = (element, poiCollection, environment) => {\n // we need these both vars to be set global. So that we can access them in Listener\n let infoWindow = this.infoWindow;\n let map = this.map;\n google.maps.event.addListener(element, \"click\", event => {\n fetch(environment.ajaxUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n poiCollection: poiCollection.uid\n })\n })\n .then(response => response.json())\n .then(data => {\n infoWindow.close();\n infoWindow.setContent(data.content);\n\n // Do not set pointer of InfoWindow to the same pointer of the POI icon.\n // In case of Point the pointer of InfoWindow should be at mouse position.\n if (poiCollection.collectionType === \"Point\") {\n infoWindow.setPosition(null);\n infoWindow.open(map, element);\n } else {\n infoWindow.setPosition(new google.maps.LatLng(poiCollection.latitude, poiCollection.longitude));\n infoWindow.open(map);\n }\n })\n .catch(error => console.error('Error:', error));\n });\n }\n\n /**\n * Check for item in list\n * Check if an item exists in a comma-separated list of items.\n *\n * @param list\n * @param item\n */\n inList = (list, item) => {\n let catSearch = ',' + list + ',';\n item = ',' + item + ',';\n return catSearch.search(item);\n };\n\n /**\n * Create Marker with InfoWindow\n *\n * @param latitude\n * @param longitude\n */\n createMarkerByLatLng = (latitude, longitude) => {\n let marker = new google.maps.Marker({\n position: new google.maps.LatLng(latitude, longitude),\n map: this.map\n });\n this.bounds.extend(marker.position);\n };\n\n /**\n * Add Edit Listeners\n * This will only work for Markers (Point)\n *\n * @param mapContainer\n * @param marker\n * @param poiCollection\n * @param environment\n */\n addEditListeners = (mapContainer, marker, poiCollection, environment) => {\n // update fields and marker while dragging\n google.maps.event.addListener(marker, 'dragend', () => {\n let lat = marker.getPosition().lat().toFixed(6);\n let lng = marker.getPosition().lng().toFixed(6);\n mapContainer.prevAll(\"input.latitude-\" + environment.contentRecord.uid).val(lat);\n mapContainer.prevAll(\"input.longitude-\" + environment.contentRecord.uid).val(lng);\n });\n\n // update fields and marker when clicking on the map\n google.maps.event.addListener(this.map, 'click', event => {\n marker.setPosition(event.latLng);\n mapContainer.prevAll(\"input.latitude-\" + environment.contentRecord.uid).val(event.latLng.lat().toFixed(6));\n mapContainer.prevAll(\"input.longitude-\" + environment.contentRecord.uid).val(event.latLng.lng().toFixed(6));\n });\n };\n}\n\nlet maps2GoogleMaps = [];\n\n/**\n * This function will be called by the &callback argument of the Google Maps API library\n */\nfunction initMap () {\n document.querySelectorAll(\".maps2\").forEach(element => {\n const environment = typeof element.dataset.environment !== 'undefined' ? element.dataset.environment : '{}';\n const override = typeof element.dataset.override !== 'undefined' ? element.dataset.override : '{}';\n\n // Pass in the objects to merge as arguments.\n // For a deep extend, set the first argument to `true`.\n const extend = (...args) => {\n let extended = {};\n let deep = false;\n let i = 0;\n let length = args.length;\n\n // Check for deep merge\n if (Object.prototype.toString.call(args[0]) === '[object Boolean]') {\n deep = args[0];\n i++;\n }\n\n // Merge the object into the extended object\n const merge = function (obj) {\n for ( var prop in obj ) {\n if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {\n // If deep merge and property is an object, merge properties\n if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {\n extended[prop] = extend( true, extended[prop], obj[prop] );\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for ( ; i < length; i++ ) {\n var obj = args[i];\n merge(obj);\n }\n\n return extended;\n };\n\n maps2GoogleMaps.push(new GoogleMaps2(\n element,\n extend(JSON.parse(environment), JSON.parse(override))\n ));\n });\n\n // Initialize radius search\n let address = document.querySelector('#maps2Address');\n let radius = document.querySelector('#maps2Radius');\n if (address !== null && radius !== null) {\n let autocomplete = new google.maps.places.Autocomplete(address, {\n fields: [\n \"place_id\"\n ]\n });\n\n address.addEventListener(\"keydown\", event => {\n if (event.keyCode === 13) return false;\n });\n }\n}\n"]} \ No newline at end of file diff --git a/Resources/Public/JavaScript/OpenStreetMap2.min.js b/Resources/Public/JavaScript/OpenStreetMap2.min.js index 51510147..88736899 100644 --- a/Resources/Public/JavaScript/OpenStreetMap2.min.js +++ b/Resources/Public/JavaScript/OpenStreetMap2.min.js @@ -3,5 +3,5 @@ class OpenStreetMap2{element={};environment={};editable=!1;bounds={};allMarkers= - `,e}countObjectProperties(t){let e=0;for(var i in t)t.hasOwnProperty(i)&&e++;return e}createPointByCollectionType(){let i,o=0;null!==this.poiCollections&&this.poiCollections.length&&this.poiCollections.forEach(e=>{switch(""===e.strokeColor&&(e.strokeColor=this.getExtConf().strokeColor),""===e.strokeOpacity&&(e.strokeOpacity=this.getExtConf().strokeOpacity),""===e.strokeWeight&&(e.strokeWeight=this.getExtConf().strokeWeight),""===e.fillColor&&(e.fillColor=this.getExtConf().fillColor),""===e.fillOpacity&&(e.fillOpacity=this.getExtConf().fillOpacity),i=null,e.collectionType){case"Point":i=this.createMarker(e);break;case"Area":i=this.createArea(e);break;case"Route":i=this.createRoute(e);break;case"Radius":i=this.createRadius(e)}this.allMarkers.push({marker:i,poiCollection:e});for(let t=o=0;t{t=[t.latitude,t.longitude];this.bounds.extend(t),e.push(t)});var i=L.polygon(e,{color:t.strokeColor,opacity:t.strokeOpacity,weight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity}).addTo(this.map);return this.addInfoWindow(i,t),i}createRoute(t){let e=[];t.pois.forEach(t=>{t=[t.latitude,t.longitude];this.bounds.extend(t),e.push(t)});var i=L.polyline(e,{color:t.strokeColor,opacity:t.strokeOpacity,weight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity}).addTo(this.map);return this.addInfoWindow(i,t),i}createRadius(t){var e=L.circle([t.latitude,t.longitude],{color:t.strokeColor,opacity:t.strokeOpacity,weight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity,radius:t.radius}).addTo(this.map);return this.bounds.extend(e.getBounds()),this.addInfoWindow(e,t),e}addInfoWindow(e,t){e.addEventListener("click",()=>{fetch(this.environment.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({poiCollection:t.uid})}).then(t=>t.json()).then(t=>{e.bindPopup(t.content).openPopup()}).catch(t=>console.error("Error:",t))})}addEditListeners(i,o,t){o.on("dragend",()=>{var t=o.getLatLng().lat.toFixed(6),e=o.getLatLng().lng.toFixed(6);i.previousElementSibling?.querySelector("input.latitude-"+this.getContentRecord().uid).setAttribute("value",t),i.previousElementSibling?.querySelector("input.longitude-"+this.getContentRecord().uid).setAttribute("value",e)}),this.map.on("click",t=>{o.setLatLng(t.latlng),i.previousElementSibling?.querySelector("input.latitude-"+this.getContentRecord().uid).setAttribute("value",t.latlng.lat.toFixed(6)),i.previousElementSibling?.querySelector("input.longitude-"+this.getContentRecord().uid).setAttribute("value",t.latlng.lng.toFixed(6))})}canBeInterpretedAsNumber(t){return"number"==typeof t||!isNaN(Number(t))}getContentRecord(){return this.environment.contentRecord}getExtConf(){return this.environment.extConf}getSettings(){return this.environment.settings}}let maps2OpenStreetMaps=[];document.querySelectorAll(".maps2").forEach(t=>{var e=void 0!==t.dataset.environment?t.dataset.environment:"{}",i=void 0!==t.dataset.override?t.dataset.override:"{}";const n=(...arguments)=>{let t={},e=!1,i=0;var o=arguments.length;for("[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(e=arguments[0],i++);i`,e}countObjectProperties(t){let e=0;for(var i in t)t.hasOwnProperty(i)&&e++;return e}createPointByCollectionType(){let i,o=0;null!==this.poiCollections&&this.poiCollections.length&&this.poiCollections.forEach(e=>{switch(""===e.strokeColor&&(e.strokeColor=this.getExtConf().strokeColor),""===e.strokeOpacity&&(e.strokeOpacity=this.getExtConf().strokeOpacity),""===e.strokeWeight&&(e.strokeWeight=this.getExtConf().strokeWeight),""===e.fillColor&&(e.fillColor=this.getExtConf().fillColor),""===e.fillOpacity&&(e.fillOpacity=this.getExtConf().fillOpacity),i=null,e.collectionType){case"Point":i=this.createMarker(e);break;case"Area":i=this.createArea(e);break;case"Route":i=this.createRoute(e);break;case"Radius":i=this.createRadius(e)}this.allMarkers.push({marker:i,poiCollection:e});for(let t=o=0;t{t=[t.latitude,t.longitude];this.bounds.extend(t),e.push(t)});var i=L.polygon(e,{color:t.strokeColor,opacity:t.strokeOpacity,weight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity}).addTo(this.map);return this.addInfoWindow(i,t),i}createRoute(t){let e=[];t.pois.forEach(t=>{t=[t.latitude,t.longitude];this.bounds.extend(t),e.push(t)});var i=L.polyline(e,{color:t.strokeColor,opacity:t.strokeOpacity,weight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity}).addTo(this.map);return this.addInfoWindow(i,t),i}createRadius(t){var e=L.circle([t.latitude,t.longitude],{color:t.strokeColor,opacity:t.strokeOpacity,weight:t.strokeWeight,fillColor:t.fillColor,fillOpacity:t.fillOpacity,radius:t.radius}).addTo(this.map);return this.bounds.extend(e.getBounds()),this.addInfoWindow(e,t),e}addInfoWindow(e,t){e.addEventListener("click",()=>{fetch(this.environment.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({poiCollection:t.uid})}).then(t=>t.json()).then(t=>{e.bindPopup(t.content).openPopup()}).catch(t=>console.error("Error:",t))})}addEditListeners(i,o,t){o.on("dragend",()=>{var t=o.getLatLng().lat.toFixed(6),e=o.getLatLng().lng.toFixed(6);i.previousElementSibling?.querySelector("input.latitude-"+this.getContentRecord().uid).setAttribute("value",t),i.previousElementSibling?.querySelector("input.longitude-"+this.getContentRecord().uid).setAttribute("value",e)}),this.map.on("click",t=>{o.setLatLng(t.latlng),i.previousElementSibling?.querySelector("input.latitude-"+this.getContentRecord().uid).setAttribute("value",t.latlng.lat.toFixed(6)),i.previousElementSibling?.querySelector("input.longitude-"+this.getContentRecord().uid).setAttribute("value",t.latlng.lng.toFixed(6))})}canBeInterpretedAsNumber(t){return"number"==typeof t||!isNaN(Number(t))}getContentRecord(){return this.environment.contentRecord}getExtConf(){return this.environment.extConf}getSettings(){return this.environment.settings}}let maps2OpenStreetMaps=[];document.querySelectorAll(".maps2").forEach(t=>{var e=void 0!==t.dataset.environment?t.dataset.environment:"{}",i=void 0!==t.dataset.override?t.dataset.override:"{}";const l=(...t)=>{let e={},i=!1,o=0;var r=t.length;for("[object Boolean]"===Object.prototype.toString.call(t[0])&&(i=t[0],o++);o 1) {\n this.showSwitchableCategories();\n }\n this.adjustMapZoom();\n }\n\n adjustMapZoom() {\n if (this.shouldFitBounds()) {\n this.map.fitBounds(this.bounds);\n } else {\n this.map.panTo([this.poiCollections[0].latitude, this.poiCollections[0].longitude]);\n }\n }\n\n /**\n * @returns {boolean}\n */\n shouldFitBounds() {\n if (this.getSettings().forceZoom === true) {\n return false;\n }\n\n if (this.poiCollections === null) {\n return false;\n }\n\n if (this.poiCollections.length > 1) {\n return true;\n }\n\n if (\n this.poiCollections.length === 1\n && (\n this.poiCollections[0].collectionType === \"Area\"\n || this.poiCollections[0].collectionType === \"Route\"\n )\n ) {\n return true;\n }\n\n return false;\n }\n\n setMapDimensions() {\n this.element.style.height = this.normalizeDimension(this.getSettings().mapHeight);\n this.element.style.width = this.normalizeDimension(this.getSettings().mapWidth);\n }\n\n /**\n * @param {string | number} dimension\n * @returns {string}\n */\n normalizeDimension(dimension) {\n let normalizedDimension = String(dimension);\n\n if (this.canBeInterpretedAsNumber(normalizedDimension)) {\n normalizedDimension += 'px';\n }\n\n return normalizedDimension;\n }\n\n createMap() {\n this.map = L.map(\n this.element, {\n center: [this.getExtConf().defaultLatitude, this.getExtConf().defaultLongitude],\n zoom: this.getSettings().zoom ? this.getSettings().zoom : 12,\n editable: this.editable,\n scrollWheelZoom: this.getSettings().activateScrollWheel !== \"0\"\n }\n );\n\n L.tileLayer(this.getSettings().mapTile, {\n attribution: this.getSettings().mapTileAttribution,\n maxZoom: 20\n }).addTo(this.map);\n }\n\n /**\n * @returns {{[p: string]: Category}}\n */\n groupCategories() {\n const groupedCategories = {};\n\n this.poiCollections.forEach((poiCollection) => {\n const categoryUids = poiCollection.categories.map((category) => String(category.uid));\n\n categoryUids\n .filter((categoryUid) => this.getSettings().categories.includes(categoryUid))\n .forEach((categoryUid) => {\n if (!groupedCategories.hasOwnProperty(categoryUid)) {\n groupedCategories[categoryUid] = poiCollection.categories.find((category) => String(category.uid) === categoryUid);\n }\n });\n });\n\n return groupedCategories;\n }\n\n /**\n * @param {HTMLElement} form\n * @param {boolean} isChecked\n * @returns {number[]}\n */\n getCategoriesOfCheckboxesWithStatus(form, isChecked) {\n let categories = [];\n let checkboxes = isChecked\n ? Array.from(form.querySelectorAll(\"input:checked\"))\n : Array.from(form.querySelectorAll(\"input:not(:checked)\"));\n\n checkboxes.forEach((checkbox) => {\n categories.push(parseInt((checkbox).value));\n });\n\n return categories;\n }\n\n /**\n * @param {string} categoryUid\n * @param {HTMLElement} form\n * @param { boolean} isChecked\n * @returns {*[]}\n */\n getMarkersToChangeVisibilityFor(categoryUid, form, isChecked) {\n let markers = [];\n if (this.allMarkers.length === 0) {\n return markers;\n }\n\n let marker = null;\n let allCategoriesOfMarker = null;\n let categoriesOfCheckboxesWithStatus = this.getCategoriesOfCheckboxesWithStatus(form, isChecked);\n for (let i = 0; i < this.allMarkers.length; i++) {\n marker = this.allMarkers[i];\n allCategoriesOfMarker = marker.poiCollection.categories;\n if (allCategoriesOfMarker.length === 0) {\n continue;\n }\n\n let markerCategoryHasCheckboxWithStatus;\n for (let j = 0; j < allCategoriesOfMarker.length; j++) {\n markerCategoryHasCheckboxWithStatus = false;\n for (let k = 0; k < categoriesOfCheckboxesWithStatus.length; k++) {\n if (allCategoriesOfMarker[j].uid === categoriesOfCheckboxesWithStatus[k]) {\n markerCategoryHasCheckboxWithStatus = true;\n }\n }\n if (markerCategoryHasCheckboxWithStatus === isChecked) {\n break;\n }\n }\n\n if (markerCategoryHasCheckboxWithStatus) {\n markers.push(marker.marker);\n }\n }\n\n return markers;\n }\n\n showSwitchableCategories() {\n let categories = this.groupCategories();\n let form = document.createElement(\"form\");\n form.classList.add(\"txMaps2Form\");\n form.setAttribute(\"id\", \"txMaps2Form-\" + this.getContentRecord().uid);\n\n // Add checkbox for category\n for (let categoryUid in categories) {\n if (categories.hasOwnProperty(categoryUid)) {\n form.appendChild(this.getCheckbox(categories[categoryUid]));\n form.querySelector(\"#checkCategory_\" + categoryUid)?.insertAdjacentHTML(\n \"afterend\",\n `${categories[categoryUid].title}`\n );\n }\n }\n\n // Add listener for checkboxes\n form.querySelectorAll(\"input\").forEach((checkbox) => {\n checkbox.addEventListener(\"click\", () => {\n let isChecked = (checkbox).checked;\n let categoryUid = (checkbox).value;\n let markers = this.getMarkersToChangeVisibilityFor(categoryUid, form, isChecked);\n\n markers.forEach((marker) => {\n if (isChecked) {\n this.map.addLayer(marker);\n } else {\n this.map.removeLayer(marker);\n }\n });\n });\n });\n\n this.element.insertAdjacentElement(\"afterend\", form);\n }\n\n /**\n * @param {Category} category\n * @returns {HTMLElement}\n */\n getCheckbox(category) {\n let div = document.createElement(\"div\");\n div.classList.add(\"form-group\");\n div.innerHTML = `\n
\n \n
`;\n\n return div;\n }\n\n /**\n * @param {object} obj\n * @returns {number}\n */\n countObjectProperties(obj) {\n let count = 0;\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n count++;\n }\n }\n return count;\n }\n\n createPointByCollectionType() {\n let marker;\n let categoryUid = 0;\n\n if (this.poiCollections !== null && this.poiCollections.length) {\n this.poiCollections.forEach(poiCollection => {\n if (poiCollection.strokeColor === \"\") {\n poiCollection.strokeColor = this.getExtConf().strokeColor;\n }\n if (poiCollection.strokeOpacity === \"\") {\n poiCollection.strokeOpacity = this.getExtConf().strokeOpacity;\n }\n if (poiCollection.strokeWeight === \"\") {\n poiCollection.strokeWeight = this.getExtConf().strokeWeight;\n }\n if (poiCollection.fillColor === \"\") {\n poiCollection.fillColor = this.getExtConf().fillColor;\n }\n if (poiCollection.fillOpacity === \"\") {\n poiCollection.fillOpacity = this.getExtConf().fillOpacity;\n }\n\n marker = null;\n switch (poiCollection.collectionType) {\n case \"Point\":\n marker = this.createMarker(poiCollection);\n break;\n case \"Area\":\n marker = this.createArea(poiCollection);\n break;\n case \"Route\":\n marker = this.createRoute(poiCollection);\n break;\n case \"Radius\":\n marker = this.createRadius(poiCollection);\n break;\n }\n\n this.allMarkers.push({\n marker: marker,\n poiCollection: poiCollection\n });\n\n categoryUid = 0;\n for (let c = 0; c < poiCollection.categories.length; c++) {\n categoryUid = poiCollection.categories[c].uid;\n if (!this.categorizedMarkers.hasOwnProperty(categoryUid)) {\n this.categorizedMarkers[categoryUid] = [];\n }\n this.categorizedMarkers[categoryUid].push(marker);\n }\n });\n }\n }\n\n /**\n * @param {number} latitude\n * @param {number} longitude\n */\n createMarkerByLatLng(latitude, longitude) {\n let marker = L.marker(\n [latitude, longitude]\n ).addTo(this.map);\n\n this.bounds.extend(marker.getLatLng());\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Marker}\n */\n createMarker(poiCollection) {\n let marker = L.marker(\n [poiCollection.latitude, poiCollection.longitude],\n {\n 'draggable': this.editable\n }\n ).addTo(this.map);\n\n if (poiCollection.hasOwnProperty(\"markerIcon\") && poiCollection.markerIcon !== \"\") {\n let icon = L.icon({\n iconUrl: poiCollection.markerIcon,\n iconSize: [poiCollection.markerIconWidth, poiCollection.markerIconHeight],\n iconAnchor: [poiCollection.markerIconAnchorPosX, poiCollection.markerIconAnchorPosY]\n });\n marker.setIcon(icon);\n }\n\n this.bounds.extend(marker.getLatLng());\n\n if (this.editable) {\n this.addEditListeners(this.element, marker, poiCollection);\n } else {\n this.addInfoWindow(marker, poiCollection);\n }\n\n return marker;\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Polygon}\n */\n createArea(poiCollection) {\n let latlngs = [];\n\n poiCollection.pois.forEach(poi => {\n let latLng = [poi.latitude, poi.longitude];\n this.bounds.extend(latLng);\n latlngs.push(latLng);\n });\n\n let marker = L.polygon(latlngs, {\n color: poiCollection.strokeColor,\n opacity: poiCollection.strokeOpacity,\n weight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n }).addTo(this.map);\n\n this.addInfoWindow(marker, poiCollection);\n\n return marker;\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Polyline}\n */\n createRoute(poiCollection) {\n let latlngs = [];\n\n poiCollection.pois.forEach(poi => {\n let latLng = [poi.latitude, poi.longitude];\n this.bounds.extend(latLng);\n latlngs.push(latLng);\n });\n\n let marker = L.polyline(latlngs, {\n color: poiCollection.strokeColor,\n opacity: poiCollection.strokeOpacity,\n weight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n }).addTo(this.map);\n\n this.addInfoWindow(marker, poiCollection);\n\n return marker;\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Circle}\n */\n createRadius(poiCollection) {\n let marker = L.circle([poiCollection.latitude, poiCollection.longitude], {\n color: poiCollection.strokeColor,\n opacity: poiCollection.strokeOpacity,\n weight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity,\n radius: poiCollection.radius\n }).addTo(this.map);\n\n this.bounds.extend(marker.getBounds());\n\n this.addInfoWindow(marker, poiCollection);\n\n return marker;\n }\n\n /**\n * @param {HTMLElement} element\n * @param {PoiCollection} poiCollection\n */\n addInfoWindow(element, poiCollection) {\n element.addEventListener(\"click\", () => {\n fetch(this.environment.ajaxUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n poiCollection: poiCollection.uid\n })\n })\n .then(response => response.json())\n .then(data => {\n element.bindPopup(data.content).openPopup();\n })\n .catch(error => console.error('Error:', error));\n });\n }\n\n /**\n * @param {HTMLElement} mapContainer\n * @param {L.Marker} marker\n * @param {PoiCollection} poiCollection\n */\n addEditListeners(mapContainer, marker, poiCollection) {\n marker.on('dragend', () => {\n let lat = marker.getLatLng().lat.toFixed(6);\n let lng = marker.getLatLng().lng.toFixed(6);\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.latitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", lat);\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.longitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", lng);\n });\n\n this.map.on('click', (event) => {\n marker.setLatLng(event.latlng);\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.latitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", event.latlng.lat.toFixed(6));\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.longitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", event.latlng.lng.toFixed(6));\n });\n }\n\n /**\n * return {boolean}\n */\n canBeInterpretedAsNumber(value) {\n return typeof value === 'number' || !isNaN(Number(value));\n }\n\n /**\n * return {ContentRecord}\n */\n getContentRecord() {\n return this.environment.contentRecord;\n }\n\n /**\n * return {ExtConf}\n */\n getExtConf() {\n return this.environment.extConf;\n }\n\n /**\n * return {Settings}\n */\n getSettings() {\n return this.environment.settings;\n }\n}\n\nlet maps2OpenStreetMaps = [];\n\ndocument.querySelectorAll(\".maps2\").forEach((element) => {\n const environment = typeof element.dataset.environment !== 'undefined' ? element.dataset.environment : '{}';\n const override = typeof element.dataset.override !== 'undefined' ? element.dataset.override : '{}';\n\n // Pass in the objects to merge as arguments.\n // For a deep extend, set the first argument to `true`.\n const extend = (...arguments) => {\n let extended = {};\n let deep = false;\n let i = 0;\n let length = arguments.length;\n\n // Check for deep merge\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\n deep = arguments[0];\n i++;\n }\n\n // Merge the object into the extended object\n const merge = function (obj) {\n for ( var prop in obj ) {\n if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {\n // If deep merge and property is an object, merge properties\n if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {\n extended[prop] = extend( true, extended[prop], obj[prop] );\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for ( ; i < length; i++ ) {\n var obj = arguments[i];\n merge(obj);\n }\n\n return extended;\n };\n\n maps2OpenStreetMaps.push(new OpenStreetMap2(\n element,\n extend(true, JSON.parse(environment), JSON.parse(override))\n ));\n});\n"]} \ No newline at end of file +{"version":3,"sources":["OpenStreetMap2.js"],"names":["OpenStreetMap2","element","environment","editable","bounds","allMarkers","categorizedMarkers","poiCollections","map","constructor","this","classList","contains","L","LatLngBounds","preparePoiCollection","setMapDimensions","createMap","setMarkersOnMap","JSON","parse","getAttribute","isPOICollectionsEmpty","createMarkerBasedOnDataAttributes","createMarkerBasedOnPOICollections","length","latitude","getAttributeAsFloat","longitude","isNaN","createMarkerByLatLng","attributeName","parseFloat","createPointByCollectionType","countObjectProperties","showSwitchableCategories","adjustMapZoom","shouldFitBounds","fitBounds","panTo","getSettings","forceZoom","collectionType","style","height","normalizeDimension","mapHeight","width","mapWidth","dimension","let","normalizedDimension","String","canBeInterpretedAsNumber","center","getExtConf","defaultLatitude","defaultLongitude","zoom","scrollWheelZoom","activateScrollWheel","tileLayer","mapTile","attribution","mapTileAttribution","maxZoom","addTo","groupCategories","groupedCategories","forEach","poiCollection","categories","category","uid","filter","includes","categoryUid","hasOwnProperty","find","getCategoriesOfCheckboxesWithStatus","form","isChecked","Array","from","querySelectorAll","push","parseInt","value","getMarkersToChangeVisibilityFor","markers","marker","allCategoriesOfMarker","categoriesOfCheckboxesWithStatus","i","markerCategoryHasCheckboxWithStatus","j","k","document","createElement","add","setAttribute","getContentRecord","appendChild","getCheckbox","querySelector","insertAdjacentHTML","title","checkbox","addEventListener","checked","addLayer","removeLayer","insertAdjacentElement","div","innerHTML","obj","count","key","strokeColor","strokeOpacity","strokeWeight","fillColor","fillOpacity","createMarker","createArea","createRoute","createRadius","c","extend","getLatLng","icon","draggable","markerIcon","iconUrl","iconSize","markerIconWidth","markerIconHeight","iconAnchor","markerIconAnchorPosX","markerIconAnchorPosY","setIcon","addEditListeners","addInfoWindow","latlngs","pois","poi","latLng","polygon","color","opacity","weight","polyline","circle","radius","getBounds","fetch","ajaxUrl","method","headers","Content-Type","body","stringify","then","response","json","data","bindPopup","content","openPopup","catch","error","console","mapContainer","on","lat","toFixed","lng","previousElementSibling","setLatLng","event","latlng","Number","contentRecord","extConf","settings","maps2OpenStreetMaps","dataset","override","args","extended","deep","Object","prototype","toString","call","prop"],"mappings":"MAAAA,eACAC,QAAA,GACAC,YAAA,GACAC,SAAA,CAAA,EACAC,OAAA,GAEAC,WAAA,GACAC,mBAAA,GACAC,eAAA,GACAC,IAAA,GAEAC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,GAEAxF,SAAAb,iBAAA,QAAA,EAAAf,QAAA,IACA,IAAAnE,EAAA,KAAA,IAAAD,EAAAyL,QAAAxL,YAAAD,EAAAyL,QAAAxL,YAAA,KACAyL,EAAA,KAAA,IAAA1L,EAAAyL,QAAAC,SAAA1L,EAAAyL,QAAAC,SAAA,KAIA,MAAA3D,EAAA,IAAA4D,KACA1I,IAAA2I,EAAA,GACAC,EAAA,CAAA,EACAjG,EAAA,EACA3C,IAAAzB,EAAAmK,EAAAnK,OAuBA,IApBA,qBAAAsK,OAAAC,UAAAC,SAAAC,KAAAN,EAAA,EAAA,IACAE,EAAAF,EAAA,GACA/F,CAAA,IAkBAA,EAAApE,EAAAoE,CAAA,GAAA,CACA,IAdAsG,EAcAhF,EAAAyE,EAAA/F,GAfAsB,GACAgF,EAAAA,KAAAA,EAeAhF,GAfA,IAAAgF,KAAAhF,EACA4E,OAAAC,UAAAnH,eAAAqH,KAAA/E,EAAAgF,CAAA,IAEAL,GAAA,oBAAAC,OAAAC,UAAAC,SAAAC,KAAA/E,EAAAgF,EAAA,EACAN,EAAAM,GAAAnE,EAAA,CAAA,EAAA6D,EAAAM,GAAAhF,EAAAgF,EAAA,EAEAN,EAAAM,GAAAhF,EAAAgF,GAUA,CAEA,OAAAN,CACA,EAEAJ,oBAAApG,KAAA,IAAArF,eACAC,EACA+H,EAAA,CAAA,EAAA7G,KAAAC,MAAAlB,CAAA,EAAAiB,KAAAC,MAAAuK,CAAA,CAAA,CACA,CAAA,CACA,CAAA","file":"OpenStreetMap2.min.js","sourcesContent":["class OpenStreetMap2 {\n element = {};\n environment = {};\n editable = false;;\n bounds = {};\n\n allMarkers = [];\n categorizedMarkers = {};\n poiCollections = [];\n map = {};\n\n constructor(element, environment) {\n this.element = element;\n this.environment = environment;\n this.editable = this.element.classList.contains(\"editMarker\");\n this.bounds = new L.LatLngBounds();\n\n this.preparePoiCollection();\n this.setMapDimensions();\n this.createMap();\n this.setMarkersOnMap();\n }\n\n preparePoiCollection() {\n this.poiCollections = JSON.parse(this.element.getAttribute(\"data-pois\") || '[]');\n }\n\n setMarkersOnMap() {\n if (this.isPOICollectionsEmpty()) {\n this.createMarkerBasedOnDataAttributes();\n } else {\n this.createMarkerBasedOnPOICollections();\n }\n }\n\n /**\n * @returns {boolean}\n */\n isPOICollectionsEmpty() {\n return this.poiCollections.length === 0;\n }\n\n createMarkerBasedOnDataAttributes() {\n const latitude = this.getAttributeAsFloat(\"data-latitude\");\n const longitude = this.getAttributeAsFloat(\"data-longitude\");\n\n if (!isNaN(latitude) && !isNaN(longitude)) {\n this.createMarkerByLatLng(latitude, longitude);\n }\n }\n\n /**\n * @param {string} attributeName\n * @returns {number}\n */\n getAttributeAsFloat(attributeName) {\n return parseFloat(this.element.getAttribute(attributeName) || \"\");\n }\n\n createMarkerBasedOnPOICollections() {\n this.createPointByCollectionType();\n if (this.countObjectProperties(this.categorizedMarkers) > 1) {\n this.showSwitchableCategories();\n }\n this.adjustMapZoom();\n }\n\n adjustMapZoom() {\n if (this.shouldFitBounds()) {\n this.map.fitBounds(this.bounds);\n } else {\n this.map.panTo([this.poiCollections[0].latitude, this.poiCollections[0].longitude]);\n }\n }\n\n /**\n * @returns {boolean}\n */\n shouldFitBounds() {\n if (this.getSettings().forceZoom === true) {\n return false;\n }\n\n if (this.poiCollections === null) {\n return false;\n }\n\n if (this.poiCollections.length > 1) {\n return true;\n }\n\n if (\n this.poiCollections.length === 1\n && (\n this.poiCollections[0].collectionType === \"Area\"\n || this.poiCollections[0].collectionType === \"Route\"\n )\n ) {\n return true;\n }\n\n return false;\n }\n\n setMapDimensions() {\n this.element.style.height = this.normalizeDimension(this.getSettings().mapHeight);\n this.element.style.width = this.normalizeDimension(this.getSettings().mapWidth);\n }\n\n /**\n * @param {string | number} dimension\n * @returns {string}\n */\n normalizeDimension(dimension) {\n let normalizedDimension = String(dimension);\n\n if (this.canBeInterpretedAsNumber(normalizedDimension)) {\n normalizedDimension += 'px';\n }\n\n return normalizedDimension;\n }\n\n createMap() {\n this.map = L.map(\n this.element, {\n center: [this.getExtConf().defaultLatitude, this.getExtConf().defaultLongitude],\n zoom: this.getSettings().zoom ? this.getSettings().zoom : 12,\n editable: this.editable,\n scrollWheelZoom: this.getSettings().activateScrollWheel !== \"0\"\n }\n );\n\n L.tileLayer(this.getSettings().mapTile, {\n attribution: this.getSettings().mapTileAttribution,\n maxZoom: 20\n }).addTo(this.map);\n }\n\n /**\n * @returns {{[p: string]: Category}}\n */\n groupCategories() {\n const groupedCategories = {};\n\n this.poiCollections.forEach((poiCollection) => {\n const categoryUids = poiCollection.categories.map((category) => String(category.uid));\n\n categoryUids\n .filter((categoryUid) => this.getSettings().categories.includes(categoryUid))\n .forEach((categoryUid) => {\n if (!groupedCategories.hasOwnProperty(categoryUid)) {\n groupedCategories[categoryUid] = poiCollection.categories.find((category) => String(category.uid) === categoryUid);\n }\n });\n });\n\n return groupedCategories;\n }\n\n /**\n * @param {HTMLElement} form\n * @param {boolean} isChecked\n * @returns {number[]}\n */\n getCategoriesOfCheckboxesWithStatus(form, isChecked) {\n let categories = [];\n let checkboxes = isChecked\n ? Array.from(form.querySelectorAll(\"input:checked\"))\n : Array.from(form.querySelectorAll(\"input:not(:checked)\"));\n\n checkboxes.forEach((checkbox) => {\n categories.push(parseInt((checkbox).value));\n });\n\n return categories;\n }\n\n /**\n * @param {string} categoryUid\n * @param {HTMLElement} form\n * @param { boolean} isChecked\n * @returns {*[]}\n */\n getMarkersToChangeVisibilityFor(categoryUid, form, isChecked) {\n let markers = [];\n if (this.allMarkers.length === 0) {\n return markers;\n }\n\n let marker = null;\n let allCategoriesOfMarker = null;\n let categoriesOfCheckboxesWithStatus = this.getCategoriesOfCheckboxesWithStatus(form, isChecked);\n for (let i = 0; i < this.allMarkers.length; i++) {\n marker = this.allMarkers[i];\n allCategoriesOfMarker = marker.poiCollection.categories;\n if (allCategoriesOfMarker.length === 0) {\n continue;\n }\n\n let markerCategoryHasCheckboxWithStatus;\n for (let j = 0; j < allCategoriesOfMarker.length; j++) {\n markerCategoryHasCheckboxWithStatus = false;\n for (let k = 0; k < categoriesOfCheckboxesWithStatus.length; k++) {\n if (allCategoriesOfMarker[j].uid === categoriesOfCheckboxesWithStatus[k]) {\n markerCategoryHasCheckboxWithStatus = true;\n }\n }\n if (markerCategoryHasCheckboxWithStatus === isChecked) {\n break;\n }\n }\n\n if (markerCategoryHasCheckboxWithStatus) {\n markers.push(marker.marker);\n }\n }\n\n return markers;\n }\n\n showSwitchableCategories() {\n let categories = this.groupCategories();\n let form = document.createElement(\"form\");\n form.classList.add(\"txMaps2Form\");\n form.setAttribute(\"id\", \"txMaps2Form-\" + this.getContentRecord().uid);\n\n // Add checkbox for category\n for (let categoryUid in categories) {\n if (categories.hasOwnProperty(categoryUid)) {\n form.appendChild(this.getCheckbox(categories[categoryUid]));\n form.querySelector(\"#checkCategory_\" + categoryUid)?.insertAdjacentHTML(\n \"afterend\",\n `${categories[categoryUid].title}`\n );\n }\n }\n\n // Add listener for checkboxes\n form.querySelectorAll(\"input\").forEach((checkbox) => {\n checkbox.addEventListener(\"click\", () => {\n let isChecked = (checkbox).checked;\n let categoryUid = (checkbox).value;\n let markers = this.getMarkersToChangeVisibilityFor(categoryUid, form, isChecked);\n\n markers.forEach((marker) => {\n if (isChecked) {\n this.map.addLayer(marker);\n } else {\n this.map.removeLayer(marker);\n }\n });\n });\n });\n\n this.element.insertAdjacentElement(\"afterend\", form);\n }\n\n /**\n * @param {Category} category\n * @returns {HTMLElement}\n */\n getCheckbox(category) {\n let div = document.createElement(\"div\");\n div.classList.add(\"form-group\");\n div.innerHTML = `\n
\n \n
`;\n\n return div;\n }\n\n /**\n * @param {object} obj\n * @returns {number}\n */\n countObjectProperties(obj) {\n let count = 0;\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n count++;\n }\n }\n return count;\n }\n\n createPointByCollectionType() {\n let marker;\n let categoryUid = 0;\n\n if (this.poiCollections !== null && this.poiCollections.length) {\n this.poiCollections.forEach(poiCollection => {\n if (poiCollection.strokeColor === \"\") {\n poiCollection.strokeColor = this.getExtConf().strokeColor;\n }\n if (poiCollection.strokeOpacity === \"\") {\n poiCollection.strokeOpacity = this.getExtConf().strokeOpacity;\n }\n if (poiCollection.strokeWeight === \"\") {\n poiCollection.strokeWeight = this.getExtConf().strokeWeight;\n }\n if (poiCollection.fillColor === \"\") {\n poiCollection.fillColor = this.getExtConf().fillColor;\n }\n if (poiCollection.fillOpacity === \"\") {\n poiCollection.fillOpacity = this.getExtConf().fillOpacity;\n }\n\n marker = null;\n switch (poiCollection.collectionType) {\n case \"Point\":\n marker = this.createMarker(poiCollection);\n break;\n case \"Area\":\n marker = this.createArea(poiCollection);\n break;\n case \"Route\":\n marker = this.createRoute(poiCollection);\n break;\n case \"Radius\":\n marker = this.createRadius(poiCollection);\n break;\n }\n\n this.allMarkers.push({\n marker: marker,\n poiCollection: poiCollection\n });\n\n categoryUid = 0;\n for (let c = 0; c < poiCollection.categories.length; c++) {\n categoryUid = poiCollection.categories[c].uid;\n if (!this.categorizedMarkers.hasOwnProperty(categoryUid)) {\n this.categorizedMarkers[categoryUid] = [];\n }\n this.categorizedMarkers[categoryUid].push(marker);\n }\n });\n }\n }\n\n /**\n * @param {number} latitude\n * @param {number} longitude\n */\n createMarkerByLatLng(latitude, longitude) {\n let marker = L.marker(\n [latitude, longitude]\n ).addTo(this.map);\n\n this.bounds.extend(marker.getLatLng());\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Marker}\n */\n createMarker(poiCollection) {\n let marker = L.marker(\n [poiCollection.latitude, poiCollection.longitude],\n {\n 'draggable': this.editable\n }\n ).addTo(this.map);\n\n if (poiCollection.hasOwnProperty(\"markerIcon\") && poiCollection.markerIcon !== \"\") {\n let icon = L.icon({\n iconUrl: poiCollection.markerIcon,\n iconSize: [poiCollection.markerIconWidth, poiCollection.markerIconHeight],\n iconAnchor: [poiCollection.markerIconAnchorPosX, poiCollection.markerIconAnchorPosY]\n });\n marker.setIcon(icon);\n }\n\n this.bounds.extend(marker.getLatLng());\n\n if (this.editable) {\n this.addEditListeners(this.element, marker, poiCollection);\n } else {\n this.addInfoWindow(marker, poiCollection);\n }\n\n return marker;\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Polygon}\n */\n createArea(poiCollection) {\n let latlngs = [];\n\n poiCollection.pois.forEach(poi => {\n let latLng = [poi.latitude, poi.longitude];\n this.bounds.extend(latLng);\n latlngs.push(latLng);\n });\n\n let marker = L.polygon(latlngs, {\n color: poiCollection.strokeColor,\n opacity: poiCollection.strokeOpacity,\n weight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n }).addTo(this.map);\n\n this.addInfoWindow(marker, poiCollection);\n\n return marker;\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Polyline}\n */\n createRoute(poiCollection) {\n let latlngs = [];\n\n poiCollection.pois.forEach(poi => {\n let latLng = [poi.latitude, poi.longitude];\n this.bounds.extend(latLng);\n latlngs.push(latLng);\n });\n\n let marker = L.polyline(latlngs, {\n color: poiCollection.strokeColor,\n opacity: poiCollection.strokeOpacity,\n weight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity\n }).addTo(this.map);\n\n this.addInfoWindow(marker, poiCollection);\n\n return marker;\n }\n\n /**\n * @param {PoiCollection} poiCollection\n * @returns {Circle}\n */\n createRadius(poiCollection) {\n let marker = L.circle([poiCollection.latitude, poiCollection.longitude], {\n color: poiCollection.strokeColor,\n opacity: poiCollection.strokeOpacity,\n weight: poiCollection.strokeWeight,\n fillColor: poiCollection.fillColor,\n fillOpacity: poiCollection.fillOpacity,\n radius: poiCollection.radius\n }).addTo(this.map);\n\n this.bounds.extend(marker.getBounds());\n\n this.addInfoWindow(marker, poiCollection);\n\n return marker;\n }\n\n /**\n * @param {HTMLElement} element\n * @param {PoiCollection} poiCollection\n */\n addInfoWindow(element, poiCollection) {\n element.addEventListener(\"click\", () => {\n fetch(this.environment.ajaxUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n poiCollection: poiCollection.uid\n })\n })\n .then(response => response.json())\n .then(data => {\n element.bindPopup(data.content).openPopup();\n })\n .catch(error => console.error('Error:', error));\n });\n }\n\n /**\n * @param {HTMLElement} mapContainer\n * @param {L.Marker} marker\n * @param {PoiCollection} poiCollection\n */\n addEditListeners(mapContainer, marker, poiCollection) {\n marker.on('dragend', () => {\n let lat = marker.getLatLng().lat.toFixed(6);\n let lng = marker.getLatLng().lng.toFixed(6);\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.latitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", lat);\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.longitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", lng);\n });\n\n this.map.on('click', (event) => {\n marker.setLatLng(event.latlng);\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.latitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", event.latlng.lat.toFixed(6));\n mapContainer\n .previousElementSibling\n ?.querySelector(`input.longitude-${this.getContentRecord().uid}`)\n .setAttribute(\"value\", event.latlng.lng.toFixed(6));\n });\n }\n\n /**\n * return {boolean}\n */\n canBeInterpretedAsNumber(value) {\n return typeof value === 'number' || !isNaN(Number(value));\n }\n\n /**\n * return {ContentRecord}\n */\n getContentRecord() {\n return this.environment.contentRecord;\n }\n\n /**\n * return {ExtConf}\n */\n getExtConf() {\n return this.environment.extConf;\n }\n\n /**\n * return {Settings}\n */\n getSettings() {\n return this.environment.settings;\n }\n}\n\nlet maps2OpenStreetMaps = [];\n\ndocument.querySelectorAll(\".maps2\").forEach((element) => {\n const environment = typeof element.dataset.environment !== 'undefined' ? element.dataset.environment : '{}';\n const override = typeof element.dataset.override !== 'undefined' ? element.dataset.override : '{}';\n\n // Pass in the objects to merge as arguments.\n // For a deep extend, set the first argument to `true`.\n const extend = (...args) => {\n let extended = {};\n let deep = false;\n let i = 0;\n let length = args.length;\n\n // Check for deep merge\n if (Object.prototype.toString.call(args[0]) === '[object Boolean]') {\n deep = args[0];\n i++;\n }\n\n // Merge the object into the extended object\n const merge = function (obj) {\n for ( var prop in obj ) {\n if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {\n // If deep merge and property is an object, merge properties\n if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {\n extended[prop] = extend( true, extended[prop], obj[prop] );\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for ( ; i < length; i++ ) {\n var obj = args[i];\n merge(obj);\n }\n\n return extended;\n };\n\n maps2OpenStreetMaps.push(new OpenStreetMap2(\n element,\n extend(true, JSON.parse(environment), JSON.parse(override))\n ));\n});\n"]} \ No newline at end of file