For documentation on the current version, please check Knowledge Base.
Viewing
These functions allow you to get info on the current view definition and do something with the view. The following can be used to install a listener on user-initiated view events :
addNewViewListener()andremoveNewViewListener()to add or remove listeners for new view events.
General view-related functions are :
getViewWidth()andgetViewHeight()to retrieve pixel size of the viewgetViewBoundingBox()to retrieve the system bounds of the current view.loadNewView()to force reloading of the view.
Panning
The following functions can be used to pan (factor is 1/4) :
- Use
panLeft(),panRight(),panUp()andpanDown()to pan horizonally or vertically. - Use
panUpLeft()panUpRight()panDownLeft()panDownRight()to pan diagonally.
Zoom
You can control the view's zoom level by using the getScaleRangePosition() and setScaleRangePosition() functions. (the scale indicator ranges between 0 (zoomed in) and 1 (zoomed out)). Minimum and maximum scales are defined in the FlashMap map configuration file.
You can also zoom to :
zoomToSelection(): All Selected objectszoomToActiveSelection(): Active selected objectzoomToFocus(): Focus rectangle (See focus info)zoomToExtent(): Full extent (full zoomout)zoomToBoundingBox(): The given bounds (takes object with minX, maxX, minY, maxY fields)
Be aware that these functions won't exceed the scale limits.
All of these functions (except the zoomToFocus() and zoomToBoundingBox() which are explicit) are subject to a zoom margin parameter. This parameter, defined in system units, defines an extra margin when zooming to something. It is 0 by default and can be set or retrieved by using the setZoomToMargin() and getZoomToMargin() functions.
Zoom History
You can access OFM's zoom history or navigate between them by using these functions :
- Zoom to previous or next views using the
previousZoom()andnextZoom()functions and - Query whether previous or next views are available using the
hasPreviousZoom()andhasNextZoom()functions.
Taking over First View
The first view is often the most important one. By default, OFM zooms to a full overview of the available map data, but there are other options :
- You can use a FlashMap Startup Operation. A startup operation can return a set of bounds, which OFM will then use as initial bounds. For example you may tell the operation to select some objects and then return the extent to OFM.
- You can force OFM to skip the first view and then later on set the bounds manually.
See here for an example of telling OFM to skip the first view and then setting it yourself.
Extra
printMap(): Print the current view. This directly opens a print dialog and prints the view, to a page.getViewURL(format)to retrieve a URL leading to an image of the current view. (Can for example be used to copy to clipboard using JS).