On Aug 9, 9:21 pm, Kesuke <[email protected]> wrote: > > The second problem is with the actual construction of the controller, > I've got parts of the code together > athttp://anatomy.study-medicine.co.uk/testk2.html > but haven't been able to find a place where I can put the IF rules.
I made a start on this, when the checkbox is being constructed: http://www.william-map.com/20100811/1/rules.htm if there's no rule, initialize to the value given, otherwise evaluate the rule and add a listener on each of the layers in the rule to reevaluate it when the visible property changes: if (layers[i].rule == "none") { checkbox.checked = layers[i].visible; } else { var ids = layers[i].list.split(','); evaluateRule(checkbox, layers[i], ids); for (var j=0; j<ids.length; j++) { var overlay = overlays.get(ids[j]); createListener(checkbox, layers[i], ids, overlay); } } function createListener(checkbox, layer, ids, overlay) { google.maps.event.addListener(overlay, "visible_changed", function() { evaluateRule(checkbox, layer, ids); }); } function evaluateRule(checkbox, layer, ids) { checkbox.checked = layer.operation(ids); overlays.get(layer.id).set("visible", checkbox.checked); } ... -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
