$width, "height" => $height, "border" => $border, "lat" => $lat, "lon" => $lon, "zoom" => $zoom, "layer" => $layer); if($gpx != "") { $default["gpx"] = $gpx; } if($trackcolor != "") { $default["trackcolor"] = $trackcolor; } if($trackwidth != "") { $default["trackwidth"] = $trackwidth; } $up = clipZoom(1, $zoom - 1, 17); $down = clipZoom(1, $zoom + 1, 17); // 2 x border for scrolling. image split into 3x3 $w = ($width- 2*$border)/3; $h = ($height- 2*$border)/3; // how wide and high is a tile in degres $dlon = 360/pow(2, $zoom); $dlat = 360 * cos($lat * pi() / 180)/pow(2, $zoom); $north = $lat + $h * $dlat / 256; $south = $lat - $h * $dlat / 256; $east = $lon + $w * $dlon / 256; $west = $lon - $w * $dlon / 256; $hlbug = array(); if($layerArray["osb"] || $layerArray["links"]) { for($i = 1; $i <= 3; $i++) { for($j = 1; $j <= 3; $j++) { $nb = $lat + (2-$i+0.5)*$h*$dlat / 256; $sb = $lat + (2-$i-0.5)*$h*$dlat / 256; $wb = $lon + ($j-2-0.5)*$w*$dlon / 256; $eb = $lon + ($j-2+0.5)*$w*$dlon / 256; $mapstring = "\n"; $points = array(); if($layerArray["osb"]) { $points = array_merge($points, getBugs($nb, $sb, $wb, $eb)); } if($layerArray["links"]) { $points = array_merge($points, getLinks($nb, $sb, $wb, $eb)); } while(list($key, $point) = each($points)) { if(($sb <= $point[2]) && ($point[2] <= $nb) && ($wb <= $point[1]) && ($point[1] <= $eb)) { $x = (getTileX($point[1], $zoom) - getTileX($wb, $zoom)) * 256; $y = (getTileY($point[2], $zoom) - getTileY($nb, $zoom)) * 256; $r = 4; if($point["type"] == "bug") { $mapstring .= " $point[0], "lon" => $point[1], "lat" => $point[2], "zoom" => $down)))."\" coords=\"$x,$y,$r\" alt=\"{$point[0]}\" title=\"{$point[0]}\">\n"; } else { $mapstring .= "\"{$point[0]}\"\n"; } if($point[0] == $bugid) { $hlbug = $point; } } } $mapstring .= "\n"; // empty maps are invalid HTML and a waste of bandwidth if(strlen($mapstring) > strlen("\n\n")) { echo $mapstring; } } } } // layout grid with borders. note that whitespace breaks the rendering on my palm treo for($i = 0; $i <= 4; $i++) { for($j = 0; $j <= 4; $j++) { if($i == 0) { if($j < 1 || $j > 3) { echo "\"corner\""; } else { echo " $north)))."\">"; echo "\"up\""; echo ""; } } else if ($i < 4) { if($j == 0) { echo " $west)))."\">"; echo "\"left\""; echo ""; } else if ($j < 4) { $link = $default; $link["zoom"] = $down; if($j == 1) { $link["lon"] = $west; } else if ($j == 3) { $link["lon"] = $east; } if($i == 1) { $link["lat"] = $north; } else if ($i == 3){ $link["lat"] = $south; } if($layerArray["osb"] || $layerArray["links"] ) { // perhaps we should only set usemap if that map is not empty... echo "\"map_${i}_${j}\""; } else { echo ""; echo "\"map_${i}_${j}\""; echo ""; } } else { echo " $east)))."\">"; echo "\"right\""; echo ""; } } else { if($j < 1 || $j > 3) { echo "\"corner\""; } else { echo " $south)))."\">"; echo "\"down\""; echo ""; } } } echo "
"; } // div to simulate mobile display behaviour echo "
"; // buttons for zoom and permalink $zoomsize = max($border, $minButtonSize); // map tiles are rounded down to int. three of those plus twice the border // are the actuall over all width of the map display. we use that for the // permalink, the search and the two zoombutton left and right $totalwidth = 3*((int)($w)) + 2*$border - 2*$zoomsize; $searchlinksize = $totalwidth/2; $permalinksize = $totalwidth - $searchlinksize; echo ""; echo "%2B"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "-"; echo ""; echo "
"; // show bug details if(count($hlbug) != 0) { echo "View bug #{$hlbug[0]}:
\n"; $parts=explode("
", $hlbug[3]); echo "\n"; if($hlbug[4] == 0) { echo "The bug is still open
\n"; echo " $hlbug[0])))."\">Add comment
\n"; echo " $hlbug[0])))."\">Close this bug
\n"; } else { echo "The bug is closed
\n"; } echo "
\n"; } while(list($key, $base) = each($baselayers)) { if($base != $layerArray["base"]) { $newbasestring = layerToString(cow($layerArray, array("base" => $base))); echo " $newbasestring)))."\">$base\n"; } } while(list($key, $overlay) = each($overlays)) { if($layerArray[$overlay]) { $newoverlaystring = layerToString(cow($layerArray, array($overlay => false))); echo " $newoverlaystring)))."\">disable $overlay\n"; } else { $newoverlaystring = layerToString(cow($layerArray, array($overlay => true))); echo " $newoverlaystring)))."\">$overlay\n"; } } echo "

\n"; if(isset($default["gpx"]) && ($default["gpx"] != "")) { echo "
\n"; while(list($key, $val) = each($default)) { if($key != "trackcolor") { echo "\n"; } } echo "\n"; echo "\n"; echo "\n"; echo "
\n"; } echo "Error in the map?
\n"; echo "Wrong screen size?
\n"; echo "Map tiles CC-BY-SA from OpenStreetMap"; echo "
"; ?>