//";
}
if( xml.documentElement.getElementsByTagName("node")[0].getAttribute('ip').split( ",")[1]) {
batmanip += "Batman: " + xml.documentElement.getElementsByTagName("node")[0].getAttribute('ip').split( ",")[1] + "
";
}
ips += olsrip + batmanip;
if( ips != "") ips += "
";
}
var antennaDescription = "";
if( xml.documentElement.getElementsByTagName("antenna")[0]) {
// parse the antenna informations
var antenna = xml.documentElement.getElementsByTagName("antenna")[0];
if( antenna.getAttribute('type') != "") antennaDescription += "Antenna typ: " + antenna.getAttribute('type') + "
";
if( antenna.getAttribute('gain') != "") antennaDescription += "Antenna gain: " + antenna.getAttribute('gain') + "dBi
";
if( antenna.getAttribute('angp') != "") antennaDescription += "Beam width (with polarization): " + antenna.getAttribute('angp') + "°
";
if( antenna.getAttribute('ango') != "") antennaDescription += "Beam width (perpendicular to polarization): " + antenna.getAttribute('ango') + "°
";
if( antenna.getAttribute('vpos') != "") antennaDescription += "Height: " + antenna.getAttribute('vpos') + "m
";
if( antenna.getAttribute('hdir') != "") antennaDescription += "Direction: " + antenna.getAttribute('hdir') + "°
";
if( antenna.getAttribute('vdir') != "") antennaDescription += "Tilt: " + antenna.getAttribute('vdir') + "°
";
if( antenna.getAttribute('pole') != "") antennaDescription += "Polarization: " + antenna.getAttribute('pole') + "
";
}
textInfoWindow = "" + nodeDescription + "
" + ips + antennaDescription + "
"; ffnode.openInfoWindowHtml( textInfoWindow); }); } }); return ffnode; } function createZoomNode( point, type) { var icon = new GIcon( mediumicon); if( map.getZoom() < 14) icon = new GIcon( smallicon); if( type == "old") { icon = new GIcon( mediumiconOld); if( map.getZoom() < 14) icon = new GIcon( smalliconOld); } else if( type == "batman") { icon = new GIcon( mediumblackicon); if( map.getZoom() < 14) icon = new GIcon( smallblackicon); } var ffnode = new PdMarker( point, { icon: icon, title: "zoom in" }); ffnode.setCursor("\"url(freifunkmap_gfx/lens.gif), move\""); GEvent.addListener(ffnode, 'click', function() { map.setCenter( point, map.getZoom() + 1); }); return ffnode; } function startMeassureDistance( point, ffnode) { map.removeOverlay( distPolyline); distPolyline = false; textInfoWindow = "Start"; if( ffnode) { ffnode.openInfoWindowHtml( textInfoWindow); } else { map.openInfoWindowHtml( point, document.createTextNode( textInfoWindow )); } pointOld = point; } function endMeassureDistance( point, ffnode) { var gPointOld = new GLatLng( pointOld.y, pointOld.x, true); var gPointNew = new GLatLng( point.y, point.x, true); distPolyline = new GPolyline( [ gPointOld, gPointNew ], "#FF0000", 3); map.addOverlay( distPolyline); var distance = gPointOld.distanceFrom( gPointNew); textInfoWindow = "Distance: " + Math.round( distance) + " m"; if( ffnode) { ffnode.openInfoWindowHtml( textInfoWindow ); } else { map.openInfoWindowHtml( point, document.createTextNode( textInfoWindow )); } pointOld = false; } function placeConnections() { if( showConn) { for( var i = 0; i < connPolylines.length; i++) { map.addOverlay( connPolylines[i]); } } else { for( var i = 0; i < connPolylines.length; i++) { map.removeOverlay( connPolylines[i]); } } } function placeLQ() { if( lqPlaced) { map.getPane( G_MAP_MAP_PANE).appendChild( connLQ); showLQ = true; } else { if( connLQ && showLQ) { map.getPane( G_MAP_MAP_PANE).removeChild( connLQ); showLQ = false; } } } function RulerControl() { } RulerControl.prototype = new GControl(); RulerControl.prototype.initialize = function( map) { var container = document.createElement( "div"); container.title = "meassure distance"; var rulerImg = document.createElement( "img"); rulerImg.src = "freifunkmap_gfx/ruler.png"; rulerImg.width = "34"; rulerImg.height = "17"; rulerImg.style.border = "1px solid black"; rulerImg.style.cursor = "pointer"; container.appendChild( rulerImg); GEvent.addDomListener( rulerImg, "click", function() { if( measureDistances) { measureDistances = false; rulerImg.src = "freifunkmap_gfx/ruler.png"; map.removeOverlay( distPolyline); distPolyline = false; } else { measureDistances = true; rulerImg.src = "freifunkmap_gfx/ruler_selected.png"; } }); map.getContainer().appendChild(container); return container; } RulerControl.prototype.getDefaultPosition = function() { return new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 207, 7)); } function FAQControl() { } FAQControl.prototype = new GControl(); FAQControl.prototype.initialize = function( map) { var container = getDefaultControlContainer( "frequently asked questions"); var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "FAQ")); container.appendChild( innerDiv); GEvent.addDomListener( container, "click", function() { innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; faqwindow = window.open( "freifunkmap.faq.en.html", "MapFAQ", "scrollbars=yes,width=600,height=400,left=100,top=200"); faqwindow.focus(); }); GEvent.addDomListener( container, "mouseout", function() { innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; }); map.getContainer().appendChild( container); return container; } FAQControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize( 70, 20)); } function StatsControl() { } StatsControl.prototype = new GControl(); StatsControl.prototype.initialize = function( map) { var container = getDefaultControlContainer( "statistics"); var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "Stats")); container.appendChild( innerDiv); GEvent.addDomListener( container, "click", function() { innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; faqwindow = window.open( "http://www.layereight.de/freifunkmap_stats.html", "MapStats", "scrollbars=yes,width=620,height=490,left=100,top=100"); faqwindow.focus(); }); GEvent.addDomListener( container, "mouseout", function() { innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; }); map.getContainer().appendChild( container); return container; } StatsControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize( 5, 20)); } function LQControl() { } LQControl.prototype = new GControl(); LQControl.prototype.initialize = function( map) { var container = getDefaultControlContainer( "show link qualities"); var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "LQ")); container.appendChild( innerDiv); GEvent.addDomListener( container, "click", function() { if( lqPlaced) { lqPlaced = false; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; placeLQ(); } else { lqPlaced = true; innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; placeLQ(); } }); map.getContainer().appendChild( container); return container; } LQControl.prototype.getDefaultPosition = function() { return new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 7, 94)); } function ConnControl() { } ConnControl.prototype = new GControl(); ConnControl.prototype.initialize = function( map) { var container = getDefaultControlContainer( "show connections"); var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; if( showConn) { innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; } else { innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; } innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "Conn")); container.appendChild( innerDiv); GEvent.addDomListener( container, "click", function() { if( showConn) { showConn = false; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; placeConnections(); } else { showConn = true; innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; placeConnections(); } }); map.getContainer().appendChild( container); return container; } ConnControl.prototype.getDefaultPosition = function() { return new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 7, 74)); } function OlsrControl() { } OlsrControl.prototype = new GControl(); OlsrControl.prototype.initialize = function( map) { var container = getDefaultControlContainer( "show olsr nodes"); var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "olsr")); container.appendChild( innerDiv); GEvent.addDomListener( container, "click", function() { if( showOlsr) { showOlsr = false; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; placeNodesXML(); } else { showOlsr = true; innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; placeNodesXML(); } }); map.getContainer().appendChild( container); return container; } OlsrControl.prototype.getDefaultPosition = function() { return new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 7, 34)); } function BatmanControl() { } BatmanControl.prototype = new GControl(); BatmanControl.prototype.initialize = function( map) { var container = getDefaultControlContainer( "show batman nodes"); var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "batman")); container.appendChild( innerDiv); GEvent.addDomListener( container, "click", function() { if( showBatman) { showBatman = false; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; placeNodesXML(); } else { showBatman = true; innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; placeNodesXML(); } }); map.getContainer().appendChild( container); return container; } BatmanControl.prototype.getDefaultPosition = function() { return new GControlPosition( G_ANCHOR_TOP_RIGHT, new GSize( 7, 54)); } function NewSearchControl() { } NewSearchControl.prototype = new GControl(); NewSearchControl.prototype.initialize = function( map) { var container = document.createElement( "div"); container.title = "search for nodes"; var connForm = document.createElement( "form"); connForm.name = "ffmapForm"; connForm.onsubmit ="newSearch();"; connForm.action = "javascript:newSearch();"; var connInputText = document.createElement( "input"); connInputText.type = "text"; connInputText.name = "searchinput"; connInputText.size = "30"; connInputText.maxlength = "30"; connInputText.style.fontSize = "70%"; connInputText.tabindex = "1"; var outerDiv = document.createElement( "div"); var outerDivClassAttr = document.createAttribute( "class"); outerDivClassAttr.nodeValue = "gmnoprint"; outerDiv.setAttributeNode( outerDivClassAttr); outerDiv.style.border = "1px solid black"; outerDiv.style.backgroundColor = "white"; outerDiv.style.textAlign = "center"; outerDiv.style.width = "5em"; outerDiv.style.cursor = "pointer"; outerDiv.style.fontFamily = "Arial,sans-serif"; outerDiv.style.fontSize = "12px"; outerDiv.style.mozUserSelect = "none"; outerDiv.title = "search for nodes"; outerDiv.tabindex = "2"; var innerDiv = document.createElement( "div"); innerDiv.style.borderStyle = "solid"; innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.borderWidth = "1px"; innerDiv.appendChild( document.createTextNode( "Search")); outerDiv.appendChild( innerDiv); var connTable = document.createElement( "table"); var connTr = document.createElement( "tr"); var connTd1 = document.createElement( "td"); connTd1.valign = "middle"; var connTd2 = document.createElement( "td"); connTd2.valign = "middle" connTd1.appendChild( connInputText); connTd2.appendChild( outerDiv); connTr.appendChild( connTd1); connTr.appendChild( connTd2); connTable.appendChild( connTr); connForm.appendChild( connTable); container.appendChild( connForm); resultDiv = document.createElement( "div"); var classAttr = document.createAttribute( "class"); classAttr.nodeValue = "searchResult"; resultDiv.setAttributeNode( classAttr); resultDiv.style.position = "absolute"; resultDiv.style.top = "100px"; resultDiv.style.left = "80px"; resultDiv.style.width = "500px"; newSearchH1 = document.createElement( "h2"); newSearchH1.appendChild( document.createTextNode( "Search result")); newSearchH1.align = "center"; resultDiv.appendChild( newSearchH1); resultDiv.appendChild( document.createElement( "br")); resultDiv.appendChild( document.createElement( "br")); GEvent.addDomListener( outerDiv, "click", function () { innerDiv.style.borderColor = "rgb(176, 176, 176) white white rgb(176, 176, 176)"; innerDiv.style.fontWeight = "bold"; newSearch(); }); GEvent.addDomListener( outerDiv, "mouseout", function() { innerDiv.style.borderColor = "white rgb(176, 176, 176) rgb(176, 176, 176) white"; innerDiv.style.fontWeight = "normal"; }); map.getContainer().appendChild( container); return container; } NewSearchControl.prototype.getDefaultPosition = function() { return new GControlPosition( G_ANCHOR_BOTTOM_RIGHT, new GSize( 132, 16)); } function searchResultClickHandling( searchLat, searchLng) { searchPosition = new GLatLng( searchLat, searchLng); map.closeInfoWindow(); map.panTo( searchPosition); isSearch = true; } function searchResultClose() { map.getContainer().removeChild( resultDiv); } function newSearch() { showSearchResult = true; resultDiv.innerHTML = ""; var newSearchTable = document.createElement("table"); newSearchTable.width = "100%"; var newSearchTr = document.createElement("tr"); var newSearchTd = document.createElement("td"); var newSearchTd2 = document.createElement("td"); newSearchTd2.width = "5px"; newSearchTd.align = "right"; newSearchCloseLink = document.createElement("a"); newSearchCloseLink.href = "javascript:searchResultClose();"; newSearchCloseImg = document.createElement("img"); newSearchCloseImg.src = "freifunkmap_gfx/search_result_close.png"; newSearchCloseImg.style.position = "absolute"; newSearchCloseImg.style.top = "0px"; newSearchCloseImg.style.width = "12px"; newSearchCloseImg.style.height = "12px"; newSearchCloseImg.border = "0"; newSearchCloseLink.appendChild( newSearchCloseImg); // newSearchTd.appendChild( newSearchCloseImg); newSearchTd.appendChild( newSearchCloseLink); newSearchTr.appendChild( newSearchTd); newSearchTr.appendChild( newSearchTd2); newSearchTable.appendChild( newSearchTr); // resultDiv.appendChild( newSearchCloseImg); resultDiv.appendChild( newSearchTable); newSearchH1 = document.createElement( "h2"); newSearchH1.appendChild( document.createTextNode( "Search result")); newSearchH1.align = "center"; resultDiv.appendChild( newSearchH1); GDownloadUrl("freifunkmap.php?newsearch=" + document.ffmapForm.searchinput.value, function( data, responseCode) { var xml = GXml.parse( data); var resultText = ""; for( i = 0; i < xml.getElementsByTagName("node").length; i++) { resultDiv.appendChild( document.createTextNode((i + 1) + ". ")); resultLink = document.createElement("a"); resultLinkAttrHref = document.createAttribute( "href"); var resultCoords = xml.getElementsByTagName("node")[i].getAttribute('coords'); resultLink.href = "javascript:searchResultClickHandling(" + resultCoords + ");"; resultLink.appendChild( document.createTextNode( resultCoords)); resultDiv.appendChild( resultLink); resultDiv.appendChild( document.createTextNode( " " + xml.getElementsByTagName("node")[i].getAttribute('ip'))); resultDiv.appendChild( document.createElement( "br")); if( i > 18) break; } map.getContainer().appendChild( resultDiv); }); } function getDefaultControlContainer( title) { var container = document.createElement( "div"); container.title = title; container.style.border = "1px solid black"; container.style.position = "absolute"; container.style.backgroundColor = "white"; container.style.textAlign = "center"; container.style.width = "5em"; container.style.cursor = "pointer"; container.style.fontFamily = "Arial,sans-serif"; container.style.fontSize = "12px"; container.style.right = "11em"; return container; } //]]>