update examples
git-svn-id: http://svn.openlayers.org/trunk/openlayers@463 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -0,0 +1,53 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 800px;
|
||||||
|
height: 475px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
var map, layer;
|
||||||
|
var size, icon;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
map = new OpenLayers.Map('map');
|
||||||
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
|
"http://octo.metacarta.com/cgi-bin/mapserv",
|
||||||
|
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} );
|
||||||
|
|
||||||
|
map.addLayer(layer);
|
||||||
|
var markers = new OpenLayers.Layer.Markers( "Markers" );
|
||||||
|
map.addLayer(markers);
|
||||||
|
|
||||||
|
size = new OpenLayers.Size(50,50);
|
||||||
|
calculateOffset = function(size) {
|
||||||
|
return new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||||
|
};
|
||||||
|
icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,null, calculateOffset);
|
||||||
|
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(-180,90),
|
||||||
|
icon));
|
||||||
|
|
||||||
|
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
|
||||||
|
size = new OpenLayers.Size(size.w + 10, size.h + 10);
|
||||||
|
icon.setSize(size);
|
||||||
|
|
||||||
|
}
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1>OpenLayers Example</h1>
|
||||||
|
<div id="map"></div>
|
||||||
|
<div style="background-color:purple" onclick="resize()"> click to resize marker</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -24,7 +24,9 @@
|
|||||||
map.addLayer(markers);
|
map.addLayer(markers);
|
||||||
var newl = new OpenLayers.Layer.Text( "text", "./textfile.txt" );
|
var newl = new OpenLayers.Layer.Text( "text", "./textfile.txt" );
|
||||||
map.addLayer(newl);
|
map.addLayer(newl);
|
||||||
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17));
|
var size = new OpenLayers.Size(10,17);
|
||||||
|
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||||
|
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset);
|
||||||
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
|
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
|
||||||
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,45),icon));
|
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,45),icon));
|
||||||
marker = new OpenLayers.Marker(new OpenLayers.LonLat(90,10),icon);
|
marker = new OpenLayers.Marker(new OpenLayers.LonLat(90,10),icon);
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 800px;
|
||||||
|
height: 475px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
var map, layer;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
map = new OpenLayers.Map('map');
|
||||||
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
|
"http://octo.metacarta.com/cgi-bin/mapserv",
|
||||||
|
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} );
|
||||||
|
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
var newl = new OpenLayers.Layer.Text( "text", "./textfile.txt" );
|
||||||
|
map.addLayer(newl);
|
||||||
|
|
||||||
|
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
}
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1>OpenLayers Example</h1>
|
||||||
|
<div id="map"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+42
-10
@@ -12,6 +12,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
var map, layer, popup;
|
var map, layer, popup;
|
||||||
|
var markers, feature;
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
@@ -52,16 +53,48 @@
|
|||||||
map.addPopup(popup);
|
map.addPopup(popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAnchorBubble() {
|
function addMarker() {
|
||||||
popup = new OpenLayers.Popup.AnchoredBubble("chicken",
|
|
||||||
new OpenLayers.LonLat(5,40),
|
markers = new OpenLayers.Layer.Markers("zibo");
|
||||||
new OpenLayers.Size(200,200),
|
map.addLayer(markers);
|
||||||
"example popup");
|
|
||||||
|
feature = new OpenLayers.Feature(layer,
|
||||||
|
new OpenLayers.LonLat(0,0));
|
||||||
|
|
||||||
|
|
||||||
|
var marker = feature.createMarker();
|
||||||
|
|
||||||
|
markers.addMarker(marker);
|
||||||
|
marker.events.register("mousedown", marker, mousedown);
|
||||||
|
|
||||||
popup.setBackgroundColor("yellow");
|
|
||||||
popup.setOpacity(0.7);
|
|
||||||
map.addPopup(popup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mousedown() {
|
||||||
|
if (popup == null) {
|
||||||
|
popup = feature.createPopup();
|
||||||
|
popup.setBackgroundColor("yellow");
|
||||||
|
popup.setOpacity(0.7);
|
||||||
|
popup.events.register("mousedown", popup, onPopupMouseDown);
|
||||||
|
markers.map.addPopup(popup);
|
||||||
|
} else {
|
||||||
|
markers.map.removePopup(popup);
|
||||||
|
popup.destroy();
|
||||||
|
popup = null;
|
||||||
|
}
|
||||||
|
Event.stop(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Event} evt
|
||||||
|
*/
|
||||||
|
function onPopupMouseDown(evt) {
|
||||||
|
markers.map.removePopup(popup);
|
||||||
|
popup.destroy();
|
||||||
|
popup = null;
|
||||||
|
Event.stop(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function destroy() {
|
function destroy() {
|
||||||
popup.destroy();
|
popup.destroy();
|
||||||
}
|
}
|
||||||
@@ -77,8 +110,7 @@
|
|||||||
<body onload="init()">
|
<body onload="init()">
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div style="background-color:purple" onclick="add()"> click to add Popup to map</div>
|
<div style="background-color:purple" onclick="add()"> click to add Popup to map</div>
|
||||||
<div style="background-color:green" onclick="addAnchor()"> click to add an Popup.Anchored</div>
|
<div style="background-color:green" onclick="addMarker()"> click to add a Marker with an AnchoredBubble popup</div>
|
||||||
<div style="background-color:orange" onclick="addAnchorBubble()"> click to add Popup.AnchoredBubble</div>
|
|
||||||
<div style="background-color:blue" onclick="changer()"> click to modify popup's attributes</div>
|
<div style="background-color:blue" onclick="changer()"> click to modify popup's attributes</div>
|
||||||
<div style="background-color:red" onclick="remove()"> click to remove the popup from map</div>
|
<div style="background-color:red" onclick="remove()"> click to remove the popup from map</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user