var plzsuche = { config: { url: 'http://www.postdirekt.de', port: '', plz_url: 'http://www.postdirekt.de', i18n_url: 'http://www.postdirekt.de/DeutschePost_PLZ_Suche/i18n/' } }; /** * Erzeugt eine neue Extension. * * @class Eine Extension-Klasse für die Deutsche Post GmbH. * * @param {String} * mapDIV Der DIV-Name für die Karte. * * @author Jan Oliver Zieger */ function IExtension(mapDIV) { // ******************************************************************** // * Setze globale Extension // ******************************************************************** iExtension = this; // ******************************************************************** // * Konstanten // ******************************************************************** var TOOLBAR_I18N_KEYS = { 'bing_mapdispatcher': 'plzsuche_maptype_roadmap', 'aerialview': 'plzsuche_maptype_air', 'bing_hybrid': 'plzsuche_maptype_hybrid' }; // Die URL der PLZ-Suche var PLZ_URL = plzsuche.config.plz_url + "/plzserver/PlzAjaxServlet?"; // Die globale URL der Anwendung //var GLOBAL_APP_URL = "http://gis3.infoware.de/DeutschePost_PLZ_Suche/"; // alt var GLOBAL_APP_URL = "../DeutschePost_PLZ_Suche/"; // auf gis3 produktiv //var GLOBAL_APP_URL = plzsuche.config.url + plzsuche.config.port + "/DeutschePost_PLZ_Suche/"; // XXX wie von olli var I18N_URL = plzsuche.config.i18n_url; var STREET_TYPE = "streets"; var DISTCRICT_TYPE = "districts"; var CITY_TYPE = "city"; var MAP_MAX_ZOOM = 15; var MAP_MIN_ZOOM = 4; var SELECTED_PLZ_OPACITY = 48; // [0 - 100] // ******************************************************************** // * private Variablen // ******************************************************************** var infoBalloon; var map; var lastlatlon; var currentPolygons; var plzPolylineArray; var plzExtentArray; var drawingContainer; var renderer; var currentPLZ; var currentMapTypeName; var currentMapTypeNode; var language = null; iCallBack = null; // ******************************************************************** // * Public Methoden // ******************************************************************** /** * Initialisiert die Extension und erzeugt die Karte. */ this.initialize = function(lang) { if (mapDIV == null) { mapDIV = "map"; } // Hier muss die ID der Deutschen Post rein bzw. der Token für BING! IWAccessFilter.setCNR(0); IWAccessFilter.setPNR(3); plzPolylineArray = new Array(); plzExtentArray = new Array(); map = new IWMap(document.getElementById(mapDIV)); map.getOptions().setMouseWheelAction(IWMapOptions.CONTROL_NONE); map.getOptions().setLanguage(lang ? lang : 'de'); /** * Hack: Das IWCopyrightControl wird nicht richtig gesetzt, da die Map zunächst nicht sichtbar ist (display: * none) und somit vom Span die OffsetWidth und OffsetHeight nicht berechnet werden können (sind beide 0). Daher * müssen hier alle Werte manuell gesetzt werden. Wenn sich der Copyright-Schriftzug ändern sollte, müssen die * Werte entsprechend angepasst werden! */ try { var copyright = document.getElementById("IWCopyrightControl"); copyright.style.top = "430px"; copyright.style.left = "749px"; copyright.style.width = "176px"; copyright.style.height = "15px"; } catch (e) { } // maximalen und minimalen Zoomlevel setzen map.getCurrentMapType().setMaxLevel(MAP_MAX_ZOOM); map.getCurrentMapType().setMinLevel(MAP_MIN_ZOOM); // Vor dem Zoomen das PLZ-Gebiet löschen IWEventManager.addListener(map, 'onzoomstart', hideExtent); // Nach dem Zoomen und Verschieben das PLZ-Gebiet rendern IWEventManager.addListener(map, 'onzoomend', drawExtent); IWEventManager.addListener(map, 'onmoveend', drawExtent); // Map zentrieren und zoomen map.setCenter(new IWCoordinate(10.271991417064294, 51.35789567400107, IWCoordinate.WGS84), 5); IWEventManager.addListener(map, 'oninitialize', function() { // Erzeuge Renderer drawingContainer = map.getDrawingContainer(); renderer = new IWGraphics(drawingContainer); var opacity = new IWOpacityControl(map, GLOBAL_APP_URL); opacity.smoothSlide(true); opacity.addElementByID("IWLabels"); opacity.addElementByID("IWLabelsLoad"); // ganze Map ein- und ausblenden // opacity.addElementByDIVID("IWTiles"); // add some controls map.getLayoutManager().getLayer(0).setBorder(5, 5); var scalarControl = new IWScalarControl(map); scalarControl.setDarkImage(GLOBAL_APP_URL + 'img/646464.gif'); scalarControl.setBrightImage(GLOBAL_APP_URL + 'img/e8e8e8.gif'); scalarControl.setSeparatorImage(GLOBAL_APP_URL + 'img/646464.gif'); map.getLayoutManager().getLayer(0).addControl(scalarControl, IWAlignment.LEFT, IWAlignment.BOTTOM); var navigationControl = new IWNavigationControl(map); navigationControl.setNavigationImage(GLOBAL_APP_URL + 'img/navigation_big/steuerkreuz2.png'); map.getLayoutManager().getLayer(0).addControl(navigationControl, IWAlignment.RIGHT, IWAlignment.TOP, 0, 0); var sliderControl = new IWSliderControl(map); sliderControl.setSliderImage(GLOBAL_APP_URL + 'img/navigation_big/slider_new2.png'); sliderControl.setSliderButtonImage(GLOBAL_APP_URL + 'img/navigation_big/slider_button_new2.png'); map.getLayoutManager().getLayer(0).addControl(sliderControl, IWAlignment.RIGHT, IWAlignment.TOP, 19, 0); // create a toolbar control and add it to the map var toolbar = createToolbar(map); map.getLayoutManager().getLayer(0).addControl(toolbar, IWAlignment.TOP, IWAlignment.LEFT); map.getLayoutManager().getLayer(0).addControl(opacity, IWAlignment.RIGHT, IWAlignment.TOP, 0, 15); }); IWEventManager.addListener(map, 'onclick', function(event) { try { var projection = map.getCurrentMapType().getProjection(); var mercator = projection.pixelToMeter(event.position); lastlatlon = mercator.toWGS84(); requestPLZExtend(mercator, function() { requestPLZMetadata(lastlatlon, mercator, currentPLZ); } ); } catch (e) { } }); // I18N var languagePack = new IWLanguagePack(); languagePack.addLanguage(new IWLanguage('de', I18N_URL + 'plzsuche_de.properties')); languagePack.addLanguage(new IWLanguage('en', I18N_URL + 'plzsuche_en.properties')); IWMultiLanguageSupport.call(this, map, languagePack); IWEventManager.addListener(this, 'onlanguagepackload', function(event) { language = event.language; var roadmap = document.getElementById('bing_mapdispatcher'); if (roadmap) roadmap.title = roadmap.alt = language.get(TOOLBAR_I18N_KEYS['bing_mapdispatcher']); var aerial = document.getElementById('aerialview'); if (aerial) aerial.title = aerial.alt = language.get(TOOLBAR_I18N_KEYS['aerialview']); var hybrid = document.getElementById('bing_hybrid'); if (hybrid) hybrid.title = hybrid.alt = language.get(TOOLBAR_I18N_KEYS['bing_hybrid']); }); this.loadLanguagePack(map.getOptions().getLanguage()); }; /** * @private */ this.getMap = function() { return map; }; /** * @private */ this.getLanguage = function() { return language; }; /** * Legt die Sprache für Popups und Tooltips fest * * @param lang Sprachcode nach ISO 639-1; derzeit werden de (deutsch) und en (englisch) unterstützt. */ this.setLanguage = function(lang) { map.getOptions().setLanguage(lang); }; /** * Über diese Registrierungsmethode kann sich eine ICallBack-Implementierung an der Extension registrieren, um * bei gewissen Statusänderungen informiert zu werden. * * @param iCallback * Eine Referenz auf eine ICallBack-Implementierung. */ this.registerCallBack = function(iCallback) { if (iCallback != null && iCallback.CLASS_NAME == "ICallBack") { iCallBack = iCallback; } }; /** * Diese Methode zoomt in der Karte auf das übergebene PLZ-Gebiet, markiert das Extent und öffnet das * Popup mit den Metainformationen zum PLZ-Gebiet. * * @param postalCode * Die PLZ. * @param city * Die Stadt. * @param cityAddon * Der Ortszusatz. * @param district * Der Ortsteil. * @param streetName * Der Straßenname. * @param x * Die x-Koordinate für das Popup. * @param y * Die y-Koordinate für das Popup. * @param listCities * Soll ein Verweis auf die Orte aufgeführt werden? {true,false} * @param listDistricts * Soll ein Verweis auf die Ortsteile aufgeführt werden? {true,false} * @param listStreets * Soll ein Verweis auf die Straßen aufgeführt werden? {true,false} * @param number * Eine optionale Nummer aus der Tabelle (wird bisher nicht verarbeitet). * @param houseNumber * Eine optionale Hausnummer (wird bisher nicht verarbeitet). * @param customName * Ein beliebig waehlbarer Name fuer einen Großempfaenger oder Postlageradressen. * @param customPostalCode * Die PLZ zum Parameter customName, falls von der Adress-PLZ abweichend. */ this.zoomTo = function(postalCode, city, cityAddon, district, streetName, x, y, listCities, listDistricts, listStreets, number, houseNumber, customName, customPostalCode) { if (city == null) { city = ""; } // geschütztes Leerzeichen setzen city = city.replace(/\u0020/g, " "); district = district.replace(/\u0020/g, " "); streetName = streetName.replace(/\u0020/g, " "); if (postalCode == null || postalCode == '' || postalCode.length != 5) throw "Übergebende PLZ ist nicht richtig gesetzt!"; if (x == null || x == '' || y == null || y == '') throw "Die Koordinaten wurden nicht richtig gesetzt!"; lastlatlon = new IWCoordinate(x, y, IWCoordinate.WGS84); var mercator = lastlatlon.toMercator(); currentPLZ = postalCode; var callback = function() { showPopup(postalCode, city, cityAddon, district, streetName, mercator, listCities, listDistricts, listStreets, customName, customPostalCode); }; requestPLZExtend(mercator, callback); }; /** * Zugriff auf die zuletzt gesetzte WGS84-Koordinate vom Typ "IWCoordinate". * * @returns {IWCoordinate} Eine WGS84-Koordinate. */ this.getLastLatLon = function() { return lastlatlon; }; // ******************************************************************** // * Private Methoden // ******************************************************************** function requestPLZExtend(mercator, callback) { var xmlHttp = createXMLHttpObject(); if (xmlHttp) { var request = 'x=' + mercator.getX() + "&y=" + mercator.getY(); var url = GLOBAL_APP_URL + 'WFSProxy\?' + request; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.responseText != '') { requestPLZExtendCallBack(xmlHttp.responseText, mercator); if (callback) callback(); } }; xmlHttp.send(null); } } function requestPLZExtendCallBack(responseText, mercator) { var json = eval(responseText); if (json && json.PLZ) { currentPLZ = json.PLZ.zipCode; var lc = json.PLZ.lowerCorner.split(' '); var uc = json.PLZ.upperCorner.split(' '); var lcX = parseInt(lc[0]); var lcY = parseInt(lc[1]); var ucX = parseInt(uc[0]); var ucY = parseInt(uc[1]); // Offset zum Vergrößern der Boundingbox var offsetX = Math.abs(lcX - ucX) * 0.025; var offsetY = Math.abs(lcY - ucY) * 0.025; var center = new IWCoordinate((lcX + ucX) / 2.0, (lcY + ucY) / 2.0); var nw = new IWCoordinate(lcX - offsetX, ucY + offsetY); var se = new IWCoordinate(ucX + offsetX, lcY - offsetY); var zoom = map.getBoundsZoomlevel(new IWBounds(nw, se)); map.setCenter(center, zoom, map.getCurrentMapType()); currentPolygons = json.PLZ.polygon; drawExtent(); } } function requestPLZMetadata(wgs84, mercator, zipCode) { var xmlHttp = createXMLHttpObject(); if (xmlHttp) { // Es kann der Postdirekt-Server nicht über JS angesprochen werden, daher der Weg über ein Servlet var serverURL = PLZ_URL + 'x=' + wgs84.getX() + "&y=" + wgs84.getY() + "&zip=" + zipCode; var url = GLOBAL_APP_URL + 'PLZProxyServlet\?serverURL=' + escape(serverURL); xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { requestPLZMetadataCallBack(xmlHttp.responseText, mercator); } }; xmlHttp.send(null); } } function requestPLZMetadataCallBack(responseText, mercator) { if (responseText == '') { return; } // JSON muss in Klammern stehen (der PLZ-Server liefert das nicht) responseText = "(" + responseText + ")"; var json = eval(responseText); if (json != null && json.plz != null) { // Leider wurden hier die Koordinaten lat/lon vertauscht if (!mercator) { mercator = new IWCoordinate(json.c_lat, json.c_lng, IWCoordinate.WGS84).toMercator(); } showPopup(json.plz, json.city, '', json.district, json.street, mercator, json.l_cities, json.l_districts, json.l_streets); // Aufruf des ICallBack-Interfaces für die Deutsche Post if (iCallBack) iCallBack.mouseClickCallBack(lastlatlon.getY(), lastlatlon.getX(), json.plz); else alert("Das iCallBack wurde nicht registriert!"); } } /** * (Re)draws the plz. */ function drawExtent() { hideExtent(); if (currentPolygons == null) return; var projection = map.getCurrentMapType().getProjection(); var offsetX = parseInt(drawingContainer.parentNode.style.left); var offsetY = parseInt(drawingContainer.parentNode.style.top); var minx = Number.MAX_VALUE; var maxx = -Number.MAX_VALUE; var miny = Number.MAX_VALUE; var maxy = -Number.MAX_VALUE; var pixelPolygon = []; for (var j = 0; j < currentPolygons.length; j++) { var plzPoly = currentPolygons[j]; var meterCoords = plzPoly.posList.split(";"); var pixelArray = []; for (var i = 0; i < meterCoords.length; i++) { var meterCoord = meterCoords[i].split(' '); var pixelXY = projection.meterToPixelXY(parseFloat(meterCoord[0]), parseFloat(meterCoord[1])); pixelXY.x = parseInt(pixelXY.x); pixelXY.y = parseInt(pixelXY.y); minx = Math.min(minx, pixelXY.x); maxx = Math.max(maxx, pixelXY.x); miny = Math.min(miny, pixelXY.y); maxy = Math.max(maxy, pixelXY.y); pixelArray.push(pixelXY); } pixelPolygon.push(pixelArray); } var size = map.getOptions().getSize(); var clipMinX = -800; var clipMaxX = size.getWidth() + 800; var clipMinY = -800; var clipMaxY = size.getHeight() + 800; for ( var c = 0; c < pixelPolygon.length; c++) { var points = ''; pixelArray = pixelPolygon[c]; var lastX = Number.MAX_VALUE; var lastY = Number.MAX_VALUE; for (var k = 0; k < pixelArray.length; k++) { var x = Math.min(clipMaxX, Math.max(clipMinX, pixelArray[k].x)) - minx; var y = Math.min(clipMaxY, Math.max(clipMinY, pixelArray[k].y)) - miny; if (x != lastX || y != lastY) points += x + ', ' + y + ' '; lastX = x; lastY = y; } try { var plzExtent = renderer.drawPolygon(points, 0, '#000000', '#FFD700'); /** * Antialias setzen */ var parent = plzExtent.parentNode; if (parent) { if (parent.setAttributeNS) { // Firefox (auto | optimizeSpeed | crispEdges | geometricPrecision | inherit) parent.setAttributeNS(null, 'shape-rendering', 'geometricPrecision'); } else { // IE (geht bisher nicht) parent.antialias = 'true'; parent.setAttribute('antialias', 'true', ''); } } plzExtent.style.opacity = '' + SELECTED_PLZ_OPACITY / 100.0; plzExtent.style.filter = 'alpha(opacity=' + SELECTED_PLZ_OPACITY + ')'; plzExtent.parentNode.style.position = 'absolute'; plzExtent.parentNode.style.left = (-offsetX + minx) + 'px'; plzExtent.parentNode.style.top = (-offsetY + miny) + 'px'; plzExtent.parentNode.style.width = parseInt(maxx - minx) + 'px'; plzExtent.parentNode.style.height = parseInt(maxy - miny) + 'px'; plzExtentArray.push(plzExtent); } catch (e) { } try { // Auch Linien rendern, um die Grenze auf volle Opacität zu setzen var plzPolyline = renderer.drawPolyline(points, 2, '#000000'); plzPolyline.style.opacity = '1.0'; plzPolyline.style.filter = 'alpha(opacity=100)'; plzPolyline.parentNode.style.position = 'absolute'; plzPolyline.parentNode.style.left = (-offsetX + minx) + 'px'; plzPolyline.parentNode.style.top = (-offsetY + miny) + 'px'; plzPolyline.parentNode.style.width = parseInt(maxx - minx) + 'px'; plzPolyline.parentNode.style.height = parseInt(maxy - miny) + 'px'; plzPolylineArray.push(plzPolyline); } catch (e) { } } } /** * Blendet das PLZ-Extent aus. */ function hideExtent() { // ******************************************************************** // * Löscht alle SVGs/VMLs-Knoten aus dem Container. // ******************************************************************** if (plzExtentArray != null) { for ( var i = 0; i < plzExtentArray.length; i++) { var plzExtent = plzExtentArray[i]; iw.remove(plzExtent); } plzExtentArray = new Array(); } if (plzPolylineArray != null) { for ( var i = 0; i < plzPolylineArray.length; i++) { var plzPolyline = plzPolylineArray[i]; iw.remove(plzPolyline); } plzPolylineArray = new Array(); } } function showPopup(zip, city, addon, district, street, mercator, listCities, listDistricts, listStreets, customName, customZip) { if (infoBalloon != null) { map.removeWindowOverlay(infoBalloon); infoBalloon.destroy(); infoBalloon = null; } var content; if (customName || customZip) { content = createCustomContent(zip, city, addon, district, street, listCities, listDistricts, listStreets, customName, customZip); } else { content = createContent(zip, city, addon, district, street, listCities, listDistricts, listStreets); } infoBalloon = new DPInfoBalloon(map, mercator, content); if (infoBalloon.setAutoPan) { infoBalloon.setAutoPan(true); } infoBalloon.setSize(new IWSize(parseInt(content.style.width), parseInt(content.style.height))); map.addWindowOverlay(infoBalloon); } function createContent(zip, city, addon, district, street, listCities, listDistricts, listStreets) { if (city == null || city == "null") // City war einmnal null { city = ""; } var escape = '\',\''; var br = '
'; var minHeight = 60; var html = ''; html += '' + zip + ' ' + city + ' ' + addon + '
'; if (district != null && district.length > 0) html += language.get('plzsuche_popup_district') + ': ' + district + br; if (street != null && street.length > 0) html += language.get('plzsuche_popup_street') + ': ' + street + br; html += br; // DIV für den oberen Label erzeugen, um die Größe zu bestimmen var plzLabelDIV = iw.create('div'); plzLabelDIV.style.position = 'relative'; plzLabelDIV.innerHTML = html; if (listCities != null && (listCities == true || listCities == "true") && iCallBack) { // Aufruf des ICallBack-Interfaces für die Deutsche Post var callBackLink = ''; html += callBackLink + '> ' + language.get('plzsuche_popup_citiesTo') + ' ' + zip + ' ' + city + '' + br; } if (listDistricts != null && (listDistricts == true || listDistricts == "true") && iCallBack) { // Aufruf des ICallBack-Interfaces für die Deutsche Post var callBackLink = ''; html += callBackLink + '> ' + language.get('plzsuche_popup_districtsTo') + ' ' + zip + ' ' + city + '' + br; } if (listStreets != null && (listStreets == true || listStreets == "true") && iCallBack) { // Aufruf des ICallBack-Interfaces für die Deutsche Post var callBackLink = ''; var text = ' ' + language.get('plzsuche_popup_streetsTo') + ' ' + zip + ' ' + city; html += callBackLink + '>' + text.replace(/\u0020/g, ' '); if (district != null && district.length > 0) { html += ", " + district; } html += ''; } var contentDiv = iw.create('div'); contentDiv.style.position = 'relative'; contentDiv.innerHTML = html; var size = IWDOMHelper.getSize(contentDiv); contentDiv.style.height = Math.max(minHeight, size.getHeight()) + 'px'; var sizePLZLabelDIV = IWDOMHelper.getSize(plzLabelDIV); var width = 20 + Math.max(10 + sizePLZLabelDIV.getWidth(), size.getWidth()); contentDiv.style.width = width + 'px'; return contentDiv; } function createCustomContent(zip, city, addon, district, street, listCities, listDistricts, listStreets, customName, customPostalCode) { // City war einmnal null if (city == null || city == "null") { city = ""; } var escape = '\',\''; var br = '
'; var minHeight = 60; var html = ''; if (customName != null && customName.length > 0) html += '' + customName + '
'; if (customPostalCode != null && customPostalCode.length > 0) html += '' + customPostalCode + ' ' + city + '

'; if (street != null && street.length > 0) html += street + br; // concatenate all parts, trim unnecessary blanks and make all white spaces non breakable var complete = iw.trim((iw.trim(iw.trim((zip ? zip : '') + ' ' + (city ? city : '')) + ' ' + (addon ? addon : '')) + ' ' + (district ? district : ''))).replace(/\s/g, ' '); html += '' + complete + ''; // DIV für den oberen Label erzeugen, um die Größe zu bestimmen var plzLabelDIV = iw.create('div'); plzLabelDIV.style.position = 'relative'; plzLabelDIV.innerHTML = html; var contentDiv = iw.create('div'); contentDiv.style.position = 'relative'; contentDiv.innerHTML = html; var size = IWDOMHelper.getSize(contentDiv); contentDiv.style.height = Math.max(minHeight, size.getHeight()) + 'px'; var sizePLZLabelDIV = IWDOMHelper.getSize(plzLabelDIV); var width = 20 + Math.max(20 + sizePLZLabelDIV.getWidth(), size.getWidth()); // WTF? contentDiv.style.width = width + 'px'; return contentDiv; } /** * Erzeugt ein XMLHttpRequest-Object (Browserabhängig) * * @returns XMLHttpRequest. */ function createXMLHttpObject() { var xmlHttp = null; try { // Mozilla, Opera, Safari sowie Internet Explorer (ab v7) xmlHttp = new XMLHttpRequest(); } catch (e) { try { // MS Internet Explorer (ab v6) xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { // MS Internet Explorer (ab v5) xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = null; } } } return xmlHttp; } /** * Erzeugt eine Toolbar für die Luftbild- und Hybridansicht. * * @return {IWToolbarControl} */ function createToolbar(map) { var toolbar = new IWToolbarControl(map); var leftBorder = new IWToolbarItem('leftBorder'); var rightBorder = new IWToolbarItem('rightBorder'); currentMapTypeName = 'bing_mapdispatcher'; var item3 = new IWToolbarItem('bing_hybrid'); var item2 = new IWToolbarItem('aerialview'); var item1 = new IWToolbarItem(currentMapTypeName); currentMapTypeNode = item1; IWEventManager.addListener(toolbar, 'onappendstart', function(e) { formatToolbarItem(e.item); }); IWEventManager.addListener(toolbar, 'onmouseover', function(e) { formatOnMouseOver(e.item); }); IWEventManager.addListener(toolbar, 'onmouseout', function(e) { formatOnMouseOut(e.item); }); IWEventManager.addListener(toolbar, 'onclick', function(e) { var mapType = map.getOptions().getMapTypeByName(e.item.getName()); if (mapType && mapType != map.getCurrentMapType()) { currentMapTypeName = e.item.getName(); formatOnMouseOut(currentMapTypeNode); currentMapTypeNode = e.item; map.setCenter(map.getCenter(), map.getZoom(), mapType); } }); try { toolbar.addItem(leftBorder); toolbar.addItem(item1); toolbar.addItem(item2); toolbar.addItem(item3); toolbar.addItem(rightBorder); } catch (e) { alert(e); } return toolbar; } /** * Formatiert ein Toolbar-Item. */ function formatToolbarItem(item) { if (item.getName() == 'leftBorder') { var img = iw.create('img'); img.style.position = 'absolute'; img.style.top = '0px'; img.style.width = '3px'; img.style.height = '38px'; img.src = GLOBAL_APP_URL + 'img/switchmap/switch_map_01.png'; item.setNode(img); } else if (item.getName() == 'rightBorder') { var img = iw.create('img'); img.style.position = 'absolute'; img.style.top = '0px'; img.style.width = '3px'; img.style.height = '38px'; img.src = GLOBAL_APP_URL + 'img/switchmap/switch_map_05.png'; item.setNode(img); } else { var div = document.createElement('div'); div.id = item.getName(); div.style.position = 'absolute'; div.style.top = '0px'; div.style.height = '38px'; div.style.width = '50px'; if (language) { div.title = div.alt = language.get(TOOLBAR_I18N_KEYS[item.getName()]); } var image = document.createElement('img'); div.appendChild(image); image.style.width = '50px'; image.style.height = '38px'; var label = document.createElement('div'); div.appendChild(label); label.style.position = 'absolute'; label.style.left = '0px'; label.style.top = '37px'; label.style.width = '50px'; label.style.height = '21px'; item.setNode(div); formatOnMouseOut(item); } } /** * Setzt normale Bilder in der Toolbar, wenn die Maus sich weg bewegt. */ function formatOnMouseOut(item) { var image = item.getNode().firstChild; var label = image.nextSibling; label.innerHTML = ''; switch (item.getName()) { case 'bing_hybrid': if (currentMapTypeName == 'bing_hybrid') { image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map2_04.png'; } else { image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map_04.png'; } break; case 'bing_mapdispatcher': if (currentMapTypeName == 'bing_mapdispatcher') { image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map2_02.png'; } else { image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map_02.png'; } break; case 'aerialview': if (currentMapTypeName == 'aerialview') { image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map2_03.png'; } else { image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map_03.png'; } break; } } /** * Setzt größere Bilder in der Toolbar, wenn die Maus sich auf die Toolbar bewegt. */ function formatOnMouseOver(item) { var image = item.getNode().firstChild; var label = image.nextSibling; switch (item.getName()) { case 'bing_hybrid': image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map2_04.png'; break; case 'bing_mapdispatcher': image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map2_02.png'; break; case 'aerialview': image.src = GLOBAL_APP_URL + 'img/switchmap/switch_map2_03.png'; break; } } }