Changeset 7722 for trunk/src/map
- Timestamp:
- Apr 12, 2010, 7:11:44 PM (15 years ago)
- Location:
- trunk/src/map
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/map/inc/nodemapWL.js
r7694 r7722 1 //Declaring some variables we will be using 1 2 var map; 2 var geoXml;3 3 var toggleState = 1; 4 var marker_hash = {}; 4 5 6 //This function is called from index.php 5 7 function initialize_map() { 8 //We will only do this function if the browser is compatible 6 9 if (GBrowserIsCompatible()) { 7 geoXml = new GGeoXml("http://www.mantixweb.nl/nodemap/example.kml?tijd=10342"); 10 //Adding the google map into the div called #mapcanvas 8 11 map = new GMap2(document.getElementById("mapcanvas")); 12 //Center the map on Leiden 9 13 map.setCenter(new GLatLng(52.162687, 4.493294), 11); 10 14 map.setUIToDefault(); 11 map.addOverlay(geoXml); 15 16 //Go through the array 'markers' (Declared in index.php) and add a marker for each marker stored in the array using our addMarker function 17 for (var i=0; i<markers.length; i++) { 18 var current = markers[i]; 19 var marker = addMarker(current); 20 marker_hash[current.id] = {marker : marker}; 21 } 12 22 } 13 23 } 14 24 15 function toggleMyKml() { 25 //This function will contain the displaying and not displaying of nodes on the map 26 function toggleNodes() { 16 27 if (toggleState == 1) { 17 28 map.removeOverlay(geoXml); … … 22 33 } 23 34 } 35 36 //This function adds a marker with an object from our 'marker'array defined in index.php 37 function addMarker(current) { 38 var marker = new GMarker(new GLatLng(current.latitude[0], current.longitude[0])); 39 map.addOverlay(marker); 40 //Added mouseover listener that calls on our mouseOver function when the mouse moves over a marker on the map 41 GEvent.addListener(marker, 'mouseover', function() { 42 mouseOver(current.id, current.name[0]); 43 }); 44 return marker; 45 } 46 47 //Our mouseover function 48 function mouseOver(id, name) 49 { 50 //For now we only post the id(We made ourself in kmlHandler) and the name of the node 51 this.obj = document.getElementById("infotop"); 52 obj.innerHTML = id+" - "+name; 53 //We will replace this function with a httprequest to a php file in the future 54 } 24 55 -
trunk/src/map/index.php
r7719 r7722 1 <?php require_once("inc/kmlHandler.php"); ?> 2 1 3 <html> 2 4 <head> … … 8 10 <link href="style/stylesheet2.css" rel="stylesheet" type="text/css"> 9 11 <![endif]--> 12 13 <!-- Make our $marker[] array from kmlHandler available to javascript in JSON--> 14 <script> 15 var markers = <?php echo json_encode($markers); ?>; 16 </script> 10 17 11 18 <!-- Loading in the google-api -->
Note:
See TracChangeset
for help on using the changeset viewer.