function mapLocation($locations, $stations) { global $location_marker, $default_zoom, $center_lng, $center_lat; // more than one location found if (count($locations) > 1) { echo "map.setCenter(new GLatLng({$center_lat},{$center_lng}), {$default_zoom});\n"; foreach ($locations as $location) { markLocation($location, $location_marker, "point"); } } else { if (count($locations) == 1) { markLocation($locations[0], $location_marker, "loc_point"); echo "map.setCenter(loc_point, {$default_zoom});\n"; foreach ($stations as $station) { echo "var points = [];\n"; echo "points.push(loc_point);\n"; markStation($station->marker); echo "points.push(point);\n"; echo "map.addOverlay(new GPolyline(points));\n"; } } else { echo "map.setCenter(new GLatLng({$center_lat},{$center_lng}), {$default_zoom});"; } } }
if ($debug) { echo "//start location:\n//"; $start_location->printInfo(); echo "\n//end location:\n//"; $end_location->printInfo(); echo "\n"; } markLocation($start_location, $start_marker_img, "start"); if (is_array($cpath) && !is_null($path)) { //plot ending point markLocation($end_location, $end_marker_img, "end"); mapStations($start_stations, "start"); mapStations($end_stations, "end"); mapPath($path->path, $cpath); } else { if (is_string($cpath) && $cpath == "walk") { //plot ending point markLocation($end_location, $end_marker_img, "end"); } } } else { for ($i = 0; $i < count($starts); $i++) { markLocation($starts[$i], $start_marker_img, "start" . $i); } for ($i = 0; $i < count($ends); $i++) { markLocation($ends[$i], $end_marker_img, "end" . $i); } } } } }
mapPath($path->path, $cpath); } // mark marker markMarker($start_marker, $start_marker_img, "start"); markMarker($end_marker, $end_marker_img, "end"); // center on start $lng = $start_marker->getLng(); $lat = $start_marker->getLat(); echo "map.setCenter(new GLatLng({$lat},{$lng}), {$default_zoom});\n"; } else { if ($_GET['type'] == 'dir') { // plot starting point markLocation($starts[0], $start_marker_img, "start"); if ($cpath != "same") { //plot ending point markLocation($ends[0], $end_marker_img, "end"); if ($cpath != "walk") { if ($path != null) { mapStations($start_stations, "start"); mapStations($end_stations, "end"); mapPath($path->path, $cpath); } } } } } } ?> //]]> </script> </body>