Go to object model Go to parent topic Go to previous topic Go to next topic

MGMap is the top-level object of the API for the Autodesk MapGuide ActiveX Control, Plug-In, and Java Edition. For the ActiveX Control, MGMap is a COM interface.

Java Development for Autodesk MapGuide Viewer Plug-In: For Autodesk MapGuide Viewer Plug-In, MGMap is a concrete class that resides in the mapguide package, located in the npmapv32.zip file in the Netscape Plugins folder.

Java Development for Autodesk MapGuide Viewer, Java Edition: For Autodesk MapGuide Viewer, Java Edition, MGMap is a Java interface that resides in the com.autodesk.mgjava package, which is located in the mgjava.cab file (for Windows systems only) and the mgjava.jar file (for all platforms). MGMap is implemented by the concrete classes MGMapApplet and MGMapComponent.

Example

The following is an example of accessing an MGMap object. If your embedded map has the name myMap, the code to access it in a simple, frameless HTML page will look something like this:

// name is "getMap()", but it can be anything you like
function getMap()
{
    if (navigator.appName() == "Netscape")
        return document.myMap;   // access map with Navigator
    else
        return window.myMap;     // access map with IE
}

If your application has multiple frames, the code to access the map in a frame called "Left" will look something like this:

{
    if (navigator.appName() == "Netscape")
        return parent.Left.document.myMap;
    else
        return parent.Left.myMap;
}

Methods

aboutDlg

Displays the Autodesk MapGuide About dialog box, which shows information about Autodesk MapGuide Viewer.

addMapLayer

Downloads and adds the specified Map Layer File (.mlf) to the map.

addMapLayers

Downloads and adds the specified Map Layer Files to the map.

copyMap

Copies the current view of the map to the clipboard as an Enhanced Windows Metafile.

copyUrl

Copies the URL of the displayed map to the clipboard.

createLayer

Adds a layer of the specified type to the map.

createMapLayerGroup

Creates a new map layer group and adds it to the map.

createObject

Creates and returns an object of the specified type.

digitizeCircle

Enables the user to define a circle on the map by clicking and dragging the mouse.

digitizeLine

Enables the user to draw a line on the map by clicking and dragging the mouse.

digitizePoint

Enables the user to define a point on the map by clicking the mouse.

digitizePolygon

Enables the user to use the mouse to define a polygon on the map, then fires the event onDigitizedPolygon upon completion.

digitizePolygonEx

Enables the user to use the mouse to define a polygon on the map, then fires the event onDigitizedPolygon upon completion.

digitizePolyline

Enables a user to use the mouse to define a polyline on the map, then fires the event onDigitizedPolyline upon completion.

digitizePolylineEx

Enables a user to use the mouse to define a polyline on the map, then fires the event onDigitizedPolyline upon completion.

digitizeRectangle

Enables the user to define a rectangle on the map by clicking and dragging the mouse, then fires the onDigitizedRectangle event upon completion.

disableApiExceptions

Disables Autodesk MapGuide Viewer from throwing exceptions.

disablePrintingEvents

Disables the Autodesk MapGuide Viewer from sending printing events to the associated event handler during a print process.

disableSelectionChangedEvent

Disables the firing of the onSelectionChanged event during calls to the MGMapLayer methods removeObject, removeObjects, and removeAllObjects.

enableApiExceptions

Enables Autodesk MapGuide Viewer exception throwing.

enablePrintingEvents

Enables the Autodesk MapGuide Viewer to send printing events to the associated event handler during a print process.

enableSelectionChangedEvent

Enables the firing of the onSelectionChanged event during calls to the MGMapLayer methods removeObject, removeObjects, and removeAllObjects.

getApiVersion

Gets the Autodesk MapGuide Viewer API version.

getAutoLinkDelay

Gets the number of seconds before the next HTML page associated with a map feature from the AutoLinkLayer will be displayed in the AutoLinkTarget window.

getAutoLinkLayers

Gets the name of the layer that uses the AutoLink feature.

getAutoLinkTarget

Gets the name of the target window where Autodesk MapGuide will display the HTML pages associated with map features on the AutoLinkLayer.

getAutoRefresh

Returns a boolean value that indicates whether or not the automatic refresh feature is enabled.

getBufferSetup

Gets an object that contains buffering properties, such as the distance from the selected features to draw the buffers.

getBusyStateChangedObserver

Returns a reference to the Java object that observes busy state change events, or null if no observer has been established.

getDefaultTarget

Gets the name of the default target window where Autodesk MapGuide will display HTML documents, including autolinks, errors, feature links, reports, and URL lists.

