changeset 164:5489c1e24521 gmap2

Rename things, and add a wrapper function.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 10 Mar 2014 10:45:47 +0200
parents 8fd905f81672
children 2304106cf899
files markers.js
diffstat 1 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/markers.js	Mon Mar 10 10:20:03 2014 +0200
+++ b/markers.js	Mon Mar 10 10:45:47 2014 +0200
@@ -46,8 +46,6 @@
     marker.openInfoWindowHtml("<div class=\"infowin\">"+html+"</div>");
   });
 
-  pmapMarkers[pmapMIndex] = marker;
-
   if (mclass == "builtin")
   {
     pmapBuiltin[pmapBIndex] = new Array(2);
@@ -60,12 +58,12 @@
 //  if (mclass == "private") side_private_html += '<a href="javascript:pmapMyClick(' + pmapMIndex + ')">' + name + '</a><br>';
 //  if (mclass == "public") side_public_html += '<a href="javascript:pmapMyClick(' + pmapMIndex + ')">' + name + '</a><br>';
 
-  pmapMIndex++;
+  pmapMarkers[pmapMIndex++] = marker;
   return marker;
 }
 
 
-function pmapAddMarker(m, mclass)
+function pmapCreateMarkerType(m, mclass)
 {
   var type = m["type"];
 
@@ -85,6 +83,13 @@
 }
 
 
+function pmapAddMarkers(mlist, minzoom, maxzoom)
+{
+  if (mlist)
+    pmapMMgr.addMarkers(mlist, minzoom, maxzoom);
+}
+
+
 function pmapInitializeMarkers()
 {
   //
@@ -100,17 +105,17 @@
     for (var nid = 0; nid < markers.length; nid++)
     {
       console.debug(markers[nid]);
-      pmapAddMarker(markers[nid], "builtin");
+      pmapCreateMarkerType(markers[nid], "builtin");
     }
 
-    pmapMMgr.addMarkers(pmapAreas["default"], 7, 11);
-//    pmapMMgr.addMarkers(pmapAreas["guild"],   6, 11);
-//    pmapMMgr.addMarkers(pmapAreas["shrine"],  7, 11);
-//    pmapMMgr.addMarkers(pmapAreas["ferry"],   4, 11);
-//    pmapMMgr.addMarkers(pmapAreas["city"],    4, 11);
+    pmapAddMarkers(pmapAreas["default"], 7, 11);
+    pmapAddMarkers(pmapAreas["guild"],   6, 11);
+    pmapAddMarkers(pmapAreas["shrine"],  7, 11);
+    pmapAddMarkers(pmapAreas["ferry"],   4, 11);
+    pmapAddMarkers(pmapAreas["city"],    4, 11);
 
-//    pmapMMgr.addMarkers(pmapAreas["pcity"],   8, 11);
-//    pmapMMgr.addMarkers(pmapAreas["fort"],    8, 11);
+    pmapAddMarkers(pmapAreas["pcity"],   8, 11);
+    pmapAddMarkers(pmapAreas["fort"],    8, 11);
     pmapMMgr.refresh();
 
     document.getElementById("sidecontent").innerHTML = pmapSideBuiltinHTML;
@@ -126,10 +131,10 @@
 
     for (var nid = 0; nid < markers.length; nid++)
     {
-      pmapAddMarker(markers[nid], "tradelane");
+      pmapCreateMarkerType(markers[nid], "tradelane");
     }
 
-    pmapMMgr.addMarkers(pmapAreas["tradelane"], 5, 11);
+    pmapAddMarkers(pmapAreas["tradelane"], 5, 11);
     pmapMMgr.refresh();
   });