32
|
Chapter 3
Accessing Maps
Overview
Netscape
®
Navigator
®
and Microsoft
®
Internet Explorer
®
expose map objects
at different levels in their object hierarchies. Therefore, how you access a map
is determined by the browsers you are supporting, not by the version of
Autodesk MapGuide
®
Viewer you use. As described in this chapter, you can
write a simple function that checks the user’s browser type and returns an
instance of the
MGMap
object using the technique required by that browser.
Note that we refer to JavaScript code modules as
functions
, reserving the term
method
for the Autodesk MapGuide Viewer API. Once you’ve obtained the
map object, your application code uses that instance when it calls methods
in the Autodesk MapGuide Viewer API. In most cases, the code for either
browser will be identical.
Map Access for ActiveX Control and Plug-In
This section describes how to access maps from both Netscape Navigator and
Internet Explorer. The techniques described here use JavaScript as the
scripting language. Because Internet Explorer automatically recompiles
JavaScript code into its native JScript, you can write JavaScript code that
works with either browser.
Suppose you embedded your map and named it
map
. In Netscape Navigator,
the map object called
map
is exposed by the document object and can be
accessed from JavaScript in one of the following ways:
document.map
// one way...
document.embeds["map"]
// another way...
In Internet Explorer, the map object called
map
is exposed by the window
object and can be accessed from JavaScript in one of the following ways:
window.map
// one way...
map
// another way...
The easiest way get around these differences is to write a
getMap
function
that checks the browser type and returns the appropriate map object; that
function can then be called as needed by the rest of the code in your
application.
Summary of Contents for 15606-011408-9300 - MAP R6.3 UPG
Page 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Page 6: ...vi ...
Page 16: ...16 ...
Page 30: ...30 ...
Page 84: ...84 ...
Page 134: ...134 ...
Page 202: ...202 ...