1function rismap3(ctrl) { 2 var self = this; 3 var curCtrl = ctrl; 4 options = rismap3_global_settings; 5 const mergeObjects = (target, ...sources) => { 6 sources.forEach(source => { 7 for (let key in source) { 8 if (source.hasOwnProperty(key)) { 9 target[key] = source[key]; 10 } 11 } 12 }); 13 return target; 14 }; 15 16 if (ctrl.dataset.map3_settings) { 17 options = mergeObjects(options, JSON.parse(ctrl.dataset.map3_settings)); 18 } 19 var infoWindow; 20 var map; 21 var marker; 22 /*--- Layers ---*/ 23 this.copyrights = []; 24 25 function CoordMapType(tileSize, url, ext) { 26 this.tileSize = tileSize; 27 this.width = tileSize.width + 'px'; 28 this.height = tileSize.height + 'px'; 29 this.url = url; 30 this.ext = ext || '.png'; 31 this.valid = true; 32 } 33 34 this.AddMapTypes = function () { 35 CoordMapType.prototype = new google.maps.MVCObject(); 36 CoordMapType.onerror = function () { this.style.display = 'none'; }; 37 CoordMapType.prototype.getTile = function (coord, zoom, ownerDocument) { 38 var img = ownerDocument.createElement('img'); 39 img.onerror = CoordMapType.onerror; // hide on missing image file 40 img.className = 'mf-gm-tile'; 41 img.src = this.url + zoom.toString() + '/' + coord.y + '/' + coord.x + this.ext; 42 return img; 43 }; 44 var BaseMapOptions = { 45 getTileUrl: function (coord, zoom) { 46 return window.location.protocol + '//mapsneu.wien.gv.at/basemap/geolandbasemap/normal/google3857/' + zoom + '/' + coord.y + '/' + coord.x + '.png' 47 }, 48 tileSize: new google.maps.Size(256, 256), 49 maxZoom: 19, 50 minZoom: 0, 51 name: 'basemap.at' 52 }; 53 var HiDpiBaseMapOptions = { 54 getTileUrl: function (coord, zoom) { 55 return window.location.protocol + '//mapsneu.wien.gv.at/basemap/bmaphidpi/normal/google3857/' + zoom + '/' + coord.y + '/' + coord.x + '.jpeg' 56 }, 57 tileSize: new google.maps.Size(256, 256), 58 maxZoom: 19, 59 minZoom: 0, 60 name: 'basemap.at (HIDPI)' 61 }; 62 var OrthoFotoBaseMapOptions = { 63 getTileUrl: function (coord, zoom) { 64 return window.location.protocol + '//mapsneu.wien.gv.at/basemap/bmaporthofoto30cm/normal/google3857/' + zoom + '/' + coord.y + '/' + coord.x + '.jpeg' 65 }, 66 tileSize: new google.maps.Size(256, 256), 67 maxZoom: 19, 68 minZoom: 0, 69 name: 'basemap.at (OrthoFoto)' 70 }; 71 var GrauBaseMapOptions = { 72 getTileUrl: function (coord, zoom) { 73 return window.location.protocol + '//mapsneu.wien.gv.at/basemap/bmapgrau/normal/google3857/' + zoom + '/' + coord.y + '/' + coord.x + '.png' 74 }, 75 tileSize: new google.maps.Size(256, 256), 76 maxZoom: 19, 77 minZoom: 0, 78 name: 'basemap.at (GRAU)' 79 }; 80 var baseMapType = new google.maps.ImageMapType(BaseMapOptions); 81 var grauBaseMapType = new google.maps.ImageMapType(GrauBaseMapOptions); 82 var hiDpiBaseMapType = new google.maps.ImageMapType(HiDpiBaseMapOptions); 83 var OrthoFotoBaseMapType = new google.maps.ImageMapType(OrthoFotoBaseMapOptions); 84 this.map.mapTypes.set('basemap', baseMapType); 85 this.map.mapTypes.set('hidpi', hiDpiBaseMapType); 86 this.map.mapTypes.set('grau', grauBaseMapType); 87 this.map.mapTypes.set('ortho', OrthoFotoBaseMapType); 88 this.copyrights['basemap'] = "<a target=\"_blank\" rel=\"noopener\" class=\"extlink\" href=\"http://www.basemap.at/\">basemap.at</a>" 89 this.copyrights['hidpi'] = "<a target=\"_blank\" rel=\"noopener\" class=\"extlink\" href=\"http://www.basemap.at/\">basemap.at</a>" 90 this.copyrights['grau'] = "<a target=\"_blank\" rel=\"noopener\" class=\"extlink\" href=\"http://www.basemap.at/\">basemap.at</a>" 91 this.copyrights['ortho'] = "<a target=\"_blank\" rel=\"noopener\" class=\"extlink\" href=\"http://www.basemap.at/\">basemap.at</a>" 92 copyrightDiv = document.createElement("div") 93 copyrightDiv.id = "map-copyright"; 94 copyrightDiv.className = "gm-style-cc mf-basemap"; 95 this.map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(copyrightDiv) 96 if (this.options.tilepath) { 97 var cmt = new CoordMapType(new google.maps.Size(256, 256), this.options.tilepath + 'gmap/Z'); 98 if (cmt.valid) { 99 self.map.overlayMapTypes.insertAt(0, cmt); 100 } 101 } 102 google.maps.event.addListener(this.map, 'maptypeid_changed', function () { 103 self.addCopyright() 104 }); 105 } 106 107 this.addCopyright = function () { 108 if (!copyrightDiv) copyrightDiv = document.getElementById("map-copyright") 109 copyrightDiv.innerHTML = "<span class='mf_copyright'>" + self.localTexts.mapfindercopyright + "</span>"; 110 if (self.map.getMapTypeId() in self.copyrights) 111 copyrightDiv.innerHTML += "<span class='mf_copyright'>" + self.copyrights[self.map.getMapTypeId()] + "</span>"; 112 } 113 /*--- Layers End ---*/ 114 115 this.loadGoogleMaps = function () { 116 if (typeof google === 'object' && typeof google.maps === 'object') { 117 self.setUpMap(curCtrl); 118 } else { 119 var apiUrl = options.protocol + "maps.googleapis.com/ma
119ps/api/js?key=" + options.googleApiKey + "&libraries=geometry,places,drawing&v=3"; 120 var loaderUrl = options.protocol + "www.google.com/jsapi"; 121 self.loadGoogleMapsScripts(apiUrl, loaderUrl); 122 } 123 } 124 125 this.setUpMap = function (ctrl) { 126 var loc = JSON.parse(ctrl.dataset.map3_pin); 127 this.localTexts = { 128 mapfindercopyright: '@2021 GEM2GO Map der RIS GmbH' 129 }; 130 if (options.showbasemap) 131 mapoptions = { 132 mapTypeIds: [google.maps.MapTypeId.ROADMAP, 133 google.maps.MapTypeId.SATELLITE, 134 'basemap', 135 'grau', 136 'hidpi', 137 'ortho', 138 google.maps.MapTypeId.TERRAIN, 139 google.maps.MapTypeId.HYBRID], 140 defaultMaptypId: 'satellite' 141 }; 142 else 143 mapoptions = { 144 mapTypeIds: [google.maps.MapTypeId.ROADMAP, 145 google.maps.MapTypeId.SATELLITE, 146 google.maps.MapTypeId.TERRAIN, 147 google.maps.MapTypeId.HYBRID], 148 defaultMaptypId: 'satellite' 149 }; 150 mapoptions = mergeObjects({ 151 zoom: options.zoom, 152 zoomControlOptions: { 153 position: google.maps.ControlPosition.RIGHT_BOTTOM 154 }, 155 center: { lat: loc.lat, lng: loc.lng }, 156 mapTypeId: mapoptions.defaultMaptypId, 157 streetViewControl: false, 158 scaleControl: true, 159 overviewMapControl: true, 160 fullscreenControl: false, 161 mapTypeControlOptions: { 162 position: google.maps.ControlPosition.TOP_RIGHT, 163 style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, 164 mapTypeIds: mapoptions.mapTypeIds 165 }, 166 }, options); 167 this.options = mapoptions; 168 169 mapoptions.mapTypeId = this.options.defaultlayer; 170 171 this.map = new google.maps.Map(ctrl, mapoptions); 172 this.AddMapTypes(); 173 174 var pos = { 175 lat: loc.lat, 176 lng: loc.lng 177 }; 178 this.marker = new google.maps.Marker({ 179 position: pos, 180 map: this.map, 181 draggable: false, 182 }); 183 if (loc.description) { 184 var description = loc.description; 185 var content = "<strong>" + description.titel + "</strong>"; 186 if (description.strasse) 187 content += "<br />" + description.strasse + " "; 188 if (description.hnr) 189 content += description.hnr; 190 if (description.plz || description.ortname) 191 content += "<br />"; 192 if (description.plz) 193 content += description.plz; 194 if (description.ortname) { 195 if (description.plz) 196 content += " "; 197 content += description.ortname; 198 } 199 this.infoWindow = new google.maps.InfoWindow({ 200 content: content 201 }); 202 } 203 this.marker.addListener('click', function () { 204 self.infoWindow.open(self.map, self.marker); 205 }); 206 this.map.panTo(pos); 207 setTimeout(this.addCopyright, 50) 208 } 209 210 this.initialiseRisMap3 = function () { 211 if (options.clicktostart === false) { 212 self.loadGoogleMaps(); 213 } else { 214 self.addGoogleClickDiv(curCtrl); 215 } 216 } 217 218 this.addGoogleClickDiv = function (ctrl) { 219 var clkDiv = document.createElement('div'); 220 clkDiv.className = 'mfClickToLoadWrapper'; 221 var innerDiv = document.createElement('div'); 222 innerDiv.className = 'mfClickToLoad'; 223 innerDiv.innerHTML = "<p class='mapIcon'></p><p>" + options.clickMessage + "</p>"; 224 clkDiv.appendChild(innerDiv); 225 226 clkDiv.addEventListener('click', function () { 227 ctrl.removeChild(clkDiv); 228 self.loadGoogleMaps(); 229 }); 230 231 ctrl.appendChild(clkDiv); 232 } 233 234 this.loadGoogleMapsScripts = function (apiUrl, loaderUrl) { 235 var apiScript = document.createElement("script"); 236 apiScript.id = "apiScript" 237 apiScript.type = "text/javascript"; 238 apiScript.src = apiUrl; 239 document.getElementsByTagName('head')[0].appendChild(apiScript); 240 apiScript.onload = function () { 241 var loaderScript = document.createElement("script");
242 loaderScript.id = "loaderScript" 243 loaderScript.type = "text/javascript"; 244 loaderScript.src = loaderUrl; 245 document.getElementsByTagName('head')[0].appendChild(loaderScript); 246 loaderScript.onload = function () { 247 self.setUpMap(curCtrl); 248 } 249 } 250 } 251} 252 253function initializeMaps() { 254 var mapdivs = document.querySelectorAll(".rismap3_map, .bemContainer--mapPlaceholder"); 255 mapdivs.forEach(function (mapdiv) { 256 var lf = new rismap3(mapdiv); 257 lf.initialiseRisMap3(); 258 }); 259} 260 261document.addEventListener("DOMContentLoaded", initializeMaps);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.