Changeset 3985
- Timestamp:
- 08/23/07 07:37:37 (1 year ago)
- Files:
-
- sandbox/thliese/openlayers/examples/map24.html (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/thliese/openlayers/examples/map24.html
r3965 r3985 16 16 17 17 var map, map24Layer, wmsLayer, markers; 18 var darmstadt TIZ= new OpenLayers.LonLat(8.625018, 49.870741);19 var frankfurt = new OpenLayers.LonLat(8.625018, 50.1);18 var darmstadt = new OpenLayers.LonLat(8.625018, 49.870741); 19 var wilhelmsdorf = new OpenLayers.LonLat(8.47787, 50.350952); 20 20 21 21 var router = null; 22 var routeID ;22 var routeID = null; 23 23 24 24 function init() { … … 35 35 } 36 36 37 function centerTIZ() { 38 map.setCenter(darmstadtTIZ, 18); 37 function centerHesse() { 38 var middle = new OpenLayers.LonLat((darmstadt.lon+wilhelmsdorf.lon)/2,(darmstadt.lat+wilhelmsdorf.lat)/2); 39 map.setCenter(middle, 10); 39 40 } 40 41 41 function addMarker() { 42 markers.addMarker(new OpenLayers.Marker(darmstadtTIZ)); 42 function addMarkers() { 43 markers.addMarker(new OpenLayers.Marker(darmstadt)); 44 markers.addMarker(new OpenLayers.Marker(wilhelmsdorf)); 43 45 } 44 46 45 function removeMarker () {47 function removeMarkers() { 46 48 markers.clearMarkers(); 47 49 } 48 50 49 51 function showRoute() { 52 if (routeID != null) return; // already visible 50 53 if (router == null) { 51 54 router = new Map24.RoutingServiceStub(); 52 55 } 53 56 router.calculateRoute({ 54 Start: new Map24.Coordinate(darmstadt TIZ.lon*60, darmstadtTIZ.lat*60),55 Destination: new Map24.Coordinate( frankfurt.lon*60, frankfurt.lat*60),57 Start: new Map24.Coordinate(darmstadt.lon*60, darmstadt.lat*60), 58 Destination: new Map24.Coordinate(wilhelmsdorf.lon*60, wilhelmsdorf.lat*60), 56 59 CallbackFunction: function(route) { 57 60 routeID = route.RouteID; … … 62 65 63 66 function hideRoute() { 64 if (router != null) router.hideRoute({RouteId: routeID}); 67 if (router != null && routeID != null) { 68 router.hideRoute({RouteId: routeID}); 69 routeID = null; 70 } 65 71 } 66 72 … … 73 79 <ul> 74 80 <li> 75 <div style="color: blue;" onclick="center TIZ()">Center on TIZ, Darmstadt</div>81 <div style="color: blue;" onclick="centerHesse()">Center Hesse, Germany :)</div> 76 82 </li> 77 83 <li> 78 <div style="color: blue;" onclick="addMarker ()">Add Marker</div>84 <div style="color: blue;" onclick="addMarkers()">Add Markers</div> 79 85 </li> 80 86 <li> 81 <div style="color: blue;" onclick="removeMarker ()">Remove Marker</div>87 <div style="color: blue;" onclick="removeMarkers()">Remove Markers</div> 82 88 </li> 83 89 <li> 84 <div style="color: blue;" onclick="showRoute()">Show Route Darmstadt - Frankfurt</div>90 <div style="color: blue;" onclick="showRoute()">Show Route</div> 85 91 </li> 86 92 <li> 87 <div style="color: blue;" onclick="hideRoute()">Hide Route Darmstadt - Frankfurt</div>93 <div style="color: blue;" onclick="hideRoute()">Hide Route</div> 88 94 </li> 89 95 </ul>
