0

Issue brownan/master/323 implemented, icons

This commit is contained in:
Michael Writhe
2011-04-14 17:16:25 -06:00
parent 26c6b686b3
commit 428b3b937e

View File

@@ -72,7 +72,7 @@ function createDropDown(title, items) {
dropdownDiv.appendChild(d); dropdownDiv.appendChild(d);
d.appendChild(n) d.appendChild(n)
var textNode = document.createElement("text"); var textNode = document.createElement("text");
textNode.innerHTML = item.label + "<br/>"; textNode.innerHTML = "<img width='15' height='15' src='"+item.icon+"'>" + item.label + "<br/>";
d.appendChild(textNode); d.appendChild(textNode);
} }
} }
@@ -137,11 +137,20 @@ function drawMapControls() {
var items = []; var items = [];
for (idx in signGroups) { for (idx in signGroups) {
var item = signGroups[idx]; var signGroup = signGroups[idx];
items.push({"label": item.label, "checked": item.checked, var iconURL = signGroup.icon;
if (!iconURL) { iconURL = 'signpost.png'; }
items.push({
"label": signGroup.label,
"checked": signGroup.checked,
"icon": iconURL,
"action": function(n, l, checked) { "action": function(n, l, checked) {
jQuery.each(markerCollection[l], function(i,elem) {elem.setVisible(checked);}); jQuery.each(markerCollection[l], function(i,elem) {
}}); elem.setVisible(checked);
});
//alert(signGroup.label);
}
});
} }
createDropDown("Signposts", items); createDropDown("Signposts", items);
} }
@@ -152,8 +161,8 @@ function drawMapControls() {
var items = []; var items = [];
for (idx in regionGroups) { for (idx in regionGroups) {
var item = regionGroups[idx]; var regionGroup = regionGroups[idx];
items.push({"label": item.label, "checked": item.checked, items.push({"label": regionGroup.label, "checked": regionGroup.checked,
"action": function(n, l, checked) { "action": function(n, l, checked) {
jQuery.each(regionCollection[l], function(i,elem) { jQuery.each(regionCollection[l], function(i,elem) {
elem.setMap(checked ? map : null); // Thanks to LeastWeasel for this line! elem.setMap(checked ? map : null); // Thanks to LeastWeasel for this line!
@@ -215,7 +224,7 @@ function initRegions() {
var testfunc = regionGroup.match; var testfunc = regionGroup.match;
var clickable = regionGroup.clickable var clickable = regionGroup.clickable
var label = regionGroup.label; var label = regionGroup.label;
if(region.label) { if(region.label) {
var name = region.label var name = region.label
} else { } else {
@@ -225,7 +234,7 @@ function initRegions() {
if (region.closed) { if (region.closed) {
var shape = new google.maps.Polygon({ var shape = new google.maps.Polygon({
name: region.label, name: name,
clickable: clickable, clickable: clickable,
geodesic: false, geodesic: false,
map: null, map: null,
@@ -239,7 +248,7 @@ function initRegions() {
}); });
} else { } else {
var shape = new google.maps.Polyline({ var shape = new google.maps.Polyline({
name: region.label, name: name,
clickable: clickable, clickable: clickable,
geodesic: false, geodesic: false,
map: null, map: null,
@@ -282,6 +291,7 @@ function initMarkers() {
for (i in signGroups) { for (i in signGroups) {
markerCollection[signGroups[i].label] = []; markerCollection[signGroups[i].label] = [];
} }
for (i in markerData) { for (i in markerData) {
var item = markerData[i]; var item = markerData[i];
@@ -331,7 +341,7 @@ function initMarkers() {
} }
} }
} }
if (!matched) { if (!matched) {
// is this signpost doesn't match any of the groups in config.js, add it automatically to the "__others__" group // is this signpost doesn't match any of the groups in config.js, add it automatically to the "__others__" group
if (item.type == 'sign') { iconURL = 'signpost_icon.png';} if (item.type == 'sign') { iconURL = 'signpost_icon.png';}
@@ -353,6 +363,9 @@ function initMarkers() {
prepareSignMarker(marker, item); prepareSignMarker(marker, item);
} }
} }
} }
} }