[mapguide-users] Open map and Zoom to data

Jonio, Dennis (Aviation) DJonio at miami-airport.com
Tue Nov 6 07:42:11 EST 2007


After spending some hours on this forum I have begun to use this
watchForInitializationComplete() function as the starting point for most
of my applications. You will obviously have to adjust the
"parent.parent.parent" stuff as I crowd as many as four iframes inside
the TaskPane. I do NOT use php. I have settles on ajax.NET 1.0 and mgos
seems to love it. I have been able to make mgos respond as if it were a
desktop application. Please forgive all the syntax errors in
processParms() ... I am just trying to explain the concept.

To reiterate what others have shown me:

		var initTimer =
setInterval(watchForInitializationComplete, 250); 
        function watchForInitializationComplete()
        { 
            try { 
                if(parent.parent.parent.mapFrame.GetMapName) 
                { 
			        //alert("within watchForInitialization
...");
                    var mapName =
parent.parent.parent.mapFrame.GetMapName();                   
                    if ( mapName != null) {
                        var mapNameControl =
document.getElementById("mapName");
                        mapNameControl.value = mapName;
                        var legend_done = false;
                        if (parent.parent.parent.mapFrame.GetLegendCtrl)
                        {
                            legend_done =
parent.parent.parent.mapFrame.GetLegendCtrl().InternalStateComplete();
                            if (legend_done == true)
                            {
                               //clearInterval(initTimer);
                               var sessionNameControl =
document.getElementById("sessionName");
                               sessionName =
parent.parent.parent.mapFrame.GetSessionId();
		                       sessionNameControl.value =
sessionName;
		                       try 
		                       {
		                         processParms();
clearInterval(initTimer);
		                       } catch(exp) { alert("...Error is
fatal: " + exp.message); }
		                       
                             }
                        } 
                    }
                } 
            } 
            catch(Exception) { } 
            //catch(Exception) { alert("Waiting: Map has not finished
building. click and Retry."); } 
        }

       function ShowViaZoom(x, y, scale)
       {
            //alert("X:" + x +" Y:" + y +" Scale:" +  scale);
            parent.parent.parent.ZoomToView(x, y, scale, true);
       }

some function like this to get your parms ......

  function processParms()
  {
    var parameters = location.search.substring(1).split("&");

    var temp = parameters[0].split("=");
    l = unescape(temp[1]);
    temp = parameters[1].split("=");
    p = unescape(temp[1]);
    document.getElementById("X").innerHTML = l;
    document.getElementById("Y").innerHTML = p;
    var X = l;
    var Y = p;
    ShowViaZoom(x, y, scale);                            
  }


-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Ismael Cams
Sent: Tuesday, November 06, 2007 6:33 AM
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] Open map and Zoom to data


You could make add another "hidden" frame to your frameset. Pass the
incoming
parameters to the hidden frame and perform zoom and selection actions in
this hidden frame.

Something like:

<frameset rows="0,100,*" frameborder="NO" border="0" framespacing="0">
	<?php
			if(isset($params)){
				echo "<frame src=\"hidden.php?$params\"
name=\"hidden\"/>";
			}else{
				echo "<frame src=\"hidden.php\"
name=\"hidden\"/>";
			}
       ?>
<frame ... />
<frame ... />
</frameset>

You will also have to check first in the hidden page if the map is
already
initiated before selecting and zooming. There are some examples on the
forum
how to achieve this.




Mark Pendergraft wrote:
> 
> I'm trying to figure out how to open my map and have it automatically
> zoom to a feature by including a request querystring in the url.
> 
> For example http://localhost/mapguide/mga/mga.aspx?JobNo=04291  would
> zoom to the feature on the Jobs layer with a property of JobNo
equaling
> 04291.
> 
>  
> 
> I have already written a search/zoom to application which uses this
> property.  It runs in the scriptFrame and is usually triggered from a
> button on a page that resides in the taskPane.
> 
>  
> 
> My application opens with a page, which creates 2 frames (titleFrame,
> viewerFrame).
> 
>  
> 
> The only way I can figure out how to do this, is to pass the request
> string to a Session.Item.  Then, I have some code in the task pane's
> default page which can submit a form using javascript to the
> scriptframe.
> 
>  
> 
> However, I was hoping to put all of this functionality into the
opening
> page, that way I wouldn't have to pass variables using the session
item.
> Which is more desirable, because if the user presses the home button
in
> the task area the code would execute again.
> 
>  
> 
> Does anyone have any ideas or experience with making the map zoom to a
> feature upon being opened?  Thanks.
> 
>  
> 
>  
> 
> Ph: (425) 486-1252  Fx: (425) 486-6108  www.meadgilman.com
> <http://www.meadgilman.com/> 
> 
>  
> 
> 
>  
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context:
http://www.nabble.com/Open-map-and-Zoom-to-data-tf4609398s16610.html#a13
604926
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


E-mails are automatically scanned for viruses using McAfee.


More information about the mapguide-users mailing list