| MGMap.digitizePoint |
|
ActiveX Control: boolean digitizePoint()
Plug-In/Java Edition: boolean digitizePoint(MGDigitizePointObserver observer)
Enables the user to define a point on the map by clicking the mouse.
After the point has been specified, digitizePoint fires the onDigitizedPoint event, passing it the point coordinates, the map object, and for Netscape and the Autodesk MapGuide Viewer, Java Edition, the observer applet.
This method is meant to be used with an onDigitizedPoint event handler; see the example for details.
Note that this method does not work during a busy state. For additional information about the busy state, refer to "Handling Busy State and Map Refresh" chapter in the Autodesk MapGuide Developer's Guide.
observer - A Java object that implements MGDigitizePointObserver (Plug-In and Java Edition only).
boolean - Returns True if successful; otherwise, returns False.
-1 (busy)
The following example is designed to work with the Tutorial.mwf file that is included with Autodesk MapGuide Author. It shows how to display the coordinates of a a user-specified point. First, a function named getThePoint invokes the appropriate digitize method:
function getThePoint()
{
if (navigator.appName == "Netscape")
getMap().digitizePoint(document.obs);
else
getMap().digitizePoint();
}
Then, if you've set up your event handler properly, digitizePoint() fires the onDigitizedPoint event, passing it the map object and the user-specified point. If the browser is Netscape, the observer applet is passed as well. See "Handling Events" in the Autodesk MapGuide Developer's Guide for information about working with events and observers, including setting up event handlers.
Finally, the onDigitizedPoint event looks for a JavaScript function of the same name and, if that function exists, executes it:
function onDigitizedPoint(map, point)
{
alert("The coordinates are:\n\nLAT = " + point.getY() + ", LON = " + point.getX());
}
digitizeCircle, digitizePolygonEx, digitizePolylineEx