getDisplayUnits

Gets the current type of display units being used to display the map width, as seen in the status bar.

getDoubleClickObserver

Returns a reference to the Java object being used to observe double-click events, or null if no observer has been established.

getErrorTarget

Gets the name of the target window where Autodesk MapGuide will display error messages.

getHeight

Gets the height of the map.

getIntermediateUpdatesEnabled

Get the current setting of the intermediate updates flag.

getLastError

Returns a reference to the MGError object of the most recent Autodesk MapGuide Viewer API method call or property access.

getLat

Gets the latitude (Y) value in decimal degrees of the center of the map area currently displayed.

getLon

Gets the longitude (X) value in decimal degrees of the center of the map area currently displayed.

getMapExtent

Gets the extents for the map or current map view.

getMapLayer

Gets the specified map layer.

getMapLayerGroup

Gets the specified map layer group.

getMapLayerGroups

Gets an MGCollection object containing all the map layer groups defined in the map.

getMapLayers

Returns a Vector (or MGCollection) object containing all the map layers defined in the map.

getMapLayersEx

Gets an MGCollection object containing all the map layers defined in the map.

getMapLoadedObserver

Returns a reference to an MGMapLoadedObserver object or null if no observer has been established.

getMcsScaleFactor

Gets the conversion factor to convert from the current Mapping Coordinate System (MCS) to meters.

getMode

Gets the current mode of the Autodesk MapGuide Viewer.

getName

Gets the name of the map, as set in the Preferences dialog box in Autodesk MapGuide Author, or with setName.

getObjectLinkTarget

Gets the name of the target window where Autodesk MapGuide will display the URL associated with a map feature.

getPageSetup

Gets an object containing properties used by Autodesk MapGuide to print maps.

getPrintingObserver

Returns a reference to the Java object being used to observe printing events.

getRedlineSetup

Gets an object containing all properties for drawing redline features.

getReportTarget

Gets the name of the target window where Autodesk MapGuide will display reports from View Reports command.

getScale

Gets the current map display scale in terms of 1:scale.

getSelection

Gets the currently selected map features.

getSelectionChangedObserver

Returns a reference to the Java object being used to observe selection change events, or null if no observer has been established.

getSelectionMode

Gets the selection mode, which controls how map features are selected when a feature is not fully contained in the selection area.

getSymbols

Gets a collection of strings representing the symbols available for use as symbol attributes.

getTrackingID

Gets the customer tracking ID associated with a map.

getUnits

Gets the current units that will be used when getting or setting the MapWidth property, or when using getWidth or setWidth without specifying the Units parameter.

getUrl

Gets the URL of the map that is currently displayed by Autodesk MapGuide Viewer.

getUrlListState

Returns True if Autodesk MapGuide will generate an HTML document that lists the names and URLs associated with a map feature as the user pauses the mouse pointer over that feature.

getUrlListTarget

Gets the name of the target window where Autodesk MapGuide will display the names and URLs associated with a map feature as the user pauses the mouse pointer over that feature.

getVersion

Gets the version string of the Autodesk MapGuide Viewer.

getViewChangedObserver

Returns a reference to the Java object being used to observe view change events, or null if no observer has been established.

getViewChangingObserver

Returns a reference to the Java object that observes when a map is about to be refreshed, or null if no such observer has been established.

getViewDistanceExObserver

Returns a reference to the Java object that observes view distance events, or null if no such observer has been established.

getViewDistanceObserver

Returns a reference to the Java object that observes view distance events, or null if no such observer has been established.

getViewerType

Returns a string indicating whether the current Autodesk MapGuide Viewer is the ActiveX Control, Java Edition, or the Autodesk MapGuide Viewer Plug-In.

getWidth

Gets the current width of the map in the specified unit of measure.

isBusy

Returns True if Autodesk MapGuide Viewer is busy loading or drawing the map.

lonLatToMcs

Converts the specified lat/lon coordinate pair to a point using the map coordinate system (MCS) defined for the MWF by the map author.

mcsToLonLat

Converts the specified Mapping Coordinate System (MCS) coordinate pair to lat/lon coordinates.

pageSetupDlg

Displays the Page Setup dialog box, where the user can specify preferences for printing the map.

panMode

Switches to Pan mode.

preferencesDlg

Displays the Preferences dialog box, where the user can specify the map units, selection mode, and options for the status bar.

printDlg

Uses the page setup properties, then displays the Print dialog box.

redrawExtent

Redraws the specified portion of the map.

redrawLegend

Redraws the map legend.

refresh

