A SERVICE OF

logo

Appendix: Buzzsaw Code Integration | 75
layerGroups.item(i).setVisibility(true);
} else {
layerGroups.item(i).setVisibility(false);
}
}
}
}
}
// Utility function to check to see if the string in variable name occurs in the
// semicolon delimited string in variable names.
// E.g. isNameIn("A;Bb;Cde", "Bb") => true
// isNameIn("A;Bb;Cde", "B") => false
function isNameIn(names, name) {
var cname = name + ";";
var clen = names.length;
var cbegin = 0;
while (cbegin < clen) {
var cend = cbegin + cname.length;
if (names.substring(cbegin, cend) == cname) {
return true;
}
cbegin = names.indexOf(";", cbegin) + 1;
if (cbegin == 0) break;
}
return false;
}
// This method is called when this page is unloaded (see onUnload ///////
// procedure).
// Its purpose is to save the state of the map into cookies.
// The following information is saved: the selected object (if there is
// only one selected object); the map center and width; and the
// layers that are turned on.
function saveMapState() {
var map = window.map;
// selected object
if (map != null) {
// selected object
var selStringPARAM = "";
var selection = map.getSelection();
if (selection.getNumObjects() == 1) {
var selObject = selection.getMapObjectsEx(null).item(0);
selStringPARAM = "<PARAM NAME=\"Selobjs\" VALUE=\""
+ selObject.getmapLayer().getName() + ","
+ selObject.getKey() + "\">";
}
// map center and width
document.cookie = cookieNameMapStateURLParam + "="
+ escape("<PARAM NAME=\"Lat\" VALUE=\"" + map.getLat() + "\">"
+ "<PARAM NAME=\"Lon\" VALUE=\"" + map.getLon() + "\">"
+ "<PARAM NAME=\"MapWidth\" VALUE=\""
+ map.getWidth(map.getUnits()) + "\">"
+ "<PARAM NAME=\"Units\" VALUE=\"" + map.getUnits() + "\"> "