<!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.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2>I haven't tried this yet, but I'd imagine that getting the
attributes could by done with some kind of custom web
service.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2>You could either have the service render JavaScript and
load it in one of the hidden frames, or you could use AJAX and make an
XMLHTTP request directly to the service.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2>The facilities for doing this may already be there in the
AJAX viewer?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=039265621-04052006><FONT face=Arial
color=#0000ff size=2>Jason</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
14:44<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>