Writing Event Handlers
|
83
Plug-In Event Handler Example
To handle events in an applet for the Autodesk MapGuide Viewer Plug-In,
you need to implement the corresponding Autodesk MapGuide Viewer event
handler interfaces in your applet.
To implement event handler interfaces
1
Implement the interface of the event that you want to handle in your
applet.
For instance, if you want to handle the
onDigitizedCircle
event, you
need to implement the
MGDigitizeCircleObserver
interface in your
applet. The
MGDigitizeCircleObserver
observer contains one
method,
onDigitizedCircle
. To implement
MGDigitizeCircleObserver
, your applet must implement this
method. For example:
public class myApplet extends applet implements
MGDigitizeCircleObserver
{
public void onDigitizedCircle(MGMap map, String units,
MGPoint center, double radius)
{
// Place your event-handling code here
}
...
}
Now your applet can act as an event observer for the
onDigitizedCircle
event.
2
Every time you call the method that triggers the event, pass in the name
of your applet as the second parameter.
For example, whenever you call
digitizeCircle
method in your applet,
you must pass in your applet name (in this case, the keyword
this
since
the applet is referring to itself) as the second parameter. For example:
Public void testDigitizedCircle()
{
myUSMap.digitizeCircle("", this);
}
When Autodesk MapGuide Viewer Plug-In triggers the
onDigitizedCircle
event, the applet will execute the code you imple-
mented for
onDigitizedCircle
in your applet.
Содержание 15606-011408-9300 - MAP R6.3 UPG
Страница 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Страница 6: ...vi ...
Страница 16: ...16 ...
Страница 30: ...30 ...
Страница 84: ...84 ...
Страница 134: ...134 ...
Страница 202: ...202 ...