Advertisement
friezakinght

Untitled

Jul 29th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.91 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4.     <title>SanMap</title>
  5.     <!-- Disallow users to scale this page -->
  6.     <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
  7.     <style type="text/css">
  8.         /* Allow the canvas to use the full height and have no margins */
  9.         html, body, #map-canvas {
  10.             height: 100%;
  11.             margin: 0
  12.         }
  13.     </style>
  14. </head>
  15. <body>
  16. <!-- The container the map is rendered in -->
  17. <div id="map-canvas"></div>
  18.  
  19. <!-- Load all javascript -->
  20. <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
  21. <script src="js/SanMap.min.js"></script>
  22. <script>
  23.     //Define the mapTypes we'll be using
  24.    
  25.     var mapType = new SanMapType(1, 5, function (zoom, x, y) {
  26.         return x == -1 && y == -1 ? "tiles/map.outer.png" : "tiles/map." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
  27.     });
  28.    
  29.     var satType = new SanMapType(1, 5, function (zoom, x, y) {
  30.         return x == -1 && y == -1 ? null : "tiles/sat." + zoom + "." + x + "." + y + ".png";//Where the tiles are located
  31.     });
  32.    
  33.     //Initialize the map
  34.     var sm = new SanMap('map-canvas', {'Map': mapType, 'Satellite': satType}, 2);
  35.  
  36.     //
  37.     // The above code contain methods SanMap provide
  38.     // From here on forth we only use methods provided by the Google API
  39.     //
  40.    
  41.     //LS Bank
  42.     var bankInfoWindow = new google.maps.InfoWindow({
  43.         content: '<h3>LS Bank</h3><p><b>At this bank</b>, your money is welcome.</p>'
  44.     });
  45.     var bankMarker = new google.maps.Marker({
  46.         position: SanMap.getLatLngFromPos(1500, -1590),
  47.         map: sm.map
  48.     });
  49.     google.maps.event.addListener(bankMarker, 'click', function() {
  50.         sm.map.setCenter(bankMarker.position);
  51.         bankInfoWindow.open(sm.map,bankMarker);
  52.     });
  53.    
  54.    
  55.     //Place a marker in Blueberry
  56.     var bbInfoWindow = new google.maps.InfoWindow({
  57.         content: '<h3>Blueberry</h3><p><b>This place</b>, is the center of the world!</p>'
  58.     });
  59.     var bbMarker = new google.maps.Marker({
  60.         position: SanMap.getLatLngFromPos(0, 0),
  61.         map: sm.map
  62.     });
  63.     google.maps.event.addListener(bbMarker, 'click', function() {
  64.         sm.map.setCenter(bbMarker.position);
  65.         bbInfoWindow.open(sm.map,bbMarker);
  66.     });
  67.    
  68.     //Place a marker in Idlewood
  69.     var homeInfoWindow = new google.maps.InfoWindow({
  70.         content: '<h3>I live here</h3><p><b>Home</b>, sweet home!</p>'
  71.     });
  72.     var homeMarker = new google.maps.Marker({
  73.         position: SanMap.getLatLngFromPos(2050, -1700),
  74.         map: sm.map,
  75.         icon: 'http://ikkentim.com/sanmap/green-house.gif'
  76.     });
  77.     google.maps.event.addListener(homeMarker, 'click', function() {
  78.         sm.map.setCenter(homeMarker.position);
  79.         homeInfoWindow.open(sm.map,homeMarker);
  80.     });
  81.    
  82.     //Uncomment to show an alert with the position when you click on the map
  83.     /* google.maps.event.addListener(sm.map, 'click', function(event) {
  84.             var pos = SanMap.getPosFromLatLng(event.latLng);
  85.             alert(pos.x + "," + pos.y);
  86.         }); */
  87. </script>
  88. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement