Problem with layer hiding and showing.

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with layer hiding and showing.

Tómas Guðmundsson

Hi all.

 

I currently have function that I am using that systematically goes through an array it‘s passed and walks through the layer legend to see if it finds a layer. So for every layername in a layerarray, I check if that layer exists and then if the checkbox is checked I show it, else I hide it. Now I‘ve been debugging this and for an array of 3 layers (this also happens for layers more than 1), I get 3 times the debug message „showing layer“, when I check the checkbox again I get the debug message „hiding layer“ 3 times as well.

 

So I know this is working properly, however Mapguide Server does not think so. Or at least the images I get back from the server are missing one layer (the first one, every time). So according to the legend all 3 layers are visible. However, the map shows everyone except the first one. Now I figured this was weird, especially since when I try to hide them, they all are hidden except the first one which is now visible. And now for the final twist.

 

If I do nothing else but reload the map (i.e. pan the map, zoom or refresh it) the correct layers are displayed on the map (all 3 or none at all).

 

So I figure this has something to do with timing or something like that, of the fetching of the map itself?

 

Please let me know if this is not clear to you and I‘ll try to explain better, but I find it weird I can not hide more than 2 layers at a time.

 

Kind regards,

Tómas


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson

Sorry about that. Everything about “If I do nothing else but reload the map (i.e. pan the map, zoom or refresh it) the correct layers are displayed on the map (all 3 or none at all).

 

So I figure this has something to do with timing or something like that, of the fetching of the map itself?“

 

Is wrong. So ignore that.

Rgds.

Tómas

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 5. ágúst 2008 13:36
To: [hidden email]
Subject: [fusion-users] Problem with layer hiding and showing.

 

Hi all.

 

I currently have function that I am using that systematically goes through an array it‘s passed and walks through the layer legend to see if it finds a layer. So for every layername in a layerarray, I check if that layer exists and then if the checkbox is checked I show it, else I hide it. Now I‘ve been debugging this and for an array of 3 layers (this also happens for layers more than 1), I get 3 times the debug message „showing layer“, when I check the checkbox again I get the debug message „hiding layer“ 3 times as well.

 

So I know this is working properly, however Mapguide Server does not think so. Or at least the images I get back from the server are missing one layer (the first one, every time). So according to the legend all 3 layers are visible. However, the map shows everyone except the first one. Now I figured this was weird, especially since when I try to hide them, they all are hidden except the first one which is now visible. And now for the final twist.

 

If I do nothing else but reload the map (i.e. pan the map, zoom or refresh it) the correct layers are displayed on the map (all 3 or none at all).

 

So I figure this has something to do with timing or something like that, of the fetching of the map itself?

 

Please let me know if this is not clear to you and I‘ll try to explain better, but I find it weird I can not hide more than 2 layers at a time.

 

Kind regards,

Tómas


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with layer hiding and showing.

Michael Adair
Tomas,

You should check the value of the 'showlayers' and 'hidelayers'
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are
the parameters that turn layers on or off. If they are what you are
expecting, then it's possible that there is a problem with specifying
those params, e.g. they should be comma-separated and they are not, or
vice versa.

Mike

Tómas Guðmundsson wrote:

