diff options
author | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2014-08-12 21:56:44 +0200 |
commit | ea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch) | |
tree | af67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/lib/OpenLayers/Strategy.js | |
parent | 59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff) | |
download | postrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip |
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/lib/OpenLayers/Strategy.js')
-rw-r--r-- | misc/openlayers/lib/OpenLayers/Strategy.js | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/misc/openlayers/lib/OpenLayers/Strategy.js b/misc/openlayers/lib/OpenLayers/Strategy.js new file mode 100644 index 0000000..113deb1 --- /dev/null +++ b/misc/openlayers/lib/OpenLayers/Strategy.js @@ -0,0 +1,121 @@ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/BaseTypes/Class.js + */ + +/** + * Class: OpenLayers.Strategy + * Abstract vector layer strategy class. Not to be instantiated directly. Use + * one of the strategy subclasses instead. + */ +OpenLayers.Strategy = OpenLayers.Class({ + + /** + * Property: layer + * {<OpenLayers.Layer.Vector>} The layer this strategy belongs to. + */ + layer: null, + + /** + * Property: options + * {Object} Any options sent to the constructor. + */ + options: null, + + /** + * Property: active + * {Boolean} The control is active. + */ + active: null, + + /** + * Property: autoActivate + * {Boolean} The creator of the strategy can set autoActivate to false + * to fully control when the protocol is activated and deactivated. + * Defaults to true. + */ + autoActivate: true, + + /** + * Property: autoDestroy + * {Boolean} The creator of the strategy can set autoDestroy to false + * to fully control when the strategy is destroyed. Defaults to + * true. + */ + autoDestroy: true, + + /** + * Constructor: OpenLayers.Strategy + * Abstract class for vector strategies. Create instances of a subclass. + * + * Parameters: + * options - {Object} Optional object whose properties will be set on the + * instance. + */ + initialize: function(options) { + OpenLayers.Util.extend(this, options); + this.options = options; + // set the active property here, so that user cannot override it + this.active = false; + }, + + /** + * APIMethod: destroy + * Clean up the strategy. + */ + destroy: function() { + this.deactivate(); + this.layer = null; + this.options = null; + }, + + /** + * Method: setLayer + * Called to set the <layer> property. + * + * Parameters: + * layer - {<OpenLayers.Layer.Vector>} + */ + setLayer: function(layer) { + this.layer = layer; + }, + + /** + * Method: activate + * Activate the strategy. Register any listeners, do appropriate setup. + * + * Returns: + * {Boolean} True if the strategy was successfully activated or false if + * the strategy was already active. + */ + activate: function() { + if (!this.active) { + this.active = true; + return true; + } + return false; + }, + + /** + * Method: deactivate + * Deactivate the strategy. Unregister any listeners, do appropriate + * tear-down. + * + * Returns: + * {Boolean} True if the strategy was successfully deactivated or false if + * the strategy was already inactive. + */ + deactivate: function() { + if (this.active) { + this.active = false; + return true; + } + return false; + }, + + CLASS_NAME: "OpenLayers.Strategy" +}); |