AfterMapMoveEvent RPC
Notifies that map has been moved or zoomed.
Description
Event is used to notify that map has been moved or zoomed.
Parameters
(* means the parameter is required)
Name | Type | Description | Default value |
---|---|---|---|
\* centerX | Number | longitude of map center | |
\* centerY | Number | latitude of map center | |
\* zoom | Number | map zoomlevel (0-12) | |
\* scale | Number | map scale | |
\* camera | Object | camera orientation for 3d maps |
RPC
Event occurs after a map has been moved or zoomed.
{
"centerX": 411650.70779123,
"centerY": 6751897.3481153,
"zoom": 4,
"scale": 362834
}
Event methods
getName()
Returns name of the event
getCenterX()
Returns map center x coordinate
getCenterY()
Returns map center y coordinate
getZoom()
Returns map zoom level
getScale()
Returns map scale
getCamera()
Returns object for camera orientation containing heading, pitch and roll. (Only in 3d map)
getParams()
Returns all the parameters of the event as an object:
{
centerX: me._centerX,
centerY: me._centerY,
zoom: me._zoom,
scale: me._scale
};
Examples
Mapmodule.ol catches map move and sends AfterMapMoveEvent:
map.on('moveend', function(evt) {
var map = evt.map;
var extent = map.getView().calculateExtent(map.getSize());
var center = map.getView().getCenter();
sandbox.getMap().setMoving(false);
sandbox.printDebug("sending AFTERMAPMOVE EVENT from map Event handler");
var lonlat = map.getView().getCenter();
me.updateDomain();
var sboxevt = sandbox.getEventBuilder('AfterMapMoveEvent')(lonlat[0], lonlat[1], map.getView().getZoom(), me.getMapScale());
sandbox.notifyAll(sboxevt);
});