RouteMAP IMS 3.0 .NET API

Navigating the Map

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

1) doPan(integer x, integer y)
   Method to center the map around a specified point.
2) doZoomFull()
   Method to set the map's bounding box so that it is large enough to see all objects that exist on the map.
3) doZoomIn(integer x, integer y)
   Method to zoom-in to a specified point.
4) doZoomInRect(integer top, integer left, integer bottom, integer right)
   Method to zoom-in to a specified bounding box.
5) doZoomOut(integer x, integer y)
   Method to zoom-out from a specified point.
6) doZoomOutRect(integer top, integer left, integer bottom, integer right)
   Method to zoom-out from a specified bounding box.
7) setZoomLevel(integer nLevel)
   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 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(), ImageFormat.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, if the name of your control is "map", so you'll get something like this:
http://localhost/default.asp?map.x=158&map.y=57
For example, center the map around the clicked point:
' VB.NET
map.doPan(CInt( Request("map.x")), CInt( Request("map.y")))

or

// C# | JScript.NET
map.doPan( Int32.Parse(Request["map.x"]), Int32.Parse(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.