This Protocol stores feature in the browser via the Gears Database module http://code.google.com
The main advantage is that all the read, create, update and delete operations can be done offline.
OpenLayers. | This Protocol stores feature in the browser via the Gears Database module http://code.google.com |
Constructor | |
OpenLayers. | |
Functions | |
destroy | Clean up the protocol. |
supported | Determine whether a browser supports Gears |
read | Read all features from the database and return a OpenLayers.Protocol.Response instance. |
create | Create new features into the database. |
update | Construct a request updating modified feature. |
delete | Delete features from the database. |
commit | Go over the features and for each take action based on the feature state. |
read: function( options )
Read all features from the database and return a OpenLayers.Protocol.Response instance. If the options parameter contains a callback attribute, the function is called with the response as a parameter.
options | {Object} Optional object for configuring the request; it can have the {Boolean} property “noFeatureStateReset” which specifies if the state of features read from the Gears database must be reset to null, if “noFeatureStateReset” is undefined or false then each feature’s state is reset to null, if “noFeatureStateReset” is true the feature state is preserved. |
{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.
create: function( features, options )
Create new features into the database.
features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features to create in the database. |
options | {Object} Optional object for configuring the request. |
{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.
update: function( features, options )
Construct a request updating modified feature.
features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features to update in the database. |
options | {Object} Optional object for configuring the request. |
{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.
"delete": function( features, options )
Delete features from the database.
features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} |
options | {Object} Optional object for configuring the request. This object is modified and should not be reused. |
{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.
commit: function( features, options )
Go over the features and for each take action based on the feature state. Possible actions are create, update and delete.
features | {Array({OpenLayers.Feature.Vector})} |
options | {Object} Object whose possible keys are “create”, “update”, “delete”, “callback” and “scope”, the values referenced by the first three are objects as passed to the “create”, “update”, and “delete” methods, the value referenced by the “callback” key is a function which is called when the commit operation is complete using the scope referenced by the “scope” key. |
{Array({OpenLayers.Protocol.Response})} An array of OpenLayers.Protocol.Response objects, one per request made to the database.
Clean up the protocol.
destroy: function()
Determine whether a browser supports Gears
supported: function()
Read all features from the database and return a OpenLayers.Protocol.Response instance.
read: function( options )
Create new features into the database.
create: function( features, options )
Construct a request updating modified feature.
update: function( features, options )
Delete features from the database.
"delete": function( features, options )
Go over the features and for each take action based on the feature state.
commit: function( features, options )