1) doPan(int x, int 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(int x, int y)
Method to zoom-in to a specified point.
4) doZoomInRect(int top, int left, int bottom, int right)
Method to zoom-in to a specified bounding box.
5) doZoomOut(int x, int y)
Method to zoom-out from a specified point.
6) doZoomOutRect(int top, int left, int bottom, int right)
Method to zoom-out from a specified bounding box.
7) setZoomLevel(int 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.DEFAULT)%>" 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.
http://localhost:8080/rmims/index.jsp?map.x=158&map.y=57For example, center the map around the clicked point:
map.doPan(Integer.parseInt( request.getParameter("map.x")), Integer.parseInt( request.getParameter("map.y")));
2) Advanced method:
This method requires a good knowledge of using 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.