Refreshes (redraws) the map.

removeMapLayer

Removes the specified map layer from the map.

removeMapLayerGroup

Removes the specified map layer group from the map.

saveMWF

Saves the map to a local MWF.

selectMapObjectsDlg

Displays the Select Map Features dialog box, where the user can select map features by name from a specific map layer.

selectMode

Switches to Select mode.

selectPolygon

Selects all map features that fall within the specified polygon.

selectPolygonEx

Selects all map features that fall within the specified polygon.

selectPolygonMode

Enters the select polygon mode.

selectRadius

Selects all map features that fall within the specified radius.

selectRadiusMode

Selects Select Radius mode.

selectWithin

Selects features from the specified map layers that fall within the currently selected polygon map features.

selectWithinDlg

Displays the Select Within dialog box, where the user chooses the map layer containing the features that will be selected if they fall within the currently selected features.

setAutoLinkDelay

Sets the number of seconds before the next HTML page associated with a map feature from the AutoLinkLayer will be displayed in the AutoLinkTarget window.

setAutoLinkLayers

Sets the name of the layer that will use the AutoLink feature.

setAutoLinkTarget

Sets the name of the target window where Autodesk MapGuide will display the HTML pages associated with map features on the AutoLinkLayer.

setAutoRefresh

Enables or disables the automatic refresh flag.

setBusyStateChangedObserver

Activates the Java object that observes the Autodesk MapGuide Viewer busy state.

setDefaultTarget

Sets the name of the default target window where Autodesk MapGuide will display HTML documents.

setDoubleClickObserver

Sets the Java object for observing double-click events.

setErrorTarget

Sets the name of the target window where Autodesk MapGuide will display error messages.

setIntermediateUpdatesEnabled

Specifies whether or not the map window should update every 1.5 seconds during a drawing operation or only at the end of the operation when all data has been loaded and rendered.

setMapLoadedObserver

Activates the Java object that observes when Autodesk MapGuide loads MWFs, enabling the onMapLoaded event.

setName

Sets the name of the current map.

setObjectLinkTarget

Sets the name of the target window where Autodesk MapGuide will display the URL associated with a map feature.

setPrintingObserver

Sets the Java object that observes printing events.

setReportTarget

Sets the name of the target window where Autodesk MapGuide will display reports from View Reports command.

setScale

Sets the current map display scale in terms of 1:scale.

setSelectionChangedObserver

Sets the Java object for observing selection change events.

setSelectionMode

Sets the selection mode, which controls how map features are selected when a feature is not fully contained in the selection area.

setTrackingID

Sets the customer tracking ID associated with a map.

setUrl

Sets the URL of the map to display.

setUrlListState

Enables or disables automatic generation of an HTML document listing the names and URLs of map features associated with URLs.

setUrlListTarget

Sets the name of the target window where Autodesk MapGuide will display the names and URLs associated with a map feature as the user pauses the mouse pointer over that feature.

setViewChangedObserver

Sets the Java object for observing view change events.

setViewChangingObserver

Sets the Java object for observing view change events.

setViewDistanceExObserver

Sets the Java object for observing view distance events.

setViewDistanceObserver

Sets the Java object for view distance events.

setWidth

Sets the current width of the map in the specified unit of measure.

stop

Aborts any downloading or redrawing that is currently taking place. Used for ActiveX Control and Plug-In Viewers only.

stopEx

Aborts any downloading or redrawing that is currently taking place. Used for Java Edition only.

viewBuffer

Creates buffers around the selected map features.

viewBufferDlg

Displays the View Buffer dialog box, where the user specifies the settings for creating the buffers.

viewDistance

Enters View Distance mode and fires the onViewedDistance event when complete.

viewDistanceEx

Enters View Distance mode and fires the onViewedDistanceEx event when complete.

viewReport

Invokes the specified report as authored in the map window.

viewReportsDlg

Displays the View Reports dialog box, where the user selects the report to display.

zoomGotoDlg

Displays the Zoom Goto dialog box, where the user specifies the zoom width as well as either a place (location), an address, or a ZIP code to zoom to.

zoomGotoLocation

Zooms to the specified category, location, and scale.

zoomInMode

Enters ZoomIn mode.

zoomOut

Zooms to the full extent of the map window as defined in the map window properties.

zoomOutMode

Enters the ZoomOut mode.

zoomPrevious

Sets the current view of the map back to the previous view of the map.

zoomScale

Zooms to the specified map center (lat/lon) and scale.

zoomScaleDlg

Displays the Zoom Scale dialog box, where the user enters the scale to zoom to.

zoomSelected

