Working with the current selection

Cory Gregor cgregor at barkerlemar.com
Fri Oct 13 16:38:12 EDT 2006


Hi Greg,

Thanks for the quick reply. Is there a way to capture the click event and
object and in which layer the user clicked so that I can handle the event in
my own page? Maybe your suggestion already deals with this, but I am really
new to this. Please let me know if there are any samples out there. I am
using ASP .NET and am not familiar with PHP. Thanks again,

Siju


Knight, Gregory wrote:
> 
> Siju,
> 
> MapGuide will do this inherently with very little effort.  There are a
> number of things you need to do to enable this.  First, in the layer
> definition, enable select the properties you wish to display when
> someone selects a feature object in the viewer.  Second, in the Map
> definition, enable feature selection for the desired layer. Lastly, in
> the Layout definition, enable the properties pane component in the
> viewer.  That's all there is too it.  Id suggest you look at the
> Sheybogan sample application for further details.
> 
> Greg 
> 
> -----Original Message-----
> From: Cory Gregor [mailto:cgregor at barkerlemar.com] 
> Sent: Friday, October 13, 2006 2:40 PM
> To: users at mapguide.osgeo.org
> Subject: [mapguide-users] RE: RE: Working with the current selection
> 
> 
> Hi,
> 
> I am kinda new to this and have not yet gone over all the posts. But
> maybe
> one you can point me to a post or can help me with what I am trying to
> do.
> Basically, I want handle a click or a double click event on the map.
> When
> the user clicks a parcel or anyother point, I want to be able to get the
> current selection so that I can display some custom properties related
> to
> the point selected. What is the correct way to do this? Any help would
> be
> appreciated. Thanks,
> 
> Siju
> 
> 
> 
> Alain Lebatard wrote:
>> 
>> Brian,
>> 
>>  
>> 
>> What you have tried before is the correct way to do, only the way you
>> retrieved the selection was not correct. Here is how things work:
>> 
>>  
>> 
>> In Studio's Web layout editor, in your InvokeURL command definition,
>> give a name to the parameter carrying the selection (I called it SEL
> in
>> this example, you're free to give the name you want):
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> When the server-side script is invoked, the parameter SEL contains the
>> XML description of the selection (snippet in C#)
>> 
>>  
>> 
>> ...
>> 
>> String selectionStr = Request.Form["SEL"];
>> 
>> MgSelection selection = new MgSelection(map);
>> 
>> selection.FromXml(selectionStr);
>> 
>> ...
>> 
>>  
>> 
>> Alain
>> 
>>  
>> 
>> -----Original Message-----
>> From: Berdel, Brian [mailto:brian.berdel at mcmtrans.com] 
>> Sent: Friday, April 28, 2006 8:23 AM
>> To: users at mapguide.osgeo.org
>> Subject: RE: [mapguide-users] RE: Working with the current selection
>> 
>>  
>> 
>> Never mind, finally got it using invoke script... thanks for all of
> your
>> 
>> help. 
>> 
>>  
>> 
>> -----Original Message-----
>> 
>> From: Berdel, Brian [mailto:brian.berdel at mcmtrans.com] 
>> 
>> Sent: Friday, April 28, 2006 10:15 AM
>> 
>> To: users at mapguide.osgeo.org
>> 
>> Subject: RE: [mapguide-users] RE: Working with the current selection
>> 
>>  
>> 
>> I have tried multiple things and for some reason (maybe I am an idiot)
>> 
>> but I am having trouble grasping how to grab the parameter in asp.net
> 
>> 
>> I know I am missing something.... thanks for your help. 
>> 
>> I have tried 
>> 
>>  
>> 
>> Dim resourceService As MgResourceService =
>> 
>> siteConnection.CreateService(MgServiceType.ResourceService)
>> 
>>         Dim featureService As MgFeatureService =
>> 
>> siteConnection.CreateService(MgServiceType.FeatureService)
>> 
>>         Dim queryOptions As New MgFeatureQueryOptions
>> 
>>         Dim map As New MgMap
>> 
>>         map.Open(resourceService, "mymap")
>> 
>>         Dim Selection As New MgSelection(map)
>> 
>>  
>> 
>>         Selection.FromXml("CurrentSelection") or
>> 
>> Selection.FromXml("$CurrentSelection")
>> 
>>  
>> 
>> -----Original Message-----
>> 
>> From: Alain Lebatard [mailto:alain.lebatard at autodesk.com] 
>> 
>> Sent: Wednesday, April 26, 2006 1:40 PM
>> 
>> To: users at mapguide.osgeo.org
>> 
>> Subject: RE: [mapguide-users] RE: Working with the current selection
>> 
>>  
>> 
>> $CurrentSelection is what you specify in Studio's web layout editor to
>> 
>> indicate that this command should send the current selection to the
>> 
>> server. When you create an Invoke URL command in Studio, look in the
>> 
>> "Additional parameters" tab, in the list "Pass in these additional
>> 
>> parameters to the URL". There you specify as "Key" the name of the
>> 
>> parameter you want for the selection, and as "Value" the macro
>> 
>> $CurrentSelection.
>> 
>>  
>> 
>> The viewer code will replace this macro with the actual value of the
>> 
>> selection at run-time, when the command is executed. The Asp.net
> script
>> 
>> will receive the XML description of the selection in the parameter you
>> 
>> specified in Studio. From there you can use an MgSelection object that
>> 
>> you can initialize either with the MgSelection constructor or the
> method
>> 
>> FromXml.
>> 
>>  
>> 
>> -----Original Message-----
>> 
>> From: Berdel, Brian [mailto:brian.berdel at mcmtrans.com] 
>> 
>> Sent: Wednesday, April 26, 2006 10:27 AM
>> 
>> To: users at mapguide.osgeo.org
>> 
>> Subject: RE: [mapguide-users] RE: Working with the current selection
>> 
>>  
>> 
>> Thanks for the response, but how would I reference the
> $CurrentSelection
>> 
>> parameter in asp.net?
>> 
>>  
>> 
>> -----Original Message-----
>> 
>> From: Alain Lebatard [mailto:alain.lebatard at autodesk.com] 
>> 
>> Sent: Wednesday, April 26, 2006 1:02 PM
>> 
>> To: users at mapguide.osgeo.org
>> 
>> Subject: RE: [mapguide-users] RE: Working with the current selection
>> 
>>  
>> 
>> The way to make it work for both the AJAX viewer and the DWF viewer is
>> 
>> to have the client send the current selection to your server-side
>> 
>> script, instead of having the server script trying to get the
> selection
>> 
>> from the session repository.
>> 
>>  
>> 
>> If your script is invoked from a web layout command 'Invoke URL', have
>> 
>> the current selection sent to the script by adding in Studio the
>> 
>> parameter $CurrentSelection to the command. If your script is invoked
> by
>> 
>> custom Javascript code, have this code retrieve the current selection
>> 
>> with GetSelectionXML() and add a parameter to your URL to send this
>> 
>> selection to the server. In this case be careful to use a POST request
>> 
>> and not a GET, as the size of the selection might exceed the maximum
>> 
>> length supported for a GET request (usually about 1K). Look at the
>> 
>> Submit() method in FormFrame, which makes it easy to do a POST
> request.
>> 
>>  
>> 
>> Alain
>> 
>>  
>> 
>> -----Original Message-----
>> 
>> From: kalpesh [mailto:kalpesh at pie-solution.com] 
>> 
>> Sent: Tuesday, April 25, 2006 9:50 PM
>> 
>> To: users at mapguide.osgeo.org
>> 
>> Subject: [mapguide-users] RE: Working with the current selection
>> 
>>  
>> 
>>  
>> 
>> But what if we want to make it work in DWF Viewer. Is there any
>> 
>> workaround ?
>> 
>>  
>> 
>> Kalpesh
>> 
>> --
>> 
>> View this message in context:
>> 
>>
> http://www.nabble.com/RE%3A-Working-with-the-current-selection-t1468388.
>> 
>> html#a4094930
>> 
>> 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
>> 
>>  
>> 
>>  
>> 
>> ---------------------------------------------------------------------
>> 
>> 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
>> 
>>  
>> 
>>  
>> 
>> ---------------------------------------------------------------------
>> 
>> 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
>> 
>>  
>> 
>> 
>>  
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/RE%3A-Working-with-the-current-selection-tf1468388
> ..html#a6801479
> Sent from the OSGeo MapGuide mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
> 
> 
> -----------------------------------------
> The substance of this message, including any attachments, may be
> confidential, legally
> privileged and/or exempt from disclosure pursuant to Massachusetts
> law. It is intended
> solely for the addressee. If you received this in error, please
> contact the sender and
> delete the material from any computer.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/RE%3A-Working-with-the-current-selection-tf1468388.html#a6803443
Sent from the OSGeo MapGuide mailing list archive at Nabble.com.





More information about the Mapguide_users mailing list