[mapguide-users] Get selected layers from server side

Jim O'Leary joleary.public at gmail.com
Sun Jan 6 17:47:50 EST 2008


Yes, this works. The part that I was missing was:

selection.Open(resourceService, mapName);

When you do this, you give the selection object access to the session
through the resource service object. Then it knows the layers that the user
selected. Much cleaner than the JavaScript route.

Thanks.


Ivan Milicevic-3 wrote:
> 
> Try this J
> 
>  
> 
> MgSelection selection = new MgSelection(map);
> 
>       selection.Open(resourceService, "1"); //opens selection
> 
>  
> 
>       MgReadOnlyLayerCollection layers = selection.GetLayers(); //gets
> layers from selection 
> 
>       MgLayerCollection zdenci = map.GetLayers();
> 
>  
> 
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jim O'Leary
> Sent: Sunday, January 06, 2008 10:51 PM
> To: mapguide-users at lists.osgeo.org
> Subject: RE: [mapguide-users] Get selected layers from server side
> 
>  
> 
>  
> 
> I know there is always a way to submit a form via POST, but it can be an
> 
> unwieldy proces. I am interested to know if the MapGuide server can
> supply a
> 
> list of selected layers to a server-side program.
> 
>  
> 
>  
> 
>  
> 
> Kori Maleski-4 wrote:
> 
>> 
> 
>> I think this isn't possible when using the Ajax viewer, but is
> possible
> 
>> when
> 
>> using the DWF viewer.
> 
>> 
> 
>> Someone may correct me on that...
> 
>> 
> 
>> Use the Script frame of the Ajax viewer to fire a Form Submit Post to
> pass
> 
>> your selection set instead.
> 
>> 
> 
>> 
> 
>> Cheers,
> 
>> 
> 
>> Kori Maleski
> 
>> 
> 
>> -----Original Message-----
> 
>> From: mapguide-users-bounces at lists.osgeo.org
> 
>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jim
> O'Leary
> 
>> Sent: January-04-08 6:13 PM
> 
>> To: mapguide-users at lists.osgeo.org
> 
>> Subject: [mapguide-users] Get selected layers from server side
> 
>> 
> 
>> 
> 
>> Is it possible to get a list of the map's selected layers from the
> server
> 
>> side? 
> 
>> 
> 
>> I know I can get this by making an MgSelection and passing the
> selection
> 
>> XML
> 
>> from the client to the server program, like:
> 
>> 
> 
>> $selection = new MgSelection($map,$_REQUEST['selectionXML']);
> 
>> 
> 
>> However, I don't want to pass a big selection XML string to the server
> 
>> program, as I am passing by GET and the selection XML could be greater
> 
>> than
> 
>> the browser handles. 
> 
>> 
> 
>> If I make the selection object without including the selection XML,
> like
> 
>> 
> 
>> $selection = new MgSelection($map);
> 
>> $selectedLayers = $selection->GetLayers();
> 
>> $numberLayers = $selectedLayers->GetCount();
> 
>> 
> 
>> PHP tells me that $selectedLayers is not an object.
> 
>> 
> 
>> Thanks.
> 
>> 
> 
>> 
> 
>> -- 
> 
>> View this message in context:
> 
>>
> http://www.nabble.com/Get-selected-layers-from-server-side-tp14628979s16
> 610p
> 
>> 14628979.html
> 
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
>> 
> 
>> _______________________________________________
> 
>> mapguide-users mailing list
> 
>> mapguide-users at lists.osgeo.org
> 
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
>> 
> 
>> _______________________________________________
> 
>> mapguide-users mailing list
> 
>> mapguide-users at lists.osgeo.org
> 
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
>> 
> 
>> 
> 
>  
> 
> -- 
> 
> View this message in context:
> http://www.nabble.com/Get-selected-layers-from-server-side-tp14628979s16
> 610p14654216.html
> 
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
>  
> 
> _______________________________________________
> 
> mapguide-users mailing list
> 
> mapguide-users at lists.osgeo.org
> 
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Get-selected-layers-from-server-side-tp14628979s16610p14655121.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list