OpenLayers. Protocol. SQL. Gears

This Protocol stores feature in the browser via the Gears Database module http://code.google.com- /apis- /gears- /api_database.html.

The main advantage is that all the read, create, update and delete operations can be done offline.

Inherits from

Summary
OpenLayers. Protocol. SQL. GearsThis Protocol stores feature in the browser via the Gears Database module http://code.google.com- /apis- /gears- /api_database.html.
Constructor
OpenLayers. Protocol. SQL. Gears
Functions
destroyClean up the protocol.
supportedDetermine whether a browser supports Gears
readRead all features from the database and return a OpenLayers.Protocol.Response instance.
createCreate new features into the database.
updateConstruct a request updating modified feature.
deleteDelete features from the database.
commitGo over the features and for each take action based on the feature state.

Constructor

OpenLayers. Protocol. SQL. Gears

Functions

destroy

destroy: function()

Clean up the protocol.

supported

supported: function()

Determine whether a browser supports Gears

Returns

{Boolean} The browser supports Gears

read

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.

Parameters

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.

Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.

create

create: function(features,
options)

Create new features into the database.

Parameters

features{Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features to create in the database.
options{Object} Optional object for configuring the request.

Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.

update

update: function(features,
options)

Construct a request updating modified feature.

Parameters

features{Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features to update in the database.
options{Object} Optional object for configuring the request.

Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.

delete

"delete": function(features,
options)

Delete features from the database.

Parameters

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.

Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object.

commit

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.

Parameters

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.

Returns

{Array({OpenLayers.Protocol.Response})} An array of OpenLayers.Protocol.Response objects, one per request made to the database.

destroy: function()
Clean up the protocol.
supported: function()
Determine whether a browser supports Gears
read: function(options)
Read all features from the database and return a OpenLayers.Protocol.Response instance.
Protocols return Response objects to their users.
create: function(features,
options)
Create new features into the database.
update: function(features,
options)
Construct a request updating modified feature.
"delete": function(features,
options)
Delete features from the database.
commit: function(features,
options)
Go over the features and for each take action based on the feature state.
Abstract SQL protocol class.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close