I’ve been tinkering with this over the past few weeks and in many
cases its working very nicely. I’ve figured out ways I can use the
‘any’ and ‘all’ rules to cover almost any situation which is great.

There’s one issue - some layer controls (checkboxes) should not be
seen by the user. E.g. ‘n’ and ‘f’ on the example below. We set it up
to accommodate that originally, with an array property called
‘control: true/false’.

However, the evaluateRule function uses those checkboxes – so if
“control: false”, the rules for that layer are ignored.

Any ideas how I can get around this (so a layer can have its
control:false but its rules still evaluate)?

Example: http://anatomy.study-medicine.co.uk/testk4.html

On Aug 10, 11:38 pm, William <william.g...@gmail.com> wrote:
> On Aug 9, 9:21 pm, Kesuke <nick_dai...@hotmail.com> 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 google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to