<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You have to wait until the map has loaded, because the viewer creates
the runtime map that you want to query.<br>
Once the map has loaded, you can access the runtime map, and set the
selection.<br>
<br>
You will need some javascript like this:<br>
<br>
<tt><span style="font-size: 10pt;"><!-- Javascript part --></span></tt><span
style="font-size: 10pt; font-family: "Courier New";"><br>
<tt><script type="text/javascript"></tt><br>
<tt> var mapFrame = null; // A reference to the
map frame</tt><br>
<tt> var originalMapFrameOnSelectionChanged = null // storage
for the original onSelectionChanged function</tt><br>
<tt> function OnSelectionChanged() // when something is
selected on the map</tt><br>
<tt> {</tt><br>
<tt> alert('Your handler works
perfectly');</tt><br>
<tt>
originalMapFrameOnSelectionChanged();</tt><br>
<tt> }</tt><br>
<tt> </tt><br>
<tt> function InitDocument()</tt><br>
<tt> {</tt><br>
<tt> var win =
document.getElementById('viewerFrame');</tt><br>
<tt> if (win.contentWindow) //FF returns
the actual tag, IE returns the iframe</tt><br>
<tt> win = win.contentWindow;</tt><br>
<tt> mapFrameRef = win.GetMapFrame();</tt><br>
<tt> originalMapFrameOnSelectionChanged =
mapFrameRef.parent.OnSelectionChanged;</tt><br>
<tt>
mapFrameRef.parent.OnSelectionChanged =
OnSelectionChanged; </tt><br>
<tt> } </tt><br>
<br>
<tt> function RetryInit()</tt><br>
<tt> {</tt><br>
<tt> if (mapFrame != null)</tt><br>
<tt> return;</tt><br>
<tt> </tt><br>
<tt> try</tt><br>
<tt> {</tt><br>
<tt> InitDocument();<br>
//At this point, you can post a "PageLoaded" via a form or
AJAX<br>
</tt> <tt> }</tt><br>
<tt> catch (e)</tt><br>
<tt> {</tt><br>
<tt> mapFrame = null;</tt><br>
<tt> }</tt><br>
<tt> </tt><br>
</span><tt><span style="font-size: 10pt;"> if
(originalMapFrameOnSelectionChanged ==
null)</span></tt><span
style="font-size: 10pt; font-family: "Courier New";"><br>
<tt> {</tt><br>
<tt> mapFrame = null;</tt><br>
<tt> window.setTimeout("RetryInit();", 500);</tt><br>
<tt> }</tt></span><br>
<span style="font-size: 10pt; font-family: "Courier New";"><tt></script></tt><br>
<br>
<tt><!-- HTML part --></tt><br>
<tt><html></tt><br>
<tt><body></tt><br>
<tt> <iframe id="viewerFrame"
frameborder="yes" width="100%" height="60%"
src="
src="../mapviewernet/dwfviewer.aspx?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>""
onload="RetryInit()"></iframe></tt><br>
<tt></body></tt><br>
<tt></html></tt><br>
<br>
</span><br>
<pre class="moz-signature" cols="72">Regards. Kenneth, GEOGRAF A/S
</pre>
<br>
<br>
Nick Aizen skrev:
<blockquote
cite="mid:C5302DE97C388A46AB9F6FA0B91AC81908DD45938C@AUSP01VMBX01.collaborationhost.net"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal">Can anyone help me with this process, I’m new to
both
web development and MapGuide API development, so please excuse me if I
don’t
ask my question the correct way but basically….<o:p></o:p></p>
<p class="MsoNormal">I want to be able to load a weblayout (created
in MG
Studio), when my asp.net page loads and query and zoom on the map in
the
weblayout before the page is fully displayed. Basically I will be
calling the
asp.net page from an application passing it parameters for the query
functionality.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> I would appreciate it if someone can provide a
code
snippet. I’m using as my base, one of the examples provided on the
Autodesk web site. I can provide any information regarding the project
being
used if that will help. Also, other than the PDF’s provided my Autodesk
are there any helpful resources for developers?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here’s the code when the page loads that loads a
weblayout:<o:p></o:p></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";"> <span
style="color: rgb(43, 145, 175);">MgUserInformation</span>
userInfo = <span style="color: blue;">new</span> <span
style="color: rgb(43, 145, 175);">MgUserInformation</span>(<span
style="color: rgb(163, 21, 21);">"Administrator"</span>, <span
style="color: rgb(163, 21, 21);">"admin"</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";"> <span
style="color: rgb(43, 145, 175);">MgSite</span>
site = <span style="color: blue;">new</span> <span
style="color: rgb(43, 145, 175);">MgSite</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";">
site.Open(userInfo);<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";"> <span
style="color: rgb(43, 145, 175);">String</span>
sessionId = site.CreateSession();<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";">
<span style="color: rgb(43, 145, 175);">String</span> webLayout = <span
style="color: rgb(163, 21, 21);">"Library://DevTV/HelloWorld.WebLayout"</span>;<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";">‘Need
help with API to query and zoom’<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";">Then
the layout is passed to the viewer.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New";"><o:p> </o:p></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New"; color: blue;"><</span><span
style="font-size: 10pt; font-family: "Courier New"; color: rgb(163, 21, 21);">frameset</span><span
style="font-size: 10pt; font-family: "Courier New";"> <span
style="color: red;">rows</span><span style="color: blue;">="0,*"</span>
<span style="color: red;">border</span><span style="color: blue;">="0"</span>
<span style="color: red;">framespacing</span><span
style="color: blue;">="0"><o:p></o:p></span></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";"> <span
style="color: blue;"><</span><span style="color: rgb(163, 21, 21);">frame</span>
<span style="color: blue;">/><o:p></o:p></span></span></p>
<p class="MsoNormal" style=""><span
style="font-size: 10pt; font-family: "Courier New";"> <span
style="color: blue;"><</span><span style="color: rgb(163, 21, 21);">frame</span>
<span style="color: red;">src</span><span style="color: blue;">="/mapguide2008/mapviewernet/ajaxviewer.aspx?SESSION=</span><span
style="background: yellow none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><%</span>=
sessionId <span
style="background: yellow none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">%></span><span
style="color: blue;">&WEBLAYOUT=</span><span
style="background: yellow none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><%</span>=
webLayout <span
style="background: yellow none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">%></span><span
style="color: blue;">"</span> <span style="color: red;">name</span><span
style="color: blue;">="ViewerFrame"</span>
<span style="color: blue;">/><o:p></o:p></span></span></p>
<p class="MsoNormal"><span
style="font-size: 10pt; font-family: "Courier New"; color: blue;"></</span><span
style="font-size: 10pt; font-family: "Courier New"; color: rgb(163, 21, 21);">frameset</span><span
style="font-size: 10pt; font-family: "Courier New"; color: blue;">></span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Many Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Nick Aizen<o:p></o:p></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
</body>
</html>