<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR>
<STYLE>@font-face {
        font-family: CourierNewPSMT;
}
@font-face {
        font-family: GillSans;
}
@font-face {
        font-family: GillSans-Bold;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=568162821-13122006><FONT face=Arial
color=#0000ff size=2>Hi Scott, You are correct. There are no APIs to
Clear() or Remove() selections. Would creating an empty selection work in
your case?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=568162821-13122006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=568162821-13122006>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$selection = new
MgSelection($map);<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$selectionXml =
$selection->ToXml();<o:p></o:p></SPAN></FONT></P></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=568162821-13122006><FONT face=Arial
color=#0000ff size=2></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> Scott Hameister
[mailto:ScottH@mPower-tech.com] <BR><B>Sent:</B> Friday, December 08, 2006 10:38
PM<BR><B>To:</B> users@mapguide.osgeo.org<BR><B>Subject:</B> [mapguide-users]
Clearing Selections<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; 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><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; 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><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; 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><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; 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><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$queryOptions = new
MgFeatureQueryOptions();<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$queryOptions->SetFilter("RNAME
LIKE 'Schmitt%'");<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$queryOptions->SetSpatialFilter('SHPGEOM',<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$districtGeometry,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">MgFeatureSpatialOperations::Inside);<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">// Get the features from the
feature source,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">// turn it into a selection,
then save as XML.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$featureResId = new
MgResourceIdentifier(<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">"Library://Samples/Sheboygan/Data/Parcels.FeatureSource");<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$featureReader =
$featureService->SelectFeatures(<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$featureResId, "Parcels",
$queryOptions);<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=GillSans size=2><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: GillSans">Example: Setting the Active
Selection | </SPAN></FONT><B><FONT face=GillSans-Bold size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 11pt; FONT-FAMILY: GillSans-Bold">53<o:p></o:p></SPAN></FONT></B></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$layer =
$map->GetLayers()->GetItem('Parcels');<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$selection = new
MgSelection($map);<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$selection->AddFeatures($layer,
$featureReader, 0);<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">$selectionXml =
$selection->ToXml();<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">echo 'Setting
selection...';<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">}<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">catch (MgException
$e)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">{<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">echo
$e->GetMessage();<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">echo
$e->GetDetails();<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">}<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">?><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"></body><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><script
language="javascript"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><!-- Emit this function
and assocate it with the onLoad event --><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; 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><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><!-- in the browser. The
function calls the SetSelectionXML --><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><!-- method on the Viewer
Frame, which updates the current --><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"><!-- selection on the
viewer and the server. --><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">function
OnPageLoad()<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">{<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">selectionXml = '<?php
echo $selectionXml; ?>';<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">parent.parent.SetSelectionXML(selectionXml);<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT">}<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"></script><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=CourierNewPSMT size=1><SPAN
style="FONT-SIZE: 8pt; FONT-FAMILY: CourierNewPSMT"></html></SPAN></FONT><FONT
face=CourierNewPSMT size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: CourierNewPSMT"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P></DIV></BODY></HTML>