<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" 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)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:CourierNewPSMT;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:GillSans;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:GillSans-Bold;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* 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:purple;
        text-decoration:underline;}
span.EmailStyle17
        {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=purple>
<div class=Section1>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>I’m
using this code from the Developers book , It’ works fine, except it
grabs the correct objects, but doesn’t release objects already selected.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>How
do I clear out the Selection in advance so that ONLY my new FILTERED objects
are in the selection.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>Is
there a selection.Clear() or selection.Remove() option to the webAPi besides
for only Adds.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>I
can’t call the parent.mapFrame.ClearSelection() with javascript, because
it runs after the page has compiled and deletes the selection after its been
created.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$queryOptions
= new MgFeatureQueryOptions();<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$queryOptions->SetFilter("RNAME
LIKE 'Schmitt%'");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$queryOptions->SetSpatialFilter('SHPGEOM',<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$districtGeometry,<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>MgFeatureSpatialOperations::Inside);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>//
Get the features from the feature source,<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>//
turn it into a selection, then save as XML.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$featureResId
= new MgResourceIdentifier(<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>"Library://Samples/Sheboygan/Data/Parcels.FeatureSource");<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$featureReader
= $featureService->SelectFeatures(<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$featureResId,
"Parcels", $queryOptions);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=2 face=GillSans><span
style='font-size:11.0pt;font-family:GillSans'>Example: Setting the Active Selection
| </span></font><b><font size=2 face=GillSans-Bold><span style='font-size:11.0pt;
font-family:GillSans-Bold;font-weight:bold'>53<o:p></o:p></span></font></b></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$layer
= $map->GetLayers()->GetItem('Parcels');<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$selection
= new MgSelection($map);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$selection->AddFeatures($layer,
$featureReader, 0);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>$selectionXml
= $selection->ToXml();<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>echo
'Setting selection...';<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>catch
(MgException $e)<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>echo
$e->GetMessage();<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>echo
$e->GetDetails();<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>?><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'></body><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><script
language="javascript"><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><!--
Emit this function and assocate it with the onLoad event --><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><!--
for the page so that it gets executed when this page loads--><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><!--
in the browser. The function calls the SetSelectionXML --><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><!--
method on the Viewer Frame, which updates the current --><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'><!--
selection on the viewer and the server. --><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>function
OnPageLoad()<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>selectionXml
= '<?php echo $selectionXml; ?>';<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>parent.parent.SetSelectionXML(selectionXml);<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'>}<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'></script><o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=1
face=CourierNewPSMT><span style='font-size:8.0pt;font-family:CourierNewPSMT'></html></span></font><font
size=2 face=CourierNewPSMT><span style='font-size:10.0pt;font-family:CourierNewPSMT'><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> </o:p></span></font></p>
</div>
</body>
</html>