<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>MgSelection.AddFeatures Bug?</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks Walt for pointing that out (duh on
my part).&nbsp; This fixed my problem.&nbsp; <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Regards,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Shane<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='margin-left:.5in;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal style='margin-left:.5in'><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Walt Welton-Lair<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, March 14, 2007
7:18 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">MapGuide
 Users Mail List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [mapguide-users]
MgSelection.AddFeatures Bug?</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>By calling ReadNext on
the feature reader you've read all the available features out of the
reader...&nbsp; Just call AddFeatures with your reader without doing your
check.&nbsp; If the reader contains no features then nothing will be added to
the selection.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>Walt<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div class=MsoNormal align=center style='margin-left:.5in;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabIndex=-1>

</span></font></div>

<p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:
12.0pt;margin-left:.5in'><b><font size=2 face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b><st1:PersonName w:st="on">Buscher, Shane</st1:PersonName><br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, March 13, 2007
10:22 PM<br>
<b><span style='font-weight:bold'>To:</span></b> Mapguide_users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [mapguide-users]
MgSelection.AddFeatures Bug?</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><!-- Converted from text/rtf format -->I&#8217;m
simply trying to highlight selected features based on an attribute query.</span></font>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>When I
obtain a feature reader I check to make sure that there are items in it, then I</span></font>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>execute
the MgSelection.AddFeatures method.&nbsp;</span></font>&nbsp; <font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>Nothing gets
selected in the long run after I call the</span></font> <font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>SetSelectionXML(&#8216;xml&#8217;)</span></font>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>viewer
api function and refresh the map.&nbsp; I took a look at the xml being passed
and noticed there are no records in it.&nbsp;</span></font> <font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>Is there something
I&#8217;m doing wrong here?&nbsp; There are definitely records in the feature
reader that aren&#8217;t making it into the xml.&nbsp; Or maybe there&#8217;s a
bug in the MgSelection.AddFeatures() method?&nbsp;</span></font> <font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>Any help</span></font>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>would
be greatly appreciated.</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Regards,</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Shane</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
layer</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
MgLayer = _map.GetLayers.GetItem(0)</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
className</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>String</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> = layer.GetFeatureClassName</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
resourceId</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>New</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>
MgResourceIdentifier(layer.GetFeatureSourceId)</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
queryString</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>String</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
queryOption</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>New</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> MgFeatureQueryOptions()</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>queryOption.SetFilter(queryString)</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
featureReader</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
MgFeatureReader</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>featureReader =
_featureService.SelectFeatures(resourceId, className, queryOption)</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Dim</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
i</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>As</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>Integer</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> = 0</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>While</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
featureReader.ReadNext</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp; i = i + 1</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>End</span></font>
<font size=2 color=blue face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:blue'>While</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>If</span></font><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>
i &gt; 0</span></font> <font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>Then</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>Dim</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> selection</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>As</span></font> <font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>New</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> MgSelection(_map)</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;
selection.AddFeatures(layer, featureReader, 0)</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>Dim</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> xml</span></font> <font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>As</span></font> <font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>String</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> = selection.ToXml()</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 color=blue face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>End</span></font>
<font size=2 color=blue face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:blue'>If</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&lt;?xml
version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span></font><o:p></o:p></p>

<p style='margin-left:.5in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&lt;FeatureSet xmlns:xsi=</span></font><a
href="http://www.w3.org/2001/XMLSchema-instance"><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>http://www.w3.org/2001/XMLSchema-instance</span></font></a>
<font size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>xsi:noNamespaceSchemaLocation=&quot;FeatureSet-1.0.0.xsd&quot;&gt;&lt;/FeatureSet&gt;</span></font><o:p></o:p></p>

</div>

</body>

</html>