Events are used to plug into the map rendering process or events that happen as the map is interfaced with. Events can be defined for the map itself or for specific layers. For example:
$map_array = array(
'events' => array(
'beforeCenter' => array('customCallback'),
)
'layers' = array(
'default_vector' => array(
'events' => array(
'moveend' => array('customModuleLoadSomeData','customModuleDoSomethingElse'),
'zoomend' => array('customModuleLoadSomeData'),
),
),
),
);
Basically, on the PHP side, you are simply defining JS callbacks to be used.
Rendering Events
The following are custom rendering event points provided by the OpenLayers module:
- beforeEverything
- Executed as soon as possible for each map. The OpenLayers map object is not yet built.
- beforeLayers
- After the map object is built, but before layers are created and added.
- beforeCenter
- Before the map is zoomed and centered.
- beforeControls
- Before controls are added to the map
- beforeEvents
- Before events are added to the map
- beforeBehaviors
- Before behaviors are triggered
- mapReady
- Last call
OpenLayers Map Events
The OpenLayers map object has built-in events. See the supported map event types.
OpenLayers Layer Events
The OpenLayers layer object has built-in events. Here are a few links to some of the common layer types and events available to them: