I'm having a bit of trouble getting this working, but its getting
there slowly.

The first problem is that some layers are subject to both ANY and ALL
rules, and have different layer-lists for show and hide - but I think
I can get around that by adding new properties for hide/show as the
concept remains the same.

The second problem is with the actual construction of the controller,
I've got parts of the code together at 
http://anatomy.study-medicine.co.uk/testk2.html
but haven't been able to find a place where I can put the IF rules.
Any suggestions where this should go?


On Aug 1, 11:51 pm, William <[email protected]> wrote:
> as a start you could have additional layer properties to store the
> rule definitions.
>
> For the simplest types of rules you could have the properties "rule",
> "operation" and "list"
>
> rule: none | shadow | group etc
> operation: any | all
> list: comma separated list of layer ids
>
> 1. the visible property would be determined by a formula if "rule"
> wasn't "none"
> 2. the formula would be conjunction/disjunction over the "visible"
> property of a list of layers
> 3. the formula would be evaluated on the initial state of the layers
> 4. afterwards a layer would listen to "visible_changed" on the layers
> in its list, nd recalculate its own visible property accordingly.
>
> you would need two functions for formula calculation:
>
> function any(list) {
>   var a = false;
>   for (var i in list) {
>     a = a || overlays.get(i).get("visible");
>   }
>   return a;
>
> }
>
> function all(list) {
>   var a = true;
>   for (var i in list) {
>     a = a && overlays.get(i).get("visible");
>   }
>   return a;
>
> }
>
> ...

-- 
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.

Reply via email to