From edc8c8979403479438d9b6ddc47c4f6214ac6538 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 5 Dec 2008 14:29:57 +0000 Subject: added makeIcon --- map.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'map.js') diff --git a/map.js b/map.js index 34a5c00..718de7c 100644 --- a/map.js +++ b/map.js @@ -106,8 +106,25 @@ function addNewNodeText(point) { return html; } +function makeIcon(type) { + var icon = new GIcon(); + + switch(type) { + case 'online': icon.image = "./img/marker_online.png"; break; + case 'tunnel': icon.image = "./img/marker_tunnel.png"; break; + case 'offline': icon.image = "./img/marker_offline.png"; break; + case 'ruler': icon.image = "./img/marker_blue.png"; break; + case 'newnode': icon.image = "./img/marker_darkred.png"; + } + icon.iconSize = new GSize(12,20); + icon.iconAnchor = new GPoint(6,20); + icon.infoWindowAnchor = new GPoint(5,1); + return icon +} + + function setNewMarker(point) { - var marker = new GMarker(point,{draggable: true}); + var marker = new GMarker(point,{icon: makeIcon('newnode'), draggable: true}); GEvent.addListener(marker, "dragstart", function() { this.autoclosed = true; @@ -197,14 +214,12 @@ RulerControl.prototype.initialize = function(map) { } var pnt = map.getCenter(); -// marker1 = new GMarker(pnt, {icon: makeIcon('messen'), draggable: true}); - marker1 = new GMarker(pnt, {draggable: true}); + marker1 = new GMarker(pnt, {icon: makeIcon('ruler'), draggable: true}); marker1.overlaytype = "ruler"; marker1.overlaysubtype = "marker1"; map.addOverlay(marker1); -// marker2 = new GMarker(pnt, {icon: makeIcon('messen'), draggable: true}); - marker2 = new GMarker(pnt, {draggable: true}); + marker2 = new GMarker(pnt, {icon: makeIcon('ruler'), draggable: true}); marker2.overlaytype = "ruler"; marker2.overlaysubtype = "marker2"; map.addOverlay(marker2); -- cgit v1.2.1