[mapguide-users] RE: PHP -> .NET Active Selection

Kori Maleski km at pat.ca
Wed Apr 26 13:35:07 EDT 2006

Pass the Selection/Session to an aspx page using Invoke URL or Script.
Or use the GetSelectionXML() in your own clientside javascript - posting it to your page.
For example:  I send the selection to the taskpane:
function ShowReport() {

var selCount = mapFrame.GetSelectedCount();

if(selCount != 0){

GetTaskFrame().GetTaskPane().location.href = homePage.replace("/MapGuide/MapViewerNet/","") + "?SESSION=" + mapFrame.GetSessionId() + "&LOCALE=" + locale + "&MAPNAME=" + mapFrame.GetMapName() + "&SELECTION=" + mapFrame.GetSelectionXML();



My homepage is actually a handler that interprets the selection - then fires the proper report:
Dim l_sSelect As String
Dim l_sMapName As String
Dim l_sSession As String

l_sMapName = Request("MAPNAME")
l_sSession = Request("SESSION")
l_sSelect = Request("SELECTION")


Dim l_oCred As New MgUserInformation(l_sSession)
'connect to the site and get a feature service and a resource service instances

Dim l_oSite As New MgSiteConnection()

Dim l_oFeatureSrvc As MgFeatureService = l_oSite.CreateService(MgServiceType.FeatureService)
Dim l_oResourceSrvc As MgResourceService = l_oSite.CreateService(MgServiceType.ResourceService)

'Create a temporary map runtime object, locate the layer
Dim l_oMap As New MgMap()
l_oMap.Open(l_oResourceSrvc, l_sMapName)

Dim l_oSel As MgSelection = New MgSelection(l_oMap, l_sSelect)
Dim l_cSelLayers As MgReadOnlyLayerCollection = l_oSel.GetLayers()

Now you can play with your selection.
Kori Maleski  BSc. 
Senior Technical Consultant
Pacific Alliance Technologies
Suite 400 - 534 17 Ave. SW Calgary, AB CANADA T2S 0B1
TEL 403.770.1917 FAX 877.691.9149 TOL 877.691.9171 www.pat.ca <http://www.pat.ca/> 


From: Berdel, Brian [mailto:brian.berdel at mcmtrans.com]
Sent: Wed 26/04/2006 5:36 AM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] RE: PHP -> .NET Active Selection

I have not been able to get it to work with the DWF viewer either.  I
would appreciate some help here as well.

-----Original Message-----
From: kalpesh [mailto:kalpesh at pie-solution.com]
Sent: Wednesday, April 26, 2006 5:54 AM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] RE: PHP -> .NET Active Selection

Any progress to this one. I tried exactly what you specified in your
post using .NET. The problem is after the XML is passed to the other
and then when we try and do

MgMap map = new MgMap();
map.Open(resourceService, "wise");
MgSelection selection = new MgSelection(map);

if (selText != null && selText.Length > 0)
    selection.FromXml(selText); //It fails here

It now tells me "Attempted to read or write protected memory. This is
an indication that other memory is corrupt."

The selText is the XML that is submitted by
window.opener.mapFrame.GetSelectionXML() from some other page.

View this message in context:
Sent from the OSGeo MapGuide forum at Nabble.com.

To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org

To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 10702 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapguide-users/attachments/20060426/17c80d95/attachment.bin

More information about the Mapguide-users mailing list