Changeset 6491
- Timestamp:
- 03/11/08 14:14:18 (6 months ago)
- Files:
-
- trunk/openlayers/examples/google.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/examples/google.html
r6145 r6491 40 40 layers: 'factbook', 'format':'png'}, {'reproject': true} ); 41 41 map.addLayer(twms); 42 markers = new OpenLayers.Layer.Markers("markers");43 map.addLayer(markers);44 42 45 43 map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5); 46 44 map.addControl( new OpenLayers.Control.LayerSwitcher() ); 47 45 map.addControl( new OpenLayers.Control.PanZoomBar() ); 48 49 46 } 50 51 function add() {52 53 var url = 'http://boston.openguides.org/markers/AQUA.png';54 var sz = new OpenLayers.Size(10, 17);55 var calculateOffset = function(size) {56 return new OpenLayers.Pixel(-(size.w/2), -size.h);57 };58 var icon = new OpenLayers.Icon(url, sz, null, calculateOffset);59 var barcelona = new OpenLayers.LonLat(2.13134765625,60 41.37062534198901);61 marker = new OpenLayers.Marker(barcelona, icon);62 markers.addMarker(marker);63 }64 65 function remove() {66 markers.removeMarker(marker);67 }68 69 47 </script> 70 48 </head> … … 75 53 76 54 <p id="shortdesc"> 77 Demonstrate a Google basemap used with boundary and marker overlay layers.55 Demonstrate a Google basemap used with boundary overlay layer. 78 56 </p> 79 57 80 58 <div id="map"></div> 81 59 82 <div style="width:512px">83 <div style="background-color:green" onclick="add()"> click to add a marker to the map</div>84 <div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>85 </div>86 87 60 <div id="docs"></div> 88 61 </body>
