<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>MgSelection.AddFeatures Bug?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=694131112-14032007>By calling ReadNext on the feature reader you've read
all the available features out of the reader... </SPAN></FONT><FONT
face=Arial color=#0000ff size=2><SPAN class=694131112-14032007>Just call
AddFeatures with your reader without doing your check. If the reader
contains no features then nothing will be added to the
selection.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=694131112-14032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=694131112-14032007>Walt</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> mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>Buscher,
Shane<BR><B>Sent:</B> Tuesday, March 13, 2007 10:22 PM<BR><B>To:</B>
Mapguide_users@lists.osgeo.org<BR><B>Subject:</B> [mapguide-users]
MgSelection.AddFeatures Bug?<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2>I</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2>’</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2>m simply trying to highlight selected feature</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>s</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2> based on an
attribute query.</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2>When I obtain a feature reader I check to make sure that there
are items in it, then I</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us>
<FONT face=Arial size=2>execut</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face=Arial size=2>e</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face=Arial size=2> the MgSelection.AddFeatures
method</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2>. </FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2>Nothing gets selected</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2> in the long run
after I call the</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2>SetSelectionXML(</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face=Arial size=2>‘</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face=Arial size=2>xml</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>’</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>)</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>viewer</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face=Arial size=2> api function and refresh the map. I took a look at the
xml being passed and noticed there are no records in
it. </FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2>Is there something I</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>’</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>m doing wrong
here? There are definitely records in the feature reader that
aren</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2>’</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2>t making it into the xml. Or maybe there</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>’</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial size=2>s a bug in the
MgSelection.AddFeatures() method? </FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial size=2>Any
help</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>would</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face=Arial size=2> be greatly appreciated.</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face=Arial size=2>Regards,</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face=Arial size=2>Shane</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> layer</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>As</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2> MgLayer =
_map.GetLayers.GetItem(0)</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> className</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>As</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2></FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>String</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> = layer.GetFeatureClassName</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> resourceId</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>As</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2></FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>New</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2>
MgResourceIdentifier(layer.GetFeatureSourceId)</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> queryString</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>As</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>String</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> queryOption</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>As</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>New</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2>
MgFeatureQueryOptions()</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face="Courier New"
size=2>queryOption.SetFilter(queryString)</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> featureReader</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>As</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> MgFeatureReader</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face="Courier New" size=2>featureReader =
_featureService.SelectFeatures(resourceId, className,
queryOption)</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> i</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>As</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2></FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>Integer</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> = 0</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff
size=2>While</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2>
featureReader.ReadNext</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face="Courier New" size=2> i = i +
1</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>End</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>While</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face="Courier New" color=#0000ff
size=2>If</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2> i > 0</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>Then</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2> </FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>Dim</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> selection</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>As</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2></FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>New</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2> MgSelection(_map)</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face="Courier New" size=2>
selection.AddFeatures(layer, featureReader, 0)</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face="Courier New"
size=2> </FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>Dim</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2> xml</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face="Courier New" color=#0000ff size=2>As</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>String</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" size=2> =
selection.ToXml()</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face="Courier New" color=#0000ff size=2>End</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face="Courier New" color=#0000ff
size=2>If</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face="Courier New"
size=2><?xml version="1.0" encoding="UTF-8"?></FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face="Courier New"
size=2><FeatureSet xmlns:xsi=</FONT></SPAN><SPAN lang=en-us></SPAN><A
href="http://www.w3.org/2001/XMLSchema-instance"><SPAN lang=en-us></SPAN><SPAN
lang=en-us><U><FONT face="Courier New" color=#0000ff
size=2>http://www.w3.org/2001/XMLSchema-instance</FONT></U></SPAN><SPAN
lang=en-us></SPAN></A><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face="Courier New" size=2></FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us> <FONT face="Courier New"
size=2>xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd"></FeatureSet></FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN></P></BODY></HTML>