[mapguide-users] Problem opening a webLayout with predefined selection

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Wed Dec 17 05:06:59 EST 2008


Nice idea.
You could do the same with the runtime map, which would ease the 
pre-creation/modification of maps.

If the user presses the reload button, the map would stay the same, as 
would the selection.

Is this a problem, and do you have and idea for a workaround?

Regards, Kenneth Skovhede, GEOGRAF A/S



Bruno Scott skrev:
> I could propose a patch to fix that problem
> The idea would be to verify if the Session://...MapDefinition exist
> If it already exist, do not overwrite
>
> Something like this
>             bool mapStateIdExist = true;
>             MgResourceIdentifier mapStateId = new
> MgResourceIdentifier("Session:" + sessionId + "//" + mapName + "." +
> MgResourceType.Map);
>             try
>             {
>               MgByteReader tmpReader =
> resourceSrvc.GetResourceContent(mapStateId);
>             }
>             catch(MgException mge)
>             {
>               mapStateIdExist = false;
>             }
>
> Then use the mapStateIdExist flag
>
>             //if MapStateId exist, we should not erase the selection
>             if(!mapStateIdExist)
>             {
>               //create an empty selection object and store it in the session
> repository
>               MgSelection sel = new MgSelection(map);
>               sel.Save(resourceSrvc, mapName);
>             }
> and
>
>             //if MapStateId exist, we should not overwrite it
>             if(!mapStateIdExist)
>             {
>               map.Save(resourceSrvc, mapStateId);
>             }
>   


More information about the mapguide-users mailing list