first import
This commit is contained in:
34
sites/all/modules/openlayers/docs/JAVASCRIPT.txt
Normal file
34
sites/all/modules/openlayers/docs/JAVASCRIPT.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
Current for 6.x-2.0-alpha3
|
||||
|
||||
The OpenLayers module aims to add minimal abstraction in Javascript to what is
|
||||
already provided by the [OpenLayers](http://openlayers.org/) Javascript library.
|
||||
However, it does create certain structures that may not be immediately obvious.
|
||||
|
||||
# Data Storage
|
||||
|
||||
The module stores all settings initially under Drupal.settings.openlayers. It
|
||||
does this in a slightly modified way if your server supports native JSON writing
|
||||
- this basically means that, instead of using Drupal to encode the settings
|
||||
array, it uses a PHP extension (written in C). This greatly increases
|
||||
performance for displaying many points on maps.
|
||||
|
||||
# Keeping Track of Maps
|
||||
|
||||
The OpenLayers map object, which contains pointers to all layers, etc., is
|
||||
stored with the [jQuery data() method](http://api.jquery.com/jQuery.data/),
|
||||
which provides the phenomenal convenience of storing arbitrary data within the
|
||||
DOM itself. This means that the map object is attached to the openlayers-map-0,
|
||||
or so on, div element in your page. So, to access it, one could use a line like
|
||||
|
||||
$('#openlayers-map-0').data('openlayers')
|
||||
|
||||
In FireBug, Safari, or Chrome.
|
||||
|
||||
Note that the 2.x branch strives to not duplicate map information: it exists in
|
||||
the Drupal settings array and then is transformed into a map object, but after
|
||||
that point, the canonical location for data about maps is in the map object.
|
||||
This is for purposes of both flexibility, since the map object lets developers
|
||||
access objects by better getter methods, and for the purpose of keeping
|
||||
OpenLayers behaviors and layer initialization code less tied to Drupal than
|
||||
before.
|
||||
Reference in New Issue
Block a user