====== 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()'' and ''removeNewViewListener()'' to add or remove listeners for new view events. General view-related functions are : * ''getViewWidth()'' and ''getViewHeight()'' to retrieve pixel size of the view * ''getViewBoundingBox()'' 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()'' and ''panDown()'' 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 [[flashmap:configuration:map|map configuration file]]. You can also zoom to : * ''zoomToSelection()'': All Selected objects * ''zoomToActiveSelection()'': Active selected object * ''zoomToFocus()'': 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()'' and ''nextZoom()'' functions and * Query whether previous or next views are available using the ''hasPreviousZoom()'' and ''hasNextZoom()'' 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 [[examples#loading_a_custom_first_view|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 [[flashmap:publicinterface:examples#copy_view_to_clipboard|copy to clipboard using JS]]).