File: mm.html

package info (click to toggle)
openlayers 2.11%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 60,144 kB
  • ctags: 10,906
  • sloc: xml: 7,435; python: 778; sh: 68; makefile: 30
file content (68 lines) | stat: -rw-r--r-- 2,280 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>MultiMap</title>
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
    <link rel="stylesheet" href="style.css" type="text/css">
    <style type="text/css">
        #map {
            width: 100%;
            height: 512px;
            border: 1px solid black;
        }
    </style>


    <!-- multimap api key for http://(www.)openlayers.org -->
    <script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA10072915821139765"></script>


    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var lon = 5;
        var lat = 40;
        var zoom = 5;
        var map, mmlayer, layer;

        function init(){
            map = new OpenLayers.Map( 'map' , 
            {controls:[new OpenLayers.Control.MouseDefaults()]});

            mmlayer = new OpenLayers.Layer.MultiMap( "MultiMap");
            map.addLayer(mmlayer);
            
            markers = new OpenLayers.Layer.Markers("markers");
            map.addLayer(markers);

            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
            map.addControl( new OpenLayers.Control.LayerSwitcher() );
            map.addControl( new OpenLayers.Control.PanZoomBar() );
        }
        
        function add() {
            
            marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41));
            markers.addMarker(marker);
        }

        function remove() {
            markers.removeMarker(marker);
        }
    </script>
  </head>
  <body onload="init()">
    <h1 id="title">MultiMap Example</h1>
    <div id="tags">
        MultiMap, basic, cleanup
    </div>
    <p id="shortdesc">
      An example of using the Layer.MultiMap class.
    </p>  
    <div id="map" class="smallmap"></div>
    <div style="background-color:green" onclick="add()"> click to add the marker to the map</div>
    <div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>
  </body>
</html>