<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Viewer API Selection Timing Issues</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=363080415-15032007>You're using DWF Viewer right?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007>With DWF Viewer there's a WaitForMapUpdated API
you can call on the EMapViewer document handler. That method is precisely
there to solve your kind of problem. Just call it after the zoom call
and before the select.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007>I sent you all the DWF Viewer API a while back, so you
have the necessary information.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007>In general, t</SPAN></FONT><FONT face=Arial
color=#0000ff size=2><SPAN class=363080415-15032007>he difficulty is that
the MapGuide "client API" is the API common to DWF and AJAX. DWF
Viewer has tons more API available (like this WaitForMapUpdated method) that's
just not exposed in the MapGuide client API layer.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=363080415-15032007>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> Thursday, March 15, 2007 4:02 PM<BR><B>To:</B>
Mapguide_users@lists.osgeo.org<BR><B>Subject:</B> [mapguide-users] Viewer API
Selection Timing Issues<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
may be going about this the wrong way, but here</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 my problem. I
want to</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2> select a feature based on</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial size=2>an attribute
query</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT face=Arial
size=2> in the task pane</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face=Arial size=2>, automatically zoom to it,
and</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>highlight</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>it. </FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us> <FONT face=Arial size=2>I have found highlighting the feature to be
the most</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>problematic because the feature has to exist within the map
frame</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>extent</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face=Arial size=2> before it can be selected with</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial size=2>the
SetSelectionXML() Viewer api function.</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial size=2>As far as I know,
this is the only function call you can make in MapGuide to</FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>highlight</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face=Arial size=2> features. </FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN><SPAN lang=en-us></SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face=Arial size=2>Knowing that
SetSelectionXML() will only highlight features in the current map extent, I
preceded to zoom to the feature</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us> <FONT face=Arial size=2>(ZoomToView)</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>before calling
SetSelectionXML(). </FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us>
<FONT face=Arial size=2>The problem is that the map can</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 zoom quick enough,
and so no features</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2>are</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us><FONT face=Arial size=2> highlighted:</FONT></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><FONT face=Arial
size=2>ZoomToView(x, y, scale); </FONT></SPAN><SPAN
lang=en-us></SPAN><SPAN lang=en-us> </SPAN></P>
<P dir=ltr><SPAN lang=en-us><FONT face=Arial
size=2>SetSelectionXML(xmlSet);</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>no features exist yet
because of</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT
face=Arial size=2>delay in ZoomToView</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><FONT face=Arial size=2>I don</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
have</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>any</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face=Arial size=2> problems when the feature already exists in my map
extent. Does anyone have a workaround or better method
to</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>accomplish</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us><FONT
face=Arial size=2> this? </FONT></SPAN><SPAN lang=en-us></SPAN><SPAN
lang=en-us> <FONT face=Arial size=2>The only hack can think of is to pause
the</FONT></SPAN><SPAN lang=en-us></SPAN><SPAN lang=en-us> <FONT face=Arial
size=2>execution</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>of SetSelectionXML() until ZoomoView is complete, but
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 not sure the best way to code this. </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></SPAN><A name=""><SPAN lang=en-us><FONT face=Arial
size=2>Regards,</FONT></SPAN></A></P>
<P dir=ltr><SPAN lang=en-us><FONT face=Arial size=2>Shane</FONT></SPAN></P>
<P dir=ltr><SPAN lang=en-us></SPAN></P></BODY></HTML>