RouteMAP IMS 3.0 .NET API

Navigating the Map

There are several methods of the Map object that allows navigating the map.

1) doPan(integer x, integer y)
   Call this method to center the map around a specified point
2) doZoomFull()
   Call this method to set the map’s bounding box large enough to see all objects that exist on the map.
3) doZoomIn(integer x, integer y)
   Call this method to zoom-in to a specified point.
4) doZoomInRect(integer top, integer left, integer bottom, integer right)
   Call this method to zoom-in to a specified bounding box.
5) doZoomOut(integer x, integer y)
   Call this method to zoom-out from a specified point.
6) doZoomOutRect(integer top, integer left, integer bottom, integer right)
   Call this method to zoom-out from a specified bounding box.
7) setZoomLevel(integer nLevel)
   Call this method to change the zoom level for the map.

Most of the above methods require the parameters to be specified in pixels. There are two main methods which can be used to obtain the coordinates of the clicked point on the map image:

1) Simple method:

Include the following code (or similar code) in your script:

<form>
<input type="image" name="map" src="<%= Map.getMapImageURL(Map.getImageWidth(), Map.getImageHeight(), rmDefault)%>"
width="<%=Map.getImageWidth()%>" height="<%=Map.getImageHeight()%>">
</form>
The above script enables the image to be an HTML image control. Now every time you click the image you will submit the form and get two additional parameters: the x-coordinate submitted under the name of the control with .x appended, and the y-coordinate submitted under the name of the control with .y appended.
For example, the name of our control is "map", so you'll get something like this:
http://localhost/default.asp?map.x=158&map.y=57
Now you can, for example, center the map around the clicked point:
// JScript
Map.doPan(parseInt( Request("map.x")), parseInt( Request("map.y"))); 

or

' VBScript
Map.doPan(CInt( Request("map.x")), CInt( Request("map.y"))) 

2) Advanced method:

This method requires a good knowledge of DHTML. First, you must set up an event capture for mouse movement. You must then locate the map image using the properties of the map image object. Finally, you need to locate the mouse pointer.

For an example see the JSP Template (Frames) based application.