Zooms to an extent covering the selected map features.

zoomWidth

Zooms to the specified map center and width.

zoomWidthDlg

Displays the Zoom Width dialog box, where the user enters the width of the map window to zoom to.

Properties

Note that direct access to properties is only available in Autodesk MapGuide Viewer ActiveX Control. In Autodesk MapGuide Viewer Plug-In and Autodesk MapGuide Viewer, Java Edition APIs, get/set methods provide access to an object's properties. For compatibility, the ActiveX Control API supports the same get/set methods as the Autodesk MapGuide Viewer Plug-In and the Autodesk MapGuide Viewer, Java Edition APIs.

ApiVersion

Gets the API version for Autodesk MapGuide ActiveX Control.

AutoLinkDelay

Gets or sets the number of seconds before the next HTML page associated with a map feature from an AutoLinkLayer will be displayed in the AutoLinkTarget window.

AutoLinkLayers

Gets or sets the name of the layer that you want to use as the AutoLink layer.

AutoLinkTarget

Gets or sets the name of the target window where Autodesk MapGuide will display the HTML pages associated with map features on AutoLinkLayers as the user pauses the mouse pointer over those map features.

AutoRefresh

Gets or sets the automatic refresh flag.

BufferSetup

An object that contains buffering properties, such as the distance from the selected features to the edge of the buffers.

Busy

True if Autodesk MapGuide Viewer is busy loading or drawing a map.

DefaultTarget

Gets or sets the name of the default target window where Autodesk MapGuide will display HTML documents.

DisplayUnits

Gets the current display units, either M (meters), KM (kilometers), FT (feet), or MI (miles), as seen in the map width on the status bar.

ErrorTarget

Gets or sets the name of the target window where Autodesk MapGuide will display error messages.

FullUrl

Gets the full URL of the map that is currently displayed by Autodesk MapGuide, including parameters specifying the current location and any non-default options.

IntermediateUpdatesEnabled

Specifies whether or not the map window should update every 1.5 seconds during a drawing operation or only at the end when all data has been loaded and rendered.

LastError

The MGError object that contains the error value and message for the most recent API error.

Lat

Gets or sets the latitude (Y) value in decimal degrees of the center of the map area currently displayed.

LayersViewWidth

Gets or sets the width of the legend. In order to change this property at runtime, it must be non-zero when the MGMap object is created.

Lon

Gets or sets the longitude (X) value in decimal degrees of the center of the map area currently displayed.

MapHeight

The height of the map. This value is expressed in the units set with the MapUnits property.

MapLayerGroups

A collection containing all the map layer groups defined in the map.

MapLayers

A collection containing all the map layers defined in the map.

MapName

Gets or sets the name of the map.

MapScale

Gets or sets the current map display scale in terms of 1:scale.

MapUnits

Gets or sets the current units that will be used when getting or setting the MapWidth property, either M (meters), KM (kilometers), FT (feet), or MI (miles).

MapWidth

Gets or sets the current map width.

McsScaleFactor

The conversion factor used to convert from the current Mapping Coordinate System (MCS) to meters.

Mode

Gets the current viewer mode of the map, such as ZoomIn, Digitize, Pan, and so on.

ObjectLinkTarget

Gets or sets the name of the target window where Autodesk MapGuide will display the URL associated with a map feature.

PageSetup

An object that contains properties used for printing maps.

RedlineSetup

Gets an object containing all properties for drawing redline features.

ReportTarget

Gets or sets the name of the target window where Autodesk MapGuide will display reports from View Reports command.

Selection

The currently selected map features.

SelectionMode

Gets or sets the selection mode, either Centroid or Intersection.

StatusBar

Gets or sets the state of the status bar, either Off or On.

Symbols

Gets a collection of strings representing the symbols available for use as point attributes.

ToolBar

Gets or sets the state of the toolbar, either Off, On, or Big.

TrackingID

The customer tracking ID associated with a map.

Url

Gets or sets the URL of the map that is currently displayed by Autodesk MapGuide.

UrlListState

Specifies whether Autodesk MapGuide will generate an HTML document that lists the names and URLs (if any) that are associated with the selected map feature(s).

UrlListTarget

Gets or sets the name of the target window where Autodesk MapGuide will display the names and URLs of map features associated with URLs.

Version

The version string of Autodesk MapGuide Viewer.

ViewerType

A string indicating whether the Autodesk MapGuide Viewer is the Autodesk MapGuide Viewer ActiveX Control, the Autodesk MapGuide Viewer Plug-In, or the Autodesk MapGuide Viewer, Java Edition.