<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>DWF Viewer API for managing selections</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5335.5" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=480341822-04052006><FONT face=Arial
color=#0000ff size=2>Regarding: "Can I somehow configure what the feature ID of
a feature source is based on?" I had this same question when setting up
some functions to emulate MapGuide 6.5 reporting functionality and determined
that the answer is "no". In this case, the source data in MGOS is
completely disparate from an external database (and joins did not work back
then). I was using some existing ASP reports from a MG6.5 site that
accepted Parcel ID's as URL parameters. In order to accomplish this, I had
to use the API to get the selection set, then use the FDO API to query the MGOS
datasource to extract the Parcel ID's that were in the datasource based on the
Feature ID's and then pass that on to the external report.
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=480341822-04052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=480341822-04052006><FONT face=Arial
color=#0000ff size=2>That's a lot of overhead for a simple function.
I would much rather be able to specify on a layer by layer basis what I
want MY key field to be (much like the old MapGuide). If the internal
Feature ID also needs to come along for the ride, then so be it. This is
also a problem with the $CurrentSelection parameter when using the Invoke URL
command option in Studio. In many cases, the Feature ID obtained from the
selection is not going to do the developer any good and they will have to add
the step to go get meaningful values.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=480341822-04052006></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=480341822-04052006></SPAN><SPAN
class=480341822-04052006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=480341822-04052006></SPAN><SPAN
lang=en-us><FONT face=Tahoma size=1>Andy Morsell, P.E.</FONT></SPAN> <BR><SPAN
lang=en-us><FONT face=Tahoma size=1>Spatial Integrators, Inc.</FONT></SPAN>
<BR><SPAN lang=en-us><FONT face=Tahoma size=1><A
href="http://www.SpatialGIS.com">http://www.SpatialGIS.com</A></FONT></SPAN>
</DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Joel Carranza [mailto:jec@gatekeeper.com]
<BR><B>Sent:</B> Thursday, May 04, 2006 3:12 PM<BR><B>To:</B>
users@mapguide.osgeo.org<BR><B>Subject:</B> RE: [mapguide-users] DWF Viewer API
for managing selections<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2>My end goal is to emulate 6.5 behavior in that i need to
able to select objects via map key and get the selected objects's map key. The
problem I see is that the feature ID appears to be some kind of
internal ID and not related back to a user specified property of the
feature source (say for example the PK of the database row). As such, I have no
way to tie my data to a feature on the map. </FONT></SPAN><SPAN
class=552535021-04052006><FONT face=Arial color=#0000ff size=2>Making an
additional server side call seems kindof ridiculous. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2>So my question is this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2>- Can I somehow configure what the feature ID of a feature
source is based on? How do you currently generate feature IDs ?
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2>- We are willing to accept the limitation of only
selecting/getting the selection of onscreen objects. How can I access attribute
data for the features that are currently visible on the
screen?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=552535021-04052006><FONT face=Arial
color=#0000ff size=2>--Joel</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Walt Welton-Lair
[mailto:walt.welton-lair@autodesk.com] <BR><B>Sent:</B> Thursday, May 04, 2006
2:44 PM<BR><B>To:</B> users@mapguide.osgeo.org<BR><B>Subject:</B> RE:
[mapguide-users] DWF Viewer API for managing selections<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006>The selection set will be a collection of
IAdEMapInstance objects. Each object has three
properties:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006> - LayerObjectId
the unique ID of the layer containing the instance</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006>
- ObjectClass the feature
class</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006> -
Id the
feature ID</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006>You cannot directly access the attributes of features
through the DWF Viewer API. That's because the viewer only stores data
(graphical + attributes) for the features currently visible on the screen.
This is one of the major differences between MapGuide 6.5 and MapGuide OS.
</SPAN></FONT><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006>Note also that the selection set is persistent.
If you select a feature, pan the view so it's offscreen, and then pan the
view so its onscreeen again then you'll still see it selected. The
IAdEMapInstance objects provide the minimum information needed to uniquely
identify a feature, and are what allow this persistent selection
behavior.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=832031215-03052006>If you want to obtain the attributes of a feature, then
you'll need to go beyond the DWF Viewer API and make a SelectFeatures feature
service request.</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Joel Carranza [mailto:jec@gatekeeper.com]
<BR><B>Sent:</B> Tuesday, May 02, 2006 4:02 PM<BR><B>To:</B>
users@mapguide.osgeo.org<BR><B>Subject:</B> [mapguide-users] DWF Viewer API for
managing selections<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<P><FONT face=Arial size=2>I am trying to write some code to inspect the current
selection using the DWF Viewer. However, I am unable to find any documentation
on what comes out of the "selectionSet" property of the viewer. I see that it is
a collection of some kind, but I don’t know what the type that comes out of the
collection is. I consulted the "</FONT><FONT face="Times New Roman">Viewer APIs
for Emap" document but didn’t see any relevant information.</FONT> </P>
<P><FONT face=Arial size=2>The code I am using is something like the following:
</FONT></P>
<P><FONT face=Arial size=2> var selectionSet =
emapViewer.SelectionSet;</FONT> <BR><FONT face=Arial size=2>
</FONT><BR><FONT face=Arial size=2> for(selEnumerator = new
Enumerator(selectionSet); !selEnumerator.atEnd();
selEnumerator.moveNext())</FONT> <BR><FONT face=Arial size=2>
{</FONT> <BR><FONT face=Arial size=2>
var feature = selEnumerator.item();</FONT> <BR><FONT face=Arial
size=2> var id = feature.id;</FONT>
<BR><FONT face=Arial size=2> var
layerId = feature.LayerObjectId;</FONT> <BR><FONT face=Arial
size=2> // what is feature?
</FONT><BR><FONT face=Arial size=2> //
what are its properties and methods?
</FONT><BR><FONT face=Arial size=2> }</FONT> </P>
<P><FONT face=Arial size=2>Specifcally, I want programmatic access to the object
properties that are shown in the properties pane. Anybody know how to do
this?</FONT></P>
<P><FONT face="Courier New" size=2>--Joel</FONT> </P><BR></BODY></HTML>