>
> Sorry about that. Everything about “If I do nothing else but reload
> the map (i.e. pan the map, zoom or refresh it) the correct layers are
> displayed on the map (all 3 or none at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?“
>
> Is wrong. So ignore that.
>
> Rgds.
>
> Tómas
>
> *From:* [hidden email]
> [mailto:[hidden email]] *On Behalf Of *Tómas
> Guðmundsson
> *Sent:* 5. ágúst 2008 13:36
> *To:* [hidden email]
> *Subject:* [fusion-users] Problem with layer hiding and showing.
>
> Hi all.
>
> I currently have function that I am using that systematically goes
> through an array it‘s passed and walks through the layer legend to see
> if it finds a layer. So for every layername in a layerarray, I check
> if that layer exists and then if the checkbox is checked I show it,
> else I hide it. Now I‘ve been debugging this and for an array of 3
> layers (this also happens for layers more than 1), I get 3 times the
> debug message „showing layer“, when I check the checkbox again I get
> the debug message „hiding layer“ 3 times as well.
>
> So I know this is working properly, however Mapguide Server does not
> think so. Or at least the images I get back from the server are
> missing one layer (the first one, every time). So according to the
> legend all 3 layers are visible. However, the map shows everyone
> except the first one. Now I figured this was weird, especially since
> when I try to hide them, they all are hidden except the first one
> which is now visible. And now for the final twist.
>
> If I do nothing else but reload the map (i.e. pan the map, zoom or
> refresh it) the correct layers are displayed on the map (all 3 or none
> at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?
>
> Please let me know if this is not clear to you and I‘ll try to explain
> better, but I find it weird I can not hide more than 2 layers at a time.
>
> Kind regards,
>
> Tómas
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>  
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson
Mike,

I'm afraid that all I found was the 'showlayers' parameter. And it
was some kind of a hash,

clientagent Fusion Viewer
showLayers 0f682be6-0000-1000-8000-001b2418ab2d
operation GETMAPIMAGE

I don't quite know how to decrypt that but any help would be appreciated.

F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.

clientagent Fusion Viewer
showLayers 0f65c98c-0000-1000-8000-001b2418ab2d
operation GETMAPIMAGE

The delta is only in the first part.

Regards,
Tómas.

-----Original Message-----
From: Mike Adair [mailto:[hidden email]]
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

Tomas,

You should check the value of the 'showlayers' and 'hidelayers'
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are
the parameters that turn layers on or off. If they are what you are
expecting, then it's possible that there is a problem with specifying
those params, e.g. they should be comma-separated and they are not, or
vice versa.

Mike

Tómas Guðmundsson wrote:

>
> Sorry about that. Everything about "If I do nothing else but reload
> the map (i.e. pan the map, zoom or refresh it) the correct layers are
> displayed on the map (all 3 or none at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?"
>
> Is wrong. So ignore that.
>
> Rgds.
>
> Tómas
>
> *From:* [hidden email]
> [mailto:[hidden email]] *On Behalf Of *Tómas
> Guðmundsson
> *Sent:* 5. ágúst 2008 13:36
> *To:* [hidden email]
> *Subject:* [fusion-users] Problem with layer hiding and showing.
>
> Hi all.
>
> I currently have function that I am using that systematically goes
> through an array it's passed and walks through the layer legend to see
> if it finds a layer. So for every layername in a layerarray, I check
> if that layer exists and then if the checkbox is checked I show it,
> else I hide it. Now I've been debugging this and for an array of 3
> layers (this also happens for layers more than 1), I get 3 times the
> debug message "showing layer", when I check the checkbox again I get
> the debug message "hiding layer" 3 times as well.
>
> So I know this is working properly, however Mapguide Server does not
> think so. Or at least the images I get back from the server are
> missing one layer (the first one, every time). So according to the
> legend all 3 layers are visible. However, the map shows everyone
> except the first one. Now I figured this was weird, especially since
> when I try to hide them, they all are hidden except the first one
> which is now visible. And now for the final twist.
>
> If I do nothing else but reload the map (i.e. pan the map, zoom or
> refresh it) the correct layers are displayed on the map (all 3 or none
> at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?
>
> Please let me know if this is not clear to you and I'll try to explain
> better, but I find it weird I can not hide more than 2 layers at a time.
>
> Kind regards,
>
> Tómas
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>  
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson
Mike, all.

With some debugging this is what I find:

console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir

This is normal, this is what it should do. And this is printed out when each layer
calls a method "layer.show()". Now, there is only one mapagent call that displays
this.

clientagent Fusion Viewer
showLayers 119062dc-0000-1000-8000-001b2418ab2d
operation GETMAPIMAGE

And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change
the order, the last one always appears. However, the legend and "group.layers[j].visible"
all result in true. It would be kind of silly to wait for 3 images to display 3 layers,
so I'm wondering how this can be solved.

Regards,
Tómas

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.

Mike,

I'm afraid that all I found was the 'showlayers' parameter. And it
was some kind of a hash,

clientagent Fusion Viewer
showLayers 0f682be6-0000-1000-8000-001b2418ab2d
operation GETMAPIMAGE

I don't quite know how to decrypt that but any help would be appreciated.

F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.

clientagent Fusion Viewer
showLayers 0f65c98c-0000-1000-8000-001b2418ab2d
operation GETMAPIMAGE

The delta is only in the first part.

Regards,
Tómas.

-----Original Message-----
From: Mike Adair [mailto:[hidden email]]
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

Tomas,

You should check the value of the 'showlayers' and 'hidelayers'
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are
the parameters that turn layers on or off. If they are what you are
expecting, then it's possible that there is a problem with specifying
those params, e.g. they should be comma-separated and they are not, or
vice versa.

Mike

Tómas Guðmundsson wrote:

>
> Sorry about that. Everything about "If I do nothing else but reload
> the map (i.e. pan the map, zoom or refresh it) the correct layers are
> displayed on the map (all 3 or none at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?"
>
> Is wrong. So ignore that.
>
> Rgds.
>
> Tómas
>
> *From:* [hidden email]
> [mailto:[hidden email]] *On Behalf Of *Tómas
> Guðmundsson
> *Sent:* 5. ágúst 2008 13:36
> *To:* [hidden email]
> *Subject:* [fusion-users] Problem with layer hiding and showing.
>
> Hi all.
>
> I currently have function that I am using that systematically goes
> through an array it's passed and walks through the layer legend to see
> if it finds a layer. So for every layername in a layerarray, I check
> if that layer exists and then if the checkbox is checked I show it,
> else I hide it. Now I've been debugging this and for an array of 3
> layers (this also happens for layers more than 1), I get 3 times the
> debug message "showing layer", when I check the checkbox again I get
> the debug message "hiding layer" 3 times as well.
>
> So I know this is working properly, however Mapguide Server does not
> think so. Or at least the images I get back from the server are
> missing one layer (the first one, every time). So according to the
> legend all 3 layers are visible. However, the map shows everyone
> except the first one. Now I figured this was weird, especially since
> when I try to hide them, they all are hidden except the first one
> which is now visible. And now for the final twist.
>
> If I do nothing else but reload the map (i.e. pan the map, zoom or
> refresh it) the correct layers are displayed on the map (all 3 or none
> at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?
>
> Please let me know if this is not clear to you and I'll try to explain
> better, but I find it weird I can not hide more than 2 layers at a time.
>
> Kind regards,
>
> Tómas
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>  
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with layer hiding and showing.

Kenneth Skovhede, GEOGRAF A/S
In reply to this post by Tómas Guðmundsson
Its not a hash, its a GUID.
Instead of using the layer name, which may not be unique, all layers are assigned a GUID when the runtime map is created.
This GUID can only be read from a runtime map, and each layer gets assigned a different GUID for each session.

They differ, because another layer is (supposed to?) show.
Regards, Kenneth Skovhede, GEOGRAF A/S


Tómas Guðmundsson skrev:
Mike,

I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,

clientagent	Fusion Viewer
showLayers	0f682be6-0000-1000-8000-001b2418ab2d
operation	GETMAPIMAGE

I don't quite know how to decrypt that but any help would be appreciated.

F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.

clientagent	Fusion Viewer
showLayers	0f65c98c-0000-1000-8000-001b2418ab2d
operation	GETMAPIMAGE

The delta is only in the first part.

Regards,
Tómas.

-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

Tomas,

You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.

Mike

Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).

So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"

Is wrong. So ignore that.

Rgds.

Tómas

*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.

Hi all.

I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.

So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.

If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).

So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?

Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.

Kind regards,

Tómas

------------------------------------------------------------------------

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with layer hiding and showing.

Kenneth Skovhede, GEOGRAF A/S
In reply to this post by Tómas Guðmundsson
the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take multiple GUIDs, so you should send:
SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,1192c52c-0000-1000-8000-001b2418ab2d,119062dc-0000-1000-8000-001b2418ab2d
Regards, Kenneth Skovhede, GEOGRAF A/S


Tómas Guðmundsson skrev:
Mike, all.

With some debugging this is what I find:

console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir

This is normal, this is what it should do. And this is printed out when each layer 
calls a method "layer.show()". Now, there is only one mapagent call that displays 
this.

clientagent	Fusion Viewer
showLayers	119062dc-0000-1000-8000-001b2418ab2d
operation	GETMAPIMAGE

And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change 
the order, the last one always appears. However, the legend and "group.layers[j].visible" 
all result in true. It would be kind of silly to wait for 3 images to display 3 layers, 
so I'm wondering how this can be solved. 

Regards,
Tómas

-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.

Mike,

I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,

clientagent	Fusion Viewer
showLayers	0f682be6-0000-1000-8000-001b2418ab2d
operation	GETMAPIMAGE

I don't quite know how to decrypt that but any help would be appreciated.

F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.

clientagent	Fusion Viewer
showLayers	0f65c98c-0000-1000-8000-001b2418ab2d
operation	GETMAPIMAGE

The delta is only in the first part.

Regards,
Tómas.

-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

Tomas,

You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.

Mike

Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).

So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"

Is wrong. So ignore that.

Rgds.

Tómas

*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.

Hi all.

I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.

So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.

If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).

So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?

Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.

Kind regards,

Tómas

------------------------------------------------------------------------

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson

Thanks Kenneth,

 

I’m trying to figure it out how I put multiple GUIDS into the mapagent request.

Only way I know how to do it is with layer.show(). I’ll look more into it but if you

Have it on the top of your head, any info would be great thanks.

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
Sent: 6. ágúst 2008 10:57
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take multiple GUIDs, so you should send:
SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,1192c52c-0000-1000-8000-001b2418ab2d,119062dc-0000-1000-8000-001b2418ab2d

Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Mike, all.
 
With some debugging this is what I find:
 
console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir
 
This is normal, this is what it should do. And this is printed out when each layer 
calls a method "layer.show()". Now, there is only one mapagent call that displays 
this.
 
clientagent    Fusion Viewer
showLayers     119062dc-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change 
the order, the last one always appears. However, the legend and "group.layers[j].visible" 
all result in true. It would be kind of silly to wait for 3 images to display 3 layers, 
so I'm wondering how this can be solved. 
 
Regards,
Tómas
 
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.
 
Mike,
 
I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,
 
clientagent    Fusion Viewer
showLayers     0f682be6-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
I don't quite know how to decrypt that but any help would be appreciated.
 
F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.
 
clientagent    Fusion Viewer
showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
The delta is only in the first part.
 
Regards,
Tómas.
 
-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.
 
Tomas,
 
You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.
 
Mike
 
Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"
 
Is wrong. So ignore that.
 
Rgds.
 
Tómas
 
*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.
 
Hi all.
 
I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.
 
So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.
 
If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?
 
Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.
 
Kind regards,
 
Tómas
 
------------------------------------------------------------------------
 
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with layer hiding and showing.

Kenneth Skovhede, GEOGRAF A/S
I have no idea how to do this in fusion, but you will likely have to run through the layer list when doing a "layer.show()".
I think there is a call that updates the map without returning the image. You can use that, but it will require multiple server calls over http.

Regards, Kenneth Skovhede, GEOGRAF A/S


Tómas Guðmundsson skrev:

Thanks Kenneth,

 

I’m trying to figure it out how I put multiple GUIDS into the mapagent request.

Only way I know how to do it is with layer.show(). I’ll look more into it but if you

Have it on the top of your head, any info would be great thanks.

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [[hidden email]]
Sent: 6. ágúst 2008 10:57
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take multiple GUIDs, so you should send:
SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,1192c52c-0000-1000-8000-001b2418ab2d,119062dc-0000-1000-8000-001b2418ab2d

Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Mike, all.
 
With some debugging this is what I find:
 
console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir
 
This is normal, this is what it should do. And this is printed out when each layer 
calls a method "layer.show()". Now, there is only one mapagent call that displays 
this.
 
clientagent    Fusion Viewer
showLayers     119062dc-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change 
the order, the last one always appears. However, the legend and "group.layers[j].visible" 
all result in true. It would be kind of silly to wait for 3 images to display 3 layers, 
so I'm wondering how this can be solved. 
 
Regards,
Tómas
 
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.
 
Mike,
 
I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,
 
clientagent    Fusion Viewer
showLayers     0f682be6-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
I don't quite know how to decrypt that but any help would be appreciated.
 
F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.
 
clientagent    Fusion Viewer
showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
The delta is only in the first part.
 
Regards,
Tómas.
 
-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.
 
Tomas,
 
You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.
 
Mike
 
Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"
 
Is wrong. So ignore that.
 
Rgds.
 
Tómas
 
*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.
 
Hi all.
 
I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.
 
So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.
 
If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?
 
Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.
 
Kind regards,
 
Tómas
 
------------------------------------------------------------------------
 
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson

Thanks.

 

I am trying to use map.showLayers() but I’m not sure what parameters it needs.

 

Does anyone know where the definition of layer.show() and layer.hide() as well as

map.showLayers() and map.hideLayers().

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
Sent: 6. ágúst 2008 13:47
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

I have no idea how to do this in fusion, but you will likely have to run through the layer list when doing a "layer.show()".
I think there is a call that updates the map without returning the image. You can use that, but it will require multiple server calls over http.


Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Thanks Kenneth,

 

I’m trying to figure it out how I put multiple GUIDS into the mapagent request.

Only way I know how to do it is with layer.show(). I’ll look more into it but if you

Have it on the top of your head, any info would be great thanks.

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [[hidden email]]
Sent: 6. ágúst 2008 10:57
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take multiple GUIDs, so you should send:
SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,1192c52c-0000-1000-8000-001b2418ab2d,119062dc-0000-1000-8000-001b2418ab2d


Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Mike, all.
 
With some debugging this is what I find:
 
console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir
 
This is normal, this is what it should do. And this is printed out when each layer 
calls a method "layer.show()". Now, there is only one mapagent call that displays 
this.
 
clientagent    Fusion Viewer
showLayers     119062dc-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change 
the order, the last one always appears. However, the legend and "group.layers[j].visible" 
all result in true. It would be kind of silly to wait for 3 images to display 3 layers, 
so I'm wondering how this can be solved. 
 
Regards,
Tómas
 
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.
 
Mike,
 
I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,
 
clientagent    Fusion Viewer
showLayers     0f682be6-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
I don't quite know how to decrypt that but any help would be appreciated.
 
F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.
 
clientagent    Fusion Viewer
showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
The delta is only in the first part.
 
Regards,
Tómas.
 
-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.
 
Tomas,
 
You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.
 
Mike
 
Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"
 
Is wrong. So ignore that.
 
Rgds.
 
Tómas
 
*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.
 
Hi all.
 
I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.
 
So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.
 
If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?
 
Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.
 
Kind regards,
 
Tómas
 
------------------------------------------------------------------------
 
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Berdel, Brian

Here is code to show a layer (just replace layerName)

 

    var mapWidget = Fusion.getWidgetById('Map');

    var layer = mapWidget.aMaps[0].getLayerByName(layerName);

    layer.show();

 

Brian

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: Wednesday, August 06, 2008 10:18 AM
To: Kenneth Skovhede, GEOGRAF A/S
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.

 

Thanks.

 

I am trying to use map.showLayers() but I’m not sure what parameters it needs.

 

Does anyone know where the definition of layer.show() and layer.hide() as well as

map.showLayers() and map.hideLayers().

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
Sent: 6. ágúst 2008 13:47
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

I have no idea how to do this in fusion, but you will likely have to run through the layer list when doing a "layer.show()".
I think there is a call that updates the map without returning the image. You can use that, but it will require multiple server calls over http.

Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Thanks Kenneth,

 

I’m trying to figure it out how I put multiple GUIDS into the mapagent request.

Only way I know how to do it is with layer.show(). I’ll look more into it but if you

Have it on the top of your head, any info would be great thanks.

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [[hidden email]]
Sent: 6. ágúst 2008 10:57
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take multiple GUIDs, so you should send:
SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,1192c52c-0000-1000-8000-001b2418ab2d,119062dc-0000-1000-8000-001b2418ab2d

Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Mike, all.
 
With some debugging this is what I find:
 
console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir
 
This is normal, this is what it should do. And this is printed out when each layer 
calls a method "layer.show()". Now, there is only one mapagent call that displays 
this.
 
clientagent    Fusion Viewer
showLayers     119062dc-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change 
the order, the last one always appears. However, the legend and "group.layers[j].visible" 
all result in true. It would be kind of silly to wait for 3 images to display 3 layers, 
so I'm wondering how this can be solved. 
 
Regards,
Tómas
 
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.
 
Mike,
 
I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,
 
clientagent    Fusion Viewer
showLayers     0f682be6-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
I don't quite know how to decrypt that but any help would be appreciated.
 
F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.
 
clientagent    Fusion Viewer
showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
The delta is only in the first part.
 
Regards,
Tómas.
 
-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.
 
Tomas,
 
You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.
 
Mike
 
Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"
 
Is wrong. So ignore that.
 
Rgds.
 
Tómas
 
*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.
 
Hi all.
 
I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.
 
So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.
 
If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?
 
Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.
 
Kind regards,
 
Tómas
 
------------------------------------------------------------------------
 
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson

Thank you for that Brian.

 

But I managed to finally solve this problem. I’m not sure if anyone else has countered it but at least, calling layer.show for many layers, that is wanting to display many layers at one time resulted in faulty behavior and not all layers were shown. So on line 879  in Mapguide.js (fusion/Mapguide/Mapguide.js) I added this function:

 

                /** function : sneShowLayers()

                  * This function takes in an array of layers

                  * so that multiple layers can be displayed at once

                  * instead of just one at a time

                  */

                sneShowLayers: function(layers, noDraw) {

                                for (var i = 0; i < layers.length; i++) {

                                                this.processLayerEvents(layers[i], true);

                                                this.aShowLayers.push(layers[i].uniqueId);

                                }

iif (!noDraw) {

 this.drawMap();

                                }                             

                },

 

                /** function : sneHideLayers()

                  * This function takes in an array of layers

                  * so that multiple layers can be hidden at once

                  * instead of just one at a time

                  */

                sneHideLayers: function( layers, noDraw ) {

                                for (var i = 0; i < layers.length; i++) {

                                                this.processLayerEvents(layers[i], false);

                                                this.aHideLayers.push(layers[i].uniqueId);

                                }

                if (!noDraw) {

                                                 this.drawMap();

                                 }

 },

               

Very similar to the showLayer function it has been altered to take in an array of layers instead of just a single array. This way they will all be pushed into the array that will be shown for the next draw of the map. So to fully allow for let’s say displaying all layers or hiding them all you have to traverse through the layer tree / layer legend and add every layer to a temporary array and then send it to this function  with “map.sneHideLayers(layersToHideArray)” and / or “map.sneShowLayers(layersToShowArray)”. Hope this helps as most people out there.

 

Kind regards,

Tómas.

 

From: Berdel, Brian [mailto:[hidden email]]
Sent: 6. ágúst 2008 14:46
To: Tómas Guðmundsson; Kenneth Skovhede, GEOGRAF A/S
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.

 

Here is code to show a layer (just replace layerName)

 

    var mapWidget = Fusion.getWidgetById('Map');

    var layer = mapWidget.aMaps[0].getLayerByName(layerName);

    layer.show();

 

Brian

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: Wednesday, August 06, 2008 10:18 AM
To: Kenneth Skovhede, GEOGRAF A/S
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.

 

Thanks.

 

I am trying to use map.showLayers() but I’m not sure what parameters it needs.

 

Does anyone know where the definition of layer.show() and layer.hide() as well as

map.showLayers() and map.hideLayers().

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
Sent: 6. ágúst 2008 13:47
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

I have no idea how to do this in fusion, but you will likely have to run through the layer list when doing a "layer.show()".
I think there is a call that updates the map without returning the image. You can use that, but it will require multiple server calls over http.

Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Thanks Kenneth,

 

I’m trying to figure it out how I put multiple GUIDS into the mapagent request.

Only way I know how to do it is with layer.show(). I’ll look more into it but if you

Have it on the top of your head, any info would be great thanks.

 

Regards,

Tómas.

 

From: Kenneth Skovhede, GEOGRAF A/S [[hidden email]]
Sent: 6. ágúst 2008 10:57
To: Tómas Guðmundsson
Cc: Mike Adair; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

 

the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take multiple GUIDs, so you should send:
SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,1192c52c-0000-1000-8000-001b2418ab2d,119062dc-0000-1000-8000-001b2418ab2d

Regards, Kenneth Skovhede, GEOGRAF A/S



Tómas Guðmundsson skrev:

Mike, all.
 
With some debugging this is what I find:
 
console.log('showing :', group.layers[j], ' - ', group.layers[j].layerName);
showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d - HV_loki
showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d - HV_brunnar
showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d - HV_lagnir
 
This is normal, this is what it should do. And this is printed out when each layer 
calls a method "layer.show()". Now, there is only one mapagent call that displays 
this.
 
clientagent    Fusion Viewer
showLayers     119062dc-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
And evidently on my map, the only layer that get's displayed is HV_lagnir. If I change 
the order, the last one always appears. However, the legend and "group.layers[j].visible" 
all result in true. It would be kind of silly to wait for 3 images to display 3 layers, 
so I'm wondering how this can be solved. 
 
Regards,
Tómas
 
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Tómas Guðmundsson
Sent: 6. ágúst 2008 09:05
To: Mike Adair
Cc: [hidden email]
Subject: RE: [fusion-users] Problem with layer hiding and showing.
 
Mike,
 
I'm afraid that all I found was the 'showlayers' parameter. And it 
was some kind of a hash,
 
clientagent    Fusion Viewer
showLayers     0f682be6-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
I don't quite know how to decrypt that but any help would be appreciated.
 
F.y.i. this is the kind of hash that would be correct with the layers
appropriately displayed.
 
clientagent    Fusion Viewer
showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
operation      GETMAPIMAGE
 
The delta is only in the first part.
 
Regards,
Tómas.
 
-----Original Message-----
From: Mike Adair [[hidden email]] 
Sent: 5. ágúst 2008 19:20
To: Tómas Guðmundsson
Cc: [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.
 
Tomas,
 
You should check the value of the 'showlayers' and 'hidelayers' 
parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are 
the parameters that turn layers on or off. If they are what you are 
expecting, then it's possible that there is a problem with specifying 
those params, e.g. they should be comma-separated and they are not, or 
vice versa.
 
Mike
 
Tómas Guðmundsson wrote:
  
Sorry about that. Everything about "If I do nothing else but reload 
the map (i.e. pan the map, zoom or refresh it) the correct layers are 
displayed on the map (all 3 or none at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?"
 
Is wrong. So ignore that.
 
Rgds.
 
Tómas
 
*From:* [hidden email] 
[[hidden email]] *On Behalf Of *Tómas 
Guðmundsson
*Sent:* 5. ágúst 2008 13:36
*To:* [hidden email]
*Subject:* [fusion-users] Problem with layer hiding and showing.
 
Hi all.
 
I currently have function that I am using that systematically goes 
through an array it's passed and walks through the layer legend to see 
if it finds a layer. So for every layername in a layerarray, I check 
if that layer exists and then if the checkbox is checked I show it, 
else I hide it. Now I've been debugging this and for an array of 3 
layers (this also happens for layers more than 1), I get 3 times the 
debug message "showing layer", when I check the checkbox again I get 
the debug message "hiding layer" 3 times as well.
 
So I know this is working properly, however Mapguide Server does not 
think so. Or at least the images I get back from the server are 
missing one layer (the first one, every time). So according to the 
legend all 3 layers are visible. However, the map shows everyone 
except the first one. Now I figured this was weird, especially since 
when I try to hide them, they all are hidden except the first one 
which is now visible. And now for the final twist.
 
If I do nothing else but reload the map (i.e. pan the map, zoom or 
refresh it) the correct layers are displayed on the map (all 3 or none 
at all).
 
So I figure this has something to do with timing or something like 
that, of the fetching of the map itself?
 
Please let me know if this is not clear to you and I'll try to explain 
better, but I find it weird I can not hide more than 2 layers at a time.
 
Kind regards,
 
Tómas
 
------------------------------------------------------------------------
 
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  
    
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
  

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with layer hiding and showing.

Paul Spencer-2
Tómas,

you may have been able to accomplish the same thing by passing false  
as the second parameter and then calling drawMap after you had shown  
or hidden all your layers.

For instance,

// layers is an array of layers to show
for (var i=0; i<layers.length; i++) {
     map.showLayer(layers[i], false);
}
map.drawMap();

That being said, I would consider a change to the API that would allow  
passing either a single object or an array of objects to the show/hide  
layer and group functions as long as it works for both mapguide and  
mapserver the same way - patches accepted.

Cheers

Paul

On 6-Aug-08, at 11:20 AM, Tómas Guðmundsson wrote:

> Thank you for that Brian.
>
> But I managed to finally solve this problem. I’m not sure if anyone  
> else has countered it but at least, calling layer.show for many  
> layers, that is wanting to display many layers at one time resulted  
> in faulty behavior and not all layers were shown. So on line 879  in  
> Mapguide.js (fusion/Mapguide/Mapguide.js) I added this function:
>
>                 /** function : sneShowLayers()
>                   * This function takes in an array of layers
>                   * so that multiple layers can be displayed at once
>                   * instead of just one at a time
>                   */
>                 sneShowLayers: function(layers, noDraw) {
>                                 for (var i = 0; i < layers.length; i+
> +) {
>                                                  
> this.processLayerEvents(layers[i], true);
>                                                  
> this.aShowLayers.push(layers[i].uniqueId);
>                                 }
> iif (!noDraw) {
>  this.drawMap();
>                                 }
>                 },
>
>                 /** function : sneHideLayers()
>                   * This function takes in an array of layers
>                   * so that multiple layers can be hidden at once
>                   * instead of just one at a time
>                   */
>                 sneHideLayers: function( layers, noDraw ) {
>                                 for (var i = 0; i < layers.length; i+
> +) {
>                                                  
> this.processLayerEvents(layers[i], false);
>                                                  
> this.aHideLayers.push(layers[i].uniqueId);
>                                 }
>                 if (!noDraw) {
>                                                  this.drawMap();
>                                  }
>  },
>
> Very similar to the showLayer function it has been altered to take  
> in an array of layers instead of just a single array. This way they  
> will all be pushed into the array that will be shown for the next  
> draw of the map. So to fully allow for let’s say displaying all  
> layers or hiding them all you have to traverse through the layer  
> tree / layer legend and add every layer to a temporary array and  
> then send it to this function  with  
> “map.sneHideLayers(layersToHideArray)” and / or  
> “map.sneShowLayers(layersToShowArray)”. Hope this helps as most  
> people out there.
>
> Kind regards,
> Tómas.
>
> From: Berdel, Brian [mailto:[hidden email]]
> Sent: 6. ágúst 2008 14:46
> To: Tómas Guðmundsson; Kenneth Skovhede, GEOGRAF A/S
> Cc: [hidden email]
> Subject: RE: [fusion-users] Problem with layer hiding and showing.
>
> Here is code to show a layer (just replace layerName)
>
>     var mapWidget = Fusion.getWidgetById('Map');
>     var layer = mapWidget.aMaps[0].getLayerByName(layerName);
>     layer.show();
>
> Brian
>
> From: [hidden email] [mailto:[hidden email]
> ] On Behalf OfTómas Guðmundsson
> Sent: Wednesday, August 06, 2008 10:18 AM
> To: Kenneth Skovhede, GEOGRAF A/S
> Cc: [hidden email]
> Subject: RE: [fusion-users] Problem with layer hiding and showing.
>
> Thanks.
>
> I am trying to use map.showLayers() but I’m not sure what parameters  
> it needs.
>
> Does anyone know where the definition of layer.show() and  
> layer.hide() as well as
> map.showLayers() and map.hideLayers().
>
> Regards,
> Tómas.
>
> From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
> Sent: 6. ágúst 2008 13:47
> To: Tómas Guðmundsson
> Cc: Mike Adair; [hidden email]
> Subject: Re: [fusion-users] Problem with layer hiding and showing.
>
> I have no idea how to do this in fusion, but you will likely have to  
> run through the layer list when doing a "layer.show()".
> I think there is a call that updates the map without returning the  
> image. You can use that, but it will require multiple server calls  
> over http.
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
> Tómas Guðmundsson skrev:
> Thanks Kenneth,
>
> I’m trying to figure it out how I put multiple GUIDS into the  
> mapagent request.
> Only way I know how to do it is with layer.show(). I’ll look more  
> into it but if you
> Have it on the top of your head, any info would be great thanks.
>
> Regards,
> Tómas.
>
> From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
> Sent: 6. ágúst 2008 10:57
> To: Tómas Guðmundsson
> Cc: Mike Adair; [hidden email]
> Subject: Re: [fusion-users] Problem with layer hiding and showing.
>
> the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take  
> multiple GUIDs, so you should send:
> SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,
> 1192c52c-0000-1000-8000-001b2418ab2d,
> 119062dc-0000-1000-8000-001b2418ab2d
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
> Tómas Guðmundsson skrev:
> Mike, all.
>
> With some debugging this is what I find:
>
> console.log('showing :', group.layers[j], ' - ',  
> group.layers[j].layerName);
> showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d -  
> HV_loki
> showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d -  
> HV_brunnar
> showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d -  
> HV_lagnir
>
> This is normal, this is what it should do. And this is printed out  
> when each layer
> calls a method "layer.show()". Now, there is only one mapagent call  
> that displays
> this.
>
> clientagent    Fusion Viewer
> showLayers     119062dc-0000-1000-8000-001b2418ab2d
> operation      GETMAPIMAGE
>
> And evidently on my map, the only layer that get's displayed is  
> HV_lagnir. If I change
> the order, the last one always appears. However, the legend and  
> "group.layers[j].visible"
> all result in true. It would be kind of silly to wait for 3 images  
> to display 3 layers,
> so I'm wondering how this can be solved.
>
> Regards,
> Tómas
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]
> ] On Behalf Of Tómas Guðmundsson
> Sent: 6. ágúst 2008 09:05
> To: Mike Adair
> Cc: [hidden email]
> Subject: RE: [fusion-users] Problem with layer hiding and showing.
>
> Mike,
>
> I'm afraid that all I found was the 'showlayers' parameter. And it
> was some kind of a hash,
>
> clientagent    Fusion Viewer
> showLayers     0f682be6-0000-1000-8000-001b2418ab2d
> operation      GETMAPIMAGE
>
> I don't quite know how to decrypt that but any help would be  
> appreciated.
>
> F.y.i. this is the kind of hash that would be correct with the layers
> appropriately displayed.
>
> clientagent    Fusion Viewer
> showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
> operation      GETMAPIMAGE
>
> The delta is only in the first part.
>
> Regards,
> Tómas.
>
> -----Original Message-----
> From: Mike Adair [mailto:[hidden email]]
> Sent: 5. ágúst 2008 19:20
> To: Tómas Guðmundsson
> Cc: [hidden email]
> Subject: Re: [fusion-users] Problem with layer hiding and showing.
>
> Tomas,
>
> You should check the value of the 'showlayers' and 'hidelayers'
> parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are
> the parameters that turn layers on or off. If they are what you are
> expecting, then it's possible that there is a problem with specifying
> those params, e.g. they should be comma-separated and they are not, or
> vice versa.
>
> Mike
>
> Tómas Guðmundsson wrote:
>
> Sorry about that. Everything about "If I do nothing else but reload
> the map (i.e. pan the map, zoom or refresh it) the correct layers are
> displayed on the map (all 3 or none at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?"
>
> Is wrong. So ignore that.
>
> Rgds.
>
> Tómas
>
> *From:* [hidden email]
> [mailto:[hidden email]] *On Behalf Of *Tómas
> Guðmundsson
> *Sent:* 5. ágúst 2008 13:36
> *To:* [hidden email]
> *Subject:* [fusion-users] Problem with layer hiding and showing.
>
> Hi all.
>
> I currently have function that I am using that systematically goes
> through an array it's passed and walks through the layer legend to see
> if it finds a layer. So for every layername in a layerarray, I check
> if that layer exists and then if the checkbox is checked I show it,
> else I hide it. Now I've been debugging this and for an array of 3
> layers (this also happens for layers more than 1), I get 3 times the
> debug message "showing layer", when I check the checkbox again I get
> the debug message "hiding layer" 3 times as well.
>
> So I know this is working properly, however Mapguide Server does not
> think so. Or at least the images I get back from the server are
> missing one layer (the first one, every time). So according to the
> legend all 3 layers are visible. However, the map shows everyone
> except the first one. Now I figured this was weird, especially since
> when I try to hide them, they all are hidden except the first one
> which is now visible. And now for the final twist.
>
> If I do nothing else but reload the map (i.e. pan the map, zoom or
> refresh it) the correct layers are displayed on the map (all 3 or none
> at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?
>
> Please let me know if this is not clear to you and I'll try to explain
> better, but I find it weird I can not hide more than 2 layers at a  
> time.
>
> Kind regards,
>
> Tómas
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

RE: Problem with layer hiding and showing.

Tómas Guðmundsson
Paul,

The thing is, at first I tried to do exactly that. Actually
what I did was this:

// layers is an array of layers to show
for (var i=0; i<layers.length; i++) {
     map.showLayer(layers[i],(i == (i-layers.length)));
}

Now that last statement only get's true when we're at the last
entry in the layers array so it show's all the layers and after
the last layer it says true so then it redraws it. But that
didn't work. Maybe some playing around with this stuff could result
in the same behavior. Well at least this is being logged for future
references when (hopefully) somebody else will need this information.

Regards,
Tómas.

-----Original Message-----
From: Paul Spencer [mailto:[hidden email]]
Sent: 6. ágúst 2008 15:33
To: Tómas Guðmundsson
Cc: Berdel, Brian; Kenneth Skovhede, GEOGRAF A/S; [hidden email]
Subject: Re: [fusion-users] Problem with layer hiding and showing.

Tómas,

you may have been able to accomplish the same thing by passing false  
as the second parameter and then calling drawMap after you had shown  
or hidden all your layers.

For instance,

// layers is an array of layers to show
for (var i=0; i<layers.length; i++) {
     map.showLayer(layers[i], false);
}
map.drawMap();

That being said, I would consider a change to the API that would allow  
passing either a single object or an array of objects to the show/hide  
layer and group functions as long as it works for both mapguide and  
mapserver the same way - patches accepted.

Cheers

Paul

On 6-Aug-08, at 11:20 AM, Tómas Guðmundsson wrote:

> Thank you for that Brian.
>
> But I managed to finally solve this problem. I'm not sure if anyone  
> else has countered it but at least, calling layer.show for many  
> layers, that is wanting to display many layers at one time resulted  
> in faulty behavior and not all layers were shown. So on line 879  in  
> Mapguide.js (fusion/Mapguide/Mapguide.js) I added this function:
>
>                 /** function : sneShowLayers()
>                   * This function takes in an array of layers
>                   * so that multiple layers can be displayed at once
>                   * instead of just one at a time
>                   */
>                 sneShowLayers: function(layers, noDraw) {
>                                 for (var i = 0; i < layers.length; i+
> +) {
>                                                  
> this.processLayerEvents(layers[i], true);
>                                                  
> this.aShowLayers.push(layers[i].uniqueId);
>                                 }
> iif (!noDraw) {
>  this.drawMap();
>                                 }
>                 },
>
>                 /** function : sneHideLayers()
>                   * This function takes in an array of layers
>                   * so that multiple layers can be hidden at once
>                   * instead of just one at a time
>                   */
>                 sneHideLayers: function( layers, noDraw ) {
>                                 for (var i = 0; i < layers.length; i+
> +) {
>                                                  
> this.processLayerEvents(layers[i], false);
>                                                  
> this.aHideLayers.push(layers[i].uniqueId);
>                                 }
>                 if (!noDraw) {
>                                                  this.drawMap();
>                                  }
>  },
>
> Very similar to the showLayer function it has been altered to take  
> in an array of layers instead of just a single array. This way they  
> will all be pushed into the array that will be shown for the next  
> draw of the map. So to fully allow for let's say displaying all  
> layers or hiding them all you have to traverse through the layer  
> tree / layer legend and add every layer to a temporary array and  
> then send it to this function  with  
> "map.sneHideLayers(layersToHideArray)" and / or  
> "map.sneShowLayers(layersToShowArray)". Hope this helps as most  
> people out there.
>
> Kind regards,
> Tómas.
>
> From: Berdel, Brian [mailto:[hidden email]]
> Sent: 6. ágúst 2008 14:46
> To: Tómas Guðmundsson; Kenneth Skovhede, GEOGRAF A/S
> Cc: [hidden email]
> Subject: RE: [fusion-users] Problem with layer hiding and showing.
>
> Here is code to show a layer (just replace layerName)
>
>     var mapWidget = Fusion.getWidgetById('Map');
>     var layer = mapWidget.aMaps[0].getLayerByName(layerName);
>     layer.show();
>
> Brian
>
> From: [hidden email] [mailto:[hidden email]
> ] On Behalf OfTómas Guðmundsson
> Sent: Wednesday, August 06, 2008 10:18 AM
> To: Kenneth Skovhede, GEOGRAF A/S
> Cc: [hidden email]
> Subject: RE: [fusion-users] Problem with layer hiding and showing.
>
> Thanks.
>
> I am trying to use map.showLayers() but I'm not sure what parameters  
> it needs.
>
> Does anyone know where the definition of layer.show() and  
> layer.hide() as well as
> map.showLayers() and map.hideLayers().
>
> Regards,
> Tómas.
>
> From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
> Sent: 6. ágúst 2008 13:47
> To: Tómas Guðmundsson
> Cc: Mike Adair; [hidden email]
> Subject: Re: [fusion-users] Problem with layer hiding and showing.
>
> I have no idea how to do this in fusion, but you will likely have to  
> run through the layer list when doing a "layer.show()".
> I think there is a call that updates the map without returning the  
> image. You can use that, but it will require multiple server calls  
> over http.
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
> Tómas Guðmundsson skrev:
> Thanks Kenneth,
>
> I'm trying to figure it out how I put multiple GUIDS into the  
> mapagent request.
> Only way I know how to do it is with layer.show(). I'll look more  
> into it but if you
> Have it on the top of your head, any info would be great thanks.
>
> Regards,
> Tómas.
>
> From: Kenneth Skovhede, GEOGRAF A/S [mailto:[hidden email]]
> Sent: 6. ágúst 2008 10:57
> To: Tómas Guðmundsson
> Cc: Mike Adair; [hidden email]
> Subject: Re: [fusion-users] Problem with layer hiding and showing.
>
> the "ShowLayers" parameter in the "GETMAPIMAGE" call, can take  
> multiple GUIDs, so you should send:
> SHOWLAYERS=118e0096-0000-1000-8000-001b2418ab2d,
> 1192c52c-0000-1000-8000-001b2418ab2d,
> 119062dc-0000-1000-8000-001b2418ab2d
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
> Tómas Guðmundsson skrev:
> Mike, all.
>
> With some debugging this is what I find:
>
> console.log('showing :', group.layers[j], ' - ',  
> group.layers[j].layerName);
> showing : Object uniqueId=118e0096-0000-1000-8000-001b2418ab2d -  
> HV_loki
> showing : Object uniqueId=1192c52c-0000-1000-8000-001b2418ab2d -  
> HV_brunnar
> showing : Object uniqueId=119062dc-0000-1000-8000-001b2418ab2d -  
> HV_lagnir
>
> This is normal, this is what it should do. And this is printed out  
> when each layer
> calls a method "layer.show()". Now, there is only one mapagent call  
> that displays
> this.
>
> clientagent    Fusion Viewer
> showLayers     119062dc-0000-1000-8000-001b2418ab2d
> operation      GETMAPIMAGE
>
> And evidently on my map, the only layer that get's displayed is  
> HV_lagnir. If I change
> the order, the last one always appears. However, the legend and  
> "group.layers[j].visible"
> all result in true. It would be kind of silly to wait for 3 images  
> to display 3 layers,
> so I'm wondering how this can be solved.
>
> Regards,
> Tómas
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]
> ] On Behalf Of Tómas Guðmundsson
> Sent: 6. ágúst 2008 09:05
> To: Mike Adair
> Cc: [hidden email]
> Subject: RE: [fusion-users] Problem with layer hiding and showing.
>
> Mike,
>
> I'm afraid that all I found was the 'showlayers' parameter. And it
> was some kind of a hash,
>
> clientagent    Fusion Viewer
> showLayers     0f682be6-0000-1000-8000-001b2418ab2d
> operation      GETMAPIMAGE
>
> I don't quite know how to decrypt that but any help would be  
> appreciated.
>
> F.y.i. this is the kind of hash that would be correct with the layers
> appropriately displayed.
>
> clientagent    Fusion Viewer
> showLayers     0f65c98c-0000-1000-8000-001b2418ab2d
> operation      GETMAPIMAGE
>
> The delta is only in the first part.
>
> Regards,
> Tómas.
>
> -----Original Message-----
> From: Mike Adair [mailto:[hidden email]]
> Sent: 5. ágúst 2008 19:20
> To: Tómas Guðmundsson
> Cc: [hidden email]
> Subject: Re: [fusion-users] Problem with layer hiding and showing.
>
> Tomas,
>
> You should check the value of the 'showlayers' and 'hidelayers'
> parameters in the sequence of mapagent calls to GETMAPIMAGE. Those are
> the parameters that turn layers on or off. If they are what you are
> expecting, then it's possible that there is a problem with specifying
> those params, e.g. they should be comma-separated and they are not, or
> vice versa.
>
> Mike
>
> Tómas Guðmundsson wrote:
>
> Sorry about that. Everything about "If I do nothing else but reload
> the map (i.e. pan the map, zoom or refresh it) the correct layers are
> displayed on the map (all 3 or none at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?"
>
> Is wrong. So ignore that.
>
> Rgds.
>
> Tómas
>
> *From:* [hidden email]
> [mailto:[hidden email]] *On Behalf Of *Tómas
> Guðmundsson
> *Sent:* 5. ágúst 2008 13:36
> *To:* [hidden email]
> *Subject:* [fusion-users] Problem with layer hiding and showing.
>
> Hi all.
>
> I currently have function that I am using that systematically goes
> through an array it's passed and walks through the layer legend to see
> if it finds a layer. So for every layername in a layerarray, I check
> if that layer exists and then if the checkbox is checked I show it,
> else I hide it. Now I've been debugging this and for an array of 3
> layers (this also happens for layers more than 1), I get 3 times the
> debug message "showing layer", when I check the checkbox again I get
> the debug message "hiding layer" 3 times as well.
>
> So I know this is working properly, however Mapguide Server does not
> think so. Or at least the images I get back from the server are
> missing one layer (the first one, every time). So according to the
> legend all 3 layers are visible. However, the map shows everyone
> except the first one. Now I figured this was weird, especially since
> when I try to hide them, they all are hidden except the first one
> which is now visible. And now for the final twist.
>
> If I do nothing else but reload the map (i.e. pan the map, zoom or
> refresh it) the correct layers are displayed on the map (all 3 or none
> at all).
>
> So I figure this has something to do with timing or something like
> that, of the fetching of the map itself?
>
> Please let me know if this is not clear to you and I'll try to explain
> better, but I find it weird I can not hide more than 2 layers at a  
> time.
>
> Kind regards,
>
> Tómas
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users
>
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with layer hiding and showing.

David Wilhelmsson
In reply to this post by Paul Spencer-2
For future googlers because the issue is still relevant with MapGuide 2.2 (tested), Paul's code was the basis for the code that resolved the issue for me. To be clear, here's the full code that I used:

var map = this.getMap().aMaps[0];
// layers is an array of layers to show
for (var i=0; i<layers.length; i++) {
     map.showLayer(layers[i], true);
}
map.drawMap();

Note that map is this.getMap().aMaps[0] and not this.getMap() to get access to the underlying Fusion.Layers.MapGuide object (instead of the higher-level Fusion.Widget.Map object) and that the noDraw parameter passed to showLayers should be true to prevent showLayers from redrawing the map (instead of Paul's code that used false - this is probably why Tómas was unable to get Paul's code working).

The above code (tested) allowed me to set the visibility of multiple layers at one time without redrawing the map after each change in visibility and manually call drawMap once at the end to correctly display the visibility of all layers. This code has the additional benefit of not requiring hacking Fusion to add the sneShowLayers and sneHideLayers functions (although these functions helped me in understanding the issue).

Please note that by calling the underlying Fusion.Layers.MapGuide.showLayers function, we miss out on the additional functionality that updates the legend and visible property of the Fusion.Layers.Layer object when we call the Fusion.Layers.Layer.show function. If you would like to Fusion.Layers.Layer.show function instead to get this additional functionality, use the following code instead:

var map = this.getMap().aMaps[0];
// layers is an array of layers to show
for (var i=0; i<layers.length; i++) {
     layer.show(true);
}
map.drawMap();

Note that even though I'm calling the higher-level Fusion.Layers.Layer.show function, I still need to call the underlying Fusion.Layers.MapGuide.drawMap to correctly redraw the map. I found that a call to higher-level Fusion.Widget.Map.redraw function will not correctly redraw the map (another source of confusion for me when trying to resolve this issue).

Kind regards,
Dave.